summaryrefslogtreecommitdiffstats
path: root/WebCore
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-02-15 12:23:52 +0000
committerSteve Block <steveblock@google.com>2010-02-16 11:48:32 +0000
commit8a0914b749bbe7da7768e07a7db5c6d4bb09472b (patch)
tree73f9065f370435d6fde32ae129d458a8c77c8dff /WebCore
parentbf14be70295513b8076f3fa47a268a7e42b2c478 (diff)
downloadexternal_webkit-8a0914b749bbe7da7768e07a7db5c6d4bb09472b.zip
external_webkit-8a0914b749bbe7da7768e07a7db5c6d4bb09472b.tar.gz
external_webkit-8a0914b749bbe7da7768e07a7db5c6d4bb09472b.tar.bz2
Merge webkit.org at r54731 : Initial merge by git
Change-Id: Ia79977b6cf3b0b00c06ef39419989b28e57e4f4a
Diffstat (limited to 'WebCore')
-rw-r--r--WebCore/Android.derived.v8bindings.mk45
-rw-r--r--WebCore/ChangeLog3768
-rw-r--r--WebCore/Configurations/FeatureDefines.xcconfig3
-rw-r--r--WebCore/Configurations/Version.xcconfig4
-rw-r--r--WebCore/DerivedSources.make4
-rw-r--r--WebCore/English.lproj/localizedStrings.jsbin32762 -> 32876 bytes
-rw-r--r--WebCore/ForwardingHeaders/runtime/WeakGCPtr.h4
-rw-r--r--WebCore/ForwardingHeaders/wtf/ValueCheck.h4
-rw-r--r--WebCore/GNUmakefile.am28
-rw-r--r--WebCore/WebCore.base.exp6
-rw-r--r--WebCore/WebCore.gypi20
-rw-r--r--WebCore/WebCore.pri1
-rw-r--r--WebCore/WebCore.pro54
-rw-r--r--WebCore/WebCore.vcproj/WebCore.make2
-rw-r--r--WebCore/WebCore.vcproj/WebCore.vcproj38
-rw-r--r--WebCore/WebCore.xcodeproj/project.pbxproj40
-rw-r--r--WebCore/WebCorePrefix.h1
-rw-r--r--WebCore/accessibility/chromium/AXObjectCacheChromium.cpp24
-rw-r--r--WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp12
-rw-r--r--WebCore/bindings/ScriptControllerBase.cpp1
-rw-r--r--WebCore/bindings/generic/BindingDOMWindow.h9
-rw-r--r--WebCore/bindings/generic/BindingElement.h102
-rw-r--r--WebCore/bindings/generic/RuntimeEnabledFeatures.cpp98
-rw-r--r--WebCore/bindings/generic/RuntimeEnabledFeatures.h (renamed from WebCore/bindings/v8/RuntimeEnabledFeatures.h)37
-rw-r--r--WebCore/bindings/js/JSAbstractWorkerCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSBindingsAllInOne.cpp1
-rw-r--r--WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSDOMBinding.cpp8
-rw-r--r--WebCore/bindings/js/JSDOMBinding.h25
-rw-r--r--WebCore/bindings/js/JSDOMWindowCustom.cpp14
-rw-r--r--WebCore/bindings/js/JSEventListener.cpp8
-rw-r--r--WebCore/bindings/js/JSEventListener.h47
-rw-r--r--WebCore/bindings/js/JSEventSourceCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSInjectedScriptHostCustom.cpp20
-rw-r--r--WebCore/bindings/js/JSLazyEventListener.cpp71
-rw-r--r--WebCore/bindings/js/JSLazyEventListener.h11
-rw-r--r--WebCore/bindings/js/JSMessagePortCustom.cpp6
-rw-r--r--WebCore/bindings/js/JSNodeCustom.cpp6
-rw-r--r--WebCore/bindings/js/JSSVGElementInstanceCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSSVGMatrixCustom.cpp16
-rw-r--r--WebCore/bindings/js/JSSVGPODTypeWrapper.h6
-rw-r--r--WebCore/bindings/js/JSWebSocketCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSWorkerContextCustom.cpp6
-rw-r--r--WebCore/bindings/js/JSXMLHttpRequestCustom.cpp6
-rw-r--r--WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp6
-rw-r--r--WebCore/bindings/js/ScriptArray.cpp4
-rw-r--r--WebCore/bindings/js/ScriptController.cpp5
-rw-r--r--WebCore/bindings/js/ScriptDebugServer.cpp49
-rw-r--r--WebCore/bindings/js/ScriptDebugServer.h46
-rw-r--r--WebCore/bindings/js/ScriptEventListener.cpp20
-rw-r--r--WebCore/bindings/js/ScriptFunctionCall.cpp8
-rw-r--r--WebCore/bindings/js/ScriptFunctionCall.h2
-rw-r--r--WebCore/bindings/js/ScriptObject.cpp4
-rw-r--r--WebCore/bindings/js/ScriptString.h2
-rw-r--r--WebCore/bindings/js/ScriptValue.cpp12
-rw-r--r--WebCore/bindings/js/ScriptValue.h5
-rw-r--r--WebCore/bindings/js/SerializedScriptValue.cpp49
-rw-r--r--WebCore/bindings/js/SerializedScriptValue.h14
-rw-r--r--WebCore/bindings/scripts/CodeGenerator.pm23
-rw-r--r--WebCore/bindings/scripts/CodeGeneratorJS.pm16
-rw-r--r--WebCore/bindings/scripts/CodeGeneratorObjC.pm6
-rw-r--r--WebCore/bindings/scripts/CodeGeneratorV8.pm208
-rw-r--r--WebCore/bindings/v8/NPV8Object.cpp2
-rw-r--r--WebCore/bindings/v8/ScheduledAction.cpp6
-rw-r--r--WebCore/bindings/v8/ScriptArray.cpp4
-rw-r--r--WebCore/bindings/v8/ScriptDebugServer.cpp (renamed from WebCore/bindings/v8/RuntimeEnabledFeatures.cpp)21
-rw-r--r--WebCore/bindings/v8/ScriptDebugServer.h46
-rw-r--r--WebCore/bindings/v8/ScriptFunctionCall.cpp8
-rw-r--r--WebCore/bindings/v8/ScriptFunctionCall.h2
-rw-r--r--WebCore/bindings/v8/ScriptObject.cpp4
-rw-r--r--WebCore/bindings/v8/ScriptState.h2
-rwxr-xr-x[-rw-r--r--]WebCore/bindings/v8/ScriptValue.cpp14
-rw-r--r--WebCore/bindings/v8/ScriptValue.h6
-rw-r--r--WebCore/bindings/v8/V8Binding.cpp8
-rw-r--r--WebCore/bindings/v8/V8Binding.h7
-rw-r--r--WebCore/bindings/v8/V8DOMWindowShell.cpp9
-rw-r--r--WebCore/bindings/v8/V8DOMWindowShell.h5
-rw-r--r--WebCore/bindings/v8/V8DOMWrapper.cpp48
-rw-r--r--WebCore/bindings/v8/V8DOMWrapper.h6
-rw-r--r--WebCore/bindings/v8/V8Index.cpp26
-rw-r--r--WebCore/bindings/v8/V8Index.h11
-rw-r--r--WebCore/bindings/v8/V8NPObject.cpp1
-rw-r--r--WebCore/bindings/v8/V8Proxy.cpp2
-rw-r--r--WebCore/bindings/v8/V8Utilities.cpp1
-rw-r--r--WebCore/bindings/v8/V8WorkerContextEventListener.cpp7
-rw-r--r--WebCore/bindings/v8/WorkerContextExecutionProxy.cpp191
-rw-r--r--WebCore/bindings/v8/WorkerContextExecutionProxy.h18
-rw-r--r--WebCore/bindings/v8/custom/V8AbstractWorkerCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8AttrCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8ClipboardCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8CoordinatesCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8CustomBinding.h51
-rw-r--r--WebCore/bindings/v8/custom/V8DOMApplicationCacheCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp113
-rw-r--r--WebCore/bindings/v8/custom/V8DataGridColumnListCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8DatabaseCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8DocumentCustom.cpp6
-rw-r--r--WebCore/bindings/v8/custom/V8ElementCustom.cpp21
-rw-r--r--WebCore/bindings/v8/custom/V8EventSourceConstructor.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8EventSourceCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8GeolocationCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp40
-rwxr-xr-xWebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.h4
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLDataGridElementCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp2
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLFrameElementCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLIFrameElementCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp40
-rwxr-xr-xWebCore/bindings/v8/custom/V8HTMLImageElementConstructor.h10
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp40
-rwxr-xr-xWebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.h10
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8HistoryCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp17
-rw-r--r--WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8LocationCustom.cpp7
-rw-r--r--WebCore/bindings/v8/custom/V8MessageEventCustom.cpp2
-rw-r--r--WebCore/bindings/v8/custom/V8MessagePortCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8NavigatorCustom.cpp13
-rw-r--r--WebCore/bindings/v8/custom/V8NodeCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8NodeFilterCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp7
-rw-r--r--WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8SVGDocumentCustom.cpp2
-rw-r--r--WebCore/bindings/v8/custom/V8SVGElementInstanceCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8SVGMatrixCustom.cpp20
-rw-r--r--WebCore/bindings/v8/custom/V8SharedWorkerCustom.cpp1
-rwxr-xr-xWebCore/bindings/v8/custom/V8StorageCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLArrayBufferCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLArrayCustom.h1
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLByteArrayCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLFloatArrayCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLIntArrayCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLShortArrayCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp1
-rwxr-xr-xWebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp1
-rwxr-xr-xWebCore/bindings/v8/custom/V8WorkerContextCustom.cpp26
-rwxr-xr-xWebCore/bindings/v8/custom/V8WorkerCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8XMLHttpRequestUploadCustom.cpp1
-rw-r--r--WebCore/bridge/IdentifierRep.h3
-rw-r--r--WebCore/bridge/NP_jsobject.cpp7
-rw-r--r--WebCore/bridge/c/c_instance.h2
-rw-r--r--WebCore/bridge/c/c_runtime.cpp2
-rw-r--r--WebCore/bridge/jni/JNIBridge.cpp8
-rw-r--r--WebCore/bridge/jni/jsc/JavaClassJSC.cpp8
-rw-r--r--WebCore/bridge/jni/jsc/JavaInstanceJSC.h8
-rw-r--r--WebCore/bridge/jni/v8/JavaInstanceV8.h8
-rw-r--r--WebCore/css/CSSFontFaceSource.cpp8
-rw-r--r--WebCore/css/CSSFontSelector.cpp2
-rw-r--r--WebCore/css/CSSImportRule.cpp8
-rw-r--r--WebCore/css/CSSParser.cpp282
-rw-r--r--WebCore/css/CSSPrimitiveValueMappings.h66
-rw-r--r--WebCore/css/CSSStyleSheet.h22
-rw-r--r--WebCore/css/CSSValueKeywords.in22
-rw-r--r--WebCore/css/StyleBase.cpp4
-rw-r--r--WebCore/css/StyleSheet.cpp19
-rw-r--r--WebCore/css/StyleSheet.h19
-rw-r--r--WebCore/css/svg.css17
-rw-r--r--WebCore/dom/Clipboard.h1
-rw-r--r--WebCore/dom/Document.cpp17
-rw-r--r--WebCore/dom/Document.h6
-rw-r--r--WebCore/dom/Element.cpp6
-rw-r--r--WebCore/dom/Element.h1
-rw-r--r--WebCore/dom/EventListener.h2
-rw-r--r--WebCore/dom/EventTarget.h16
-rw-r--r--WebCore/dom/Position.cpp2
-rw-r--r--WebCore/dom/ProcessingInstruction.cpp4
-rw-r--r--WebCore/editing/Editor.cpp14
-rw-r--r--WebCore/editing/EditorCommand.cpp2
-rw-r--r--WebCore/editing/InsertParagraphSeparatorCommand.cpp24
-rw-r--r--WebCore/editing/ReplaceSelectionCommand.cpp56
-rw-r--r--WebCore/editing/ReplaceSelectionCommand.h1
-rw-r--r--WebCore/editing/htmlediting.cpp17
-rw-r--r--WebCore/editing/htmlediting.h3
-rw-r--r--WebCore/html/HTMLCanvasElement.cpp4
-rw-r--r--WebCore/html/HTMLCanvasElement.h4
-rw-r--r--WebCore/html/HTMLEmbedElement.cpp8
-rw-r--r--WebCore/html/HTMLFormCollection.cpp1
-rw-r--r--WebCore/html/HTMLInputElement.cpp188
-rw-r--r--WebCore/html/HTMLInputElement.h9
-rw-r--r--WebCore/html/HTMLObjectElement.cpp10
-rw-r--r--WebCore/html/HTMLTagNames.in6
-rw-r--r--WebCore/html/HTMLTextAreaElement.cpp16
-rw-r--r--WebCore/html/HTMLTextAreaElement.h1
-rw-r--r--WebCore/html/canvas/CanvasPixelArray.h1
-rw-r--r--WebCore/inspector/InjectedScript.cpp27
-rw-r--r--WebCore/inspector/InjectedScript.h8
-rw-r--r--WebCore/inspector/InjectedScriptHost.cpp4
-rw-r--r--WebCore/inspector/InjectedScriptHost.h3
-rw-r--r--WebCore/inspector/InjectedScriptHost.idl4
-rw-r--r--WebCore/inspector/InspectorBackend.cpp18
-rw-r--r--WebCore/inspector/InspectorBackend.h5
-rw-r--r--WebCore/inspector/InspectorBackend.idl5
-rw-r--r--WebCore/inspector/InspectorController.cpp41
-rw-r--r--WebCore/inspector/InspectorController.h8
-rw-r--r--WebCore/inspector/InspectorDOMAgent.cpp6
-rwxr-xr-x[-rw-r--r--]WebCore/inspector/InspectorFrontend.cpp163
-rw-r--r--WebCore/inspector/InspectorFrontend.h19
-rw-r--r--WebCore/inspector/InspectorResource.cpp4
-rw-r--r--WebCore/inspector/InspectorResource.h2
-rw-r--r--WebCore/inspector/front-end/AuditCategories.js70
-rw-r--r--WebCore/inspector/front-end/AuditLauncherView.js11
-rw-r--r--WebCore/inspector/front-end/AuditRules.js1213
-rw-r--r--WebCore/inspector/front-end/AuditsPanel.js38
-rw-r--r--WebCore/inspector/front-end/CookieItemsView.js300
-rw-r--r--WebCore/inspector/front-end/DOMStorageItemsView.js21
-rw-r--r--WebCore/inspector/front-end/DataGrid.js74
-rw-r--r--WebCore/inspector/front-end/DatabaseQueryView.js1
-rw-r--r--WebCore/inspector/front-end/DatabaseTableView.js1
-rw-r--r--WebCore/inspector/front-end/ElementsTreeOutline.js4
-rw-r--r--WebCore/inspector/front-end/InjectedScript.js306
-rw-r--r--WebCore/inspector/front-end/InjectedScriptAccess.js2
-rw-r--r--WebCore/inspector/front-end/NativeTextViewer.js258
-rw-r--r--WebCore/inspector/front-end/ScriptView.js3
-rw-r--r--WebCore/inspector/front-end/Settings.js5
-rw-r--r--WebCore/inspector/front-end/SourceCSSTokenizer.re2js56
-rw-r--r--WebCore/inspector/front-end/SourceFrame.js425
-rw-r--r--WebCore/inspector/front-end/SourceView.js22
-rw-r--r--WebCore/inspector/front-end/StoragePanel.js56
-rw-r--r--WebCore/inspector/front-end/StylesSidebarPane.js17
-rw-r--r--WebCore/inspector/front-end/TextEditor.js1168
-rw-r--r--WebCore/inspector/front-end/TextEditorModel.js23
-rw-r--r--WebCore/inspector/front-end/TextViewer.js666
-rw-r--r--WebCore/inspector/front-end/WebKit.qrc7
-rw-r--r--WebCore/inspector/front-end/audits.css4
-rw-r--r--WebCore/inspector/front-end/inspector.css6
-rw-r--r--WebCore/inspector/front-end/inspector.html7
-rw-r--r--WebCore/inspector/front-end/inspector.js46
-rw-r--r--WebCore/inspector/front-end/textEditor.css90
-rw-r--r--WebCore/inspector/front-end/textViewer.css149
-rw-r--r--WebCore/inspector/front-end/utilities.js24
-rw-r--r--WebCore/loader/FrameLoader.cpp13
-rw-r--r--WebCore/loader/FrameLoader.h4
-rw-r--r--WebCore/loader/ImageLoader.cpp62
-rw-r--r--WebCore/loader/ImageLoader.h4
-rw-r--r--WebCore/loader/loader.cpp1
-rw-r--r--WebCore/manual-tests/drag-image-table-part-decorations.html3
-rw-r--r--WebCore/manual-tests/onbeforeunload-focused-iframe.html31
-rw-r--r--WebCore/manual-tests/resources/focused-iframe.html12
-rw-r--r--WebCore/manual-tests/win/horizontal-scroll-composited.html8
-rw-r--r--WebCore/page/Console.cpp13
-rw-r--r--WebCore/page/Console.idl3
-rw-r--r--WebCore/page/DOMWindow.idl2
-rw-r--r--WebCore/page/DragController.cpp14
-rw-r--r--WebCore/page/FrameView.cpp15
-rw-r--r--WebCore/page/PrintContext.cpp13
-rw-r--r--WebCore/page/PrintContext.h3
-rw-r--r--WebCore/page/SecurityOrigin.cpp9
-rw-r--r--WebCore/page/SecurityOrigin.h1
-rw-r--r--WebCore/page/Settings.cpp6
-rw-r--r--WebCore/page/Settings.h8
-rw-r--r--WebCore/page/brew/FrameBrew.cpp38
-rw-r--r--WebCore/page/chromium/ChromeClientChromium.h30
-rw-r--r--WebCore/page/win/FrameCGWin.cpp2
-rw-r--r--WebCore/platform/CookieJar.h2
-rw-r--r--WebCore/platform/DragImage.h7
-rw-r--r--WebCore/platform/Pasteboard.h1
-rw-r--r--WebCore/platform/PlatformMouseEvent.h10
-rw-r--r--WebCore/platform/ScrollView.cpp10
-rw-r--r--WebCore/platform/ScrollView.h2
-rw-r--r--WebCore/platform/Scrollbar.cpp9
-rw-r--r--WebCore/platform/Scrollbar.h14
-rw-r--r--WebCore/platform/ScrollbarTheme.h4
-rw-r--r--WebCore/platform/android/ClipboardAndroid.cpp4
-rw-r--r--WebCore/platform/android/ClipboardAndroid.h1
-rw-r--r--WebCore/platform/brew/CursorBrew.cpp320
-rw-r--r--WebCore/platform/brew/KURLBrew.cpp37
-rw-r--r--WebCore/platform/brew/PlatformMouseEventBrew.cpp85
-rw-r--r--WebCore/platform/chromium/ChromiumBridge.h1
-rw-r--r--WebCore/platform/chromium/ChromiumDataObject.cpp3
-rw-r--r--WebCore/platform/chromium/ChromiumDataObject.h1
-rw-r--r--WebCore/platform/chromium/ClipboardChromium.cpp22
-rw-r--r--WebCore/platform/chromium/ClipboardChromium.h1
-rw-r--r--WebCore/platform/chromium/PasteboardChromium.cpp8
-rw-r--r--WebCore/platform/chromium/ThemeChromiumMac.mm141
-rw-r--r--WebCore/platform/graphics/BitmapImage.h2
-rw-r--r--WebCore/platform/graphics/FloatPoint.cpp7
-rw-r--r--WebCore/platform/graphics/FloatPoint.h2
-rw-r--r--WebCore/platform/graphics/FloatSize.h7
-rw-r--r--WebCore/platform/graphics/FontCache.cpp17
-rw-r--r--WebCore/platform/graphics/FontCache.h15
-rw-r--r--WebCore/platform/graphics/GeneratedImage.cpp2
-rw-r--r--WebCore/platform/graphics/GeneratedImage.h2
-rw-r--r--WebCore/platform/graphics/Gradient.cpp7
-rw-r--r--WebCore/platform/graphics/Gradient.h10
-rw-r--r--WebCore/platform/graphics/GraphicsContext.h7
-rw-r--r--WebCore/platform/graphics/GraphicsContext3D.h2
-rw-r--r--WebCore/platform/graphics/Image.cpp6
-rw-r--r--WebCore/platform/graphics/Image.h4
-rw-r--r--WebCore/platform/graphics/ImageBuffer.h6
-rw-r--r--WebCore/platform/graphics/Path.h2
-rw-r--r--WebCore/platform/graphics/Pattern.cpp2
-rw-r--r--WebCore/platform/graphics/Pattern.h52
-rw-r--r--WebCore/platform/graphics/SimpleFontData.h14
-rw-r--r--WebCore/platform/graphics/cairo/FontCairo.cpp6
-rw-r--r--WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp26
-rw-r--r--WebCore/platform/graphics/cairo/ImageCairo.cpp4
-rw-r--r--WebCore/platform/graphics/cairo/PathCairo.cpp9
-rw-r--r--WebCore/platform/graphics/cairo/PatternCairo.cpp4
-rw-r--r--WebCore/platform/graphics/cg/GraphicsContextCG.cpp35
-rw-r--r--WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h19
-rw-r--r--WebCore/platform/graphics/cg/ImageBufferCG.cpp29
-rw-r--r--WebCore/platform/graphics/cg/ImageCG.cpp4
-rw-r--r--WebCore/platform/graphics/cg/PathCG.cpp10
-rw-r--r--WebCore/platform/graphics/cg/PatternCG.cpp6
-rw-r--r--WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp6
-rw-r--r--WebCore/platform/graphics/chromium/FontCacheLinux.cpp6
-rw-r--r--WebCore/platform/graphics/chromium/TransparencyWin.cpp8
-rw-r--r--WebCore/platform/graphics/chromium/TransparencyWin.h4
-rw-r--r--WebCore/platform/graphics/gtk/FontCacheGtk.cpp6
-rw-r--r--WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp59
-rw-r--r--WebCore/platform/graphics/gtk/WebKitWebSourceGStreamer.cpp726
-rw-r--r--WebCore/platform/graphics/gtk/WebKitWebSourceGStreamer.h52
-rw-r--r--WebCore/platform/graphics/haiku/FloatRectHaiku.cpp5
-rw-r--r--WebCore/platform/graphics/haiku/FontCacheHaiku.cpp6
-rw-r--r--WebCore/platform/graphics/haiku/GlyphPageTreeNodeHaiku.cpp68
-rw-r--r--WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp17
-rw-r--r--WebCore/platform/graphics/haiku/ImageHaiku.cpp76
-rw-r--r--WebCore/platform/graphics/haiku/IntRectHaiku.cpp4
-rw-r--r--WebCore/platform/graphics/haiku/PathHaiku.cpp5
-rw-r--r--WebCore/platform/graphics/mac/ComplexTextController.cpp51
-rw-r--r--WebCore/platform/graphics/mac/ComplexTextController.h6
-rw-r--r--WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp2
-rw-r--r--WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp1
-rw-r--r--WebCore/platform/graphics/mac/FontCacheMac.mm34
-rw-r--r--WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp1
-rw-r--r--WebCore/platform/graphics/qt/FontCacheQt.cpp6
-rw-r--r--WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp (renamed from WebCore/platform/graphics/qt/FontCustomPlatformData.cpp)0
-rw-r--r--WebCore/platform/graphics/qt/FontQt.cpp8
-rw-r--r--WebCore/platform/graphics/qt/GraphicsContextQt.cpp176
-rw-r--r--WebCore/platform/graphics/qt/GraphicsLayerQt.cpp334
-rw-r--r--WebCore/platform/graphics/qt/ImageQt.cpp4
-rw-r--r--WebCore/platform/graphics/qt/PathQt.cpp16
-rw-r--r--WebCore/platform/graphics/qt/PatternQt.cpp4
-rw-r--r--WebCore/platform/graphics/skia/GradientSkia.cpp2
-rw-r--r--WebCore/platform/graphics/skia/GraphicsContextSkia.cpp33
-rw-r--r--WebCore/platform/graphics/skia/ImageSkia.cpp4
-rw-r--r--WebCore/platform/graphics/skia/PathSkia.cpp5
-rw-r--r--WebCore/platform/graphics/skia/PatternSkia.cpp4
-rw-r--r--WebCore/platform/graphics/skia/SkiaFontWin.cpp4
-rw-r--r--WebCore/platform/graphics/transforms/AffineTransform.cpp55
-rw-r--r--WebCore/platform/graphics/transforms/AffineTransform.h11
-rw-r--r--WebCore/platform/graphics/transforms/TransformationMatrix.cpp6
-rw-r--r--WebCore/platform/graphics/transforms/TransformationMatrix.h4
-rw-r--r--WebCore/platform/graphics/win/FontCGWin.cpp4
-rw-r--r--WebCore/platform/graphics/win/FontCacheWin.cpp10
-rw-r--r--WebCore/platform/graphics/win/GraphicsContextCGWin.cpp2
-rw-r--r--WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp2
-rw-r--r--WebCore/platform/graphics/win/GraphicsContextWin.cpp12
-rw-r--r--WebCore/platform/graphics/win/GraphicsLayerCACF.cpp26
-rw-r--r--WebCore/platform/graphics/win/GraphicsLayerCACF.h6
-rw-r--r--WebCore/platform/graphics/win/QTMovieWin.cpp27
-rw-r--r--WebCore/platform/graphics/win/WKCACFLayer.cpp120
-rw-r--r--WebCore/platform/graphics/win/WKCACFLayer.h14
-rw-r--r--WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp17
-rw-r--r--WebCore/platform/graphics/win/WKCACFLayerRenderer.h4
-rw-r--r--WebCore/platform/graphics/wince/FontCacheWince.cpp6
-rw-r--r--WebCore/platform/graphics/wince/FontWince.cpp2
-rw-r--r--WebCore/platform/graphics/wince/GraphicsContextWince.cpp25
-rw-r--r--WebCore/platform/graphics/wince/ImageBufferWince.cpp4
-rw-r--r--WebCore/platform/graphics/wince/PathWince.cpp4
-rw-r--r--WebCore/platform/graphics/wince/PlatformPathWince.cpp14
-rw-r--r--WebCore/platform/graphics/wince/PlatformPathWince.h10
-rw-r--r--WebCore/platform/graphics/wx/FontCacheWx.cpp8
-rw-r--r--WebCore/platform/graphics/wx/FontPlatformData.h7
-rw-r--r--WebCore/platform/graphics/wx/FontPlatformDataWx.cpp12
-rw-r--r--WebCore/platform/graphics/wx/FontWx.cpp69
-rw-r--r--WebCore/platform/graphics/wx/GraphicsContextWx.cpp18
-rw-r--r--WebCore/platform/graphics/wx/ImageWx.cpp16
-rw-r--r--WebCore/platform/graphics/wx/PathWx.cpp9
-rw-r--r--WebCore/platform/graphics/wx/SimpleFontDataWx.cpp53
-rw-r--r--WebCore/platform/gtk/ClipboardGtk.cpp9
-rw-r--r--WebCore/platform/gtk/ClipboardGtk.h1
-rw-r--r--WebCore/platform/gtk/GOwnPtrGtk.cpp4
-rw-r--r--WebCore/platform/gtk/RenderThemeGtk.cpp4
-rw-r--r--WebCore/platform/gtk/ScrollViewGtk.cpp35
-rw-r--r--WebCore/platform/gtk/ScrollbarGtk.cpp28
-rw-r--r--WebCore/platform/gtk/ScrollbarGtk.h4
-rw-r--r--WebCore/platform/gtk/WheelEventGtk.cpp4
-rw-r--r--WebCore/platform/haiku/ClipboardHaiku.cpp5
-rw-r--r--WebCore/platform/haiku/ClipboardHaiku.h1
-rw-r--r--WebCore/platform/haiku/ContextMenuItemHaiku.cpp4
-rw-r--r--WebCore/platform/haiku/CookieJarHaiku.cpp6
-rw-r--r--WebCore/platform/haiku/DragImageHaiku.cpp2
-rw-r--r--WebCore/platform/haiku/FileChooserHaiku.cpp2
-rw-r--r--WebCore/platform/haiku/LocalizedStringsHaiku.cpp1
-rw-r--r--WebCore/platform/haiku/PlatformWheelEventHaiku.cpp4
-rw-r--r--WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp39
-rw-r--r--WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp2
-rw-r--r--WebCore/platform/mac/ClipboardMac.h1
-rw-r--r--WebCore/platform/mac/ClipboardMac.mm7
-rw-r--r--WebCore/platform/mac/CookieJar.mm12
-rw-r--r--WebCore/platform/mac/PasteboardMac.mm8
-rw-r--r--WebCore/platform/mac/ScrollbarThemeMac.h2
-rw-r--r--WebCore/platform/mac/WheelEventMac.mm8
-rw-r--r--WebCore/platform/network/android/CookieJarAndroid.cpp6
-rw-r--r--WebCore/platform/network/chromium/CookieJarChromium.cpp19
-rw-r--r--WebCore/platform/network/curl/CookieJarCurl.cpp6
-rw-r--r--WebCore/platform/network/curl/ResourceHandleCurl.cpp2
-rw-r--r--WebCore/platform/network/curl/ResourceHandleManager.cpp6
-rw-r--r--WebCore/platform/network/soup/CookieJarSoup.cpp35
-rw-r--r--WebCore/platform/network/soup/DNSSoup.cpp13
-rw-r--r--WebCore/platform/network/soup/ResourceHandleSoup.cpp17
-rw-r--r--WebCore/platform/network/soup/ResourceRequestSoup.cpp22
-rw-r--r--WebCore/platform/network/win/CookieJarCFNetWin.cpp14
-rw-r--r--WebCore/platform/network/win/CookieJarWin.cpp6
-rw-r--r--WebCore/platform/qt/ClipboardQt.cpp13
-rw-r--r--WebCore/platform/qt/ClipboardQt.h1
-rw-r--r--WebCore/platform/qt/CookieJarQt.cpp20
-rw-r--r--WebCore/platform/sql/SQLiteDatabase.cpp5
-rw-r--r--WebCore/platform/sql/SQLiteDatabase.h1
-rw-r--r--WebCore/platform/sql/SQLiteTransaction.cpp27
-rw-r--r--WebCore/platform/sql/SQLiteTransaction.h1
-rw-r--r--WebCore/platform/text/Base64.cpp11
-rw-r--r--WebCore/platform/text/Base64.h1
-rw-r--r--WebCore/platform/text/CharacterNames.h1
-rw-r--r--WebCore/platform/text/StringImpl.cpp12
-rw-r--r--WebCore/platform/text/StringImpl.h5
-rw-r--r--WebCore/platform/text/haiku/StringHaiku.cpp17
-rw-r--r--WebCore/platform/win/ClipboardWin.cpp19
-rw-r--r--WebCore/platform/win/ClipboardWin.h1
-rw-r--r--WebCore/platform/wx/ClipboardWx.cpp5
-rw-r--r--WebCore/platform/wx/ClipboardWx.h2
-rw-r--r--WebCore/platform/wx/MouseWheelEventWx.cpp2
-rw-r--r--WebCore/platform/wx/ScrollViewWx.cpp16
-rw-r--r--WebCore/platform/wx/wxcode/fontprops.h1
-rw-r--r--WebCore/platform/wx/wxcode/gtk/fontprops.cpp7
-rw-r--r--WebCore/platform/wx/wxcode/mac/carbon/fontprops.mm (renamed from WebCore/platform/wx/wxcode/mac/carbon/fontprops.cpp)16
-rw-r--r--WebCore/platform/wx/wxcode/win/fontprops.cpp50
-rw-r--r--WebCore/platform/wx/wxcode/win/non-kerned-drawing.cpp2
-rw-r--r--WebCore/plugins/PluginStream.cpp6
-rw-r--r--WebCore/plugins/PluginView.cpp51
-rw-r--r--WebCore/plugins/PluginView.h14
-rw-r--r--WebCore/plugins/PluginViewNone.cpp6
-rw-r--r--WebCore/plugins/gtk/PluginViewGtk.cpp10
-rw-r--r--WebCore/plugins/win/PluginViewWin.cpp4
-rw-r--r--WebCore/rendering/BidiRun.cpp74
-rw-r--r--WebCore/rendering/BidiRun.h65
-rw-r--r--WebCore/rendering/InlineIterator.h266
-rw-r--r--WebCore/rendering/RenderBlock.h3
-rw-r--r--WebCore/rendering/RenderBlockLineLayout.cpp325
-rw-r--r--WebCore/rendering/RenderBox.cpp4
-rw-r--r--WebCore/rendering/RenderBox.h2
-rw-r--r--WebCore/rendering/RenderBoxModelObject.cpp12
-rw-r--r--WebCore/rendering/RenderForeignObject.cpp9
-rw-r--r--WebCore/rendering/RenderForeignObject.h13
-rw-r--r--WebCore/rendering/RenderFrame.cpp55
-rw-r--r--WebCore/rendering/RenderFrame.h1
-rw-r--r--WebCore/rendering/RenderFrameSet.cpp122
-rw-r--r--WebCore/rendering/RenderFrameSet.h5
-rw-r--r--WebCore/rendering/RenderLayer.cpp10
-rw-r--r--WebCore/rendering/RenderListMarker.cpp263
-rw-r--r--WebCore/rendering/RenderObject.cpp28
-rw-r--r--WebCore/rendering/RenderObject.h12
-rw-r--r--WebCore/rendering/RenderPath.cpp4
-rw-r--r--WebCore/rendering/RenderPath.h8
-rw-r--r--WebCore/rendering/RenderRuby.cpp3
-rw-r--r--WebCore/rendering/RenderRuby.h4
-rw-r--r--WebCore/rendering/RenderRubyBase.cpp4
-rw-r--r--WebCore/rendering/RenderRubyBase.h4
-rw-r--r--WebCore/rendering/RenderRubyRun.cpp4
-rw-r--r--WebCore/rendering/RenderRubyRun.h4
-rw-r--r--WebCore/rendering/RenderRubyText.cpp4
-rw-r--r--WebCore/rendering/RenderRubyText.h4
-rw-r--r--WebCore/rendering/RenderSVGHiddenContainer.h3
-rw-r--r--WebCore/rendering/RenderSVGImage.cpp1
-rw-r--r--WebCore/rendering/RenderSVGImage.h10
-rw-r--r--WebCore/rendering/RenderSVGModelObject.cpp1
-rw-r--r--WebCore/rendering/RenderSVGRoot.cpp60
-rw-r--r--WebCore/rendering/RenderSVGRoot.h18
-rw-r--r--WebCore/rendering/RenderSVGText.cpp7
-rw-r--r--WebCore/rendering/RenderSVGText.h8
-rw-r--r--WebCore/rendering/RenderSVGTransformableContainer.cpp6
-rw-r--r--WebCore/rendering/RenderSVGTransformableContainer.h6
-rw-r--r--WebCore/rendering/RenderSVGViewportContainer.cpp40
-rw-r--r--WebCore/rendering/RenderSVGViewportContainer.h13
-rw-r--r--WebCore/rendering/RenderTableCell.cpp3
-rw-r--r--WebCore/rendering/RenderThemeChromiumWin.cpp2
-rw-r--r--WebCore/rendering/SVGCharacterLayoutInfo.cpp4
-rw-r--r--WebCore/rendering/SVGCharacterLayoutInfo.h46
-rw-r--r--WebCore/rendering/SVGInlineTextBox.cpp59
-rw-r--r--WebCore/rendering/SVGInlineTextBox.h3
-rw-r--r--WebCore/rendering/SVGMarkerLayoutInfo.h4
-rw-r--r--WebCore/rendering/SVGRenderSupport.cpp20
-rw-r--r--WebCore/rendering/SVGRenderSupport.h5
-rw-r--r--WebCore/rendering/SVGRenderTreeAsText.cpp4
-rw-r--r--WebCore/rendering/SVGRenderTreeAsText.h4
-rw-r--r--WebCore/rendering/SVGRootInlineBox.cpp82
-rw-r--r--WebCore/rendering/SVGRootInlineBox.h2
-rw-r--r--WebCore/rendering/TransformState.cpp6
-rw-r--r--WebCore/rendering/TransformState.h2
-rw-r--r--WebCore/rendering/style/RenderStyle.h6
-rw-r--r--WebCore/rendering/style/RenderStyleConstants.h132
-rw-r--r--WebCore/storage/DatabaseTracker.cpp18
-rw-r--r--WebCore/storage/DatabaseTracker.h24
-rw-r--r--WebCore/storage/SQLTransaction.cpp6
-rw-r--r--WebCore/storage/chromium/DatabaseTrackerChromium.cpp57
-rw-r--r--WebCore/svg/GradientAttributes.h6
-rw-r--r--WebCore/svg/PatternAttributes.h6
-rw-r--r--WebCore/svg/SVGAnimateMotionElement.cpp8
-rw-r--r--WebCore/svg/SVGAnimateMotionElement.h5
-rw-r--r--WebCore/svg/SVGAnimateTransformElement.cpp2
-rw-r--r--WebCore/svg/SVGAnimateTransformElement.h46
-rw-r--r--WebCore/svg/SVGElement.h4
-rw-r--r--WebCore/svg/SVGFitToViewBox.cpp6
-rw-r--r--WebCore/svg/SVGFitToViewBox.h24
-rw-r--r--WebCore/svg/SVGFont.cpp3
-rw-r--r--WebCore/svg/SVGLocatable.cpp20
-rw-r--r--WebCore/svg/SVGLocatable.h52
-rw-r--r--WebCore/svg/SVGMarkerElement.cpp2
-rw-r--r--WebCore/svg/SVGMarkerElement.h2
-rw-r--r--WebCore/svg/SVGMaskElement.cpp24
-rw-r--r--WebCore/svg/SVGMaskElement.h2
-rw-r--r--WebCore/svg/SVGMatrix.idl4
-rw-r--r--WebCore/svg/SVGPatternElement.cpp11
-rw-r--r--WebCore/svg/SVGPreserveAspectRatio.cpp6
-rw-r--r--WebCore/svg/SVGPreserveAspectRatio.h4
-rw-r--r--WebCore/svg/SVGSVGElement.cpp26
-rw-r--r--WebCore/svg/SVGSVGElement.h10
-rw-r--r--WebCore/svg/SVGStyledElement.cpp12
-rw-r--r--WebCore/svg/SVGStyledElement.h2
-rw-r--r--WebCore/svg/SVGStyledLocatableElement.cpp6
-rw-r--r--WebCore/svg/SVGStyledLocatableElement.h4
-rw-r--r--WebCore/svg/SVGStyledTransformableElement.cpp12
-rw-r--r--WebCore/svg/SVGStyledTransformableElement.h72
-rw-r--r--WebCore/svg/SVGTextContentElement.cpp2
-rw-r--r--WebCore/svg/SVGTextElement.cpp12
-rw-r--r--WebCore/svg/SVGTextElement.h10
-rw-r--r--WebCore/svg/SVGTextPathElement.cpp2
-rw-r--r--WebCore/svg/SVGTransform.cpp9
-rw-r--r--WebCore/svg/SVGTransform.h10
-rw-r--r--WebCore/svg/SVGTransformDistance.cpp12
-rw-r--r--WebCore/svg/SVGTransformDistance.h48
-rw-r--r--WebCore/svg/SVGTransformList.cpp13
-rw-r--r--WebCore/svg/SVGTransformList.h2
-rw-r--r--WebCore/svg/SVGTransformable.cpp12
-rw-r--r--WebCore/svg/SVGTransformable.h50
-rw-r--r--WebCore/svg/graphics/SVGPaintServer.cpp7
-rw-r--r--WebCore/svg/graphics/SVGPaintServer.h6
-rw-r--r--WebCore/svg/graphics/SVGPaintServerGradient.cpp94
-rw-r--r--WebCore/svg/graphics/SVGPaintServerGradient.h10
-rw-r--r--WebCore/svg/graphics/SVGPaintServerPattern.cpp26
-rw-r--r--WebCore/svg/graphics/SVGPaintServerPattern.h10
-rw-r--r--WebCore/svg/graphics/SVGPaintServerSolid.cpp3
-rw-r--r--WebCore/svg/graphics/SVGPaintServerSolid.h2
-rw-r--r--WebCore/svg/graphics/SVGResourceClipper.cpp4
-rw-r--r--WebCore/svg/graphics/SVGResourceMarker.cpp8
-rw-r--r--WebCore/svg/graphics/SVGResourceMarker.h6
-rw-r--r--WebCore/svg/graphics/filters/SVGFEImage.cpp2
-rw-r--r--WebCore/svg/graphics/filters/SVGFETile.cpp4
-rw-r--r--WebCore/websockets/ThreadableWebSocketChannelClientWrapper.h4
-rw-r--r--WebCore/websockets/WebSocket.cpp14
-rw-r--r--WebCore/websockets/WebSocket.h3
-rw-r--r--WebCore/websockets/WebSocketChannel.cpp15
-rw-r--r--WebCore/websockets/WebSocketChannel.h1
-rw-r--r--WebCore/websockets/WebSocketChannelClient.h2
-rw-r--r--WebCore/websockets/WebSocketHandshake.cpp3
-rw-r--r--WebCore/websockets/WorkerThreadableWebSocketChannel.cpp10
-rw-r--r--WebCore/websockets/WorkerThreadableWebSocketChannel.h2
-rw-r--r--WebCore/wml/WMLInputElement.cpp8
-rw-r--r--WebCore/wml/WMLInputElement.h2
-rw-r--r--WebCore/wscript19
-rw-r--r--WebCore/xml/XSLImportRule.cpp6
-rw-r--r--WebCore/xml/XSLStyleSheet.h16
-rw-r--r--WebCore/xml/XSLStyleSheetLibxslt.cpp12
-rw-r--r--WebCore/xml/XSLStyleSheetQt.cpp4
-rw-r--r--WebCore/xml/XSLTProcessorLibxslt.cpp8
578 files changed, 13686 insertions, 5754 deletions
diff --git a/WebCore/Android.derived.v8bindings.mk b/WebCore/Android.derived.v8bindings.mk
index 8a24d27..810133e 100644
--- a/WebCore/Android.derived.v8bindings.mk
+++ b/WebCore/Android.derived.v8bindings.mk
@@ -561,6 +561,51 @@ GEN := \
$(intermediates)/bindings/V8InspectorBackend.h \
$(intermediates)/bindings/V8InspectorFrontendHost.h
+<<<<<<< HEAD
+=======
+$(GEN): PRIVATE_PATH := $(LOCAL_PATH)
+$(GEN): PRIVATE_CUSTOM_TOOL = SOURCE_ROOT=$(PRIVATE_PATH) perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator V8 --include dom --include html --outputdir $(dir $@) $<
+$(GEN): $(intermediates)/bindings/V8%.h : $(LOCAL_PATH)/inspector/%.idl $(js_binding_scripts)
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp)
+
+# We also need the .cpp files, which are generated as side effects of the
+# above rules. Specifying this explicitly makes -j2 work.
+$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/bindings/%.cpp : $(intermediates)/bindings/%.h
+
+# Notifications
+# These headers are required by the V8 bindings even when Notifications are disabled
+GEN := \
+ $(intermediates)/bindings/V8Notification.h
+
+$(GEN): PRIVATE_PATH := $(LOCAL_PATH)
+$(GEN): PRIVATE_CUSTOM_TOOL = SOURCE_ROOT=$(PRIVATE_PATH) perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator V8 --include dom --include html --outputdir $(dir $@) $<
+$(GEN): $(intermediates)/bindings/V8%.h : $(LOCAL_PATH)/notifications/%.idl $(js_binding_scripts)
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp)
+
+# We also need the .cpp files, which are generated as side effects of the
+# above rules. Specifying this explicitly makes -j2 work.
+$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/bindings/%.cpp : $(intermediates)/bindings/%.h
+
+# Web Sockets
+# These headers are required by the V8 bindings even when Web Sockets are disabled
+GEN := \
+ $(intermediates)/bindings/V8WebSocket.h
+
+$(GEN): PRIVATE_PATH := $(LOCAL_PATH)
+$(GEN): PRIVATE_CUSTOM_TOOL = SOURCE_ROOT=$(PRIVATE_PATH) perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator V8 --include dom --include html --outputdir $(dir $@) $<
+$(GEN): $(intermediates)/bindings/V8%.h : $(LOCAL_PATH)/websockets/%.idl $(js_binding_scripts)
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp)
+
+# We also need the .cpp files, which are generated as side effects of the
+# above rules. Specifying this explicitly makes -j2 work.
+$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/bindings/%.cpp : $(intermediates)/bindings/%.h
+
+# HTML tag and attribute names
+GEN:= $(intermediates)/HTMLNames.cpp $(intermediates)/HTMLElementFactory.cpp
+>>>>>>> webkit.org at r54731
$(GEN): PRIVATE_PATH := $(LOCAL_PATH)
$(GEN): PRIVATE_CUSTOM_TOOL = SOURCE_ROOT=$(PRIVATE_PATH) perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator V8 --include dom --include html --outputdir $(dir $@) $<
$(GEN): $(intermediates)/bindings/V8%.h : $(LOCAL_PATH)/inspector/%.idl $(js_binding_scripts)
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index db4c515..5a13318 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,3771 @@
+2010-02-12 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ <rdar://problem/7609268> REGRESSION (r50301): Problem selecting text in a Devanagari website
+ https://bugs.webkit.org/show_bug.cgi?id=34865
+
+ Test: fast/text/glyph-reordering.html
+
+ * platform/graphics/mac/ComplexTextController.cpp:
+ (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
+ (WebCore::ComplexTextController::ComplexTextRun::setIsNonMonotonic): Added. Sets m_isMonotonic
+ and populates m_glyphEndOffsets with the end offsets of each glyph’s corresponding character range.
+ (WebCore::ComplexTextController::advance): For non-monotonic runs, use endOffsetAt() to get
+ glyphs’ end offsets.
+ (WebCore::ComplexTextController::adjustGlyphsAndAdvances): Check for monotonicity and call
+ setIsNonMonotonic() if needed.
+ * platform/graphics/mac/ComplexTextController.h:
+ (WebCore::ComplexTextController::ComplexTextRun::lastIndexAt): Added this getter.
+ (WebCore::ComplexTextController::ComplexTextRun::isMonotonic): Ditto.
+ * platform/graphics/mac/ComplexTextControllerATSUI.cpp:
+ (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): Initialize m_isMonotonic.
+ * platform/graphics/mac/ComplexTextControllerCoreText.cpp:
+ (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): Ditto.
+
+2010-02-12 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by David Levin.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34866
+ Leopard Debug Bot crashed on fast/forms/old-names.html
+
+ * html/HTMLFormCollection.cpp: (WebCore::HTMLFormCollection::formCollectionInfo): Removed
+ a misplaced checkConsistency() call. We are not looking at cache content at this point, and
+ caches will be reset on next access.
+
+2010-02-12 Pavel Feldman <pfeldman@chromium.org>
+
+ Reviewed by Timothy Hatcher.
+
+ Web Inspector: restore highlighting animation, bring back
+ keyboard navigation, beautify search results.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34853
+
+ * inspector/front-end/TextViewer.js:
+ (WebInspector.TextViewer):
+ (WebInspector.TextViewer.prototype.highlightLine):
+ * inspector/front-end/textViewer.css:
+
+2010-02-12 Anton Muhin <antonm@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ [v8] handle to the document can only own Objects, not Values
+ https://bugs.webkit.org/show_bug.cgi?id=34854
+
+ * bindings/v8/V8DOMWindowShell.cpp:
+ (WebCore::V8DOMWindowShell::updateDocumentWrapper):
+ (WebCore::V8DOMWindowShell::updateDocumentWrapperCache):
+ * bindings/v8/V8DOMWindowShell.h:
+ * bindings/v8/custom/V8DocumentCustom.cpp:
+ (WebCore::toV8):
+
+2010-02-12 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Holger Freyther.
+
+ Replaced stray CRLF with LF.
+
+ * wml/WMLInputElement.cpp:
+ (WebCore::WMLInputElement::suggestedValue):
+ * wml/WMLInputElement.h:
+
+2010-02-10 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ [Qt] Make qtlauncher and qgvlauncher use the generated headers
+ path to make sure they are correctly generated.
+
+ * WebCore.pro:
+
+2010-02-10 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ [Qt] Ensure relative paths in generated .pri files to ensure that
+ a source package with pre-generated derived sources can be compiled.
+
+ - Re-add a separate headers.pri file for WEBKIT_API_HEADERS
+ - Rename the generated headers.pri to classheaders.pri to avoid
+ confusion with the one generated by synqt since they don't have the
+ same content.
+ - Remove private headers list variable from classheaders.pri
+ - Use $$PWD in classheaders.pri
+ - Remove classheaders.pri from the installed files
+
+ * WebCore.pro:
+
+2010-02-10 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ [Qt] Manually add support for the install target on Symbian.
+
+ This is required to copy the headers over the ones in Qt.
+
+ * WebCore.pro:
+
+2010-02-10 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ [Qt] Minor fixes on QtWebKit headers generation.
+
+ - Adds QtWebKit to the generated headers destination path
+ - Improve compatibility with MinGW
+
+ * WebCore.pro:
+
+2010-02-11 Fumitoshi Ukai <ukai@chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ WebSocket ignores HttpOnly cookies, but should use in Handshake.
+ https://bugs.webkit.org/show_bug.cgi?id=34289
+
+ Test: websocket/tests/cookies/httponly-cookie.pl
+
+ * platform/CookieJar.h: add cookieRequestHeaderFieldValue()
+ * platform/chromium/ChromiumBridge.h:
+ * platform/haiku/CookieJarHaiku.cpp:
+ (WebCore::cookieRequestHeaderFieldValue):
+ * platform/mac/CookieJar.mm:
+ (WebCore::cookies):
+ (WebCore::cookieRequestHeaderFieldValue):
+ * platform/network/android/CookieJarAndroid.cpp:
+ (WebCore::cookieRequestHeaderFieldValue):
+ * platform/network/chromium/CookieJarChromium.cpp:
+ (WebCore::cookieRequestHeaderFieldValue):
+ * platform/network/curl/CookieJarCurl.cpp:
+ (WebCore::cookieRequestHeaderFieldValue):
+ * platform/network/soup/CookieJarSoup.cpp:
+ (WebCore::cookieRequestHeaderFieldValue):
+ * platform/network/win/CookieJarCFNetWin.cpp:
+ (WebCore::cookieRequestHeaderFieldValue):
+ * platform/network/win/CookieJarWin.cpp:
+ (WebCore::cookieRequestHeaderFieldValue):
+ * platform/qt/CookieJarQt.cpp:
+ (WebCore::cookieRequestHeaderFieldValue):
+ * websockets/WebSocketHandshake.cpp:
+ (WebCore::WebSocketHandshake::clientHandshakeMessage): use cookieRequestHeaderFieldValue() instead of cookies() to include HttpOnly cookies.
+
+2010-02-11 Ariya Hidayat <ariya.hidayat@gmail.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Use clipRegion instead of clipPath to save lots of CPU cycles.
+
+ https://bugs.webkit.org/show_bug.cgi?id=32375
+
+ * platform/graphics/qt/GraphicsContextQt.cpp:
+ (WebCore::GraphicsContext::clipOut):
+ (WebCore::GraphicsContext::clipOutEllipseInRect):
+
+2010-02-11 Yuzo Fujishima <yuzo@google.com>
+
+ Reviewed by Shinichiro Hamaji.
+
+ Rename underscored identifiers in WebCore/css/CSSParser.cpp.
+ https://bugs.webkit.org/show_bug.cgi?id=34877
+ Also fix whitespace erros that surface due to the above fix.
+
+ This doesn't change the code logic. Hence no new tests are required.
+
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::parseValue):
+
+2010-02-11 Joseph Pecoraro <joepeck@webkit.org>
+
+ Reviewed by Timothy Hatcher.
+
+ Web Inspector: Focusing a resource in the inspector should default to content not header
+ https://bugs.webkit.org/show_bug.cgi?id=34861
+
+ * inspector/front-end/Settings.js:
+ (WebInspector.Settings.prototype._load): changed initial default to content tab
+
+2010-02-11 Joseph Pecoraro <joepeck@webkit.org>
+
+ Reviewed by Timothy Hatcher.
+
+ Web Inspector: Editing Styles Cannot Tab Backwards from a New Style Item
+ https://bugs.webkit.org/show_bug.cgi?id=34872
+
+ * inspector/front-end/StylesSidebarPane.js:
+ (WebInspector.StylePropertiesSection.prototype.update): triggers afterUpdate
+ (WebInspector.StylePropertiesSection.prototype.afterUpdate): factored out _afterUpdate handling
+
+2010-02-11 Nikolas Zimmermann <nzimmermann@rim.com>
+
+ Reviewed by Eric Seidel.
+
+ Add roundedIntSize() convenience method converting FloatSize to IntSize, just like roundedIntPoint() converting FloatPoint to IntPoint.
+
+ * platform/graphics/FloatSize.h:
+ (WebCore::roundedIntSize):
+
+2010-02-11 Kent Tamura <tkent@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Fix two issues on maxLength.
+ https://bugs.webkit.org/show_bug.cgi?id=34783
+
+ - ValidityState.tooLong behavior was inconsistent with UIs of
+ <input> and <textarea>. tooLong checked Unicode code point length
+ though the UIs checks grapheme cluster length.
+
+ - Setting HTMLTextAreaElement::value didn't update the dirty flag.
+
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::tooLong): Use numGraphemeClusters() instead of length().
+ * html/HTMLTextAreaElement.cpp:
+ Rename setValue() to setNonDirtyValue(), and introduce setValue()
+ which calls setNonDirtyValue() and sets the dirty flag.
+ (WebCore::HTMLTextAreaElement::childrenChanged):
+ (WebCore::HTMLTextAreaElement::reset):
+ (WebCore::HTMLTextAreaElement::setValue):
+ (WebCore::HTMLTextAreaElement::setNonDirtyValue):
+ (WebCore::HTMLTextAreaElement::setDefaultValue):
+ (WebCore::HTMLTextAreaElement::tooLong): Use numGraphemeClusters() instead of length().
+ * html/HTMLTextAreaElement.h:
+
+2010-02-11 Fumitoshi Ukai <ukai@chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ WebSocket bufferedAmount should not be 0 when send after close.
+ https://bugs.webkit.org/show_bug.cgi?id=34633
+
+ Test: websocket/tests/bufferedAmount-after-close.html
+
+ * websockets/ThreadableWebSocketChannelClientWrapper.h:
+ (WebCore::ThreadableWebSocketChannelClientWrapper::didClose):
+ * websockets/WebSocket.cpp:
+ (WebCore::WebSocket::WebSocket):
+ (WebCore::WebSocket::send):
+ (WebCore::WebSocket::close):
+ (WebCore::WebSocket::bufferedAmount):
+ (WebCore::WebSocket::didConnect):
+ (WebCore::WebSocket::didClose):
+ * websockets/WebSocket.h:
+ * websockets/WebSocketChannel.cpp:
+ (WebCore::WebSocketChannel::WebSocketChannel):
+ (WebCore::WebSocketChannel::send):
+ (WebCore::WebSocketChannel::bufferedAmount):
+ (WebCore::WebSocketChannel::didClose):
+ * websockets/WebSocketChannel.h:
+ * websockets/WebSocketChannelClient.h:
+ (WebCore::WebSocketChannelClient::didClose):
+ * websockets/WorkerThreadableWebSocketChannel.cpp:
+ (WebCore::workerContextDidClose):
+ (WebCore::WorkerThreadableWebSocketChannel::Peer::didClose):
+ * websockets/WorkerThreadableWebSocketChannel.h:
+
+2010-02-11 Fumitoshi Ukai <ukai@chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ WebSocket in Worker failed to close
+ https://bugs.webkit.org/show_bug.cgi?id=34785
+
+ Tests: websocket/tests/workers/close-in-shared-worker.html
+ websocket/tests/workers/close-in-worker.html
+
+ * websockets/WorkerThreadableWebSocketChannel.cpp:
+ (WebCore::WorkerThreadableWebSocketChannel::close):
+
+2010-02-11 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Add dummy Cursor
+ https://bugs.webkit.org/show_bug.cgi?id=34672
+
+ * platform/brew/CursorBrew.cpp: Added.
+ (WebCore::Cursor::Cursor):
+ (WebCore::Cursor::~Cursor):
+ (WebCore::Cursor::operator=):
+ (WebCore::dummyCursor):
+ (WebCore::pointerCursor):
+ (WebCore::crossCursor):
+ (WebCore::handCursor):
+ (WebCore::moveCursor):
+ (WebCore::iBeamCursor):
+ (WebCore::waitCursor):
+ (WebCore::helpCursor):
+ (WebCore::eastResizeCursor):
+ (WebCore::northResizeCursor):
+ (WebCore::northEastResizeCursor):
+ (WebCore::northWestResizeCursor):
+ (WebCore::southResizeCursor):
+ (WebCore::southEastResizeCursor):
+ (WebCore::southWestResizeCursor):
+ (WebCore::westResizeCursor):
+ (WebCore::northSouthResizeCursor):
+ (WebCore::eastWestResizeCursor):
+ (WebCore::northEastSouthWestResizeCursor):
+ (WebCore::northWestSouthEastResizeCursor):
+ (WebCore::columnResizeCursor):
+ (WebCore::rowResizeCursor):
+ (WebCore::verticalTextCursor):
+ (WebCore::cellCursor):
+ (WebCore::contextMenuCursor):
+ (WebCore::noDropCursor):
+ (WebCore::copyCursor):
+ (WebCore::progressCursor):
+ (WebCore::aliasCursor):
+ (WebCore::noneCursor):
+ (WebCore::notAllowedCursor):
+ (WebCore::zoomInCursor):
+ (WebCore::zoomOutCursor):
+ (WebCore::middlePanningCursor):
+ (WebCore::eastPanningCursor):
+ (WebCore::northPanningCursor):
+ (WebCore::northEastPanningCursor):
+ (WebCore::northWestPanningCursor):
+ (WebCore::southPanningCursor):
+ (WebCore::southEastPanningCursor):
+ (WebCore::southWestPanningCursor):
+ (WebCore::westPanningCursor):
+ (WebCore::grabCursor):
+ (WebCore::grabbingCursor):
+
+2010-02-11 Nate Chapin <japhet@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ [V8] Add back in a fast path for v8 object wrapping
+ when it's not possible we're in a WorkerContext (the fast
+ path is important for performance).
+
+ https://bugs.webkit.org/show_bug.cgi?id=34805
+
+ * bindings/scripts/CodeGeneratorV8.pm:
+ * bindings/v8/V8DOMWrapper.cpp:
+ (WebCore::V8DOMWrapper::instantiateV8ObjectInWorkerContext):
+ (WebCore::V8DOMWrapper::instantiateV8Object):
+ * bindings/v8/V8DOMWrapper.h:
+
+2010-02-11 Nikolas Zimmermann <nzimmermann@rim.com>
+
+ Reviewed by Dirk Schulze.
+
+ Small cleanups in SVG render tree code.
+ Centralize calls to inflateShadow(), in SVGRenderSupport::computeRectForRepaint,
+ instead of spreading them around the subclasses. All classes should inherit
+ protected from SVGRenderBase, made it consistent.
+
+ Doesn't affect layout tests.
+
+ * rendering/RenderSVGImage.cpp:
+ (WebCore::RenderSVGImage::computeRectForRepaint):
+ * rendering/RenderSVGImage.h:
+ * rendering/RenderSVGModelObject.cpp:
+ (WebCore::RenderSVGModelObject::computeRectForRepaint):
+ * rendering/RenderSVGRoot.h:
+ * rendering/RenderSVGText.cpp:
+ (WebCore::RenderSVGText::computeRectForRepaint):
+ (WebCore::RenderSVGText::layout):
+ * rendering/SVGRenderSupport.cpp:
+ (WebCore::SVGRenderBase::computeRectForRepaint):
+ * rendering/SVGRootInlineBox.h:
+
+2010-02-11 David Hyatt <hyatt@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34857
+ Move InlineIterator and BidiRun into new files so subclasses can access them.
+
+ * GNUmakefile.am:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * rendering/BidiRun.cpp: Added.
+ (WebCore::BidiRun::destroy):
+ (WebCore::throw):
+ (WebCore::BidiRun::operator delete):
+ * rendering/BidiRun.h: Added.
+ (WebCore::BidiRun::BidiRun):
+ (WebCore::BidiRun::next):
+ * rendering/InlineIterator.h: Added.
+ (WebCore::InlineIterator::InlineIterator):
+ (WebCore::operator==):
+ (WebCore::operator!=):
+ (WebCore::bidiNext):
+ (WebCore::bidiFirst):
+ (WebCore::InlineIterator::increment):
+ (WebCore::InlineIterator::atEnd):
+ (WebCore::InlineIterator::current):
+ (WebCore::InlineIterator::direction):
+ (WebCore::InlineBidiResolver::increment):
+ (WebCore::InlineBidiResolver::appendRun):
+ * rendering/RenderBlock.h:
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::RenderBlock::appendRunsForObject):
+ (WebCore::RenderBlock::requiresLineBox):
+
+2010-02-11 Steve Block <steveblock@google.com>
+
+ Reviewed by Dimitri Glazkov.
+
+ Fixes CodeGeneratorV8.pm to include the header for the indexer type when using setCollectionIndexedGetter()
+ https://bugs.webkit.org/show_bug.cgi?id=34836
+
+ setCollectionIndexedGetter() uses getIndexedPropertyOfCollection(),
+ which in turn uses toV8() with the indexer type, which is declared in
+ the header for the indexer type.
+
+ No new tests, build fix only.
+
+ * bindings/scripts/CodeGeneratorV8.pm:
+
+2010-02-11 Pavel Feldman <pfeldman@chromium.org>
+
+ Reviewed by Timothy Hatcher.
+
+ Web Inspector: split source code into chunks in order to improve text
+ viewer performance on large files.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34816
+
+ This change brings back SourceFrame's canvas+style magic, restores line
+ wrapping and makes things a lot like they used to be.
+ It removes TextEditor for now and renames NativeTextViewer into TextViewer.
+ TextViewer is no longer derived from TextEditor.
+ This TextViewer is still based on TextEditorModel, no iframes are involved.
+
+ Instead of creating div per line, TextViewer splits source code into 50 line
+ chunks. Upon scroll event, visible chunks are sharded into lines and individual
+ lines are highlighted. Whenever highlighted region gets outside of the visible
+ area, highlight spans are thrown away and region is replaced with the original
+ plain text chunk.
+
+ Complex stuff:
+ - Whenever there is a need to manipulate individual lines (add message bubble /
+ set breakpoint / reveal / etc.), individual chunks for such lines are created.
+ - There is also an implicit machinery that is maintaining selection when it
+ goes beyond the visible area.
+ - Search occurrences are implemented as artificial spans interweaving
+ highlighting markup.
+
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * inspector/front-end/NativeTextViewer.js: Removed.
+ * inspector/front-end/ScriptView.js:
+ (WebInspector.ScriptView):
+ * inspector/front-end/Settings.js:
+ * inspector/front-end/SourceFrame.js:
+ (WebInspector.SourceFrame):
+ (WebInspector.SourceFrame.prototype.set visible):
+ (WebInspector.SourceFrame.prototype.set executionLine):
+ (WebInspector.SourceFrame.prototype.revealLine):
+ (WebInspector.SourceFrame.prototype.addBreakpoint):
+ (WebInspector.SourceFrame.prototype.removeBreakpoint):
+ (WebInspector.SourceFrame.prototype.addMessage):
+ (WebInspector.SourceFrame.prototype.clearMessages):
+ (WebInspector.SourceFrame.prototype.sizeToFitContentHeight):
+ (WebInspector.SourceFrame.prototype.setContent):
+ (WebInspector.SourceFrame.prototype.highlightLine):
+ (WebInspector.SourceFrame.prototype._createViewerIfNeeded):
+ (WebInspector.SourceFrame.prototype.markAndRevealRange):
+ (WebInspector.SourceFrame.prototype.clearMarkedRange):
+ (WebInspector.SourceFrame.prototype._breakpointChanged):
+ (WebInspector.SourceFrame.prototype._updateExecutionLine):
+ (WebInspector.SourceFrame.prototype._addMessageToSource):
+ (WebInspector.SourceFrame.prototype._addExistingBreakpointsToSource):
+ (WebInspector.SourceFrame.prototype._addBreakpointToSource):
+ (WebInspector.SourceFrame.prototype._removeBreakpointFromSource):
+ (WebInspector.SourceFrame.prototype._mouseDown):
+ (WebInspector.SourceFrame.prototype._editBreakpointCondition.committed):
+ (WebInspector.SourceFrame.prototype._editBreakpointCondition.dismissed):
+ (WebInspector.SourceFrame.prototype._editBreakpointCondition):
+ (WebInspector.SourceFrame.prototype._showBreakpointConditionPopup):
+ (WebInspector.SourceFrame.prototype._createConditionElement):
+ (WebInspector.SourceFrame.prototype._keyDown):
+ (WebInspector.SourceFrame.prototype.resize):
+ (WebInspector.SourceFrame.prototype._drawProgramCounterInContext):
+ (WebInspector.SourceFrame.prototype._drawProgramCounterImageIfNeeded):
+ (WebInspector.SourceFrame.prototype._drawBreakpointImagesIfNeeded.drawBreakpoint):
+ (WebInspector.SourceFrame.prototype._drawBreakpointImagesIfNeeded):
+ * inspector/front-end/SourceView.js:
+ (WebInspector.SourceView):
+ (WebInspector.SourceView.prototype._removeBreakpoint):
+ (WebInspector.SourceView.prototype.searchCanceled):
+ (WebInspector.SourceView.prototype._jumpToSearchResult):
+ * inspector/front-end/TextEditor.js: Removed.
+ * inspector/front-end/TextViewer.js: Added.
+ (WebInspector.TextViewer):
+ (WebInspector.TextViewer.prototype.set mimeType):
+ (WebInspector.TextViewer.prototype.get textModel):
+ (WebInspector.TextViewer.prototype.revealLine):
+ (WebInspector.TextViewer.prototype.addDecoration):
+ (WebInspector.TextViewer.prototype.removeDecoration):
+ (WebInspector.TextViewer.prototype.markAndRevealRange):
+ (WebInspector.TextViewer.prototype.highlightLine):
+ (WebInspector.TextViewer.prototype._textChanged):
+ (WebInspector.TextViewer.prototype._createChunkRow):
+ (WebInspector.TextViewer.prototype._makeLineAChunk):
+ (WebInspector.TextViewer.prototype._indexChunks):
+ (WebInspector.TextViewer.prototype._highlightChanged):
+ (WebInspector.TextViewer.prototype._scroll):
+ (WebInspector.TextViewer.prototype.setCoalescingUpdate):
+ (WebInspector.TextViewer.prototype._repaintAll):
+ (WebInspector.TextViewer.prototype._chunkForOffset):
+ (WebInspector.TextViewer.prototype._chunkNumberForLine):
+ (WebInspector.TextViewer.prototype._chunkStartLine):
+ (WebInspector.TextViewer.prototype._restoreChunks):
+ (WebInspector.TextViewer.prototype._repaint):
+ (WebInspector.TextViewer.prototype._getSelection):
+ (WebInspector.TextViewer.prototype._restoreSelection):
+ (WebInspector.TextViewer.prototype._selectionToPosition):
+ (WebInspector.TextViewer.prototype._createLineRow):
+ (WebInspector.TextViewer.prototype._paintLine):
+ (WebInspector.TextViewer.prototype._createSpan):
+ (WebInspector.TextViewer.prototype._createLink):
+ (WebInspector.TextViewer.prototype._rewriteHref):
+ (WebInspector.TextViewer.prototype._markRange):
+ (WebInspector.TextViewer.prototype._decimalDigits):
+ (WebInspector.TextViewer.prototype.resize):
+ * inspector/front-end/WebKit.qrc:
+ * inspector/front-end/inspector.css:
+ * inspector/front-end/inspector.html:
+ * inspector/front-end/textEditor.css: Removed.
+ * inspector/front-end/textViewer.css: Added.
+ * inspector/front-end/utilities.js:
+ (Node.prototype.traverseNextTextNode):
+ (Node.prototype.rangeBoundaryForOffset):
+
+2010-02-11 Csaba Osztrogonác <ossy@webkit.org>
+
+ Reviewed by Tor Arne Vestbø.
+
+ [Qt] ENABLE_RUBY flag was restored by r54649, but default value wasn't added for Qt port.
+ https://bugs.webkit.org/show_bug.cgi?id=34698
+
+ * WebCore.pri: Add ENABLE_RUBY=1 as default setting.
+
+2010-02-11 Steve Block <steveblock@google.com>
+
+ Reviewed by Jeremy Orlow.
+
+ Updates Android V8 Makefile to generate Notifications and WebSockets headers required by V8DOMWrapper.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=34815
+
+ No new tests, build fix only.
+
+ * Android.derived.v8bindings.mk:
+
+2010-02-11 Steve Block <steveblock@google.com>
+
+ Reviewed by Jeremy Orlow.
+
+ Updates Android V8 Makefile to generate XPath header required by V8Proxy.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=34814
+
+ No new tests, build fix only.
+
+ * Android.derived.v8bindings.mk:
+
+2010-02-11 Steve Block <steveblock@google.com>
+
+ Reviewed by Nate Chapin.
+
+ Update Android V8 Makefile to generate Inspector headers required by V8 ScriptObject.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=34806
+
+ No new tests, build fix only.
+
+ * Android.derived.v8bindings.mk:
+
+2010-02-11 Steve Block <steveblock@google.com>
+
+ Reviewed by David Levin.
+
+ Guards SVG code in V8 bindings with ENABLE(SVG)
+ https://bugs.webkit.org/show_bug.cgi?id=34812
+
+ Also updates Android V8 Makefile to generate required SVG headers.
+
+ No new tests, build fix only.
+
+ * Android.derived.v8bindings.mk:
+ * bindings/v8/custom/V8CSSValueCustom.cpp:
+ (WebCore::toV8):
+ * bindings/v8/custom/V8DocumentCustom.cpp:
+ (WebCore::toV8):
+ * bindings/v8/custom/V8ElementCustom.cpp:
+ (WebCore::toV8):
+
+2010-02-08 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Restore ENABLE_RUBY flag so vendors can ship with Ruby disabled if they choose.
+ https://bugs.webkit.org/show_bug.cgi?id=34698
+
+ * Configurations/FeatureDefines.xcconfig:
+ * DerivedSources.make:
+ * GNUmakefile.am:
+ * html/HTMLTagNames.in: Make the ruby-related tag names conditional.
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::createObject): ifdef the code that would create ruby elements.
+ * rendering/RenderObject.h: ditto above
+ * rendering/RenderRuby.cpp: ifdef this whole file
+ * rendering/RenderRuby.h: ditto
+ * rendering/RenderRubyBase.cpp: ditto
+ * rendering/RenderRubyBase.h: ditto
+ * rendering/RenderRubyRun.cpp: ditto
+ * rendering/RenderRubyRun.h: ditto
+ * rendering/RenderRubyText.cpp: ditto
+ * rendering/RenderRubyText.h: ditto
+
+2010-02-11 Kent Tamura <tkent@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Step attribute support for date&time types.
+ https://bugs.webkit.org/show_bug.cgi?id=30847
+
+ - Add implementation for ValidityState.stepMismatch, stepUp() and
+ stepDown() for date, datetime, datetime-local, month, time, week types.
+ - Fix string representation of DateComponents.
+
+ Tests: fast/forms/ValidityState-stepMismatch.html
+ fast/forms/input-stepup-stepdown.html
+
+ * html/HTMLInputElement.cpp:
+ - Change monthDefaultMaximum so that DateComponents::m_year doesn't overflow.
+ (WebCore::HTMLInputElement::stepBase):
+ (WebCore::HTMLInputElement::stepMismatch):
+ (WebCore::HTMLInputElement::getStepParameters):
+ (WebCore::HTMLInputElement::getAllowedValueStep):
+ (WebCore::HTMLInputElement::applyStep):
+ Renamed from applyStepForNumberOrRange(), and add support for other types.
+ (WebCore::HTMLInputElement::stepUp): Rename applyStepForNumberOrRange().
+ (WebCore::HTMLInputElement::stepDown): Rename applyStepForNumberOrRange().
+ (WebCore::HTMLInputElement::setValueAsDate): Use setDateValue().
+ (WebCore::HTMLInputElement::setDateValue):
+ A helper function to make the best representation of DateComponents.
+ (WebCore::HTMLInputElement::setValueAsNumber): Use setDateValue().
+ * html/HTMLInputElement.h:
+
+2010-02-10 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ postMessage does not send ImageData
+ https://bugs.webkit.org/show_bug.cgi?id=34825
+
+ Implement serialisation of ImageData, and for testing reasons
+ expose the ImageData constructor (which should already have
+ been exposed).
+
+ * bindings/js/SerializedScriptValue.cpp:
+ (WebCore::SerializedImageData::create):
+ (WebCore::SerializedImageData::width):
+ (WebCore::SerializedImageData::height):
+ (WebCore::SerializedImageData::data):
+ (WebCore::SerializedImageData::SerializedImageData):
+ (WebCore::SerializedScriptValueData::SerializedScriptValueData):
+ (WebCore::SharedSerializedData::asImageData):
+ (WebCore::SerializingTreeWalker::convertIfTerminal):
+ (WebCore::DeserializingTreeWalker::convertIfTerminal):
+ (WebCore::TeardownTreeWalker::convertIfTerminal):
+ * bindings/js/SerializedScriptValue.h:
+ (WebCore::SerializedScriptValueData::):
+ (WebCore::SerializedScriptValueData::asImageData):
+ * html/canvas/CanvasPixelArray.h:
+ (WebCore::CanvasPixelArray::data):
+ * page/DOMWindow.idl:
+
+2010-02-10 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Address last round of review comments on r53607
+ https://bugs.webkit.org/show_bug.cgi?id=33940
+
+ Mostly renaming and cleaning up.
+
+ * css/CSSImportRule.cpp:
+ (WebCore::CSSImportRule::insertedIntoParent):
+ * css/CSSStyleSheet.h:
+ (WebCore::CSSStyleSheet::create):
+ (WebCore::CSSStyleSheet::createInline):
+ * css/StyleBase.cpp:
+ (WebCore::StyleBase::baseURL):
+ * css/StyleSheet.cpp:
+ (WebCore::StyleSheet::StyleSheet):
+ * css/StyleSheet.h:
+ (WebCore::StyleSheet::href):
+ (WebCore::StyleSheet::setFinalURL):
+ (WebCore::StyleSheet::finalURL):
+ * dom/Document.cpp:
+ (WebCore::Document::updateBaseURL):
+ * dom/ProcessingInstruction.cpp:
+ (WebCore::ProcessingInstruction::checkStyleSheet):
+ * xml/XSLImportRule.cpp:
+ (WebCore::XSLImportRule::loadSheet):
+ * xml/XSLStyleSheet.h:
+ (WebCore::XSLStyleSheet::create):
+ (WebCore::XSLStyleSheet::createInline):
+ * xml/XSLStyleSheetLibxslt.cpp:
+ (WebCore::XSLStyleSheet::XSLStyleSheet):
+ (WebCore::XSLStyleSheet::parseString):
+ (WebCore::XSLStyleSheet::loadChildSheets):
+ * xml/XSLStyleSheetQt.cpp:
+ (WebCore::XSLStyleSheet::XSLStyleSheet):
+
+2010-02-10 Noam Rosenthal <noam.rosenthal@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ [Qt] GraphicsLayer: somtimes the item flickers at the end of an animation
+ This is because we try to delete the animation when finished: that is
+ unnecessary. WebCore manages the animation's lifecycle and makes sure
+ to call the right function when the animation can be deleted.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34761
+
+ No new tests.
+
+ * platform/graphics/qt/GraphicsLayerQt.cpp:
+ (WebCore::GraphicsLayerQt::addAnimation): No need to delete here
+ (WebCore::GraphicsLayerQt::removeAnimationsForProperty): deleteLater
+
+2010-02-10 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] Build fix for wxMac/Cocoa.
+
+ * platform/wx/wxcode/mac/carbon/fontprops.cpp: Removed.
+ * platform/wx/wxcode/mac/carbon/fontprops.mm: Copied from WebCore/platform/wx/wxcode/mac/carbon/fontprops.cpp.
+ * wscript:
+
+2010-02-10 Jon Honeycutt <jhoneycutt@apple.com>
+
+ REGRESSION(24929): PDF page doesn't load in background tab
+
+ Reviewed by Dan Bernstein.
+
+ * plugins/PluginView.cpp:
+ (WebCore::PluginView::startOrAddToUnstartedList):
+ Only delay loading of the plug-in if we'll kick off our own load of the
+ plug-in data later, in start().
+
+2010-02-10 Enrica Casucci <enrica@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Crash in WebKit!WebCore::RenderTextControlSingleLine::createInnerTextStyle doing anything in Safari after sitting on a page with 3D site
+ <rdar://problem/7557201>
+ https://bugs.webkit.org/show_bug.cgi?id=34823
+
+ No tests added because the code is exercised by the existing tests.
+
+ The root cause was the fact that we were not releasing a reference that was held by CA.
+ In debug builds we had an assert in the destructor of WKCACFLayer.
+
+ * platform/graphics/win/GraphicsLayerCACF.cpp:
+ (WebCore::GraphicsLayerCACF::~GraphicsLayerCACF):
+
+2010-02-10 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Typedef DragImageRef
+ https://bugs.webkit.org/show_bug.cgi?id=34791
+
+ Use IImage* as it is the BREW's image type.
+
+ * platform/DragImage.h:
+
+2010-02-10 Beth Dakin <bdakin@apple.com>
+
+ Reviewed by Simon Fraser and Darin Adler.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=34185 REGRESSION:
+ Mask not invalidating
+
+ SVGMaskElement is the only class that keeps a HashMap of canvas
+ resources rather than just a pointer to a resource. This
+ patch makes SVGMaskElement invalidate all of its resources in the
+ HashMap instead of just one.
+
+ * svg/SVGMaskElement.cpp:
+ (WebCore::SVGMaskElement::svgAttributeChanged):
+ (WebCore::SVGMaskElement::childrenChanged):
+ (WebCore::SVGMaskElement::invalidateCanvasResources):
+ * svg/SVGMaskElement.h:
+ * svg/SVGStyledElement.cpp:
+ (WebCore::SVGStyledElement::invalidateResourcesInAncestorChain):
+ (WebCore::SVGStyledElement::invalidateCanvasResources):
+ * svg/SVGStyledElement.h:
+
+2010-02-10 Stephan Aßmus <superstippi@gmx.de>
+
+ Reviewed by David Levin.
+
+ Fixes to rect conversion and image rendering on Haiku
+ https://bugs.webkit.org/show_bug.cgi?id=34684
+
+ Covered by existing tests.
+
+ The changes to the rect conversions are indeed correct. In Haiku (to stay
+ compatibly with BeOS), a BRect specifies the left/top and bottom/right pixel
+ *indices*, even though the values are floating point. So a rectangle covering
+ just one pixel would be specified as BRect(0, 0, 0, 0). In WebCore and other
+ frame works, such rectangles would be expressed as 0, 0, 1, 1. In WebCore, the
+ width and height of rectangles refer to the distance between pixels, while on
+ Haiku, a one pixel rect has indeed a width and height of 0, as confusing as
+ that may be.
+
+ The part of the patch that affects
+ WebCore/platform/graphics/haiku/ImageHaiku.cpp also implements the drawing
+ methods more correctly. Image observers are notified, and pattern drawing takes
+ the "phase" into account which makes scrolled backgrounds render correctly.
+ Transformations are still not supported, since the Haiku drawing backend itself
+ does not yet support them.
+
+ Use OwnPtr when creating the BBitmap to avoid future leaks with early returns.
+
+ Convert the bitmap data to non pre-multiplied until Haiku supports drawing
+ pre-multiplied bitmaps.
+
+ * platform/graphics/haiku/FloatRectHaiku.cpp: Fixed conversion
+ * platform/graphics/haiku/ImageHaiku.cpp:
+ (WebCore::BitmapImage::draw): Fixed placement, notify observers
+ (WebCore::Image::drawPattern): Implemented using "phase" to fix scrolling, notify observers
+ * platform/graphics/haiku/IntRectHaiku.cpp: Fixed conversion
+ * platform/image-decoders/haiku/ImageDecoderHaiku.cpp: Fixed conversion
+
+2010-02-10 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by David Levin.
+
+ Clean up unused member var and initialization in Document
+ https://bugs.webkit.org/show_bug.cgi?id=34820
+
+ Remove unused m_secureForms member variable in Document.
+
+ * dom/Document.cpp:
+ (WebCore::Document::Document):
+ * dom/Document.h:
+
+2010-02-10 Kevin Watters <kevinwatters@gmail.com>
+
+ Reviewed by Kevin Ollivier.
+
+ [wx] Add Windows complex text support and Mac support for containsCharacters.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34759
+
+ * platform/graphics/SimpleFontData.h:
+ * platform/graphics/wx/FontPlatformData.h:
+ (WebCore::FontPlatformData::roundsGlyphAdvances):
+ * platform/graphics/wx/FontPlatformDataWx.cpp:
+ (WebCore::FontPlatformData::useGDI):
+ (WebCore::FontPlatformData::hfont):
+ * platform/graphics/wx/FontWx.cpp:
+ (WebCore::Font::canReturnFallbackFontsForComplexText):
+ (WebCore::Font::selectionRectForComplexText):
+ (WebCore::Font::drawComplexText):
+ (WebCore::Font::floatWidthForComplexText):
+ (WebCore::Font::offsetForPositionForComplexText):
+ * platform/graphics/wx/SimpleFontDataWx.cpp:
+ (WebCore::SimpleFontData::platformInit):
+ (WebCore::SimpleFontData::platformDestroy):
+ (WebCore::SimpleFontData::containsCharacters):
+ (WebCore::SimpleFontData::platformWidthForGlyph):
+ (WebCore::SimpleFontData::scriptFontProperties):
+ (WebCore::SimpleFontData::initGDIFont):
+ (WebCore::SimpleFontData::platformCommonDestroy):
+ (WebCore::SimpleFontData::widthForGDIGlyph):
+ * platform/wx/wxcode/fontprops.h:
+ * platform/wx/wxcode/gtk/fontprops.cpp:
+ (wxFontContainsCharacters):
+ * platform/wx/wxcode/mac/carbon/fontprops.cpp:
+ (wxFontContainsCharacters):
+ * platform/wx/wxcode/win/fontprops.cpp:
+ (wxFontContainsCharacters):
+ * platform/wx/wxcode/win/non-kerned-drawing.cpp:
+ (WebCore::drawTextWithSpacing):
+ * wscript:
+
+2010-02-10 Kwang Yul Seo <skyul@company100.net>
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Add dummy Frame::dragImageForSelection
+ https://bugs.webkit.org/show_bug.cgi?id=34792
+
+ Add FrameBrew.cpp which contains a dummy implementation of
+ Frame::dragImageForSelection.
+
+ * page/brew/FrameBrew.cpp: Added.
+ (WebCore::Frame::dragImageForSelection):
+
+2010-02-10 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] Build fix. Switch drawPattern to Image class like other platforms.
+
+ * platform/graphics/BitmapImage.h:
+ * platform/graphics/wx/ImageWx.cpp:
+ (WebCore::Image::drawPattern):
+
+2010-02-10 Chris Marrin <cmarrin@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Added CA_PRINT_TREE functionality to WKCACFLayer implementation
+ https://bugs.webkit.org/show_bug.cgi?id=34779
+
+ I've tried to duplicate the look of the output on Mac, but
+ it's not quite the same. It shows all the useful information though.
+ It is enabled by setting the environment variable CA_PRINT_TREE=1
+
+ * platform/graphics/win/WKCACFLayer.cpp:Implementation of printTree
+ (WebCore::WKCACFLayer::isTransformLayer):
+ Moved function to cpp file because it needs to use the function form
+ of kCACFTransformLayer because the DLL is delay loaded, and that function
+ can only be called from the cpp file.
+ (WebCore::WKCACFLayer::sublayerAtIndex):
+ (WebCore::printIndent):
+ (WebCore::printTransform):
+ (WebCore::WKCACFLayer::printTree):Prints from this layer down
+ (WebCore::WKCACFLayer::printLayer):Prints this layer and recursively calls sublayers
+ * platform/graphics/win/WKCACFLayer.h:
+ * platform/graphics/win/WKCACFLayerRenderer.cpp:
+ (WebCore::WKCACFLayerRenderer::WKCACFLayerRenderer):
+ (WebCore::WKCACFLayerRenderer::createRenderer):Adds a name to the root layers
+ (WebCore::WKCACFLayerRenderer::render):Calls printTree when CA_PRINT_TREE is 1
+ * platform/graphics/win/WKCACFLayerRenderer.h:
+
+2010-02-10 Nate Chapin <japhet@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Change V8DOMWrapper::lookupDOMWrapper() and configureTemplate()
+ to not use V8ClassIndex.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34768
+
+ * bindings/scripts/CodeGeneratorV8.pm:
+ * bindings/v8/V8Binding.cpp:
+ * bindings/v8/V8Binding.h:
+ * bindings/v8/V8DOMWindowShell.cpp:
+ * bindings/v8/V8DOMWrapper.cpp:
+ * bindings/v8/V8DOMWrapper.h:
+ * bindings/v8/V8Proxy.cpp:
+ * bindings/v8/WorkerContextExecutionProxy.cpp:
+ * bindings/v8/custom/V8DOMWindowCustom.cpp:
+ * bindings/v8/custom/V8LocationCustom.cpp:
+ * bindings/v8/custom/V8MessageEventCustom.cpp:
+
+2010-02-10 Nate Chapin <japhet@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ [V8] Handle the possibility that ScheduledAction::execute() may
+ retrieve a null V8Proxy* even if not in a WorkerContext (e.g., if
+ JS was disallowed).
+
+ * bindings/v8/ScheduledAction.cpp:
+ (WebCore::ScheduledAction::execute):
+
+2010-02-10 Kenneth Russell <kbr@google.com>
+
+ Reviewed by Oliver Hunt.
+
+ Remove automatic viewport resizing
+ https://bugs.webkit.org/show_bug.cgi?id=34766
+
+ Removed automatic viewport resizing per conclusions on the WebGL
+ mailing list. Added test verifying new behavior and updated a
+ couple of previous tests failing after this change.
+
+ Test: fast/canvas/webgl/viewport-unchanged-upon-resize.html
+
+ * platform/graphics/mac/GraphicsContext3DMac.cpp:
+ (WebCore::GraphicsContext3D::reshape):
+
+2010-02-10 Ariya Hidayat <ariya.hidayat@gmail.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Implement image interpolation quality.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34629
+
+ * platform/graphics/qt/GraphicsContextQt.cpp:
+ (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
+ (WebCore::GraphicsContext::setImageInterpolationQuality):
+ (WebCore::GraphicsContext::imageInterpolationQuality):
+
+2010-02-10 Eric Seidel <eric@webkit.org>
+
+ No review, Mac build fix.
+
+ Crash in Flash at http://www.cctv.com/
+ https://bugs.webkit.org/show_bug.cgi?id=34673
+
+ * plugins/PluginViewNone.cpp:
+ (WebCore::PluginView::getValueStatic):
+
+2010-02-10 Gustavo Noronha Silva <gns@gnome.org>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] Hits assertion on history back, with page cache enabled, in specific conditions
+ https://bugs.webkit.org/show_bug.cgi?id=34773
+
+ When unsetting the adjustments from a ScrollView, also disconnect
+ them from the Scrollbars.
+
+ Test: fast/frames/frame-crash-with-page-cache.html
+
+ * platform/gtk/ScrollViewGtk.cpp:
+ (WebCore::ScrollView::setGtkAdjustments):
+ * platform/gtk/ScrollbarGtk.cpp:
+ (ScrollbarGtk::~ScrollbarGtk):
+ (ScrollbarGtk::detachAdjustment):
+ * platform/gtk/ScrollbarGtk.h:
+
+2010-02-09 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34490
+ WebCore::ImageEventSender::dispatchPendingEvents() crashes in certain conditions
+
+ Test: fast/images/destroyed-image-load-event.html
+
+ * ForwardingHeaders/wtf/ValueCheck.h: Added.
+
+ * loader/ImageLoader.cpp:
+ (WTF::ValueCheck): Special case value check for ImageLoader - it's allocated inside elements,
+ so check the owner instead.
+ (WebCore::ImageEventSender::hasPendingEvents): Added a debugging aid for ImageLoader destructor.
+ (WebCore::ImageLoader::~ImageLoader): Assert that we're not going to leave dangling pointers
+ in ImageEventSender.
+ (WebCore::ImageLoader::setImage): Cancel events that could be dispatched for the previous
+ image. The only client using this method that I could find was DeleteButton, which doesn't
+ care about load events for the new image, so I didn't add any code for firing those.
+ (WebCore::ImageLoader::setLoadingImage): This method only existed to confuse readers -
+ there wasn't any meaningful code shared (callers just undid most assignments made there).
+ Merged the logic into callers.
+ (WebCore::ImageLoader::updateFromElement): We're forgetting the old image, so forget its
+ old events, too.
+ (WebCore::ImageLoader::notifyFinished): This can be called from setImage(), in which case
+ no one is going to dispatch the event "soon". So, don't queue it.
+ (WebCore::ImageEventSender::dispatchPendingEvents): Call checkConsistency(). This didn't
+ help catch this particuar bug, but seems like a useful check anyway.
+
+ * loader/ImageLoader.h: Removed setLoadingImage().
+
+2010-02-10 Jon Honeycutt <jhoneycutt@apple.com>
+
+ Mac build fix. Unreviewed.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ Add PluginViewNone.cpp to the Mac project.
+
+2010-02-10 Adam Roben <aroben@apple.com>
+
+ Optimize ImageBuffer::toDataURL's CG implementation
+
+ There was some unused code that could have been removed in r31830 when
+ this function was changed not to flip the CG image anymore.
+
+ Fixes <http://webkit.org/b/34808> ImageBuffer::toDataURL allocates
+ unnecessary memory under CoreGraphics
+
+ Reviewed by Sam Weinig.
+
+ * platform/graphics/cg/ImageBufferCG.cpp:
+ (WebCore::ImageBuffer::toDataURL): Don't allocate an unused CGImageRef
+ and buffer, and switch to the new overload of base64Encode that
+ doesn't require us to copy all the image data into a Vector first.
+
+ * platform/text/Base64.cpp:
+ (WebCore::base64Encode):
+ * platform/text/Base64.h:
+ Added an overload that takes a raw data pointer and length, just like
+ we have for base64Decode. The overload that takes a Vector as input
+ just calls through to the new overload.
+
+2010-02-10 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Dave Hyatt.
+
+ Complete the fix for <rdar://problem/7577604> Drag and Drop: background elements are bleeding through
+ https://bugs.webkit.org/show_bug.cgi?id=34546
+
+ * manual-tests/drag-image-table-part-decorations.html:
+ * rendering/RenderTableCell.cpp:
+ (WebCore::RenderTableCell::paint): Don’t paint collapsed borders if this object shouldn’t
+ paint within the current painting root.
+
+2010-02-08 Jon Honeycutt <jhoneycutt@apple.com>
+
+ <rdar://problem/7436875> Crash in Flash when visiting
+ http://www.cctv.com/default.shtml (WER ID 819298200) [watson 2502260]
+
+ Reviewed by Darin Adler.
+
+ Test: platform/win/plugins/plugin-delayed-destroy.html
+
+ * bridge/NP_jsobject.cpp:
+ (_NPN_Evaluate):
+ If Flash calls this to evaluate a script that destroys the PluginView,
+ we crash when returning to Flash code. Before evaluating the script,
+ call PluginView::keepAlive() to hold a ref to this instance (and release
+ it asynchronously).
+
+ * plugins/PluginView.cpp:
+ (WebCore::instanceMap):
+ Return a map from the NPP to the PluginView.
+ (WebCore::PluginView::~PluginView):
+ Assert that the keep alive timer is not running; remove ourselves from
+ the instance map.
+ (WebCore::PluginView::performRequest):
+ The parent Frame is now a RefPtr; use .get().
+ (WebCore::PluginView::status):
+ Ditto.
+ (WebCore::PluginView::didReceiveResponse):
+ Ditto.
+ (WebCore::PluginView::PluginView):
+ Add the view to the instance map.
+ (WebCore::PluginView::lifeSupportTimerFired):
+ Deref the PluginView.
+ (WebCore::PluginView::keepAlive):
+ Ref the PluginView, then start a time to release the reference
+ asynchronously.
+ (WebCore::PluginView::keepAlive):
+ Find the PluginView in the map, and call its keepAlive() function.
+
+ * plugins/PluginView.h:
+ Made m_parentFrame a RefPtr, so that it will remain valid when the
+ keep alive timer fires.
+ (WebCore::PluginView::parentFrame):
+ Use .get().
+
+ * plugins/gtk/PluginViewGtk.cpp:
+ (WebCore::PluginView::updatePluginWidget):
+ Use .get().
+ (WebCore::PluginView::handleKeyboardEvent):
+ Use .get().
+ (WebCore::PluginView::handleMouseEvent):
+ Use .get().
+
+ * plugins/PluginViewNone.cpp:
+ (WebCore::PluginView::keepAlive):
+ Stubbed.
+
+2010-02-10 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Support frameset flattening
+ https://bugs.webkit.org/show_bug.cgi?id=32717
+
+ Add support for enabling/disabling FrameSet Flattening on the Mac port.
+
+ * WebCore.base.exp:
+
+2010-02-10 Jeremy Orlow <jorlow@chromium.org>
+
+ Revert 54599 because it breaks a lot of tests on Windows Chrome
+
+ * inspector/front-end/DOMAgent.js:
+ (WebInspector.DOMNode.prototype._insertChild):
+ * inspector/front-end/ElementsPanel.js:
+ (WebInspector.ElementsPanel.prototype.updateModifiedNodes):
+ * inspector/front-end/ElementsTreeOutline.js:
+ (WebInspector.ElementsTreeOutline.prototype.revealAndSelectNode):
+ (WebInspector.ElementsTreeElement):
+ (WebInspector.ElementsTreeElement.prototype._updateChildren.updateChildrenOfNode):
+ (WebInspector.ElementsTreeElement.prototype._updateChildren):
+ ():
+ * inspector/front-end/inspector.css:
+
+2010-02-10 Adam Roben <aroben@apple.com>
+
+ Fix bad paths in WebCore.vcproj
+
+ These were harmless in VS2005, but cause project conversion errors in
+ VS2010 RC.
+
+ Fixes <http://webkit.org/b/34801>.
+
+ Reviewed by Dan Bernstein.
+
+ * WebCore.vcproj/WebCore.vcproj: Removed leading "." from paths to
+ JSHTMLFrameSetElement.{cpp,h}.
+
+2010-02-10 Julien Chaffraix <jchaffraix@webkit.org>
+
+ Not reviewed (build fix).
+
+ * platform/graphics/win/FontCacheWin.cpp:
+ (WebCore::FontCache::getLastResortFallbackFont): Return a
+ SimpleFontData here.
+
+2010-02-10 Julien Chaffraix <jchaffraix@pleyo.com>
+
+ Reviewed by Eric Seidel.
+
+ Bug 23287 - Avoid using FontPlatformData outside the FontCache
+
+ No functional change, only refactored the code using FontPlatformData to use SimpleFontData.
+
+ This change leaves the class FontCached as it needs some thoughts and more refactoring.
+
+ * css/CSSFontFaceSource.cpp:
+ (WebCore::CSSFontFaceSource::getFontData): Call getCachedFontData with the 2 parameters directly.
+ * css/CSSFontSelector.cpp:
+ (WebCore::fontDataForGenericFamily): Ditto.
+ * platform/graphics/FontCache.cpp:
+ (WebCore::FontCache::getCachedFontData): This method is meant to replace getCachedFontPlatformData
+ that was moved in the private section of the class. It calls getCachedFontPlatformData and cache
+ the returned FontPlatformData if it is not null.
+ (WebCore::FontCache::getFontData): Updated to use the new getCachedFontData.
+ * platform/graphics/FontCache.h: Updated several methods to return a SimpleFontData in lieu of a
+ FontPlatformData. Moved some method in the private sections.
+
+ * platform/graphics/chromium/FontCacheChromiumWin.cpp:
+ (WebCore::FontCache::getSimilarFontPlatformData):
+ (WebCore::FontCache::getLastResortFallbackFont):
+ * platform/graphics/chromium/FontCacheLinux.cpp:
+ (WebCore::FontCache::getSimilarFontPlatformData):
+ (WebCore::FontCache::getLastResortFallbackFont):
+ * platform/graphics/gtk/FontCacheGtk.cpp:
+ (WebCore::FontCache::getSimilarFontPlatformData):
+ (WebCore::FontCache::getLastResortFallbackFont):
+ * platform/graphics/haiku/FontCacheHaiku.cpp:
+ (WebCore::FontCache::getSimilarFontPlatformData):
+ (WebCore::FontCache::getLastResortFallbackFont):
+ * platform/graphics/qt/FontCacheQt.cpp:
+ (WebCore::FontCache::getLastResortFallbackFont):
+ * platform/graphics/win/FontCacheWin.cpp:
+ (WebCore::FontCache::getSimilarFontPlatformData):
+ (WebCore::FontCache::getLastResortFallbackFont):
+ * platform/graphics/wince/FontCacheWince.cpp:
+ * platform/graphics/wx/FontCacheWx.cpp:
+ (WebCore::FontCache::getSimilarFontPlatformData):
+ (WebCore::FontCache::getLastResortFallbackFont):
+ Updated all the previous platform methods to return a SimpleFontData.
+
+ * platform/graphics/mac/FontCacheMac.mm:
+ (WebCore::FontCache::getSimilarFontPlatformData): Updated to return a SimpleFontData.
+ (WebCore::FontCache::getLastResortFallbackFont): Ditto. Also refactored the code
+ and moved a DEFINE_STATIC_LOCAL where it is needed.
+
+2010-02-10 Alexander Pavlov <apavlov@chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ Web Inspector: Elements Panel: Limit the number of initially loaded element children
+ https://bugs.webkit.org/show_bug.cgi?id=34421
+
+ Test: inspector/elements-panel-limited-children.html
+
+ * English.lproj/localizedStrings.js:
+ * inspector/front-end/DOMAgent.js:
+ (WebInspector.DOMNode.prototype._insertChild):
+ * inspector/front-end/ElementsPanel.js:
+ (WebInspector.ElementsPanel.prototype.updateModifiedNodes):
+ * inspector/front-end/ElementsTreeOutline.js:
+ (WebInspector.ElementsTreeOutline.prototype.createTreeElementFor):
+ (WebInspector.ElementsTreeOutline.prototype.revealAndSelectNode):
+ (WebInspector.ElementsTreeElement):
+ (WebInspector.ElementsTreeElement.prototype.get expandedChildrenLimit):
+ (WebInspector.ElementsTreeElement.prototype.set expandedChildrenLimit):
+ (WebInspector.ElementsTreeElement.prototype.get expandedChildCount):
+ (WebInspector.ElementsTreeElement.prototype.showChild):
+ (WebInspector.ElementsTreeElement.prototype.insertChildElement):
+ (WebInspector.ElementsTreeElement.prototype.moveChild):
+ (WebInspector.ElementsTreeElement.prototype._updateChildren.updateChildrenOfNode):
+ (WebInspector.ElementsTreeElement.prototype._updateChildren):
+ (WebInspector.ElementsTreeElement.prototype.adjustCollapsedRange):
+ (WebInspector.ElementsTreeElement.prototype.handleLoadAllChildren):
+ ():
+ * inspector/front-end/inspector.css:
+
+2010-02-10 Mikhail Naganov <mnaganov@chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ Remove several #if USE(JSC) branches. Introduce ScriptDebugServer class for
+ making JavaScriptDebugServer engine-agnostic.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34795
+
+ * GNUmakefile.am:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSBindingsAllInOne.cpp:
+ * bindings/js/ScriptDebugServer.cpp: Added.
+ (WebCore::ScriptDebugServer::recompileAllJSFunctions):
+ (WebCore::ScriptDebugServer::recompileAllJSFunctionsSoon):
+ * bindings/js/ScriptDebugServer.h: Added.
+ * bindings/v8/ScriptDebugServer.cpp: Added.
+ (WebCore::ScriptDebugServer::recompileAllJSFunctions):
+ (WebCore::ScriptDebugServer::recompileAllJSFunctionsSoon):
+ * bindings/v8/ScriptDebugServer.h: Added.
+ * inspector/InspectorController.cpp:
+ (WebCore::InspectorController::startUserInitiatedProfiling):
+ (WebCore::InspectorController::enableProfiler):
+ (WebCore::InspectorController::disableProfiler):
+ * page/Console.cpp:
+ (WebCore::Console::profile):
+ (WebCore::Console::profileEnd):
+
+2009-10-06 Yongjun Zhang <yongjun.zhang@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Make JObjectWrapper::ref() and deref() public accessible to derefIfNull().
+
+ Will be reverted when the following winscw compiler bug is fixed.
+ https://xdabug001.ext.nokia.com/bugzilla/show_bug.cgi?id=9812
+
+ https://bugs.webkit.org/show_bug.cgi?id=28054
+
+ * bridge/jni/jsc/JavaInstanceJSC.h:
+ * bridge/jni/v8/JavaInstanceV8.h:
+
+2010-02-10 Yaar Schnitman <yaar@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Simplified RuntimeEnabledFeatures and corresponding v8 generated code
+ https://bugs.webkit.org/show_bug.cgi?id=34667
+
+ * WebCore.gypi:
+ * bindings/generic/RuntimeEnabledFeatures.cpp: Added.
+ (WebCore::RuntimeEnabledFeatures::audioEnabled):
+ (WebCore::RuntimeEnabledFeatures::htmlMediaElementEnabled):
+ (WebCore::RuntimeEnabledFeatures::htmlAudioElementEnabled):
+ (WebCore::RuntimeEnabledFeatures::htmlVideoElementEnabled):
+ (WebCore::RuntimeEnabledFeatures::mediaErrorEnabled):
+ (WebCore::RuntimeEnabledFeatures::sharedWorkerEnabled):
+ (WebCore::RuntimeEnabledFeatures::webSocketEnabled):
+ (WebCore::RuntimeEnabledFeatures::openDatabaseEnabled):
+ * bindings/generic/RuntimeEnabledFeatures.h: Added.
+ (WebCore::RuntimeEnabledFeatures::setLocalStorageEnabled):
+ (WebCore::RuntimeEnabledFeatures::localStorageEnabled):
+ (WebCore::RuntimeEnabledFeatures::setSessionStorageEnabled):
+ (WebCore::RuntimeEnabledFeatures::sessionStorageEnabled):
+ (WebCore::RuntimeEnabledFeatures::setWebkitNotificationsEnabled):
+ (WebCore::RuntimeEnabledFeatures::webkitNotificationsEnabled):
+ (WebCore::RuntimeEnabledFeatures::setApplicationCacheEnabled):
+ (WebCore::RuntimeEnabledFeatures::applicationCacheEnabled):
+ (WebCore::RuntimeEnabledFeatures::setGeolocationEnabled):
+ (WebCore::RuntimeEnabledFeatures::geolocationEnabled):
+ (WebCore::RuntimeEnabledFeatures::setIndexedDBEnabled):
+ (WebCore::RuntimeEnabledFeatures::indexedDBEnabled):
+ (WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures):
+ * bindings/scripts/CodeGenerator.pm:
+ * bindings/scripts/CodeGeneratorV8.pm:
+ * bindings/v8/RuntimeEnabledFeatures.cpp: Removed.
+ * bindings/v8/RuntimeEnabledFeatures.h: Removed.
+ * bindings/v8/custom/V8DOMWindowCustom.cpp:
+ * bindings/v8/custom/V8NavigatorCustom.cpp:
+ * bindings/v8/custom/V8WorkerContextCustom.cpp:
+
+2010-02-09 Alexander Pavlov <apavlov@chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ Web Inspector: Add two basic categories for the Audits panel
+ https://bugs.webkit.org/show_bug.cgi?id=32930
+
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * inspector/front-end/AuditCategories.js: Added.
+ (WebInspector.AuditCategories.PagePerformance):
+ (WebInspector.AuditCategories.PagePerformance.prototype.initialize):
+ (WebInspector.AuditCategories.NetworkUtilization):
+ (WebInspector.AuditCategories.NetworkUtilization.prototype.initialize):
+ * inspector/front-end/AuditLauncherView.js:
+ (WebInspector.AuditLauncherView.prototype.updateResourceTrackingState):
+ (WebInspector.AuditLauncherView.prototype._createLauncherUI):
+ (WebInspector.AuditLauncherView.prototype.show):
+ * inspector/front-end/AuditRules.js: Added.
+ (WebInspector.AuditRules.arrayAsUL):
+ (WebInspector.AuditRules.getDomainToResourcesMap):
+ (WebInspector.AuditRules.evaluateInTargetWindow):
+ (WebInspector.AuditRules.GzipRule):
+ (WebInspector.AuditRules.GzipRule.prototype.doRun):
+ (WebInspector.AuditRules.GzipRule.prototype._isCompressed):
+ (WebInspector.AuditRules.GzipRule.prototype._shouldCompress):
+ (WebInspector.AuditRules.CombineExternalResourcesRule):
+ (WebInspector.AuditRules.CombineExternalResourcesRule.prototype.doRun):
+ (WebInspector.AuditRules.CombineJsResourcesRule):
+ (WebInspector.AuditRules.CombineCssResourcesRule):
+ (WebInspector.AuditRules.MinimizeDnsLookupsRule):
+ (WebInspector.AuditRules.MinimizeDnsLookupsRule.prototype.doRun):
+ (WebInspector.AuditRules.ParallelizeDownloadRule):
+ (WebInspector.AuditRules.ParallelizeDownloadRule.prototype.doRun):
+ (WebInspector.AuditRules.UnusedCssRule):
+ (WebInspector.AuditRules.UnusedCssRule.prototype._getUnusedStylesheetRatioMessage):
+ (WebInspector.AuditRules.UnusedCssRule.prototype._getUnusedTotalRatioMessage):
+ (WebInspector.AuditRules.UnusedCssRule.prototype.doRun.evalCallback):
+ (WebInspector.AuditRules.UnusedCssRule.prototype.doRun.routine):
+ (WebInspector.AuditRules.UnusedCssRule.prototype.doRun):
+ (WebInspector.AuditRules.CacheControlRule):
+ (WebInspector.AuditRules.CacheControlRule.prototype.InfoCheck.1.FailCheck.0.WarningCheck.1.SevereCheck.2.doRun):
+ (WebInspector.AuditRules.CacheControlRule.prototype.handleNonCacheableResources):
+ (WebInspector.AuditRules.CacheControlRule.prototype._cacheableAndNonCacheableResources):
+ (WebInspector.AuditRules.CacheControlRule.prototype.execCheck):
+ (WebInspector.AuditRules.CacheControlRule.prototype.freshnessLifetimeGreaterThan):
+ (WebInspector.AuditRules.CacheControlRule.prototype.responseHeader):
+ (WebInspector.AuditRules.CacheControlRule.prototype.hasResponseHeader):
+ (WebInspector.AuditRules.CacheControlRule.prototype.isCompressible):
+ (WebInspector.AuditRules.CacheControlRule.prototype.isPubliclyCacheable):
+ (WebInspector.AuditRules.CacheControlRule.prototype.responseHeaderMatch):
+ (WebInspector.AuditRules.CacheControlRule.prototype.hasExplicitExpiration):
+ (WebInspector.AuditRules.CacheControlRule.prototype._isExplicitlyNonCacheable):
+ (WebInspector.AuditRules.CacheControlRule.prototype.isCacheableResource):
+ (WebInspector.AuditRules.BrowserCacheControlRule):
+ (WebInspector.AuditRules.BrowserCacheControlRule.prototype.handleNonCacheableResources):
+ (WebInspector.AuditRules.BrowserCacheControlRule.prototype.runChecks):
+ (WebInspector.AuditRules.BrowserCacheControlRule.prototype._missingExpirationCheck):
+ (WebInspector.AuditRules.BrowserCacheControlRule.prototype._varyCheck):
+ (WebInspector.AuditRules.BrowserCacheControlRule.prototype._oneMonthExpirationCheck):
+ (WebInspector.AuditRules.BrowserCacheControlRule.prototype._oneYearExpirationCheck):
+ (WebInspector.AuditRules.ProxyCacheControlRule):
+ (WebInspector.AuditRules.ProxyCacheControlRule.prototype.runChecks):
+ (WebInspector.AuditRules.ProxyCacheControlRule.prototype._questionMarkCheck):
+ (WebInspector.AuditRules.ProxyCacheControlRule.prototype._publicCachingCheck):
+ (WebInspector.AuditRules.ProxyCacheControlRule.prototype._setCookieCacheableCheck):
+ (WebInspector.AuditRules.ImageDimensionsRule):
+ (WebInspector.AuditRules.ImageDimensionsRule.prototype.doRun):
+ (WebInspector.AuditRules.ImageDimensionsRule.prototype.doRun.routine.hasDimension):
+ (WebInspector.AuditRules.ImageDimensionsRule.prototype.doRun.routine.hasWidth):
+ (WebInspector.AuditRules.ImageDimensionsRule.prototype.doRun.routine.hasHeight):
+ (WebInspector.AuditRules.ImageDimensionsRule.prototype.doRun.routine):
+ (WebInspector.AuditRules.CssInHeadRule):
+ (WebInspector.AuditRules.CssInHeadRule.prototype.doRun):
+ (WebInspector.AuditRules.CssInHeadRule.prototype.doRun.routine.allViews):
+ (WebInspector.AuditRules.CssInHeadRule.prototype.doRun.routine):
+ (WebInspector.AuditRules.StylesScriptsOrderRule):
+ (WebInspector.AuditRules.StylesScriptsOrderRule.prototype.doRun):
+ (WebInspector.AuditRules.StylesScriptsOrderRule.prototype.doRun.routine):
+ (WebInspector.AuditRules.CookieRuleBase):
+ (WebInspector.AuditRules.CookieRuleBase.prototype.doRun.resultCallback):
+ (WebInspector.AuditRules.CookieRuleBase.prototype.doRun):
+ (WebInspector.AuditRules.CookieRuleBase.prototype.mapResourceCookies):
+ (WebInspector.AuditRules.CookieRuleBase.prototype._callbackForResourceCookiePairs):
+ (WebInspector.AuditRules.CookieSizeRule):
+ (WebInspector.AuditRules.CookieSizeRule.prototype._average):
+ (WebInspector.AuditRules.CookieSizeRule.prototype._max):
+ (WebInspector.AuditRules.CookieSizeRule.prototype.processCookies):
+ (WebInspector.AuditRules.CookieSizeRule.prototype.processCookies.avgSizeSorter):
+ (WebInspector.AuditRules.StaticCookielessRule):
+ (WebInspector.AuditRules.StaticCookielessRule.prototype.processCookies):
+ (WebInspector.AuditRules.StaticCookielessRule.prototype._collectorCallback):
+ * inspector/front-end/AuditsPanel.js:
+ (WebInspector.AuditsPanel.prototype._constructCategories):
+ (WebInspector.AuditsPanel.prototype._reloadResources):
+ (WebInspector.AuditsPanel.prototype.show):
+ (WebInspector.AuditsPanel.prototype._updateLauncherViewControls):
+ (WebInspector.AuditCategory):
+ (WebInspector.AuditCategory.prototype.get id):
+ (WebInspector.AuditCategory.prototype.get ruleCount):
+ (WebInspector.AuditCategory.prototype.runRules):
+ (WebInspector.AuditCategory.prototype._ensureInitialized):
+ (WebInspector.AuditCategoryResult):
+ * inspector/front-end/WebKit.qrc:
+ * inspector/front-end/audits.css:
+ * inspector/front-end/inspector.html:
+ * inspector/front-end/inspector.js:
+ (WebInspector.loaded):
+ (WebInspector.addPanelToolbarIcon):
+ (WebInspector.documentKeyDown):
+
+2010-02-10 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Freeze sandbox attributes on creation
+ https://bugs.webkit.org/show_bug.cgi?id=34184
+
+ This is how the spec works now.
+
+ Test: fast/frames/sandboxed-iframe-forms-dynamic.html
+
+ * bindings/ScriptControllerBase.cpp:
+ (WebCore::ScriptController::canExecuteScripts):
+ * bindings/generic/BindingDOMWindow.h:
+ (WebCore::::createWindow):
+ * bindings/js/JSDOMWindowCustom.cpp:
+ (WebCore::createWindow):
+ * dom/Document.cpp:
+ * dom/Document.h:
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::submitForm):
+ (WebCore::FrameLoader::requestObject):
+ (WebCore::FrameLoader::shouldAllowNavigation):
+ (WebCore::FrameLoader::updateSandboxFlags):
+ * page/SecurityOrigin.cpp:
+ * page/SecurityOrigin.h:
+
+2010-02-09 Ariya Hidayat <ariya.hidayat@gmail.com>
+
+ Rubber-stamped by Kenneth Rohde Christiansen.
+
+ [Qt] Remove old, outdated unused code block.
+
+ * platform/graphics/qt/GraphicsContextQt.cpp:
+
+2010-02-09 Chris Guillory <ctguil@google.com>
+
+ Reviewed by Darin Fisher.
+
+ [Chromium] Notify ChromeClientChromium of state change notifications.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34464
+
+ * accessibility/chromium/AXObjectCacheChromium.cpp:
+ (WebCore::toChromeClientChromium):
+ (WebCore::AXObjectCache::postPlatformNotification):
+ * page/chromium/ChromeClientChromium.h:
+
+2010-02-09 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Adam Barth.
+
+ [BREWMP] Port PlatformMouseEvent
+ https://bugs.webkit.org/show_bug.cgi?id=34600
+
+ Retrieve the event type, position, key modifiers, time stamp
+ and click count from AEEEvent.
+
+ * platform/PlatformMouseEvent.h:
+ * platform/brew/PlatformMouseEventBrew.cpp: Added.
+ (WebCore::PlatformMouseEvent::PlatformMouseEvent):
+
+2010-02-09 Avi Drissman <avi@chromium.org>
+
+ Reviewed by Timothy Hatcher.
+
+ [Chromium] RenderTheme does not draw focus rings on SL for checkboxes, radio buttons
+ https://bugs.webkit.org/show_bug.cgi?id=34544
+
+ Covered by layout tests when run on SL.
+
+ * platform/chromium/ThemeChromiumMac.mm:
+ (-[TCMVisibleView _focusRingVisibleRect]):
+ (-[TCMVisibleView _focusRingClipAncestor]):
+ (FocusIndicationFix::currentOSHasSetFocusRingStyleInBitmapBug):
+ (FocusIndicationFix::swizzleFocusView):
+ (FocusIndicationFix::ScopedFixer::ScopedFixer):
+ (FocusIndicationFix::ScopedFixer::~ScopedFixer):
+ (+[NSView TCMInterposing_focusView]):
+ (WebCore::paintCheckbox):
+ (WebCore::paintRadio):
+ (WebCore::paintButton):
+
+2010-02-09 Anton Muhin <antonm@chromium.org>
+
+ Reviewed by Nate Chapin.
+
+ [v8] Check if returned wrapper is empty before operating on it.
+ https://bugs.webkit.org/show_bug.cgi?id=34746
+
+ * bindings/v8/custom/V8DocumentCustom.cpp:
+ (WebCore::toV8):
+ * bindings/v8/custom/V8HTMLDocumentCustom.cpp:
+ (WebCore::toV8):
+ * bindings/v8/custom/V8SVGDocumentCustom.cpp:
+ (WebCore::toV8):
+
+2010-02-09 Mikhail Naganov <mnaganov@chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ Continuing debugger and profiler unforking: narrow scope of JSC-specific ifdefs.
+ Also, enable JAVASCRIPT_DEBUGGER explicitly in features, it appears to be required
+ for really enabling it in V8 bindings generation.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34706
+
+ * inspector/InjectedScriptHost.idl:
+ * inspector/InspectorBackend.cpp:
+ (WebCore::InspectorBackend::currentCallFrame):
+ (WebCore::InspectorBackend::getProfile):
+ * inspector/InspectorBackend.h:
+ * inspector/InspectorBackend.idl:
+ * inspector/InspectorController.cpp:
+ (WebCore::InspectorController::InspectorController):
+ (WebCore::InspectorController::addProfile):
+ (WebCore::InspectorController::getProfile):
+ (WebCore::InspectorController::startUserInitiatedProfiling):
+ (WebCore::InspectorController::stopUserInitiatedProfiling):
+ (WebCore::InspectorController::enableProfiler):
+ (WebCore::InspectorController::disableProfiler):
+ * inspector/InspectorController.h:
+ * inspector/InspectorFrontend.cpp:
+ (WebCore::InspectorFrontend::pausedScript):
+ (WebCore::InspectorFrontend::resumedScript):
+ (WebCore::InspectorFrontend::profilerWasEnabled):
+ (WebCore::InspectorFrontend::profilerWasDisabled):
+ (WebCore::InspectorFrontend::didGetProfile):
+ * inspector/InspectorFrontend.h:
+ * page/Console.idl:
+
+2010-02-09 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber Stamped by Geoff Garen.
+
+ Rename StringBuilder::release && JSStringBuilder::releaseJSString
+ to 'build()'.
+
+ * bindings/js/ScriptString.h:
+ (WebCore::ScriptString::operator+=):
+
+2010-02-09 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ <rdar://problem/7400160> Netscape plug-ins are not instantiated on property access if there are pending stylesheets
+ https://bugs.webkit.org/show_bug.cgi?id=34776
+
+ Tests: plugins/instance-available-before-stylesheets-loaded-object.html
+ plugins/instance-available-before-stylesheets-loaded.html
+
+ * html/HTMLEmbedElement.cpp:
+ (WebCore::HTMLEmbedElement::renderWidgetForJSBindings): Call
+ updateLayoutIgnorePendingStylesheets() before checking for a renderer.
+ * html/HTMLObjectElement.cpp:
+ (WebCore::HTMLObjectElement::renderWidgetForJSBindings): Ditto.
+
+2010-02-09 Alejandro G. Castro <alex@igalia.com>
+
+ Reviewed by Darin Adler.
+
+ Problems navigating by caret in links whose text wraps onto
+ subsequent lines.
+ https://bugs.webkit.org/show_bug.cgi?id=25676
+
+ We should not search ahead if we are not in the last element.
+
+ * dom/Position.cpp:
+
+2010-02-09 Dirk Schulze <krit@webkit.org>
+
+ Reviewed by Nikolas Zimmermann.
+
+ More optimization for AffineTransform with SVG
+ https://bugs.webkit.org/show_bug.cgi?id=34774
+
+ Some optimizations to safe unnecessary summations and multiplications.
+ Optimize AffineTransform to handle an identity or translation matrix
+ more efficient.
+ Added translationRight to avoid multiplications of matrices as much as
+ possible.
+
+ No tests added, no change of functionality.
+
+ * platform/graphics/transforms/AffineTransform.cpp:
+ (WebCore::AffineTransform::inverse):
+ (WebCore::AffineTransform::translate):
+ (WebCore::AffineTransform::translateRight):
+ * platform/graphics/transforms/AffineTransform.h:
+ * rendering/RenderForeignObject.cpp:
+ (WebCore::RenderForeignObject::translationForAttributes):
+ (WebCore::RenderForeignObject::localToParentTransform):
+ * rendering/RenderForeignObject.h:
+ * rendering/RenderSVGRoot.cpp:
+ (WebCore::RenderSVGRoot::localToBorderBoxTransform):
+ (WebCore::RenderSVGRoot::localToRepaintContainerTransform):
+ (WebCore::RenderSVGRoot::localToParentTransform):
+ * rendering/RenderSVGViewportContainer.cpp:
+ (WebCore::RenderSVGViewportContainer::localToParentTransform):
+ * rendering/SVGRootInlineBox.cpp:
+ (WebCore::applyTextLengthCorrectionToTextChunk):
+
+2010-02-09 Dirk Schulze <krit@webkit.org>
+
+ Reviewed by Nikolas Zimmermann.
+
+ SVG patterns with some scale patternTransform are not displayed correctly for small elements
+ https://bugs.webkit.org/show_bug.cgi?id=25484
+
+ SVG Pattern size was clipped to the size of the target, if the pattern is bigger than the target. This
+ causes problems, if the patternTransform scales the pattern. This patch deletes the clipping.
+
+ Tests: svg/custom/pattern-excessive-malloc.svg
+ svg/custom/pattern-size-bigger-than-target-size.svg
+ svg/custom/pattern-skew-transformed.svg
+
+ * svg/SVGPatternElement.cpp:
+ (WebCore::SVGPatternElement::buildPattern):
+
+2010-02-09 Darin Adler <darin@apple.com>
+
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::styleDidChange): Fixed typo in comment.
+
+2010-02-09 MORITA Hajime <morrita@gmail.com>
+
+ Reviewed by Nikolas Zimmermann.
+
+ SVG selection text foreground colour does not respect user settings
+ https://bugs.webkit.org/show_bug.cgi?id=15997
+
+ Add two subphases SVGTextPaintSubphaseGlyphFillSelection and
+ SVGTextPaintSubphaseGlyphStrokeSelection for painting selected
+ text on SVG. Selected texts are painted with style from
+ getCachedPseudoStyle() instead of style().
+
+ Tests: svg/text/selection-styles.xhtml
+
+ * rendering/SVGCharacterLayoutInfo.h:
+ (WebCore::SVGTextChunkWalker::SVGTextChunkWalker):
+ (WebCore::SVGTextChunkWalker::setupFillSelection):
+ (WebCore::SVGTextChunkWalker::setupStrokeSelection):
+ * rendering/SVGRootInlineBox.cpp:
+ (WebCore::SVGRootInlineBoxPaintWalker::mayHaveSelection):
+ (WebCore::SVGRootInlineBoxPaintWalker::chunkSetupFillSelectionCallback):
+ (WebCore::SVGRootInlineBoxPaintWalker::chunkSetupStrokeSelectionCallback):
+ (WebCore::SVGRootInlineBoxPaintWalker::activePaintServer):
+ (WebCore::SVGRootInlineBox::paint):
+ (WebCore::SVGRootInlineBox::walkTextChunks):
+ * rendering/SVGInlineTextBox.h:
+ (WebCore::):
+ Add callback hooks and its implementation for handle new
+ subphases.
+
+ * rendering/SVGInlineTextBox.cpp:
+ (WebCore::SVGInlineTextBox::chunkSelectionStartEnd):
+ (WebCore::SVGInlineTextBox::paintCharacters):
+ Split box text into selected part and non-selected part, and use
+ separate subphases to paint them.
+
+ * svg/SVGFont.cpp:
+ (WebCore::SVGTextRunWalker::walk):
+ Relax ASSERT() condition to accept a part of text.
+
+ * svg/graphics/SVGPaintServer.cpp:
+ (WebCore::applyStrokeStyleToContext):
+ (WebCore::SVGPaintServer::setup):
+ * svg/graphics/SVGPaintServer.h:
+ * svg/graphics/SVGPaintServerGradient.cpp:
+ (WebCore::SVGPaintServerGradient::setup):
+ * svg/graphics/SVGPaintServerGradient.h:
+ * svg/graphics/SVGPaintServerPattern.cpp:
+ (WebCore::SVGPaintServerPattern::setup):
+ * svg/graphics/SVGPaintServerPattern.h:
+ * svg/graphics/SVGPaintServerSolid.cpp:
+ (WebCore::SVGPaintServerSolid::setup):
+ * svg/graphics/SVGPaintServerSolid.h:
+ Change setup() signature to accept RenderStyle instead of always
+ using RenderObject::style().
+
+2010-02-09 Nikolas Zimmermann <nzimmermann@rim.com>
+
+ Reviewed by Dirk Schulze.
+
+ No scroll bars are displayed for standalone SVG image
+ https://bugs.webkit.org/show_bug.cgi?id=11225
+
+ Height and width defined for svg element are not honored
+ https://bugs.webkit.org/show_bug.cgi?id=24033
+
+ SVG file does not pan and has no scroll bars
+ https://bugs.webkit.org/show_bug.cgi?id=24448
+
+ Adapt to SVG 1.1 errata to change the overflow handling:
+ Replace "svg { overflow: hidden }" by "svg:not(:root) { overflow: hidden }" to allow standalone SVG documents to contain scrolllbars.
+ Agreed by SVG WG to make this the default behaviour, already implemented by Opera & FireFox (partial support).
+
+ Add new tests in svg/overflow covering all special SVG css overflow handling rules on inner/outer svg elements.
+
+ Tests: svg/overflow/overflow-on-inner-svg-element-defaults.svg
+ svg/overflow/overflow-on-inner-svg-element.svg
+ svg/overflow/overflow-on-outermost-svg-element-defaults.svg
+ svg/overflow/overflow-on-outermost-svg-element-ignore-attribute-1.svg
+ svg/overflow/overflow-on-outermost-svg-element-ignore-attribute-2.svg
+ svg/overflow/overflow-on-outermost-svg-element-ignore-attribute-3.svg
+ svg/overflow/overflow-on-outermost-svg-element-in-xhtml-auto.xhtml
+ svg/overflow/overflow-on-outermost-svg-element-in-xhtml-defaults.xhtml
+ svg/overflow/overflow-on-outermost-svg-element-in-xhtml-hidden.xhtml
+ svg/overflow/overflow-on-outermost-svg-element-in-xhtml-scroll.xhtml
+ svg/overflow/overflow-on-outermost-svg-element-in-xhtml-visible.xhtml
+
+ * css/svg.css: Change default <svg> overflow rule to only apply to inner <svg> elements.
+ * page/FrameView.cpp:
+ (WebCore::FrameView::layout): Only apply overflow rules for non-standalone SVG documents.
+ * rendering/RenderSVGRoot.cpp: Remove all calls to isOverflowHidden - it's always the case for the outermost SVG element, see spec + errata.
+ (WebCore::RenderSVGRoot::paint): Always clip to initial viewport size.
+ (WebCore::RenderSVGRoot::computeRectForRepaint): Ditto.
+ (WebCore::RenderSVGRoot::nodeAtPoint): Simplify.
+ * rendering/RenderSVGViewportContainer.cpp:
+ (WebCore::RenderSVGViewportContainer::applyViewportClip): Use isOverflowHidden() instead of a manual oveflow query and clip in float precision.
+ * rendering/SVGRenderSupport.cpp:
+ (WebCore::SVGRenderBase::isOverflowHidden): Simplify implementation, assure the function is not called anymore for RenderSVGRoot objects.
+
+2010-02-09 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Port KURL::fileSystemPath
+ https://bugs.webkit.org/show_bug.cgi?id=34516
+
+ Convert a file URL to a file path by prefixing
+ AEEFS_HOME_DIR to access files relative to the current
+ module directory in a case-sensitive manner.
+
+ As IWeb "file:" engine opens files in BREW's application-relative
+ file namespace, we follow the same policy here.
+
+ * platform/brew/KURLBrew.cpp: Added.
+ (WebCore::KURL::fileSystemPath):
+
+2010-02-09 Noam Rosenthal <noam.rosenthal@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] the above website does not render properly when in compositing mode
+ https://bugs.webkit.org/show_bug.cgi?id=34681
+
+ http://media.24ways.org/2009/15/spinner-alt.html now renders correctly
+
+ * platform/graphics/qt/GraphicsLayerQt.cpp:
+ (WebCore::MaskEffectQt::MaskEffectQt): implement mask as
+ QGraphicsEffect
+ (WebCore::MaskEffectQt::draw): reimp
+ (WebCore::GraphicsLayerQtImpl::GraphicsLayerQtImpl): init the effect
+ (WebCore::GraphicsLayerQtImpl::paint): no need for drawContents
+ (WebCore::GraphicsLayerQtImpl::flushChanges): make sure to update the
+ mask layer, not just the actual children
+
+2010-02-09 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Laszlo Gombos.
+
+ [BREWMP] Fix macro redefinition error in BREWMP simulator build.
+ https://bugs.webkit.org/show_bug.cgi?id=34738
+
+ Remove warning: 'FAR' macro redefinition.
+
+ * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
+
+2010-02-07 Yuzo Fujishima <yuzo@google.com>
+
+ Reviewed by Dan Bernstein.
+
+ Fix the following bugs:
+ https://bugs.webkit.org/show_bug.cgi?id=18926 - dt:after generate a line break. Boost documentation page renders poorly
+ https://bugs.webkit.org/show_bug.cgi?id=7276 - Most W3C padding related tests fail
+
+ Tests: fast/css/inline-element-line-break.html
+ fast/css/pseudo-element-line-break.html
+
+ findNextLineBreak() unconditionally allowed lines to break between elements when no other line breaking opportunity had been found,
+ but that was unnecessary and led to incorrect layout. Disallow that kind of line breaks.
+
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::RenderBlock::findNextLineBreak):
+
+2010-02-09 Shinichiro Hamaji <hamaji@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Provide a way to get total number of pages to be printed
+ https://bugs.webkit.org/show_bug.cgi?id=34699
+
+ Test: printing/numberOfPages.html
+
+ * WebCore.base.exp:
+ * page/PrintContext.cpp:
+ (WebCore::PrintContext::pageNumberForElement):
+ (WebCore::PrintContext::numberOfPages):
+ * page/PrintContext.h:
+ (WebCore::PrintContext::pageRects):
+
+2010-02-08 Dominic Cooney <dominicc@google.com>
+
+ Reviewed by Adam Barth.
+
+ [V8] Move Element custom methods into generic bindings
+
+ This patch moves the security checks in setAttribute,
+ setAttributeNode, setAttributeNS and setAttributeNodeNS from
+ V8ElementCustom into the generic bindings so that they can be
+ reused in other bindings. This is in a similar vein to
+ <https://bugs.webkit.org/attachment.cgi?id=45872>.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34554
+
+ LayoutTests: None
+
+ * WebCore.gypi:
+ * bindings/generic/BindingElement.h: Added.
+ (WebCore::::setAttribute):
+ (WebCore::::setAttributeNode):
+ (WebCore::::setAttributeNS):
+ (WebCore::::setAttributeNodeNS):
+ * bindings/v8/V8Binding.h:
+ * bindings/v8/custom/V8ElementCustom.cpp:
+ (WebCore::V8Element::setAttributeCallback):
+ (WebCore::V8Element::setAttributeNodeCallback):
+ (WebCore::V8Element::setAttributeNSCallback):
+ (WebCore::V8Element::setAttributeNodeNSCallback):
+
+2010-02-08 Hayato Ito <hayato@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Schedule a loading request when there are many in-flight requests beyond
+ the limit to avoid forever page loading.
+
+ https://bugs.webkit.org/show_bug.cgi?id=31227
+
+ Test: http/tests/loading/load-javascript-after-many-xhrs.html
+
+ * loader/loader.cpp:
+ (WebCore::Loader::Host::servePendingRequests):
+
+2010-02-08 David Levin <levin@chromium.org>
+
+ Reviewed by Gavin Barraclough.
+
+ REGRESSION (before r54472): Various tests in fast/workers are crashing on the buildbot.
+ https://bugs.webkit.org/show_bug.cgi?id=34728
+
+ The core part of the fix is to change WebCoreJSClientData::m_normalWorld
+ from DOMWrapperWorld to RefPtr<DOMWrapperWorld> so that the DOMWrapperWorld
+ is really ref counted.
+
+ No new tests because current tests sufficiently cover this as evidenced as
+ the buildbot crashes.
+
+ * bindings/js/JSDOMBinding.cpp:
+ (WebCore::DOMWrapperWorld::~DOMWrapperWorld): Made this robust to m_globalData
+ being 0.
+ * bindings/js/JSDOMBinding.h:
+ (WebCore::DOMWrapperWorld::create): Made this class follow the standard
+ create pattern for RefCounted classes.
+ (WebCore::DOMWrapperWorld::detachFromGlobalData): Since this class can
+ now outlive JSGlobalData, this method tells it to stop using its JSGlobalData.
+ (WebCore::WebCoreJSClientData::WebCoreJSClientData): Adjusted due to
+ m_normalWorld being a RefPtr.
+ (WebCore::WebCoreJSClientData::~WebCoreJSClientData): Ditto (and added
+ asserts for the FIXME).
+ (WebCore::WebCoreJSClientData::normalWorld): Ditto.
+ * bindings/js/ScriptController.cpp:
+ (WebCore::IsolatedWorld::create): Made the constructor protected.
+ (WebCore::IsolatedWorld::IsolatedWorld): Made the constructor protected, so
+ that code would have to use the create method.
+
+2010-02-08 Kinuko Yasuda <kinuko@chromium.org>
+
+ Reviewed by David Levin.
+
+ Remove special utf-8 tag from Chromium cilpboard code because
+ we now have the corresponding code in generic clipboard framework
+ code in chromium (since it's needed by other places than in Web
+ page rendering) and no longer need the separate workaround code in
+ WebKit.
+ https://bugs.webkit.org/show_bug.cgi?id=34567
+
+ Test: (for regression) editing/pasteboard
+
+ * platform/chromium/ClipboardChromium.cpp:
+ (WebCore::ClipboardChromium::writeRange):
+ * platform/chromium/PasteboardChromium.cpp:
+ (WebCore::Pasteboard::writeSelection):
+ (WebCore::Pasteboard::documentFragment):
+
+2010-02-08 Darin Adler <darin@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Crash due to layout not done in case involving removal of absolute positioning
+ https://bugs.webkit.org/show_bug.cgi?id=34734
+ rdar://problem/7588280
+
+ Test: fast/dynamic/position-change-layout.html
+
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::styleDidChange): Call markContainingBlocksForLayout in
+ a case where the object already needs layout, but might have a new containing
+ block and so needs to mark the new containing block.
+
+2010-02-08 Charlie Reis <creis@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ onbeforeunload not called at window close + frame or iframe focused
+ https://bugs.webkit.org/show_bug.cgi?id=27481
+
+ Chromium and WebKit on Windows will now fire beforeunload handlers
+ even if an inner frame is focused.
+
+ Layout tests aren't able to test this bug, since it requires closing
+ the actual browser window, not calling window.close(). Instead,
+ test with WebCore/manual-tests/onbeforeunload-focused-iframe.html.
+
+ * manual-tests/onbeforeunload-focused-iframe.html: Added.
+ * manual-tests/resources/focused-iframe.html: Added.
+
+2010-02-08 Alexey Proskuryakov <ap@apple.com>
+
+ Addressing review feedback.
+
+ * bridge/c/c_instance.h: Removed argument name.
+
+2010-02-08 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34727
+ Assertion crashes and freezes when plug-in property access results in an exception
+
+ Test: plugins/netscape-plugin-property-access-exception.html
+
+ * bridge/c/c_instance.h: Made moveGlobalExceptionToExecState public, since it also need to
+ be called from CField.
+
+ * bridge/c/c_runtime.cpp:
+ (JSC::Bindings::CField::valueFromInstance): Call moveGlobalExceptionToExecState(). Without
+ this, not only didn't we get exceptions, but we also got an assertion failure because of
+ dangling global exception on next call into plug-in.
+ (JSC::Bindings::CField::setValueToInstance): Ditto.
+
+2010-02-08 Dirk Schulze <krit@webkit.org>
+
+ Unreviewed build fix of ChromiumWin.
+
+ * platform/graphics/chromium/TransparencyWin.cpp:
+ (WebCore::):
+ (WebCore::TransparencyWin::setupLayerForOpaqueCompositeLayer):
+ (WebCore::TransparencyWin::setupTransformForKeepTransform):
+ * platform/graphics/chromium/TransparencyWin.h:
+ * rendering/RenderThemeChromiumWin.cpp:
+ (WebCore::):
+
+2010-02-05 Dumitru Daniliuc <dumi@chromium.org>
+
+ Reviewed by Jeremy Orlow.
+
+ Adding a way to get the set of all open database handles pointing
+ to a given database.
+ https://bugs.webkit.org/show_bug.cgi?id=34619
+
+ Sometimes we need to be able to close all handles to a database as
+ soon as possible (to delete the DB file, for example).
+
+ * storage/DatabaseTracker.cpp:
+ (WebCore::DatabaseTracker::getOpenDatabases):
+ * storage/DatabaseTracker.h:
+ * storage/chromium/DatabaseTrackerChromium.cpp:
+ (WebCore::DatabaseTracker::addOpenDatabase):
+ (WebCore::DatabaseTracker::removeOpenDatabase):
+ (WebCore::DatabaseTracker::getOpenDatabases):
+
+2010-02-08 Dirk Schulze <krit@webkit.org>
+
+ Unreviewed windows build-fix.
+
+ * page/win/FrameCGWin.cpp:
+ (WebCore::drawRectIntoContext):
+
+2010-02-08 Dirk Schulze <krit@webkit.org>
+
+ Reviewed by Nikolas Zimmermann.
+
+ Add back an AffineTransform class for use by SVG
+ https://bugs.webkit.org/show_bug.cgi?id=33750
+
+ This adds back AffineTransform. This saves additional 4% memory consumption
+ on the 50k rects stress test: https://bugs.webkit.org/attachment.cgi?id=46721
+ It also makes it possible to optimize the calculations internally of
+ AffineTransform to the needs of 2D transformations (the second benefit for SVG,
+ which uses transformations relative often at the moment.
+ Everything that is 2D related (like images, patterns, gradients, fonts), uses
+ AffineTransform now.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSSVGMatrixCustom.cpp:
+ (WebCore::JSSVGMatrix::multiply):
+ (WebCore::JSSVGMatrix::inverse):
+ (WebCore::JSSVGMatrix::rotateFromVector):
+ * bindings/js/JSSVGPODTypeWrapper.h:
+ * bindings/scripts/CodeGeneratorJS.pm:
+ * bindings/scripts/CodeGeneratorObjC.pm:
+ * bindings/scripts/CodeGeneratorV8.pm:
+ * bindings/v8/V8Index.h:
+ * bindings/v8/custom/V8SVGMatrixCustom.cpp:
+ (WebCore::V8SVGMatrix::multiplyCallback):
+ (WebCore::V8SVGMatrix::inverseCallback):
+ (WebCore::V8SVGMatrix::rotateFromVectorCallback):
+ * html/HTMLCanvasElement.cpp: Changed to AffineTransform now
+ (WebCore::HTMLCanvasElement::baseTransform):
+ * html/HTMLCanvasElement.h:
+ * platform/graphics/FloatPoint.cpp:
+ (WebCore::FloatPoint::matrixTransform):
+ * platform/graphics/FloatPoint.h:
+ * platform/graphics/GeneratedImage.cpp:
+ (WebCore::GeneratedImage::drawPattern):
+ * platform/graphics/GeneratedImage.h:
+ * platform/graphics/Gradient.cpp:
+ (WebCore::Gradient::setGradientSpaceTransform):
+ (WebCore::Gradient::setPlatformGradientSpaceTransform):
+ * platform/graphics/Gradient.h:
+ (WebCore::Gradient::gradientSpaceTransform):
+ * platform/graphics/GraphicsContext.h:
+ * platform/graphics/Image.cpp:
+ (WebCore::Image::drawTiled):
+ * platform/graphics/Image.h:
+ * platform/graphics/ImageBuffer.h:
+ (WebCore::ImageBuffer::baseTransform):
+ * platform/graphics/Path.h:
+ * platform/graphics/Pattern.cpp:
+ (WebCore::Pattern::setPatternSpaceTransform):
+ * platform/graphics/Pattern.h:
+ (WebCore::Pattern::create):
+ (WebCore::Pattern::tileImage):
+ * platform/graphics/cairo/FontCairo.cpp:
+ (WebCore::Font::drawGlyphs):
+ * platform/graphics/cairo/GraphicsContextCairo.cpp:
+ (WebCore::setPlatformFill):
+ (WebCore::setPlatformStroke):
+ (WebCore::GraphicsContext::getCTM):
+ * platform/graphics/cairo/ImageCairo.cpp:
+ (WebCore::Image::drawPattern):
+ * platform/graphics/cairo/PathCairo.cpp:
+ * platform/graphics/cairo/PatternCairo.cpp:
+ (WebCore::Pattern::createPlatformPattern):
+ * platform/graphics/cg/GraphicsContextCG.cpp:
+ (WebCore::GraphicsContext::getCTM):
+ * platform/graphics/cg/GraphicsContextPlatformPrivateCG.h:
+ (WebCore::GraphicsContextPlatformPrivate::concatCTM):
+ * platform/graphics/cg/ImageCG.cpp:
+ (WebCore::Image::drawPattern):
+ * platform/graphics/cg/PathCG.cpp:
+ * platform/graphics/cg/PatternCG.cpp:
+ (WebCore::Pattern::createPlatformPattern):
+ * platform/graphics/haiku/GraphicsContextHaiku.cpp:
+ (WebCore::GraphicsContext::getCTM):
+ * platform/graphics/haiku/ImageHaiku.cpp:
+ (WebCore::Image::drawPattern):
+ * platform/graphics/haiku/PathHaiku.cpp:
+ * platform/graphics/qt/FontQt.cpp:
+ (WebCore::Font::drawComplexText):
+ * platform/graphics/qt/GraphicsContextQt.cpp:
+ (WebCore::GraphicsContext::getCTM):
+ (WebCore::GraphicsContext::fillPath):
+ (WebCore::GraphicsContext::strokePath):
+ (WebCore::GraphicsContext::fillRect):
+ * platform/graphics/qt/ImageQt.cpp:
+ (WebCore::Image::drawPattern):
+ * platform/graphics/qt/PathQt.cpp:
+ * platform/graphics/qt/PatternQt.cpp:
+ (WebCore::Pattern::createPlatformPattern):
+ * platform/graphics/skia/GradientSkia.cpp:
+ (WebCore::Gradient::setPlatformGradientSpaceTransform):
+ * platform/graphics/skia/GraphicsContextSkia.cpp:
+ (WebCore::GraphicsContext::getCTM):
+ * platform/graphics/skia/ImageSkia.cpp:
+ (WebCore::Image::drawPattern):
+ * platform/graphics/skia/PathSkia.cpp:
+ * platform/graphics/skia/PatternSkia.cpp:
+ (WebCore::Pattern::platformPattern):
+ * platform/graphics/skia/SkiaFontWin.cpp:
+ (WebCore::windowsCanHandleTextDrawing):
+ * platform/graphics/transforms/AffineTransform.cpp:
+ (WebCore::AffineTransform::makeIdentity): needed by some parts of WebCore
+ (WebCore::AffineTransform::scale): Didn't scale the complete matrix
+ (WebCore::AffineTransform::translate): Didn't respect other transformations
+ (WebCore::AffineTransform::shear): direct calculation, no extra multiply of matrices
+ (WebCore::AffineTransform::map):
+ (WebCore::AffineTransform::mapPoint):
+ (WebCore::AffineTransform::mapRect):
+ * platform/graphics/transforms/AffineTransform.h:
+ (WebCore::AffineTransform::isIdentityOrTranslation):
+ * platform/graphics/transforms/TransformationMatrix.cpp:
+ (WebCore::TransformationMatrix::toAffineTransform):
+ * platform/graphics/transforms/TransformationMatrix.h:
+ * platform/graphics/win/FontCGWin.cpp:
+ (WebCore::drawGDIGlyphs):
+ * platform/graphics/win/GraphicsContextCGWin.cpp:
+ * platform/graphics/win/GraphicsContextCairoWin.cpp:
+ * platform/graphics/win/GraphicsContextWin.cpp:
+ (WebCore::GraphicsContextPlatformPrivate::concatCTM):
+ * platform/graphics/wince/FontWince.cpp:
+ * platform/graphics/wince/GraphicsContextWince.cpp:
+ (WebCore::GraphicsContextPlatformPrivate::concatCTM):
+ (WebCore::GraphicsContext::fillPath):
+ (WebCore::GraphicsContext::strokePath):
+ (WebCore::GraphicsContext::getCTM):
+ (WebCore::GraphicsContext::drawBitmapPattern):
+ * platform/graphics/wince/ImageBufferWince.cpp:
+ (WebCore::):
+ (WebCore::BufferedImage::drawPattern):
+ * platform/graphics/wince/PathWince.cpp:
+ (WebCore::Path::transform):
+ * platform/graphics/wince/PlatformPathWince.cpp:
+ (WebCore::drawPolygons):
+ (WebCore::PathPolygon::transform):
+ (WebCore::PlatformPathElement::transform):
+ (WebCore::PlatformPath::strokePath):
+ (WebCore::PlatformPath::fillPath):
+ (WebCore::PlatformPath::transform):
+ * platform/graphics/wince/PlatformPathWince.h:
+ (WebCore::):
+ * platform/graphics/wx/GraphicsContextWx.cpp:
+ (WebCore::GraphicsContext::getCTM):
+ * platform/graphics/wx/ImageWx.cpp:
+ (WebCore::BitmapImage::drawPattern):
+ (WebCore::Image::drawPattern):
+ * platform/graphics/wx/PathWx.cpp:
+ * platform/gtk/RenderThemeGtk.cpp:
+ (WebCore::paintMozillaGtkWidget):
+ * plugins/win/PluginViewWin.cpp:
+ (WebCore::PluginView::paintWindowedPluginIntoContext):
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::localTransform):
+ * rendering/RenderBox.h:
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelScaleData::RenderBoxModelScaleData):
+ (WebCore::RenderBoxModelScaleData::transform):
+ (WebCore::RenderBoxModelScaleData::setTransform):
+ (WebCore::RenderBoxModelScaleObserver::shouldPaintBackgroundAtLowQuality):
+ (WebCore::RenderBoxModelObject::paintBoxShadow):
+ * rendering/RenderForeignObject.cpp:
+ (WebCore::RenderForeignObject::translationForAttributes):
+ (WebCore::RenderForeignObject::localToParentTransform):
+ * rendering/RenderForeignObject.h:
+ (WebCore::RenderForeignObject::localTransform):
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::paintLayer):
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::localTransform):
+ (WebCore::RenderObject::localToParentTransform):
+ (WebCore::RenderObject::absoluteTransform):
+ * rendering/RenderObject.h:
+ * rendering/RenderPath.cpp:
+ (WebCore::RenderPath::localToParentTransform):
+ (WebCore::RenderPath::localTransform):
+ * rendering/RenderPath.h:
+ * rendering/RenderSVGHiddenContainer.h:
+ (WebCore::RenderSVGHiddenContainer::absoluteTransform):
+ * rendering/RenderSVGImage.h:
+ (WebCore::RenderSVGImage::localToParentTransform):
+ (WebCore::RenderSVGImage::localTransform):
+ * rendering/RenderSVGRoot.cpp:
+ (WebCore::RenderSVGRoot::localToBorderBoxTransform):
+ (WebCore::RenderSVGRoot::localToRepaintContainerTransform):
+ (WebCore::RenderSVGRoot::localToParentTransform):
+ (WebCore::RenderSVGRoot::absoluteTransform):
+ (WebCore::RenderSVGRoot::localTransform):
+ * rendering/RenderSVGRoot.h:
+ * rendering/RenderSVGText.h:
+ (WebCore::RenderSVGText::localToParentTransform):
+ (WebCore::RenderSVGText::localTransform):
+ * rendering/RenderSVGTransformableContainer.cpp:
+ (WebCore::RenderSVGTransformableContainer::localToParentTransform):
+ (WebCore::RenderSVGTransformableContainer::localTransform):
+ (WebCore::RenderSVGTransformableContainer::calculateLocalTransform):
+ * rendering/RenderSVGTransformableContainer.h:
+ * rendering/RenderSVGViewportContainer.cpp:
+ (WebCore::RenderSVGViewportContainer::markerBoundaries):
+ (WebCore::RenderSVGViewportContainer::markerContentTransformation):
+ (WebCore::RenderSVGViewportContainer::viewportTransform):
+ (WebCore::RenderSVGViewportContainer::localToParentTransform):
+ (WebCore::RenderSVGViewportContainer::absoluteTransform):
+ * rendering/RenderSVGViewportContainer.h:
+ * rendering/SVGCharacterLayoutInfo.cpp:
+ (WebCore::SVGChar::characterTransform):
+ * rendering/SVGCharacterLayoutInfo.h:
+ (WebCore::SVGTextChunkWalker::operator()):
+ * rendering/SVGInlineTextBox.cpp:
+ (WebCore::SVGInlineTextBox::calculateGlyphBoundaries):
+ (WebCore::SVGInlineTextBoxClosestCharacterToPositionWalker::chunkPortionCallback):
+ (WebCore::SVGInlineTextBoxSelectionRectWalker::chunkPortionCallback):
+ (WebCore::SVGInlineTextBox::paintCharacters):
+ (WebCore::SVGInlineTextBox::paintDecoration):
+ * rendering/SVGMarkerLayoutInfo.h:
+ (WebCore::MarkerLayout::MarkerLayout):
+ * rendering/SVGRenderSupport.cpp:
+ (WebCore::applyTransformToPaintInfo):
+ * rendering/SVGRenderSupport.h:
+ * rendering/SVGRenderTreeAsText.cpp:
+ (WebCore::operator<<):
+ * rendering/SVGRenderTreeAsText.h:
+ * rendering/SVGRootInlineBox.cpp:
+ (WebCore::SVGRootInlineBoxPaintWalker::chunkPortionCallback):
+ (WebCore::applyTextLengthCorrectionToTextChunk):
+ (WebCore::SVGRootInlineBox::buildLayoutInformation):
+ * rendering/TransformState.cpp:
+ (WebCore::TransformState::applyTransform):
+ * rendering/TransformState.h:
+ * svg/GradientAttributes.h:
+ (WebCore::GradientAttributes::gradientTransform):
+ (WebCore::GradientAttributes::setGradientTransform):
+ * svg/PatternAttributes.h:
+ (WebCore::PatternAttributes::patternTransform):
+ (WebCore::PatternAttributes::setPatternTransform):
+ * svg/SVGAnimateMotionElement.cpp:
+ (WebCore::SVGAnimateMotionElement::resetToBaseValue):
+ (WebCore::SVGAnimateMotionElement::calculateAnimatedValue):
+ (WebCore::SVGAnimateMotionElement::applyResultsToTarget):
+ * svg/SVGAnimateMotionElement.h:
+ * svg/SVGAnimateTransformElement.cpp:
+ * svg/SVGAnimateTransformElement.h:
+ * svg/SVGElement.h:
+ (WebCore::SVGElement::supplementalTransform):
+ * svg/SVGFitToViewBox.cpp:
+ (WebCore::SVGFitToViewBox::viewBoxToViewTransform):
+ * svg/SVGFitToViewBox.h:
+ * svg/SVGLocatable.cpp:
+ (WebCore::SVGLocatable::getCTM):
+ (WebCore::SVGLocatable::getScreenCTM):
+ (WebCore::SVGLocatable::getTransformToElement):
+ * svg/SVGLocatable.h:
+ * svg/SVGMarkerElement.cpp:
+ (WebCore::SVGMarkerElement::viewBoxToViewTransform):
+ * svg/SVGMarkerElement.h:
+ * svg/SVGMaskElement.cpp:
+ (WebCore::SVGMaskElement::drawMaskerContent):
+ * svg/SVGMatrix.idl:
+ * svg/SVGPatternElement.cpp:
+ (WebCore::SVGPatternElement::buildPattern):
+ * svg/SVGPreserveAspectRatio.cpp:
+ (WebCore::SVGPreserveAspectRatio::getCTM):
+ * svg/SVGPreserveAspectRatio.h:
+ * svg/SVGSVGElement.cpp:
+ (WebCore::SVGSVGElement::viewport):
+ (WebCore::SVGSVGElement::createSVGMatrix):
+ (WebCore::SVGSVGElement::createSVGTransformFromMatrix):
+ (WebCore::SVGSVGElement::getCTM):
+ (WebCore::SVGSVGElement::getScreenCTM):
+ (WebCore::SVGSVGElement::viewBoxToViewTransform):
+ * svg/SVGSVGElement.h:
+ * svg/SVGStyledLocatableElement.cpp:
+ (WebCore::SVGStyledLocatableElement::getCTM):
+ (WebCore::SVGStyledLocatableElement::getScreenCTM):
+ * svg/SVGStyledLocatableElement.h:
+ * svg/SVGStyledTransformableElement.cpp:
+ (WebCore::SVGStyledTransformableElement::getCTM):
+ (WebCore::SVGStyledTransformableElement::getScreenCTM):
+ (WebCore::SVGStyledTransformableElement::animatedLocalTransform):
+ (WebCore::SVGStyledTransformableElement::supplementalTransform):
+ * svg/SVGStyledTransformableElement.h:
+ (WebCore::SVGStyledTransformableElement::isStyledTransformable):
+ (WebCore::SVGStyledTransformableElement::toPathData):
+ * svg/SVGTextContentElement.cpp:
+ (WebCore::SVGInlineTextBoxQueryWalker::chunkPortionCallback):
+ * svg/SVGTextElement.cpp:
+ (WebCore::SVGTextElement::getScreenCTM):
+ (WebCore::SVGTextElement::getCTM):
+ (WebCore::SVGTextElement::animatedLocalTransform):
+ (WebCore::SVGTextElement::supplementalTransform):
+ * svg/SVGTextElement.h:
+ * svg/SVGTextPathElement.cpp:
+ * svg/SVGTransform.cpp:
+ (SVGTransform::SVGTransform):
+ (SVGTransform::matrix):
+ (SVGTransform::setMatrix):
+ * svg/SVGTransform.h:
+ * svg/SVGTransformDistance.cpp:
+ (WebCore::SVGTransformDistance::SVGTransformDistance):
+ (WebCore::SVGTransformDistance::scaledDistance):
+ (WebCore::SVGTransformDistance::isZero):
+ * svg/SVGTransformDistance.h:
+ * svg/SVGTransformList.cpp:
+ (SVGTransformList::createSVGTransformFromMatrix):
+ (SVGTransformList::concatenate):
+ (SVGTransformList::valueAsString):
+ * svg/SVGTransformList.h:
+ * svg/SVGTransformable.cpp:
+ (WebCore::SVGTransformable::getCTM):
+ (WebCore::SVGTransformable::getScreenCTM):
+ (WebCore::SVGTransformable::parseTransformValue):
+ * svg/SVGTransformable.h:
+ (WebCore::SVGTransformable::):
+ * svg/graphics/SVGPaintServerGradient.cpp:
+ (WebCore::SVGPaintServerGradient::gradientTransform):
+ (WebCore::SVGPaintServerGradient::setGradientTransform):
+ (WebCore::clipToTextMask):
+ (WebCore::SVGPaintServerGradient::setup):
+ * svg/graphics/SVGPaintServerGradient.h:
+ * svg/graphics/SVGPaintServerPattern.cpp:
+ (WebCore::SVGPaintServerPattern::patternTransform):
+ (WebCore::SVGPaintServerPattern::setPatternTransform):
+ (WebCore::SVGPaintServerPattern::setup):
+ * svg/graphics/SVGPaintServerPattern.h:
+ * svg/graphics/SVGResourceClipper.cpp:
+ (WebCore::SVGResourceClipper::applyClip):
+ * svg/graphics/SVGResourceMarker.cpp:
+ (WebCore::SVGResourceMarker::markerTransformation):
+ (WebCore::SVGResourceMarker::draw):
+ * svg/graphics/SVGResourceMarker.h:
+ * svg/graphics/filters/SVGFEImage.cpp:
+ * svg/graphics/filters/SVGFETile.cpp:
+ (WebCore::FETile::apply):
+
+2010-02-08 Stephen White <senorblanco@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Make an inline function containing a static var out-of-line. This is
+ a workaround for Xcode 3.1 bug radar 7070016. We tripped on this in
+ deviceRGBColorSpaceRef on the Chromium canaries. This is a proactive
+ fix for the same problem in sRGBColorSpaceRef().
+
+ https://bugs.webkit.org/show_bug.cgi?id=34663
+
+ * platform/graphics/cg/GraphicsContextCG.cpp:
+ (WebCore::sRGBColorSpaceRef):
+ * platform/graphics/cg/GraphicsContextPlatformPrivateCG.h:
+
+2010-02-08 Nate Chapin <japhet@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ [V8] Unify the WorkerContext V8 object wrapping code with
+ the standard V8 object wrapping code.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34658
+
+ * bindings/scripts/CodeGeneratorV8.pm:
+ * bindings/v8/V8DOMWrapper.cpp:
+ (WebCore::V8DOMWrapper::instantiateV8Object):
+ (WebCore::V8DOMWrapper::convertEventTargetToV8Object):
+ * bindings/v8/V8WorkerContextEventListener.cpp:
+ (WebCore::V8WorkerContextEventListener::handleEvent):
+ (WebCore::V8WorkerContextEventListener::getReceiverObject):
+ * bindings/v8/WorkerContextExecutionProxy.cpp:
+ * bindings/v8/WorkerContextExecutionProxy.h:
+ * bindings/v8/custom/V8NotificationCenterCustom.cpp:
+ (WebCore::V8NotificationCenter::createHTMLNotificationCallback):
+ (WebCore::V8NotificationCenter::createNotificationCallback):
+ * bindings/v8/custom/V8WorkerContextCustom.cpp:
+ (WebCore::toV8):
+
+2010-02-08 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Darin Adler.
+
+ Use fastStrDup instead of strdup
+ https://bugs.webkit.org/show_bug.cgi?id=33943
+
+ Replace strdup/free with fastStrDup/fastFree.
+
+ * bridge/IdentifierRep.h:
+ (WebCore::IdentifierRep::IdentifierRep):
+ * bridge/jni/JNIBridge.cpp:
+ (JavaMethod::~JavaMethod):
+ (appendClassName):
+ (JavaMethod::signature):
+ * bridge/jni/jsc/JavaClassJSC.cpp:
+ (JavaClass::JavaClass):
+ (JavaClass::~JavaClass):
+ * platform/network/curl/ResourceHandleCurl.cpp:
+ (WebCore::ResourceHandleInternal::~ResourceHandleInternal):
+ * platform/network/curl/ResourceHandleManager.cpp:
+ (WebCore::ResourceHandleManager::~ResourceHandleManager):
+ (WebCore::ResourceHandleManager::setCookieJarFileName):
+ (WebCore::ResourceHandleManager::initializeHandle):
+ * plugins/PluginStream.cpp:
+ (WebCore::PluginStream::~PluginStream):
+ (WebCore::PluginStream::startStream):
+ * xml/XSLTProcessorLibxslt.cpp:
+ (WebCore::xsltParamArrayFromParameterMap):
+ (WebCore::freeXsltParamArray):
+
+2010-02-08 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix Qt build on Windows.
+
+ nmake fails to pick the right cpp file, so we have to
+ rename the file to to a unique name.
+
+ * WebCore.pro:
+ * platform/graphics/qt/FontCustomPlatformDataQt.cpp: Renamed from WebCore/platform/graphics/qt/FontCustomPlatformData.cpp.
+
+2010-02-08 Nikolas Zimmermann <nzimmermann@rim.com>
+
+ Reviewed by Dirk Schulze.
+
+ All SVG *-expected.txt files contain wrong results
+ https://bugs.webkit.org/show_bug.cgi?id=34703
+
+ Finally dump meaningful information for SVG layout tests.
+ Use 'absoluteClippedOverflowRect' which goes through the same code paths used
+ to actually calculate repaint rects etc - instead of the legacy CSS-unaware
+ code path that mapped 'repaintRectInLocalCoordinates' through 'absoluteTransform'.
+ Remove absoluteTransform() - a long standing TODO, finally not needed anymore.
+
+ Despite SVGRenderTreeAsText, SVGPaintServerGradient was also using absoluteTransform().
+ Rewrite the code in question, fixing svg/W3C-SVG-1.1/pserver-grad-08-b.svg alignment issues
+ when scaling/panning text using gradient on stroke/fill. Affects some other gradient tests as well.
+
+ As we're now dumping clipped overflow rects any problems with repaint rects will become
+ immediate visible - it turns out we're not supporting the overflow rules on the outermost <svg>
+ element properly (repaint rects and bounding boxes need to take special SVG overflow rules into account).
+ Fixing that magically gives pixel-perfect clipped overflow rects for all types of shapes/text/containers.
+
+ Note: This will break any overriden platform-specific SVG results, need to wait for build bots in order to update them.
+
+ * rendering/RenderObject.cpp: Remove absoluteTransform() method, centralize overflow query code in SVGRenderSupport::isOverflowHidden().
+ * rendering/RenderObject.h: Remove absoluteTransform() method.
+ * rendering/RenderSVGHiddenContainer.h: Ditto.
+ * rendering/RenderSVGRoot.cpp:
+ (WebCore::RenderSVGRoot::paint): Use SVGRenderSupport::isOverflowHidden() to query SVG overflow mode.
+ (WebCore::RenderSVGRoot::computeRectForRepaint): Respect SVG overflow rules here: clip repaintRect against overflow rect _before_ passing
+ along to RenderBox. This is the key issue behind wrong absoluteClippedOverflowRect() values.
+ (WebCore::RenderSVGRoot::nodeAtPoint): Use SVGRenderSupport::isOverflowHidden() to query SVG overflow mode.
+ * rendering/RenderSVGRoot.h: Remove absoluteTransform(). Don't expose viewportSize() anymore.
+ * rendering/RenderSVGText.cpp:
+ (WebCore::RenderSVGText::strokeBoundingBox): Fix default stroke width to 1. This was the only wrong place -> fixes repaint rects for stroked text.
+ * rendering/RenderSVGViewportContainer.cpp: Remove absoluteTransform() method.
+ (WebCore::RenderSVGViewportContainer::pointIsInsideViewportClip): Use SVGRenderSupport::isOverflowHidden() to query SVG overflow mode.
+ * rendering/RenderSVGViewportContainer.h: Remove absoluteTransform() method.
+ * rendering/SVGRenderSupport.cpp: Refactored overflow queries in one place, centralizing SVG specific assumptions about overflowX/Y.
+ (WebCore::SVGRenderBase::isOverflowHidden):
+ * rendering/SVGRenderSupport.h:
+ * rendering/SVGRenderTreeAsText.cpp: Dump absoluteClippedOverflowRect() instead of absoluteTransform().mapRect(repaintRectInLocalCoordinates()).
+ (WebCore::writePositionAndStyle): Affects all layout tests dumping render trees.
+ * svg/graphics/SVGPaintServerGradient.cpp: Rewrite Gradient on text fill/stroke support on Cg, to avoid using absoluteTransform().
+ (WebCore::absoluteTransformForRenderer):
+ (WebCore::createMaskAndSwapContextForTextGradient):
+ (WebCore::clipToTextMask):
+ (WebCore::SVGPaintServerGradient::setup):
+
+2010-02-07 Daniel Bates <dbates@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34402
+
+ Implements all of the numeric CSS3 list-style-types as per
+ section 4.3 of the CSS3 Lists module <http://www.w3.org/TR/css3-lists/#numeric>.
+
+ Test: fast/lists/w3-css3-list-styles-numeric.html
+
+ * css/CSSPrimitiveValueMappings.h:
+ (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+ * css/CSSValueKeywords.in:
+ * inspector/front-end/SourceCSSTokenizer.re2js:
+ * platform/text/CharacterNames.h: Added constant hyphenMinus.
+ * rendering/RenderListMarker.cpp:
+ (WebCore::): Defined enum SequenceType.
+ (WebCore::toAlphabeticOrNumeric): Added.
+ (WebCore::toAlphabetic): Modified to call WebCore::toAlphabeticOrNumeric.
+ (WebCore::toNumeric): Added.
+ (WebCore::listMarkerSuffix):
+ (WebCore::listMarkerText):
+ (WebCore::RenderListMarker::paint):
+ (WebCore::RenderListMarker::calcPrefWidths):
+ (WebCore::RenderListMarker::getRelativeMarkerRect):
+ * rendering/style/RenderStyle.h:
+ (WebCore::):
+ * rendering/style/RenderStyleConstants.h: Added numeric list style types
+ and fixed indent level for the enum values.
+ (WebCore::):
+
+2010-02-07 Ismail Donmez <ismail@namtrac.org>
+
+ Reviewed by Darin Adler.
+
+ Include wtf/StringExtras.h for strdup definition, which
+ is needed for WinCE.
+
+ * bridge/IdentifierRep.h:
+
+2010-02-07 Pavel Feldman <pfeldman@chromium.org>
+
+ Reviewed by Timothy Hatcher.
+
+ Web Inspector: Fragment-held Elements Not Shown in Inspector.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34680
+
+ * inspector/InspectorDOMAgent.cpp:
+ (WebCore::InspectorDOMAgent::pushChildNodesToFrontend):
+ (WebCore::InspectorDOMAgent::buildObjectForNode):
+ * inspector/front-end/ElementsTreeOutline.js:
+ (WebInspector.ElementsTreeElement.prototype._nodeTitleInfo):
+
+2010-02-07 Jian Li <jianli@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ [chromium] Change chromium interface to handle DownloadURL format.
+ https://bugs.webkit.org/show_bug.cgi?id=34655
+
+ * platform/chromium/ChromiumDataObject.cpp:
+ (WebCore::ChromiumDataObject::clear):
+ (WebCore::ChromiumDataObject::hasData):
+ (WebCore::ChromiumDataObject::ChromiumDataObject):
+ * platform/chromium/ChromiumDataObject.h:
+ * platform/chromium/ClipboardChromium.cpp:
+ (WebCore::ClipboardChromium::setData):
+
+2010-02-06 Dimitri Glazkov <dglazkov@chromium.org>
+
+ No review, rolling out r54364.
+ http://trac.webkit.org/changeset/54364
+ https://bugs.webkit.org/show_bug.cgi?id=34464
+
+ Introduced asserts in layout tests, needs more testing
+ locally.
+
+ * accessibility/chromium/AXObjectCacheChromium.cpp:
+ (WebCore::AXObjectCache::postPlatformNotification):
+ * page/chromium/ChromeClientChromium.h:
+
+2010-02-06 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Using inlines and function-level statics don't mix, according to gcc.
+ https://bugs.webkit.org/show_bug.cgi?id=34663
+
+ De-inline deviceRGBColorSpaceRef to avoid gcc-bug landmines.
+
+ It appears that the initialization check, generated by gcc doesn't account
+ for a possibility that the function may be inlined, resulting in lazy
+ initialization failure for more than one inlined instance of the function.
+
+ No behavior change, so no new tests.
+
+ * platform/graphics/cg/GraphicsContextCG.cpp:
+ (WebCore::deviceRGBColorSpaceRef):
+ * platform/graphics/cg/GraphicsContextPlatformPrivateCG.h:
+
+2010-02-05 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Added an ASSERT to catch an implausible but theoretically possible leak.
+
+ In theory, if malloc allocated a UChar buffer directly after a StringImpl,
+ the StringImpl might incorrecly assume that the UChar buffer was inline,
+ and fail to delete it.
+
+ This ASSERT is somewhat academic, since we don't use the same allocator
+ in debug builds, but oh well.
+
+ * platform/text/StringImpl.cpp:
+ (WebCore::StringImpl::StringImpl):
+ (WebCore::StringImpl::createUninitialized):
+ * platform/text/StringImpl.h: Separated the inline buffer StringImpl
+ constructor from the out-of-line buffer StringImpl constructor. Made
+ the former ASSERT that its buffer was indeed inline, and the latter ASSERT
+ that its buffer was indeed not inline.
+
+2010-02-05 Chris Marrin <cmarrin@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Fixed changed virtual function in GraphicsLayerCACF and call order issues
+ https://bugs.webkit.org/show_bug.cgi?id=34348
+
+ The correct virtual function in GraphicsLayerCACF is now being
+ called. We also fixed an issue in QTMovieWin where the size
+ of the movie was not being set correctly because the call order
+ was changed.
+
+ I also changed the order of a couple of calls in QTMovieWin to account
+ for changed calling order from the logic above.
+
+ * platform/graphics/win/GraphicsLayerCACF.cpp:Update to new virtual function API
+ (WebCore::GraphicsLayerCACF::setContentsToMedia):
+ (WebCore::GraphicsLayerCACF::updateContentsMedia):
+ * platform/graphics/win/GraphicsLayerCACF.h:Update to new virtual function API
+ (WebCore::GraphicsLayerCACF::):
+ * platform/graphics/win/QTMovieWin.cpp:
+ (QTMovieWinPrivate::cacheMovieScale):Fix a bug where ratio was computed wrong because it was using integer math
+ (QTMovieWinPrivate::task):Compute movie scale before computing movie size so values are correct
+ (QTMovieWinPrivate::setSize):Move movie size update to updateMovieSize()
+ (QTMovieWinPrivate::updateMovieSize):Wrap size update in a new call so it can be used from multiple places
+
+2010-02-05 Enrica Casucci <enrica@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Horizontal scrollbar works in reverse at milliondollarcu.be
+ <rdar://problem/7556121>
+ https://bugs.webkit.org/show_bug.cgi?id=33848
+
+ Added a manual test.
+
+ * manual-tests/win: Added.
+ * manual-tests/win/horizontal-scroll-composited.html: Added.
+ * platform/graphics/win/WKCACFLayerRenderer.cpp:
+ (WebCore::WKCACFLayerRenderer::setScrollFrame):
+ (WebCore::WKCACFLayerRenderer::setRootChildLayer):
+
+2010-02-05 Ryan Leavengood <leavengood@gmail.com>
+
+ Reviewed by David Levin.
+
+ Implementation of GlyphPage::fill() for Haiku port.
+ https://bugs.webkit.org/show_bug.cgi?id=34527
+
+ Covered by existing tests.
+
+ * platform/graphics/haiku/GlyphPageTreeNodeHaiku.cpp
+
+2010-01-19 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ Reviewed by Dave Hyatt.
+
+ Implement flattening of framesets
+ https://bugs.webkit.org/show_bug.cgi?id=32717
+
+ The following patch, builds ontop of Antti Koivisto's frameset
+ flattening code from the iPhone source, which itself is based on
+ the old Nokia Series 60 source.
+
+ Layout tests have been added to test the functionality and the original
+ code which has then been fixed to make these pass, as well as support
+ frameset grids.
+
+ Tests: fast/frames/flattening/frameset-flattening-advanced.html
+ fast/frames/flattening/frameset-flattening-grid.html
+ fast/frames/flattening/frameset-flattening-simple.html
+ fast/frames/flattening/frameset-flattening-subframe-resize.html
+ fast/frames/flattening/frameset-flattening-subframesets.html
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::layout):
+ (WebCore::FrameView::scheduleRelayout):
+ * page/Settings.cpp:
+ (WebCore::Settings::Settings):
+ (WebCore::Settings::setFrameSetFlatteningEnabled):
+ * page/Settings.h:
+ (WebCore::Settings::frameSetFlatteningEnabled):
+ * rendering/RenderFrame.cpp:
+ (WebCore::RenderFrame::layoutWithFlattening):
+ * rendering/RenderFrame.h:
+ * rendering/RenderFrameSet.cpp:
+ (WebCore::RenderFrameSet::layout):
+ (WebCore::RenderFrameSet::positionFramesWithFlattening):
+ (WebCore::RenderFrameSet::flattenFrameSet):
+ (WebCore::RenderFrameSet::userResize):
+ * rendering/RenderFrameSet.h:
+
+2010-02-05 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Changing display type of parent of input on focus causes input field to not receive key events
+ https://bugs.webkit.org/show_bug.cgi?id=34620
+ <rdar://problem/7584572>
+
+ When layout affects a text input, the RenderTextControl gets destroyed and
+ recreated, which in turn makes a new innerTextElement. However, if the text field was
+ focused, the VisibleSelection is left pointing to the old innerTextElement, so text
+ input no longer works.
+
+ The fix is to call updateFocusAppearanceSoon() when attaching the input element,
+ which will update the selection if necessary.
+
+ Test: fast/forms/restore-selection-after-layout.html
+
+ * dom/Document.h: Add a paramter to updateFocusAppearanceSoon() and a member variable,
+ m_updateFocusAppearanceRestoresSelection, to store its value until the timer fires.
+ * dom/Document.cpp:
+ (WebCore::Document::Document): Initialize m_updateFocusAppearanceRestoresSelection
+ (WebCore::Document::updateFocusAppearanceSoon): New restorePreviousSelection parameter.
+ (WebCore::Document::updateFocusAppearanceTimerFired): Pass m_updateFocusAppearanceRestoresSelection down.
+ * dom/Element.cpp:
+ (WebCore::Element::attach): Call updateFocusAppearanceSoon() with false.
+ * dom/Element.h: The updateFocusAppearanceSoonAfterAttach() was undefined.
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::attach): Call document()->updateFocusAppearanceSoon() with true.
+
+2010-02-05 Pavel Feldman <pfeldman@chromium.org>
+
+ Reviewed by Timothy Hatcher.
+
+ Web Inspector: simplify cookies view, introduce DataGrid::autoSizeColumns.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34646
+
+ * inspector/front-end/CookieItemsView.js:
+ (WebInspector.CookieItemsView):
+ (WebInspector.CookieItemsView.prototype.show):
+ (WebInspector.CookieItemsView.prototype._update):
+ (WebInspector.CookieItemsView.prototype._updateWithCookies):
+ (WebInspector.CookieItemsView.prototype._filterCookiesForDomain):
+ (WebInspector.CookieItemsView.prototype._createDataGrid):
+ (WebInspector.CookieItemsView.prototype._populateDataGrid.expiresCompare):
+ (WebInspector.CookieItemsView.prototype._populateDataGrid):
+ (WebInspector.CookieItemsView.prototype._createSimpleDataGrid):
+ (WebInspector.CookieItemsView.prototype._populateSimpleDataGrid):
+ (WebInspector.CookieItemsView.prototype._deleteCookieCallback):
+ (WebInspector.CookieItemsView.prototype._refreshButtonClicked):
+ * inspector/front-end/DOMStorageItemsView.js:
+ (WebInspector.DOMStorageItemsView.prototype._showDOMStorageEntries):
+ (WebInspector.DOMStorageItemsView.prototype._dataGridForDOMStorageEntries):
+ * inspector/front-end/DataGrid.js:
+ (WebInspector.DataGrid):
+ (WebInspector.DataGrid.prototype.autoSizeColumns):
+ * inspector/front-end/DatabaseQueryView.js:
+ (WebInspector.DatabaseQueryView.prototype._queryFinished):
+ * inspector/front-end/DatabaseTableView.js:
+ (WebInspector.DatabaseTableView.prototype._queryFinished):
+ * inspector/front-end/StoragePanel.js:
+ (WebInspector.StoragePanel.prototype.dataGridForResult):
+
+2010-02-04 Pavel Feldman <pfeldman@chromium.org>
+
+ Reviewed by Timothy Hatcher.
+
+ Web Inspector: group cookies by frame, show total
+ cookies size, allow sorting cookie table.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34617
+
+ * English.lproj/localizedStrings.js:
+ * inspector/InspectorController.cpp:
+ (WebCore::InspectorController::deleteCookie):
+ * inspector/front-end/CookieItemsView.js:
+ (WebInspector.CookieItemsView):
+ (WebInspector.CookieItemsView.prototype.update):
+ (WebInspector.CookieItemsView.prototype._updateWithCookies):
+ (WebInspector.CookieItemsView.prototype._cookiesForDomain):
+ (WebInspector.CookieItemsView.prototype.dataGridForCookies):
+ (WebInspector.CookieItemsView.prototype._createNodes):
+ (WebInspector.CookieItemsView.prototype._sortData.localeCompare):
+ (WebInspector.CookieItemsView.prototype._sortData.numberCompare):
+ (WebInspector.CookieItemsView.prototype._sortData.expiresCompare):
+ (WebInspector.CookieItemsView.prototype._sortData):
+ * inspector/front-end/StoragePanel.js:
+ (WebInspector.StoragePanel.prototype.showCookies):
+ (WebInspector.CookieSidebarTreeElement):
+ (WebInspector.CookieSidebarTreeElement.prototype.onselect):
+ (WebInspector.CookieSidebarTreeElement.prototype.get subtitle):
+ (WebInspector.CookieSidebarTreeElement.prototype.set subtitle):
+ * inspector/front-end/inspector.js:
+ (WebInspector.updateResource):
+
+2010-02-05 Maxime Simone <simon.maxime@gmail.com>
+
+ Reviewed by David Levin.
+
+ More robust conversion from BString to String for Haiku port.
+ https://bugs.webkit.org/show_bug.cgi?id=34527
+
+ Covered by existing tests.
+
+ * platform/text/haiku/StringHaiku.cpp: Fixed include order, Improved coversion from BString.
+
+2010-02-05 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Windows build fix.
+
+ * WebCore.vcproj/WebCore.make:
+
+2010-02-05 Csaba Osztrogonác <ossy@webkit.org>
+
+ Reviewed by Dirk Schulze.
+ Rubber-stamped by Kenneth Rohde Christiansen.
+
+ [Qt] Modifying SVG path dumping to equal to other ports
+ https://bugs.webkit.org/show_bug.cgi?id=33784
+
+ * platform/graphics/qt/PathQt.cpp:
+ (WebCore::Path::debugString): Path dumping style is aproached to Mac.
+
+2010-02-05 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ Reviewed by Gustavo Noronha.
+
+ Add a GStreamer HTTP/HTTPS source, using WebKit infrastructure
+ https://bugs.webkit.org/show_bug.cgi?id=34317
+
+ * GNUmakefile.am:
+ * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp:
+ (WebCore::mediaPlayerPrivateSourceChangedCallback):
+ (WebCore::doGstInit):
+ * platform/graphics/gtk/WebKitWebSourceGStreamer.cpp:
+ * platform/graphics/gtk/WebKitWebSourceGStreamer.h:
+ Add a GStreamer HTTP/HTTPS source, using the WebKit infrastructure.
+ This makes sure that referer, cookies, authentication information
+ and all kinds of other context are passed to GStreamer for websites
+ like Vimeo or YouTube.
+
+2010-02-05 Nate Chapin <japhet@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ [V8] Clean up code for getting a v8::FunctionTemplate.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34606
+
+ * bindings/scripts/CodeGeneratorV8.pm: Making GetTemplate() public
+ * bindings/v8/V8Binding.cpp:
+ (WebCore::configureTemplate):
+ * bindings/v8/V8DOMWrapper.cpp: Remove getTemplate(), use V8ClassIndex::getTemplate() instead.
+ (WebCore::V8DOMWrapper::getConstructor):
+ (WebCore::V8DOMWrapper::instantiateV8Object):
+ * bindings/v8/V8DOMWrapper.h:
+ (WebCore::V8DOMWrapper::lookupDOMWrapper):
+ * bindings/v8/V8Index.cpp: Remove duplicate caching of FunctionTemplates.
+ (WebCore::V8ClassIndex::getTemplate):
+ * bindings/v8/V8Index.h:
+ * bindings/v8/WorkerContextExecutionProxy.cpp:
+ (WebCore::WorkerContextExecutionProxy::toV8):
+ * bindings/v8/custom/V8HTMLAudioElementConstructor.cpp:
+ (WebCore::v8HTMLAudioElementConstructorCallback):
+ (WebCore::V8HTMLAudioElementConstructor::GetTemplate):
+ * bindings/v8/custom/V8HTMLAudioElementConstructor.h:
+ * bindings/v8/custom/V8HTMLImageElementConstructor.cpp:
+ (WebCore::v8HTMLImageElementConstructorCallback):
+ (WebCore::V8HTMLImageElementConstructor::GetTemplate):
+ * bindings/v8/custom/V8HTMLImageElementConstructor.h:
+ * bindings/v8/custom/V8HTMLOptionElementConstructor.cpp:
+ (WebCore::v8HTMLOptionElementConstructorCallback):
+ (WebCore::V8HTMLOptionElementConstructor::GetTemplate):
+ * bindings/v8/custom/V8HTMLOptionElementConstructor.h:
+ * bindings/v8/custom/V8InjectedScriptHostCustom.cpp:
+ (WebCore::createInjectedScriptHostV8Wrapper):
+
+2010-02-05 Siddharth Mathur <siddharth.mathur@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ [Qt] Build break in QtWebkit on Symbian
+ https://bugs.webkit.org/show_bug.cgi?id=34597
+
+ * plugins/PluginView.h:
+
+2010-02-05 Yury Semikhatsky <yurys@chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ - Use SerializedScriptValue for passing data between injected script and
+ inspector frontend.
+ - Remove custom JSON implementation from the instpector utility script.
+ - Make sure that only objects created in the same ScriptState can be values
+ of ScriptObject/Array properties and arguments to ScriptFunctionCall. We don't
+ want ScriptObjects to leak between contexts.
+ - Use ScriptState of the 'this' object in ScriptFunctionCall instead of passing
+ it as additional parameter.
+
+ https://bugs.webkit.org/show_bug.cgi?id=33592
+
+ * bindings/js/JSInjectedScriptHostCustom.cpp:
+ (WebCore::JSInjectedScriptHost::reportDidDispatchOnInjectedScript):
+ * bindings/js/ScriptArray.cpp:
+ (WebCore::ScriptArray::set):
+ * bindings/js/ScriptFunctionCall.cpp:
+ (WebCore::ScriptFunctionCall::ScriptFunctionCall):
+ (WebCore::ScriptFunctionCall::appendArgument):
+ * bindings/js/ScriptFunctionCall.h:
+ * bindings/js/ScriptObject.cpp:
+ (WebCore::ScriptObject::set):
+ * bindings/js/ScriptValue.cpp:
+ (WebCore::ScriptValue::serialize):
+ (WebCore::ScriptValue::deserialize):
+ * bindings/js/ScriptValue.h:
+ * bindings/v8/ScriptArray.cpp:
+ (WebCore::ScriptArray::set):
+ * bindings/v8/ScriptFunctionCall.cpp:
+ (WebCore::ScriptFunctionCall::ScriptFunctionCall):
+ (WebCore::ScriptFunctionCall::appendArgument):
+ * bindings/v8/ScriptFunctionCall.h:
+ * bindings/v8/ScriptObject.cpp:
+ (WebCore::ScriptObject::set):
+ * bindings/v8/ScriptState.h:
+ * bindings/v8/ScriptValue.cpp:
+ (WebCore::ScriptValue::serialize):
+ (WebCore::deserialize):
+ * bindings/v8/ScriptValue.h:
+ * bindings/v8/custom/V8InjectedScriptHostCustom.cpp:
+ (WebCore::V8InjectedScriptHost::reportDidDispatchOnInjectedScriptCallback):
+ * inspector/InjectedScript.cpp:
+ (WebCore::InjectedScript::dispatch):
+ (WebCore::InjectedScript::callFrames):
+ (WebCore::InjectedScript::wrapForConsole):
+ (WebCore::InjectedScript::releaseWrapperObjectGroup):
+ * inspector/InjectedScript.h:
+ * inspector/InjectedScriptHost.cpp:
+ (WebCore::InjectedScriptHost::reportDidDispatchOnInjectedScript):
+ * inspector/InjectedScriptHost.h:
+ * inspector/InjectedScriptHost.idl:
+ * inspector/InspectorBackend.cpp:
+ (WebCore::InspectorBackend::dispatchOnInjectedScript):
+ * inspector/InspectorController.cpp:
+ (WebCore::InspectorController::setFrontendProxyObject):
+ (WebCore::InspectorController::didPause):
+ (WebCore::InspectorController::didEvaluateForTestInFrontend):
+ * inspector/InspectorFrontend.cpp:
+ (WebCore::InspectorFrontend::InspectorFrontend):
+ (WebCore::InspectorFrontend::newScriptArray):
+ (WebCore::InspectorFrontend::newScriptObject):
+ (WebCore::InspectorFrontend::populateFrontendSettings):
+ (WebCore::InspectorFrontend::updateConsoleMessageExpiredCount):
+ (WebCore::InspectorFrontend::addConsoleMessage):
+ (WebCore::InspectorFrontend::updateConsoleMessageRepeatCount):
+ (WebCore::InspectorFrontend::updateResource):
+ (WebCore::InspectorFrontend::removeResource):
+ (WebCore::InspectorFrontend::didGetResourceContent):
+ (WebCore::InspectorFrontend::updateFocusedNode):
+ (WebCore::InspectorFrontend::setAttachedWindow):
+ (WebCore::InspectorFrontend::addRecordToTimeline):
+ (WebCore::InspectorFrontend::parsedScriptSource):
+ (WebCore::InspectorFrontend::failedToParseScriptSource):
+ (WebCore::InspectorFrontend::addProfileHeader):
+ (WebCore::InspectorFrontend::setRecordingProfile):
+ (WebCore::InspectorFrontend::didGetProfileHeaders):
+ (WebCore::InspectorFrontend::didGetProfile):
+ (WebCore::InspectorFrontend::pausedScript):
+ (WebCore::InspectorFrontend::setDocument):
+ (WebCore::InspectorFrontend::setDetachedRoot):
+ (WebCore::InspectorFrontend::setChildNodes):
+ (WebCore::InspectorFrontend::childNodeCountUpdated):
+ (WebCore::InspectorFrontend::childNodeInserted):
+ (WebCore::InspectorFrontend::childNodeRemoved):
+ (WebCore::InspectorFrontend::attributesUpdated):
+ (WebCore::InspectorFrontend::didRemoveNode):
+ (WebCore::InspectorFrontend::didGetChildNodes):
+ (WebCore::InspectorFrontend::didApplyDomChange):
+ (WebCore::InspectorFrontend::didGetEventListenersForNode):
+ (WebCore::InspectorFrontend::didGetCookies):
+ (WebCore::InspectorFrontend::didDispatchOnInjectedScript):
+ (WebCore::InspectorFrontend::addDatabase):
+ (WebCore::InspectorFrontend::selectDatabase):
+ (WebCore::InspectorFrontend::didGetDatabaseTableNames):
+ (WebCore::InspectorFrontend::addDOMStorage):
+ (WebCore::InspectorFrontend::selectDOMStorage):
+ (WebCore::InspectorFrontend::didGetDOMStorageEntries):
+ (WebCore::InspectorFrontend::didSetDOMStorageItem):
+ (WebCore::InspectorFrontend::didRemoveDOMStorageItem):
+ (WebCore::InspectorFrontend::updateDOMStorage):
+ (WebCore::InspectorFrontend::addNodesToSearchResult):
+ (WebCore::InspectorFrontend::contextMenuItemSelected):
+ (WebCore::InspectorFrontend::evaluateForTestInFrontend):
+ (WebCore::InspectorFrontend::callSimpleFunction):
+ * inspector/InspectorFrontend.h:
+ (WebCore::InspectorFrontend::scriptState):
+ * inspector/front-end/InjectedScript.js:
+ (injectedScriptConstructor):
+ (injectedScriptConstructor.):
+ * inspector/front-end/InjectedScriptAccess.js:
+ (InjectedScriptAccess._installHandler.InjectedScriptAccess.prototype.methodName.myCallback):
+ (InjectedScriptAccess._installHandler.InjectedScriptAccess.prototype.methodName):
+ (InjectedScriptAccess._installHandler):
+ * inspector/front-end/inspector.js:
+ (WebInspector.pausedScript):
+ (WebInspector.addConsoleMessage):
+
+2010-02-05 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Generate convenience headers (QWebView, etc) using qmake
+
+ In Qt this is done using syncqt, but we use a pro-file instead
+ that generates makefile-rules for each of the extra headers.
+
+ These extra headers are installed alongside the normal headers.
+
+ * WebCore.pro: Use headers.pri based on DerivedSources instead
+ of the one previously checked in in the source tree.
+
+2010-02-05 Mikhail Naganov <mnaganov@chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ Enable JAVASCRIPT_DEBUGGER in chromium port.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34638
+
+ * page/Console.cpp:
+ * page/Console.h:
+ * page/Console.idl:
+
+2010-02-05 Pavel Feldman <pfeldman@chromium.org>
+
+ Reviewed by Timothy Hatcher.
+
+ Web Inspector: Tab width for javascript source is 8, should be 4
+
+ https://bugs.webkit.org/show_bug.cgi?id=31248
+
+ * inspector/front-end/SourceFrame.js:
+ (WebInspector.SourceFrame):
+ * inspector/front-end/TextEditorModel.js:
+ (WebInspector.TextEditorModel.prototype.set replaceTabsWithSpaces):
+ (WebInspector.TextEditorModel.prototype._innerSetText):
+ (WebInspector.TextEditorModel.prototype._replaceTabsIfNeeded):
+
+2010-02-05 Tony Chang <tony@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24872
+ When pasting a list into another list should not indent another level.
+ If the cursor is at the beginning of the line, it should insert the
+ list items before the current list item. If the cursor is at the end
+ of the line, it should insert the list items after the current list item.
+
+ This matches Firefox and IE and makes the common activity of reordering a list
+ work as expected.
+
+ This also adds a small helper method (isListItem) to htmlediting.h.
+
+ Test: editing/pasteboard/paste-list-002.html
+
+ * editing/ReplaceSelectionCommand.cpp:
+ (WebCore::ReplaceSelectionCommand::doApply):
+ (WebCore::ReplaceSelectionCommand::insertAsListItems):
+ * editing/ReplaceSelectionCommand.h:
+ * editing/htmlediting.cpp:
+ (WebCore::isListItem):
+ (WebCore::appendedSublist):
+ * editing/htmlediting.h:
+
+2010-02-04 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Timothy Hatcher.
+
+ Build fix. Remove a symbol corresponding to an inline function from the linker export
+ file to prevent a weak external failure.
+
+ * WebCore.base.exp: Remove symbol.
+ * WebCore.xcodeproj/project.pbxproj: Accommodate rename of script.
+
+2010-02-04 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Updated to use new WeakGCPtr::clear interface.
+
+ * bindings/js/JSEventListener.cpp:
+ * bindings/js/JSEventListener.h:
+ (WebCore::JSEventListener::invalidateJSFunction):
+
+2010-02-04 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: Added a forwarding header.
+
+ * ForwardingHeaders/runtime/WeakGCPtr.h: Added.
+
+2010-02-04 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Alexey Proskuryakov and Darin Adler.
+
+ REGRESSION (r52082): Missing event handlers on JQuery demo page (33383)
+ https://bugs.webkit.org/show_bug.cgi?id=33383
+ <rdar://problem/7559449>
+
+ There were two bugs here:
+
+ 1. A stale wrapper would invalidate a node's event listeners, even if
+ the node had a fresh wrapper keeping it alive.
+
+ The fix for this is for an event listener to keep a WeakGCPtr back-pointer
+ to the wrapper it expects to mark it. The wrapper destructor checks this
+ back-pointer, and only invalidates the event listener in the case of a match.
+
+ 2. Conversely, a stale wrapper would not invalidate a node's event
+ listeners soon enough, if its destructor didn't have a chance to run
+ before an event fired on the node. (This can only happen in cases where
+ we've made some other error and failed to mark a wrapper that was circuitously
+ observable in the DOM. But we know we have edge case bugs like this, and
+ we don't want them to be crashes.)
+
+ The fix for this is to check the wrapper back-pointer before firing the
+ event listener. As long as the the wrapper back-pointer is not null,
+ it's safe to fire the listener.
+
+ * ForwardingHeaders/runtime/WeakGCPtr.h: Added. Appease build gods.
+
+ * bindings/js/JSAbstractWorkerCustom.cpp:
+ (WebCore::JSAbstractWorker::addEventListener):
+ (WebCore::JSAbstractWorker::removeEventListener):
+ * bindings/js/JSDOMApplicationCacheCustom.cpp:
+ (WebCore::JSDOMApplicationCache::addEventListener):
+ (WebCore::JSDOMApplicationCache::removeEventListener):
+ * bindings/js/JSDOMWindowCustom.cpp:
+ (WebCore::JSDOMWindow::markChildren):
+ (WebCore::JSDOMWindow::addEventListener):
+ (WebCore::JSDOMWindow::removeEventListener): Updated to pass a wrapper
+ to the JSEventListener constructor.
+
+ * bindings/js/JSEventListener.cpp:
+ (WebCore::JSEventListener::JSEventListener):
+ (WebCore::JSEventListener::initializeJSFunction):
+ (WebCore::JSEventListener::invalidateJSFunction):
+ * bindings/js/JSEventListener.h:
+ (WebCore::JSEventListener::create):
+ (WebCore::JSEventListener::isolatedWorld):
+ (WebCore::JSEventListener::wrapper):
+ (WebCore::JSEventListener::setWrapper):
+ (WebCore::JSEventListener::jsFunction):
+ (WebCore::createJSAttributeEventListener): Implemented the back-pointer
+ described above. Refactored the jsFunction() accessor to return 0 if
+ the wrapper back-pointer is 0.
+
+ * bindings/js/JSEventSourceCustom.cpp:
+ (WebCore::JSEventSource::addEventListener):
+ (WebCore::JSEventSource::removeEventListener):
+ * bindings/js/JSLazyEventListener.cpp:
+ (WebCore::JSLazyEventListener::JSLazyEventListener):
+ (WebCore::JSLazyEventListener::initializeJSFunction):
+ * bindings/js/JSLazyEventListener.h:
+ (WebCore::JSLazyEventListener::create):
+ * bindings/js/JSMessagePortCustom.cpp:
+ (WebCore::JSMessagePort::markChildren):
+ (WebCore::JSMessagePort::addEventListener):
+ (WebCore::JSMessagePort::removeEventListener):
+ * bindings/js/JSNodeCustom.cpp:
+ (WebCore::JSNode::addEventListener):
+ (WebCore::JSNode::removeEventListener):
+ (WebCore::JSNode::markChildren):
+ * bindings/js/JSSVGElementInstanceCustom.cpp:
+ (WebCore::JSSVGElementInstance::addEventListener):
+ (WebCore::JSSVGElementInstance::removeEventListener):
+ * bindings/js/JSWebSocketCustom.cpp:
+ (WebCore::JSWebSocket::addEventListener):
+ (WebCore::JSWebSocket::removeEventListener):
+ * bindings/js/JSWorkerContextCustom.cpp:
+ (WebCore::JSWorkerContext::markChildren):
+ (WebCore::JSWorkerContext::addEventListener):
+ (WebCore::JSWorkerContext::removeEventListener):
+ * bindings/js/JSXMLHttpRequestCustom.cpp:
+ (WebCore::JSXMLHttpRequest::markChildren):
+ (WebCore::JSXMLHttpRequest::addEventListener):
+ (WebCore::JSXMLHttpRequest::removeEventListener):
+ * bindings/js/JSXMLHttpRequestUploadCustom.cpp:
+ (WebCore::JSXMLHttpRequestUpload::markChildren):
+ (WebCore::JSXMLHttpRequestUpload::addEventListener):
+ (WebCore::JSXMLHttpRequestUpload::removeEventListener): Updated to pass a wrapper
+ to the JSEventListener constructor.
+
+
+ * bindings/js/ScriptEventListener.cpp:
+ (WebCore::createAttributeEventListener): Updated to pass a wrapper
+ to the JSEventListener constructor.
+ (WebCore::getEventListenerHandlerBody): Updated for the fact that jsFunction()
+ is no longer a virtual accessor on the EventHandler base class.
+
+ * bindings/scripts/CodeGeneratorJS.pm: Updated for the fact that jsFunction()
+ is no longer a virtual accessor on the EventHandler base class. Added a "JS"
+ to invalidateEventListeners and markEventListeners to clarify that these
+ actions are for JS event listeners only. Added a wrapper parameter to
+ invalidateEventListeners for the back-pointer check explained above.
+
+ * dom/EventListener.h:
+ (WebCore::EventListener::invalidateJSFunction): ditto
+
+ * dom/EventTarget.h:
+ (WebCore::EventTarget::markJSEventListeners):
+ (WebCore::EventTarget::invalidateJSEventListeners): ditto
+
+2010-02-04 Tony Chang <tony@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ https://bugs.webkit.org/show_bug.cgi?id=25002
+ When inserting a new paragraph, avoid nesting empty divs. When
+ pasting near the end of a paragraph, this prevents each paste
+ command for getting nested one level deeper.
+
+ Test: editing/inserting/paragraph-outside-nested-divs.html
+
+ * editing/InsertParagraphSeparatorCommand.cpp:
+ (WebCore::highestVisuallyEquivalentDiv):
+ (WebCore::InsertParagraphSeparatorCommand::doApply):
+
+2010-02-04 Dumitru Daniliuc <dumi@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ 1. Fix a bug in SQLiteTransaction: do not assume that COMMIT always
+ succeeds.
+ 2. Jump straight to the transaction error callback when a
+ statement fails in a way that makes sqlite automatically rollback
+ the transaction.
+ 3. Fix the code that handles the "quota reached" failure, as it is
+ one of the failures that lead to an automatic transaction
+ rollback.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34280
+
+ * platform/sql/SQLiteDatabase.cpp:
+ (WebCore::SQLiteDatabase::isAutoCommitOn):
+ * platform/sql/SQLiteDatabase.h:
+ * platform/sql/SQLiteTransaction.cpp:
+ (WebCore::SQLiteTransaction::begin):
+ (WebCore::SQLiteTransaction::commit):
+ (WebCore::SQLiteTransaction::rollback):
+ (WebCore::SQLiteTransaction::transactionWasRolledBackBySqlite):
+ * platform/sql/SQLiteTransaction.h:
+ * storage/SQLTransaction.cpp:
+ (WebCore::SQLTransaction::SQLTransaction):
+ (WebCore::SQLTransaction::runStatements):
+ (WebCore::SQLTransaction::runCurrentStatement):
+ (WebCore::SQLTransaction::handleCurrentStatementError):
+ (WebCore::SQLTransaction::deliverQuotaIncreaseCallback):
+
+2010-02-04 Peter Kasting <pkasting@google.com>
+
+ Not reviewed, rollback.
+
+ Rollback r54387, it doesn't fix builds and Chromium doesn't want this behavior.
+
+ * platform/chromium/ScrollbarThemeChromiumMac.h:
+
+2010-02-04 Stephen White <senorblanco@chromium.org>
+
+ Unreviewed, build fix.
+
+ Fix for Chromium/Mac after palindromic scrollbar change (54345).
+
+ Covered by many layout tests.
+
+ * platform/chromium/ScrollbarThemeChromiumMac.h:
+ (WebCore::ScrollbarThemeChromiumMac::maxOverlapBetweenPages):
+
+2010-02-04 Clemmitt Sigler <cmsigler@gmail.com>
+
+ Reviewed by David Levin.
+
+ WebKitGTK doesn't build GtkLauncher when --enable-mathml is specified.
+ Updated WebCore/GNUmakefile.am to include needed files in build.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34387
+
+ No new tests.
+
+ * GNUmakefile.am:
+
+2010-02-04 Stephan Aßmus <superstippi@gmx.de>
+
+ Reviewed by David Levin.
+
+ Misc coding style fixes in Haiku port code.
+ https://bugs.webkit.org/show_bug.cgi?id=34527
+
+ No tests needed.
+
+ * platform/haiku/ContextMenuItemHaiku.cpp: Trailing white space, NULL -> 0
+ * platform/haiku/DragImageHaiku.cpp: Trailing white space.
+ * platform/haiku/FileChooserHaiku.cpp: Sorted headers.
+ * platform/haiku/LocalizedStringsHaiku.cpp: Needed to include NotImplemented.h
+
+2010-02-04 Enrica Casucci <enrica@apple.com>
+
+ Reviewed by Csaba Osztrogonac.
+
+ Fixed crash on QT introduced with the fix for
+ https://bugs.webkit.org/show_bug.cgi?id=34609
+
+ The test has been added with the original patch.
+
+ * platform/qt/ClipboardQt.cpp:
+ (WebCore::ClipboardQt::writePlainText): Added missing allocation of m_writeData.
+
+2010-02-04 Christian Dywan <christian@twotoasts.de>
+
+ Reviewed by Xan Lopez.
+
+ Conditionalize third party cookie policy for libsoup 2.29.90.
+
+ * platform/network/soup/CookieJarSoup.cpp:
+ (WebCore::setCookies):
+ * platform/network/soup/DNSSoup.cpp:
+ (WebCore::prefetchDNS):
+ * platform/network/soup/ResourceHandleSoup.cpp:
+ (WebCore::restartedCallback):
+ (WebCore::startHttp):
+ * platform/network/soup/ResourceRequestSoup.cpp:
+ (WebCore::ResourceRequest::toSoupMessage):
+ (WebCore::ResourceRequest::updateFromSoupMessage):
+
+2010-02-04 Christian Dywan <christian@twotoasts.de>
+
+ Rubber-stamped by Gustavo Noronha Silva.
+
+ Add ENABLE(VIDEO) guards around freeOwnedGPtr<GstElement> implementation.
+
+ * platform/gtk/GOwnPtrGtk.cpp:
+
+2010-02-04 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Assertion failure in CheckedRadioButtons::removeButton when using jQuery 1.4.1
+ https://bugs.webkit.org/show_bug.cgi?id=34520
+
+ Test: fast/dom/HTMLInputElement/cloned-input-checked-state.html
+
+ * dom/Element.cpp: (WebCore::Element::cloneElementWithoutChildren): Copy non-attribute
+ properties before attributes. Otherwise, copying "checked" attribute would make the cloned
+ node checked, unchecking original (they share a name, and are thus in the same radio group).
+ We do want the original to be unchecked, but we also want to know its original state in
+ HTMLInputElement::copyNonAttributeProperties().
+
+ * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::copyNonAttributeProperties):
+ Use setChecked instead of plain assignment to prevent m_checked getting out of sync with
+ checkedRadioButtons. Also, copy field related to default checked state, so that m_checked
+ won't be overridden when copying attributes.
+
+2010-02-04 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] Build fix after addition of Clipboard::writePlainText method.
+
+ * platform/wx/ClipboardWx.cpp:
+ (WebCore::ClipboardWx::writePlainText):
+ * platform/wx/ClipboardWx.h:
+
+2010-02-04 Enrica Casucci <enrica@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ REGRESSION: Dragging plain text into a styled text region does not acquire the correct style info.
+ <rdar://problem/7595685>
+ https://bugs.webkit.org/show_bug.cgi?id=34609
+
+ Test: editing/pasteboard/drop-inputtext-acquires-style.html
+
+ The dragging code did not distinguish the case of dragging the content of an input control
+ as a special case. The markup placed in the pasteboard included the style information.
+ I've modified the Clipboard class interface adding a new method writePlainText to match the
+ behavior of the copy and cut commands and modified the drag code to detect the special case.
+ I've modified all the platform specific implementations of the Clipboard class.
+
+ * dom/Clipboard.h: Added writePlainText pure virtual function.
+ * editing/Editor.cpp:
+ (WebCore::Editor::cut): Renamed nodeIsTextFormControl to isNodeInTextFormControl.
+ (WebCore::Editor::copy): Renamed nodeIsTextFormControl to isNodeInTextFormControl.
+ * editing/htmlediting.cpp:
+ (WebCore::isNodeInTextFormControl): Added, after removing the implementation with the old name
+ in Editor.cpp
+ * editing/htmlediting.h:
+ * page/DragController.cpp:
+ (WebCore::DragController::startDrag):
+ * platform/Pasteboard.h:
+ * platform/android/ClipboardAndroid.cpp:
+ (WebCore::ClipboardAndroid::writePlainText): Added.
+ * platform/android/ClipboardAndroid.h:
+ * platform/chromium/ClipboardChromium.cpp:
+ (WebCore::ClipboardChromium::writePlainText): Added.
+ * platform/chromium/ClipboardChromium.h:
+ * platform/gtk/ClipboardGtk.cpp:
+ (WebCore::ClipboardGtk::writePlainText): Added.
+ * platform/gtk/ClipboardGtk.h:
+ * platform/haiku/ClipboardHaiku.cpp:
+ (WebCore::ClipboardHaiku::writePlainText): Added.
+ * platform/haiku/ClipboardHaiku.h:
+ * platform/mac/ClipboardMac.h:
+ * platform/mac/ClipboardMac.mm:
+ (WebCore::ClipboardMac::writePlainText): Added.
+ * platform/mac/PasteboardMac.mm:
+ (WebCore::Pasteboard::writePlainText): Added helper function.
+ * platform/qt/ClipboardQt.cpp:
+ (WebCore::ClipboardQt::writePlainText): Added.
+ * platform/qt/ClipboardQt.h:
+ * platform/win/ClipboardWin.cpp:
+ (WebCore::ClipboardWin::writePlainText): Added.
+ * platform/win/ClipboardWin.h:
+
+2010-02-04 Steve Block <steveblock@google.com>
+
+ Reviewed by Nate Chapin.
+
+ Fix bug in V8 convertNPVariantToJValue when converting float and double types
+ https://bugs.webkit.org/show_bug.cgi?id=34593
+
+ No new tests, build fix only.
+
+ * bridge/jni/v8/JNIUtilityPrivate.cpp: Modified.
+ (JSC::Bindings::convertNPVariantToJValue): Modified. Use correct members of 'result' enum.
+
+2010-02-04 Chris Guillory <chris.guillory@google.com>
+
+ Reviewed by Darin Fisher.
+
+ [Chromium] Notify ChromeClientChromium of AccessibilityObject state
+ change notifications.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34464
+
+ * accessibility/chromium/AXObjectCacheChromium.cpp:
+ (WebCore::toChromeClientChromium):
+ (WebCore::AXObjectCache::postPlatformNotification):
+ * page/chromium/ChromeClientChromium.h:
+
+2010-02-04 Stephen White <senorblanco@chromium.org>
+
+ Unreviewed, build fix for Chromium.
+
+ Revert r54341 ("[v8] Remove clear method from DOM object maps"),
+ since it causes the worker tests to fail on Chromium.
+
+ * bindings/v8/DOMData.h:
+ (WebCore::DOMData::removeObjectsFromWrapperMap):
+ * bindings/v8/DOMDataStore.h:
+ (WebCore::ChunkedTable::clear):
+ (WebCore::ChunkedTable::clearEntries):
+ (WebCore::DOMDataStore::IntrusiveDOMWrapperMap::clear):
+ (WebCore::DOMDataStore::IntrusiveDOMWrapperMap::ChunkedTableTraits::clear):
+ * bindings/v8/V8DOMMap.cpp:
+ (WebCore::removeAllDOMObjectsInCurrentThreadHelper):
+ (WebCore::removeAllDOMObjectsInCurrentThread):
+ * bindings/v8/V8DOMMap.h:
+ (WebCore::WeakReferenceMap::clear):
+ * bindings/v8/WorkerScriptController.cpp:
+ (WebCore::WorkerScriptController::~WorkerScriptController):
+
+2010-02-04 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] Crashes when an invalid hostname is pre-fetched
+ https://bugs.webkit.org/show_bug.cgi?id=34602
+
+ * platform/network/soup/DNSSoup.cpp:
+ (WebCore::prefetchDNS): NULL-check the SoupURI that is created
+ from the hostname; that will happen for invalid hostnames.
+
+2010-02-04 José Millán Soto <jmillan@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [Gtk] webkitgtk crashed when Orca open
+ https://bugs.webkit.org/show_bug.cgi?id=34463
+
+ * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
+ (textForObject):
+ Checking if render objects are texts before calling toRenderText
+
+2010-02-04 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ Set first party URI in all SoupMessages. This allows libsoup to
+ implement a "no third party cookies" policy in case it wants
+ to. Also start a non-JSC-specific, gtk-specific GOwnPtr module and
+ use it for SoupURI.
+
+ * platform/network/soup/CookieJarSoup.cpp:
+ (WebCore::setCookies):
+ * platform/network/soup/ResourceHandleSoup.cpp:
+ (WebCore::restartedCallback):
+ (WebCore::startHttp):
+ * platform/network/soup/ResourceRequestSoup.cpp:
+ (WebCore::ResourceRequest::toSoupMessage):
+ (WebCore::ResourceRequest::updateFromSoupMessage):
+
+2010-02-04 Pavel Feldman <pfeldman@chromium.org>
+
+ Reviewed by Timothy Hatcher.
+
+ Web Inspector: group cookies by domains, not frame's domains.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34599
+
+ * inspector/front-end/CookieItemsView.js:
+ (WebInspector.CookieItemsView.prototype._cookiesForDomain):
+ * inspector/front-end/inspector.js:
+ (WebInspector.updateResource):
+ (WebInspector._addCookieDomain):
+
+2010-02-04 Nate Chapin <japhet@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ [V8] Delete V8CustomBinding.h and all references to V8Custom
+
+ https://bugs.webkit.org/show_bug.cgi?id=32638
+
+ * bindings/v8/NPV8Object.cpp:
+ * bindings/v8/V8DOMWindowShell.h:
+ * bindings/v8/V8NPObject.cpp:
+ * bindings/v8/V8Utilities.cpp:
+ * bindings/v8/custom/V8AbstractWorkerCustom.cpp:
+ * bindings/v8/custom/V8AttrCustom.cpp:
+ * bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp:
+ * bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp:
+ * bindings/v8/custom/V8ClipboardCustom.cpp:
+ * bindings/v8/custom/V8CoordinatesCustom.cpp:
+ * bindings/v8/custom/V8CustomBinding.h: Removed.
+ * bindings/v8/custom/V8DOMApplicationCacheCustom.cpp:
+ * bindings/v8/custom/V8DOMWindowCustom.cpp:
+ * bindings/v8/custom/V8DataGridColumnListCustom.cpp:
+ * bindings/v8/custom/V8DatabaseCustom.cpp:
+ * bindings/v8/custom/V8ElementCustom.cpp:
+ * bindings/v8/custom/V8EventSourceConstructor.cpp:
+ * bindings/v8/custom/V8EventSourceCustom.cpp:
+ * bindings/v8/custom/V8GeolocationCustom.cpp:
+ * bindings/v8/custom/V8HTMLAllCollectionCustom.cpp:
+ * bindings/v8/custom/V8HTMLAudioElementConstructor.cpp:
+ (WebCore::v8HTMLAudioElementConstructorCallback):
+ (WebCore::V8HTMLAudioElementConstructor::GetTemplate):
+ * bindings/v8/custom/V8HTMLCollectionCustom.cpp:
+ * bindings/v8/custom/V8HTMLDataGridElementCustom.cpp:
+ * bindings/v8/custom/V8HTMLFrameElementCustom.cpp:
+ * bindings/v8/custom/V8HTMLIFrameElementCustom.cpp:
+ * bindings/v8/custom/V8HTMLImageElementConstructor.cpp:
+ (WebCore::v8HTMLImageElementConstructorCallback):
+ (WebCore::V8HTMLImageElementConstructor::GetTemplate):
+ * bindings/v8/custom/V8HTMLInputElementCustom.cpp:
+ * bindings/v8/custom/V8HTMLOptionElementConstructor.cpp:
+ (WebCore::v8HTMLOptionElementConstructorCallback):
+ (WebCore::V8HTMLOptionElementConstructor::GetTemplate):
+ * bindings/v8/custom/V8HTMLPlugInElementCustom.cpp:
+ * bindings/v8/custom/V8HistoryCustom.cpp:
+ * bindings/v8/custom/V8InspectorFrontendHostCustom.cpp:
+ * bindings/v8/custom/V8LocationCustom.cpp:
+ * bindings/v8/custom/V8MessagePortCustom.cpp:
+ * bindings/v8/custom/V8NodeCustom.cpp:
+ * bindings/v8/custom/V8NodeFilterCustom.cpp:
+ * bindings/v8/custom/V8SQLResultSetRowListCustom.cpp:
+ * bindings/v8/custom/V8SQLTransactionCustom.cpp:
+ * bindings/v8/custom/V8SVGElementInstanceCustom.cpp:
+ * bindings/v8/custom/V8SVGLengthCustom.cpp:
+ * bindings/v8/custom/V8SharedWorkerCustom.cpp:
+ * bindings/v8/custom/V8StorageCustom.cpp:
+ * bindings/v8/custom/V8WebGLArrayBufferCustom.cpp:
+ * bindings/v8/custom/V8WebGLArrayCustom.h:
+ * bindings/v8/custom/V8WebGLByteArrayCustom.cpp:
+ * bindings/v8/custom/V8WebGLFloatArrayCustom.cpp:
+ * bindings/v8/custom/V8WebGLIntArrayCustom.cpp:
+ * bindings/v8/custom/V8WebGLShortArrayCustom.cpp:
+ * bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp:
+ * bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp:
+ * bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp:
+ * bindings/v8/custom/V8WebKitPointConstructor.cpp:
+ * bindings/v8/custom/V8WorkerContextCustom.cpp:
+ * bindings/v8/custom/V8WorkerCustom.cpp:
+ * bindings/v8/custom/V8XMLHttpRequestConstructor.cpp:
+ * bindings/v8/custom/V8XMLHttpRequestCustom.cpp:
+ * bindings/v8/custom/V8XMLHttpRequestUploadCustom.cpp:
+
+2010-02-04 Ariya Hidayat <ariya.hidayat@gmail.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Unnecessary QBrush construction for doing a solid fill
+ https://bugs.webkit.org/show_bug.cgi?id=34559
+
+ Use the similar trick like r37421, i.e. use the special brush for
+ solid color to avoid creating QBrush again and again.
+
+ * platform/graphics/qt/GraphicsContextQt.cpp:
+ (WebCore::GraphicsContext::setPlatformFillColor):
+
+2010-02-04 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ REGRESSION (r53718): When scrolling a tall window by page, the overlap between pages is too big
+ https://bugs.webkit.org/show_bug.cgi?id=34371
+
+ Allow ScrollbarTheme to cap the overlap between pages, and set a cap of
+ 40 in ScrollbarThemeMac.
+
+ * WebCore.base.exp: Export Scrollbar::maxOverlapBetweenPages().
+ * editing/EditorCommand.cpp:
+ (WebCore::verticalScrollDistance): Use Scrollbar methods instead of
+ constants, and cap the scroll distance if needed.
+ * platform/ScrollView.cpp:
+ (WebCore::ScrollView::updateScrollbars): Ditto.
+ (WebCore::ScrollView::wheelEvent): Ditto.
+ * platform/Scrollbar.cpp:
+ (WebCore::Scrollbar::maxOverlapBetweenPages): Added. Returns the
+ value from the native scrollbar theme.
+ * platform/Scrollbar.h: Replaced scroll amount constants with static methods.
+ (WebCore::Scrollbar::pixelsPerLineStep): Replaces cScrollbarPixelsPerLineStep.
+ (WebCore::Scrollbar::minFractionToStepWhenPaging): Replaces cFractionToStepWhenPaging.
+ * platform/ScrollbarTheme.h:
+ (WebCore::ScrollbarTheme::maxOverlapBetweenPages): A base implementation
+ that returns the largest int.
+ * platform/gtk/WheelEventGtk.cpp:
+ (WebCore::PlatformWheelEvent::PlatformWheelEvent): Use Scrollbar methods instead of
+ constants.
+ * platform/haiku/PlatformWheelEventHaiku.cpp:
+ (WebCore::PlatformWheelEvent::PlatformWheelEvent): Use Scrollbar methods instead of
+ constants.
+ * platform/mac/ScrollbarThemeMac.h:
+ (WebCore::ScrollbarThemeMac::maxOverlapBetweenPages): An override
+ that returns 40.
+ * platform/mac/WheelEventMac.mm:
+ (WebCore::PlatformWheelEvent::PlatformWheelEvent): Use
+ Scrollbar::pixelsPerLineStep() instead of cScrollbarPixelsPerLineStep.
+ * platform/wx/MouseWheelEventWx.cpp:
+ (WebCore::PlatformWheelEvent::PlatformWheelEvent): Use Scrollbar methods instead of
+ constants.
+ * platform/wx/ScrollViewWx.cpp:
+ (WebCore::ScrollView::ScrollViewPrivate::OnScrollWinEvents): Use Scrollbar
+ methods instead of constants, and cap the scroll distance if needed.
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::updateScrollInfoAfterLayout): Ditto.
+
+2010-02-04 No'am Rosenthal <noam.rosenthal@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ [Qt] Tuning and optimizations to GraphicsLayerQt. Reduce unnecessary
+ recaching, remove QTimer::singleShot and QPixmap::scaled, more
+ accurate strategy of handling transform operation blends. Rotating a
+ bordered-table, for example, now runs at 50FPS instead of 40FPS on Maemo5.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34062
+
+ This is tested by https://bugs.webkit.org/show_bug.cgi?id=34450, fps measurements.
+
+ * platform/graphics/qt/GraphicsLayerQt.cpp:
+ (WebCore::GraphicsLayerQtImpl::flushChanges): Fine-tune caching
+ (WebCore::TransformAnimationQt::TransformAnimationQt): transform bugs
+ (WebCore::OpacityAnimationQt::updateState): style change
+
+2010-02-04 Pavel Feldman <pfeldman@chromium.org>
+
+ Reviewed by Timothy Hatcher.
+
+ Web Inspector: Cookies for resources are not shown in storage panel.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34594
+
+ * inspector/InspectorController.cpp:
+ (WebCore::InspectorController::getCookies):
+ * inspector/InspectorResource.cpp:
+ (WebCore::InspectorResource::updateScriptObject):
+ (WebCore::InspectorResource::cachedResource):
+ * inspector/InspectorResource.h:
+ (WebCore::InspectorResource::requestURL):
+
+2010-02-04 Anton Muhin <antonm@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ [v8] Remove clear method from DOM object maps
+ https://bugs.webkit.org/show_bug.cgi?id=34530
+
+ No new tests. Should be covered by existent testing infrastructure.
+
+ * bindings/v8/DOMData.h:
+ * bindings/v8/DOMDataStore.h:
+ * bindings/v8/V8DOMMap.cpp:
+ * bindings/v8/V8DOMMap.h:
+ * bindings/v8/WorkerScriptController.cpp:
+ (WebCore::WorkerScriptController::~WorkerScriptController):
+
2010-02-04 Holger Hans Peter Freyther <zecke@selfish.org>
Reviewed by Xan Lopez.
diff --git a/WebCore/Configurations/FeatureDefines.xcconfig b/WebCore/Configurations/FeatureDefines.xcconfig
index 24589c7..8343ce7 100644
--- a/WebCore/Configurations/FeatureDefines.xcconfig
+++ b/WebCore/Configurations/FeatureDefines.xcconfig
@@ -56,6 +56,7 @@ ENABLE_JAVASCRIPT_DEBUGGER = ENABLE_JAVASCRIPT_DEBUGGER;
ENABLE_MATHML = ;
ENABLE_NOTIFICATIONS = ;
ENABLE_OFFLINE_WEB_APPLICATIONS = ENABLE_OFFLINE_WEB_APPLICATIONS;
+ENABLE_RUBY = ENABLE_RUBY;
ENABLE_SHARED_WORKERS = ENABLE_SHARED_WORKERS;
ENABLE_SVG = ENABLE_SVG;
ENABLE_SVG_ANIMATION = ENABLE_SVG_ANIMATION;
@@ -72,4 +73,4 @@ ENABLE_XHTMLMP = ;
ENABLE_XPATH = ENABLE_XPATH;
ENABLE_XSLT = ENABLE_XSLT;
-FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT);
+FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_RUBY) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT);
diff --git a/WebCore/Configurations/Version.xcconfig b/WebCore/Configurations/Version.xcconfig
index 75f9bd4..0e289b1 100644
--- a/WebCore/Configurations/Version.xcconfig
+++ b/WebCore/Configurations/Version.xcconfig
@@ -21,8 +21,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-MAJOR_VERSION = 532;
-MINOR_VERSION = 9;
+MAJOR_VERSION = 533;
+MINOR_VERSION = 1;
TINY_VERSION = 0;
FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION);
diff --git a/WebCore/DerivedSources.make b/WebCore/DerivedSources.make
index 6d8a6d5..d5fd2c1 100644
--- a/WebCore/DerivedSources.make
+++ b/WebCore/DerivedSources.make
@@ -624,6 +624,10 @@ ifeq ($(findstring ENABLE_VIDEO,$(FEATURE_DEFINES)), ENABLE_VIDEO)
HTML_FLAGS := $(HTML_FLAGS) ENABLE_VIDEO=1
endif
+ifeq ($(findstring ENABLE_RUBY,$(FEATURE_DEFINES)), ENABLE_RUBY)
+ HTML_FLAGS := $(HTML_FLAGS) ENABLE_RUBY=1
+endif
+
ifdef HTML_FLAGS
HTMLElementFactory.cpp HTMLNames.cpp : dom/make_names.pl html/HTMLTagNames.in html/HTMLAttributeNames.in
diff --git a/WebCore/English.lproj/localizedStrings.js b/WebCore/English.lproj/localizedStrings.js
index 637d4a6..9196692 100644
--- a/WebCore/English.lproj/localizedStrings.js
+++ b/WebCore/English.lproj/localizedStrings.js
Binary files differ
diff --git a/WebCore/ForwardingHeaders/runtime/WeakGCPtr.h b/WebCore/ForwardingHeaders/runtime/WeakGCPtr.h
new file mode 100644
index 0000000..e87f8f2
--- /dev/null
+++ b/WebCore/ForwardingHeaders/runtime/WeakGCPtr.h
@@ -0,0 +1,4 @@
+#ifndef WebCore_FWD_WeakGCPtr_h
+#define WebCore_FWD_WeakGCPtr_h
+#include <JavaScriptCore/WeakGCPtr.h>
+#endif
diff --git a/WebCore/ForwardingHeaders/wtf/ValueCheck.h b/WebCore/ForwardingHeaders/wtf/ValueCheck.h
new file mode 100644
index 0000000..4667674
--- /dev/null
+++ b/WebCore/ForwardingHeaders/wtf/ValueCheck.h
@@ -0,0 +1,4 @@
+#ifndef WebCore_FWD_ValueCheck_h
+#define WebCore_FWD_ValueCheck_h
+#include <JavaScriptCore/ValueCheck.h>
+#endif
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index f2dacec..e0c9dc6 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -477,6 +477,8 @@ webcore_sources += \
WebCore/bindings/js/ScriptCallStack.h \
WebCore/bindings/js/ScriptController.cpp \
WebCore/bindings/js/ScriptController.h \
+ WebCore/bindings/js/ScriptDebugServer.cpp \
+ WebCore/bindings/js/ScriptDebugServer.h \
WebCore/bindings/js/ScriptEventListener.cpp \
WebCore/bindings/js/ScriptEventListener.h \
WebCore/bindings/js/ScriptFunctionCall.cpp \
@@ -1734,6 +1736,8 @@ webcore_sources += \
WebCore/plugins/npfunctions.h \
WebCore/rendering/AutoTableLayout.cpp \
WebCore/rendering/AutoTableLayout.h \
+ WebCore/rendering/BidiRun.cpp \
+ WebCore/rendering/BidiRun.h \
WebCore/rendering/CounterNode.cpp \
WebCore/rendering/CounterNode.h \
WebCore/rendering/EllipsisBox.cpp \
@@ -1748,6 +1752,7 @@ webcore_sources += \
WebCore/rendering/InlineBox.h \
WebCore/rendering/InlineFlowBox.cpp \
WebCore/rendering/InlineFlowBox.h \
+ WebCore/rendering/InlineIterator.h \
WebCore/rendering/InlineRunBox.h \
WebCore/rendering/InlineTextBox.cpp \
WebCore/rendering/InlineTextBox.h \
@@ -2409,12 +2414,15 @@ webcoregtk_sources += \
WebCore/platform/graphics/gtk/VideoSinkGStreamer.cpp \
WebCore/platform/graphics/gtk/VideoSinkGStreamer.h \
WebCore/platform/graphics/gtk/DataSourceGStreamer.cpp \
- WebCore/platform/graphics/gtk/DataSourceGStreamer.h
+ WebCore/platform/graphics/gtk/DataSourceGStreamer.h \
+ WebCore/platform/graphics/gtk/WebKitWebSourceGStreamer.cpp \
+ WebCore/platform/graphics/gtk/WebKitWebSourceGStreamer.h
webcore_libadd += \
-lgstinterfaces-0.10 \
-lgstvideo-0.10 \
- -lgstpbutils-0.10
+ -lgstpbutils-0.10 \
+ -lgstapp-0.10
endif # END ENABLE_VIDEO
@@ -2432,6 +2440,16 @@ webcore_sources += \
endif # END ENABLE_XHTMLMP
# ----
+# Ruby Support
+# ----
+if ENABLE_RUBY
+
+HTML_FEATURES += ENABLE_RUBY=1
+webcore_cppflags += -DENABLE_RUBY=1
+
+endif # END ENABLE_RUBY
+
+# ----
# XPath Support
# ----
if ENABLE_XPATH
@@ -2722,7 +2740,11 @@ webcore_sources += \
WebCore/mathml/MathMLInlineContainerElement.cpp \
WebCore/mathml/MathMLInlineContainerElement.h \
WebCore/mathml/MathMLMathElement.cpp \
- WebCore/mathml/MathMLMathElement.h
+ WebCore/mathml/MathMLMathElement.h \
+ WebCore/mathml/MathMLTextElement.cpp \
+ WebCore/mathml/MathMLTextElement.h \
+ WebCore/mathml/RenderMathMLBlock.cpp \
+ WebCore/mathml/RenderMathMLBlock.h
webcore_built_sources += \
DerivedSources/MathMLElementFactory.cpp \
diff --git a/WebCore/WebCore.base.exp b/WebCore/WebCore.base.exp
index fbab12e..a0a5262 100644
--- a/WebCore/WebCore.base.exp
+++ b/WebCore/WebCore.base.exp
@@ -1,3 +1,4 @@
+
.objc_class_name_DOMAbstractView
.objc_class_name_DOMAttr
.objc_class_name_DOMCDATASection
@@ -249,6 +250,7 @@ __ZN7WebCore12IconDatabase4openERKNS_6StringE
__ZN7WebCore12IconDatabase5closeEv
__ZN7WebCore12IconDatabase9setClientEPNS_18IconDatabaseClientE
__ZN7WebCore12PluginWidget14invalidateRectERKNS_7IntRectE
+__ZN7WebCore12PrintContext13numberOfPagesEPNS_5FrameERKNS_9FloatSizeE
__ZN7WebCore12PrintContext20pageNumberForElementEPNS_7ElementERKNS_9FloatSizeE
__ZN7WebCore12RenderObject16repaintRectangleERKNS_7IntRectEb
__ZN7WebCore12RenderWidget19showSubstituteImageEN3WTF10PassRefPtrINS_5ImageEEE
@@ -651,6 +653,7 @@ __ZN7WebCore8Settings23setEditableLinkBehaviorENS_20EditableLinkBehaviorE
__ZN7WebCore8Settings23setLoadDeferringEnabledEb
__ZN7WebCore8Settings23setNeedsTigerMailQuirksEb
__ZN7WebCore8Settings23setPluginAllowedRunTimeEj
+__ZN7WebCore8Settings28setFrameSetFlatteningEnabledEb
__ZN7WebCore8Settings23setUsesEncodingDetectorEb
__ZN7WebCore8Settings24setApplicationChromeModeEb
__ZN7WebCore8Settings24setTextAreasAreResizableEb
@@ -682,7 +685,6 @@ __ZN7WebCore8Settings40setJavaScriptCanOpenWindowsAutomaticallyEb
__ZN7WebCore8Settings40setTextDirectionSubmenuInclusionBehaviorENS_37TextDirectionSubmenuInclusionBehaviorE
__ZN7WebCore8Settings41setNeedsKeyboardEventDisambiguationQuirksEb
__ZN7WebCore8blankURLEv
-__ZN7WebCore8jsStringEPN3JSC9ExecStateERKNS_6StringE
__ZN7WebCore8makeRGBAEiiii
__ZN7WebCore9DOMWindow30dispatchAllPendingUnloadEventsEv
__ZN7WebCore9DOMWindow36dispatchAllPendingBeforeUnloadEventsEv
@@ -760,6 +762,7 @@ __ZN7WebCore9PageGroup26setShouldTrackVisitedLinksEb
__ZN7WebCore9PageGroup29removeUserStyleSheetFromWorldEPNS_15DOMWrapperWorldERKNS_4KURLE
__ZN7WebCore9PageGroup30removeUserStyleSheetsFromWorldEPNS_15DOMWrapperWorldE
__ZN7WebCore9PageGroup9pageGroupERKNS_6StringE
+__ZN7WebCore9Scrollbar22maxOverlapBetweenPagesEv
__ZN7WebCore9TimerBase4stopEv
__ZN7WebCore9TimerBase5startEdd
__ZN7WebCore9TimerBaseC2Ev
@@ -1057,4 +1060,3 @@ _wkSetUpFontCache
_wkSignalCFReadStreamEnd
_wkSignalCFReadStreamError
_wkSignalCFReadStreamHasBytes
-
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 8291811..22b6117 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -450,10 +450,13 @@
'accessibility/win/AccessibilityObjectWrapperWin.h',
'accessibility/wx/AccessibilityObjectWx.cpp',
'bindings/generic/BindingDOMWindow.h',
+ 'bindings/generic/BindingElement.h',
'bindings/generic/BindingSecurity.h',
'bindings/generic/BindingSecurityBase.cpp',
'bindings/generic/BindingSecurityBase.h',
'bindings/generic/GenericBinding.h',
+ 'bindings/generic/RuntimeEnabledFeatures.cpp',
+ 'bindings/generic/RuntimeEnabledFeatures.h',
'bindings/js/CachedScriptSourceProvider.h',
'bindings/js/DOMObjectWithSVGContext.h',
'bindings/js/GCController.cpp',
@@ -674,7 +677,6 @@
'bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp',
'bindings/v8/custom/V8CSSStyleSheetCustom.cpp',
'bindings/v8/custom/V8CSSValueCustom.cpp',
- 'bindings/v8/custom/V8CustomBinding.h',
'bindings/v8/custom/V8CustomEventListener.cpp',
'bindings/v8/custom/V8CustomEventListener.h',
'bindings/v8/custom/V8CustomPositionCallback.cpp',
@@ -786,8 +788,6 @@
'bindings/v8/NPV8Object.cpp',
'bindings/v8/NPV8Object.h',
'bindings/v8/OwnHandle.h',
- 'bindings/v8/RuntimeEnabledFeatures.cpp',
- 'bindings/v8/RuntimeEnabledFeatures.h',
'bindings/v8/ScheduledAction.cpp',
'bindings/v8/ScheduledAction.h',
'bindings/v8/ScopedDOMDataStore.cpp',
@@ -801,6 +801,8 @@
'bindings/v8/ScriptCallStack.h',
'bindings/v8/ScriptController.cpp',
'bindings/v8/ScriptController.h',
+ 'bindings/v8/ScriptDebugServer.cpp',
+ 'bindings/v8/ScriptDebugServer.h',
'bindings/v8/ScriptEventListener.cpp',
'bindings/v8/ScriptEventListener.h',
'bindings/v8/ScriptFunctionCall.cpp',
@@ -2965,6 +2967,8 @@
'rendering/style/StyleVisualData.h',
'rendering/AutoTableLayout.cpp',
'rendering/AutoTableLayout.h',
+ 'rendering/BidiRun.cpp',
+ 'rendering/BidiRun.h',
'rendering/CounterNode.cpp',
'rendering/CounterNode.h',
'rendering/EllipsisBox.cpp',
@@ -2979,6 +2983,7 @@
'rendering/InlineBox.h',
'rendering/InlineFlowBox.cpp',
'rendering/InlineFlowBox.h',
+ 'rendering/InlineIterator.h',
'rendering/InlineRunBox.h',
'rendering/InlineTextBox.cpp',
'rendering/InlineTextBox.h',
@@ -3700,8 +3705,10 @@
'inspector/front-end/inspector.html',
'inspector/front-end/AbstractTimelinePanel.js',
+ 'inspector/front-end/AuditCategories.js',
'inspector/front-end/AuditLauncherView.js',
'inspector/front-end/AuditResultView.js',
+ 'inspector/front-end/AuditRules.js',
'inspector/front-end/AuditsPanel.js',
'inspector/front-end/BottomUpProfileDataGridTree.js',
'inspector/front-end/Breakpoint.js',
@@ -3735,7 +3742,6 @@
'inspector/front-end/inspector.js',
'inspector/front-end/KeyboardShortcut.js',
'inspector/front-end/MetricsSidebarPane.js',
- 'inspector/front-end/NativeTextViewer.js',
'inspector/front-end/Object.js',
'inspector/front-end/ObjectProxy.js',
'inspector/front-end/ObjectPropertiesSection.js',
@@ -3771,10 +3777,10 @@
'inspector/front-end/StylesSidebarPane.js',
'inspector/front-end/SummaryBar.js',
'inspector/front-end/TestController.js',
- 'inspector/front-end/TextEditor.js',
'inspector/front-end/TextEditorHighlighter.js',
'inspector/front-end/TextEditorModel.js',
'inspector/front-end/TextPrompt.js',
+ 'inspector/front-end/TextViewer.js',
'inspector/front-end/TimelineAgent.js',
'inspector/front-end/TimelineOverviewPane.js',
'inspector/front-end/TimelineGrid.js',
@@ -3788,7 +3794,7 @@
'inspector/front-end/audits.css',
'inspector/front-end/inspector.css',
'inspector/front-end/inspectorSyntaxHighlight.css',
- 'inspector/front-end/textEditor.css',
+ 'inspector/front-end/textViewer.css',
],
'webinspector_image_files': [
@@ -3821,7 +3827,7 @@
'inspector/front-end/Images/enableSolidButtonGlyph.png',
'inspector/front-end/Images/errorIcon.png',
'inspector/front-end/Images/errorMediumIcon.png',
- 'inspector/front-end/Images/errorRedDot.png',
+ 'inspector/front-end/Images/errorRedDot.png',
'inspector/front-end/Images/excludeButtonGlyph.png',
'inspector/front-end/Images/focusButtonGlyph.png',
'inspector/front-end/Images/forward.png',
diff --git a/WebCore/WebCore.pri b/WebCore/WebCore.pri
index 07b1532..c1b2e5a 100644
--- a/WebCore/WebCore.pri
+++ b/WebCore/WebCore.pri
@@ -52,6 +52,7 @@ contains(DEFINES, ENABLE_SINGLE_THREADED=1) {
!contains(DEFINES, ENABLE_XHTMLMP=.): DEFINES += ENABLE_XHTMLMP=0
!contains(DEFINES, ENABLE_DATAGRID=.): DEFINES += ENABLE_DATAGRID=0
!contains(DEFINES, ENABLE_VIDEO=.): DEFINES += ENABLE_VIDEO=1
+!contains(DEFINES, ENABLE_RUBY=.): DEFINES += ENABLE_RUBY=1
# SVG support
!contains(DEFINES, ENABLE_SVG=0) {
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index be4244d..13d6314 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -213,6 +213,7 @@ INCLUDEPATH = \
$$PWD/platform/graphics/qt \
$$PWD/platform/network/qt \
$$PWD/platform/qt \
+ $$PWD/../WebKit/qt/Api \
$$PWD/../WebKit/qt/WebCoreSupport \
$$INCLUDEPATH
@@ -343,6 +344,7 @@ SOURCES += \
bindings/js/ScriptCallFrame.cpp \
bindings/js/ScriptCallStack.cpp \
bindings/js/ScriptController.cpp \
+ bindings/js/ScriptDebugServer.cpp \
bindings/js/ScriptEventListener.cpp \
bindings/js/ScriptFunctionCall.cpp \
bindings/js/ScriptObject.cpp \
@@ -864,6 +866,7 @@ SOURCES += \
plugins/PluginView.cpp \
rendering/AutoTableLayout.cpp \
rendering/break_lines.cpp \
+ rendering/BidiRun.cpp \
rendering/CounterNode.cpp \
rendering/EllipsisBox.cpp \
rendering/FixedTableLayout.cpp \
@@ -1999,7 +2002,7 @@ SOURCES += \
platform/qt/FileSystemQt.cpp \
platform/qt/SharedBufferQt.cpp \
platform/graphics/qt/FontCacheQt.cpp \
- platform/graphics/qt/FontCustomPlatformData.cpp \
+ platform/graphics/qt/FontCustomPlatformDataQt.cpp \
platform/graphics/qt/GlyphPageTreeNodeQt.cpp \
platform/graphics/qt/SimpleFontDataQt.cpp \
platform/qt/KURLQt.cpp \
@@ -2663,37 +2666,40 @@ SOURCES += \
}
include($$PWD/../WebKit/qt/Api/headers.pri)
+include(../include/QtWebKit/classheaders.pri)
HEADERS += $$WEBKIT_API_HEADERS
-CONFIG(standalone_package) {
-
- !symbian {
- target.path = $$[QT_INSTALL_LIBS]
- INSTALLS += target
- }
+WEBKIT_INSTALL_HEADERS = $$WEBKIT_API_HEADERS $$WEBKIT_CLASS_HEADERS
- include($$PWD/../include/QtWebKit/headers.pri)
- headers.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES
+!symbian {
+ headers.files = $$WEBKIT_INSTALL_HEADERS
headers.path = $$[QT_INSTALL_HEADERS]/QtWebKit
- INSTALLS += headers
-
-} else {
target.path = $$[QT_INSTALL_LIBS]
- headers.files = $$WEBKIT_API_HEADERS
- headers.path = $$[QT_INSTALL_HEADERS]/QtWebKit
- VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION}
+ INSTALLS += target headers
+} else {
+ # INSTALLS is not implemented in qmake's s60 generators, copy headers manually
+ inst_headers.commands = $$QMAKE_COPY ${QMAKE_FILE_NAME} ${QMAKE_FILE_OUT}
+ inst_headers.input = WEBKIT_INSTALL_HEADERS
+ inst_headers.output = $$[QT_INSTALL_HEADERS]/QtWebKit/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
+ QMAKE_EXTRA_COMPILERS += inst_headers
+
+ install.depends += compiler_inst_headers_make_all
+ QMAKE_EXTRA_TARGETS += install
+}
- win32-*|wince* {
- DLLDESTDIR = $$OUTPUT_DIR/bin
- TARGET = $$qtLibraryTarget($$TARGET)
+# Qt will set the version for us when building in Qt's tree
+!CONFIG(QTDIR_build): VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION}
- dlltarget.commands = $(COPY_FILE) $(DESTDIR)$(TARGET) $$[QT_INSTALL_BINS]
- dlltarget.CONFIG = no_path
- INSTALLS += dlltarget
- }
+win32-*|wince* {
+ DLLDESTDIR = $$OUTPUT_DIR/bin
+ TARGET = $$qtLibraryTarget($$TARGET)
+ dlltarget.commands = $(COPY_FILE) $(DESTDIR_TARGET) $$[QT_INSTALL_BINS]
+ dlltarget.CONFIG = no_path
+ INSTALLS += dlltarget
+}
- INSTALLS += target headers
+!CONFIG(standalone_package) {
unix {
CONFIG += create_pc create_prl
@@ -2718,7 +2724,7 @@ CONFIG(standalone_package) {
CONFIG += lib_bundle qt_no_framework_direct_includes qt_framework
FRAMEWORK_HEADERS.version = Versions
- FRAMEWORK_HEADERS.files = $$WEBKIT_API_HEADERS
+ FRAMEWORK_HEADERS.files = $${headers.files}
FRAMEWORK_HEADERS.path = Headers
QMAKE_BUNDLE_DATA += FRAMEWORK_HEADERS
}
diff --git a/WebCore/WebCore.vcproj/WebCore.make b/WebCore/WebCore.vcproj/WebCore.make
index 26ad54f..1895b82 100644
--- a/WebCore/WebCore.vcproj/WebCore.make
+++ b/WebCore/WebCore.vcproj/WebCore.make
@@ -12,6 +12,6 @@ install:
xcopy "$(OBJROOT)\include\*" "$(DSTROOT)\AppleInternal\include\" /e/v/i/h/y
xcopy "$(OBJROOT)\lib\*" "$(DSTROOT)\AppleInternal\lib\" /e/v/i/h/y
xcopy "$(OBJROOT)\bin\WebKit.resources\*" "$(DSTROOT)\AppleInternal\bin\WebKit.resources" /e/v/i/h/y
- xcopy "$(OBJROOT)\obj\WebCore\scripts\*" "$(DSTROOT)\AppleInternal\obj\WebCore\scripts" /e/v/i/h/y
+ xcopy "$(OBJROOT)\obj\WebCore\scripts\*" "$(DSTROOT)\AppleInternal\tools\scripts" /e/v/i/h/y
xcopy "$(OBJROOT)\bin\*.pdb" "$(DSTROOT)\AppleInternal\bin\" /e/v/i/h/y
xcopy "$(OBJROOT)\bin\*.dll" "$(DSTROOT)\AppleInternal\bin\" /e/v/i/h/y
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index b46e5c1..14d93a9 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -5373,7 +5373,7 @@
>
</File>
<File
- RelativePath=".$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSHTMLFrameSetElement.cpp"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSHTMLFrameSetElement.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -5425,7 +5425,7 @@
</FileConfiguration>
</File>
<File
- RelativePath=".$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSHTMLFrameSetElement.h"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSHTMLFrameSetElement.h"
>
</File>
<File
@@ -27064,6 +27064,14 @@
RelativePath="..\rendering\break_lines.h"
>
</File>
+ <File
+ RelativePath="..\rendering\BidiRun.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\rendering\BidiRun.h"
+ >
+ </File>
<File
RelativePath="..\rendering\CounterNode.cpp"
>
@@ -27120,6 +27128,10 @@
RelativePath="..\rendering\InlineFlowBox.h"
>
</File>
+ <File
+ RelativePath="..\rendering\InlineIterator.h"
+ >
+ </File>
<File
RelativePath="..\rendering\InlineRunBox.h"
>
@@ -42720,6 +42732,10 @@
>
</File>
<File
+ RelativePath="..\inspector\front-end\AuditCategories.js"
+ >
+ </File>
+ <File
RelativePath="..\inspector\front-end\AuditLauncherView.js"
>
</File>
@@ -42728,6 +42744,10 @@
>
</File>
<File
+ RelativePath="..\inspector\front-end\AuditRules.js"
+ >
+ </File>
+ <File
RelativePath="..\inspector\front-end\audits.css"
>
</File>
@@ -42860,10 +42880,6 @@
>
</File>
<File
- RelativePath="..\inspector\front-end\NativeTextViewer.js"
- >
- </File>
- <File
RelativePath="..\inspector\front-end\Object.js"
>
</File>
@@ -43004,23 +43020,23 @@
>
</File>
<File
- RelativePath="..\inspector\front-end\TextEditor.js"
+ RelativePath="..\inspector\front-end\TextEditorHighlighter.js"
>
</File>
<File
- RelativePath="..\inspector\front-end\TextEditorHighlighter.js"
+ RelativePath="..\inspector\front-end\TextEditorModel.js"
>
</File>
<File
- RelativePath="..\inspector\front-end\TextEditorModel.js"
+ RelativePath="..\inspector\front-end\TextPrompt.js"
>
</File>
<File
- RelativePath="..\inspector\front-end\textEditor.css"
+ RelativePath="..\inspector\front-end\TextViewer.js"
>
</File>
<File
- RelativePath="..\inspector\front-end\TextPrompt.js"
+ RelativePath="..\inspector\front-end\textViewer.css"
>
</File>
<File
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 9135a97..1a75733 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -1273,6 +1273,7 @@
76CDD2F51103DA6600680521 /* AccessibilityMenuListPopup.h in Headers */ = {isa = PBXBuildFile; fileRef = 76CDD2EF1103DA6600680521 /* AccessibilityMenuListPopup.h */; };
76CDD2F61103DA6600680521 /* AccessibilityMenuListOption.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76CDD2F01103DA6600680521 /* AccessibilityMenuListOption.cpp */; };
76CDD2F71103DA6600680521 /* AccessibilityMenuListOption.h in Headers */ = {isa = PBXBuildFile; fileRef = 76CDD2F11103DA6600680521 /* AccessibilityMenuListOption.h */; };
+ 76FF17E311235673001D61B5 /* PluginViewNone.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76FF17E211235673001D61B5 /* PluginViewNone.cpp */; };
79AC9218109945C80021266E /* JSCompositionEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 79AC9216109945C80021266E /* JSCompositionEvent.cpp */; };
79AC9219109945C80021266E /* JSCompositionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 79AC9217109945C80021266E /* JSCompositionEvent.h */; };
79F2F5A11091939A000D87CB /* CompositionEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 79F2F59E1091939A000D87CB /* CompositionEvent.cpp */; };
@@ -1316,7 +1317,7 @@
84A81F410FC7E02700955300 /* SourceGraphic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84A81F3F0FC7E02700955300 /* SourceGraphic.cpp */; };
84A81F420FC7E02700955300 /* SourceGraphic.h in Headers */ = {isa = PBXBuildFile; fileRef = 84A81F400FC7E02700955300 /* SourceGraphic.h */; };
84D0C4041115F1D40018AA34 /* AffineTransform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84D0C4031115F1D40018AA34 /* AffineTransform.cpp */; };
- 84D0C4061115F1EA0018AA34 /* AffineTransform.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D0C4051115F1EA0018AA34 /* AffineTransform.h */; };
+ 84D0C4061115F1EA0018AA34 /* AffineTransform.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D0C4051115F1EA0018AA34 /* AffineTransform.h */; settings = {ATTRIBUTES = (Private, ); }; };
85004D940ACEEAEF00C438F6 /* DOMSVGDefsElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 85004D880ACEEAEF00C438F6 /* DOMSVGDefsElement.h */; };
85004D950ACEEAEF00C438F6 /* DOMSVGDefsElement.mm in Sources */ = {isa = PBXBuildFile; fileRef = 85004D890ACEEAEF00C438F6 /* DOMSVGDefsElement.mm */; };
85004D960ACEEAEF00C438F6 /* DOMSVGDescElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 85004D8A0ACEEAEF00C438F6 /* DOMSVGDescElement.h */; };
@@ -2457,6 +2458,8 @@
97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97DD4D840FDF4D6D00ECF9A4 /* XSSAuditor.cpp */; };
97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */ = {isa = PBXBuildFile; fileRef = 97DD4D850FDF4D6E00ECF9A4 /* XSSAuditor.h */; };
97EF7DFE107E55B700D7C49C /* ScriptControllerBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97EF7DFD107E55B700D7C49C /* ScriptControllerBase.cpp */; };
+ 9F6FC1961122E82A00E80196 /* ScriptDebugServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9F6FC1941122E82A00E80196 /* ScriptDebugServer.cpp */; };
+ 9F6FC1971122E82A00E80196 /* ScriptDebugServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F6FC1951122E82A00E80196 /* ScriptDebugServer.h */; settings = {ATTRIBUTES = (Private, ); }; };
9F72304F11184B4100AD0126 /* ScriptProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F72304C11184B4100AD0126 /* ScriptProfile.h */; settings = {ATTRIBUTES = (Private, ); }; };
9F72305011184B4100AD0126 /* ScriptProfiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9F72304D11184B4100AD0126 /* ScriptProfiler.cpp */; };
9F72305111184B4100AD0126 /* ScriptProfiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F72304E11184B4100AD0126 /* ScriptProfiler.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -4550,6 +4553,9 @@
BCE65BEA0EACDF16007E4533 /* Length.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE65BE80EACDF16007E4533 /* Length.cpp */; };
BCE65BEB0EACDF16007E4533 /* Length.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE65BE90EACDF16007E4533 /* Length.h */; settings = {ATTRIBUTES = (Private, ); }; };
BCE65D320EAD1211007E4533 /* Theme.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE65D310EAD1211007E4533 /* Theme.cpp */; };
+ BCE789161120D6080060ECE5 /* InlineIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE789151120D6080060ECE5 /* InlineIterator.h */; };
+ BCE789861120E7A60060ECE5 /* BidiRun.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE789851120E7A60060ECE5 /* BidiRun.h */; };
+ BCE7898B1120E8020060ECE5 /* BidiRun.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE7898A1120E8020060ECE5 /* BidiRun.cpp */; };
BCE7B1930D4E86960075A539 /* JSHistoryCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE7B1920D4E86960075A539 /* JSHistoryCustom.cpp */; };
BCE99EC30DCA624100182683 /* JSXSLTProcessorConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE99EC10DCA624100182683 /* JSXSLTProcessorConstructor.cpp */; };
BCE99EC40DCA624100182683 /* JSXSLTProcessorConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE99EC20DCA624100182683 /* JSXSLTProcessorConstructor.h */; };
@@ -6683,6 +6689,7 @@
76CDD2EF1103DA6600680521 /* AccessibilityMenuListPopup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityMenuListPopup.h; sourceTree = "<group>"; };
76CDD2F01103DA6600680521 /* AccessibilityMenuListOption.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityMenuListOption.cpp; sourceTree = "<group>"; };
76CDD2F11103DA6600680521 /* AccessibilityMenuListOption.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityMenuListOption.h; sourceTree = "<group>"; };
+ 76FF17E211235673001D61B5 /* PluginViewNone.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginViewNone.cpp; sourceTree = "<group>"; };
79AC9216109945C80021266E /* JSCompositionEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCompositionEvent.cpp; sourceTree = "<group>"; };
79AC9217109945C80021266E /* JSCompositionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCompositionEvent.h; sourceTree = "<group>"; };
79F2F59E1091939A000D87CB /* CompositionEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CompositionEvent.cpp; sourceTree = "<group>"; };
@@ -7798,6 +7805,8 @@
97DD4D840FDF4D6D00ECF9A4 /* XSSAuditor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XSSAuditor.cpp; sourceTree = "<group>"; };
97DD4D850FDF4D6E00ECF9A4 /* XSSAuditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XSSAuditor.h; sourceTree = "<group>"; };
97EF7DFD107E55B700D7C49C /* ScriptControllerBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptControllerBase.cpp; sourceTree = "<group>"; };
+ 9F6FC1941122E82A00E80196 /* ScriptDebugServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptDebugServer.cpp; sourceTree = "<group>"; };
+ 9F6FC1951122E82A00E80196 /* ScriptDebugServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptDebugServer.h; sourceTree = "<group>"; };
9F72304C11184B4100AD0126 /* ScriptProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptProfile.h; sourceTree = "<group>"; };
9F72304D11184B4100AD0126 /* ScriptProfiler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptProfiler.cpp; sourceTree = "<group>"; };
9F72304E11184B4100AD0126 /* ScriptProfiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptProfiler.h; sourceTree = "<group>"; };
@@ -9814,6 +9823,9 @@
BCE65BE80EACDF16007E4533 /* Length.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Length.cpp; sourceTree = "<group>"; };
BCE65BE90EACDF16007E4533 /* Length.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Length.h; sourceTree = "<group>"; };
BCE65D310EAD1211007E4533 /* Theme.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Theme.cpp; sourceTree = "<group>"; };
+ BCE789151120D6080060ECE5 /* InlineIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InlineIterator.h; sourceTree = "<group>"; };
+ BCE789851120E7A60060ECE5 /* BidiRun.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BidiRun.h; sourceTree = "<group>"; };
+ BCE7898A1120E8020060ECE5 /* BidiRun.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BidiRun.cpp; sourceTree = "<group>"; };
BCE7B1920D4E86960075A539 /* JSHistoryCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHistoryCustom.cpp; sourceTree = "<group>"; };
BCE99EC10DCA624100182683 /* JSXSLTProcessorConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXSLTProcessorConstructor.cpp; sourceTree = "<group>"; };
BCE99EC20DCA624100182683 /* JSXSLTProcessorConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSXSLTProcessorConstructor.h; sourceTree = "<group>"; };
@@ -11215,6 +11227,7 @@
5DCF836C0D59159800953BC6 /* PluginInfoStore.h */,
1ADA140E0E1AE5D900023EE5 /* PluginMainThreadScheduler.cpp */,
1ADA140F0E1AE5D900023EE5 /* PluginMainThreadScheduler.h */,
+ 76FF17E211235673001D61B5 /* PluginViewNone.cpp */,
0AFDAC3C10F5448C00E1F3D2 /* PluginWidget.h */,
);
path = plugins;
@@ -14632,6 +14645,8 @@
93B70D5309EB0C7C009D8468 /* ScriptController.cpp */,
93B70D5409EB0C7C009D8468 /* ScriptController.h */,
A83E1C720E49042B00140B9C /* ScriptControllerMac.mm */,
+ 9F6FC1941122E82A00E80196 /* ScriptDebugServer.cpp */,
+ 9F6FC1951122E82A00E80196 /* ScriptDebugServer.h */,
411046400FA222A600BA436A /* ScriptEventListener.cpp */,
4110463F0FA222A600BA436A /* ScriptEventListener.h */,
41002CCC0F66EDEF009E660D /* ScriptFunctionCall.cpp */,
@@ -15562,6 +15577,8 @@
BC8C8FAA0DDCD2F200B592F4 /* style */,
A8CFF04B0A154F09000A4234 /* AutoTableLayout.cpp */,
A8CFF0490A154F09000A4234 /* AutoTableLayout.h */,
+ BCE7898A1120E8020060ECE5 /* BidiRun.cpp */,
+ BCE789851120E7A60060ECE5 /* BidiRun.h */,
BCEA4815097D93020094C9E4 /* break_lines.cpp */,
BCEA4816097D93020094C9E4 /* break_lines.h */,
9392F14F0AD1862300691BD4 /* CounterNode.cpp */,
@@ -15578,6 +15595,7 @@
A8CFF5DE0A155A05000A4234 /* InlineBox.h */,
A8CFF5DD0A155A05000A4234 /* InlineFlowBox.cpp */,
A8CFF5DC0A155A05000A4234 /* InlineFlowBox.h */,
+ BCE789151120D6080060ECE5 /* InlineIterator.h */,
A8CFF5DB0A155A05000A4234 /* InlineRunBox.h */,
BCEA481A097D93020094C9E4 /* InlineTextBox.cpp */,
BCEA481B097D93020094C9E4 /* InlineTextBox.h */,
@@ -18511,7 +18529,13 @@
B71FE6DF11091CB300DAEF77 /* PrintContext.h in Headers */,
9F72304F11184B4100AD0126 /* ScriptProfile.h in Headers */,
9F72305111184B4100AD0126 /* ScriptProfiler.h in Headers */,
+<<<<<<< HEAD
59FD5B8D1129B29F00DB6D96 /* GeolocationPositionCache.h in Headers */,
+=======
+ BCE789161120D6080060ECE5 /* InlineIterator.h in Headers */,
+ BCE789861120E7A60060ECE5 /* BidiRun.h in Headers */,
+ 9F6FC1971122E82A00E80196 /* ScriptDebugServer.h in Headers */,
+>>>>>>> webkit.org at r54731
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -18533,7 +18557,7 @@
93F19B1208245E59001E9ABC /* Frameworks */,
939D050109D9FF6B00984996 /* Check For Global Initializers */,
933457E60EBFDF6B00B80894 /* Check For Exit Time Destructors */,
- 5D0D540D0E9862F60029E223 /* Check For Weak VTables */,
+ 5D0D540D0E9862F60029E223 /* Check For Weak VTables and Externals */,
);
buildRules = (
);
@@ -18668,7 +18692,7 @@
shellPath = /bin/sh;
shellScript = "rsync -aq --exclude \".svn\" --exclude \".DS_Store\" \"$SRCROOT/ForwardingHeaders\" \"$BUILT_PRODUCTS_DIR/$PRIVATE_HEADERS_FOLDER_PATH\"\nrsync -aq --exclude \".svn\" --exclude \".DS_Store\" \"$SRCROOT/icu\" \"$BUILT_PRODUCTS_DIR/$PRIVATE_HEADERS_FOLDER_PATH\"\n";
};
- 5D0D540D0E9862F60029E223 /* Check For Weak VTables */ = {
+ 5D0D540D0E9862F60029E223 /* Check For Weak VTables and Externals */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
@@ -18676,12 +18700,12 @@
inputPaths = (
"$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)",
);
- name = "Check For Weak VTables";
+ name = "Check For Weak VTables and Externals";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "if [ \"${ACTION}\" = \"installhdrs\" ]; then\n exit 0;\nfi\n\nif [ -f ../WebKitTools/Scripts/check-for-weak-vtables ]; then\n ../WebKitTools/Scripts/check-for-weak-vtables || exit $?\nfi";
+ shellScript = "if [ \"${ACTION}\" = \"installhdrs\" ]; then\n exit 0;\nfi\n\nif [ -f ../WebKitTools/Scripts/check-for-weak-vtables-and-externals ]; then\n ../WebKitTools/Scripts/check-for-weak-vtables-and-externals || exit $?\nfi";
};
5D2F7DA00C6879C600B5B72B /* Update Info.plist with version information */ = {
isa = PBXShellScriptBuildPhase;
@@ -20690,7 +20714,13 @@
84D0C4041115F1D40018AA34 /* AffineTransform.cpp in Sources */,
B776D43D1104527500BEB0EC /* PrintContext.cpp in Sources */,
9F72305011184B4100AD0126 /* ScriptProfiler.cpp in Sources */,
+<<<<<<< HEAD
59FD5B8B1129B29100DB6D96 /* GeolocationPositionCache.cpp in Sources */,
+=======
+ BCE7898B1120E8020060ECE5 /* BidiRun.cpp in Sources */,
+ 9F6FC1961122E82A00E80196 /* ScriptDebugServer.cpp in Sources */,
+ 76FF17E311235673001D61B5 /* PluginViewNone.cpp in Sources */,
+>>>>>>> webkit.org at r54731
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/WebCore/WebCorePrefix.h b/WebCore/WebCorePrefix.h
index 1ffb675..ac2014e 100644
--- a/WebCore/WebCorePrefix.h
+++ b/WebCore/WebCorePrefix.h
@@ -153,3 +153,4 @@
#undef try
#undef catch
#endif
+
diff --git a/WebCore/accessibility/chromium/AXObjectCacheChromium.cpp b/WebCore/accessibility/chromium/AXObjectCacheChromium.cpp
index a97dfe2..4118c63 100644
--- a/WebCore/accessibility/chromium/AXObjectCacheChromium.cpp
+++ b/WebCore/accessibility/chromium/AXObjectCacheChromium.cpp
@@ -26,11 +26,22 @@
#include "config.h"
#include "AXObjectCache.h"
-
#include "AccessibilityObject.h"
+#include "Chrome.h"
+#include "ChromeClientChromium.h"
+#include "FrameView.h"
namespace WebCore {
+static ChromeClientChromium* toChromeClientChromium(FrameView* view)
+{
+ Page* page = view->frame() ? view->frame()->page() : 0;
+ if (!page)
+ return 0;
+
+ return static_cast<ChromeClientChromium*>(page->chrome()->client());
+}
+
void AXObjectCache::detachWrapper(AccessibilityObject* obj)
{
// In Chromium, AccessibilityObjects are wrapped lazily.
@@ -43,8 +54,17 @@ void AXObjectCache::attachWrapper(AccessibilityObject*)
// In Chromium, AccessibilityObjects are wrapped lazily.
}
-void AXObjectCache::postPlatformNotification(AccessibilityObject*, AXNotification)
+void AXObjectCache::postPlatformNotification(AccessibilityObject* obj, AXNotification notification)
{
+ if (notification != AXCheckedStateChanged)
+ return;
+
+ if (!obj || !obj->document() || !obj->documentFrameView())
+ return;
+
+ ChromeClientChromium* client = toChromeClientChromium(obj->documentFrameView());
+ if (client)
+ client->didChangeAccessibilityObjectState(obj);
}
void AXObjectCache::handleFocusedUIElementChanged(RenderObject*, RenderObject*)
diff --git a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp
index a4d1638..487fa5b 100644
--- a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp
+++ b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp
@@ -884,14 +884,14 @@ gchar* textForObject(AccessibilityRenderObject* accObject)
continue;
}
- RenderText* renderText = toRenderText(obj);
- // Be sure we have a RenderText object we can work with.
- if (!renderText || !obj->isText()) {
+ RenderText* renderText;
+ if (obj->isText())
+ renderText = toRenderText(obj);
+ else if (obj->firstChild() && obj->firstChild()->isText()) {
// Handle RenderInlines (and any other similiar RenderObjects).
renderText = toRenderText(obj->firstChild());
- if (!renderText)
- continue;
- }
+ } else
+ continue;
InlineTextBox* box = renderText->firstTextBox();
while (box) {
diff --git a/WebCore/bindings/ScriptControllerBase.cpp b/WebCore/bindings/ScriptControllerBase.cpp
index f1217e3..abe96ee 100644
--- a/WebCore/bindings/ScriptControllerBase.cpp
+++ b/WebCore/bindings/ScriptControllerBase.cpp
@@ -33,6 +33,7 @@ namespace WebCore {
bool ScriptController::canExecuteScripts()
{
+ // FIXME: We should get this information from the document instead of the frame.
if (m_frame->loader()->isSandboxed(SandboxScripts))
return false;
diff --git a/WebCore/bindings/generic/BindingDOMWindow.h b/WebCore/bindings/generic/BindingDOMWindow.h
index b968e2c..d6d3087 100644
--- a/WebCore/bindings/generic/BindingDOMWindow.h
+++ b/WebCore/bindings/generic/BindingDOMWindow.h
@@ -35,6 +35,7 @@
#include "FrameLoadRequest.h"
#include "GenericBinding.h"
#include "Page.h"
+#include "SecurityOrigin.h"
namespace WebCore {
@@ -68,9 +69,11 @@ Frame* BindingDOMWindow<Binding>::createWindow(State<Binding>* state,
ASSERT(callingFrame);
ASSERT(enteredFrame);
- // Sandboxed iframes cannot open new auxiliary browsing contexts.
- if (callingFrame && callingFrame->loader()->isSandboxed(SandboxNavigation))
- return 0;
+ if (Document* callingDocument = callingFrame->document()) {
+ // Sandboxed iframes cannot open new auxiliary browsing contexts.
+ if (callingDocument->securityOrigin()->isSandboxed(SandboxNavigation))
+ return 0;
+ }
ResourceRequest request;
diff --git a/WebCore/bindings/generic/BindingElement.h b/WebCore/bindings/generic/BindingElement.h
new file mode 100644
index 0000000..ba7856a
--- /dev/null
+++ b/WebCore/bindings/generic/BindingElement.h
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BindingElement_h
+#define BindingElement_h
+
+#include "Attr.h"
+#include "BindingSecurity.h"
+#include "Element.h"
+#include "ExceptionCode.h"
+
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+template <class Binding>
+class BindingElement {
+public:
+ static void setAttribute(State<Binding>*, Element*, const AtomicString&, const AtomicString&, ExceptionCode&);
+ static RefPtr<Attr> setAttributeNode(State<Binding>*, Element*, Attr*, ExceptionCode&);
+ static void setAttributeNS(State<Binding>*, Element*, const AtomicString&, const AtomicString&, const AtomicString&, ExceptionCode&);
+ static RefPtr<Attr> setAttributeNodeNS(State<Binding>*, Element*, Attr*, ExceptionCode&);
+};
+
+// Implementations of templated methods must be in this file.
+
+template <class Binding>
+void BindingElement<Binding>::setAttribute(State<Binding>* state, Element* element, const AtomicString& name, const AtomicString& value, ExceptionCode& ec)
+{
+ ASSERT(element);
+
+ if (!BindingSecurity<Binding>::allowSettingSrcToJavascriptURL(state, element, name, value))
+ return;
+
+ element->setAttribute(name, value, ec);
+}
+
+template <class Binding>
+RefPtr<Attr> BindingElement<Binding>::setAttributeNode(State<Binding>* state, Element* element, Attr* newAttr, ExceptionCode& ec)
+{
+ ASSERT(element);
+ ASSERT(newAttr);
+
+ if (!BindingSecurity<Binding>::allowSettingSrcToJavascriptURL(state, element, newAttr->name(), newAttr->value()))
+ return 0;
+
+ return element->setAttributeNode(newAttr, ec);
+}
+
+template <class Binding>
+void BindingElement<Binding>::setAttributeNS(State<Binding>* state, Element* element, const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& value, ExceptionCode& ec)
+{
+ ASSERT(element);
+
+ if (!BindingSecurity<Binding>::allowSettingSrcToJavascriptURL(state, element, qualifiedName, value))
+ return;
+
+ element->setAttributeNS(namespaceURI, qualifiedName, value, ec);
+}
+
+template <class Binding>
+RefPtr<Attr> BindingElement<Binding>::setAttributeNodeNS(State<Binding>* state, Element* element, Attr* newAttr, ExceptionCode& ec)
+{
+ ASSERT(element);
+ ASSERT(newAttr);
+
+ if (!BindingSecurity<Binding>::allowSettingSrcToJavascriptURL(state, element, newAttr->name(), newAttr->value()))
+ return 0;
+
+ return element->setAttributeNodeNS(newAttr, ec);
+}
+
+} // namespace WebCore
+
+#endif // BindingElement_h
diff --git a/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp b/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp
new file mode 100644
index 0000000..3fdbb6d
--- /dev/null
+++ b/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "RuntimeEnabledFeatures.h"
+
+#include "Database.h"
+#include "MediaPlayer.h"
+#include "SharedWorkerRepository.h"
+#include "WebSocket.h"
+
+namespace WebCore {
+
+bool RuntimeEnabledFeatures::isLocalStorageEnabled = true;
+bool RuntimeEnabledFeatures::isSessionStorageEnabled = true;
+bool RuntimeEnabledFeatures::isWebkitNotificationsEnabled = false;
+bool RuntimeEnabledFeatures::isApplicationCacheEnabled = false;
+bool RuntimeEnabledFeatures::isGeolocationEnabled = false;
+bool RuntimeEnabledFeatures::isIndexedDBEnabled = false;
+
+#if ENABLE(VIDEO)
+
+bool RuntimeEnabledFeatures::audioEnabled()
+{
+ return MediaPlayer::isAvailable();
+}
+
+bool RuntimeEnabledFeatures::htmlMediaElementEnabled()
+{
+ return MediaPlayer::isAvailable();
+}
+
+bool RuntimeEnabledFeatures::htmlAudioElementEnabled()
+{
+ return MediaPlayer::isAvailable();
+}
+
+bool RuntimeEnabledFeatures::htmlVideoElementEnabled()
+{
+ return MediaPlayer::isAvailable();
+}
+
+bool RuntimeEnabledFeatures::mediaErrorEnabled()
+{
+ return MediaPlayer::isAvailable();
+}
+
+#endif
+
+#if ENABLE(SHARED_WORKERS)
+bool RuntimeEnabledFeatures::sharedWorkerEnabled()
+{
+ return SharedWorkerRepository::isAvailable();
+}
+#endif
+
+#if ENABLE(WEB_SOCKETS)
+bool RuntimeEnabledFeatures::webSocketEnabled()
+{
+ return WebSocket::isAvailable();
+}
+#endif
+
+#if ENABLE(DATABASE)
+bool RuntimeEnabledFeatures::openDatabaseEnabled()
+{
+ return Database::isAvailable();
+}
+#endif
+
+} // namespace WebCore
diff --git a/WebCore/bindings/v8/RuntimeEnabledFeatures.h b/WebCore/bindings/generic/RuntimeEnabledFeatures.h
index 4428004..6f0f78f 100644
--- a/WebCore/bindings/v8/RuntimeEnabledFeatures.h
+++ b/WebCore/bindings/generic/RuntimeEnabledFeatures.h
@@ -33,7 +33,10 @@
namespace WebCore {
-// A class that stores static enablers for all experimental features
+// A class that stores static enablers for all experimental features. Note that
+// the method names must line up with the JavaScript method they enable for code
+// generation to work properly.
+
class RuntimeEnabledFeatures {
public:
static void setLocalStorageEnabled(bool isEnabled) { isLocalStorageEnabled = isEnabled; }
@@ -42,8 +45,8 @@ public:
static void setSessionStorageEnabled(bool isEnabled) { isSessionStorageEnabled = isEnabled; }
static bool sessionStorageEnabled() { return isSessionStorageEnabled; }
- static void setNotificationsEnabled(bool isEnabled) { isNotificationsEnabled = isEnabled; }
- static bool notificationsEnabled() { return isNotificationsEnabled; }
+ static void setWebkitNotificationsEnabled(bool isEnabled) { isWebkitNotificationsEnabled = isEnabled; }
+ static bool webkitNotificationsEnabled() { return isWebkitNotificationsEnabled; }
static void setApplicationCacheEnabled(bool isEnabled) { isApplicationCacheEnabled = isEnabled; }
static bool applicationCacheEnabled() { return isApplicationCacheEnabled; }
@@ -51,8 +54,28 @@ public:
static void setGeolocationEnabled(bool isEnabled) { isGeolocationEnabled = isEnabled; }
static bool geolocationEnabled() { return isGeolocationEnabled; }
- static void setIndexedDatabaseEnabled(bool isEnabled) { isIndexedDatabaseEnabled = isEnabled; }
- static bool indexedDatabaseEnabled() { return isIndexedDatabaseEnabled; }
+ static void setIndexedDBEnabled(bool isEnabled) { isIndexedDBEnabled = isEnabled; }
+ static bool indexedDBEnabled() { return isIndexedDBEnabled; }
+
+#if ENABLE(VIDEO)
+ static bool audioEnabled();
+ static bool htmlMediaElementEnabled();
+ static bool htmlAudioElementEnabled();
+ static bool htmlVideoElementEnabled();
+ static bool mediaErrorEnabled();
+#endif
+
+#if ENABLE(SHARED_WORKERS)
+ static bool sharedWorkerEnabled();
+#endif
+
+#if ENABLE(WEB_SOCKETS)
+ static bool webSocketEnabled();
+#endif
+
+#if ENABLE(DATABASE)
+ static bool openDatabaseEnabled();
+#endif
private:
// Never instantiate.
@@ -60,10 +83,10 @@ private:
static bool isLocalStorageEnabled;
static bool isSessionStorageEnabled;
- static bool isNotificationsEnabled;
+ static bool isWebkitNotificationsEnabled;
static bool isApplicationCacheEnabled;
static bool isGeolocationEnabled;
- static bool isIndexedDatabaseEnabled;
+ static bool isIndexedDBEnabled;
};
} // namespace WebCore
diff --git a/WebCore/bindings/js/JSAbstractWorkerCustom.cpp b/WebCore/bindings/js/JSAbstractWorkerCustom.cpp
index 6eca7bd..61fcf98 100644
--- a/WebCore/bindings/js/JSAbstractWorkerCustom.cpp
+++ b/WebCore/bindings/js/JSAbstractWorkerCustom.cpp
@@ -50,7 +50,7 @@ JSValue JSAbstractWorker::addEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -60,7 +60,7 @@ JSValue JSAbstractWorker::removeEventListener(ExecState* exec, const ArgList& ar
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/WebCore/bindings/js/JSBindingsAllInOne.cpp b/WebCore/bindings/js/JSBindingsAllInOne.cpp
index 8a918a3..5a0820b 100644
--- a/WebCore/bindings/js/JSBindingsAllInOne.cpp
+++ b/WebCore/bindings/js/JSBindingsAllInOne.cpp
@@ -140,6 +140,7 @@
#include "ScriptCallStack.cpp"
#include "ScriptController.cpp"
#include "ScriptControllerWin.cpp"
+#include "ScriptDebugServer.cpp"
#include "ScriptEventListener.cpp"
#include "ScriptFunctionCall.cpp"
#include "ScriptProfiler.cpp"
diff --git a/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp b/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp
index 91ee51a..5637087 100644
--- a/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp
+++ b/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp
@@ -91,7 +91,7 @@ JSValue JSDOMApplicationCache::addEventListener(ExecState* exec, const ArgList&
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -101,7 +101,7 @@ JSValue JSDOMApplicationCache::removeEventListener(ExecState* exec, const ArgLis
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/WebCore/bindings/js/JSDOMBinding.cpp b/WebCore/bindings/js/JSDOMBinding.cpp
index abba405..d718cba 100644
--- a/WebCore/bindings/js/JSDOMBinding.cpp
+++ b/WebCore/bindings/js/JSDOMBinding.cpp
@@ -151,9 +151,11 @@ DOMWrapperWorld::DOMWrapperWorld(JSC::JSGlobalData* globalData, bool isNormal)
DOMWrapperWorld::~DOMWrapperWorld()
{
- JSGlobalData::ClientData* clientData = m_globalData->clientData;
- ASSERT(clientData);
- static_cast<WebCoreJSClientData*>(clientData)->forgetWorld(this);
+ if (m_globalData) {
+ JSGlobalData::ClientData* clientData = m_globalData->clientData;
+ ASSERT(clientData);
+ static_cast<WebCoreJSClientData*>(clientData)->forgetWorld(this);
+ }
for (HashSet<Document*>::iterator iter = documentsWithWrappers.begin(); iter != documentsWithWrappers.end(); ++iter)
forgetWorldOfDOMNodesForDocument(*iter, this);
diff --git a/WebCore/bindings/js/JSDOMBinding.h b/WebCore/bindings/js/JSDOMBinding.h
index 5456c75..930f9cc 100644
--- a/WebCore/bindings/js/JSDOMBinding.h
+++ b/WebCore/bindings/js/JSDOMBinding.h
@@ -138,9 +138,13 @@ namespace WebCore {
class DOMWrapperWorld : public RefCounted<DOMWrapperWorld> {
public:
- DOMWrapperWorld(JSC::JSGlobalData*, bool isNormal);
+ static PassRefPtr<DOMWrapperWorld> create(JSC::JSGlobalData* globalData, bool isNormal)
+ {
+ return adoptRef(new DOMWrapperWorld(globalData, isNormal));
+ }
~DOMWrapperWorld();
+ void detachFromGlobalData() { m_globalData = 0; }
void rememberDocument(Document* document) { documentsWithWrappers.add(document); }
void forgetDocument(Document* document) { documentsWithWrappers.remove(document); }
@@ -150,6 +154,9 @@ namespace WebCore {
bool isNormal() const { return m_isNormal; }
+ protected:
+ DOMWrapperWorld(JSC::JSGlobalData*, bool isNormal);
+
private:
JSC::JSGlobalData* m_globalData;
HashSet<Document*> documentsWithWrappers;
@@ -185,13 +192,19 @@ namespace WebCore {
public:
WebCoreJSClientData(JSC::JSGlobalData* globalData)
- : m_normalWorld(globalData, true)
+ : m_normalWorld(DOMWrapperWorld::create(globalData, true))
+ {
+ m_worldSet.add(m_normalWorld.get());
+ }
+
+ virtual ~WebCoreJSClientData()
{
- m_worldSet.add(&m_normalWorld);
+ ASSERT(m_worldSet.contains(m_normalWorld.get()));
+ ASSERT(m_worldSet.size() == 1);
+ m_normalWorld->detachFromGlobalData();
}
- // FIXME: add a destructor to assert m_worldSet only contains m_normalWorld?
- DOMWrapperWorld* normalWorld() { return &m_normalWorld; }
+ DOMWrapperWorld* normalWorld() { return m_normalWorld.get(); }
void getAllWorlds(Vector<DOMWrapperWorld*>& worlds)
{
@@ -212,7 +225,7 @@ namespace WebCore {
DOMObjectHashTableMap hashTableMap;
private:
HashSet<DOMWrapperWorld*> m_worldSet;
- DOMWrapperWorld m_normalWorld;
+ RefPtr<DOMWrapperWorld> m_normalWorld;
};
DOMObject* getCachedDOMObjectWrapper(JSC::ExecState*, void* objectHandle);
diff --git a/WebCore/bindings/js/JSDOMWindowCustom.cpp b/WebCore/bindings/js/JSDOMWindowCustom.cpp
index f7be2c5..b8cd1dc 100644
--- a/WebCore/bindings/js/JSDOMWindowCustom.cpp
+++ b/WebCore/bindings/js/JSDOMWindowCustom.cpp
@@ -97,7 +97,7 @@ void JSDOMWindow::markChildren(MarkStack& markStack)
{
Base::markChildren(markStack);
- impl()->markEventListeners(markStack);
+ impl()->markJSEventListeners(markStack);
JSGlobalData& globalData = *Heap::heap(this)->globalData();
@@ -666,9 +666,11 @@ static Frame* createWindow(ExecState* exec, Frame* lexicalFrame, Frame* dynamicF
ASSERT(lexicalFrame);
ASSERT(dynamicFrame);
- // Sandboxed iframes cannot open new auxiliary browsing contexts.
- if (lexicalFrame && lexicalFrame->loader()->isSandboxed(SandboxNavigation))
- return 0;
+ if (Document* lexicalDocument = lexicalFrame->document()) {
+ // Sandboxed iframes cannot open new auxiliary browsing contexts.
+ if (lexicalDocument->securityOrigin()->isSandboxed(SandboxNavigation))
+ return 0;
+ }
ResourceRequest request;
@@ -997,7 +999,7 @@ JSValue JSDOMWindow::addEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -1011,7 +1013,7 @@ JSValue JSDOMWindow::removeEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/WebCore/bindings/js/JSEventListener.cpp b/WebCore/bindings/js/JSEventListener.cpp
index d3b5fe1..61f21be 100644
--- a/WebCore/bindings/js/JSEventListener.cpp
+++ b/WebCore/bindings/js/JSEventListener.cpp
@@ -31,9 +31,10 @@ using namespace JSC;
namespace WebCore {
-JSEventListener::JSEventListener(JSObject* function, bool isAttribute, DOMWrapperWorld* isolatedWorld)
+JSEventListener::JSEventListener(JSObject* function, JSObject* wrapper, bool isAttribute, DOMWrapperWorld* isolatedWorld)
: EventListener(JSEventListenerType)
, m_jsFunction(function)
+ , m_wrapper(wrapper)
, m_isAttribute(isAttribute)
, m_isolatedWorld(isolatedWorld)
{
@@ -43,9 +44,10 @@ JSEventListener::~JSEventListener()
{
}
-JSObject* JSEventListener::jsFunction(ScriptExecutionContext*) const
+JSObject* JSEventListener::initializeJSFunction(ScriptExecutionContext*) const
{
- return m_jsFunction;
+ ASSERT_NOT_REACHED();
+ return 0;
}
void JSEventListener::markJSFunction(MarkStack& markStack)
diff --git a/WebCore/bindings/js/JSEventListener.h b/WebCore/bindings/js/JSEventListener.h
index 9ba09c6..569c192 100644
--- a/WebCore/bindings/js/JSEventListener.h
+++ b/WebCore/bindings/js/JSEventListener.h
@@ -22,7 +22,7 @@
#include "EventListener.h"
#include "JSDOMWindow.h"
-#include <runtime/Protect.h>
+#include <runtime/WeakGCPtr.h>
namespace WebCore {
@@ -30,9 +30,9 @@ namespace WebCore {
class JSEventListener : public EventListener {
public:
- static PassRefPtr<JSEventListener> create(JSC::JSObject* listener, bool isAttribute, DOMWrapperWorld* isolatedWorld)
+ static PassRefPtr<JSEventListener> create(JSC::JSObject* listener, JSC::JSObject* wrapper, bool isAttribute, DOMWrapperWorld* isolatedWorld)
{
- return adoptRef(new JSEventListener(listener, isAttribute, isolatedWorld));
+ return adoptRef(new JSEventListener(listener, wrapper, isAttribute, isolatedWorld));
}
static const JSEventListener* cast(const EventListener* listener)
@@ -49,30 +49,61 @@ namespace WebCore {
// Returns true if this event listener was created for an event handler attribute, like "onload" or "onclick".
bool isAttribute() const { return m_isAttribute; }
- virtual JSC::JSObject* jsFunction(ScriptExecutionContext*) const;
+ JSC::JSObject* jsFunction(ScriptExecutionContext*) const;
+ DOMWrapperWorld* isolatedWorld() const { return m_isolatedWorld.get(); }
+
+ JSC::JSObject* wrapper() const { return m_wrapper.get(); }
+ void setWrapper(JSC::JSObject* wrapper) const { m_wrapper = wrapper; }
private:
+ virtual JSC::JSObject* initializeJSFunction(ScriptExecutionContext*) const;
virtual void markJSFunction(JSC::MarkStack&);
+ virtual void invalidateJSFunction(JSC::JSObject*);
virtual void handleEvent(ScriptExecutionContext*, Event*);
virtual bool reportError(ScriptExecutionContext*, const String& message, const String& url, int lineNumber);
virtual bool virtualisAttribute() const;
- void clearJSFunctionInline();
protected:
- JSEventListener(JSC::JSObject* function, bool isAttribute, DOMWrapperWorld* isolatedWorld);
+ JSEventListener(JSC::JSObject* function, JSC::JSObject* wrapper, bool isAttribute, DOMWrapperWorld* isolatedWorld);
+ private:
mutable JSC::JSObject* m_jsFunction;
+ mutable JSC::WeakGCPtr<JSC::JSObject> m_wrapper;
+
bool m_isAttribute;
RefPtr<DOMWrapperWorld> m_isolatedWorld;
};
+ inline JSC::JSObject* JSEventListener::jsFunction(ScriptExecutionContext* scriptExecutionContext) const
+ {
+ if (!m_jsFunction)
+ m_jsFunction = initializeJSFunction(scriptExecutionContext);
+
+ // Verify that we have a valid wrapper protecting our function from
+ // garbage collection.
+ ASSERT(m_wrapper || !m_jsFunction);
+ if (!m_wrapper)
+ return 0;
+
+ // Try to verify that m_jsFunction wasn't recycled. (Not exact, since an
+ // event listener can be almost anything, but this makes test-writing easier).
+ ASSERT(!m_jsFunction || static_cast<JSC::JSCell*>(m_jsFunction)->isObject());
+
+ return m_jsFunction;
+ }
+
+ inline void JSEventListener::invalidateJSFunction(JSC::JSObject* wrapper)
+ {
+ m_wrapper.clear(wrapper);
+ }
+
// Creates a JS EventListener for an "onXXX" event attribute.
- inline PassRefPtr<JSEventListener> createJSAttributeEventListener(JSC::ExecState* exec, JSC::JSValue listener)
+ inline PassRefPtr<JSEventListener> createJSAttributeEventListener(JSC::ExecState* exec, JSC::JSValue listener, JSC::JSObject* wrapper)
{
if (!listener.isObject())
return 0;
- return JSEventListener::create(asObject(listener), true, currentWorld(exec));
+ return JSEventListener::create(asObject(listener), wrapper, true, currentWorld(exec));
}
diff --git a/WebCore/bindings/js/JSEventSourceCustom.cpp b/WebCore/bindings/js/JSEventSourceCustom.cpp
index 8f0dfb1..dab3285 100644
--- a/WebCore/bindings/js/JSEventSourceCustom.cpp
+++ b/WebCore/bindings/js/JSEventSourceCustom.cpp
@@ -49,7 +49,7 @@ JSValue JSEventSource::addEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -59,7 +59,7 @@ JSValue JSEventSource::removeEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp b/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
index 96c5c43..3db894d 100644
--- a/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
+++ b/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
@@ -53,6 +53,7 @@
#include "Node.h"
#include "Page.h"
#if ENABLE(DOM_STORAGE)
+#include "SerializedScriptValue.h"
#include "Storage.h"
#include "JSStorage.h"
#endif
@@ -61,6 +62,7 @@
#include <parser/SourceCode.h>
#include <runtime/JSArray.h>
#include <runtime/JSLock.h>
+#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
#if ENABLE(JAVASCRIPT_DEBUGGER)
@@ -195,6 +197,24 @@ JSValue JSInjectedScriptHost::selectDOMStorage(ExecState*, const ArgList& args)
}
#endif
+JSValue JSInjectedScriptHost::reportDidDispatchOnInjectedScript(ExecState* exec, const ArgList& args)
+{
+ if (args.size() < 3)
+ return jsUndefined();
+
+ if (!args.at(0).isInt32())
+ return jsUndefined();
+ int callId = args.at(0).asInt32();
+
+ RefPtr<SerializedScriptValue> result(SerializedScriptValue::create(exec, args.at(1)));
+
+ bool isException;
+ if (!args.at(2).getBoolean(isException))
+ return jsUndefined();
+ impl()->reportDidDispatchOnInjectedScript(callId, result.get(), isException);
+ return jsUndefined();
+}
+
InjectedScript InjectedScriptHost::injectedScriptFor(ScriptState* scriptState)
{
JSLock lock(SilenceAssertionsOnly);
diff --git a/WebCore/bindings/js/JSLazyEventListener.cpp b/WebCore/bindings/js/JSLazyEventListener.cpp
index b707991..4fbdaa6 100644
--- a/WebCore/bindings/js/JSLazyEventListener.cpp
+++ b/WebCore/bindings/js/JSLazyEventListener.cpp
@@ -35,12 +35,11 @@ namespace WebCore {
static WTF::RefCountedLeakCounter eventListenerCounter("JSLazyEventListener");
#endif
-JSLazyEventListener::JSLazyEventListener(const String& functionName, const String& eventParameterName, const String& code, Node* node, const String& sourceURL, int lineNumber, DOMWrapperWorld* isolatedWorld)
- : JSEventListener(0, true, isolatedWorld)
+JSLazyEventListener::JSLazyEventListener(const String& functionName, const String& eventParameterName, const String& code, Node* node, const String& sourceURL, int lineNumber, JSObject* wrapper, DOMWrapperWorld* isolatedWorld)
+ : JSEventListener(0, wrapper, true, isolatedWorld)
, m_functionName(functionName)
, m_eventParameterName(eventParameterName)
, m_code(code)
- , m_parsed(false)
, m_sourceURL(sourceURL)
, m_lineNumber(lineNumber)
, m_originalNode(node)
@@ -48,8 +47,8 @@ JSLazyEventListener::JSLazyEventListener(const String& functionName, const Strin
// We don't retain the original node because we assume it
// will stay alive as long as this handler object is around
// and we need to avoid a reference cycle. If JS transfers
- // this handler to another node, parseCode will be called and
- // then originalNode is no longer needed.
+ // this handler to another node, initializeJSFunction will
+ // be called and then originalNode is no longer needed.
// A JSLazyEventListener can be created with a line number of zero when it is created with
// a setAttribute call from JavaScript, so make the line number 1 in that case.
@@ -68,79 +67,62 @@ JSLazyEventListener::~JSLazyEventListener()
#endif
}
-JSObject* JSLazyEventListener::jsFunction(ScriptExecutionContext* executionContext) const
-{
- parseCode(executionContext);
- return m_jsFunction;
-}
-
-void JSLazyEventListener::parseCode(ScriptExecutionContext* executionContext) const
+JSObject* JSLazyEventListener::initializeJSFunction(ScriptExecutionContext* executionContext) const
{
ASSERT(executionContext);
ASSERT(executionContext->isDocument());
if (!executionContext)
- return;
-
- if (m_parsed)
- return;
+ return 0;
Frame* frame = static_cast<Document*>(executionContext)->frame();
if (!frame)
- return;
+ return 0;
ScriptController* scriptController = frame->script();
if (!scriptController->canExecuteScripts())
- return;
+ return 0;
- JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(executionContext, m_isolatedWorld.get());
+ JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(executionContext, isolatedWorld());
if (!globalObject)
- return;
-
- // Ensure that 'node' has a JavaScript wrapper to mark the event listener we're creating.
- if (m_originalNode) {
- JSLock lock(SilenceAssertionsOnly);
- // FIXME: Should pass the global object associated with the node
- toJS(globalObject->globalExec(), globalObject, m_originalNode);
- }
+ return 0;
if (executionContext->isDocument()) {
JSDOMWindow* window = static_cast<JSDOMWindow*>(globalObject);
Frame* frame = window->impl()->frame();
if (!frame)
- return;
+ return 0;
// FIXME: Is this check needed for non-Document contexts?
ScriptController* script = frame->script();
if (!script->canExecuteScripts() || script->isPaused())
- return;
+ return 0;
}
- m_parsed = true;
-
ExecState* exec = globalObject->globalExec();
MarkedArgumentBuffer args;
args.append(jsNontrivialString(exec, m_eventParameterName));
args.append(jsString(exec, m_code));
- m_jsFunction = constructFunction(exec, args, Identifier(exec, m_functionName), m_sourceURL, m_lineNumber); // FIXME: is globalExec ok?
-
- JSFunction* listenerAsFunction = static_cast<JSFunction*>(m_jsFunction);
-
+ JSObject* jsFunction = constructFunction(exec, args, Identifier(exec, m_functionName), m_sourceURL, m_lineNumber); // FIXME: is globalExec ok?
if (exec->hadException()) {
exec->clearException();
+ return 0;
+ }
+
+ JSFunction* listenerAsFunction = static_cast<JSFunction*>(jsFunction);
+ if (m_originalNode) {
+ if (!wrapper()) {
+ // Ensure that 'node' has a JavaScript wrapper to mark the event listener we're creating.
+ JSLock lock(SilenceAssertionsOnly);
+ // FIXME: Should pass the global object associated with the node
+ setWrapper(asObject(toJS(globalObject->globalExec(), globalObject, m_originalNode)));
+ }
- // failed to parse, so let's just make this listener a no-op
- m_jsFunction = 0;
- } else if (m_originalNode) {
// Add the event's home element to the scope
// (and the document, and the form - see JSHTMLElement::eventHandlerScope)
ScopeChain scope = listenerAsFunction->scope();
-
- JSValue thisObj = toJS(exec, globalObject, m_originalNode);
- if (thisObj.isObject()) {
- static_cast<JSNode*>(asObject(thisObj))->pushEventHandlerScope(exec, scope);
- listenerAsFunction->setScope(scope);
- }
+ static_cast<JSNode*>(wrapper())->pushEventHandlerScope(exec, scope);
+ listenerAsFunction->setScope(scope);
}
// Since we only parse once, there's no need to keep data used for parsing around anymore.
@@ -148,6 +130,7 @@ void JSLazyEventListener::parseCode(ScriptExecutionContext* executionContext) co
m_code = String();
m_eventParameterName = String();
m_sourceURL = String();
+ return jsFunction;
}
} // namespace WebCore
diff --git a/WebCore/bindings/js/JSLazyEventListener.h b/WebCore/bindings/js/JSLazyEventListener.h
index ba26ef6..1b00b75 100644
--- a/WebCore/bindings/js/JSLazyEventListener.h
+++ b/WebCore/bindings/js/JSLazyEventListener.h
@@ -29,24 +29,21 @@ namespace WebCore {
class JSLazyEventListener : public JSEventListener {
public:
- static PassRefPtr<JSLazyEventListener> create(const String& functionName, const String& eventParameterName, const String& code, Node* node, const String& sourceURL, int lineNumber, DOMWrapperWorld* isolatedWorld)
+ static PassRefPtr<JSLazyEventListener> create(const String& functionName, const String& eventParameterName, const String& code, Node* node, const String& sourceURL, int lineNumber, JSC::JSObject* wrapper, DOMWrapperWorld* isolatedWorld)
{
- return adoptRef(new JSLazyEventListener(functionName, eventParameterName, code, node, sourceURL, lineNumber, isolatedWorld));
+ return adoptRef(new JSLazyEventListener(functionName, eventParameterName, code, node, sourceURL, lineNumber, wrapper, isolatedWorld));
}
virtual ~JSLazyEventListener();
private:
- JSLazyEventListener(const String& functionName, const String& eventParameterName, const String& code, Node*, const String& sourceURL, int lineNumber, DOMWrapperWorld* isolatedWorld);
+ JSLazyEventListener(const String& functionName, const String& eventParameterName, const String& code, Node*, const String& sourceURL, int lineNumber, JSC::JSObject* wrapper, DOMWrapperWorld* isolatedWorld);
- virtual JSC::JSObject* jsFunction(ScriptExecutionContext*) const;
+ virtual JSC::JSObject* initializeJSFunction(ScriptExecutionContext*) const;
virtual bool wasCreatedFromMarkup() const { return true; }
- void parseCode(ScriptExecutionContext*) const;
-
mutable String m_functionName;
mutable String m_eventParameterName;
mutable String m_code;
- mutable bool m_parsed;
mutable String m_sourceURL;
int m_lineNumber;
Node* m_originalNode;
diff --git a/WebCore/bindings/js/JSMessagePortCustom.cpp b/WebCore/bindings/js/JSMessagePortCustom.cpp
index 2c09620..2ee8125 100644
--- a/WebCore/bindings/js/JSMessagePortCustom.cpp
+++ b/WebCore/bindings/js/JSMessagePortCustom.cpp
@@ -49,7 +49,7 @@ void JSMessagePort::markChildren(MarkStack& markStack)
if (MessagePort* entangledPort = m_impl->locallyEntangledPort())
markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), entangledPort);
- m_impl->markEventListeners(markStack);
+ m_impl->markJSEventListeners(markStack);
}
JSValue JSMessagePort::addEventListener(ExecState* exec, const ArgList& args)
@@ -58,7 +58,7 @@ JSValue JSMessagePort::addEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -68,7 +68,7 @@ JSValue JSMessagePort::removeEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/WebCore/bindings/js/JSNodeCustom.cpp b/WebCore/bindings/js/JSNodeCustom.cpp
index 737430e..46a30a4 100644
--- a/WebCore/bindings/js/JSNodeCustom.cpp
+++ b/WebCore/bindings/js/JSNodeCustom.cpp
@@ -114,7 +114,7 @@ JSValue JSNode::addEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -124,7 +124,7 @@ JSValue JSNode::removeEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -137,7 +137,7 @@ void JSNode::markChildren(MarkStack& markStack)
Base::markChildren(markStack);
Node* node = m_impl.get();
- node->markEventListeners(markStack);
+ node->markJSEventListeners(markStack);
// Nodes in the document are kept alive by JSDocument::mark, so, if we're in
// the document, we need to mark the document, but we don't need to explicitly
diff --git a/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp b/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp
index 5f26df3..b3bded5 100644
--- a/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp
+++ b/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp
@@ -52,7 +52,7 @@ JSValue JSSVGElementInstance::addEventListener(ExecState* exec, const ArgList& a
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -62,7 +62,7 @@ JSValue JSSVGElementInstance::removeEventListener(ExecState* exec, const ArgList
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/WebCore/bindings/js/JSSVGMatrixCustom.cpp b/WebCore/bindings/js/JSSVGMatrixCustom.cpp
index d2d3d6f..59e3f03 100644
--- a/WebCore/bindings/js/JSSVGMatrixCustom.cpp
+++ b/WebCore/bindings/js/JSSVGMatrixCustom.cpp
@@ -23,7 +23,7 @@
#if ENABLE(SVG)
#include "JSSVGMatrix.h"
-#include "TransformationMatrix.h"
+#include "AffineTransform.h"
#include "SVGException.h"
#include <runtime/Error.h>
@@ -41,19 +41,19 @@ JSValue JSSVGMatrix::multiply(ExecState* exec, const ArgList& args)
JSSVGMatrix* matrixObj = static_cast<JSSVGMatrix*>(asObject(args.at(0)));
- TransformationMatrix m1(*impl());
- TransformationMatrix m2(*(matrixObj->impl()));
+ AffineTransform m1(*impl());
+ AffineTransform m2(*(matrixObj->impl()));
SVGElement* context = JSSVGContextCache::svgContextForDOMObject(this);
- return toJS(exec, globalObject(), JSSVGStaticPODTypeWrapper<TransformationMatrix>::create(m1.multLeft(m2)).get(), context);
+ return toJS(exec, globalObject(), JSSVGStaticPODTypeWrapper<AffineTransform>::create(m1.multLeft(m2)).get(), context);
}
JSValue JSSVGMatrix::inverse(ExecState* exec, const ArgList&)
{
- TransformationMatrix imp(*impl());
+ AffineTransform imp(*impl());
SVGElement* context = JSSVGContextCache::svgContextForDOMObject(this);
- JSValue result = toJS(exec, globalObject(), JSSVGStaticPODTypeWrapper<TransformationMatrix>::create(imp.inverse()).get(), context);
+ JSValue result = toJS(exec, globalObject(), JSSVGStaticPODTypeWrapper<AffineTransform>::create(imp.inverse()).get(), context);
if (!imp.isInvertible())
setDOMException(exec, SVGException::SVG_MATRIX_NOT_INVERTABLE);
@@ -63,13 +63,13 @@ JSValue JSSVGMatrix::inverse(ExecState* exec, const ArgList&)
JSValue JSSVGMatrix::rotateFromVector(ExecState* exec, const ArgList& args)
{
- TransformationMatrix imp(*impl());
+ AffineTransform imp(*impl());
float x = args.at(0).toFloat(exec);
float y = args.at(1).toFloat(exec);
SVGElement* context = JSSVGContextCache::svgContextForDOMObject(this);
- JSValue result = toJS(exec, globalObject(), JSSVGStaticPODTypeWrapper<TransformationMatrix>::create(imp.rotateFromVector(x, y)).get(), context);
+ JSValue result = toJS(exec, globalObject(), JSSVGStaticPODTypeWrapper<AffineTransform>::create(imp.rotateFromVector(x, y)).get(), context);
if (x == 0.0 || y == 0.0)
setDOMException(exec, SVGException::SVG_INVALID_VALUE_ERR);
diff --git a/WebCore/bindings/js/JSSVGPODTypeWrapper.h b/WebCore/bindings/js/JSSVGPODTypeWrapper.h
index 7c04f22..2efc60e 100644
--- a/WebCore/bindings/js/JSSVGPODTypeWrapper.h
+++ b/WebCore/bindings/js/JSSVGPODTypeWrapper.h
@@ -46,13 +46,13 @@ public:
};
// This file contains JS wrapper objects for SVG datatypes, that are passed around by value
-// in WebCore/svg (aka. 'POD types'). For instance SVGMatrix is mapped to TransformationMatrix, and
+// in WebCore/svg (aka. 'POD types'). For instance SVGMatrix is mapped to AffineTransform, and
// passed around as const reference. SVG DOM demands these objects to be "live", changes to any
// of the writable attributes of SVGMatrix need to be reflected in the object which exposed the
// SVGMatrix object (i.e. 'someElement.transform.matrix.a = 50.0', in that case 'SVGTransform').
-// The SVGTransform class stores its "TransformationMatrix m_matrix" object on the stack. If it would
+// The SVGTransform class stores its "AffineTransform m_matrix" object on the stack. If it would
// be stored as pointer we could just build an auto-generated JSSVG* wrapper object around it
-// and all changes to that object would automatically affect the TransformationMatrix* object stored
+// and all changes to that object would automatically affect the AffineTransform* object stored
// in the SVGTransform object. For the sake of efficiency and memory we don't pass around any
// primitive values as pointers, so a custom JS wrapper object is needed for all SVG types, that
// are internally represented by POD types (SVGRect <-> FloatRect, SVGPoint <-> FloatPoint, ...).
diff --git a/WebCore/bindings/js/JSWebSocketCustom.cpp b/WebCore/bindings/js/JSWebSocketCustom.cpp
index 238b041..d610f01 100644
--- a/WebCore/bindings/js/JSWebSocketCustom.cpp
+++ b/WebCore/bindings/js/JSWebSocketCustom.cpp
@@ -65,7 +65,7 @@ JSValue JSWebSocket::addEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -75,7 +75,7 @@ JSValue JSWebSocket::removeEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/WebCore/bindings/js/JSWorkerContextCustom.cpp b/WebCore/bindings/js/JSWorkerContextCustom.cpp
index ab28674..d6c8dbd 100644
--- a/WebCore/bindings/js/JSWorkerContextCustom.cpp
+++ b/WebCore/bindings/js/JSWorkerContextCustom.cpp
@@ -60,7 +60,7 @@ void JSWorkerContext::markChildren(MarkStack& markStack)
markDOMObjectWrapper(markStack, globalData, impl()->optionalLocation());
markDOMObjectWrapper(markStack, globalData, impl()->optionalNavigator());
- impl()->markEventListeners(markStack);
+ impl()->markJSEventListeners(markStack);
}
bool JSWorkerContext::getOwnPropertySlotDelegate(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
@@ -127,7 +127,7 @@ JSValue JSWorkerContext::addEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -137,7 +137,7 @@ JSValue JSWorkerContext::removeEventListener(ExecState* exec, const ArgList& arg
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
index d35d53a..e20b6d9 100644
--- a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
+++ b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
@@ -56,7 +56,7 @@ void JSXMLHttpRequest::markChildren(MarkStack& markStack)
if (XMLHttpRequestUpload* upload = m_impl->optionalUpload())
markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), upload);
- m_impl->markEventListeners(markStack);
+ m_impl->markJSEventListeners(markStack);
}
// Custom functions
@@ -153,7 +153,7 @@ JSValue JSXMLHttpRequest::addEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -163,7 +163,7 @@ JSValue JSXMLHttpRequest::removeEventListener(ExecState* exec, const ArgList& ar
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp b/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp
index fa7cfec..857c12d 100644
--- a/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp
+++ b/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp
@@ -48,7 +48,7 @@ void JSXMLHttpRequestUpload::markChildren(MarkStack& markStack)
if (XMLHttpRequest* xmlHttpRequest = m_impl->associatedXMLHttpRequest())
markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), xmlHttpRequest);
- m_impl->markEventListeners(markStack);
+ m_impl->markJSEventListeners(markStack);
}
JSValue JSXMLHttpRequestUpload::addEventListener(ExecState* exec, const ArgList& args)
@@ -57,7 +57,7 @@ JSValue JSXMLHttpRequestUpload::addEventListener(ExecState* exec, const ArgList&
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -67,7 +67,7 @@ JSValue JSXMLHttpRequestUpload::removeEventListener(ExecState* exec, const ArgLi
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/WebCore/bindings/js/ScriptArray.cpp b/WebCore/bindings/js/ScriptArray.cpp
index 2c4075a..caecc40 100644
--- a/WebCore/bindings/js/ScriptArray.cpp
+++ b/WebCore/bindings/js/ScriptArray.cpp
@@ -53,6 +53,10 @@ static bool handleException(ScriptState* scriptState)
bool ScriptArray::set(unsigned index, const ScriptObject& value)
{
+ if (value.scriptState() != m_scriptState) {
+ ASSERT_NOT_REACHED();
+ return false;
+ }
JSLock lock(SilenceAssertionsOnly);
jsArray()->put(m_scriptState, index, value.jsObject());
return handleException(m_scriptState);
diff --git a/WebCore/bindings/js/ScriptController.cpp b/WebCore/bindings/js/ScriptController.cpp
index bd36689..171d4dd 100644
--- a/WebCore/bindings/js/ScriptController.cpp
+++ b/WebCore/bindings/js/ScriptController.cpp
@@ -155,6 +155,9 @@ ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode)
// An DOMWrapperWorld other than the thread's normal world.
class IsolatedWorld : public DOMWrapperWorld {
public:
+ static PassRefPtr<IsolatedWorld> create(JSGlobalData* globalData) { return adoptRef(new IsolatedWorld(globalData)); }
+
+protected:
IsolatedWorld(JSGlobalData* globalData)
: DOMWrapperWorld(globalData, false)
{
@@ -162,8 +165,6 @@ public:
ASSERT(clientData);
static_cast<WebCoreJSClientData*>(clientData)->rememberWorld(this);
}
-
- static PassRefPtr<IsolatedWorld> create(JSGlobalData* globalData) { return adoptRef(new IsolatedWorld(globalData)); }
};
PassRefPtr<DOMWrapperWorld> ScriptController::createWorld()
diff --git a/WebCore/bindings/js/ScriptDebugServer.cpp b/WebCore/bindings/js/ScriptDebugServer.cpp
new file mode 100644
index 0000000..9869775
--- /dev/null
+++ b/WebCore/bindings/js/ScriptDebugServer.cpp
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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"
+
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+
+#include "ScriptDebugServer.h"
+
+#include "JavaScriptDebugServer.h"
+
+namespace WebCore {
+
+void ScriptDebugServer::recompileAllJSFunctions()
+{
+ JavaScriptDebugServer::shared().recompileAllJSFunctions();
+}
+
+void ScriptDebugServer::recompileAllJSFunctionsSoon()
+{
+ JavaScriptDebugServer::shared().recompileAllJSFunctionsSoon();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(JAVASCRIPT_DEBUGGER)
diff --git a/WebCore/bindings/js/ScriptDebugServer.h b/WebCore/bindings/js/ScriptDebugServer.h
new file mode 100644
index 0000000..027ffa5
--- /dev/null
+++ b/WebCore/bindings/js/ScriptDebugServer.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 ScriptDebugServer_h
+#define ScriptDebugServer_h
+
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+class ScriptDebugServer : public Noncopyable {
+public:
+ static void recompileAllJSFunctions();
+ static void recompileAllJSFunctionsSoon();
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(JAVASCRIPT_DEBUGGER)
+
+#endif // ScriptDebugServer_h
diff --git a/WebCore/bindings/js/ScriptEventListener.cpp b/WebCore/bindings/js/ScriptEventListener.cpp
index 4325dc3..fd45546 100644
--- a/WebCore/bindings/js/ScriptEventListener.cpp
+++ b/WebCore/bindings/js/ScriptEventListener.cpp
@@ -37,6 +37,7 @@
#include "JSNode.h"
#include "Frame.h"
#include "XSSAuditor.h"
+#include <runtime/JSLock.h>
using namespace JSC;
@@ -58,6 +59,7 @@ PassRefPtr<JSLazyEventListener> createAttributeEventListener(Node* node, Attribu
int lineNumber = 1;
String sourceURL;
+ JSObject* wrapper = 0;
// FIXME: We should be able to provide accurate source information for frameless documents, too (e.g. for importing nodes from XMLHttpRequest.responseXML).
if (Frame* frame = node->document()->frame()) {
@@ -72,9 +74,13 @@ PassRefPtr<JSLazyEventListener> createAttributeEventListener(Node* node, Attribu
lineNumber = scriptController->eventHandlerLineNumber();
sourceURL = node->document()->url().string();
+
+ JSC::JSLock lock(SilenceAssertionsOnly);
+ JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(node->document(), mainThreadNormalWorld());
+ wrapper = asObject(toJS(globalObject->globalExec(), globalObject, node));
}
- return JSLazyEventListener::create(attr->localName().string(), eventParameterName(node->isSVGElement()), attr->value(), node, sourceURL, lineNumber, mainThreadNormalWorld());
+ return JSLazyEventListener::create(attr->localName().string(), eventParameterName(node->isSVGElement()), attr->value(), node, sourceURL, lineNumber, wrapper, mainThreadNormalWorld());
}
PassRefPtr<JSLazyEventListener> createAttributeEventListener(Frame* frame, Attribute* attr)
@@ -100,15 +106,19 @@ PassRefPtr<JSLazyEventListener> createAttributeEventListener(Frame* frame, Attri
lineNumber = scriptController->eventHandlerLineNumber();
sourceURL = frame->document()->url().string();
- return JSLazyEventListener::create(attr->localName().string(), eventParameterName(frame->document()->isSVGDocument()), attr->value(), 0, sourceURL, lineNumber, mainThreadNormalWorld());
+ JSObject* wrapper = toJSDOMWindow(frame, mainThreadNormalWorld());
+ return JSLazyEventListener::create(attr->localName().string(), eventParameterName(frame->document()->isSVGDocument()), attr->value(), 0, sourceURL, lineNumber, wrapper, mainThreadNormalWorld());
}
String getEventListenerHandlerBody(ScriptExecutionContext* context, ScriptState* scriptState, EventListener* eventListener)
{
- JSC::JSObject* functionObject = eventListener->jsFunction(context);
- if (!functionObject)
+ const JSEventListener* jsListener = JSEventListener::cast(eventListener);
+ if (!jsListener)
+ return "";
+ JSC::JSObject* jsFunction = jsListener->jsFunction(context);
+ if (!jsFunction)
return "";
- return functionObject->toString(scriptState);
+ return jsFunction->toString(scriptState);
}
} // namespace WebCore
diff --git a/WebCore/bindings/js/ScriptFunctionCall.cpp b/WebCore/bindings/js/ScriptFunctionCall.cpp
index a2284bc..5001d3c 100644
--- a/WebCore/bindings/js/ScriptFunctionCall.cpp
+++ b/WebCore/bindings/js/ScriptFunctionCall.cpp
@@ -42,8 +42,8 @@ using namespace JSC;
namespace WebCore {
-ScriptFunctionCall::ScriptFunctionCall(ScriptState* exec, const ScriptObject& thisObject, const String& name)
- : m_exec(exec)
+ScriptFunctionCall::ScriptFunctionCall(const ScriptObject& thisObject, const String& name)
+ : m_exec(thisObject.scriptState())
, m_thisObject(thisObject)
, m_name(name)
{
@@ -51,6 +51,10 @@ ScriptFunctionCall::ScriptFunctionCall(ScriptState* exec, const ScriptObject& th
void ScriptFunctionCall::appendArgument(const ScriptObject& argument)
{
+ if (argument.scriptState() != m_exec) {
+ ASSERT_NOT_REACHED();
+ return;
+ }
m_arguments.append(argument.jsObject());
}
diff --git a/WebCore/bindings/js/ScriptFunctionCall.h b/WebCore/bindings/js/ScriptFunctionCall.h
index 7c5074f..9742e8f 100644
--- a/WebCore/bindings/js/ScriptFunctionCall.h
+++ b/WebCore/bindings/js/ScriptFunctionCall.h
@@ -48,7 +48,7 @@ namespace WebCore {
class ScriptFunctionCall {
public:
- ScriptFunctionCall(ScriptState* exec, const ScriptObject& thisObject, const String& name);
+ ScriptFunctionCall(const ScriptObject& thisObject, const String& name);
virtual ~ScriptFunctionCall() {};
void appendArgument(const ScriptObject&);
diff --git a/WebCore/bindings/js/ScriptObject.cpp b/WebCore/bindings/js/ScriptObject.cpp
index 03ecfc6..7948219 100644
--- a/WebCore/bindings/js/ScriptObject.cpp
+++ b/WebCore/bindings/js/ScriptObject.cpp
@@ -70,6 +70,10 @@ bool ScriptObject::set(const String& name, const String& value)
bool ScriptObject::set(const char* name, const ScriptObject& value)
{
+ if (value.scriptState() != m_scriptState) {
+ ASSERT_NOT_REACHED();
+ return false;
+ }
JSLock lock(SilenceAssertionsOnly);
PutPropertySlot slot;
jsObject()->put(m_scriptState, Identifier(m_scriptState, name), value.jsObject(), slot);
diff --git a/WebCore/bindings/js/ScriptString.h b/WebCore/bindings/js/ScriptString.h
index a33d639..18964b8 100644
--- a/WebCore/bindings/js/ScriptString.h
+++ b/WebCore/bindings/js/ScriptString.h
@@ -61,7 +61,7 @@ public:
JSC::StringBuilder buffer;
buffer.append(m_str);
buffer.append(s);
- m_str = buffer.release();
+ m_str = buffer.build();
return *this;
}
diff --git a/WebCore/bindings/js/ScriptValue.cpp b/WebCore/bindings/js/ScriptValue.cpp
index ac92e14..005c329 100644
--- a/WebCore/bindings/js/ScriptValue.cpp
+++ b/WebCore/bindings/js/ScriptValue.cpp
@@ -29,6 +29,8 @@
#include "config.h"
#include "ScriptValue.h"
+#include "SerializedScriptValue.h"
+
#include <JavaScriptCore/APICast.h>
#include <JavaScriptCore/JSValueRef.h>
@@ -81,4 +83,14 @@ bool ScriptValue::isObject() const
return m_value.get().isObject();
}
+PassRefPtr<SerializedScriptValue> ScriptValue::serialize(ScriptState* scriptState)
+{
+ return SerializedScriptValue::create(scriptState, jsValue());
+}
+
+ScriptValue ScriptValue::deserialize(ScriptState* scriptState, SerializedScriptValue* value)
+{
+ return ScriptValue(value->deserialize(scriptState, scriptState->lexicalGlobalObject()));
+}
+
} // namespace WebCore
diff --git a/WebCore/bindings/js/ScriptValue.h b/WebCore/bindings/js/ScriptValue.h
index b1eaa21..9ccb7ac 100644
--- a/WebCore/bindings/js/ScriptValue.h
+++ b/WebCore/bindings/js/ScriptValue.h
@@ -34,10 +34,12 @@
#include "PlatformString.h"
#include "ScriptState.h"
#include <runtime/Protect.h>
+#include <wtf/PassRefPtr.h>
namespace WebCore {
class String;
+class SerializedScriptValue;
class ScriptValue {
public:
@@ -53,6 +55,9 @@ public:
bool isObject() const;
bool hasNoValue() const { return m_value == JSC::JSValue(); }
+ PassRefPtr<SerializedScriptValue> serialize(ScriptState*);
+ static ScriptValue deserialize(ScriptState*, SerializedScriptValue*);
+
private:
JSC::ProtectedJSValue m_value;
};
diff --git a/WebCore/bindings/js/SerializedScriptValue.cpp b/WebCore/bindings/js/SerializedScriptValue.cpp
index fd9cb59..fbf8899 100644
--- a/WebCore/bindings/js/SerializedScriptValue.cpp
+++ b/WebCore/bindings/js/SerializedScriptValue.cpp
@@ -29,14 +29,17 @@
#include "File.h"
#include "FileList.h"
+#include "ImageData.h"
#include "JSDOMGlobalObject.h"
#include "JSFile.h"
#include "JSFileList.h"
+#include "JSImageData.h"
#include <JavaScriptCore/APICast.h>
#include <runtime/DateInstance.h>
#include <runtime/ExceptionHelpers.h>
#include <runtime/JSLock.h>
#include <runtime/PropertyNameArray.h>
+#include <wtf/ByteArray.h>
#include <wtf/HashTraits.h>
#include <wtf/Vector.h>
@@ -165,6 +168,30 @@ private:
Vector<String> m_files;
};
+class SerializedImageData : public SharedSerializedData {
+public:
+ static PassRefPtr<SerializedImageData> create(const ImageData* imageData)
+ {
+ return adoptRef(new SerializedImageData(imageData));
+ }
+
+ unsigned width() const { return m_width; }
+ unsigned height() const { return m_height; }
+ WTF::ByteArray* data() const { return m_storage.get(); }
+private:
+ SerializedImageData(const ImageData* imageData)
+ : m_width(imageData->width())
+ , m_height(imageData->height())
+ {
+ WTF::ByteArray* array = imageData->data()->data();
+ m_storage = WTF::ByteArray::create(array->length());
+ memcpy(m_storage->data(), array->data(), array->length());
+ }
+ unsigned m_width;
+ unsigned m_height;
+ RefPtr<WTF::ByteArray> m_storage;
+};
+
SerializedScriptValueData::SerializedScriptValueData(RefPtr<SerializedObject> data)
: m_type(ObjectType)
, m_sharedData(data)
@@ -183,6 +210,12 @@ SerializedScriptValueData::SerializedScriptValueData(const FileList* fileList)
{
}
+SerializedScriptValueData::SerializedScriptValueData(const ImageData* imageData)
+ : m_type(ImageDataType)
+ , m_sharedData(SerializedImageData::create(imageData))
+{
+}
+
SerializedScriptValueData::SerializedScriptValueData(const File* file)
: m_type(FileType)
, m_string(file->path().crossThreadString())
@@ -204,6 +237,11 @@ SerializedFileList* SharedSerializedData::asFileList()
return static_cast<SerializedFileList*>(this);
}
+SerializedImageData* SharedSerializedData::asImageData()
+{
+ return static_cast<SerializedImageData*>(this);
+}
+
static const unsigned maximumFilterRecursion = 40000;
enum WalkerState { StateUnknown, ArrayStartState, ArrayStartVisitMember, ArrayEndVisitMember,
ObjectStartState, ObjectStartVisitMember, ObjectEndVisitMember };
@@ -533,6 +571,8 @@ struct SerializingTreeWalker : public BaseWalker {
return SerializedScriptValueData(toFile(obj));
if (obj->inherits(&JSFileList::s_info))
return SerializedScriptValueData(toFileList(obj));
+ if (obj->inherits(&JSImageData::s_info))
+ return SerializedScriptValueData(toImageData(obj));
CallData unusedData;
if (value.getCallData(unusedData) == CallTypeNone)
@@ -709,6 +749,14 @@ struct DeserializingTreeWalker : public BaseWalker {
result->append(File::create(serializedFileList->item(i)));
return toJS(m_exec, static_cast<JSDOMGlobalObject*>(m_globalObject), result.get());
}
+ case SerializedScriptValueData::ImageDataType: {
+ if (!m_isDOMGlobalObject)
+ return jsNull();
+ SerializedImageData* serializedImageData = value.asImageData();
+ RefPtr<ImageData> result = ImageData::create(serializedImageData->width(), serializedImageData->height());
+ memcpy(result->data()->data()->data(), serializedImageData->data()->data(), serializedImageData->data()->length());
+ return toJS(m_exec, static_cast<JSDOMGlobalObject*>(m_globalObject), result.get());
+ }
case SerializedScriptValueData::EmptyType:
ASSERT_NOT_REACHED();
return jsNull();
@@ -868,6 +916,7 @@ struct TeardownTreeWalker {
case SerializedScriptValueData::EmptyType:
case SerializedScriptValueData::FileType:
case SerializedScriptValueData::FileListType:
+ case SerializedScriptValueData::ImageDataType:
return true;
}
ASSERT_NOT_REACHED();
diff --git a/WebCore/bindings/js/SerializedScriptValue.h b/WebCore/bindings/js/SerializedScriptValue.h
index 347d8f2..93bd0de 100644
--- a/WebCore/bindings/js/SerializedScriptValue.h
+++ b/WebCore/bindings/js/SerializedScriptValue.h
@@ -35,8 +35,10 @@ typedef const struct OpaqueJSValue* JSValueRef;
namespace WebCore {
class File;
class FileList;
+ class ImageData;
class SerializedArray;
class SerializedFileList;
+ class SerializedImageData;
class SerializedObject;
class SharedSerializedData : public RefCounted<SharedSerializedData> {
@@ -45,6 +47,7 @@ namespace WebCore {
SerializedArray* asArray();
SerializedObject* asObject();
SerializedFileList* asFileList();
+ SerializedImageData* asImageData();
};
class SerializedScriptValue;
@@ -60,7 +63,8 @@ namespace WebCore {
ArrayType,
StringType,
FileType,
- FileListType
+ FileListType,
+ ImageDataType
};
SerializedType type() const { return m_type; }
@@ -86,6 +90,7 @@ namespace WebCore {
explicit SerializedScriptValueData(const File*);
explicit SerializedScriptValueData(const FileList*);
+ explicit SerializedScriptValueData(const ImageData*);
explicit SerializedScriptValueData(JSC::JSValue value)
: m_type(ImmediateType)
@@ -141,6 +146,13 @@ namespace WebCore {
ASSERT(m_sharedData);
return m_sharedData->asFileList();
}
+
+ SerializedImageData* asImageData() const
+ {
+ ASSERT(m_type == ImageDataType);
+ ASSERT(m_sharedData);
+ return m_sharedData->asImageData();
+ }
operator bool() const { return m_type != EmptyType; }
diff --git a/WebCore/bindings/scripts/CodeGenerator.pm b/WebCore/bindings/scripts/CodeGenerator.pm
index dc3c7c0..506e8ea 100644
--- a/WebCore/bindings/scripts/CodeGenerator.pm
+++ b/WebCore/bindings/scripts/CodeGenerator.pm
@@ -1,26 +1,26 @@
#
# WebKit IDL parser
-#
+#
# Copyright (C) 2005 Nikolas Zimmermann <wildfox@kde.org>
# Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
# Copyright (C) 2007 Apple Inc. All rights reserved.
# Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
-#
+#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library 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
# Library General Public License for more details.
-#
+#
# You should have received a copy of the GNU Library General Public License
# aint with this library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
-#
+#
package CodeGenerator;
@@ -39,10 +39,10 @@ my $codeGenerator = 0;
my $verbose = 0;
-my %primitiveTypeHash = ("int" => 1, "short" => 1, "long" => 1, "long long" => 1,
+my %primitiveTypeHash = ("int" => 1, "short" => 1, "long" => 1, "long long" => 1,
"unsigned int" => 1, "unsigned short" => 1,
- "unsigned long" => 1, "unsigned long long" => 1,
- "float" => 1, "double" => 1,
+ "unsigned long" => 1, "unsigned long long" => 1,
+ "float" => 1, "double" => 1,
"boolean" => 1, "void" => 1,
"Date" => 1);
@@ -328,10 +328,10 @@ sub IsSVGAnimatedType
my $type = shift;
return 1 if $svgAnimatedTypeHash{$type};
- return 0;
+ return 0;
}
-# Uppercase the first letter while respecting WebKit style guidelines.
+# Uppercase the first letter while respecting WebKit style guidelines.
# E.g., xmlEncoding becomes XMLEncoding, but xmlllang becomes Xmllang.
sub WK_ucfirst
{
@@ -341,12 +341,13 @@ sub WK_ucfirst
return $ret;
}
-# Lowercase the first letter while respecting WebKit style guidelines.
+# Lowercase the first letter while respecting WebKit style guidelines.
# URL becomes url, but SetURL becomes setURL.
sub WK_lcfirst
{
my ($object, $param) = @_;
my $ret = lcfirst($param);
+ $ret =~ s/hTML/html/ if $ret =~ /^hTML/;
$ret =~ s/uRL/url/ if $ret =~ /^uRL/;
$ret =~ s/jS/js/ if $ret =~ /^jS/;
$ret =~ s/xML/xml/ if $ret =~ /^xML/;
diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm
index c774a57..94fc2b8 100644
--- a/WebCore/bindings/scripts/CodeGeneratorJS.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm
@@ -1198,7 +1198,7 @@ sub GenerateImplementation
if ($eventTarget) {
$implIncludes{"RegisteredEventListener.h"} = 1;
- push(@implContent, " impl()->invalidateEventListeners();\n");
+ push(@implContent, " impl()->invalidateJSEventListeners(this);\n");
}
if (!$dataNode->extendedAttributes->{"ExtendsDOMGlobalObject"}) {
@@ -1218,7 +1218,7 @@ sub GenerateImplementation
push(@implContent, "void ${className}::markChildren(MarkStack& markStack)\n");
push(@implContent, "{\n");
push(@implContent, " Base::markChildren(markStack);\n");
- push(@implContent, " impl()->markEventListeners(markStack);\n");
+ push(@implContent, " impl()->markJSEventListeners(markStack);\n");
push(@implContent, "}\n\n");
}
@@ -1318,12 +1318,14 @@ sub GenerateImplementation
push(@implContent, " UNUSED_PARAM(exec);\n");
push(@implContent, " $implClassName* imp = static_cast<$implClassName*>(castedThis->impl());\n");
push(@implContent, " if (EventListener* listener = imp->$implGetterFunctionName()) {\n");
+ push(@implContent, " if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {\n");
if ($implClassName eq "Document" || $implClassName eq "WorkerContext" || $implClassName eq "SharedWorkerContext" || $implClassName eq "DedicatedWorkerContext") {
- push(@implContent, " if (JSObject* jsFunction = listener->jsFunction(imp))\n");
+ push(@implContent, " if (JSObject* jsFunction = jsListener->jsFunction(imp))\n");
} else {
- push(@implContent, " if (JSObject* jsFunction = listener->jsFunction(imp->scriptExecutionContext()))\n");
+ push(@implContent, " if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))\n");
}
- push(@implContent, " return jsFunction;\n");
+ push(@implContent, " return jsFunction;\n");
+ push(@implContent, " }\n");
push(@implContent, " }\n");
push(@implContent, " return jsNull();\n");
} elsif ($attribute->signature->type =~ /Constructor$/) {
@@ -1477,7 +1479,7 @@ sub GenerateImplementation
$implIncludes{"JSEventListener.h"} = 1;
push(@implContent, " UNUSED_PARAM(exec);\n");
push(@implContent, " $implClassName* imp = static_cast<$implClassName*>(static_cast<$className*>(thisObject)->impl());\n");
- push(@implContent, " imp->set$implSetterFunctionName(createJSAttributeEventListener(exec, value));\n");
+ push(@implContent, " imp->set$implSetterFunctionName(createJSAttributeEventListener(exec, value, thisObject));\n");
} elsif ($attribute->signature->type =~ /Constructor$/) {
my $constructorType = $attribute->signature->type;
$constructorType =~ s/Constructor$//;
@@ -1834,7 +1836,7 @@ my %nativeType = (
"NodeFilter" => "RefPtr<NodeFilter>",
"SVGAngle" => "SVGAngle",
"SVGLength" => "SVGLength",
- "SVGMatrix" => "TransformationMatrix",
+ "SVGMatrix" => "AffineTransform",
"SVGNumber" => "float",
"SVGPaintType" => "SVGPaint::SVGPaintType",
"SVGPreserveAspectRatio" => "SVGPreserveAspectRatio",
diff --git a/WebCore/bindings/scripts/CodeGeneratorObjC.pm b/WebCore/bindings/scripts/CodeGeneratorObjC.pm
index 698b4f5..dcb22a7 100644
--- a/WebCore/bindings/scripts/CodeGeneratorObjC.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorObjC.pm
@@ -578,7 +578,7 @@ sub AddIncludesForType
}
if ($type eq "SVGMatrix") {
- $implIncludes{"TransformationMatrix.h"} = 1;
+ $implIncludes{"AffineTransform.h"} = 1;
$implIncludes{"DOMSVGMatrixInternal.h"} = 1;
$implIncludes{"SVGException.h"} = 1;
return;
@@ -1426,8 +1426,8 @@ sub GenerateImplementation
}
# FIXME! We need [Custom] support for ObjC, to move these hacks into DOMSVGLength/MatrixCustom.mm
- my $svgMatrixRotateFromVector = ($podType and $podType eq "TransformationMatrix" and $functionName eq "rotateFromVector");
- my $svgMatrixInverse = ($podType and $podType eq "TransformationMatrix" and $functionName eq "inverse");
+ my $svgMatrixRotateFromVector = ($podType and $podType eq "AffineTransform" and $functionName eq "rotateFromVector");
+ my $svgMatrixInverse = ($podType and $podType eq "AffineTransform" and $functionName eq "inverse");
my $svgLengthConvertToSpecifiedUnits = ($podType and $podType eq "SVGLength" and $functionName eq "convertToSpecifiedUnits");
push(@parameterNames, "ec") if $raisesExceptions and !($svgMatrixRotateFromVector || $svgMatrixInverse);
diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm
index cd70c55..2b89b54 100644
--- a/WebCore/bindings/scripts/CodeGeneratorV8.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm
@@ -272,6 +272,7 @@ sub GenerateHeader
public:
static bool HasInstance(v8::Handle<v8::Value> value);
static v8::Persistent<v8::FunctionTemplate> GetRawTemplate();
+ static v8::Persistent<v8::FunctionTemplate> GetTemplate();
static ${nativeType}* toNative(v8::Handle<v8::Object>);
static v8::Handle<v8::Object> wrap(${nativeType}*${forceNewObjectParameter});
END
@@ -302,7 +303,7 @@ END
static v8::Handle<v8::Value> constructorCallback(const v8::Arguments& args);
END
}
-
+
foreach my $attribute (@{$dataNode->attributes}) {
my $name = $attribute->signature->name;
my $attrExt = $attribute->signature->extendedAttributes;
@@ -323,11 +324,10 @@ END
}
}
- GenerateHeaderRuntimeEnablerDeclarations(@enabledAtRuntime);
GenerateHeaderNamedAndIndexedPropertyAccessors($dataNode);
GenerateHeaderCustomCall($dataNode);
GenerateHeaderCustomInternalFieldIndices($dataNode);
-
+
if ($dataNode->extendedAttributes->{"CheckDomainSecurity"}) {
push(@headerContent, <<END);
static bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType, v8::Local<v8::Value> data);
@@ -336,11 +336,6 @@ END
}
push(@headerContent, <<END);
-
- private:
- static v8::Persistent<v8::FunctionTemplate> GetTemplate();
-
- friend class V8ClassIndex;
};
v8::Handle<v8::Value> toV8(${nativeType}*${forceNewObjectParameter});
@@ -361,7 +356,7 @@ sub GetInternalFields
{
my $dataNode = shift;
my $name = $dataNode->name;
-
+
# FIXME: I am hideous and hard-coded. Make me beautiful.
return ("cacheIndex", "implementationIndex") if ($name eq "Document") || ($name eq "SVGDocument");
return ("cacheIndex", "implementationIndex", "markerIndex", "shadowIndex") if $name eq "HTMLDocument";
@@ -417,25 +412,6 @@ END
END
}
-sub GenerateHeaderRuntimeEnablerDeclarations
-{
- my @enabledAtRuntime = @_;
-
- foreach my $runtime_attr (@enabledAtRuntime) {
- my $enabledAtRuntimeConditionalString = GenerateConditionalString($runtime_attr->signature);
- my $enabler = $codeGenerator->WK_ucfirst($runtime_attr->signature->name);
- if ($enabledAtRuntimeConditionalString) {
- push(@headerContent, "\n#if ${enabledAtRuntimeConditionalString}\n");
- }
- push(@headerContent, <<END);
- static bool ${enabler}Enabled();
-END
- if ($enabledAtRuntimeConditionalString) {
- push(@headerContent, "#endif\n");
- }
- }
-}
-
my %indexerSpecialCases = (
"Storage" => 1,
"HTMLAppletElement" => 1,
@@ -473,7 +449,7 @@ sub GenerateHeaderNamedAndIndexedPropertyAccessors
static v8::Handle<v8::Value> indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info);
END
}
-
+
if ($isIndexerSpecialCase || $hasCustomIndexedSetter) {
push(@headerContent, <<END);
static v8::Handle<v8::Value> indexedPropertySetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
@@ -509,7 +485,7 @@ END
sub GenerateHeaderCustomCall
{
my $dataNode = shift;
-
+
if ($dataNode->extendedAttributes->{"CustomCall"}) {
push(@headerContent, " static v8::Handle<v8::Value> callAsFunctionCallback(const v8::Arguments&);\n");
}
@@ -537,22 +513,34 @@ sub GenerateSetDOMException
return $result;
}
-sub IsNodeSubType
+sub IsSubType
{
my $dataNode = shift;
- return 1 if ($dataNode->name eq "Node");
+ my $parentType = shift;
+ return 1 if ($dataNode->name eq $parentType);
foreach (@allParents) {
my $parent = $codeGenerator->StripModule($_);
- return 1 if $parent eq "Node";
+ return 1 if $parent eq $parentType;
}
return 0;
}
+sub IsNodeSubType
+{
+ my $dataNode = shift;
+ return IsSubType($dataNode, "Node");
+}
+
+sub IsEventSubType
+{
+ my $dataNode = shift;
+ return IsSubType($dataNode, "Event");
+}
+
sub GenerateDomainSafeFunctionGetter
{
my $function = shift;
my $dataNode = shift;
- my $classIndex = shift;
my $implClassName = shift;
my $className = "V8" . $dataNode->name;
@@ -570,7 +558,7 @@ sub GenerateDomainSafeFunctionGetter
INC_STATS(\"DOM.$implClassName.$funcName._get\");
static v8::Persistent<v8::FunctionTemplate> private_template =
v8::Persistent<v8::FunctionTemplate>::New($newTemplateString);
- v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::$classIndex, info.This());
+ v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(${className}::GetTemplate(), info.This());
if (holder.IsEmpty()) {
// can only reach here by 'object.__proto__.func', and it should passed
// domain security check already
@@ -611,7 +599,6 @@ END
return V8DOMWrapper::getConstructor(type, V8DOMWindow::toNative(info.Holder()));
END
} elsif ($classIndex eq "DEDICATEDWORKERCONTEXT" or $classIndex eq "WORKERCONTEXT" or $classIndex eq "SHAREDWORKERCONTEXT") {
- $implIncludes{"WorkerContextExecutionProxy.h"} = 1;
push(@implContentDecls, <<END);
return V8DOMWrapper::getConstructor(type, V8WorkerContext::toNative(info.Holder()));
END
@@ -630,7 +617,6 @@ sub GenerateNormalAttrGetter
{
my $attribute = shift;
my $dataNode = shift;
- my $classIndex = shift;
my $implClassName = shift;
my $interfaceName = shift;
@@ -688,14 +674,14 @@ END
}
} elsif ($attrExt->{"v8OnProto"} || $attrExt->{"V8DisallowShadowing"}) {
- if ($classIndex eq "DOMWINDOW") {
+ if ($interfaceName eq "DOMWindow") {
push(@implContentDecls, <<END);
v8::Handle<v8::Object> holder = info.Holder();
END
} else {
# perform lookup first
push(@implContentDecls, <<END);
- v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::$classIndex, info.This());
+ v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8${interfaceName}::GetTemplate(), info.This());
if (holder.IsEmpty()) return v8::Handle<v8::Value>();
END
}
@@ -863,7 +849,6 @@ sub GenerateNormalAttrSetter
{
my $attribute = shift;
my $dataNode = shift;
- my $classIndex = shift;
my $implClassName = shift;
my $interfaceName = shift;
@@ -885,14 +870,14 @@ sub GenerateNormalAttrSetter
push(@implContentDecls, " $implClassName* imp = &imp_instance;\n");
} elsif ($attrExt->{"v8OnProto"}) {
- if ($classIndex eq "DOMWINDOW") {
+ if ($interfaceName eq "DOMWindow") {
push(@implContentDecls, <<END);
v8::Handle<v8::Object> holder = info.Holder();
END
} else {
# perform lookup first
push(@implContentDecls, <<END);
- v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::$classIndex, info.This());
+ v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8${interfaceName}::GetTemplate(), info.This());
if (holder.IsEmpty()) return;
END
}
@@ -999,7 +984,7 @@ sub GetFunctionTemplateCallbackName
{
$function = shift;
$dataNode = shift;
-
+
my $interfaceName = $dataNode->name;
my $name = $function->signature->name;
@@ -1067,7 +1052,7 @@ END
" return v8::Handle<v8::Value>();\n" .
" }\n");
}
-
+
my $raisesExceptions = @{$function->raisesExceptions};
if (!$raisesExceptions) {
foreach my $parameter (@{$function->parameters}) {
@@ -1152,7 +1137,7 @@ END
push(@implContentDecls, " V8Proxy::setDOMException(ec);\n");
push(@implContentDecls, " return v8::Handle<v8::Value>();\n");
}
-
+
push(@implContentDecls, " }\n\n");
}
@@ -1477,6 +1462,7 @@ sub GenerateImplementation
push(@implFixedHeader,
"#include \"config.h\"\n" .
+ "#include \"RuntimeEnabledFeatures.h\"\n" .
"#include \"V8Proxy.h\"\n" .
"#include \"V8Binding.h\"\n" .
"#include \"V8BindingState.h\"\n" .
@@ -1529,7 +1515,7 @@ sub GenerateImplementation
# Generate the accessor.
if (!($attribute->signature->extendedAttributes->{"CustomGetter"} ||
$attribute->signature->extendedAttributes->{"V8CustomGetter"})) {
- GenerateNormalAttrGetter($attribute, $dataNode, $classIndex, $implClassName, $interfaceName);
+ GenerateNormalAttrGetter($attribute, $dataNode, $implClassName, $interfaceName);
}
if (!($attribute->signature->extendedAttributes->{"CustomSetter"} ||
$attribute->signature->extendedAttributes->{"V8CustomSetter"})) {
@@ -1537,7 +1523,7 @@ sub GenerateImplementation
$dataNode->extendedAttributes->{"ExtendsDOMGlobalObject"} || die "Replaceable attribute can only be used in interface that defines ExtendsDOMGlobalObject attribute!";
# GenerateReplaceableAttrSetter($implClassName);
} elsif ($attribute->type !~ /^readonly/ && !$attribute->signature->extendedAttributes->{"V8ReadOnly"}) {
- GenerateNormalAttrSetter($attribute, $dataNode, $classIndex, $implClassName, $interfaceName);
+ GenerateNormalAttrSetter($attribute, $dataNode, $implClassName, $interfaceName);
}
}
}
@@ -1545,7 +1531,7 @@ sub GenerateImplementation
if ($hasConstructors) {
GenerateConstructorGetter($implClassName, $classIndex);
}
-
+
my $indexer;
my $namedPropertyGetter;
# Generate methods for functions.
@@ -1568,7 +1554,7 @@ sub GenerateImplementation
# generate an access getter that returns different function objects
# for different calling context.
if (($dataNode->extendedAttributes->{"CheckDomainSecurity"} || ($interfaceName eq "DOMWindow")) && $function->signature->extendedAttributes->{"DoNotCheckDomainSecurity"}) {
- GenerateDomainSafeFunctionGetter($function, $dataNode, $classIndex, $implClassName);
+ GenerateDomainSafeFunctionGetter($function, $dataNode, $implClassName);
}
}
@@ -1606,7 +1592,7 @@ sub GenerateImplementation
GenerateBatchedAttributeData($dataNode, $attributes);
push(@implContent, "};\n");
}
-
+
# Setup table of standard callback functions
$num_callbacks = 0;
$has_callbacks = 0;
@@ -1696,20 +1682,23 @@ END
}
# find the super descriptor
- my $parentClassIndex = "INVALID_CLASS_INDEX";
+ my $parentClassTemplate = "";
foreach (@{$dataNode->parents}) {
my $parent = $codeGenerator->StripModule($_);
if ($parent eq "EventTarget") { next; }
$implIncludes{"V8${parent}.h"} = 1;
- $parentClassIndex = uc($codeGenerator->StripModule($parent));
+ $parentClassTemplate = "V8" . $parent . "::GetTemplate()";
last;
}
-
+ if (!$parentClassTemplate) {
+ $parentClassTemplate = "v8::Persistent<v8::FunctionTemplate>()";
+ }
+
# Generate the template configuration method
push(@implContent, <<END);
static v8::Persistent<v8::FunctionTemplate> Configure${className}Template(v8::Persistent<v8::FunctionTemplate> desc) {
v8::Local<v8::Signature> default_signature = configureTemplate(desc, \"${interfaceName}\",
- V8ClassIndex::$parentClassIndex, V8${interfaceName}::internalFieldCount,
+ $parentClassTemplate, V8${interfaceName}::internalFieldCount,
END
# Set up our attributes if we have them
if ($has_attributes) {
@@ -1721,7 +1710,7 @@ END
NULL, 0,
END
}
-
+
if ($has_callbacks) {
push(@implContent, <<END);
${interfaceName}_callbacks, sizeof(${interfaceName}_callbacks)/sizeof(*${interfaceName}_callbacks));
@@ -1739,20 +1728,21 @@ END
}
if ($access_check or @enabledAtRuntime or @{$dataNode->functions} or $has_constants) {
- push(@implContent, <<END);
+ push(@implContent, <<END);
v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
END
}
push(@implContent, " $access_check\n");
-
+
# Setup the enable-at-runtime attrs if we have them
foreach my $runtime_attr (@enabledAtRuntime) {
- $enable_function = $interfaceName . "::" . $codeGenerator->WK_ucfirst($runtime_attr->signature->name);
+ # A function named RuntimeEnabledFeatures::{methodName}Enabled() need to be written by hand.
+ $enable_function = "RuntimeEnabledFeatures::" . $codeGenerator->WK_lcfirst($runtime_attr->signature->name) . "Enabled";
my $conditionalString = GenerateConditionalString($runtime_attr->signature);
push(@implContent, "\n#if ${conditionalString}\n") if $conditionalString;
- push(@implContent, " if (V8${enable_function}Enabled()) {\n");
+ push(@implContent, " if (${enable_function}()) {\n");
push(@implContent, " static const BatchedAttribute attrData =\\\n");
GenerateSingleBatchedAttribute($interfaceName, $runtime_attr, ";", " ");
push(@implContent, <<END);
@@ -1792,8 +1782,8 @@ END
my $conditional = "";
if ($attrExt->{"EnabledAtRuntime"}) {
# Only call Set()/SetAccessor() if this method should be enabled
- $enable_function = $interfaceName . "::" . $codeGenerator->WK_ucfirst($function->signature->name);
- $conditional = "if (V8${enable_function}Enabled())\n";
+ $enable_function = "RuntimeEnabledFeatures::" . $codeGenerator->WK_lcfirst($function->signature->name) . "Enabled";
+ $conditional = "if (${enable_function}())\n";
}
if ($attrExt->{"DoNotCheckDomainSecurity"} &&
@@ -1840,24 +1830,24 @@ END
# Normal function call is a template
my $callback = GetFunctionTemplateCallbackName($function, $dataNode);
-
+
if ($property_attributes eq "v8::DontDelete") {
$property_attributes = "";
} else {
$property_attributes = ", static_cast<v8::PropertyAttribute>($property_attributes)";
}
-
+
if ($template eq "proto" && $conditional eq "" && $signature eq "default_signature" && $property_attributes eq "") {
# Standard type of callback, already created in the batch, so skip it here.
next;
}
-
+
push(@implContent, <<END);
${conditional}$template->Set(v8::String::New("$name"), v8::FunctionTemplate::New($callback, v8::Handle<v8::Value>(), ${signature})$property_attributes);
END
$num_callbacks++;
}
-
+
die "Wrong number of callbacks generated for $interfaceName ($num_callbacks, should be $total_functions)" if $num_callbacks != $total_functions;
if ($has_constants) {
@@ -1865,11 +1855,11 @@ END
batchConfigureConstants(desc, proto, ${interfaceName}_consts, sizeof(${interfaceName}_consts)/sizeof(*${interfaceName}_consts));
END
}
-
+
# Special cases
if ($interfaceName eq "DOMWindow") {
push(@implContent, <<END);
-
+
proto->SetInternalFieldCount(V8DOMWindow::internalFieldCount);
desc->SetHiddenPrototype(true);
instance->SetInternalFieldCount(V8DOMWindow::internalFieldCount);
@@ -1881,8 +1871,8 @@ END
}
if ($interfaceName eq "Location") {
push(@implContent, <<END);
-
- // For security reasons, these functions are on the instance instead
+
+ // For security reasons, these functions are on the instance instead
// of on the prototype object to insure that they cannot be overwritten.
instance->SetAccessor(v8::String::New("reload"), V8Location::reloadAccessorGetter, 0, v8::Handle<v8::Value>(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly));
instance->SetAccessor(v8::String::New("replace"), V8Location::replaceAccessorGetter, 0, v8::Handle<v8::Value>(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly));
@@ -1895,7 +1885,7 @@ END
$nativeType = "V8SVGPODTypeWrapper<${nativeType}>";
}
push(@implContent, <<END);
-
+
// Custom toString template
desc->Set(getToStringName(), getToStringTemplate());
return desc;
@@ -1912,7 +1902,7 @@ v8::Persistent<v8::FunctionTemplate> ${className}::GetTemplate() {
}
${nativeType}* ${className}::toNative(v8::Handle<v8::Object> object) {
- return reinterpret_cast<${nativeType}*>(object->GetPointerFromInternalField(v8DOMWrapperObjectIndex));
+ return reinterpret_cast<${nativeType}*>(object->GetPointerFromInternalField(v8DOMWrapperObjectIndex));
}
bool ${className}::HasInstance(v8::Handle<v8::Value> value) {
@@ -1933,7 +1923,7 @@ v8::Persistent<v8::ObjectTemplate> V8DOMWindow::GetShadowObjectTemplate() {
}
END
}
-
+
GenerateToV8Converters($dataNode, $interfaceName, $className, $nativeType);
push(@implContent, <<END);
@@ -1943,24 +1933,24 @@ END
push(@implContent, "\n#endif // ${conditionalString}\n") if $conditionalString;
}
-sub GenerateToV8Converters
+sub GenerateToV8Converters
{
my $dataNode = shift;
my $interfaceName = shift;
my $className = shift;
my $nativeType = shift;
-
+
my $wrapperType = "V8ClassIndex::" . uc($interfaceName);
my $domMapFunction = GetDomMapFunction($dataNode, $interfaceName);
my $forceNewObjectInput = IsDOMNodeType($interfaceName) ? ", bool forceNewObject" : "";
my $forceNewObjectCall = IsDOMNodeType($interfaceName) ? ", forceNewObject" : "";
-
- push(@implContent, <<END);
+
+ push(@implContent, <<END);
v8::Handle<v8::Object> ${className}::wrap(${nativeType}* impl${forceNewObjectInput}) {
v8::Handle<v8::Object> wrapper;
END
- if (!NeedsWorkerContextExecutionProxyToV8($interfaceName)) {
+ if (!MayBeInWorkerContext($dataNode, $interfaceName)) {
push(@implContent, <<END);
V8Proxy* proxy = 0;
END
@@ -2003,10 +1993,9 @@ END
END
}
- if (NeedsWorkerContextExecutionProxyToV8($interfaceName)) {
- $implIncludes{"WorkerContextExecutionProxy.h"} = 1;
+ if (MayBeInWorkerContext($dataNode, $interfaceName)) {
push(@implContent, <<END);
- wrapper = WorkerContextExecutionProxy::toV8(${wrapperType}, impl);
+ wrapper = V8DOMWrapper::instantiateV8ObjectInWorkerContext(${wrapperType}, impl);
END
} else {
push(@implContent, <<END);
@@ -2021,7 +2010,7 @@ END
context->Exit();
END
}
-
+
push(@implContent, <<END);
if (wrapper.IsEmpty())
return wrapper;
@@ -2047,7 +2036,7 @@ v8::Handle<v8::Value> toV8(PassRefPtr<${nativeType} > impl${forceNewObjectInput}
}
END
}
-
+
if (!HasCustomToV8Implementation($dataNode, $interfaceName)) {
push(@implContent, <<END);
@@ -2060,16 +2049,32 @@ END
}
}
-sub NeedsWorkerContextExecutionProxyToV8 {
+sub MayBeInWorkerContext {
# These objects can be constructed under WorkerContextExecutionProxy. They need special
# handling, since if we call V8Proxy::retrieve(), we will crash.
# FIXME: websocket?
- $interfaceName = shift;
+ my $dataNode = shift;
+ my $interfaceName = shift;
+ # FIXME: Doing the extra work to handle the WorkerContext case for all Event
+ # types is sad. We can probably be cleverer and only do the extra work for certain types.
+ return 1 if IsEventSubType($dataNode);
return 1 if $interfaceName eq "DOMCoreException";
return 1 if $interfaceName eq "EventException";
return 1 if $interfaceName eq "RangeException";
return 1 if $interfaceName eq "XMLHttpRequestException";
return 1 if $interfaceName eq "MessagePort";
+ return 1 if $interfaceName eq "DedicatedWorkerContext";
+ return 1 if $interfaceName eq "WorkerContext";
+ return 1 if $interfaceName eq "SharedWorkerContext";
+ return 1 if $interfaceName eq "WorkerLocation";
+ return 1 if $interfaceName eq "WorkerNavigator";
+ return 1 if $interfaceName eq "Notification";
+ return 1 if $interfaceName eq "NotificationCenter";
+ return 1 if $interfaceName eq "XMLHttpRequest";
+ return 1 if $interfaceName eq "WebSocket";
+ return 1 if $interfaceName eq "Worker";
+ return 1 if $interfaceName eq "SharedWorker";
+ return 1 if $interfaceName eq "EventSource";
return 0;
}
@@ -2077,7 +2082,7 @@ sub HasCustomToV8Implementation {
# FIXME: This subroutine is lame. Probably should be an .idl attribute (CustomToV8)?
$dataNode = shift;
$interfaceName = shift;
-
+
# We generate a custom converter (but JSC doesn't) for the following:
return 1 if $interfaceName eq "BarInfo";
return 1 if $interfaceName eq "CSSStyleSheet";
@@ -2094,7 +2099,7 @@ sub HasCustomToV8Implementation {
return 1 if $interfaceName eq "SVGDocument";
return 1 if $interfaceName eq "SVGElement";
return 1 if $interfaceName eq "Screen";
-
+ return 1 if $interfaceName eq "WorkerContext";
# We don't generate a custom converter (but JSC does) for the following:
return 0 if $interfaceName eq "AbstractWorker";
return 0 if $interfaceName eq "CanvasRenderingContext";
@@ -2135,7 +2140,7 @@ sub GetNativeTypeForConversions
my $type = shift;
return "FloatRect" if $type eq "SVGRect";
return "FloatPoint" if $type eq "SVGPoint";
- return "TransformationMatrix" if $type eq "SVGMatrix";
+ return "AffineTransform" if $type eq "SVGMatrix";
return "float" if $type eq "SVGNumber";
return $type;
}
@@ -2323,7 +2328,7 @@ sub GetNativeTypeFromSignature
}
$type = GetNativeType($type, $parameterIndex >= 0 ? 1 : 0);
-
+
if ($parameterIndex >= 0 && $type eq "V8Parameter") {
my $mode = "";
if ($signature->extendedAttributes->{"ConvertUndefinedOrNullToNullString"}) {
@@ -2333,7 +2338,7 @@ sub GetNativeTypeFromSignature
}
$type .= "<$mode>";
}
-
+
return $type;
}
@@ -2357,17 +2362,6 @@ sub IsRefPtrType
return 1;
}
-sub IsWorkerClassName
-{
- my $class = shift;
- return 1 if $class eq "V8Worker";
- return 1 if $class eq "V8WorkerContext";
- return 1 if $class eq "V8WorkerLocation";
- return 1 if $class eq "V8WorkerNavigator";
-
- return 0;
-}
-
sub GetNativeType
{
my $type = shift;
@@ -2389,7 +2383,7 @@ sub GetNativeType
return "Range::CompareHow" if $type eq "CompareHow";
return "FloatRect" if $type eq "SVGRect";
return "FloatPoint" if $type eq "SVGPoint";
- return "TransformationMatrix" if $type eq "SVGMatrix";
+ return "AffineTransform" if $type eq "SVGMatrix";
return "SVGTransform" if $type eq "SVGTransform";
return "SVGLength" if $type eq "SVGLength";
return "SVGAngle" if $type eq "SVGAngle";
@@ -2785,18 +2779,6 @@ sub ReturnNativeToJSValue
return "return $value->deserialize()";
}
- if ($type eq "DedicatedWorkerContext" or $type eq "WorkerContext" or $type eq "SharedWorkerContext") {
- $implIncludes{"WorkerContextExecutionProxy.h"} = 1;
- return "return WorkerContextExecutionProxy::convertWorkerContextToV8Object($value)";
- }
-
- if ($type eq "WorkerLocation" or $type eq "WorkerNavigator" or $type eq "NotificationCenter") {
- $implIncludes{"WorkerContextExecutionProxy.h"} = 1;
- my $classIndex = uc($type);
-
- return "return WorkerContextExecutionProxy::convertToV8Object(V8ClassIndex::$classIndex, $value)";
- }
-
$implIncludes{"wtf/RefCounted.h"} = 1;
$implIncludes{"wtf/RefPtr.h"} = 1;
$implIncludes{"wtf/GetPtr.h"} = 1;
diff --git a/WebCore/bindings/v8/NPV8Object.cpp b/WebCore/bindings/v8/NPV8Object.cpp
index 258f579..1fe10b2 100644
--- a/WebCore/bindings/v8/NPV8Object.cpp
+++ b/WebCore/bindings/v8/NPV8Object.cpp
@@ -34,7 +34,6 @@
#include "OwnArrayPtr.h"
#include "PlatformString.h"
#include "ScriptController.h"
-#include "V8CustomBinding.h"
#include "V8GCController.h"
#include "V8Helpers.h"
#include "V8Index.h"
@@ -51,7 +50,6 @@ using WebCore::npObjectInternalFieldCount;
using WebCore::toV8Context;
using WebCore::toV8Proxy;
using WebCore::V8ClassIndex;
-using WebCore::V8Custom;
using WebCore::V8DOMWrapper;
using WebCore::V8GCController;
using WebCore::V8Proxy;
diff --git a/WebCore/bindings/v8/ScheduledAction.cpp b/WebCore/bindings/v8/ScheduledAction.cpp
index 4f321cb..f511e2b 100644
--- a/WebCore/bindings/v8/ScheduledAction.cpp
+++ b/WebCore/bindings/v8/ScheduledAction.cpp
@@ -95,11 +95,11 @@ void ScheduledAction::execute(ScriptExecutionContext* context)
if (proxy)
execute(proxy);
#if ENABLE(WORKERS)
- else {
- ASSERT(context->isWorkerContext());
+ else if (context->isWorkerContext())
execute(static_cast<WorkerContext*>(context));
- }
#endif
+ // It's possible that Javascript is disabled and that we have neither a V8Proxy
+ // nor a WorkerContext. Do nothing in that case.
}
void ScheduledAction::execute(V8Proxy* proxy)
diff --git a/WebCore/bindings/v8/ScriptArray.cpp b/WebCore/bindings/v8/ScriptArray.cpp
index 748ee19..01b0898 100644
--- a/WebCore/bindings/v8/ScriptArray.cpp
+++ b/WebCore/bindings/v8/ScriptArray.cpp
@@ -50,6 +50,10 @@ ScriptArray::ScriptArray(ScriptState* scriptState, v8::Handle<v8::Array> v8Array
bool ScriptArray::set(unsigned index, const ScriptObject& value)
{
+ if (value.scriptState() != m_scriptState) {
+ ASSERT_NOT_REACHED();
+ return false;
+ }
ScriptScope scope(m_scriptState);
v8Object()->Set(v8::Integer::New(index), value.v8Value());
return scope.success();
diff --git a/WebCore/bindings/v8/RuntimeEnabledFeatures.cpp b/WebCore/bindings/v8/ScriptDebugServer.cpp
index b712999..3fe8c34 100644
--- a/WebCore/bindings/v8/RuntimeEnabledFeatures.cpp
+++ b/WebCore/bindings/v8/ScriptDebugServer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (c) 2010, Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -29,18 +29,17 @@
*/
#include "config.h"
-#include "RuntimeEnabledFeatures.h"
+
+#include "ScriptDebugServer.h"
namespace WebCore {
-bool RuntimeEnabledFeatures::isLocalStorageEnabled = true;
-bool RuntimeEnabledFeatures::isSessionStorageEnabled = true;
-bool RuntimeEnabledFeatures::isNotificationsEnabled = false;
-#if PLATFORM(ANDROID)
-// These should default to true, to match the behavior with JSC
-bool RuntimeEnabledFeatures::isApplicationCacheEnabled = true;
-bool RuntimeEnabledFeatures::isGeolocationEnabled = true;
-#endif
-bool RuntimeEnabledFeatures::isIndexedDatabaseEnabled = false;
+void ScriptDebugServer::recompileAllJSFunctions()
+{
+}
+
+void ScriptDebugServer::recompileAllJSFunctionsSoon()
+{
+}
} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptDebugServer.h b/WebCore/bindings/v8/ScriptDebugServer.h
new file mode 100644
index 0000000..b37af2f
--- /dev/null
+++ b/WebCore/bindings/v8/ScriptDebugServer.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2010, Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ScriptDebugServer_h
+#define ScriptDebugServer_h
+
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+class ScriptDebugServer : public Noncopyable {
+public:
+ static void recompileAllJSFunctions();
+ static void recompileAllJSFunctionsSoon();
+};
+
+} // namespace WebCore
+
+#endif // ScriptDebugServer_h
diff --git a/WebCore/bindings/v8/ScriptFunctionCall.cpp b/WebCore/bindings/v8/ScriptFunctionCall.cpp
index a232acd..e6b22ee 100644
--- a/WebCore/bindings/v8/ScriptFunctionCall.cpp
+++ b/WebCore/bindings/v8/ScriptFunctionCall.cpp
@@ -45,8 +45,8 @@
namespace WebCore {
-ScriptFunctionCall::ScriptFunctionCall(ScriptState* scriptState, const ScriptObject& thisObject, const String& name)
- : m_scriptState(scriptState)
+ScriptFunctionCall::ScriptFunctionCall(const ScriptObject& thisObject, const String& name)
+ : m_scriptState(thisObject.scriptState())
, m_thisObject(thisObject)
, m_name(name)
{
@@ -54,6 +54,10 @@ ScriptFunctionCall::ScriptFunctionCall(ScriptState* scriptState, const ScriptObj
void ScriptFunctionCall::appendArgument(const ScriptObject& argument)
{
+ if (argument.scriptState() != m_scriptState) {
+ ASSERT_NOT_REACHED();
+ return;
+ }
m_arguments.append(argument);
}
diff --git a/WebCore/bindings/v8/ScriptFunctionCall.h b/WebCore/bindings/v8/ScriptFunctionCall.h
index 6203402..4cbbf7e 100644
--- a/WebCore/bindings/v8/ScriptFunctionCall.h
+++ b/WebCore/bindings/v8/ScriptFunctionCall.h
@@ -43,7 +43,7 @@ namespace WebCore {
class ScriptFunctionCall {
public:
- ScriptFunctionCall(ScriptState* scriptState, const ScriptObject& thisObject, const String& name);
+ ScriptFunctionCall(const ScriptObject& thisObject, const String& name);
virtual ~ScriptFunctionCall() {};
void appendArgument(const ScriptObject&);
diff --git a/WebCore/bindings/v8/ScriptObject.cpp b/WebCore/bindings/v8/ScriptObject.cpp
index 0fcd16f..520c57b 100644
--- a/WebCore/bindings/v8/ScriptObject.cpp
+++ b/WebCore/bindings/v8/ScriptObject.cpp
@@ -67,6 +67,10 @@ bool ScriptObject::set(const String& name, const String& value)
bool ScriptObject::set(const char* name, const ScriptObject& value)
{
+ if (value.scriptState() != m_scriptState) {
+ ASSERT_NOT_REACHED();
+ return false;
+ }
ScriptScope scope(m_scriptState);
v8Object()->Set(v8::String::New(name), value.v8Value());
return scope.success();
diff --git a/WebCore/bindings/v8/ScriptState.h b/WebCore/bindings/v8/ScriptState.h
index e71becb..5c5ce6c 100644
--- a/WebCore/bindings/v8/ScriptState.h
+++ b/WebCore/bindings/v8/ScriptState.h
@@ -38,9 +38,9 @@
namespace WebCore {
class DOMWrapperWorld;
+ class Frame;
class Node;
class Page;
- class Frame;
class ScriptState : public Noncopyable {
public:
diff --git a/WebCore/bindings/v8/ScriptValue.cpp b/WebCore/bindings/v8/ScriptValue.cpp
index af84e99..02d62db 100644..100755
--- a/WebCore/bindings/v8/ScriptValue.cpp
+++ b/WebCore/bindings/v8/ScriptValue.cpp
@@ -31,10 +31,24 @@
#include "config.h"
#include "ScriptValue.h"
+#include "ScriptScope.h"
+#include "SerializedScriptValue.h"
#include "V8Binding.h"
namespace WebCore {
+PassRefPtr<SerializedScriptValue> ScriptValue::serialize(ScriptState* scriptState)
+{
+ ScriptScope scope(scriptState);
+ return SerializedScriptValue::create(v8Value());
+}
+
+ScriptValue ScriptValue::deserialize(ScriptState* scriptState, SerializedScriptValue* value)
+{
+ ScriptScope scope(scriptState);
+ return ScriptValue(value->deserialize());
+}
+
bool ScriptValue::getString(String& result) const
{
if (m_value.IsEmpty())
diff --git a/WebCore/bindings/v8/ScriptValue.h b/WebCore/bindings/v8/ScriptValue.h
index 6a70bd7..1713f80 100644
--- a/WebCore/bindings/v8/ScriptValue.h
+++ b/WebCore/bindings/v8/ScriptValue.h
@@ -35,6 +35,7 @@
#include "ScriptState.h"
#include <v8.h>
+#include <wtf/PassRefPtr.h>
#ifndef NDEBUG
#include "V8Proxy.h" // for register and unregister global handles.
@@ -42,6 +43,8 @@
namespace WebCore {
+class SerializedScriptValue;
+
class ScriptValue {
public:
ScriptValue() {}
@@ -121,6 +124,9 @@ public:
return m_value.IsEmpty();
}
+ PassRefPtr<SerializedScriptValue> serialize(ScriptState*);
+ static ScriptValue deserialize(ScriptState*, SerializedScriptValue*);
+
void clear()
{
if (m_value.IsEmpty())
diff --git a/WebCore/bindings/v8/V8Binding.cpp b/WebCore/bindings/v8/V8Binding.cpp
index 4379230..34020be 100644
--- a/WebCore/bindings/v8/V8Binding.cpp
+++ b/WebCore/bindings/v8/V8Binding.cpp
@@ -437,9 +437,9 @@ v8::Persistent<v8::FunctionTemplate> createRawTemplate()
return v8::Persistent<v8::FunctionTemplate>::New(result);
}
-v8::Local<v8::Signature> configureTemplate(v8::Persistent<v8::FunctionTemplate>desc,
+v8::Local<v8::Signature> configureTemplate(v8::Persistent<v8::FunctionTemplate> desc,
const char *interfaceName,
- V8ClassIndex::V8WrapperType parentClassIndex,
+ v8::Persistent<v8::FunctionTemplate> parentClass,
int fieldCount,
const BatchedAttribute* attributes,
size_t attributeCount,
@@ -449,8 +449,8 @@ v8::Local<v8::Signature> configureTemplate(v8::Persistent<v8::FunctionTemplate>d
desc->SetClassName(v8::String::New(interfaceName));
v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
instance->SetInternalFieldCount(fieldCount);
- if (parentClassIndex)
- desc->Inherit(V8DOMWrapper::getTemplate(parentClassIndex));
+ if (!parentClass.IsEmpty())
+ desc->Inherit(parentClass);
if (attributeCount)
batchConfigureAttributes(instance, desc->PrototypeTemplate(),
attributes, attributeCount);
diff --git a/WebCore/bindings/v8/V8Binding.h b/WebCore/bindings/v8/V8Binding.h
index 439dfd7..0be0ebd 100644
--- a/WebCore/bindings/v8/V8Binding.h
+++ b/WebCore/bindings/v8/V8Binding.h
@@ -32,11 +32,11 @@
#define V8Binding_h
#include "AtomicString.h"
+#include "BindingElement.h"
#include "BindingSecurity.h"
#include "MathExtras.h"
#include "PlatformString.h"
#include "V8DOMWrapper.h"
-#include "V8Index.h"
#include <v8.h>
@@ -53,6 +53,7 @@ namespace WebCore {
typedef V8BindingDOMWindow DOMWindow;
};
typedef BindingSecurity<V8Binding> V8BindingSecurity;
+ typedef BindingElement<V8Binding> V8BindingElement;
enum ExternalMode {
Externalize,
@@ -160,8 +161,8 @@ namespace WebCore {
struct BatchedCallback;
v8::Local<v8::Signature> configureTemplate(v8::Persistent<v8::FunctionTemplate>,
- const char *interfaceName,
- V8ClassIndex::V8WrapperType parentClassIndex,
+ const char* interfaceName,
+ v8::Persistent<v8::FunctionTemplate> parentClass,
int fieldCount,
const BatchedAttribute*,
size_t attributeCount,
diff --git a/WebCore/bindings/v8/V8DOMWindowShell.cpp b/WebCore/bindings/v8/V8DOMWindowShell.cpp
index 683fea5..02135bf 100644
--- a/WebCore/bindings/v8/V8DOMWindowShell.cpp
+++ b/WebCore/bindings/v8/V8DOMWindowShell.cpp
@@ -94,7 +94,7 @@ static Frame* getTargetFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> da
Frame* target = 0;
switch (V8ClassIndex::FromInt(data->Int32Value())) {
case V8ClassIndex::DOMWINDOW: {
- v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, host);
+ v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), host);
if (window.IsEmpty())
return target;
@@ -196,7 +196,7 @@ void V8DOMWindowShell::clearForNavigation()
clearDocumentWrapperCache();
// Turn on access check on the old DOMWindow wrapper.
- v8::Handle<v8::Object> wrapper = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, m_global);
+ v8::Handle<v8::Object> wrapper = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), m_global);
ASSERT(!wrapper.IsEmpty());
wrapper->TurnOnAccessCheck();
@@ -391,12 +391,12 @@ bool V8DOMWindowShell::installDOMWindow(v8::Handle<v8::Context> context, DOMWind
return true;
}
-void V8DOMWindowShell::updateDocumentWrapper(v8::Handle<v8::Value> wrapper)
+void V8DOMWindowShell::updateDocumentWrapper(v8::Handle<v8::Object> wrapper)
{
clearDocumentWrapper();
ASSERT(m_document.IsEmpty());
- m_document = v8::Persistent<v8::Value>::New(wrapper);
+ m_document = v8::Persistent<v8::Object>::New(wrapper);
#ifndef NDEBUG
V8GCController::registerGlobalHandle(PROXY, this, m_document);
#endif
@@ -438,6 +438,7 @@ void V8DOMWindowShell::updateDocumentWrapperCache()
clearDocumentWrapperCache();
return;
}
+ ASSERT(documentWrapper->IsObject());
m_context->Global()->ForceSet(v8::String::New("document"), documentWrapper, static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete));
}
diff --git a/WebCore/bindings/v8/V8DOMWindowShell.h b/WebCore/bindings/v8/V8DOMWindowShell.h
index 29dd517..5114f7a 100644
--- a/WebCore/bindings/v8/V8DOMWindowShell.h
+++ b/WebCore/bindings/v8/V8DOMWindowShell.h
@@ -31,7 +31,6 @@
#ifndef V8DOMWindowShell_h
#define V8DOMWindowShell_h
-#include "V8CustomBinding.h"
#include "V8Index.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
@@ -64,7 +63,7 @@ public:
static bool installDOMWindow(v8::Handle<v8::Context> context, DOMWindow*);
void initContextIfNeeded();
- void updateDocumentWrapper(v8::Handle<v8::Value> wrapper);
+ void updateDocumentWrapper(v8::Handle<v8::Object> wrapper);
void clearForNavigation();
void clearForClose();
@@ -114,7 +113,7 @@ private:
v8::Persistent<v8::Context> m_context;
v8::Persistent<v8::Object> m_global;
- v8::Persistent<v8::Value> m_document;
+ v8::Persistent<v8::Object> m_document;
};
} // namespace WebCore
diff --git a/WebCore/bindings/v8/V8DOMWrapper.cpp b/WebCore/bindings/v8/V8DOMWrapper.cpp
index a715160..1605417 100644
--- a/WebCore/bindings/v8/V8DOMWrapper.cpp
+++ b/WebCore/bindings/v8/V8DOMWrapper.cpp
@@ -64,6 +64,8 @@
#include "V8StyleSheet.h"
#include "V8WebSocket.h"
#include "V8Worker.h"
+#include "V8WorkerContext.h"
+#include "V8XMLHttpRequest.h"
#include "WebGLArray.h"
#include "WebGLContextAttributes.h"
#include "WebGLUniformLocation.h"
@@ -164,20 +166,6 @@ void V8DOMWrapper::setJSWrapperForDOMNode(Node* node, v8::Persistent<v8::Object>
getDOMNodeMap().set(node, wrapper);
}
-v8::Persistent<v8::FunctionTemplate> V8DOMWrapper::getTemplate(V8ClassIndex::V8WrapperType type)
-{
- v8::Persistent<v8::FunctionTemplate>* cacheCell = V8ClassIndex::GetCache(type);
- if (!cacheCell->IsEmpty())
- return *cacheCell;
-
- // Not in the cache.
- FunctionTemplateFactory factory = V8ClassIndex::GetFactory(type);
- v8::Persistent<v8::FunctionTemplate> descriptor = factory();
-
- *cacheCell = descriptor;
- return descriptor;
-}
-
v8::Local<v8::Function> V8DOMWrapper::getConstructor(V8ClassIndex::V8WrapperType type, v8::Handle<v8::Value> objectPrototype)
{
// A DOM constructor is a function instance created from a DOM constructor
@@ -189,7 +177,7 @@ v8::Local<v8::Function> V8DOMWrapper::getConstructor(V8ClassIndex::V8WrapperType
// The reason for 2) is that, in Safari, a DOM constructor is a normal JS
// object, but not a function. Hotmail relies on the fact that, in Safari,
// HTMLElement.__proto__ == Object.prototype.
- v8::Handle<v8::FunctionTemplate> functionTemplate = getTemplate(type);
+ v8::Handle<v8::FunctionTemplate> functionTemplate = V8ClassIndex::getTemplate(type);
// Getting the function might fail if we're running out of
// stack or memory.
v8::TryCatch tryCatch;
@@ -249,7 +237,7 @@ void V8DOMWrapper::setHiddenWindowReference(Frame* frame, const int internalInde
v8::Handle<v8::Object> global = context->Global();
// Look for real DOM wrapper.
- global = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, global);
+ global = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), global);
ASSERT(!global.IsEmpty());
ASSERT(global->GetInternalField(internalIndex)->IsUndefined());
global->SetInternalField(internalIndex, jsObject);
@@ -279,6 +267,19 @@ PassRefPtr<NodeFilter> V8DOMWrapper::wrapNativeNodeFilter(v8::Handle<v8::Value>
return NodeFilter::create(condition);
}
+v8::Local<v8::Object> V8DOMWrapper::instantiateV8ObjectInWorkerContext(V8ClassIndex::V8WrapperType type, void* impl)
+{
+ WorkerContextExecutionProxy* workerContextProxy = WorkerContextExecutionProxy::retrieve();
+ if (!workerContextProxy)
+ return instantiateV8Object(0, type, impl);
+ v8::Local<v8::Object> instance = SafeAllocation::newInstance(getConstructor(type, workerContextProxy->workerContext()));
+ if (!instance.IsEmpty()) {
+ // Avoid setting the DOM wrapper for failed allocations.
+ setDOMWrapper(instance, V8ClassIndex::ToInt(type), impl);
+ }
+ return instance;
+}
+
v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(V8Proxy* proxy, V8ClassIndex::V8WrapperType type, void* impl)
{
if (V8IsolatedContext::getEntered()) {
@@ -294,10 +295,8 @@ v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(V8Proxy* proxy, V8ClassI
if (proxy)
// FIXME: Fix this to work properly with isolated worlds (see above).
instance = proxy->windowShell()->createWrapperFromCache(type);
- else {
- v8::Local<v8::Function> function = getTemplate(type)->GetFunction();
- instance = SafeAllocation::newInstance(function);
- }
+ else
+ instance = SafeAllocation::newInstance(V8ClassIndex::getTemplate(type)->GetFunction());
if (!instance.IsEmpty()) {
// Avoid setting the DOM wrapper for failed allocations.
setDOMWrapper(instance, V8ClassIndex::ToInt(type), impl);
@@ -379,11 +378,17 @@ v8::Handle<v8::Value> V8DOMWrapper::convertEventTargetToV8Object(EventTarget* ta
#if ENABLE(WORKERS)
if (Worker* worker = target->toWorker())
return toV8(worker);
+
+ if (DedicatedWorkerContext* workerContext = target->toDedicatedWorkerContext())
+ return toV8(workerContext);
#endif // WORKERS
#if ENABLE(SHARED_WORKERS)
if (SharedWorker* sharedWorker = target->toSharedWorker())
return toV8(sharedWorker);
+
+ if (SharedWorkerContext* sharedWorkerContext = target->toSharedWorkerContext())
+ return toV8(sharedWorkerContext);
#endif // SHARED_WORKERS
#if ENABLE(NOTIFICATIONS)
@@ -409,6 +414,9 @@ v8::Handle<v8::Value> V8DOMWrapper::convertEventTargetToV8Object(EventTarget* ta
return wrapper;
}
+ if (XMLHttpRequest* xhr = target->toXMLHttpRequest())
+ return toV8(xhr);
+
// MessagePort is created within its JS counterpart
if (MessagePort* port = target->toMessagePort()) {
v8::Handle<v8::Object> wrapper = getActiveDOMObjectMap().get(port);
diff --git a/WebCore/bindings/v8/V8DOMWrapper.h b/WebCore/bindings/v8/V8DOMWrapper.h
index 51abff7..78e9ae2 100644
--- a/WebCore/bindings/v8/V8DOMWrapper.h
+++ b/WebCore/bindings/v8/V8DOMWrapper.h
@@ -117,9 +117,9 @@ namespace WebCore {
object->SetInternalField(v8DOMWrapperTypeIndex, v8::Integer::New(type));
}
- static v8::Handle<v8::Object> lookupDOMWrapper(V8ClassIndex::V8WrapperType type, v8::Handle<v8::Object> object)
+ static v8::Handle<v8::Object> lookupDOMWrapper(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Handle<v8::Object> object)
{
- return object.IsEmpty() ? object : object->FindInstanceInPrototypeChain(getTemplate(type));
+ return object.IsEmpty() ? object : object->FindInstanceInPrototypeChain(functionTemplate);
}
static V8ClassIndex::V8WrapperType domWrapperType(v8::Handle<v8::Object>);
@@ -169,7 +169,6 @@ namespace WebCore {
// Wrap JS node filter in C++.
static PassRefPtr<NodeFilter> wrapNativeNodeFilter(v8::Handle<v8::Value>);
- static v8::Persistent<v8::FunctionTemplate> getTemplate(V8ClassIndex::V8WrapperType);
static v8::Local<v8::Function> getConstructorForContext(V8ClassIndex::V8WrapperType, v8::Handle<v8::Context>);
static v8::Local<v8::Function> getConstructor(V8ClassIndex::V8WrapperType, v8::Handle<v8::Value> objectPrototype);
static v8::Local<v8::Function> getConstructor(V8ClassIndex::V8WrapperType, DOMWindow*);
@@ -193,6 +192,7 @@ namespace WebCore {
static void setHiddenWindowReference(Frame*, const int internalIndex, v8::Handle<v8::Object>);
static v8::Local<v8::Object> instantiateV8Object(V8Proxy* proxy, V8ClassIndex::V8WrapperType type, void* impl);
+ static v8::Local<v8::Object> instantiateV8ObjectInWorkerContext(V8ClassIndex::V8WrapperType type, void* impl);
static v8::Handle<v8::Object> getWrapper(Node*);
};
diff --git a/WebCore/bindings/v8/V8Index.cpp b/WebCore/bindings/v8/V8Index.cpp
index b87e060..1053f19 100644
--- a/WebCore/bindings/v8/V8Index.cpp
+++ b/WebCore/bindings/v8/V8Index.cpp
@@ -476,34 +476,16 @@
namespace WebCore {
-FunctionTemplateFactory V8ClassIndex::GetFactory(V8WrapperType type)
+v8::Persistent<v8::FunctionTemplate> V8ClassIndex::getTemplate(V8WrapperType type)
{
switch (type) {
#define MAKE_CASE(type, name)\
- case V8ClassIndex::type: return V8##name::GetTemplate;
+ case V8ClassIndex::type: return V8##name::GetTemplate();
WRAPPER_TYPES(MAKE_CASE)
#undef MAKE_CASE
- default: return NULL;
- }
-}
-
-
-#define MAKE_CACHE(type, name)\
- static v8::Persistent<v8::FunctionTemplate> name##_cache_;
- ALL_WRAPPER_TYPES(MAKE_CACHE)
-#undef MAKE_CACHE
-
-
-v8::Persistent<v8::FunctionTemplate>* V8ClassIndex::GetCache(V8WrapperType type)
-{
- switch (type) {
-#define MAKE_CASE(type, name)\
- case V8ClassIndex::type: return &name##_cache_;
- ALL_WRAPPER_TYPES(MAKE_CASE)
-#undef MAKE_CASE
default:
- ASSERT(false);
- return NULL;
+ ASSERT_NOT_REACHED();
+ return v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New());
}
}
diff --git a/WebCore/bindings/v8/V8Index.h b/WebCore/bindings/v8/V8Index.h
index f7582f7..bd1c45c 100644
--- a/WebCore/bindings/v8/V8Index.h
+++ b/WebCore/bindings/v8/V8Index.h
@@ -39,8 +39,6 @@ static const int v8DOMWrapperTypeIndex = 0;
static const int v8DOMWrapperObjectIndex = 1;
static const int v8DefaultWrapperInternalFieldCount = 2;
-typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)();
-
#if ENABLE(DATAGRID)
#define DATAGRID_HTMLELEMENT_TYPES(V) \
V(HTMLDATAGRIDCELLELEMENT, HTMLDataGridCellElement) \
@@ -635,7 +633,7 @@ typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)();
V(SVGLENGTH, SVGLength) \
V(SVGPRESERVEASPECTRATIO, SVGPreserveAspectRatio) \
V(SVGTRANSFORM, SVGTransform) \
- V(SVGMATRIX, TransformationMatrix) \
+ V(SVGMATRIX, AffineTransform) \
V(SVGNUMBER, float) \
V(SVGPOINT, FloatPoint) \
V(SVGRECT, FloatRect)
@@ -691,12 +689,7 @@ typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)();
return static_cast<V8WrapperType>(v);
}
- // FIXME: Convert to getFactory after all the bindings are in one place.
- static FunctionTemplateFactory GetFactory(V8WrapperType type);
-
- // Returns a field to be used as cache for the template for the given type
- // FIXME: Convert to getCache after all the bindings are in one place.
- static v8::Persistent<v8::FunctionTemplate>* GetCache(V8WrapperType type);
+ static v8::Persistent<v8::FunctionTemplate> getTemplate(V8WrapperType type);
};
}
diff --git a/WebCore/bindings/v8/V8NPObject.cpp b/WebCore/bindings/v8/V8NPObject.cpp
index 196972e..b873d5f 100644
--- a/WebCore/bindings/v8/V8NPObject.cpp
+++ b/WebCore/bindings/v8/V8NPObject.cpp
@@ -35,7 +35,6 @@
#include "HTMLPlugInElement.h"
#include "IdentifierRep.h"
#include "NPV8Object.h"
-#include "V8CustomBinding.h"
#include "V8DOMMap.h"
#include "V8HTMLAppletElement.h"
#include "V8HTMLEmbedElement.h"
diff --git a/WebCore/bindings/v8/V8Proxy.cpp b/WebCore/bindings/v8/V8Proxy.cpp
index b0a47b8..6e2d8b2 100644
--- a/WebCore/bindings/v8/V8Proxy.cpp
+++ b/WebCore/bindings/v8/V8Proxy.cpp
@@ -549,7 +549,7 @@ DOMWindow* V8Proxy::retrieveWindow(v8::Handle<v8::Context> context)
{
v8::Handle<v8::Object> global = context->Global();
ASSERT(!global.IsEmpty());
- global = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, global);
+ global = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), global);
ASSERT(!global.IsEmpty());
return V8DOMWindow::toNative(global);
}
diff --git a/WebCore/bindings/v8/V8Utilities.cpp b/WebCore/bindings/v8/V8Utilities.cpp
index fb1ecaa..c7314f1 100644
--- a/WebCore/bindings/v8/V8Utilities.cpp
+++ b/WebCore/bindings/v8/V8Utilities.cpp
@@ -37,7 +37,6 @@
#include "Frame.h"
#include "ScriptExecutionContext.h"
#include "ScriptState.h"
-#include "V8CustomBinding.h"
#include "V8Binding.h"
#include "V8Proxy.h"
#include "WorkerContext.h"
diff --git a/WebCore/bindings/v8/V8WorkerContextEventListener.cpp b/WebCore/bindings/v8/V8WorkerContextEventListener.cpp
index e5356de..fa89ae6 100644
--- a/WebCore/bindings/v8/V8WorkerContextEventListener.cpp
+++ b/WebCore/bindings/v8/V8WorkerContextEventListener.cpp
@@ -34,8 +34,9 @@
#include "V8WorkerContextEventListener.h"
-#include "Event.h"
#include "V8Binding.h"
+#include "V8DOMWrapper.h"
+#include "V8Event.h"
#include "WorkerContext.h"
#include "WorkerContextExecutionProxy.h"
@@ -76,7 +77,7 @@ void V8WorkerContextEventListener::handleEvent(ScriptExecutionContext* context,
v8::Context::Scope scope(v8Context);
// Get the V8 wrapper for the event object.
- v8::Handle<v8::Value> jsEvent = WorkerContextExecutionProxy::convertEventToV8Object(event);
+ v8::Handle<v8::Value> jsEvent = toV8(event);
invokeEventHandler(context, event, jsEvent);
}
@@ -155,7 +156,7 @@ v8::Local<v8::Object> V8WorkerContextEventListener::getReceiverObject(ScriptExec
return listener;
EventTarget* target = event->currentTarget();
- v8::Handle<v8::Value> value = WorkerContextExecutionProxy::convertEventTargetToV8Object(target);
+ v8::Handle<v8::Value> value = V8DOMWrapper::convertEventTargetToV8Object(target);
if (value.IsEmpty())
return v8::Local<v8::Object>();
return v8::Local<v8::Object>::New(v8::Handle<v8::Object>::Cast(value));
diff --git a/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp b/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
index ac677a2..e4b417e 100644
--- a/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
+++ b/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
@@ -107,7 +107,7 @@ WorkerContextExecutionProxy* WorkerContextExecutionProxy::retrieve()
return 0;
v8::Handle<v8::Context> context = v8::Context::GetCurrent();
v8::Handle<v8::Object> global = context->Global();
- global = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::WORKERCONTEXT, global);
+ global = V8DOMWrapper::lookupDOMWrapper(V8WorkerContext::GetTemplate(), global);
// Return 0 if the current executing context is not the worker context.
if (global.IsEmpty())
return 0;
@@ -176,195 +176,6 @@ void WorkerContextExecutionProxy::initContextIfNeeded()
globalObject->Set(implicitProtoString, jsWorkerContext);
}
-v8::Handle<v8::Value> WorkerContextExecutionProxy::convertToV8Object(V8ClassIndex::V8WrapperType type, void* impl)
-{
- if (!impl)
- return v8::Null();
-
- if (type == V8ClassIndex::DEDICATEDWORKERCONTEXT
-#if ENABLE(SHARED_WORKERS)
- || type == V8ClassIndex::SHAREDWORKERCONTEXT
-#endif
- )
- return convertWorkerContextToV8Object(static_cast<WorkerContext*>(impl));
-
- bool isActiveDomObject = false;
- switch (type) {
-#define MAKE_CASE(TYPE, NAME) case V8ClassIndex::TYPE:
- ACTIVE_DOM_OBJECT_TYPES(MAKE_CASE)
- isActiveDomObject = true;
- break;
-#undef MAKE_CASE
- default:
- break;
- }
-
- if (isActiveDomObject) {
- v8::Persistent<v8::Object> result = getActiveDOMObjectMap().get(impl);
- if (!result.IsEmpty())
- return result;
-
- v8::Local<v8::Object> object = toV8(type, type, impl);
- switch (type) {
-#define MAKE_CASE(TYPE, NAME) \
- case V8ClassIndex::TYPE: static_cast<NAME*>(impl)->ref(); break;
- ACTIVE_DOM_OBJECT_TYPES(MAKE_CASE)
-#undef MAKE_CASE
- default:
- ASSERT_NOT_REACHED();
- }
-
- result = v8::Persistent<v8::Object>::New(object);
- V8DOMWrapper::setJSWrapperForActiveDOMObject(impl, result);
- return result;
- }
-
- // Non DOM node
- v8::Persistent<v8::Object> result = getDOMObjectMap().get(impl);
- if (result.IsEmpty()) {
- v8::Local<v8::Object> object = toV8(type, type, impl);
- if (!object.IsEmpty()) {
- switch (type) {
- case V8ClassIndex::WORKERLOCATION:
- static_cast<WorkerLocation*>(impl)->ref();
- break;
- case V8ClassIndex::WORKERNAVIGATOR:
- static_cast<WorkerNavigator*>(impl)->ref();
- break;
-#if ENABLE(NOTIFICATIONS)
- case V8ClassIndex::NOTIFICATIONCENTER:
- static_cast<NotificationCenter*>(impl)->ref();
- break;
- case V8ClassIndex::NOTIFICATION:
- static_cast<Notification*>(impl)->ref();
- break;
-#endif
- case V8ClassIndex::DOMCOREEXCEPTION:
- static_cast<DOMCoreException*>(impl)->ref();
- break;
- case V8ClassIndex::RANGEEXCEPTION:
- static_cast<RangeException*>(impl)->ref();
- break;
- case V8ClassIndex::EVENTEXCEPTION:
- static_cast<EventException*>(impl)->ref();
- break;
- case V8ClassIndex::XMLHTTPREQUESTEXCEPTION:
- static_cast<XMLHttpRequestException*>(impl)->ref();
- break;
- default:
- ASSERT(false);
- }
- result = v8::Persistent<v8::Object>::New(object);
- V8DOMWrapper::setJSWrapperForDOMObject(impl, result);
- }
- }
- return result;
-}
-
-v8::Handle<v8::Value> WorkerContextExecutionProxy::convertEventToV8Object(Event* event)
-{
- if (!event)
- return v8::Null();
-
- v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(event);
- if (!wrapper.IsEmpty())
- return wrapper;
-
- V8ClassIndex::V8WrapperType type = V8ClassIndex::EVENT;
-
- if (event->isMessageEvent())
- type = V8ClassIndex::MESSAGEEVENT;
-
- v8::Handle<v8::Object> result = toV8(type, V8ClassIndex::EVENT, event);
- if (result.IsEmpty()) {
- // Instantiation failed. Avoid updating the DOM object map and return null which
- // is already handled by callers of this function in case the event is null.
- return v8::Null();
- }
-
- event->ref(); // fast ref
- V8DOMWrapper::setJSWrapperForDOMObject(event, v8::Persistent<v8::Object>::New(result));
-
- return result;
-}
-
-v8::Handle<v8::Value> WorkerContextExecutionProxy::convertEventTargetToV8Object(EventTarget* target)
-{
- if (!target)
- return v8::Null();
-
- DedicatedWorkerContext* workerContext = target->toDedicatedWorkerContext();
- if (workerContext)
- return convertWorkerContextToV8Object(workerContext);
-
-#if ENABLE(SHARED_WORKERS)
- SharedWorkerContext* sharedWorkerContext = target->toSharedWorkerContext();
- if (sharedWorkerContext)
- return convertWorkerContextToV8Object(sharedWorkerContext);
-#endif
-
- Worker* worker = target->toWorker();
- if (worker)
- return convertToV8Object(V8ClassIndex::WORKER, worker);
-
-#if ENABLE(SHARED_WORKERS)
- SharedWorker* sharedWorker = target->toSharedWorker();
- if (sharedWorker)
- return convertToV8Object(V8ClassIndex::SHAREDWORKER, sharedWorker);
-#endif
-
- XMLHttpRequest* xhr = target->toXMLHttpRequest();
- if (xhr)
- return convertToV8Object(V8ClassIndex::XMLHTTPREQUEST, xhr);
-
- MessagePort* mp = target->toMessagePort();
- if (mp)
- return convertToV8Object(V8ClassIndex::MESSAGEPORT, mp);
-
-#if ENABLE(WEB_SOCKETS)
- WebSocket* webSocket = target->toWebSocket();
- if (webSocket)
- return convertToV8Object(V8ClassIndex::WEBSOCKET, webSocket);
-#endif
-
-#if ENABLE(EVENTSOURCE)
- EventSource* eventSource = target->toEventSource();
- if (eventSource)
- return convertToV8Object(V8ClassIndex::EVENTSOURCE, eventSource);
-#endif
-
- ASSERT_NOT_REACHED();
- return v8::Handle<v8::Value>();
-}
-
-v8::Handle<v8::Value> WorkerContextExecutionProxy::convertWorkerContextToV8Object(WorkerContext* workerContext)
-{
- if (!workerContext)
- return v8::Null();
-
- v8::Handle<v8::Context> context = workerContext->script()->proxy()->context();
-
- v8::Handle<v8::Object> global = context->Global();
- ASSERT(!global.IsEmpty());
- return global;
-}
-
-v8::Local<v8::Object> WorkerContextExecutionProxy::toV8(V8ClassIndex::V8WrapperType descriptorType, V8ClassIndex::V8WrapperType cptrType, void* impl)
-{
- v8::Local<v8::Function> function;
- WorkerContextExecutionProxy* proxy = retrieve();
- if (proxy)
- function = V8DOMWrapper::getConstructor(descriptorType, proxy->workerContext());
- else
- function = V8DOMWrapper::getTemplate(descriptorType)->GetFunction();
-
- v8::Local<v8::Object> instance = SafeAllocation::newInstance(function);
- if (!instance.IsEmpty())
- // Avoid setting the DOM wrapper for failed allocations.
- V8DOMWrapper::setDOMWrapper(instance, V8ClassIndex::ToInt(cptrType), impl);
- return instance;
-}
-
bool WorkerContextExecutionProxy::forgetV8EventObject(Event* event)
{
if (getDOMObjectMap().contains(event)) {
diff --git a/WebCore/bindings/v8/WorkerContextExecutionProxy.h b/WebCore/bindings/v8/WorkerContextExecutionProxy.h
index b5e6afb..67a472b 100644
--- a/WebCore/bindings/v8/WorkerContextExecutionProxy.h
+++ b/WebCore/bindings/v8/WorkerContextExecutionProxy.h
@@ -84,22 +84,6 @@ namespace WebCore {
// Returns WorkerContextExecutionProxy object of the currently executing context. 0 will be returned if the current executing context is not the worker context.
static WorkerContextExecutionProxy* retrieve();
- // We have to keep all these conversion functions here before WorkerContextExecutionProxy is refactor-ed.
- template<typename T>
- static v8::Handle<v8::Value> convertToV8Object(V8ClassIndex::V8WrapperType type, PassRefPtr<T> impl)
- {
- return convertToV8Object(type, impl.get());
- }
- static v8::Handle<v8::Value> convertToV8Object(V8ClassIndex::V8WrapperType, void* impl);
- static v8::Handle<v8::Value> convertEventToV8Object(Event*);
- static v8::Handle<v8::Value> convertEventTargetToV8Object(EventTarget*);
- static v8::Handle<v8::Value> convertWorkerContextToV8Object(WorkerContext*);
-
- static v8::Local<v8::Object> toV8(V8ClassIndex::V8WrapperType type, void* impl)
- {
- return toV8(type, type, impl);
- }
-
private:
void initV8IfNeeded();
void initContextIfNeeded();
@@ -108,8 +92,6 @@ namespace WebCore {
// Run an already compiled script.
v8::Local<v8::Value> runScript(v8::Handle<v8::Script>);
- static v8::Local<v8::Object> toV8(V8ClassIndex::V8WrapperType descriptorType, V8ClassIndex::V8WrapperType cptrType, void* impl);
-
static bool forgetV8EventObject(Event*);
static const int kWorkerMaxStackSize = 500 * 1024;
diff --git a/WebCore/bindings/v8/custom/V8AbstractWorkerCustom.cpp b/WebCore/bindings/v8/custom/V8AbstractWorkerCustom.cpp
index 6b8f195..e776438 100644
--- a/WebCore/bindings/v8/custom/V8AbstractWorkerCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8AbstractWorkerCustom.cpp
@@ -37,7 +37,6 @@
#include "ExceptionCode.h"
#include "ScriptExecutionContext.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
#include "V8Utilities.h"
#include "WorkerContextExecutionProxy.h"
diff --git a/WebCore/bindings/v8/custom/V8AttrCustom.cpp b/WebCore/bindings/v8/custom/V8AttrCustom.cpp
index 7bec619..0da4ae4 100644
--- a/WebCore/bindings/v8/custom/V8AttrCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8AttrCustom.cpp
@@ -36,7 +36,6 @@
#include "ExceptionCode.h"
#include "V8Binding.h"
#include "V8BindingState.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp b/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp
index 25d141a..850ae14 100644
--- a/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp
@@ -38,7 +38,6 @@
#include "EventTarget.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
#include <wtf/ASCIICType.h>
diff --git a/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp b/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
index 70be193..9a05d72 100644
--- a/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
@@ -41,7 +41,6 @@
#include "V8Binding.h"
#include "V8CanvasGradient.h"
#include "V8CanvasPattern.h"
-#include "V8CustomBinding.h"
#include "V8HTMLCanvasElement.h"
#include "V8HTMLImageElement.h"
#include "V8HTMLVideoElement.h"
diff --git a/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp b/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp
index 5f0b4e3..aa2816c 100644
--- a/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp
@@ -39,7 +39,6 @@
#include "Element.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Node.h"
#include "V8Proxy.h"
diff --git a/WebCore/bindings/v8/custom/V8CoordinatesCustom.cpp b/WebCore/bindings/v8/custom/V8CoordinatesCustom.cpp
index a5197f5..fc5c750 100644
--- a/WebCore/bindings/v8/custom/V8CoordinatesCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8CoordinatesCustom.cpp
@@ -28,7 +28,6 @@
#include "Coordinates.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8CustomBinding.h b/WebCore/bindings/v8/custom/V8CustomBinding.h
index 0c96cb1..e69de29 100644
--- a/WebCore/bindings/v8/custom/V8CustomBinding.h
+++ b/WebCore/bindings/v8/custom/V8CustomBinding.h
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef V8CustomBinding_h
-#define V8CustomBinding_h
-
-#include "V8Index.h"
-#include <v8.h>
-
-namespace WebCore {
- class V8Custom {
- public:
-#define DECLARE_CALLBACK(NAME) static v8::Handle<v8::Value> v8##NAME##Callback(const v8::Arguments& args)
-#define USE_CALLBACK(NAME) V8Custom::v8##NAME##Callback
-
- DECLARE_CALLBACK(HTMLAudioElementConstructor);
- DECLARE_CALLBACK(HTMLImageElementConstructor);
- DECLARE_CALLBACK(HTMLOptionElementConstructor);
-
-#undef DECLARE_CALLBACK
- };
-} // namespace WebCore
-
-#endif // V8CustomBinding_h
diff --git a/WebCore/bindings/v8/custom/V8DOMApplicationCacheCustom.cpp b/WebCore/bindings/v8/custom/V8DOMApplicationCacheCustom.cpp
index a439432..61760b3 100644
--- a/WebCore/bindings/v8/custom/V8DOMApplicationCacheCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DOMApplicationCacheCustom.cpp
@@ -36,7 +36,6 @@
#include "ApplicationCacheHost.h"
#include "DOMApplicationCache.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Document.h"
#include "V8Proxy.h"
#include "V8Utilities.h"
diff --git a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
index ba6c738..9719837 100644
--- a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
@@ -1,10 +1,10 @@
/*
* Copyright (C) 2009 Google Inc. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -45,7 +45,6 @@
#include "MediaPlayer.h"
#include "Page.h"
#include "PlatformScreen.h"
-#include "RuntimeEnabledFeatures.h"
#include "ScheduledAction.h"
#include "ScriptSourceCode.h"
#include "SerializedScriptValue.h"
@@ -55,7 +54,6 @@
#include "V8Binding.h"
#include "V8BindingDOMWindow.h"
#include "V8BindingState.h"
-#include "V8CustomBinding.h"
#include "V8CustomEventListener.h"
#include "V8HTMLCollection.h"
#include "V8MessagePortCustom.h"
@@ -96,9 +94,9 @@ v8::Handle<v8::Value> WindowSetTimeoutImpl(const v8::Arguments& args, bool singl
else {
v8::Handle<v8::Value> v8String = function->ToString();
- // Bail out if string conversion failed.
- if (v8String.IsEmpty())
- return v8::Undefined();
+ // Bail out if string conversion failed.
+ if (v8String.IsEmpty())
+ return v8::Undefined();
functionString = toWebCoreString(v8String);
}
@@ -173,7 +171,7 @@ static v8::Handle<v8::Value> convertBase64(const String& str, bool encode)
v8::Handle<v8::Value> V8DOMWindow::eventAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
- v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, info.This());
+ v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), info.This());
if (holder.IsEmpty())
return v8::Undefined();
@@ -194,7 +192,7 @@ v8::Handle<v8::Value> V8DOMWindow::eventAccessorGetter(v8::Local<v8::String> nam
void V8DOMWindow::eventAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
- v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, info.This());
+ v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), info.This());
if (holder.IsEmpty())
return;
@@ -229,7 +227,7 @@ void V8DOMWindow::openerAccessorSetter(v8::Local<v8::String> name, v8::Local<v8:
if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true))
return;
-
+
// Opener can be shadowed if it is in the same domain.
// Have a special handling of null value to behave
// like Firefox. See bug http://b/1224887 & http://b/791706.
@@ -255,85 +253,6 @@ v8::Handle<v8::Value> V8DOMWindow::AudioAccessorGetter(v8::Local<v8::String> nam
return V8DOMWrapper::getConstructor(V8ClassIndex::AUDIO, window);
}
-bool V8DOMWindow::AudioEnabled()
-{
- return MediaPlayer::isAvailable();
-}
-
-bool V8DOMWindow::HTMLMediaElementEnabled()
-{
- return MediaPlayer::isAvailable();
-}
-
-bool V8DOMWindow::HTMLAudioElementEnabled()
-{
- return MediaPlayer::isAvailable();
-}
-
-bool V8DOMWindow::HTMLVideoElementEnabled()
-{
- return MediaPlayer::isAvailable();
-}
-
-bool V8DOMWindow::MediaErrorEnabled()
-{
- return MediaPlayer::isAvailable();
-}
-
-#endif
-
-#if ENABLE(SHARED_WORKERS)
-bool V8DOMWindow::SharedWorkerEnabled()
-{
- return SharedWorkerRepository::isAvailable();
-}
-#endif
-
-#if ENABLE(WEB_SOCKETS)
-bool V8DOMWindow::WebSocketEnabled()
-{
- return WebSocket::isAvailable();
-}
-#endif
-
-#if ENABLE(DATABASE)
-bool V8DOMWindow::OpenDatabaseEnabled()
-{
- return Database::isAvailable();
-}
-#endif
-
-#if ENABLE(INDEXED_DATABASE)
-bool V8DOMWindow::IndexedDBEnabled()
-{
- return RuntimeEnabledFeatures::indexedDatabaseEnabled();
-}
-#endif
-
-#if ENABLE(DOM_STORAGE)
-bool V8DOMWindow::LocalStorageEnabled()
-{
- return RuntimeEnabledFeatures::localStorageEnabled();
-}
-
-bool V8DOMWindow::SessionStorageEnabled()
-{
- return RuntimeEnabledFeatures::sessionStorageEnabled();
-}
-#endif
-
-#if ENABLE(NOTIFICATIONS)
-bool V8DOMWindow::WebkitNotificationsEnabled()
-{
- return RuntimeEnabledFeatures::notificationsEnabled();
-}
-#endif
-
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
-bool V8DOMWindow::ApplicationCacheEnabled()
-{
- return RuntimeEnabledFeatures::applicationCacheEnabled();
-}
#endif
v8::Handle<v8::Value> V8DOMWindow::ImageAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
@@ -490,7 +409,7 @@ v8::Handle<v8::Value> V8DOMWindow::btoaCallback(const v8::Arguments& args)
v8::Handle<v8::Value> V8DOMWindow::toStringCallback(const v8::Arguments& args)
{
INC_STATS("DOM.DOMWindow.toString()");
- v8::Handle<v8::Object> domWrapper = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, args.This());
+ v8::Handle<v8::Object> domWrapper = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), args.This());
if (domWrapper.IsEmpty())
return args.This()->ObjectProtoToString();
return domWrapper->ObjectProtoToString();
@@ -596,7 +515,7 @@ v8::Handle<v8::Value> V8DOMWindow::showModalDialogCallback(const v8::Arguments&
// default here came from frame size of dialog in MacIE.
windowFeatures.height = WindowFeatures::floatFeature(features, "dialogheight", 100, screenRect.height(), 450);
windowFeatures.heightSet = true;
-
+
windowFeatures.x = WindowFeatures::floatFeature(features, "dialogleft", screenRect.x(), screenRect.right() - windowFeatures.width, -1);
windowFeatures.xSet = windowFeatures.x > 0;
windowFeatures.y = WindowFeatures::floatFeature(features, "dialogtop", screenRect.y(), screenRect.bottom() - windowFeatures.height, -1);
@@ -695,11 +614,11 @@ v8::Handle<v8::Value> V8DOMWindow::openCallback(const v8::Arguments& args)
if (topOrParent) {
if (!shouldAllowNavigation(frame))
return v8::Undefined();
-
+
String completedUrl;
if (!urlString.isEmpty())
completedUrl = completeURL(urlString);
-
+
if (!completedUrl.isEmpty() &&
(!protocolIsJavaScript(completedUrl) || ScriptController::isSafeScript(frame))) {
bool userGesture = processingUserGesture();
@@ -882,7 +801,7 @@ v8::Handle<v8::Value> V8DOMWindow::clearIntervalCallback(const v8::Arguments& ar
bool V8DOMWindow::namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value> data)
{
ASSERT(V8ClassIndex::FromInt(data->Int32Value()) == V8ClassIndex::DOMWINDOW);
- v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, host);
+ v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), host);
if (window.IsEmpty())
return false; // the frame is gone.
@@ -908,7 +827,7 @@ bool V8DOMWindow::namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::V
bool V8DOMWindow::indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::AccessType type, v8::Local<v8::Value> data)
{
ASSERT(V8ClassIndex::FromInt(data->Int32Value()) == V8ClassIndex::DOMWINDOW);
- v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, host);
+ v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), host);
if (window.IsEmpty())
return false;
@@ -944,7 +863,7 @@ v8::Handle<v8::Value> toV8(DOMWindow* window)
// necessarily the first global object associated with that DOMWindow.
v8::Handle<v8::Context> currentContext = v8::Context::GetCurrent();
v8::Handle<v8::Object> currentGlobal = currentContext->Global();
- v8::Handle<v8::Object> windowWrapper = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, currentGlobal);
+ v8::Handle<v8::Object> windowWrapper = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), currentGlobal);
if (!windowWrapper.IsEmpty()) {
if (V8DOMWindow::toNative(windowWrapper) == window)
return currentGlobal;
diff --git a/WebCore/bindings/v8/custom/V8DataGridColumnListCustom.cpp b/WebCore/bindings/v8/custom/V8DataGridColumnListCustom.cpp
index 58e5d01..3dad5c0 100644
--- a/WebCore/bindings/v8/custom/V8DataGridColumnListCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DataGridColumnListCustom.cpp
@@ -33,7 +33,6 @@
#include "Document.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
#if ENABLE(DATAGRID)
diff --git a/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp b/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp
index c83e1cc..abd6ff6 100644
--- a/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp
@@ -35,7 +35,6 @@
#include "Database.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8CustomSQLTransactionCallback.h"
#include "V8CustomSQLTransactionErrorCallback.h"
#include "V8CustomVoidCallback.h"
diff --git a/WebCore/bindings/v8/custom/V8DocumentCustom.cpp b/WebCore/bindings/v8/custom/V8DocumentCustom.cpp
index 7bf7e50..0199d67 100644
--- a/WebCore/bindings/v8/custom/V8DocumentCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DocumentCustom.cpp
@@ -155,7 +155,13 @@ v8::Handle<v8::Value> toV8(Document* impl, bool forceNewObject)
if (impl->isSVGDocument())
return toV8(static_cast<SVGDocument*>(impl), forceNewObject);
#endif
+<<<<<<< HEAD
v8::Handle<v8::Value> wrapper = V8Document::wrap(impl, forceNewObject);
+=======
+ v8::Handle<v8::Object> wrapper = V8Document::wrap(impl, forceNewObject);
+ if (wrapper.IsEmpty())
+ return wrapper;
+>>>>>>> webkit.org at r54731
if (!V8IsolatedContext::getEntered()) {
if (V8Proxy* proxy = V8Proxy::retrieve(impl->frame()))
proxy->windowShell()->updateDocumentWrapper(wrapper);
diff --git a/WebCore/bindings/v8/custom/V8ElementCustom.cpp b/WebCore/bindings/v8/custom/V8ElementCustom.cpp
index a81e081..86f134e 100644
--- a/WebCore/bindings/v8/custom/V8ElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8ElementCustom.cpp
@@ -43,7 +43,6 @@
#include "V8Attr.h"
#include "V8Binding.h"
#include "V8BindingState.h"
-#include "V8CustomBinding.h"
#include "V8HTMLElement.h"
#include "V8Proxy.h"
#include "V8SVGElement.h"
@@ -59,11 +58,8 @@ v8::Handle<v8::Value> V8Element::setAttributeCallback(const v8::Arguments& args)
String name = toWebCoreString(args[0]);
String value = toWebCoreString(args[1]);
- if (!V8BindingSecurity::allowSettingSrcToJavascriptURL(V8BindingState::Only(), element, name, value))
- return v8::Undefined();
-
ExceptionCode ec = 0;
- element->setAttribute(name, value, ec);
+ V8BindingElement::setAttribute(V8BindingState::Only(), element, name, value, ec);
if (ec)
return throwError(ec);
@@ -79,11 +75,8 @@ v8::Handle<v8::Value> V8Element::setAttributeNodeCallback(const v8::Arguments& a
Attr* newAttr = V8Attr::toNative(v8::Handle<v8::Object>::Cast(args[0]));
Element* element = V8Element::toNative(args.Holder());
- if (!V8BindingSecurity::allowSettingSrcToJavascriptURL(V8BindingState::Only(), element, newAttr->name(), newAttr->value()))
- return v8::Undefined();
-
ExceptionCode ec = 0;
- RefPtr<Attr> result = element->setAttributeNode(newAttr, ec);
+ RefPtr<Attr> result = V8BindingElement::setAttributeNode(V8BindingState::Only(), element, newAttr, ec);
if (ec)
throwError(ec);
@@ -98,11 +91,8 @@ v8::Handle<v8::Value> V8Element::setAttributeNSCallback(const v8::Arguments& arg
String qualifiedName = toWebCoreString(args[1]);
String value = toWebCoreString(args[2]);
- if (!V8BindingSecurity::allowSettingSrcToJavascriptURL(V8BindingState::Only(), element, qualifiedName, value))
- return v8::Undefined();
-
ExceptionCode ec = 0;
- element->setAttributeNS(namespaceURI, qualifiedName, value, ec);
+ V8BindingElement::setAttributeNS(V8BindingState::Only(), element, namespaceURI, qualifiedName, value, ec);
if (ec)
throwError(ec);
@@ -118,11 +108,8 @@ v8::Handle<v8::Value> V8Element::setAttributeNodeNSCallback(const v8::Arguments&
Attr* newAttr = V8Attr::toNative(v8::Handle<v8::Object>::Cast(args[0]));
Element* element = V8Element::toNative(args.Holder());
- if (!V8BindingSecurity::allowSettingSrcToJavascriptURL(V8BindingState::Only(), element, newAttr->name(), newAttr->value()))
- return v8::Undefined();
-
ExceptionCode ec = 0;
- RefPtr<Attr> result = element->setAttributeNodeNS(newAttr, ec);
+ RefPtr<Attr> result = V8BindingElement::setAttributeNodeNS(V8BindingState::Only(), element, newAttr, ec);
if (ec)
throwError(ec);
diff --git a/WebCore/bindings/v8/custom/V8EventSourceConstructor.cpp b/WebCore/bindings/v8/custom/V8EventSourceConstructor.cpp
index 458c35d..793ffb6 100644
--- a/WebCore/bindings/v8/custom/V8EventSourceConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8EventSourceConstructor.cpp
@@ -36,7 +36,6 @@
#include "EventSource.h"
#include "Frame.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
#include "V8Utilities.h"
#include "WorkerContext.h"
diff --git a/WebCore/bindings/v8/custom/V8EventSourceCustom.cpp b/WebCore/bindings/v8/custom/V8EventSourceCustom.cpp
index e603549..a7f79db 100644
--- a/WebCore/bindings/v8/custom/V8EventSourceCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8EventSourceCustom.cpp
@@ -31,7 +31,6 @@
#include "EventSource.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp b/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp
index 6bd9ff2..7173be1 100644
--- a/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp
@@ -29,7 +29,6 @@
#include "Geolocation.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8CustomPositionCallback.h"
#include "V8CustomPositionErrorCallback.h"
#include "V8Proxy.h"
diff --git a/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp
index 88b3a9d..58a85dc 100644
--- a/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp
@@ -34,7 +34,6 @@
#include "HTMLAllCollection.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8NamedNodesCollection.h"
#include "V8Node.h"
#include "V8NodeList.h"
diff --git a/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp b/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp
index 28b0a99..06c6c1d 100644
--- a/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp
@@ -44,25 +44,7 @@
namespace WebCore {
-v8::Persistent<v8::FunctionTemplate> V8HTMLAudioElementConstructor::GetTemplate()
-{
- static v8::Persistent<v8::FunctionTemplate> cachedTemplate;
- if (!cachedTemplate.IsEmpty())
- return cachedTemplate;
-
- v8::HandleScope scope;
- v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(USE_CALLBACK(HTMLAudioElementConstructor));
-
- v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
- instance->SetInternalFieldCount(V8HTMLAudioElement::internalFieldCount);
- result->SetClassName(v8::String::New("HTMLAudioElement"));
- result->Inherit(V8DOMWrapper::getTemplate(V8ClassIndex::HTMLAUDIOELEMENT));
-
- cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(result);
- return cachedTemplate;
-}
-
-v8::Handle<v8::Value> V8Custom::v8HTMLAudioElementConstructorCallback(const v8::Arguments& args)
+static v8::Handle<v8::Value> v8HTMLAudioElementConstructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLAudioElement.Contructor");
@@ -88,10 +70,28 @@ v8::Handle<v8::Value> V8Custom::v8HTMLAudioElementConstructorCallback(const v8::
audio->scheduleLoad();
}
- V8DOMWrapper::setDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::NODE), audio.get());
+ V8DOMWrapper::setDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::AUDIO), audio.get());
audio->ref();
V8DOMWrapper::setJSWrapperForDOMNode(audio.get(), v8::Persistent<v8::Object>::New(args.Holder()));
return args.Holder();
}
+v8::Persistent<v8::FunctionTemplate> V8HTMLAudioElementConstructor::GetTemplate()
+{
+ static v8::Persistent<v8::FunctionTemplate> cachedTemplate;
+ if (!cachedTemplate.IsEmpty())
+ return cachedTemplate;
+
+ v8::HandleScope scope;
+ v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(v8HTMLAudioElementConstructorCallback);
+
+ v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
+ instance->SetInternalFieldCount(V8HTMLAudioElement::internalFieldCount);
+ result->SetClassName(v8::String::New("HTMLAudioElement"));
+ result->Inherit(V8HTMLAudioElement::GetTemplate());
+
+ cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(result);
+ return cachedTemplate;
+}
+
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.h b/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.h
index ac4b46d..711f539 100755
--- a/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.h
+++ b/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.h
@@ -36,10 +36,8 @@
namespace WebCore {
class V8HTMLAudioElementConstructor {
-private:
+public:
static v8::Persistent<v8::FunctionTemplate> GetTemplate();
-
- friend class V8ClassIndex;
};
}
diff --git a/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp
index 29ff6eb..a4a0c57 100644
--- a/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp
@@ -33,7 +33,6 @@
#include "HTMLCollection.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8HTMLAllCollection.h"
#include "V8NamedNodesCollection.h"
#include "V8Node.h"
diff --git a/WebCore/bindings/v8/custom/V8HTMLDataGridElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLDataGridElementCustom.cpp
index 0ef4150..d6918cf 100644
--- a/WebCore/bindings/v8/custom/V8HTMLDataGridElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLDataGridElementCustom.cpp
@@ -33,7 +33,6 @@
#include "Document.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8DataGridDataSource.h"
#include "V8Proxy.h"
diff --git a/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
index 6478e07..86f2eb5 100644
--- a/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
@@ -204,6 +204,8 @@ v8::Handle<v8::Value> toV8(HTMLDocument* impl, bool forceNewObject)
if (!impl)
return v8::Null();
v8::Handle<v8::Object> wrapper = V8HTMLDocument::wrap(impl, forceNewObject);
+ if (wrapper.IsEmpty())
+ return wrapper;
if (!V8IsolatedContext::getEntered()) {
if (V8Proxy* proxy = V8Proxy::retrieve(impl->frame()))
proxy->windowShell()->updateDocumentWrapper(wrapper);
diff --git a/WebCore/bindings/v8/custom/V8HTMLFrameElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLFrameElementCustom.cpp
index fd831bf..d3de1dc 100644
--- a/WebCore/bindings/v8/custom/V8HTMLFrameElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLFrameElementCustom.cpp
@@ -35,7 +35,6 @@
#include "HTMLNames.h"
#include "V8Binding.h"
#include "V8BindingState.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8HTMLIFrameElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLIFrameElementCustom.cpp
index 1949632..5f22400 100644
--- a/WebCore/bindings/v8/custom/V8HTMLIFrameElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLIFrameElementCustom.cpp
@@ -35,7 +35,6 @@
#include "HTMLNames.h"
#include "V8Binding.h"
#include "V8BindingState.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp b/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
index 2c28fa5..1873188 100644
--- a/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
@@ -44,25 +44,7 @@
namespace WebCore {
-v8::Persistent<v8::FunctionTemplate> V8HTMLImageElementConstructor::GetTemplate()
-{
- static v8::Persistent<v8::FunctionTemplate> cachedTemplate;
- if (!cachedTemplate.IsEmpty())
- return cachedTemplate;
-
- v8::HandleScope scope;
- v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(USE_CALLBACK(HTMLImageElementConstructor));
-
- v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
- instance->SetInternalFieldCount(V8HTMLImageElement::internalFieldCount);
- result->SetClassName(v8::String::New("HTMLImageElement"));
- result->Inherit(V8DOMWrapper::getTemplate(V8ClassIndex::HTMLIMAGEELEMENT));
-
- cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(result);
- return cachedTemplate;
-}
-
-v8::Handle<v8::Value> V8Custom::v8HTMLImageElementConstructorCallback(const v8::Arguments& args)
+static v8::Handle<v8::Value> v8HTMLImageElementConstructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLImageElement.Contructor");
@@ -88,10 +70,28 @@ v8::Handle<v8::Value> V8Custom::v8HTMLImageElementConstructorCallback(const v8::
image->setHeight(toInt32(args[1]));
}
- V8DOMWrapper::setDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::NODE), image.get());
+ V8DOMWrapper::setDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::IMAGE), image.get());
image->ref();
V8DOMWrapper::setJSWrapperForDOMNode(image.get(), v8::Persistent<v8::Object>::New(args.Holder()));
return args.Holder();
}
+v8::Persistent<v8::FunctionTemplate> V8HTMLImageElementConstructor::GetTemplate()
+{
+ static v8::Persistent<v8::FunctionTemplate> cachedTemplate;
+ if (!cachedTemplate.IsEmpty())
+ return cachedTemplate;
+
+ v8::HandleScope scope;
+ v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(v8HTMLImageElementConstructorCallback);
+
+ v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
+ instance->SetInternalFieldCount(V8HTMLImageElement::internalFieldCount);
+ result->SetClassName(v8::String::New("HTMLImageElement"));
+ result->Inherit(V8HTMLImageElement::GetTemplate());
+
+ cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(result);
+ return cachedTemplate;
+}
+
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.h b/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.h
index cdce0e0..19ee944 100755
--- a/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.h
+++ b/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.h
@@ -35,12 +35,10 @@
namespace WebCore {
- class V8HTMLImageElementConstructor {
- private:
- static v8::Persistent<v8::FunctionTemplate> GetTemplate();
-
- friend class V8ClassIndex;
- };
+class V8HTMLImageElementConstructor {
+public:
+ static v8::Persistent<v8::FunctionTemplate> GetTemplate();
+};
}
diff --git a/WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp
index 78486b3..a9ac74c 100644
--- a/WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp
@@ -34,7 +34,6 @@
#include "HTMLInputElement.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp b/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp
index 5325933..3113eb5 100644
--- a/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp
@@ -44,25 +44,7 @@
namespace WebCore {
-v8::Persistent<v8::FunctionTemplate> V8HTMLOptionElementConstructor::GetTemplate()
-{
- static v8::Persistent<v8::FunctionTemplate> cachedTemplate;
- if (!cachedTemplate.IsEmpty())
- return cachedTemplate;
-
- v8::HandleScope scope;
- v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(USE_CALLBACK(HTMLOptionElementConstructor));
-
- v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
- instance->SetInternalFieldCount(V8HTMLOptionElement::internalFieldCount);
- result->SetClassName(v8::String::New("HTMLOptionElement"));
- result->Inherit(V8DOMWrapper::getTemplate(V8ClassIndex::HTMLOPTIONELEMENT));
-
- cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(result);
- return cachedTemplate;
-}
-
-v8::Handle<v8::Value> V8Custom::v8HTMLOptionElementConstructorCallback(const v8::Arguments& args)
+static v8::Handle<v8::Value> v8HTMLOptionElementConstructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLOptionElement.Contructor");
@@ -104,10 +86,28 @@ v8::Handle<v8::Value> V8Custom::v8HTMLOptionElementConstructorCallback(const v8:
}
}
- V8DOMWrapper::setDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::NODE), option.get());
+ V8DOMWrapper::setDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::OPTION), option.get());
option->ref();
V8DOMWrapper::setJSWrapperForDOMNode(option.get(), v8::Persistent<v8::Object>::New(args.Holder()));
return args.Holder();
}
+v8::Persistent<v8::FunctionTemplate> V8HTMLOptionElementConstructor::GetTemplate()
+{
+ static v8::Persistent<v8::FunctionTemplate> cachedTemplate;
+ if (!cachedTemplate.IsEmpty())
+ return cachedTemplate;
+
+ v8::HandleScope scope;
+ v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(v8HTMLOptionElementConstructorCallback);
+
+ v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
+ instance->SetInternalFieldCount(V8HTMLOptionElement::internalFieldCount);
+ result->SetClassName(v8::String::New("HTMLOptionElement"));
+ result->Inherit(V8HTMLOptionElement::GetTemplate());
+
+ cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(result);
+ return cachedTemplate;
+}
+
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.h b/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.h
index 70076a5..905a745 100755
--- a/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.h
+++ b/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.h
@@ -35,12 +35,10 @@
namespace WebCore {
- class V8HTMLOptionElementConstructor {
- private:
- static v8::Persistent<v8::FunctionTemplate> GetTemplate();
-
- friend class V8ClassIndex;
- };
+class V8HTMLOptionElementConstructor {
+public:
+ static v8::Persistent<v8::FunctionTemplate> GetTemplate();
+};
}
diff --git a/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp
index 261b5a8..1c114c5 100644
--- a/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp
@@ -33,7 +33,6 @@
#include "ScriptInstance.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8HTMLAppletElement.h"
#include "V8HTMLEmbedElement.h"
#include "V8HTMLObjectElement.h"
diff --git a/WebCore/bindings/v8/custom/V8HistoryCustom.cpp b/WebCore/bindings/v8/custom/V8HistoryCustom.cpp
index 5e9c7c8..6075ec5 100644
--- a/WebCore/bindings/v8/custom/V8HistoryCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HistoryCustom.cpp
@@ -36,7 +36,6 @@
#include "SerializedScriptValue.h"
#include "V8Binding.h"
#include "V8BindingState.h"
-#include "V8CustomBinding.h"
#include "V8DOMWindow.h"
#include "V8Proxy.h"
diff --git a/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
index ad4ed01..054f9ba 100644
--- a/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
@@ -39,12 +39,14 @@
#include "InspectorController.h"
#include "Node.h"
#include "Page.h"
+#include "SerializedScriptValue.h"
#include "V8Binding.h"
#include "V8Database.h"
#include "V8Node.h"
#include "V8Proxy.h"
#include "V8Storage.h"
+#include <wtf/RefPtr.h>
namespace WebCore {
@@ -58,7 +60,7 @@ static void WeakReferenceCallback(v8::Persistent<v8::Value> object, void* parame
static v8::Local<v8::Object> createInjectedScriptHostV8Wrapper(InjectedScriptHost* host)
{
V8ClassIndex::V8WrapperType descriptorType = V8ClassIndex::INJECTEDSCRIPTHOST;
- v8::Local<v8::Function> function = V8DOMWrapper::getTemplate(descriptorType)->GetFunction();
+ v8::Local<v8::Function> function = V8InjectedScriptHost::GetTemplate()->GetFunction();
if (function.IsEmpty()) {
// Return if allocation failed.
return v8::Local<v8::Object>();
@@ -194,6 +196,19 @@ v8::Handle<v8::Value> V8InjectedScriptHost::selectDOMStorageCallback(const v8::A
}
#endif
+v8::Handle<v8::Value> V8InjectedScriptHost::reportDidDispatchOnInjectedScriptCallback(const v8::Arguments& args)
+{
+ INC_STATS("InjectedScriptHost.reportDidDispatchOnInjectedScript()");
+ if (args.Length() < 3)
+ return v8::Undefined();
+ InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
+ int callId = args[0]->ToInt32()->Value();
+ RefPtr<SerializedScriptValue> result(SerializedScriptValue::create(args[1]));
+ bool isException = args[2]->ToBoolean()->Value();
+ host->reportDidDispatchOnInjectedScript(callId, result.get(), isException);
+ return v8::Undefined();
+}
+
InjectedScript InjectedScriptHost::injectedScriptFor(ScriptState* inspectedScriptState)
{
v8::HandleScope handleScope;
diff --git a/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp b/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp
index df63bf1..b823034 100644
--- a/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp
@@ -35,7 +35,6 @@
#include "InspectorFrontendHost.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8LocationCustom.cpp b/WebCore/bindings/v8/custom/V8LocationCustom.cpp
index 7c9c529..b5df601 100644
--- a/WebCore/bindings/v8/custom/V8LocationCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8LocationCustom.cpp
@@ -41,7 +41,6 @@
#include "ScriptController.h"
#include "V8Binding.h"
#include "V8BindingState.h"
-#include "V8CustomBinding.h"
#include "V8CustomEventListener.h"
#include "V8DOMWindow.h"
#include "V8Location.h"
@@ -212,7 +211,7 @@ v8::Handle<v8::Value> V8Location::reloadAccessorGetter(v8::Local<v8::String> nam
{
INC_STATS("DOM.Location.reload._get");
static v8::Persistent<v8::FunctionTemplate> privateTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8Location::reloadCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
- v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::LOCATION, info.This());
+ v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8Location::GetTemplate(), info.This());
if (holder.IsEmpty()) {
// can only reach here by 'object.__proto__.func', and it should passed
// domain security check already
@@ -230,7 +229,7 @@ v8::Handle<v8::Value> V8Location::replaceAccessorGetter(v8::Local<v8::String> na
{
INC_STATS("DOM.Location.replace._get");
static v8::Persistent<v8::FunctionTemplate> privateTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8Location::replaceCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
- v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::LOCATION, info.This());
+ v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8Location::GetTemplate(), info.This());
if (holder.IsEmpty()) {
// can only reach here by 'object.__proto__.func', and it should passed
// domain security check already
@@ -249,7 +248,7 @@ v8::Handle<v8::Value> V8Location::assignAccessorGetter(v8::Local<v8::String> nam
INC_STATS("DOM.Location.assign._get");
static v8::Persistent<v8::FunctionTemplate> privateTemplate =
v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8Location::assignCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
- v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::LOCATION, info.This());
+ v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8Location::GetTemplate(), info.This());
if (holder.IsEmpty()) {
// can only reach here by 'object.__proto__.func', and it should passed
// domain security check already
diff --git a/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp b/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp
index 9f2c080..d41a785 100644
--- a/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp
@@ -72,7 +72,7 @@ v8::Handle<v8::Value> V8MessageEvent::initMessageEventCallback(const v8::Argumen
DOMWindow* sourceArg = 0;
if (args[6]->IsObject()) {
v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(args[6]);
- v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, wrapper);
+ v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), wrapper);
if (!window.IsEmpty())
sourceArg = V8DOMWindow::toNative(window);
}
diff --git a/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp b/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp
index cc70bc5..9890668 100644
--- a/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp
@@ -34,7 +34,6 @@
#include "MessagePort.h"
#include "SerializedScriptValue.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8MessagePortCustom.h"
#include "V8MessagePort.h"
#include "V8Proxy.h"
diff --git a/WebCore/bindings/v8/custom/V8NavigatorCustom.cpp b/WebCore/bindings/v8/custom/V8NavigatorCustom.cpp
index 828d1bc..863ce0e 100644
--- a/WebCore/bindings/v8/custom/V8NavigatorCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8NavigatorCustom.cpp
@@ -1,10 +1,10 @@
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -43,13 +43,6 @@
namespace WebCore {
-#if ENABLE(GEOLOCATION)
-bool V8Navigator::GeolocationEnabled()
-{
- return RuntimeEnabledFeatures::geolocationEnabled();
-}
-#endif
-
v8::Handle<v8::Value> toV8(Navigator* impl)
{
if (!impl)
diff --git a/WebCore/bindings/v8/custom/V8NodeCustom.cpp b/WebCore/bindings/v8/custom/V8NodeCustom.cpp
index 06489fd..7907283 100644
--- a/WebCore/bindings/v8/custom/V8NodeCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8NodeCustom.cpp
@@ -39,7 +39,6 @@
#include "V8Binding.h"
#include "V8CDATASection.h"
#include "V8Comment.h"
-#include "V8CustomBinding.h"
#include "V8CustomEventListener.h"
#include "V8Document.h"
#include "V8DocumentFragment.h"
diff --git a/WebCore/bindings/v8/custom/V8NodeFilterCustom.cpp b/WebCore/bindings/v8/custom/V8NodeFilterCustom.cpp
index 032900c..7bb640b 100644
--- a/WebCore/bindings/v8/custom/V8NodeFilterCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8NodeFilterCustom.cpp
@@ -35,7 +35,6 @@
#include "NodeFilter.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp b/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp
index 5531b48..9c3ab45 100644
--- a/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp
@@ -43,7 +43,6 @@
#include "V8Proxy.h"
#include "V8Utilities.h"
#include "WorkerContext.h"
-#include "WorkerContextExecutionProxy.h"
namespace WebCore {
@@ -91,9 +90,6 @@ v8::Handle<v8::Value> V8NotificationCenter::createHTMLNotificationCallback(const
if (ec)
return throwError(ec);
- if (notificationCenter->context()->isWorkerContext())
- return WorkerContextExecutionProxy::convertToV8Object(V8ClassIndex::NOTIFICATION, notification.get());
-
return toV8(notification.get());
}
@@ -108,9 +104,6 @@ v8::Handle<v8::Value> V8NotificationCenter::createNotificationCallback(const v8:
if (ec)
return throwError(ec);
- if (notificationCenter->context()->isWorkerContext())
- return WorkerContextExecutionProxy::convertToV8Object(V8ClassIndex::NOTIFICATION, notification.get());
-
return toV8(notification.get());
}
diff --git a/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp b/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp
index ab58d1c..7c24ac8 100644
--- a/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp
@@ -35,7 +35,6 @@
#include "SQLResultSetRowList.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp b/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp
index 98fbd9a..b7e7ff2 100644
--- a/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp
@@ -37,7 +37,6 @@
#include "Database.h"
#include "SQLValue.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8CustomSQLStatementCallback.h"
#include "V8CustomSQLStatementErrorCallback.h"
#include "V8Proxy.h"
diff --git a/WebCore/bindings/v8/custom/V8SVGDocumentCustom.cpp b/WebCore/bindings/v8/custom/V8SVGDocumentCustom.cpp
index 4cefc0e..558c03b 100644
--- a/WebCore/bindings/v8/custom/V8SVGDocumentCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8SVGDocumentCustom.cpp
@@ -41,6 +41,8 @@ v8::Handle<v8::Value> toV8(SVGDocument* impl, bool forceNewObject)
if (!impl)
return v8::Null();
v8::Handle<v8::Object> wrapper = V8SVGDocument::wrap(impl, forceNewObject);
+ if (wrapper.IsEmpty())
+ return wrapper;
if (!V8IsolatedContext::getEntered()) {
if (V8Proxy* proxy = V8Proxy::retrieve(impl->frame()))
proxy->windowShell()->updateDocumentWrapper(wrapper);
diff --git a/WebCore/bindings/v8/custom/V8SVGElementInstanceCustom.cpp b/WebCore/bindings/v8/custom/V8SVGElementInstanceCustom.cpp
index 23b5b06..56c37bd 100644
--- a/WebCore/bindings/v8/custom/V8SVGElementInstanceCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8SVGElementInstanceCustom.cpp
@@ -37,7 +37,6 @@
#include "SVGElementInstance.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8CustomEventListener.h"
#include "V8SVGPODTypeWrapper.h"
#include "V8Proxy.h"
diff --git a/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp b/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp
index 129801d..0dae6af 100644
--- a/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp
@@ -35,7 +35,6 @@
#include "SVGLength.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8SVGPODTypeWrapper.h"
#include "V8Proxy.h"
diff --git a/WebCore/bindings/v8/custom/V8SVGMatrixCustom.cpp b/WebCore/bindings/v8/custom/V8SVGMatrixCustom.cpp
index 0a75c9f..f310238 100644
--- a/WebCore/bindings/v8/custom/V8SVGMatrixCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8SVGMatrixCustom.cpp
@@ -31,7 +31,7 @@
#include <config.h>
#if ENABLE(SVG)
-#include "TransformationMatrix.h"
+#include "AffineTransform.h"
#include "SVGException.h"
#include "V8Binding.h"
@@ -50,19 +50,19 @@ v8::Handle<v8::Value> V8SVGMatrix::multiplyCallback(const v8::Arguments& args)
if (!V8SVGMatrix::HasInstance(args[0]))
return throwError("secondMatrix argument was not a SVGMatrix");
- TransformationMatrix m1 = *V8SVGPODTypeWrapper<TransformationMatrix>::toNative(args.Holder());
- TransformationMatrix m2 = *V8SVGPODTypeWrapper<TransformationMatrix>::toNative(v8::Handle<v8::Object>::Cast(args[0]));
+ AffineTransform m1 = *V8SVGPODTypeWrapper<AffineTransform>::toNative(args.Holder());
+ AffineTransform m2 = *V8SVGPODTypeWrapper<AffineTransform>::toNative(v8::Handle<v8::Object>::Cast(args[0]));
- RefPtr<V8SVGStaticPODTypeWrapper<TransformationMatrix> > wrapper = V8SVGStaticPODTypeWrapper<TransformationMatrix>::create(m1.multLeft(m2));
+ RefPtr<V8SVGStaticPODTypeWrapper<AffineTransform> > wrapper = V8SVGStaticPODTypeWrapper<AffineTransform>::create(m1.multLeft(m2));
return toV8(wrapper.get());
}
v8::Handle<v8::Value> V8SVGMatrix::inverseCallback(const v8::Arguments& args)
{
INC_STATS("DOM.SVGMatrix.inverse()");
- TransformationMatrix matrix = *V8SVGPODTypeWrapper<TransformationMatrix>::toNative(args.Holder());
+ AffineTransform matrix = *V8SVGPODTypeWrapper<AffineTransform>::toNative(args.Holder());
ExceptionCode ec = 0;
- TransformationMatrix result = matrix.inverse();
+ AffineTransform result = matrix.inverse();
if (!matrix.isInvertible())
ec = SVGException::SVG_MATRIX_NOT_INVERTABLE;
@@ -72,18 +72,18 @@ v8::Handle<v8::Value> V8SVGMatrix::inverseCallback(const v8::Arguments& args)
return v8::Handle<v8::Value>();
}
- RefPtr<V8SVGStaticPODTypeWrapper<TransformationMatrix> > wrapper = V8SVGStaticPODTypeWrapper<TransformationMatrix>::create(result);
+ RefPtr<V8SVGStaticPODTypeWrapper<AffineTransform> > wrapper = V8SVGStaticPODTypeWrapper<AffineTransform>::create(result);
return toV8(wrapper.get());
}
v8::Handle<v8::Value> V8SVGMatrix::rotateFromVectorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.SVGMatrix.rotateFromVector()");
- TransformationMatrix matrix = *V8SVGPODTypeWrapper<TransformationMatrix>::toNative(args.Holder());
+ AffineTransform matrix = *V8SVGPODTypeWrapper<AffineTransform>::toNative(args.Holder());
ExceptionCode ec = 0;
float x = toFloat(args[0]);
float y = toFloat(args[1]);
- TransformationMatrix result = matrix;
+ AffineTransform result = matrix;
result.rotateFromVector(x, y);
if (x == 0.0 || y == 0.0)
ec = SVGException::SVG_INVALID_VALUE_ERR;
@@ -93,7 +93,7 @@ v8::Handle<v8::Value> V8SVGMatrix::rotateFromVectorCallback(const v8::Arguments&
return v8::Handle<v8::Value>();
}
- RefPtr<V8SVGStaticPODTypeWrapper<TransformationMatrix> > wrapper = V8SVGStaticPODTypeWrapper<TransformationMatrix>::create(result);
+ RefPtr<V8SVGStaticPODTypeWrapper<AffineTransform> > wrapper = V8SVGStaticPODTypeWrapper<AffineTransform>::create(result);
return toV8(wrapper.get());
}
diff --git a/WebCore/bindings/v8/custom/V8SharedWorkerCustom.cpp b/WebCore/bindings/v8/custom/V8SharedWorkerCustom.cpp
index 549de94..f69675a 100644
--- a/WebCore/bindings/v8/custom/V8SharedWorkerCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8SharedWorkerCustom.cpp
@@ -37,7 +37,6 @@
#include "ExceptionCode.h"
#include "Frame.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
#include "V8Utilities.h"
#include "WorkerContext.h"
diff --git a/WebCore/bindings/v8/custom/V8StorageCustom.cpp b/WebCore/bindings/v8/custom/V8StorageCustom.cpp
index ff3ac5e..70d8a09 100755
--- a/WebCore/bindings/v8/custom/V8StorageCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8StorageCustom.cpp
@@ -35,7 +35,6 @@
#include "Storage.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8WebGLArrayBufferCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLArrayBufferCustom.cpp
index bc167c5..5b54563 100644
--- a/WebCore/bindings/v8/custom/V8WebGLArrayBufferCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLArrayBufferCustom.cpp
@@ -36,7 +36,6 @@
#include "V8Binding.h"
#include "V8WebGLArrayBuffer.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8WebGLArrayCustom.h b/WebCore/bindings/v8/custom/V8WebGLArrayCustom.h
index 6a702f5..beea8e6 100644
--- a/WebCore/bindings/v8/custom/V8WebGLArrayCustom.h
+++ b/WebCore/bindings/v8/custom/V8WebGLArrayCustom.h
@@ -36,7 +36,6 @@
#include "V8Binding.h"
#include "V8WebGLArrayBuffer.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8WebGLByteArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLByteArrayCustom.cpp
index 95f6879..dd6163a 100644
--- a/WebCore/bindings/v8/custom/V8WebGLByteArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLByteArrayCustom.cpp
@@ -39,7 +39,6 @@
#include "V8WebGLArrayBuffer.h"
#include "V8WebGLArrayCustom.h"
#include "V8WebGLByteArray.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8WebGLFloatArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLFloatArrayCustom.cpp
index 5882450..3fb8865 100644
--- a/WebCore/bindings/v8/custom/V8WebGLFloatArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLFloatArrayCustom.cpp
@@ -39,7 +39,6 @@
#include "V8WebGLArrayBuffer.h"
#include "V8WebGLArrayCustom.h"
#include "V8WebGLFloatArray.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8WebGLIntArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLIntArrayCustom.cpp
index 7e2f2ed..0141a0b 100644
--- a/WebCore/bindings/v8/custom/V8WebGLIntArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLIntArrayCustom.cpp
@@ -39,7 +39,6 @@
#include "V8WebGLArrayBuffer.h"
#include "V8WebGLArrayCustom.h"
#include "V8WebGLIntArray.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8WebGLShortArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLShortArrayCustom.cpp
index 4cbccf5..5a2408e 100644
--- a/WebCore/bindings/v8/custom/V8WebGLShortArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLShortArrayCustom.cpp
@@ -39,7 +39,6 @@
#include "V8WebGLArrayBuffer.h"
#include "V8WebGLArrayCustom.h"
#include "V8WebGLShortArray.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp
index 962e390..5a30ace 100644
--- a/WebCore/bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp
@@ -39,7 +39,6 @@
#include "V8WebGLArrayBuffer.h"
#include "V8WebGLArrayCustom.h"
#include "V8WebGLUnsignedByteArray.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp
index eb0b7cf..cefc60e 100644
--- a/WebCore/bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp
@@ -39,7 +39,6 @@
#include "V8WebGLArrayBuffer.h"
#include "V8WebGLArrayCustom.h"
#include "V8WebGLUnsignedIntArray.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp
index 5f30de3..56e34b8 100644
--- a/WebCore/bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp
@@ -39,7 +39,6 @@
#include "V8WebGLArrayBuffer.h"
#include "V8WebGLArrayCustom.h"
#include "V8WebGLUnsignedShortArray.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp b/WebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp
index 4e0d575..58f810b 100755
--- a/WebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp
@@ -32,7 +32,6 @@
#include "V8WebKitPoint.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8DOMWrapper.h"
#include "V8Index.h"
#include "V8Proxy.h"
diff --git a/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp b/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp
index 9d54f8e..7677e27 100755
--- a/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp
@@ -35,10 +35,8 @@
#include "DOMTimer.h"
#include "ExceptionCode.h"
-#include "RuntimeEnabledFeatures.h"
#include "ScheduledAction.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
#include "V8Utilities.h"
#include "V8WorkerContextEventListener.h"
@@ -48,20 +46,6 @@
namespace WebCore {
-#if ENABLE(NOTIFICATIONS)
-bool V8WorkerContext::WebkitNotificationsEnabled()
-{
- return RuntimeEnabledFeatures::notificationsEnabled();
-}
-#endif
-
-#if ENABLE(WEB_SOCKETS)
-bool V8WorkerContext::WebSocketEnabled()
-{
- return WebSocket::isAvailable();
-}
-#endif
-
v8::Handle<v8::Value> SetTimeoutOrInterval(const v8::Arguments& args, bool singleShot)
{
WorkerContext* workerContext = V8WorkerContext::toNative(args.Holder());
@@ -174,6 +158,16 @@ v8::Handle<v8::Value> V8WorkerContext::removeEventListenerCallback(const v8::Arg
return v8::Undefined();
}
+v8::Handle<v8::Value> toV8(WorkerContext* impl)
+{
+ if (!impl)
+ return v8::Null();
+
+ v8::Handle<v8::Object> global = impl->script()->proxy()->context()->Global();
+ ASSERT(!global.IsEmpty());
+ return global;
+}
+
} // namespace WebCore
#endif // ENABLE(WORKERS)
diff --git a/WebCore/bindings/v8/custom/V8WorkerCustom.cpp b/WebCore/bindings/v8/custom/V8WorkerCustom.cpp
index ffca2a4..6b41246 100755
--- a/WebCore/bindings/v8/custom/V8WorkerCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WorkerCustom.cpp
@@ -39,7 +39,6 @@
#include "Frame.h"
#include "SerializedScriptValue.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8MessagePortCustom.h"
#include "V8Proxy.h"
#include "V8Utilities.h"
diff --git a/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp b/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp
index e31e05f..f50248b 100644
--- a/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp
@@ -33,7 +33,6 @@
#include "Frame.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
#include "V8Utilities.h"
#include "WorkerContext.h"
diff --git a/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp b/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
index d7cdcd1..d10c418 100644
--- a/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
@@ -34,7 +34,6 @@
#include "Frame.h"
#include "V8Binding.h"
#include "V8Blob.h"
-#include "V8CustomBinding.h"
#include "V8Document.h"
#include "V8HTMLDocument.h"
#include "V8Proxy.h"
diff --git a/WebCore/bindings/v8/custom/V8XMLHttpRequestUploadCustom.cpp b/WebCore/bindings/v8/custom/V8XMLHttpRequestUploadCustom.cpp
index 0690189..c6c31bf 100644
--- a/WebCore/bindings/v8/custom/V8XMLHttpRequestUploadCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8XMLHttpRequestUploadCustom.cpp
@@ -33,7 +33,6 @@
#include "ExceptionCode.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
#include "V8Utilities.h"
#include "XMLHttpRequest.h"
diff --git a/WebCore/bridge/IdentifierRep.h b/WebCore/bridge/IdentifierRep.h
index 8128bf8..99bae0b 100644
--- a/WebCore/bridge/IdentifierRep.h
+++ b/WebCore/bridge/IdentifierRep.h
@@ -28,6 +28,7 @@
#include <wtf/Assertions.h>
#include <wtf/FastAllocBase.h>
+#include <wtf/StringExtras.h>
#include <string.h>
namespace WebCore {
@@ -54,7 +55,7 @@ private:
IdentifierRep(const char* name)
: m_isString(true)
{
- m_value.m_string = strdup(name);
+ m_value.m_string = fastStrDup(name);
}
~IdentifierRep()
diff --git a/WebCore/bridge/NP_jsobject.cpp b/WebCore/bridge/NP_jsobject.cpp
index a30b6d7..09851df 100644
--- a/WebCore/bridge/NP_jsobject.cpp
+++ b/WebCore/bridge/NP_jsobject.cpp
@@ -30,6 +30,7 @@
#include "NP_jsobject.h"
#include "PlatformString.h"
+#include "PluginView.h"
#include "StringSourceProvider.h"
#include "c_utility.h"
#include "c_instance.h"
@@ -190,7 +191,7 @@ bool _NPN_Invoke(NPP npp, NPObject* o, NPIdentifier methodName, const NPVariant*
return true;
}
-bool _NPN_Evaluate(NPP, NPObject* o, NPString* s, NPVariant* variant)
+bool _NPN_Evaluate(NPP instance, NPObject* o, NPString* s, NPVariant* variant)
{
if (o->_class == NPScriptObjectClass) {
JavaScriptObject* obj = reinterpret_cast<JavaScriptObject*>(o);
@@ -199,6 +200,10 @@ bool _NPN_Evaluate(NPP, NPObject* o, NPString* s, NPVariant* variant)
if (!rootObject || !rootObject->isValid())
return false;
+ // There is a crash in Flash when evaluating a script that destroys the
+ // PluginView, so we destroy it asynchronously.
+ PluginView::keepAlive(instance);
+
ExecState* exec = rootObject->globalObject()->globalExec();
JSLock lock(SilenceAssertionsOnly);
String scriptString = convertNPStringToUTF16(s);
diff --git a/WebCore/bridge/c/c_instance.h b/WebCore/bridge/c/c_instance.h
index 7109582..abbabad 100644
--- a/WebCore/bridge/c/c_instance.h
+++ b/WebCore/bridge/c/c_instance.h
@@ -50,6 +50,7 @@ public:
}
static void setGlobalException(JSC::UString exception);
+ static void moveGlobalExceptionToExecState(ExecState*);
~CInstance ();
@@ -74,7 +75,6 @@ public:
NPObject *getObject() const { return _object; }
private:
- static void moveGlobalExceptionToExecState(ExecState* exec);
CInstance(NPObject*, PassRefPtr<RootObject>);
mutable CClass *_class;
diff --git a/WebCore/bridge/c/c_runtime.cpp b/WebCore/bridge/c/c_runtime.cpp
index e9a7bb6..e038cd4 100644
--- a/WebCore/bridge/c/c_runtime.cpp
+++ b/WebCore/bridge/c/c_runtime.cpp
@@ -49,6 +49,7 @@ JSValue CField::valueFromInstance(ExecState* exec, const Instance* inst) const
{
JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly);
result = obj->_class->getProperty(obj, _fieldIdentifier, &property);
+ CInstance::moveGlobalExceptionToExecState(exec);
}
if (result) {
JSValue result = convertNPVariantToValue(exec, &property, instance->rootObject());
@@ -70,6 +71,7 @@ void CField::setValueToInstance(ExecState *exec, const Instance *inst, JSValue a
{
JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly);
obj->_class->setProperty(obj, _fieldIdentifier, &variant);
+ CInstance::moveGlobalExceptionToExecState(exec);
}
_NPN_ReleaseVariantValue(&variant);
diff --git a/WebCore/bridge/jni/JNIBridge.cpp b/WebCore/bridge/jni/JNIBridge.cpp
index 3329ba8..f8a3979 100644
--- a/WebCore/bridge/jni/JNIBridge.cpp
+++ b/WebCore/bridge/jni/JNIBridge.cpp
@@ -107,7 +107,7 @@ JavaMethod::JavaMethod(JNIEnv* env, jobject aMethod)
JavaMethod::~JavaMethod()
{
if (m_signature)
- free(m_signature);
+ fastFree(m_signature);
delete[] m_parameters;
};
@@ -119,7 +119,7 @@ static void appendClassName(StringBuilder& builder, const char* className)
ASSERT(JSLock::lockCount() > 0);
#endif
- char* c = strdup(className);
+ char* c = fastStrDup(className);
char* result = c;
while (*c) {
@@ -130,7 +130,7 @@ static void appendClassName(StringBuilder& builder, const char* className)
builder.append(result);
- free(result);
+ fastFree(result);
}
const char* JavaMethod::signature() const
@@ -169,7 +169,7 @@ const char* JavaMethod::signature() const
}
String signatureString = signatureBuilder.toString();
- m_signature = strdup(signatureString.utf8().data());
+ m_signature = fastStrDup(signatureString.utf8().data());
}
return m_signature;
diff --git a/WebCore/bridge/jni/jsc/JavaClassJSC.cpp b/WebCore/bridge/jni/jsc/JavaClassJSC.cpp
index bbe3871..ec5c172 100644
--- a/WebCore/bridge/jni/jsc/JavaClassJSC.cpp
+++ b/WebCore/bridge/jni/jsc/JavaClassJSC.cpp
@@ -41,16 +41,16 @@ JavaClass::JavaClass(jobject anInstance)
if (!aClass) {
fprintf(stderr, "%s: unable to call getClass on instance %p\n", __PRETTY_FUNCTION__, anInstance);
- m_name = strdup("<Unknown>");
+ m_name = fastStrDup("<Unknown>");
return;
}
if (jstring className = (jstring)callJNIMethod<jobject>(aClass, "getName", "()Ljava/lang/String;")) {
const char* classNameC = getCharactersFromJString(className);
- m_name = strdup(classNameC);
+ m_name = fastStrDup(classNameC);
releaseCharactersForJString(className, classNameC);
} else
- m_name = strdup("<Unknown>");
+ m_name = fastStrDup("<Unknown>");
int i;
JNIEnv* env = getJNIEnv();
@@ -97,7 +97,7 @@ JavaClass::JavaClass(jobject anInstance)
JavaClass::~JavaClass()
{
- free(const_cast<char*>(m_name));
+ fastFree(const_cast<char*>(m_name));
JSLock lock(SilenceAssertionsOnly);
diff --git a/WebCore/bridge/jni/jsc/JavaInstanceJSC.h b/WebCore/bridge/jni/jsc/JavaInstanceJSC.h
index d7b6102..a46c6d3 100644
--- a/WebCore/bridge/jni/jsc/JavaInstanceJSC.h
+++ b/WebCore/bridge/jni/jsc/JavaInstanceJSC.h
@@ -50,10 +50,6 @@ public:
jobject instance() const { return m_instance; }
void setInstance(jobject instance) { m_instance = instance; }
-protected:
- JObjectWrapper(jobject instance);
- ~JObjectWrapper();
-
void ref() { m_refCount++; }
void deref()
{
@@ -61,6 +57,10 @@ protected:
delete this;
}
+protected:
+ JObjectWrapper(jobject instance);
+ ~JObjectWrapper();
+
jobject m_instance;
private:
diff --git a/WebCore/bridge/jni/v8/JavaInstanceV8.h b/WebCore/bridge/jni/v8/JavaInstanceV8.h
index c18f2d6..c928c05 100644
--- a/WebCore/bridge/jni/v8/JavaInstanceV8.h
+++ b/WebCore/bridge/jni/v8/JavaInstanceV8.h
@@ -50,10 +50,6 @@ public:
jobject instance() const { return m_instance; }
void setInstance(jobject instance) { m_instance = instance; }
-protected:
- JObjectWrapper(jobject);
- ~JObjectWrapper();
-
void ref() { m_refCount++; }
void deref()
{
@@ -61,6 +57,10 @@ protected:
delete this;
}
+protected:
+ JObjectWrapper(jobject);
+ ~JObjectWrapper();
+
jobject m_instance;
private:
diff --git a/WebCore/css/CSSFontFaceSource.cpp b/WebCore/css/CSSFontFaceSource.cpp
index 111cea2..1354e68 100644
--- a/WebCore/css/CSSFontFaceSource.cpp
+++ b/WebCore/css/CSSFontFaceSource.cpp
@@ -107,8 +107,7 @@ SimpleFontData* CSSFontFaceSource::getFontData(const FontDescription& fontDescri
#else
if (!m_font) {
#endif
- FontPlatformData* data = fontCache()->getCachedFontPlatformData(fontDescription, m_string);
- SimpleFontData* fontData = fontCache()->getCachedFontData(data);
+ SimpleFontData* fontData = fontCache()->getCachedFontData(fontDescription, m_string);
// We're local. Just return a SimpleFontData from the normal cache.
return fontData;
@@ -179,10 +178,11 @@ SimpleFontData* CSSFontFaceSource::getFontData(const FontDescription& fontDescri
if (DocLoader* docLoader = fontSelector->docLoader())
m_font->beginLoadIfNeeded(docLoader);
// FIXME: m_string is a URL so it makes no sense to pass it as a family name.
- FontPlatformData* tempData = fontCache()->getCachedFontPlatformData(fontDescription, m_string);
+ SimpleFontData* tempData = fontCache()->getCachedFontData(fontDescription, m_string);
if (!tempData)
tempData = fontCache()->getLastResortFallbackFont(fontDescription);
- fontData.set(new SimpleFontData(*tempData, true, true));
+
+ fontData.set(new SimpleFontData(tempData->platformData(), true, true));
}
m_fontDataTable.set(hashKey, fontData.get());
diff --git a/WebCore/css/CSSFontSelector.cpp b/WebCore/css/CSSFontSelector.cpp
index ce3253c..56ee261 100644
--- a/WebCore/css/CSSFontSelector.cpp
+++ b/WebCore/css/CSSFontSelector.cpp
@@ -394,7 +394,7 @@ static FontData* fontDataForGenericFamily(Document* document, const FontDescript
genericFamily = settings->standardFontFamily();
if (!genericFamily.isEmpty())
- return fontCache()->getCachedFontData(fontCache()->getCachedFontPlatformData(fontDescription, genericFamily));
+ return fontCache()->getCachedFontData(fontDescription, genericFamily);
return 0;
}
diff --git a/WebCore/css/CSSImportRule.cpp b/WebCore/css/CSSImportRule.cpp
index 7ad5456..95ed032 100644
--- a/WebCore/css/CSSImportRule.cpp
+++ b/WebCore/css/CSSImportRule.cpp
@@ -117,16 +117,16 @@ void CSSImportRule::insertedIntoParent()
return;
String absHref = m_strHref;
- if (!parentSheet->putativeBaseURL().isNull())
+ if (!parentSheet->finalURL().isNull())
// use parent styleheet's URL as the base URL
- absHref = KURL(parentSheet->putativeBaseURL(), m_strHref).string();
+ absHref = KURL(parentSheet->finalURL(), m_strHref).string();
// Check for a cycle in our import chain. If we encounter a stylesheet
// in our parent chain with the same URL, then just bail.
StyleBase* root = this;
for (StyleBase* curr = parent(); curr; curr = curr->parent()) {
- // FIXME: This is wrong if the putativeBaseURL was updated via document::updateBaseURL.
- if (curr->isCSSStyleSheet() && absHref == static_cast<CSSStyleSheet*>(curr)->putativeBaseURL().string())
+ // FIXME: This is wrong if the finalURL was updated via document::updateBaseURL.
+ if (curr->isCSSStyleSheet() && absHref == static_cast<CSSStyleSheet*>(curr)->finalURL().string())
return;
root = curr;
}
diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp
index e6ff1f0..f5b2cbc 100644
--- a/WebCore/css/CSSParser.cpp
+++ b/WebCore/css/CSSParser.cpp
@@ -623,7 +623,7 @@ bool CSSParser::parseValue(int propId, bool important)
return true;
}
- bool valid_primitive = false;
+ bool validPrimitive = false;
RefPtr<CSSValue> parsedValue;
switch (static_cast<CSSPropertyID>(propId)) {
@@ -639,13 +639,13 @@ bool CSSParser::parseValue(int propId, bool important)
case CSSPropertySize: // <length>{1,2} | auto | portrait | landscape | inherit
case CSSPropertyQuotes: // [<string> <string>]+ | none | inherit
if (id)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyUnicodeBidi: // normal | embed | bidi-override | inherit
if (id == CSSValueNormal ||
id == CSSValueEmbed ||
id == CSSValueBidiOverride)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyPosition: // static | relative | absolute | fixed | inherit
@@ -653,7 +653,7 @@ bool CSSParser::parseValue(int propId, bool important)
id == CSSValueRelative ||
id == CSSValueAbsolute ||
id == CSSValueFixed)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyPageBreakAfter: // auto | always | avoid | left | right | inherit
@@ -665,19 +665,19 @@ bool CSSParser::parseValue(int propId, bool important)
id == CSSValueAvoid ||
id == CSSValueLeft ||
id == CSSValueRight)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyPageBreakInside: // avoid | auto | inherit
case CSSPropertyWebkitColumnBreakInside:
if (id == CSSValueAuto || id == CSSValueAvoid)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyEmptyCells: // show | hide | inherit
if (id == CSSValueShow ||
id == CSSValueHide)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyContent: // [ <string> | <uri> | <counter> | attr(X) | open-quote |
@@ -690,12 +690,12 @@ bool CSSParser::parseValue(int propId, bool important)
id == CSSValuePreWrap ||
id == CSSValuePreLine ||
id == CSSValueNowrap)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyClip: // <shape> | auto | inherit
if (id == CSSValueAuto)
- valid_primitive = true;
+ validPrimitive = true;
else if (value->unit == CSSParserValue::Function)
return parseShape(propId, important);
break;
@@ -706,17 +706,17 @@ bool CSSParser::parseValue(int propId, bool important)
case CSSPropertyCaptionSide: // top | bottom | left | right | inherit
if (id == CSSValueLeft || id == CSSValueRight ||
id == CSSValueTop || id == CSSValueBottom)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyBorderCollapse: // collapse | separate | inherit
if (id == CSSValueCollapse || id == CSSValueSeparate)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyVisibility: // visible | hidden | collapse | inherit
if (id == CSSValueVisible || id == CSSValueHidden || id == CSSValueCollapse)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyOverflow: {
@@ -731,19 +731,19 @@ bool CSSParser::parseValue(int propId, bool important)
case CSSPropertyOverflowY: // visible | hidden | scroll | auto | marquee | overlay | inherit
if (id == CSSValueVisible || id == CSSValueHidden || id == CSSValueScroll || id == CSSValueAuto ||
id == CSSValueOverlay || id == CSSValueWebkitMarquee)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyListStylePosition: // inside | outside | inherit
if (id == CSSValueInside || id == CSSValueOutside)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyListStyleType:
// See section CSS_PROP_LIST_STYLE_TYPE of file CSSValueKeywords.in
// for the list of supported list-style-types.
if ((id >= CSSValueDisc && id <= CSSValueKatakanaIroha) || id == CSSValueNone)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyDisplay:
@@ -755,41 +755,41 @@ bool CSSParser::parseValue(int propId, bool important)
#else
if ((id >= CSSValueInline && id <= CSSValueWebkitInlineBox) || id == CSSValueNone)
#endif
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyDirection: // ltr | rtl | inherit
if (id == CSSValueLtr || id == CSSValueRtl)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyTextTransform: // capitalize | uppercase | lowercase | none | inherit
if ((id >= CSSValueCapitalize && id <= CSSValueLowercase) || id == CSSValueNone)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyFloat: // left | right | none | inherit + center for buggy CSS
if (id == CSSValueLeft || id == CSSValueRight ||
id == CSSValueNone || id == CSSValueCenter)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyClear: // none | left | right | both | inherit
if (id == CSSValueNone || id == CSSValueLeft ||
id == CSSValueRight|| id == CSSValueBoth)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyTextAlign:
// left | right | center | justify | webkit_left | webkit_right | webkit_center | start | end | <string> | inherit
if ((id >= CSSValueWebkitAuto && id <= CSSValueWebkitCenter) || id == CSSValueStart || id == CSSValueEnd ||
value->unit == CSSPrimitiveValue::CSS_STRING)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyOutlineStyle: // (<border-style> except hidden) | auto | inherit
if (id == CSSValueAuto || id == CSSValueNone || (id >= CSSValueInset && id <= CSSValueDouble))
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyBorderTopStyle: //// <border-style> | inherit
@@ -798,7 +798,7 @@ bool CSSParser::parseValue(int propId, bool important)
case CSSPropertyBorderLeftStyle:
case CSSPropertyWebkitColumnRuleStyle:
if (id >= CSSValueNone && id <= CSSValueDouble)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyFontWeight: // normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit
@@ -825,13 +825,13 @@ bool CSSParser::parseValue(int propId, bool important)
}
case CSSPropertyWebkitBorderHorizontalSpacing:
case CSSPropertyWebkitBorderVerticalSpacing:
- valid_primitive = validUnit(value, FLength|FNonNeg, m_strict);
+ validPrimitive = validUnit(value, FLength | FNonNeg, m_strict);
break;
case CSSPropertyOutlineColor: // <color> | invert | inherit
// Outline color has "invert" as additional keyword.
// Also, we want to allow the special focus color even in strict parsing mode.
if (propId == CSSPropertyOutlineColor && (id == CSSValueInvert || id == CSSValueWebkitFocusRingColor)) {
- valid_primitive = true;
+ validPrimitive = true;
break;
}
/* nobreak */
@@ -848,13 +848,13 @@ bool CSSParser::parseValue(int propId, bool important)
case CSSPropertyWebkitTextFillColor:
case CSSPropertyWebkitTextStrokeColor:
if (id == CSSValueWebkitText)
- valid_primitive = true; // Always allow this, even when strict parsing is on,
+ validPrimitive = true; // Always allow this, even when strict parsing is on,
// since we use this in our UA sheets.
else if (id == CSSValueCurrentcolor)
- valid_primitive = true;
+ validPrimitive = true;
else if ((id >= CSSValueAqua && id <= CSSValueWindowtext) || id == CSSValueMenu ||
(id >= CSSValueWebkitFocusRingColor && id < CSSValueWebkitText && !m_strict)) {
- valid_primitive = true;
+ validPrimitive = true;
} else {
parsedValue = parseColor();
if (parsedValue)
@@ -911,9 +911,9 @@ bool CSSParser::parseValue(int propId, bool important)
id = value->id;
if (!m_strict && value->id == CSSValueHand) { // MSIE 5 compatibility :/
id = CSSValuePointer;
- valid_primitive = true;
+ validPrimitive = true;
} else if ((value->id >= CSSValueAuto && value->id <= CSSValueWebkitGrabbing) || value->id == CSSValueCopy || value->id == CSSValueNone)
- valid_primitive = true;
+ validPrimitive = true;
break;
}
@@ -991,27 +991,27 @@ bool CSSParser::parseValue(int propId, bool important)
case CSSPropertyBorderLeftWidth:
case CSSPropertyWebkitColumnRuleWidth:
if (id == CSSValueThin || id == CSSValueMedium || id == CSSValueThick)
- valid_primitive = true;
+ validPrimitive = true;
else
- valid_primitive = validUnit(value, FLength, m_strict);
+ validPrimitive = validUnit(value, FLength, m_strict);
break;
case CSSPropertyLetterSpacing: // normal | <length> | inherit
case CSSPropertyWordSpacing: // normal | <length> | inherit
if (id == CSSValueNormal)
- valid_primitive = true;
+ validPrimitive = true;
else
- valid_primitive = validUnit(value, FLength, m_strict);
+ validPrimitive = validUnit(value, FLength, m_strict);
break;
case CSSPropertyWordBreak: // normal | break-all | break-word (this is a custom extension)
if (id == CSSValueNormal || id == CSSValueBreakAll || id == CSSValueBreakWord)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyWordWrap: // normal | break-word
if (id == CSSValueNormal || id == CSSValueBreakWord)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyTextIndent: // <length> | <percentage> | inherit
@@ -1020,30 +1020,30 @@ bool CSSParser::parseValue(int propId, bool important)
case CSSPropertyPaddingBottom: // <length> | <percentage>
case CSSPropertyPaddingLeft: ////
case CSSPropertyWebkitPaddingStart:
- valid_primitive = (!id && validUnit(value, FLength|FPercent, m_strict));
+ validPrimitive = (!id && validUnit(value, FLength | FPercent, m_strict));
break;
case CSSPropertyMaxHeight: // <length> | <percentage> | none | inherit
case CSSPropertyMaxWidth: // <length> | <percentage> | none | inherit
if (id == CSSValueNone || id == CSSValueIntrinsic || id == CSSValueMinIntrinsic) {
- valid_primitive = true;
+ validPrimitive = true;
break;
}
/* nobreak */
case CSSPropertyMinHeight: // <length> | <percentage> | inherit
case CSSPropertyMinWidth: // <length> | <percentage> | inherit
if (id == CSSValueIntrinsic || id == CSSValueMinIntrinsic)
- valid_primitive = true;
+ validPrimitive = true;
else
- valid_primitive = (!id && validUnit(value, FLength|FPercent|FNonNeg, m_strict));
+ validPrimitive = (!id && validUnit(value, FLength | FPercent | FNonNeg, m_strict));
break;
case CSSPropertyFontSize:
// <absolute-size> | <relative-size> | <length> | <percentage> | inherit
if (id >= CSSValueXxSmall && id <= CSSValueLarger)
- valid_primitive = true;
+ validPrimitive = true;
else
- valid_primitive = (validUnit(value, FLength|FPercent|FNonNeg, m_strict));
+ validPrimitive = (validUnit(value, FLength | FPercent | FNonNeg, m_strict));
break;
case CSSPropertyFontStyle: // normal | italic | oblique | inherit
@@ -1057,18 +1057,18 @@ bool CSSParser::parseValue(int propId, bool important)
// <percentage> | <length> | inherit
if (id >= CSSValueBaseline && id <= CSSValueWebkitBaselineMiddle)
- valid_primitive = true;
+ validPrimitive = true;
else
- valid_primitive = (!id && validUnit(value, FLength|FPercent, m_strict));
+ validPrimitive = (!id && validUnit(value, FLength | FPercent, m_strict));
break;
case CSSPropertyHeight: // <length> | <percentage> | auto | inherit
case CSSPropertyWidth: // <length> | <percentage> | auto | inherit
if (id == CSSValueAuto || id == CSSValueIntrinsic || id == CSSValueMinIntrinsic)
- valid_primitive = true;
+ validPrimitive = true;
else
// ### handle multilength case where we allow relative units
- valid_primitive = (!id && validUnit(value, FLength|FPercent|FNonNeg, m_strict));
+ validPrimitive = (!id && validUnit(value, FLength | FPercent | FNonNeg, m_strict));
break;
case CSSPropertyBottom: // <length> | <percentage> | auto | inherit
@@ -1081,38 +1081,38 @@ bool CSSParser::parseValue(int propId, bool important)
case CSSPropertyMarginLeft: ////
case CSSPropertyWebkitMarginStart:
if (id == CSSValueAuto)
- valid_primitive = true;
+ validPrimitive = true;
else
- valid_primitive = (!id && validUnit(value, FLength|FPercent, m_strict));
+ validPrimitive = (!id && validUnit(value, FLength | FPercent, m_strict));
break;
case CSSPropertyZIndex: // auto | <integer> | inherit
if (id == CSSValueAuto) {
- valid_primitive = true;
+ validPrimitive = true;
break;
}
/* nobreak */
case CSSPropertyOrphans: // <integer> | inherit
case CSSPropertyWidows: // <integer> | inherit
// ### not supported later on
- valid_primitive = (!id && validUnit(value, FInteger, false));
+ validPrimitive = (!id && validUnit(value, FInteger, false));
break;
case CSSPropertyLineHeight: // normal | <number> | <length> | <percentage> | inherit
if (id == CSSValueNormal)
- valid_primitive = true;
+ validPrimitive = true;
else
- valid_primitive = (!id && validUnit(value, FNumber|FLength|FPercent|FNonNeg, m_strict));
+ validPrimitive = (!id && validUnit(value, FNumber | FLength | FPercent | FNonNeg, m_strict));
break;
case CSSPropertyCounterIncrement: // [ <identifier> <integer>? ]+ | none | inherit
if (id != CSSValueNone)
return parseCounter(propId, 1, important);
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyCounterReset: // [ <identifier> <integer>? ]+ | none | inherit
if (id != CSSValueNone)
return parseCounter(propId, 0, important);
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyFontFamily:
// [[ <family-name> | <generic-family> ],]* [<family-name> | <generic-family>] | inherit
@@ -1125,11 +1125,11 @@ bool CSSParser::parseValue(int propId, bool important)
case CSSPropertyWebkitTextDecorationsInEffect:
// none | [ underline || overline || line-through || blink ] | inherit
if (id == CSSValueNone) {
- valid_primitive = true;
+ validPrimitive = true;
} else {
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
- bool is_valid = true;
- while (is_valid && value) {
+ bool isValid = true;
+ while (isValid && value) {
switch (value->id) {
case CSSValueBlink:
break;
@@ -1139,11 +1139,11 @@ bool CSSParser::parseValue(int propId, bool important)
list->append(CSSPrimitiveValue::createIdentifier(value->id));
break;
default:
- is_valid = false;
+ isValid = false;
}
value = m_valueList->next();
}
- if (list->length() && is_valid) {
+ if (list->length() && isValid) {
parsedValue = list.release();
m_valueList->next();
}
@@ -1152,14 +1152,14 @@ bool CSSParser::parseValue(int propId, bool important)
case CSSPropertyZoom: // normal | reset | document | <number> | <percentage> | inherit
if (id == CSSValueNormal || id == CSSValueReset || id == CSSValueDocument)
- valid_primitive = true;
+ validPrimitive = true;
else
- valid_primitive = (!id && validUnit(value, FNumber | FPercent | FNonNeg, true));
+ validPrimitive = (!id && validUnit(value, FNumber | FPercent | FNonNeg, true));
break;
case CSSPropertyTableLayout: // auto | fixed | inherit
if (id == CSSValueAuto || id == CSSValueFixed)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertySrc: // Only used within @font-face, so cannot use inherit | initial or be !important. This is a list of urls or local references.
@@ -1171,13 +1171,13 @@ bool CSSParser::parseValue(int propId, bool important)
/* CSS3 properties */
case CSSPropertyWebkitAppearance:
if ((id >= CSSValueCheckbox && id <= CSSValueTextarea) || id == CSSValueNone)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyWebkitBinding:
#if ENABLE(XBL)
if (id == CSSValueNone)
- valid_primitive = true;
+ validPrimitive = true;
else {
RefPtr<CSSValueList> values = CSSValueList::createCommaSeparated();
CSSParserValue* val;
@@ -1211,7 +1211,7 @@ bool CSSParser::parseValue(int propId, bool important)
case CSSPropertyWebkitBorderImage:
case CSSPropertyWebkitMaskBoxImage:
if (id == CSSValueNone)
- valid_primitive = true;
+ validPrimitive = true;
else {
RefPtr<CSSValue> result;
if (parseBorderImage(propId, important, result)) {
@@ -1226,15 +1226,15 @@ bool CSSParser::parseValue(int propId, bool important)
case CSSPropertyBorderBottomRightRadius: {
if (num != 1 && num != 2)
return false;
- valid_primitive = validUnit(value, FLength, m_strict);
- if (!valid_primitive)
+ validPrimitive = validUnit(value, FLength, m_strict);
+ if (!validPrimitive)
return false;
RefPtr<CSSPrimitiveValue> parsedValue1 = CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit);
RefPtr<CSSPrimitiveValue> parsedValue2;
if (num == 2) {
value = m_valueList->next();
- valid_primitive = validUnit(value, FLength, m_strict);
- if (!valid_primitive)
+ validPrimitive = validUnit(value, FLength, m_strict);
+ if (!validPrimitive)
return false;
parsedValue2 = CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit);
} else
@@ -1249,59 +1249,59 @@ bool CSSParser::parseValue(int propId, bool important)
case CSSPropertyWebkitBorderRadius:
return parseBorderRadius(propId, important);
case CSSPropertyOutlineOffset:
- valid_primitive = validUnit(value, FLength, m_strict);
+ validPrimitive = validUnit(value, FLength, m_strict);
break;
case CSSPropertyTextShadow: // CSS2 property, dropped in CSS2.1, back in CSS3, so treat as CSS3
case CSSPropertyWebkitBoxShadow:
if (id == CSSValueNone)
- valid_primitive = true;
+ validPrimitive = true;
else
return parseShadow(propId, important);
break;
case CSSPropertyWebkitBoxReflect:
if (id == CSSValueNone)
- valid_primitive = true;
+ validPrimitive = true;
else
return parseReflect(propId, important);
break;
case CSSPropertyOpacity:
- valid_primitive = validUnit(value, FNumber, m_strict);
+ validPrimitive = validUnit(value, FNumber, m_strict);
break;
case CSSPropertyWebkitBoxAlign:
if (id == CSSValueStretch || id == CSSValueStart || id == CSSValueEnd ||
id == CSSValueCenter || id == CSSValueBaseline)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyWebkitBoxDirection:
if (id == CSSValueNormal || id == CSSValueReverse)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyWebkitBoxLines:
if (id == CSSValueSingle || id == CSSValueMultiple)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyWebkitBoxOrient:
if (id == CSSValueHorizontal || id == CSSValueVertical ||
id == CSSValueInlineAxis || id == CSSValueBlockAxis)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyWebkitBoxPack:
if (id == CSSValueStart || id == CSSValueEnd ||
id == CSSValueCenter || id == CSSValueJustify)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyWebkitBoxFlex:
- valid_primitive = validUnit(value, FNumber, m_strict);
+ validPrimitive = validUnit(value, FNumber, m_strict);
break;
case CSSPropertyWebkitBoxFlexGroup:
case CSSPropertyWebkitBoxOrdinalGroup:
- valid_primitive = validUnit(value, FInteger|FNonNeg, true);
+ validPrimitive = validUnit(value, FInteger | FNonNeg, true);
break;
case CSSPropertyWebkitBoxSizing:
- valid_primitive = id == CSSValueBorderBox || id == CSSValueContentBox;
+ validPrimitive = id == CSSValueBorderBox || id == CSSValueContentBox;
break;
case CSSPropertyWebkitColorCorrection:
- valid_primitive = id == CSSValueSrgb || id == CSSValueDefault;
+ validPrimitive = id == CSSValueSrgb || id == CSSValueDefault;
break;
case CSSPropertyWebkitMarquee: {
const int properties[5] = { CSSPropertyWebkitMarqueeDirection, CSSPropertyWebkitMarqueeIncrement,
@@ -1313,71 +1313,71 @@ bool CSSParser::parseValue(int propId, bool important)
if (id == CSSValueForwards || id == CSSValueBackwards || id == CSSValueAhead ||
id == CSSValueReverse || id == CSSValueLeft || id == CSSValueRight || id == CSSValueDown ||
id == CSSValueUp || id == CSSValueAuto)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyWebkitMarqueeIncrement:
if (id == CSSValueSmall || id == CSSValueLarge || id == CSSValueMedium)
- valid_primitive = true;
+ validPrimitive = true;
else
- valid_primitive = validUnit(value, FLength|FPercent, m_strict);
+ validPrimitive = validUnit(value, FLength | FPercent, m_strict);
break;
case CSSPropertyWebkitMarqueeStyle:
if (id == CSSValueNone || id == CSSValueSlide || id == CSSValueScroll || id == CSSValueAlternate)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyWebkitMarqueeRepetition:
if (id == CSSValueInfinite)
- valid_primitive = true;
+ validPrimitive = true;
else
- valid_primitive = validUnit(value, FInteger|FNonNeg, m_strict);
+ validPrimitive = validUnit(value, FInteger | FNonNeg, m_strict);
break;
case CSSPropertyWebkitMarqueeSpeed:
if (id == CSSValueNormal || id == CSSValueSlow || id == CSSValueFast)
- valid_primitive = true;
+ validPrimitive = true;
else
- valid_primitive = validUnit(value, FTime|FInteger|FNonNeg, m_strict);
+ validPrimitive = validUnit(value, FTime | FInteger | FNonNeg, m_strict);
break;
#if ENABLE(WCSS)
case CSSPropertyWapMarqueeDir:
if (id == CSSValueLtr || id == CSSValueRtl)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyWapMarqueeStyle:
if (id == CSSValueNone || id == CSSValueSlide || id == CSSValueScroll || id == CSSValueAlternate)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyWapMarqueeLoop:
if (id == CSSValueInfinite)
- valid_primitive = true;
+ validPrimitive = true;
else
- valid_primitive = validUnit(value, FInteger | FNonNeg, m_strict);
+ validPrimitive = validUnit(value, FInteger | FNonNeg, m_strict);
break;
case CSSPropertyWapMarqueeSpeed:
if (id == CSSValueNormal || id == CSSValueSlow || id == CSSValueFast)
- valid_primitive = true;
+ validPrimitive = true;
else
- valid_primitive = validUnit(value, FTime | FInteger | FNonNeg, m_strict);
+ validPrimitive = validUnit(value, FTime | FInteger | FNonNeg, m_strict);
break;
#endif
case CSSPropertyWebkitUserDrag: // auto | none | element
if (id == CSSValueAuto || id == CSSValueNone || id == CSSValueElement)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyWebkitUserModify: // read-only | read-write
if (id == CSSValueReadOnly || id == CSSValueReadWrite || id == CSSValueReadWritePlaintextOnly)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyWebkitUserSelect: // auto | none | text
if (id == CSSValueAuto || id == CSSValueNone || id == CSSValueText)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyTextOverflow: // clip | ellipsis
if (id == CSSValueClip || id == CSSValueEllipsis)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyWebkitTransform:
if (id == CSSValueNone)
- valid_primitive = true;
+ validPrimitive = true;
else {
PassRefPtr<CSSValue> val = parseTransform();
if (val) {
@@ -1407,18 +1407,18 @@ bool CSSParser::parseValue(int propId, bool important)
}
case CSSPropertyWebkitTransformStyle:
if (value->id == CSSValueFlat || value->id == CSSValuePreserve3d)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyWebkitBackfaceVisibility:
if (value->id == CSSValueVisible || value->id == CSSValueHidden)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyWebkitPerspective:
if (id == CSSValueNone)
- valid_primitive = true;
+ validPrimitive = true;
else {
// Accepting valueless numbers is a quirk of the -webkit prefixed version of the property.
- if (validUnit(value, FNumber|FLength|FNonNeg, m_strict)) {
+ if (validUnit(value, FNumber | FLength | FNonNeg, m_strict)) {
RefPtr<CSSValue> val = CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit);
if (val) {
addProperty(propId, val.release(), important);
@@ -1482,13 +1482,13 @@ bool CSSParser::parseValue(int propId, bool important)
case CSSPropertyWebkitMarginTopCollapse:
case CSSPropertyWebkitMarginBottomCollapse:
if (id == CSSValueCollapse || id == CSSValueSeparate || id == CSSValueDiscard)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyTextLineThroughMode:
case CSSPropertyTextOverlineMode:
case CSSPropertyTextUnderlineMode:
if (id == CSSValueContinuous || id == CSSValueSkipWhiteSpace)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyTextLineThroughStyle:
case CSSPropertyTextOverlineStyle:
@@ -1496,50 +1496,50 @@ bool CSSParser::parseValue(int propId, bool important)
if (id == CSSValueNone || id == CSSValueSolid || id == CSSValueDouble ||
id == CSSValueDashed || id == CSSValueDotDash || id == CSSValueDotDotDash ||
id == CSSValueWave)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyTextRendering: // auto | optimizeSpeed | optimizeLegibility | geometricPrecision
if (id == CSSValueAuto || id == CSSValueOptimizespeed || id == CSSValueOptimizelegibility
|| id == CSSValueGeometricprecision)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyTextLineThroughWidth:
case CSSPropertyTextOverlineWidth:
case CSSPropertyTextUnderlineWidth:
if (id == CSSValueAuto || id == CSSValueNormal || id == CSSValueThin ||
id == CSSValueMedium || id == CSSValueThick)
- valid_primitive = true;
+ validPrimitive = true;
else
- valid_primitive = !id && validUnit(value, FNumber|FLength|FPercent, m_strict);
+ validPrimitive = !id && validUnit(value, FNumber | FLength | FPercent, m_strict);
break;
case CSSPropertyResize: // none | both | horizontal | vertical | auto
if (id == CSSValueNone || id == CSSValueBoth || id == CSSValueHorizontal || id == CSSValueVertical || id == CSSValueAuto)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyWebkitColumnCount:
if (id == CSSValueAuto)
- valid_primitive = true;
+ validPrimitive = true;
else
- valid_primitive = !id && validUnit(value, FInteger | FNonNeg, false);
+ validPrimitive = !id && validUnit(value, FInteger | FNonNeg, false);
break;
case CSSPropertyWebkitColumnGap: // normal | <length>
if (id == CSSValueNormal)
- valid_primitive = true;
+ validPrimitive = true;
else
- valid_primitive = validUnit(value, FLength | FNonNeg, m_strict);
+ validPrimitive = validUnit(value, FLength | FNonNeg, m_strict);
break;
case CSSPropertyWebkitColumnWidth: // auto | <length>
if (id == CSSValueAuto)
- valid_primitive = true;
+ validPrimitive = true;
else // Always parse this property in strict mode, since it would be ambiguous otherwise when used in the 'columns' shorthand property.
- valid_primitive = validUnit(value, FLength, true);
+ validPrimitive = validUnit(value, FLength, true);
break;
case CSSPropertyPointerEvents:
// none | visiblePainted | visibleFill | visibleStroke | visible |
// painted | fill | stroke | auto | all | inherit
if (id == CSSValueVisible || id == CSSValueNone || id == CSSValueAll || id == CSSValueAuto ||
(id >= CSSValueVisiblepainted && id <= CSSValueStroke))
- valid_primitive = true;
+ validPrimitive = true;
break;
// End of CSS3 properties
@@ -1549,56 +1549,56 @@ bool CSSParser::parseValue(int propId, bool important)
case CSSPropertyWebkitLineClamp:
// When specifying number of lines, don't allow 0 as a valid value
// When specifying either type of unit, require non-negative integers
- valid_primitive = (!id && (value->unit == CSSPrimitiveValue::CSS_PERCENTAGE || value->fValue) && validUnit(value, FInteger | FPercent | FNonNeg, false));
+ validPrimitive = (!id && (value->unit == CSSPrimitiveValue::CSS_PERCENTAGE || value->fValue) && validUnit(value, FInteger | FPercent | FNonNeg, false));
break;
case CSSPropertyWebkitTextSizeAdjust:
if (id == CSSValueAuto || id == CSSValueNone)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyWebkitRtlOrdering:
if (id == CSSValueLogical || id == CSSValueVisual)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyWebkitFontSizeDelta: // <length>
- valid_primitive = validUnit(value, FLength, m_strict);
+ validPrimitive = validUnit(value, FLength, m_strict);
break;
case CSSPropertyWebkitNbspMode: // normal | space
if (id == CSSValueNormal || id == CSSValueSpace)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyWebkitLineBreak: // normal | after-white-space
if (id == CSSValueNormal || id == CSSValueAfterWhiteSpace)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyWebkitMatchNearestMailBlockquoteColor: // normal | match
if (id == CSSValueNormal || id == CSSValueMatch)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyWebkitHighlight:
if (id == CSSValueNone || value->unit == CSSPrimitiveValue::CSS_STRING)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyWebkitBorderFit:
if (id == CSSValueBorder || id == CSSValueLines)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyWebkitTextSecurity:
// disc | circle | square | none | inherit
if (id == CSSValueDisc || id == CSSValueCircle || id == CSSValueSquare|| id == CSSValueNone)
- valid_primitive = true;
+ validPrimitive = true;
break;
case CSSPropertyWebkitFontSmoothing:
if (id == CSSValueAuto || id == CSSValueNone
|| id == CSSValueAntialiased || id == CSSValueSubpixelAntialiased)
- valid_primitive = true;
+ validPrimitive = true;
break;
#if ENABLE(DASHBOARD_SUPPORT)
@@ -1706,7 +1706,7 @@ bool CSSParser::parseValue(int propId, bool important)
// [ [ 'font-style' || 'font-variant' || 'font-weight' ]? 'font-size' [ / 'line-height' ]?
// 'font-family' ] | caption | icon | menu | message-box | small-caption | status-bar | inherit
if (id >= CSSValueCaption && id <= CSSValueStatusBar)
- valid_primitive = true;
+ validPrimitive = true;
else
return parseFont(important);
break;
@@ -1756,7 +1756,7 @@ bool CSSParser::parseValue(int propId, bool important)
#endif
}
- if (valid_primitive) {
+ if (validPrimitive) {
if (id != 0)
parsedValue = CSSPrimitiveValue::createIdentifier(id);
else if (value->unit == CSSPrimitiveValue::CSS_STRING)
@@ -2303,7 +2303,7 @@ PassRefPtr<CSSValue> CSSParser::parseFillPositionXY(bool& xFound, bool& yFound)
percent = 50;
return CSSPrimitiveValue::create(percent, CSSPrimitiveValue::CSS_PERCENTAGE);
}
- if (validUnit(m_valueList->current(), FPercent|FLength, m_strict))
+ if (validUnit(m_valueList->current(), FPercent | FLength, m_strict))
return CSSPrimitiveValue::create(m_valueList->current()->fValue,
(CSSPrimitiveValue::UnitTypes)m_valueList->current()->unit);
@@ -2411,7 +2411,7 @@ PassRefPtr<CSSValue> CSSParser::parseFillSize(int propId, bool& allowComma)
if (value->id == CSSValueAuto)
parsedValue1 = CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_UNKNOWN);
else {
- if (!validUnit(value, FLength|FPercent, m_strict))
+ if (!validUnit(value, FLength | FPercent, m_strict))
return 0;
parsedValue1 = CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit);
}
@@ -2424,7 +2424,7 @@ PassRefPtr<CSSValue> CSSParser::parseFillSize(int propId, bool& allowComma)
else if (value->unit == CSSParserValue::Operator && value->iValue == ',')
allowComma = false;
else {
- if (!validUnit(value, FLength|FPercent, m_strict))
+ if (!validUnit(value, FLength | FPercent, m_strict))
return 0;
parsedValue2 = CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit);
}
@@ -2626,7 +2626,7 @@ PassRefPtr<CSSValue> CSSParser::parseAnimationDirection()
PassRefPtr<CSSValue> CSSParser::parseAnimationDuration()
{
CSSParserValue* value = m_valueList->current();
- if (validUnit(value, FTime|FNonNeg, m_strict))
+ if (validUnit(value, FTime | FNonNeg, m_strict))
return CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit);
return 0;
}
@@ -2636,7 +2636,7 @@ PassRefPtr<CSSValue> CSSParser::parseAnimationIterationCount()
CSSParserValue* value = m_valueList->current();
if (value->id == CSSValueInfinite)
return CSSPrimitiveValue::createIdentifier(value->id);
- if (validUnit(value, FInteger|FNonNeg, m_strict))
+ if (validUnit(value, FInteger | FNonNeg, m_strict))
return CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit);
return 0;
}
@@ -3107,7 +3107,7 @@ bool CSSParser::parseFont(bool important)
} else {
valid = false;
}
- } else if (!font->weight && validUnit(value, FInteger|FNonNeg, true)) {
+ } else if (!font->weight && validUnit(value, FInteger | FNonNeg, true)) {
int weight = (int)value->fValue;
int val = 0;
if (weight == 100)
@@ -3155,7 +3155,7 @@ bool CSSParser::parseFont(bool important)
// <absolute-size> | <relative-size> | <length> | <percentage> | inherit
if (value->id >= CSSValueXxSmall && value->id <= CSSValueLarger)
font->size = CSSPrimitiveValue::createIdentifier(value->id);
- else if (validUnit(value, FLength|FPercent|FNonNeg, m_strict))
+ else if (validUnit(value, FLength | FPercent | FNonNeg, m_strict))
font->size = CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes) value->unit);
value = m_valueList->next();
if (!font->size || !value)
@@ -3168,7 +3168,7 @@ bool CSSParser::parseFont(bool important)
return false;
if (value->id == CSSValueNormal) {
// default value, nothing to do
- } else if (validUnit(value, FNumber|FLength|FPercent|FNonNeg, m_strict))
+ } else if (validUnit(value, FNumber | FLength | FPercent | FNonNeg, m_strict))
font->lineHeight = CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes) value->unit);
else
return false;
@@ -4089,7 +4089,7 @@ bool CSSParser::parseBorderImage(int propId, bool important, RefPtr<CSSValue>& r
return false;
while ((val = m_valueList->next())) {
- if (context.allowNumber() && validUnit(val, FInteger|FNonNeg|FPercent, true)) {
+ if (context.allowNumber() && validUnit(val, FInteger | FNonNeg | FPercent, true)) {
context.commitNumber(val);
} else if (propId == CSSPropertyWebkitBorderImage && context.allowSlash() && val->unit == CSSParserValue::Operator && val->iValue == '/') {
context.commitSlash();
diff --git a/WebCore/css/CSSPrimitiveValueMappings.h b/WebCore/css/CSSPrimitiveValueMappings.h
index f920898..c20448e 100644
--- a/WebCore/css/CSSPrimitiveValueMappings.h
+++ b/WebCore/css/CSSPrimitiveValueMappings.h
@@ -945,9 +945,21 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStyleType e)
case AmharicAbegede:
m_value.ident = CSSValueAmharicAbegede;
break;
+ case ArabicIndic:
+ m_value.ident = CSSValueArabicIndic;
+ break;
case Armenian:
m_value.ident = CSSValueArmenian;
break;
+ case BinaryListStyle:
+ m_value.ident = CSSValueBinary;
+ break;
+ case Bengali:
+ m_value.ident = CSSValueBengali;
+ break;
+ case Cambodian:
+ m_value.ident = CSSValueCambodian;
+ break;
case Circle:
m_value.ident = CSSValueCircle;
break;
@@ -966,6 +978,9 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStyleType e)
case DecimalListStyle:
m_value.ident = CSSValueDecimal;
break;
+ case Devanagari:
+ m_value.ident = CSSValueDevanagari;
+ break;
case Disc:
m_value.ident = CSSValueDisc;
break;
@@ -1020,6 +1035,12 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStyleType e)
case Georgian:
m_value.ident = CSSValueGeorgian;
break;
+ case Gujarati:
+ m_value.ident = CSSValueGujarati;
+ break;
+ case Gurmukhi:
+ m_value.ident = CSSValueGurmukhi;
+ break;
case Hangul:
m_value.ident = CSSValueHangul;
break;
@@ -1035,18 +1056,30 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStyleType e)
case HiraganaIroha:
m_value.ident = CSSValueHiraganaIroha;
break;
+ case Kannada:
+ m_value.ident = CSSValueKannada;
+ break;
case Katakana:
m_value.ident = CSSValueKatakana;
break;
case KatakanaIroha:
m_value.ident = CSSValueKatakanaIroha;
break;
+ case Khmer:
+ m_value.ident = CSSValueKhmer;
+ break;
+ case Lao:
+ m_value.ident = CSSValueLao;
+ break;
case LowerAlpha:
m_value.ident = CSSValueLowerAlpha;
break;
case LowerGreek:
m_value.ident = CSSValueLowerGreek;
break;
+ case LowerHexadecimal:
+ m_value.ident = CSSValueLowerHexadecimal;
+ break;
case LowerLatin:
m_value.ident = CSSValueLowerLatin;
break;
@@ -1056,12 +1089,30 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStyleType e)
case LowerRoman:
m_value.ident = CSSValueLowerRoman;
break;
+ case Malayalam:
+ m_value.ident = CSSValueMalayalam;
+ break;
+ case Mongolian:
+ m_value.ident = CSSValueMongolian;
+ break;
+ case Myanmar:
+ m_value.ident = CSSValueMyanmar;
+ break;
case NoneListStyle:
m_value.ident = CSSValueNone;
break;
+ case Octal:
+ m_value.ident = CSSValueOctal;
+ break;
+ case Oriya:
+ m_value.ident = CSSValueOriya;
+ break;
case Oromo:
m_value.ident = CSSValueOromo;
break;
+ case Persian:
+ m_value.ident = CSSValuePersian;
+ break;
case Sidama:
m_value.ident = CSSValueSidama;
break;
@@ -1071,6 +1122,15 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStyleType e)
case Square:
m_value.ident = CSSValueSquare;
break;
+ case Telugu:
+ m_value.ident = CSSValueTelugu;
+ break;
+ case Thai:
+ m_value.ident = CSSValueThai;
+ break;
+ case Tibetan:
+ m_value.ident = CSSValueTibetan;
+ break;
case Tigre:
m_value.ident = CSSValueTigre;
break;
@@ -1092,6 +1152,9 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStyleType e)
case UpperGreek:
m_value.ident = CSSValueUpperGreek;
break;
+ case UpperHexadecimal:
+ m_value.ident = CSSValueUpperHexadecimal;
+ break;
case UpperLatin:
m_value.ident = CSSValueUpperLatin;
break;
@@ -1101,6 +1164,9 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStyleType e)
case UpperRoman:
m_value.ident = CSSValueUpperRoman;
break;
+ case Urdu:
+ m_value.ident = CSSValueUrdu;
+ break;
}
}
diff --git a/WebCore/css/CSSStyleSheet.h b/WebCore/css/CSSStyleSheet.h
index 2d8a912..bb14e28 100644
--- a/WebCore/css/CSSStyleSheet.h
+++ b/WebCore/css/CSSStyleSheet.h
@@ -44,21 +44,21 @@ public:
{
return adoptRef(new CSSStyleSheet(ownerNode, String(), KURL(), String()));
}
- static PassRefPtr<CSSStyleSheet> create(Node* ownerNode, const String& href, const KURL& baseURL)
+ static PassRefPtr<CSSStyleSheet> create(Node* ownerNode, const String& originalURL, const KURL& finalURL)
{
- return adoptRef(new CSSStyleSheet(ownerNode, href, baseURL, String()));
+ return adoptRef(new CSSStyleSheet(ownerNode, originalURL, finalURL, String()));
}
- static PassRefPtr<CSSStyleSheet> create(Node* ownerNode, const String& href, const KURL& baseURL, const String& charset)
+ static PassRefPtr<CSSStyleSheet> create(Node* ownerNode, const String& originalURL, const KURL& finalURL, const String& charset)
{
- return adoptRef(new CSSStyleSheet(ownerNode, href, baseURL, charset));
+ return adoptRef(new CSSStyleSheet(ownerNode, originalURL, finalURL, charset));
}
- static PassRefPtr<CSSStyleSheet> create(CSSRule* ownerRule, const String& href, const KURL& baseURL, const String& charset)
+ static PassRefPtr<CSSStyleSheet> create(CSSRule* ownerRule, const String& originalURL, const KURL& finalURL, const String& charset)
{
- return adoptRef(new CSSStyleSheet(ownerRule, href, baseURL, charset));
+ return adoptRef(new CSSStyleSheet(ownerRule, originalURL, finalURL, charset));
}
- static PassRefPtr<CSSStyleSheet> createInline(Node* ownerNode, const KURL& baseURL)
+ static PassRefPtr<CSSStyleSheet> createInline(Node* ownerNode, const KURL& finalURL)
{
- return adoptRef(new CSSStyleSheet(ownerNode, baseURL.string(), baseURL, String()));
+ return adoptRef(new CSSStyleSheet(ownerNode, finalURL.string(), finalURL, String()));
}
virtual ~CSSStyleSheet();
@@ -103,9 +103,9 @@ public:
bool hasSyntacticallyValidCSSHeader() const { return m_hasSyntacticallyValidCSSHeader; }
private:
- CSSStyleSheet(Node* ownerNode, const String& href, const KURL& baseURL, const String& charset);
- CSSStyleSheet(CSSStyleSheet* parentSheet, const String& href, const KURL& baseURL, const String& charset);
- CSSStyleSheet(CSSRule* ownerRule, const String& href, const KURL& baseURL, const String& charset);
+ CSSStyleSheet(Node* ownerNode, const String& originalURL, const KURL& finalURL, const String& charset);
+ CSSStyleSheet(CSSStyleSheet* parentSheet, const String& originalURL, const KURL& finalURL, const String& charset);
+ CSSStyleSheet(CSSRule* ownerRule, const String& originalURL, const KURL& finalURL, const String& charset);
virtual bool isCSSStyleSheet() const { return true; }
virtual String type() const { return "text/css"; }
diff --git a/WebCore/css/CSSValueKeywords.in b/WebCore/css/CSSValueKeywords.in
index 8236115..ca2a47a 100644
--- a/WebCore/css/CSSValueKeywords.in
+++ b/WebCore/css/CSSValueKeywords.in
@@ -225,6 +225,28 @@ circle
square
decimal
decimal-leading-zero
+arabic-indic
+binary
+bengali
+cambodian
+khmer
+devanagari
+gujarati
+gurmukhi
+kannada
+lower-hexadecimal
+lao
+malayalam
+mongolian
+myanmar
+octal
+oriya
+persian
+urdu
+telugu
+tibetan
+thai
+upper-hexadecimal
lower-roman
upper-roman
lower-greek
diff --git a/WebCore/css/StyleBase.cpp b/WebCore/css/StyleBase.cpp
index cc7c0d4..5d9d79d 100644
--- a/WebCore/css/StyleBase.cpp
+++ b/WebCore/css/StyleBase.cpp
@@ -56,8 +56,8 @@ KURL StyleBase::baseURL() const
StyleSheet* sheet = const_cast<StyleBase*>(this)->stylesheet();
if (!sheet)
return KURL();
- if (!sheet->putativeBaseURL().isNull())
- return sheet->putativeBaseURL();
+ if (!sheet->finalURL().isNull())
+ return sheet->finalURL();
if (sheet->parent())
return sheet->parent()->baseURL();
if (!sheet->ownerNode())
diff --git a/WebCore/css/StyleSheet.cpp b/WebCore/css/StyleSheet.cpp
index 15e1c3b..4f20a20 100644
--- a/WebCore/css/StyleSheet.cpp
+++ b/WebCore/css/StyleSheet.cpp
@@ -24,30 +24,29 @@
namespace WebCore {
-StyleSheet::StyleSheet(StyleSheet* parentSheet, const String& href, const KURL& baseURL)
+StyleSheet::StyleSheet(StyleSheet* parentSheet, const String& originalURL, const KURL& finalURL)
: StyleList(parentSheet)
, m_parentNode(0)
- , m_href(href)
- , m_baseURL(baseURL)
+ , m_originalURL(originalURL)
+ , m_finalURL(finalURL)
, m_disabled(false)
{
}
-
-StyleSheet::StyleSheet(Node* parentNode, const String& href, const KURL& baseURL)
+StyleSheet::StyleSheet(Node* parentNode, const String& originalURL, const KURL& finalURL)
: StyleList(0)
, m_parentNode(parentNode)
- , m_href(href)
- , m_baseURL(baseURL)
+ , m_originalURL(originalURL)
+ , m_finalURL(finalURL)
, m_disabled(false)
{
}
-StyleSheet::StyleSheet(StyleBase* owner, const String& href, const KURL& baseURL)
+StyleSheet::StyleSheet(StyleBase* owner, const String& originalURL, const KURL& finalURL)
: StyleList(owner)
, m_parentNode(0)
- , m_href(href)
- , m_baseURL(baseURL)
+ , m_originalURL(originalURL)
+ , m_finalURL(finalURL)
, m_disabled(false)
{
}
diff --git a/WebCore/css/StyleSheet.h b/WebCore/css/StyleSheet.h
index 5f8ad78..621733d 100644
--- a/WebCore/css/StyleSheet.h
+++ b/WebCore/css/StyleSheet.h
@@ -45,13 +45,10 @@ public:
// Note that href is the URL that started the redirect chain that led to
// this style sheet. This property probably isn't useful for much except
// the JavaScript binding (which needs to use this value for security).
- const String& href() const { return m_href; }
+ const String& href() const { return m_originalURL; }
- void setBaseURL(const KURL& baseURL) { m_baseURL = baseURL; }
-
- // Notice that this object inherits a baseURL function from StyleBase that
- // crawls the parent() relation looking for a non-0 putativeBaseURL.
- const KURL& putativeBaseURL() const { return m_baseURL; }
+ void setFinalURL(const KURL& finalURL) { m_finalURL = finalURL; }
+ const KURL& finalURL() const { return m_finalURL; }
const String& title() const { return m_strTitle; }
void setTitle(const String& s) { m_strTitle = s; }
@@ -68,16 +65,16 @@ public:
virtual bool parseString(const String&, bool strict = true) = 0;
protected:
- StyleSheet(Node* ownerNode, const String& href, const KURL& baseURL);
- StyleSheet(StyleSheet* parentSheet, const String& href, const KURL& baseURL);
- StyleSheet(StyleBase* owner, const String& href, const KURL& baseURL);
+ StyleSheet(Node* ownerNode, const String& href, const KURL& finalURL);
+ StyleSheet(StyleSheet* parentSheet, const String& href, const KURL& finalURL);
+ StyleSheet(StyleBase* owner, const String& href, const KURL& finalURL);
private:
virtual bool isStyleSheet() const { return true; }
Node* m_parentNode;
- String m_href;
- KURL m_baseURL;
+ String m_originalURL;
+ KURL m_finalURL;
String m_strTitle;
RefPtr<MediaList> m_media;
bool m_disabled;
diff --git a/WebCore/css/svg.css b/WebCore/css/svg.css
index 322eda8..171c1c4 100644
--- a/WebCore/css/svg.css
+++ b/WebCore/css/svg.css
@@ -32,9 +32,18 @@
which does not use CSS layout [CSS2-LAYOUT] or XSL formatting [XSL], the 'overflow' property on the
outermost 'svg' element is ignored for the purposes of visual rendering and the initial clipping path is set
to the bounds of the initial viewport.
+
+ When an outermost 'svg' element is embedded inline within a parent XML grammar which uses CSS layout
+ [CSS2-LAYOUT] or XSL formatting [XSL], if the 'overflow' property has the value hidden or scroll, then
+ the user agent will establish an initial clipping path equal to the bounds of the initial viewport; otherwise,
+ the initial clipping path is set according to the clipping rules as defined in [CSS2-overflow].
+
+ Opera/Firefox & WebKit agreed on NOT setting "overflow: hidden" for the outermost svg element - SVG 1.1 Errata
+ contains these changes as well as all future SVG specifications: see http://lists.w3.org/Archives/Public/public-svg-wg/2008JulSep/0347.html
*/
-svg:root {
- overflow: hidden !important
+
+svg:not(:root), symbol, image, marker, pattern, foreignObject {
+ overflow: hidden
}
svg {
@@ -42,10 +51,6 @@ svg {
height: 100%;
}
-svg, symbol, marker, pattern {
- overflow: hidden
-}
-
text, foreignObject {
display: block
}
diff --git a/WebCore/dom/Clipboard.h b/WebCore/dom/Clipboard.h
index 042cd82..2f4dc6f 100644
--- a/WebCore/dom/Clipboard.h
+++ b/WebCore/dom/Clipboard.h
@@ -69,6 +69,7 @@ namespace WebCore {
#endif
virtual void writeURL(const KURL&, const String&, Frame*) = 0;
virtual void writeRange(Range*, Frame*) = 0;
+ virtual void writePlainText(const String&) = 0;
virtual bool hasData() = 0;
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index 79beb0c..06ed918 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -373,6 +373,7 @@ Document::Document(Frame* frame, bool isXHTML, bool isHTML)
, m_styleRecalcTimer(this, &Document::styleRecalcTimerFired)
, m_frameElementsShouldIgnoreScrolling(false)
, m_containsValidityStyleRules(false)
+ , m_updateFocusAppearanceRestoresSelection(false)
, m_title("")
, m_rawTitle("")
, m_titleSetExplicitly(false)
@@ -387,7 +388,6 @@ Document::Document(Frame* frame, bool isXHTML, bool isHTML)
, m_bindingManager(new XBLBindingManager(this))
#endif
, m_savedRenderer(0)
- , m_secureForms(0)
, m_designMode(inherit)
, m_selfOnlyRefCount(0)
#if ENABLE(SVG)
@@ -2049,9 +2049,9 @@ void Document::updateBaseURL()
m_baseURL = KURL();
if (m_elemSheet)
- m_elemSheet->setBaseURL(m_baseURL);
+ m_elemSheet->setFinalURL(m_baseURL);
if (m_mappedElementSheet)
- m_mappedElementSheet->setBaseURL(m_baseURL);
+ m_mappedElementSheet->setFinalURL(m_baseURL);
}
String Document::userAgent(const KURL& url) const
@@ -4598,14 +4598,9 @@ void Document::statePopped(SerializedScriptValue* stateObject)
m_pendingStateObject = stateObject;
}
-void Document::updateSandboxFlags()
-{
- if (m_frame && securityOrigin())
- securityOrigin()->setSandboxFlags(m_frame->loader()->sandboxFlags());
-}
-
-void Document::updateFocusAppearanceSoon()
+void Document::updateFocusAppearanceSoon(bool restorePreviousSelection)
{
+ m_updateFocusAppearanceRestoresSelection = restorePreviousSelection;
if (!m_updateFocusAppearanceTimer.isActive())
m_updateFocusAppearanceTimer.startOneShot(0);
}
@@ -4627,7 +4622,7 @@ void Document::updateFocusAppearanceTimerFired(Timer<Document>*)
Element* element = static_cast<Element*>(node);
if (element->isFocusable())
- element->updateFocusAppearance(false);
+ element->updateFocusAppearance(m_updateFocusAppearanceRestoresSelection);
}
void Document::executeScriptSoonTimerFired(Timer<Document>* timer)
diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h
index f909ba1..e7c470b 100644
--- a/WebCore/dom/Document.h
+++ b/WebCore/dom/Document.h
@@ -838,7 +838,7 @@ public:
void removeNodeListCache() { ASSERT(m_numNodeListCaches > 0); --m_numNodeListCaches; }
bool hasNodeListCaches() const { return m_numNodeListCaches; }
- void updateFocusAppearanceSoon();
+ void updateFocusAppearanceSoon(bool restorePreviousSelection);
void cancelFocusAppearanceUpdate();
// FF method for accessing the selection added for compatibility.
@@ -923,8 +923,6 @@ public:
void updateURLForPushOrReplaceState(const KURL&);
void statePopped(SerializedScriptValue*);
- void updateSandboxFlags(); // Set sandbox flags as determined by the frame.
-
bool processingLoadEvent() const { return m_processingLoadEvent; }
#if ENABLE(DATABASE)
@@ -1088,6 +1086,7 @@ private:
bool m_haveExplicitlyDisabledDNSPrefetch;
bool m_frameElementsShouldIgnoreScrolling;
bool m_containsValidityStyleRules;
+ bool m_updateFocusAppearanceRestoresSelection;
String m_title;
String m_rawTitle;
@@ -1146,7 +1145,6 @@ private:
#endif
RenderObject* m_savedRenderer;
- int m_secureForms;
RefPtr<TextResourceDecoder> m_decoder;
diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp
index 729ec8d..0a1bc75 100644
--- a/WebCore/dom/Element.cpp
+++ b/WebCore/dom/Element.cpp
@@ -113,11 +113,11 @@ PassRefPtr<Element> Element::cloneElementWithoutChildren()
// This is a sanity check as HTML overloads some of the DOM methods.
ASSERT(isHTMLElement() == clone->isHTMLElement());
+ clone->copyNonAttributeProperties(this);
+
// Clone attributes.
if (namedAttrMap)
clone->attributes()->setAttributes(*attributes(true)); // Call attributes(true) to force attribute synchronization to occur (for svg and style) before cloning happens.
-
- clone->copyNonAttributeProperties(this);
return clone.release();
}
@@ -785,7 +785,7 @@ void Element::attach()
ElementRareData* data = rareData();
if (data->needsFocusAppearanceUpdateSoonAfterAttach()) {
if (isFocusable() && document()->focusedNode() == this)
- document()->updateFocusAppearanceSoon();
+ document()->updateFocusAppearanceSoon(false /* don't restore selection */);
data->setNeedsFocusAppearanceUpdateSoonAfterAttach(false);
}
}
diff --git a/WebCore/dom/Element.h b/WebCore/dom/Element.h
index 15032d7..a5c4e96 100644
--- a/WebCore/dom/Element.h
+++ b/WebCore/dom/Element.h
@@ -304,7 +304,6 @@ private:
virtual void updateAnimatedSVGAttribute(const QualifiedName&) const { }
#endif
- void updateFocusAppearanceSoonAfterAttach();
void cancelFocusAppearanceUpdate();
virtual const AtomicString& virtualPrefix() const { return prefix(); }
diff --git a/WebCore/dom/EventListener.h b/WebCore/dom/EventListener.h
index da9d179..c0d045d 100644
--- a/WebCore/dom/EventListener.h
+++ b/WebCore/dom/EventListener.h
@@ -52,8 +52,8 @@ namespace WebCore {
virtual bool wasCreatedFromMarkup() const { return false; }
#if USE(JSC)
- virtual JSC::JSObject* jsFunction(ScriptExecutionContext*) const { return 0; }
virtual void markJSFunction(JSC::MarkStack&) { }
+ virtual void invalidateJSFunction(JSC::JSObject*) { }
#endif
bool isAttribute() const { return virtualisAttribute(); }
diff --git a/WebCore/dom/EventTarget.h b/WebCore/dom/EventTarget.h
index fa5ca09..ece0f34 100644
--- a/WebCore/dom/EventTarget.h
+++ b/WebCore/dom/EventTarget.h
@@ -140,8 +140,8 @@ namespace WebCore {
bool isFiringEventListeners();
#if USE(JSC)
- void markEventListeners(JSC::MarkStack&);
- void invalidateEventListeners();
+ void markJSEventListeners(JSC::MarkStack&);
+ void invalidateJSEventListeners(JSC::JSObject*);
#endif
protected:
@@ -185,7 +185,7 @@ namespace WebCore {
#endif
#if USE(JSC)
- inline void EventTarget::markEventListeners(JSC::MarkStack& markStack)
+ inline void EventTarget::markJSEventListeners(JSC::MarkStack& markStack)
{
EventTargetData* d = eventTargetData();
if (!d)
@@ -199,14 +199,18 @@ namespace WebCore {
}
}
- inline void EventTarget::invalidateEventListeners()
+ inline void EventTarget::invalidateJSEventListeners(JSC::JSObject* wrapper)
{
EventTargetData* d = eventTargetData();
if (!d)
return;
- deleteAllValues(d->eventListenerMap);
- d->eventListenerMap.clear();
+ EventListenerMap::iterator end = d->eventListenerMap.end();
+ for (EventListenerMap::iterator it = d->eventListenerMap.begin(); it != end; ++it) {
+ EventListenerVector& entry = *it->second;
+ for (size_t i = 0; i < entry.size(); ++i)
+ entry[i].listener->invalidateJSFunction(wrapper);
+ }
}
#endif
diff --git a/WebCore/dom/Position.cpp b/WebCore/dom/Position.cpp
index 0126835..c0f6fa3 100644
--- a/WebCore/dom/Position.cpp
+++ b/WebCore/dom/Position.cpp
@@ -1046,7 +1046,7 @@ void Position::getInlineBoxAndOffset(EAffinity affinity, TextDirection primaryDi
candidate = box;
}
- if (candidate && !box && affinity == DOWNSTREAM) {
+ if (candidate && candidate == textRenderer->lastTextBox() && affinity == DOWNSTREAM) {
box = searchAheadForBetterMatch(textRenderer);
if (box)
caretOffset = box->caretMinOffset();
diff --git a/WebCore/dom/ProcessingInstruction.cpp b/WebCore/dom/ProcessingInstruction.cpp
index d4636b4..122a175 100644
--- a/WebCore/dom/ProcessingInstruction.cpp
+++ b/WebCore/dom/ProcessingInstruction.cpp
@@ -139,8 +139,8 @@ void ProcessingInstruction::checkStyleSheet()
// We need to make a synthetic XSLStyleSheet that is embedded. It needs to be able
// to kick off import/include loads that can hang off some parent sheet.
if (m_isXSL) {
- KURL baseURL = KURL(ParsedURLString, m_localHref);
- m_sheet = XSLStyleSheet::createEmbedded(this, m_localHref, baseURL);
+ KURL finalURL(ParsedURLString, m_localHref);
+ m_sheet = XSLStyleSheet::createInline(this, finalURL);
m_loading = false;
}
#endif
diff --git a/WebCore/editing/Editor.cpp b/WebCore/editing/Editor.cpp
index 5798452..1061dd2 100644
--- a/WebCore/editing/Editor.cpp
+++ b/WebCore/editing/Editor.cpp
@@ -1004,16 +1004,6 @@ bool Editor::insertParagraphSeparator()
return true;
}
-static bool nodeIsInTextFormControl(Node* node)
-{
- if (!node)
- return false;
- Node* ancestor = node->shadowAncestorNode();
- if (ancestor == node)
- return false;
- return ancestor->isElementNode() && static_cast<Element*>(ancestor)->isTextFormControl();
-}
-
void Editor::cut()
{
if (tryDHTMLCut())
@@ -1024,7 +1014,7 @@ void Editor::cut()
}
RefPtr<Range> selection = selectedRange();
if (shouldDeleteRange(selection.get())) {
- if (nodeIsInTextFormControl(m_frame->selection()->start().node()))
+ if (isNodeInTextFormControl(m_frame->selection()->start().node()))
Pasteboard::generalPasteboard()->writePlainText(m_frame->selectedText());
else
Pasteboard::generalPasteboard()->writeSelection(selection.get(), canSmartCopyOrDelete(), m_frame);
@@ -1042,7 +1032,7 @@ void Editor::copy()
return;
}
- if (nodeIsInTextFormControl(m_frame->selection()->start().node()))
+ if (isNodeInTextFormControl(m_frame->selection()->start().node()))
Pasteboard::generalPasteboard()->writePlainText(m_frame->selectedText());
else {
Document* document = m_frame->document();
diff --git a/WebCore/editing/EditorCommand.cpp b/WebCore/editing/EditorCommand.cpp
index 6a9e10f..437d584 100644
--- a/WebCore/editing/EditorCommand.cpp
+++ b/WebCore/editing/EditorCommand.cpp
@@ -260,7 +260,7 @@ static int verticalScrollDistance(Frame* frame)
if (!(style->overflowY() == OSCROLL || style->overflowY() == OAUTO || renderer->isTextArea()))
return 0;
int height = toRenderBox(renderer)->clientHeight();
- return max(height * cFractionToStepWhenPaging, 1.f);
+ return max(max<int>(height * Scrollbar::minFractionToStepWhenPaging(), height - Scrollbar::maxOverlapBetweenPages()), 1);
}
static RefPtr<Range> unionDOMRanges(Range* a, Range* b)
diff --git a/WebCore/editing/InsertParagraphSeparatorCommand.cpp b/WebCore/editing/InsertParagraphSeparatorCommand.cpp
index 695f46a..058b961 100644
--- a/WebCore/editing/InsertParagraphSeparatorCommand.cpp
+++ b/WebCore/editing/InsertParagraphSeparatorCommand.cpp
@@ -44,6 +44,22 @@ namespace WebCore {
using namespace HTMLNames;
+// When inserting a new line, we want to avoid nesting empty divs if we can. Otherwise, when
+// pasting, it's easy to have each new line be a div deeper than the previous. E.g., in the case
+// below, we want to insert at ^ instead of |.
+// <div>foo<div>bar</div>|</div>^
+static Element* highestVisuallyEquivalentDiv(Element* startBlock)
+{
+ Element* curBlock = startBlock;
+ while (!curBlock->nextSibling() && curBlock->parentElement()->hasTagName(divTag)) {
+ NamedNodeMap* attributes = curBlock->parentElement()->attributes(true);
+ if (attributes && !attributes->isEmpty())
+ break;
+ curBlock = curBlock->parentElement();
+ }
+ return curBlock;
+}
+
InsertParagraphSeparatorCommand::InsertParagraphSeparatorCommand(Document *document, bool mustUseDefaultParagraphElement)
: CompositeEditCommand(document)
, m_mustUseDefaultParagraphElement(mustUseDefaultParagraphElement)
@@ -214,7 +230,13 @@ void InsertParagraphSeparatorCommand::doApply()
// When inserting the newline after the blockquote, we don't want to apply the original style after the insertion
shouldApplyStyleAfterInsertion = false;
}
- insertNodeAfter(blockToInsert, startBlock);
+
+ // Most of the time we want to stay at the nesting level of the startBlock (e.g., when nesting within lists). However,
+ // for div nodes, this can result in nested div tags that are hard to break out of.
+ Element* siblingNode = startBlock;
+ if (blockToInsert->hasTagName(divTag))
+ siblingNode = highestVisuallyEquivalentDiv(startBlock);
+ insertNodeAfter(blockToInsert, siblingNode);
}
// Recreate the same structure in the new paragraph.
diff --git a/WebCore/editing/ReplaceSelectionCommand.cpp b/WebCore/editing/ReplaceSelectionCommand.cpp
index 85a4471..f26757e 100644
--- a/WebCore/editing/ReplaceSelectionCommand.cpp
+++ b/WebCore/editing/ReplaceSelectionCommand.cpp
@@ -752,9 +752,7 @@ void ReplaceSelectionCommand::doApply()
bool startIsInsideMailBlockquote = nearestMailBlockquote(insertionPos.node());
if ((selectionStartWasStartOfParagraph && selectionEndWasEndOfParagraph && !startIsInsideMailBlockquote) ||
- startBlock == currentRoot ||
- (startBlock && startBlock->renderer() && startBlock->renderer()->isListItem()) ||
- selectionIsPlainText)
+ startBlock == currentRoot || isListItem(startBlock) || selectionIsPlainText)
m_preventNesting = false;
if (selection.isRange()) {
@@ -871,7 +869,12 @@ void ReplaceSelectionCommand::doApply()
RefPtr<Node> node = refNode->nextSibling();
fragment.removeNode(refNode);
- insertNodeAtAndUpdateNodesInserted(refNode, insertionPos);
+
+ Node* blockStart = enclosingBlock(insertionPos.node());
+ if (isListElement(refNode.get()) && blockStart->renderer()->isListItem())
+ refNode = insertAsListItems(refNode, blockStart, insertionPos);
+ else
+ insertNodeAtAndUpdateNodesInserted(refNode, insertionPos);
// Mutation events (bug 22634) may have already removed the inserted content
if (!refNode->inDocument())
@@ -960,9 +963,15 @@ void ReplaceSelectionCommand::doApply()
if (selectionEndWasEndOfParagraph || !isEndOfParagraph(endOfInsertedContent) || next.isNull()) {
if (!isStartOfParagraph(endOfInsertedContent)) {
setEndingSelection(endOfInsertedContent);
- // Use a default paragraph element (a plain div) for the empty paragraph, using the last paragraph
- // block's style seems to annoy users.
- insertParagraphSeparator(true);
+ Node* enclosingNode = enclosingBlock(endOfInsertedContent.deepEquivalent().node());
+ if (isListItem(enclosingNode)) {
+ RefPtr<Node> newListItem = createListItemElement(document());
+ insertNodeAfter(newListItem, enclosingNode);
+ setEndingSelection(VisiblePosition(Position(newListItem, 0)));
+ } else
+ // Use a default paragraph element (a plain div) for the empty paragraph, using the last paragraph
+ // block's style seems to annoy users.
+ insertParagraphSeparator(true);
// Select up to the paragraph separator that was added.
lastPositionToSelect = endingSelection().visibleStart().deepEquivalent();
@@ -1111,6 +1120,39 @@ void ReplaceSelectionCommand::insertNodeBeforeAndUpdateNodesInserted(PassRefPtr<
updateNodesInserted(nodeToUpdate);
}
+// If the user is inserting a list into an existing list, instead of nesting the list,
+// we put the list items into the existing list.
+Node* ReplaceSelectionCommand::insertAsListItems(PassRefPtr<Node> listElement, Node* insertionNode, const Position& p)
+{
+ while (listElement->hasChildNodes() && isListElement(listElement->firstChild()) && listElement->childNodeCount() == 1)
+ listElement = listElement->firstChild();
+
+ bool isStart = isStartOfParagraph(p);
+ bool isEnd = isEndOfParagraph(p);
+
+ Node* lastNode = insertionNode;
+ while (RefPtr<Node> listItem = listElement->firstChild()) {
+ ExceptionCode ec = 0;
+ listElement->removeChild(listItem.get(), ec);
+ ASSERT(!ec);
+ if (isStart)
+ insertNodeBefore(listItem, lastNode);
+ else if (isEnd) {
+ insertNodeAfter(listItem, lastNode);
+ lastNode = listItem.get();
+ } else {
+ // FIXME: If we're in the middle of a list item, we should split it into two separate
+ // list items and insert these nodes between them. For now, just append the nodes.
+ insertNodeAfter(listItem, lastNode);
+ lastNode = listItem.get();
+ }
+ }
+ if (isStart)
+ lastNode = lastNode->previousSibling();
+ updateNodesInserted(lastNode);
+ return lastNode;
+}
+
void ReplaceSelectionCommand::updateNodesInserted(Node *node)
{
if (!node)
diff --git a/WebCore/editing/ReplaceSelectionCommand.h b/WebCore/editing/ReplaceSelectionCommand.h
index 1cb93c3..19f63bb 100644
--- a/WebCore/editing/ReplaceSelectionCommand.h
+++ b/WebCore/editing/ReplaceSelectionCommand.h
@@ -54,6 +54,7 @@ private:
void insertNodeAfterAndUpdateNodesInserted(PassRefPtr<Node> insertChild, Node* refChild);
void insertNodeAtAndUpdateNodesInserted(PassRefPtr<Node>, const Position&);
void insertNodeBeforeAndUpdateNodesInserted(PassRefPtr<Node> insertChild, Node* refChild);
+ Node* insertAsListItems(PassRefPtr<Node>, Node* insertionNode, const Position&);
void updateNodesInserted(Node*);
bool shouldRemoveEndBR(Node*, const VisiblePosition&);
diff --git a/WebCore/editing/htmlediting.cpp b/WebCore/editing/htmlediting.cpp
index b58dff3..c0a9b63 100644
--- a/WebCore/editing/htmlediting.cpp
+++ b/WebCore/editing/htmlediting.cpp
@@ -658,6 +658,11 @@ bool isListElement(Node *n)
return (n && (n->hasTagName(ulTag) || n->hasTagName(olTag) || n->hasTagName(dlTag)));
}
+bool isListItem(Node *n)
+{
+ return n && n->renderer() && n->renderer()->isListItem();
+}
+
Node* enclosingNodeWithTag(const Position& p, const QualifiedName& tagName)
{
if (p.isNull())
@@ -779,7 +784,7 @@ static Node* appendedSublist(Node* listItem)
for (Node* n = listItem->nextSibling(); n; n = n->nextSibling()) {
if (isListElement(n))
return static_cast<HTMLElement*>(n);
- if (n->renderer() && n->renderer()->isListItem())
+ if (isListItem(listItem))
return 0;
}
@@ -911,6 +916,16 @@ Node *tabSpanNode(const Node *node)
return isTabSpanTextNode(node) ? node->parentNode() : 0;
}
+bool isNodeInTextFormControl(Node* node)
+{
+ if (!node)
+ return false;
+ Node* ancestor = node->shadowAncestorNode();
+ if (ancestor == node)
+ return false;
+ return ancestor->isElementNode() && static_cast<Element*>(ancestor)->isTextFormControl();
+}
+
Position positionBeforeTabSpan(const Position& pos)
{
Node *node = pos.node();
diff --git a/WebCore/editing/htmlediting.h b/WebCore/editing/htmlediting.h
index c5a44ac..1559fa5 100644
--- a/WebCore/editing/htmlediting.h
+++ b/WebCore/editing/htmlediting.h
@@ -90,10 +90,11 @@ bool isTableCell(const Node*);
bool isEmptyTableCell(const Node*);
bool isTableStructureNode(const Node*);
bool isListElement(Node*);
+bool isListItem(Node*);
bool isNodeRendered(const Node*);
bool isNodeVisiblyContainedWithin(Node*, const Range*);
bool isRenderedAsNonInlineTableImageOrHR(const Node*);
-
+bool isNodeInTextFormControl(Node* node);
// -------------------------------------------------------------------------
// Position
diff --git a/WebCore/html/HTMLCanvasElement.cpp b/WebCore/html/HTMLCanvasElement.cpp
index 4cbbb65..fa03dbf 100644
--- a/WebCore/html/HTMLCanvasElement.cpp
+++ b/WebCore/html/HTMLCanvasElement.cpp
@@ -361,12 +361,12 @@ ImageBuffer* HTMLCanvasElement::buffer() const
return m_imageBuffer.get();
}
-TransformationMatrix HTMLCanvasElement::baseTransform() const
+AffineTransform HTMLCanvasElement::baseTransform() const
{
ASSERT(m_createdImageBuffer);
FloatSize unscaledSize(width(), height());
IntSize size = convertLogicalToDevice(unscaledSize);
- TransformationMatrix transform;
+ AffineTransform transform;
if (size.width() && size.height())
transform.scaleNonUniform(size.width() / unscaledSize.width(), size.height() / unscaledSize.height());
transform.multiply(m_imageBuffer->baseTransform());
diff --git a/WebCore/html/HTMLCanvasElement.h b/WebCore/html/HTMLCanvasElement.h
index db80396..d70a7e6 100644
--- a/WebCore/html/HTMLCanvasElement.h
+++ b/WebCore/html/HTMLCanvasElement.h
@@ -27,7 +27,7 @@
#ifndef HTMLCanvasElement_h
#define HTMLCanvasElement_h
-#include "TransformationMatrix.h"
+#include "AffineTransform.h"
#include "FloatRect.h"
#include "HTMLElement.h"
#if ENABLE(3D_CANVAS)
@@ -100,7 +100,7 @@ public:
void setObserver(CanvasObserver* observer) { m_observer = observer; }
- TransformationMatrix baseTransform() const;
+ AffineTransform baseTransform() const;
CanvasRenderingContext* renderingContext() const { return m_context.get(); }
diff --git a/WebCore/html/HTMLEmbedElement.cpp b/WebCore/html/HTMLEmbedElement.cpp
index 6c62848..eba980c 100644
--- a/WebCore/html/HTMLEmbedElement.cpp
+++ b/WebCore/html/HTMLEmbedElement.cpp
@@ -69,12 +69,8 @@ static inline RenderWidget* findWidgetRenderer(const Node* n)
RenderWidget* HTMLEmbedElement::renderWidgetForJSBindings() const
{
- RenderWidget* renderWidget = findWidgetRenderer(this);
- if (renderWidget && !renderWidget->widget()) {
- document()->updateLayoutIgnorePendingStylesheets();
- renderWidget = findWidgetRenderer(this);
- }
- return renderWidget;
+ document()->updateLayoutIgnorePendingStylesheets();
+ return findWidgetRenderer(this);
}
bool HTMLEmbedElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const
diff --git a/WebCore/html/HTMLFormCollection.cpp b/WebCore/html/HTMLFormCollection.cpp
index 602f23b..65c48fe 100644
--- a/WebCore/html/HTMLFormCollection.cpp
+++ b/WebCore/html/HTMLFormCollection.cpp
@@ -40,7 +40,6 @@ inline CollectionCache* HTMLFormCollection::formCollectionInfo(HTMLFormElement*
{
if (!form->collectionInfo)
form->collectionInfo = new CollectionCache;
- form->collectionInfo->checkConsistency();
return form->collectionInfo;
}
diff --git a/WebCore/html/HTMLInputElement.cpp b/WebCore/html/HTMLInputElement.cpp
index 79f8c14..ee0c75d 100644
--- a/WebCore/html/HTMLInputElement.cpp
+++ b/WebCore/html/HTMLInputElement.cpp
@@ -79,8 +79,19 @@ using namespace HTMLNames;
const int maxSavedResults = 256;
// Constant values for getAllowedValueStep().
+static const double dateDefaultStep = 1.0;
+static const double dateStepScaleFactor = 86400000.0;
+static const double dateTimeDefaultStep = 60.0;
+static const double dateTimeStepScaleFactor = 1000.0;
+static const double monthDefaultStep = 1.0;
+static const double monthStepScaleFactor = 1.0;
static const double numberDefaultStep = 1.0;
static const double numberStepScaleFactor = 1.0;
+static const double timeDefaultStep = 60.0;
+static const double timeStepScaleFactor = 1000.0;
+static const double weekDefaultStep = 1.0;
+static const double weekStepScaleFactor = 604800000.0;
+
// Constant values for minimum().
static const double dateDefaultMinimum = -12219292800000.0; // This means 1582-10-15T00:00Z.
static const double dateTimeDefaultMinimum = -12219292800000.0; // ditto.
@@ -89,15 +100,23 @@ static const double numberDefaultMinimum = -DBL_MAX;
static const double rangeDefaultMinimum = 0.0;
static const double timeDefaultMinimum = 0.0; // 00:00:00.000
static const double weekDefaultMinimum = -12212380800000.0; // 1583-01-03, the first Monday of 1583.
+
// Constant values for maximum().
static const double dateDefaultMaximum = DBL_MAX;
static const double dateTimeDefaultMaximum = DBL_MAX;
-static const double monthDefaultMaximum = DBL_MAX;
+// DateComponents::m_year can't represent a year greater than INT_MAX.
+static const double monthDefaultMaximum = (INT_MAX - 1970) * 12.0 + 12 - 1;
static const double numberDefaultMaximum = DBL_MAX;
static const double rangeDefaultMaximum = 100.0;
static const double timeDefaultMaximum = 86399999.0; // 23:59:59.999
static const double weekDefaultMaximum = DBL_MAX;
+static const double defaultStepBase = 0.0;
+static const double weekDefaultStepBase = -259200000.0; // The first day of 1970-W01.
+
+static const double msecPerMinute = 60 * 1000;
+static const double msecPerSecond = 1000;
+
HTMLInputElement::HTMLInputElement(const QualifiedName& tagName, Document* doc, HTMLFormElement* f)
: HTMLTextFormControlElement(tagName, doc, f)
, m_xPos(0)
@@ -251,7 +270,7 @@ bool HTMLInputElement::tooLong() const
bool userEdited = !m_data.value().isNull();
if (!userEdited)
return false;
- return value().length() > static_cast<unsigned>(max);
+ return value().numGraphemeClusters() > static_cast<unsigned>(max);
}
case BUTTON:
case CHECKBOX:
@@ -438,13 +457,35 @@ double HTMLInputElement::maximum() const
double HTMLInputElement::stepBase() const
{
- if (inputType() == RANGE)
+ switch (inputType()) {
+ case RANGE:
return minimum();
- if (inputType() == NUMBER) {
- static const double defaultStepBase = 0.0;
- double min = defaultStepBase;
- formStringToDouble(getAttribute(minAttr), &min);
- return min;
+ case DATE:
+ case DATETIME:
+ case DATETIMELOCAL:
+ case MONTH:
+ case NUMBER:
+ case TIME:
+ return parseToDouble(getAttribute(minAttr), defaultStepBase);
+ case WEEK:
+ return parseToDouble(getAttribute(minAttr), weekDefaultStepBase);
+ case BUTTON:
+ case CHECKBOX:
+ case COLOR:
+ case EMAIL:
+ case FILE:
+ case HIDDEN:
+ case IMAGE:
+ case ISINDEX:
+ case PASSWORD:
+ case RADIO:
+ case RESET:
+ case SEARCH:
+ case SUBMIT:
+ case TELEPHONE:
+ case TEXT:
+ case URL:
+ break;
}
ASSERT_NOT_REACHED();
return 0.0;
@@ -455,7 +496,12 @@ bool HTMLInputElement::stepMismatch() const
double step;
if (!getAllowedValueStep(&step))
return false;
- if (inputType() == NUMBER) {
+ switch (inputType()) {
+ case RANGE:
+ // stepMismatch doesn't occur for RANGE. RenderSlider guarantees the
+ // value matches to step.
+ return false;
+ case NUMBER: {
double doubleValue;
if (!formStringToDouble(value(), &doubleValue))
return false;
@@ -472,10 +518,41 @@ bool HTMLInputElement::stepMismatch() const
double acceptableError = step / pow(2.0, DBL_MANT_DIG - 7);
return acceptableError < remainder && remainder < (step - acceptableError);
}
- // Non-RANGE types should be rejected by getAllowedValueStep().
- ASSERT(inputType() == RANGE);
- // stepMismatch doesn't occur for RANGE. RenderSlider guarantees the
- // value matches to step.
+ case DATE:
+ case DATETIME:
+ case DATETIMELOCAL:
+ case MONTH:
+ case TIME:
+ case WEEK: {
+ const double nan = numeric_limits<double>::quiet_NaN();
+ double doubleValue = parseToDouble(value(), nan);
+ doubleValue = fabs(doubleValue - stepBase());
+ if (!isfinite(doubleValue))
+ return false;
+ ASSERT(round(doubleValue) == doubleValue);
+ ASSERT(round(step) == step);
+ return fmod(doubleValue, step);
+ }
+ case BUTTON:
+ case CHECKBOX:
+ case COLOR:
+ case EMAIL:
+ case FILE:
+ case HIDDEN:
+ case IMAGE:
+ case ISINDEX:
+ case PASSWORD:
+ case RADIO:
+ case RESET:
+ case SEARCH:
+ case SUBMIT:
+ case TELEPHONE:
+ case TEXT:
+ case URL:
+ break;
+ }
+ // Non-supported types should be rejected by getAllowedValueStep().
+ ASSERT_NOT_REACHED();
return false;
}
@@ -490,13 +567,26 @@ bool HTMLInputElement::getStepParameters(double* defaultStep, double* stepScaleF
*stepScaleFactor = numberStepScaleFactor;
return true;
case DATE:
+ *defaultStep = dateDefaultStep;
+ *stepScaleFactor = dateStepScaleFactor;
+ return true;
case DATETIME:
case DATETIMELOCAL:
+ *defaultStep = dateTimeDefaultStep;
+ *stepScaleFactor = dateTimeStepScaleFactor;
+ return true;
case MONTH:
+ *defaultStep = monthDefaultStep;
+ *stepScaleFactor = monthStepScaleFactor;
+ return true;
case TIME:
+ *defaultStep = timeDefaultStep;
+ *stepScaleFactor = timeStepScaleFactor;
+ return true;
case WEEK:
- // FIXME: Implement for these types.
- return false;
+ *defaultStep = weekDefaultStep;
+ *stepScaleFactor = weekStepScaleFactor;
+ return true;
case BUTTON:
case CHECKBOX:
case COLOR:
@@ -538,21 +628,28 @@ bool HTMLInputElement::getAllowedValueStep(double* step) const
*step = defaultStep * stepScaleFactor;
return true;
}
- *step = parsed * stepScaleFactor;
- ASSERT(*step > 0);
+ // For DATE, MONTH, WEEK, the parsed value should be an integer.
+ if (inputType() == DATE || inputType() == MONTH || inputType() == WEEK)
+ parsed = max(round(parsed), 1.0);
+ double result = parsed * stepScaleFactor;
+ // For DATETIME, DATETIMELOCAL, TIME, the result should be an integer.
+ if (inputType() == DATETIME || inputType() == DATETIMELOCAL || inputType() == TIME)
+ result = max(round(result), 1.0);
+ ASSERT(result > 0);
+ *step = result;
return true;
}
-void HTMLInputElement::applyStepForNumberOrRange(double count, ExceptionCode& ec)
+void HTMLInputElement::applyStep(double count, ExceptionCode& ec)
{
- ASSERT(inputType() == NUMBER || inputType() == RANGE);
double step;
if (!getAllowedValueStep(&step)) {
ec = INVALID_STATE_ERR;
return;
}
- double current;
- if (!formStringToDouble(value(), &current)) {
+ const double nan = numeric_limits<double>::quiet_NaN();
+ double current = parseToDouble(value(), nan);
+ if (!isfinite(current)) {
ec = INVALID_STATE_ERR;
return;
}
@@ -571,25 +668,17 @@ void HTMLInputElement::applyStepForNumberOrRange(double count, ExceptionCode& ec
ec = INVALID_STATE_ERR;
return;
}
- setValue(formStringFromDouble(newValue));
+ setValueAsNumber(newValue, ec);
}
void HTMLInputElement::stepUp(int n, ExceptionCode& ec)
{
- if (inputType() != NUMBER && inputType() != RANGE) {
- ec = INVALID_STATE_ERR;
- return;
- }
- applyStepForNumberOrRange(n, ec);
+ applyStep(n, ec);
}
void HTMLInputElement::stepDown(int n, ExceptionCode& ec)
{
- if (inputType() != NUMBER && inputType() != RANGE) {
- ec = INVALID_STATE_ERR;
- return;
- }
- applyStepForNumberOrRange(-n, ec);
+ applyStep(-n, ec);
}
static inline CheckedRadioButtons& checkedRadioButtons(const HTMLInputElement *element)
@@ -1146,6 +1235,9 @@ void HTMLInputElement::attach()
imageObj->setImageSizeForAltText();
}
}
+
+ if (document()->focusedNode() == this)
+ document()->updateFocusAppearanceSoon(true /* restore selection */);
}
void HTMLInputElement::detach()
@@ -1377,7 +1469,9 @@ void HTMLInputElement::copyNonAttributeProperties(const Element* source)
const HTMLInputElement* sourceElement = static_cast<const HTMLInputElement*>(source);
m_data.setValue(sourceElement->m_data.value());
- m_checked = sourceElement->m_checked;
+ setChecked(sourceElement->m_checked);
+ m_defaultChecked = sourceElement->m_defaultChecked;
+ m_useDefaultChecked = sourceElement->m_useDefaultChecked;
m_indeterminate = sourceElement->m_indeterminate;
HTMLFormControlElementWithState::copyNonAttributeProperties(source);
@@ -1660,10 +1754,25 @@ void HTMLInputElement::setValueAsDate(double value, ExceptionCode& ec)
setValue(String());
return;
}
- // FIXME: We should specify SecondFormat.
- // e.g. If the step value is 60, use SecondFormat::None.
- // If the step value is 1, use SecondFormat::Second.
- setValue(date.toString());
+ setDateValue(date);
+}
+
+void HTMLInputElement::setDateValue(const DateComponents& date)
+{
+ double step;
+ if (!getAllowedValueStep(&step)) {
+ setValue(date.toString());
+ return;
+ }
+ if (!fmod(step, msecPerMinute)) {
+ setValue(date.toString(DateComponents::None));
+ return;
+ }
+ if (!fmod(step, msecPerSecond)) {
+ setValue(date.toString(DateComponents::Second));
+ return;
+ }
+ setValue(date.toString(DateComponents::Millisecond));
}
double HTMLInputElement::valueAsNumber() const
@@ -1730,10 +1839,7 @@ void HTMLInputElement::setValueAsNumber(double newValue, ExceptionCode& ec)
setValue(String());
return;
}
- // FIXME: We should specify SecondFormat.
- // e.g. If the step value is 60, use SecondFormat::None.
- // If the step value is 1, use SecondFormat::Second.
- setValue(date.toString());
+ setDateValue(date);
return;
}
case NUMBER:
diff --git a/WebCore/html/HTMLInputElement.h b/WebCore/html/HTMLInputElement.h
index f35a1b1..4665437 100644
--- a/WebCore/html/HTMLInputElement.h
+++ b/WebCore/html/HTMLInputElement.h
@@ -295,8 +295,8 @@ private:
PassRefPtr<HTMLFormElement> createTemporaryFormForIsIndex();
// Helper for getAllowedValueStep();
bool getStepParameters(double* defaultStep, double* stepScaleFactor) const;
- // Helper for stepUp()/stepDown(). Adds step value * count to the current number/range value.
- void applyStepForNumberOrRange(double count, ExceptionCode&);
+ // Helper for stepUp()/stepDown(). Adds step value * count to the current value.
+ void applyStep(double count, ExceptionCode&);
// Helper for applyStepForNumberOrRange().
double stepBase() const;
@@ -306,6 +306,11 @@ private:
// return NaN or Infinity only if defaultValue is NaN or Infinity.
double parseToDouble(const String&, double defaultValue) const;
+ // Generates a suitable string for the specified DateComponents and the
+ // step value, and calls setValue() with it.
+ void setDateValue(const DateComponents&);
+
+
#if ENABLE(DATALIST)
HTMLDataListElement* dataList() const;
#endif
diff --git a/WebCore/html/HTMLObjectElement.cpp b/WebCore/html/HTMLObjectElement.cpp
index 80a5efa..74fbf21 100644
--- a/WebCore/html/HTMLObjectElement.cpp
+++ b/WebCore/html/HTMLObjectElement.cpp
@@ -61,12 +61,10 @@ PassRefPtr<HTMLObjectElement> HTMLObjectElement::create(const QualifiedName& tag
RenderWidget* HTMLObjectElement::renderWidgetForJSBindings() const
{
- RenderWidget* renderWidget = (renderer() && renderer()->isWidget()) ? toRenderWidget(renderer()) : 0;
- if (renderWidget && !renderWidget->widget()) {
- document()->updateLayoutIgnorePendingStylesheets();
- renderWidget = (renderer() && renderer()->isWidget()) ? toRenderWidget(renderer()) : 0;
- }
- return renderWidget;
+ document()->updateLayoutIgnorePendingStylesheets();
+ if (!renderer() || !renderer()->isWidget())
+ return 0;
+ return toRenderWidget(renderer());
}
void HTMLObjectElement::parseMappedAttribute(MappedAttribute *attr)
diff --git a/WebCore/html/HTMLTagNames.in b/WebCore/html/HTMLTagNames.in
index 1b77c5a..430b8ea 100644
--- a/WebCore/html/HTMLTagNames.in
+++ b/WebCore/html/HTMLTagNames.in
@@ -90,9 +90,9 @@ param createWithNew
plaintext interfaceName=HTMLElement
pre createWithNew
q interfaceName=HTMLQuoteElement, createWithNew
-rp interfaceName=HTMLElement
-rt interfaceName=HTMLElement
-ruby interfaceName=HTMLElement
+rp interfaceName=HTMLElement, conditional=RUBY
+rt interfaceName=HTMLElement, conditional=RUBY
+ruby interfaceName=HTMLElement, conditional=RUBY
s interfaceName=HTMLElement
samp interfaceName=HTMLElement
script constructorNeedsCreatedByParser, createWithNew
diff --git a/WebCore/html/HTMLTextAreaElement.cpp b/WebCore/html/HTMLTextAreaElement.cpp
index f74040d..633e5ec 100644
--- a/WebCore/html/HTMLTextAreaElement.cpp
+++ b/WebCore/html/HTMLTextAreaElement.cpp
@@ -101,7 +101,7 @@ void HTMLTextAreaElement::restoreFormControlState(const String& state)
void HTMLTextAreaElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
{
- setValue(defaultValue());
+ setNonDirtyValue(defaultValue());
HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
}
@@ -180,8 +180,7 @@ bool HTMLTextAreaElement::appendFormData(FormDataList& encoding, bool)
void HTMLTextAreaElement::reset()
{
- setValue(defaultValue());
- m_isDirty = false;
+ setNonDirtyValue(defaultValue());
}
bool HTMLTextAreaElement::isKeyboardFocusable(KeyboardEvent*) const
@@ -278,6 +277,12 @@ String HTMLTextAreaElement::value() const
void HTMLTextAreaElement::setValue(const String& value)
{
+ setNonDirtyValue(value);
+ m_isDirty = true;
+}
+
+void HTMLTextAreaElement::setNonDirtyValue(const String& value)
+{
// Code elsewhere normalizes line endings added by the user via the keyboard or pasting.
// We normalize line endings coming from JavaScript here.
String normalizedValue = value.isNull() ? "" : value;
@@ -290,6 +295,7 @@ void HTMLTextAreaElement::setValue(const String& value)
return;
m_value = normalizedValue;
+ m_isDirty = false;
setFormControlValueMatchesRenderer(true);
updatePlaceholderVisibility(false);
if (inDocument())
@@ -355,7 +361,7 @@ void HTMLTextAreaElement::setDefaultValue(const String& defaultValue)
insertBefore(document()->createTextNode(value), firstChild(), ec);
- setValue(value);
+ setNonDirtyValue(value);
}
int HTMLTextAreaElement::maxLength() const
@@ -382,7 +388,7 @@ bool HTMLTextAreaElement::tooLong() const
int max = maxLength();
if (max < 0)
return false;
- return value().length() > static_cast<unsigned>(max);
+ return value().numGraphemeClusters() > static_cast<unsigned>(max);
}
void HTMLTextAreaElement::accessKeyAction(bool)
diff --git a/WebCore/html/HTMLTextAreaElement.h b/WebCore/html/HTMLTextAreaElement.h
index 23f61d3..8d92a48 100644
--- a/WebCore/html/HTMLTextAreaElement.h
+++ b/WebCore/html/HTMLTextAreaElement.h
@@ -94,6 +94,7 @@ private:
void handleBeforeTextInsertedEvent(BeforeTextInsertedEvent*) const;
static String sanitizeUserInputValue(const String&, unsigned maxLength);
void updateValue() const;
+ void setNonDirtyValue(const String&);
virtual bool supportsPlaceholder() const { return true; }
virtual bool isEmptyValue() const { return value().isEmpty(); }
diff --git a/WebCore/html/canvas/CanvasPixelArray.h b/WebCore/html/canvas/CanvasPixelArray.h
index 8ac5163..25eb92a 100644
--- a/WebCore/html/canvas/CanvasPixelArray.h
+++ b/WebCore/html/canvas/CanvasPixelArray.h
@@ -42,6 +42,7 @@ namespace WebCore {
static PassRefPtr<CanvasPixelArray> create(unsigned length);
WTF::ByteArray* data() { return m_data.get(); }
+ const WTF::ByteArray* data() const { return m_data.get(); }
unsigned length() const { return m_data->length(); }
void set(unsigned index, double value)
diff --git a/WebCore/inspector/InjectedScript.cpp b/WebCore/inspector/InjectedScript.cpp
index 5525877..42a2856 100644
--- a/WebCore/inspector/InjectedScript.cpp
+++ b/WebCore/inspector/InjectedScript.cpp
@@ -34,6 +34,7 @@
#if ENABLE(INSPECTOR)
#include "PlatformString.h"
+#include "SerializedScriptValue.h"
#include "ScriptFunctionCall.h"
namespace WebCore {
@@ -43,11 +44,10 @@ InjectedScript::InjectedScript(ScriptObject injectedScriptObject)
{
}
-void InjectedScript::dispatch(long callId, const String& methodName, const String& arguments, bool async, String* result, bool* hadException)
+void InjectedScript::dispatch(long callId, const String& methodName, const String& arguments, bool async, RefPtr<SerializedScriptValue>* result, bool* hadException)
{
ASSERT(!hasNoValue());
- ScriptState* scriptState = m_injectedScriptObject.scriptState();
- ScriptFunctionCall function(scriptState, m_injectedScriptObject, "dispatch");
+ ScriptFunctionCall function(m_injectedScriptObject, "dispatch");
function.appendArgument(methodName);
function.appendArgument(arguments);
if (async)
@@ -55,38 +55,33 @@ void InjectedScript::dispatch(long callId, const String& methodName, const Strin
*hadException = false;
ScriptValue resultValue = function.call(*hadException);
if (!*hadException)
- *result = resultValue.toString(scriptState);
+ *result = resultValue.serialize(m_injectedScriptObject.scriptState());
}
#if ENABLE(JAVASCRIPT_DEBUGGER)
-String InjectedScript::callFrames()
+PassRefPtr<SerializedScriptValue> InjectedScript::callFrames()
{
ASSERT(!hasNoValue());
- ScriptState* scriptState = m_injectedScriptObject.scriptState();
- ScriptFunctionCall function(scriptState, m_injectedScriptObject, "callFrames");
+ ScriptFunctionCall function(m_injectedScriptObject, "callFrames");
ScriptValue callFramesValue = function.call();
- return callFramesValue.toString(scriptState);
+ return callFramesValue.serialize(m_injectedScriptObject.scriptState());
}
#endif
-String InjectedScript::wrapAndStringifyForConsole(ScriptValue value)
+PassRefPtr<SerializedScriptValue> InjectedScript::wrapForConsole(ScriptValue value)
{
ASSERT(!hasNoValue());
- ScriptState* scriptState = m_injectedScriptObject.scriptState();
- ScriptFunctionCall wrapFunction(scriptState, m_injectedScriptObject, "wrapAndStringifyObject");
+ ScriptFunctionCall wrapFunction(m_injectedScriptObject, "wrapObject");
wrapFunction.appendArgument(value);
wrapFunction.appendArgument("console");
ScriptValue r = wrapFunction.call();
- if (r.hasNoValue())
- return "";
- return r.toString(scriptState);
+ return r.serialize(m_injectedScriptObject.scriptState());
}
void InjectedScript::releaseWrapperObjectGroup(const String& objectGroup)
{
ASSERT(!hasNoValue());
- ScriptState* scriptState = m_injectedScriptObject.scriptState();
- ScriptFunctionCall releaseFunction(scriptState, m_injectedScriptObject, "releaseWrapperObjectGroup");
+ ScriptFunctionCall releaseFunction(m_injectedScriptObject, "releaseWrapperObjectGroup");
releaseFunction.appendArgument(objectGroup);
releaseFunction.call();
}
diff --git a/WebCore/inspector/InjectedScript.h b/WebCore/inspector/InjectedScript.h
index b70ee39..db40f80 100644
--- a/WebCore/inspector/InjectedScript.h
+++ b/WebCore/inspector/InjectedScript.h
@@ -34,9 +34,11 @@
#include "InjectedScriptHost.h"
#include "ScriptObject.h"
#include <wtf/Noncopyable.h>
+#include <wtf/PassRefPtr.h>
namespace WebCore {
+class SerializedScriptValue;
class String;
class InjectedScript {
@@ -46,11 +48,11 @@ public:
bool hasNoValue() const { return m_injectedScriptObject.hasNoValue(); }
- void dispatch(long callId, const String& methodName, const String& arguments, bool async, String* result, bool* hadException);
+ void dispatch(long callId, const String& methodName, const String& arguments, bool async, RefPtr<SerializedScriptValue>* result, bool* hadException);
#if ENABLE(JAVASCRIPT_DEBUGGER)
- String callFrames();
+ PassRefPtr<SerializedScriptValue> callFrames();
#endif
- String wrapAndStringifyForConsole(ScriptValue);
+ PassRefPtr<SerializedScriptValue> wrapForConsole(ScriptValue);
void releaseWrapperObjectGroup(const String&);
private:
diff --git a/WebCore/inspector/InjectedScriptHost.cpp b/WebCore/inspector/InjectedScriptHost.cpp
index 13e156a..62db4b4 100644
--- a/WebCore/inspector/InjectedScriptHost.cpp
+++ b/WebCore/inspector/InjectedScriptHost.cpp
@@ -45,8 +45,6 @@
#include "InspectorFrontend.h"
#include "InspectorResource.h"
#include "Pasteboard.h"
-#include "ScriptArray.h"
-#include "ScriptFunctionCall.h"
#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
#include "JavaScriptCallFrame.h"
@@ -162,7 +160,7 @@ void InjectedScriptHost::selectDOMStorage(Storage* storage)
}
#endif
-void InjectedScriptHost::reportDidDispatchOnInjectedScript(long callId, const String& result, bool isException)
+void InjectedScriptHost::reportDidDispatchOnInjectedScript(long callId, SerializedScriptValue* result, bool isException)
{
if (InspectorFrontend* frontend = inspectorFrontend())
frontend->didDispatchOnInjectedScript(callId, result, isException);
diff --git a/WebCore/inspector/InjectedScriptHost.h b/WebCore/inspector/InjectedScriptHost.h
index 901472c..fb56115 100644
--- a/WebCore/inspector/InjectedScriptHost.h
+++ b/WebCore/inspector/InjectedScriptHost.h
@@ -46,6 +46,7 @@ class InspectorDOMAgent;
class InspectorFrontend;
class JavaScriptCallFrame;
class Node;
+class SerializedScriptValue;
class Storage;
class InjectedScriptHost : public RefCounted<InjectedScriptHost>
@@ -82,7 +83,7 @@ public:
#if ENABLE(DOM_STORAGE)
void selectDOMStorage(Storage* storage);
#endif
- void reportDidDispatchOnInjectedScript(long callId, const String& result, bool isException);
+ void reportDidDispatchOnInjectedScript(long callId, SerializedScriptValue* result, bool isException);
InjectedScript injectedScriptFor(ScriptState*);
InjectedScript injectedScriptForId(long);
diff --git a/WebCore/inspector/InjectedScriptHost.idl b/WebCore/inspector/InjectedScriptHost.idl
index d224d1a..bb57c3a 100644
--- a/WebCore/inspector/InjectedScriptHost.idl
+++ b/WebCore/inspector/InjectedScriptHost.idl
@@ -41,7 +41,7 @@ module core {
void addNodesToSearchResult(in DOMString nodeIds);
long pushNodeByPathToFrontend(in DOMString path);
-#if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER
+#if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER && !(defined(V8_BINDING) && V8_BINDING)
[Custom] DOMObject currentCallFrame();
[Custom] boolean isActivation(in DOMObject object);
#endif
@@ -55,6 +55,6 @@ module core {
[Custom] void selectDOMStorage(in DOMObject storage);
#endif
- void reportDidDispatchOnInjectedScript(in long callId, in DOMString result, in boolean isException);
+ [Custom] void reportDidDispatchOnInjectedScript(in long callId, in DOMObject result, in boolean isException);
};
}
diff --git a/WebCore/inspector/InspectorBackend.cpp b/WebCore/inspector/InspectorBackend.cpp
index 1ce0e69..c43be63 100644
--- a/WebCore/inspector/InspectorBackend.cpp
+++ b/WebCore/inspector/InspectorBackend.cpp
@@ -49,7 +49,7 @@
#include "InspectorResource.h"
#include "Pasteboard.h"
#include "ScriptArray.h"
-#include "ScriptFunctionCall.h"
+#include "SerializedScriptValue.h"
#if ENABLE(DOM_STORAGE)
#include "Storage.h"
@@ -222,6 +222,13 @@ void InspectorBackend::setPauseOnExceptionsState(long pauseState)
JavaScriptDebugServer::shared().setPauseOnExceptionsState(static_cast<JavaScriptDebugServer::PauseOnExceptionsState>(pauseState));
}
+JavaScriptCallFrame* InspectorBackend::currentCallFrame() const
+{
+ return JavaScriptDebugServer::shared().currentCallFrame();
+}
+#endif
+
+#if ENABLE(JAVASCRIPT_DEBUGGER)
bool InspectorBackend::profilerEnabled()
{
if (m_inspectorController)
@@ -264,11 +271,6 @@ void InspectorBackend::getProfile(long callId, unsigned uid)
if (m_inspectorController)
m_inspectorController->getProfile(callId, uid);
}
-
-JavaScriptCallFrame* InspectorBackend::currentCallFrame() const
-{
- return JavaScriptDebugServer::shared().currentCallFrame();
-}
#endif
void InspectorBackend::setInjectedScriptSource(const String& source)
@@ -295,12 +297,12 @@ void InspectorBackend::dispatchOnInjectedScript(long callId, long injectedScript
if (injectedScript.hasNoValue())
return;
- String result;
+ RefPtr<SerializedScriptValue> result;
bool hadException = false;
injectedScript.dispatch(callId, methodName, arguments, async, &result, &hadException);
if (async)
return; // InjectedScript will return result asynchronously by means of ::reportDidDispatchOnInjectedScript.
- frontend->didDispatchOnInjectedScript(callId, result, hadException);
+ frontend->didDispatchOnInjectedScript(callId, result.get(), hadException);
}
void InspectorBackend::getChildNodes(long callId, long nodeId)
diff --git a/WebCore/inspector/InspectorBackend.h b/WebCore/inspector/InspectorBackend.h
index 7c9644f..0df13f5 100644
--- a/WebCore/inspector/InspectorBackend.h
+++ b/WebCore/inspector/InspectorBackend.h
@@ -92,6 +92,9 @@ public:
void stepIntoStatementInDebugger();
void stepOutOfFunctionInDebugger();
+ JavaScriptCallFrame* currentCallFrame() const;
+#endif
+#if ENABLE(JAVASCRIPT_DEBUGGER)
bool profilerEnabled();
void enableProfiler(bool always);
void disableProfiler(bool always);
@@ -101,8 +104,6 @@ public:
void getProfileHeaders(long callId);
void getProfile(long callId, unsigned uid);
-
- JavaScriptCallFrame* currentCallFrame() const;
#endif
void setInjectedScriptSource(const String& source);
diff --git a/WebCore/inspector/InspectorBackend.idl b/WebCore/inspector/InspectorBackend.idl
index 043a9f5..9faae76 100644
--- a/WebCore/inspector/InspectorBackend.idl
+++ b/WebCore/inspector/InspectorBackend.idl
@@ -47,7 +47,7 @@ module core {
void startTimelineProfiler();
void stopTimelineProfiler();
-#if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER
+#if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER && !(defined(V8_BINDING) && V8_BINDING)
boolean debuggerEnabled();
void enableDebugger(in boolean always);
void disableDebugger(in boolean always);
@@ -65,7 +65,8 @@ module core {
long pauseOnExceptionsState();
void setPauseOnExceptionsState(in long pauseOnExceptionsState);
-
+#endif
+#if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER
boolean profilerEnabled();
void enableProfiler(in boolean always);
void disableProfiler(in boolean always);
diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp
index 1dbb898..3d0ba9e 100644
--- a/WebCore/inspector/InspectorController.cpp
+++ b/WebCore/inspector/InspectorController.cpp
@@ -53,8 +53,8 @@
#include "GraphicsContext.h"
#include "HTMLFrameOwnerElement.h"
#include "HitTestResult.h"
-#include "InjectedScriptHost.h"
#include "InjectedScript.h"
+#include "InjectedScriptHost.h"
#include "InspectorBackend.h"
#include "InspectorClient.h"
#include "InspectorDOMAgent.h"
@@ -72,6 +72,7 @@
#include "ResourceRequest.h"
#include "ResourceResponse.h"
#include "ScriptCallStack.h"
+#include "ScriptDebugServer.h"
#include "ScriptFunctionCall.h"
#include "ScriptObject.h"
#include "ScriptProfile.h"
@@ -146,7 +147,9 @@ InspectorController::InspectorController(Page* page, InspectorClient* client)
#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
, m_debuggerEnabled(false)
, m_attachDebuggerWhenShown(false)
- , m_profilerEnabled(false)
+#endif
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+ , m_profilerEnabled(!WTF_USE_JSC)
, m_recordingUserInitiatedProfile(false)
, m_currentUserInitiatedProfileNumber(-1)
, m_nextUserInitiatedProfileNumber(1)
@@ -542,7 +545,7 @@ void InspectorController::scriptObjectReady()
void InspectorController::setFrontendProxyObject(ScriptState* scriptState, ScriptObject webInspectorObj, ScriptObject)
{
m_frontendScriptState = scriptState;
- m_frontend.set(new InspectorFrontend(this, scriptState, webInspectorObj));
+ m_frontend.set(new InspectorFrontend(this, webInspectorObj));
releaseDOMAgent();
m_domAgent = InspectorDOMAgent::create(m_frontend.get());
if (m_timelineAgent)
@@ -1180,7 +1183,7 @@ void InspectorController::getCookies(long callId)
for (ResourcesMap::iterator it = m_resources.begin(); it != resourcesEnd; ++it) {
Document* document = it->second->frame()->document();
Vector<Cookie> docCookiesList;
- rawCookiesImplemented = getRawCookies(document, document->cookieURL(), docCookiesList);
+ rawCookiesImplemented = getRawCookies(document, it->second->requestURL(), docCookiesList);
if (!rawCookiesImplemented) {
// FIXME: We need duplication checking for the String representation of cookies.
@@ -1342,7 +1345,7 @@ void InspectorController::moveWindowBy(float x, float y) const
m_page->chrome()->setWindowRect(frameRect);
}
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
+#if ENABLE(JAVASCRIPT_DEBUGGER)
void InspectorController::addProfile(PassRefPtr<ScriptProfile> prpProfile, unsigned lineNumber, const String& sourceURL)
{
if (!enabled())
@@ -1352,7 +1355,9 @@ void InspectorController::addProfile(PassRefPtr<ScriptProfile> prpProfile, unsig
m_profiles.add(profile->uid(), profile);
if (m_frontend) {
+#if USE(JSC)
JSLock lock(SilenceAssertionsOnly);
+#endif
m_frontend->addProfileHeader(createProfileHeader(*profile));
}
@@ -1390,8 +1395,10 @@ void InspectorController::getProfile(long callId, unsigned uid)
if (!m_frontend)
return;
ProfilesMap::iterator it = m_profiles.find(uid);
+#if USE(JSC)
if (it != m_profiles.end())
m_frontend->didGetProfile(callId, toJS(m_frontendScriptState, it->second.get()));
+#endif
}
ScriptObject InspectorController::createProfileHeader(const ScriptProfile& profile)
@@ -1423,14 +1430,18 @@ void InspectorController::startUserInitiatedProfiling(Timer<InspectorController>
if (!profilerEnabled()) {
enableProfiler(false, true);
- JavaScriptDebugServer::shared().recompileAllJSFunctions();
+ ScriptDebugServer::recompileAllJSFunctions();
}
m_recordingUserInitiatedProfile = true;
String title = getCurrentUserInitiatedProfileName(true);
+#if USE(JSC)
ExecState* scriptState = toJSDOMWindow(m_inspectedPage->mainFrame(), debuggerWorld())->globalExec();
+#else
+ ScriptState* scriptState = 0;
+#endif
ScriptProfiler::start(scriptState, title);
addStartProfilingMessageToConsole(title, 0, String());
@@ -1447,7 +1458,11 @@ void InspectorController::stopUserInitiatedProfiling()
String title = getCurrentUserInitiatedProfileName();
+#if USE(JSC)
ExecState* scriptState = toJSDOMWindow(m_inspectedPage->mainFrame(), debuggerWorld())->globalExec();
+#else
+ ScriptState* scriptState = 0;
+#endif
RefPtr<ScriptProfile> profile = ScriptProfiler::stop(scriptState, title);
if (profile)
addProfile(profile, 0, String());
@@ -1473,7 +1488,7 @@ void InspectorController::enableProfiler(bool always, bool skipRecompile)
m_profilerEnabled = true;
if (!skipRecompile)
- JavaScriptDebugServer::shared().recompileAllJSFunctionsSoon();
+ ScriptDebugServer::recompileAllJSFunctionsSoon();
if (m_frontend)
m_frontend->profilerWasEnabled();
@@ -1489,12 +1504,14 @@ void InspectorController::disableProfiler(bool always)
m_profilerEnabled = false;
- JavaScriptDebugServer::shared().recompileAllJSFunctionsSoon();
+ ScriptDebugServer::recompileAllJSFunctionsSoon();
if (m_frontend)
m_frontend->profilerWasDisabled();
}
+#endif
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
void InspectorController::enableDebuggerFromFrontend(bool always)
{
if (always)
@@ -1569,8 +1586,8 @@ void InspectorController::didPause()
ScriptState* scriptState = callFrame->scopeChain()->globalObject->globalExec();
ASSERT(scriptState);
InjectedScript injectedScript = m_injectedScriptHost->injectedScriptFor(scriptState);
- String callFrames = injectedScript.callFrames();
- m_frontend->pausedScript(callFrames);
+ RefPtr<SerializedScriptValue> callFrames = injectedScript.callFrames();
+ m_frontend->pausedScript(callFrames.get());
}
void InspectorController::didContinue()
@@ -1593,7 +1610,7 @@ void InspectorController::didEvaluateForTestInFrontend(long callId, const String
ScriptState* scriptState = scriptStateFromPage(debuggerWorld(), m_inspectedPage);
ScriptObject window;
ScriptGlobalObject::get(scriptState, "window", window);
- ScriptFunctionCall function(scriptState, window, "didEvaluateForTestInFrontend");
+ ScriptFunctionCall function(window, "didEvaluateForTestInFrontend");
function.appendArgument(callId);
function.appendArgument(jsonResult);
function.call();
@@ -1802,7 +1819,7 @@ void InspectorController::deleteCookie(const String& cookieName, const String& d
for (ResourcesMap::iterator it = m_resources.begin(); it != resourcesEnd; ++it) {
Document* document = it->second->frame()->document();
if (document->url().host() == domain)
- WebCore::deleteCookie(document, document->cookieURL(), cookieName);
+ WebCore::deleteCookie(document, it->second->requestURL(), cookieName);
}
}
diff --git a/WebCore/inspector/InspectorController.h b/WebCore/inspector/InspectorController.h
index 6904380..2f25eec 100644
--- a/WebCore/inspector/InspectorController.h
+++ b/WebCore/inspector/InspectorController.h
@@ -220,7 +220,7 @@ public:
void markTimeline(const String& message);
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
+#if ENABLE(JAVASCRIPT_DEBUGGER)
void addProfile(PassRefPtr<ScriptProfile>, unsigned lineNumber, const String& sourceURL);
void addProfileFinishedMessageToConsole(PassRefPtr<ScriptProfile>, unsigned lineNumber, const String& sourceURL);
void addStartProfilingMessageToConsole(const String& title, unsigned lineNumber, const String& sourceURL);
@@ -234,7 +234,9 @@ public:
void enableProfiler(bool always = false, bool skipRecompile = false);
void disableProfiler(bool always = false);
bool profilerEnabled() const { return enabled() && m_profilerEnabled; }
+#endif
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
void enableDebugger();
void disableDebugger(bool always = false);
bool debuggerEnabled() const { return m_debuggerEnabled; }
@@ -268,7 +270,7 @@ private:
void deleteCookie(const String& cookieName, const String& domain);
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
+#if ENABLE(JAVASCRIPT_DEBUGGER)
typedef HashMap<unsigned int, RefPtr<ScriptProfile> > ProfilesMap;
void startUserInitiatedProfilingSoon();
@@ -349,6 +351,8 @@ private:
#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
bool m_debuggerEnabled;
bool m_attachDebuggerWhenShown;
+#endif
+#if ENABLE(JAVASCRIPT_DEBUGGER)
bool m_profilerEnabled;
bool m_recordingUserInitiatedProfile;
int m_currentUserInitiatedProfileNumber;
diff --git a/WebCore/inspector/InspectorDOMAgent.cpp b/WebCore/inspector/InspectorDOMAgent.cpp
index 8b0b6f8..0387f30 100644
--- a/WebCore/inspector/InspectorDOMAgent.cpp
+++ b/WebCore/inspector/InspectorDOMAgent.cpp
@@ -204,7 +204,7 @@ bool InspectorDOMAgent::pushDocumentToFrontend()
void InspectorDOMAgent::pushChildNodesToFrontend(long nodeId)
{
Node* node = nodeForId(nodeId);
- if (!node || (node->nodeType() != Node::ELEMENT_NODE && node->nodeType() != Node::DOCUMENT_NODE))
+ if (!node || (node->nodeType() != Node::ELEMENT_NODE && node->nodeType() != Node::DOCUMENT_NODE && node->nodeType() != Node::DOCUMENT_FRAGMENT_NODE))
return;
if (m_childrenRequested.contains(nodeId))
return;
@@ -464,7 +464,7 @@ ScriptObject InspectorDOMAgent::buildObjectForNode(Node* node, int depth, NodeTo
value.set("localName", localName);
value.set("nodeValue", nodeValue);
- if (node->nodeType() == Node::ELEMENT_NODE || node->nodeType() == Node::DOCUMENT_NODE) {
+ if (node->nodeType() == Node::ELEMENT_NODE || node->nodeType() == Node::DOCUMENT_NODE || node->nodeType() == Node::DOCUMENT_FRAGMENT_NODE) {
int nodeCount = innerChildNodeCount(node);
value.set("childNodeCount", nodeCount);
ScriptArray children = buildArrayForContainerChildren(node, depth, nodesMap);
@@ -478,7 +478,7 @@ ScriptObject InspectorDOMAgent::buildObjectForNode(Node* node, int depth, NodeTo
HTMLFrameOwnerElement* frameOwner = static_cast<HTMLFrameOwnerElement*>(node);
value.set("documentURL", documentURLString(frameOwner->contentDocument()));
}
- } else {
+ } else if (node->nodeType() == Node::DOCUMENT_NODE) {
Document* document = static_cast<Document*>(node);
value.set("documentURL", documentURLString(document));
}
diff --git a/WebCore/inspector/InspectorFrontend.cpp b/WebCore/inspector/InspectorFrontend.cpp
index c3bf1b4..90b60f4 100644..100755
--- a/WebCore/inspector/InspectorFrontend.cpp
+++ b/WebCore/inspector/InspectorFrontend.cpp
@@ -42,6 +42,8 @@
#include "ScriptObject.h"
#include "ScriptState.h"
#include "ScriptString.h"
+#include "ScriptValue.h"
+#include "SerializedScriptValue.h"
#include <wtf/OwnPtr.h>
#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
@@ -52,9 +54,8 @@
namespace WebCore {
-InspectorFrontend::InspectorFrontend(InspectorController* inspectorController, ScriptState* scriptState, ScriptObject webInspector)
+InspectorFrontend::InspectorFrontend(InspectorController* inspectorController, ScriptObject webInspector)
: m_inspectorController(inspectorController)
- , m_scriptState(scriptState)
, m_webInspector(webInspector)
{
}
@@ -66,12 +67,12 @@ InspectorFrontend::~InspectorFrontend()
ScriptArray InspectorFrontend::newScriptArray()
{
- return ScriptArray::createNew(m_scriptState);
+ return ScriptArray::createNew(scriptState());
}
ScriptObject InspectorFrontend::newScriptObject()
{
- return ScriptObject::createNew(m_scriptState);
+ return ScriptObject::createNew(scriptState());
}
void InspectorFrontend::didCommitLoad()
@@ -81,7 +82,7 @@ void InspectorFrontend::didCommitLoad()
void InspectorFrontend::populateFrontendSettings(const String& settings)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("populateFrontendSettings");
function.appendArgument(settings);
function.call();
@@ -89,7 +90,7 @@ void InspectorFrontend::populateFrontendSettings(const String& settings)
void InspectorFrontend::updateConsoleMessageExpiredCount(unsigned count)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("updateConsoleMessageExpiredCount");
function.appendArgument(count);
function.call();
@@ -97,22 +98,24 @@ void InspectorFrontend::updateConsoleMessageExpiredCount(unsigned count)
void InspectorFrontend::addConsoleMessage(const ScriptObject& messageObj, const Vector<ScriptString>& frames, ScriptState* scriptState, const Vector<ScriptValue> arguments, const String& message)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("addConsoleMessage");
function.appendArgument(messageObj);
if (!frames.isEmpty()) {
- function.appendArgument(false);
for (unsigned i = 0; i < frames.size(); ++i)
function.appendArgument(frames[i]);
} else if (!arguments.isEmpty()) {
- function.appendArgument(true);
InjectedScript injectedScript = m_inspectorController->injectedScriptHost()->injectedScriptFor(scriptState);
for (unsigned i = 0; i < arguments.size(); ++i) {
- String s = injectedScript.wrapAndStringifyForConsole(arguments[i]);
- function.appendArgument(s);
+ RefPtr<SerializedScriptValue> serializedValue = injectedScript.wrapForConsole(arguments[i]);
+ ScriptValue scriptValue = ScriptValue::deserialize(this->scriptState(), serializedValue.get());
+ if (scriptValue.hasNoValue()) {
+ ASSERT_NOT_REACHED();
+ return;
+ }
+ function.appendArgument(scriptValue);
}
} else {
- function.appendArgument(false);
function.appendArgument(message);
}
function.call();
@@ -120,7 +123,7 @@ void InspectorFrontend::addConsoleMessage(const ScriptObject& messageObj, const
void InspectorFrontend::updateConsoleMessageRepeatCount(unsigned count)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("updateConsoleMessageRepeatCount");
function.appendArgument(count);
function.call();
@@ -133,7 +136,7 @@ void InspectorFrontend::clearConsoleMessages()
bool InspectorFrontend::updateResource(unsigned long identifier, const ScriptObject& resourceObj)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("updateResource");
function.appendArgument(identifier);
function.appendArgument(resourceObj);
@@ -144,7 +147,7 @@ bool InspectorFrontend::updateResource(unsigned long identifier, const ScriptObj
void InspectorFrontend::removeResource(unsigned long identifier)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("removeResource");
function.appendArgument(identifier);
function.call();
@@ -152,7 +155,7 @@ void InspectorFrontend::removeResource(unsigned long identifier)
void InspectorFrontend::didGetResourceContent(int callId, const String& content)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("didGetResourceContent");
function.appendArgument(callId);
function.appendArgument(content);
@@ -161,7 +164,7 @@ void InspectorFrontend::didGetResourceContent(int callId, const String& content)
void InspectorFrontend::updateFocusedNode(long nodeId)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("updateFocusedNode");
function.appendArgument(nodeId);
function.call();
@@ -169,7 +172,7 @@ void InspectorFrontend::updateFocusedNode(long nodeId)
void InspectorFrontend::setAttachedWindow(bool attached)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("setAttachedWindow");
function.appendArgument(attached);
function.call();
@@ -241,7 +244,7 @@ void InspectorFrontend::timelineProfilerWasStopped()
void InspectorFrontend::addRecordToTimeline(const ScriptObject& record)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("addRecordToTimeline");
function.appendArgument(record);
function.call();
@@ -263,19 +266,9 @@ void InspectorFrontend::debuggerWasDisabled()
callSimpleFunction("debuggerWasDisabled");
}
-void InspectorFrontend::profilerWasEnabled()
-{
- callSimpleFunction("profilerWasEnabled");
-}
-
-void InspectorFrontend::profilerWasDisabled()
-{
- callSimpleFunction("profilerWasDisabled");
-}
-
void InspectorFrontend::parsedScriptSource(const JSC::SourceCode& source)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("parsedScriptSource");
function.appendArgument(JSC::UString(JSC::UString::from(source.provider()->asID())));
function.appendArgument(source.provider()->url());
@@ -286,7 +279,7 @@ void InspectorFrontend::parsedScriptSource(const JSC::SourceCode& source)
void InspectorFrontend::failedToParseScriptSource(const JSC::SourceCode& source, int errorLine, const JSC::UString& errorMessage)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("failedToParseScriptSource");
function.appendArgument(source.provider()->url());
function.appendArgument(JSC::UString(source.data(), source.length()));
@@ -296,9 +289,35 @@ void InspectorFrontend::failedToParseScriptSource(const JSC::SourceCode& source,
function.call();
}
+void InspectorFrontend::pausedScript(SerializedScriptValue* callFrames)
+{
+ ScriptValue callFramesValue = ScriptValue::deserialize(scriptState(), callFrames);
+ ScriptFunctionCall function(m_webInspector, "dispatch");
+ function.appendArgument("pausedScript");
+ function.appendArgument(callFramesValue);
+ function.call();
+}
+
+void InspectorFrontend::resumedScript()
+{
+ callSimpleFunction("resumedScript");
+}
+#endif
+
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+void InspectorFrontend::profilerWasEnabled()
+{
+ callSimpleFunction("profilerWasEnabled");
+}
+
+void InspectorFrontend::profilerWasDisabled()
+{
+ callSimpleFunction("profilerWasDisabled");
+}
+
void InspectorFrontend::addProfileHeader(const ScriptValue& profile)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("addProfileHeader");
function.appendArgument(profile);
function.call();
@@ -306,7 +325,7 @@ void InspectorFrontend::addProfileHeader(const ScriptValue& profile)
void InspectorFrontend::setRecordingProfile(bool isProfiling)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("setRecordingProfile");
function.appendArgument(isProfiling);
function.call();
@@ -314,7 +333,7 @@ void InspectorFrontend::setRecordingProfile(bool isProfiling)
void InspectorFrontend::didGetProfileHeaders(int callId, const ScriptArray& headers)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("didGetProfileHeaders");
function.appendArgument(callId);
function.appendArgument(headers);
@@ -323,30 +342,17 @@ void InspectorFrontend::didGetProfileHeaders(int callId, const ScriptArray& head
void InspectorFrontend::didGetProfile(int callId, const ScriptValue& profile)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("didGetProfile");
function.appendArgument(callId);
function.appendArgument(profile);
function.call();
}
-
-void InspectorFrontend::pausedScript(const String& callFrames)
-{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
- function.appendArgument("pausedScript");
- function.appendArgument(callFrames);
- function.call();
-}
-
-void InspectorFrontend::resumedScript()
-{
- callSimpleFunction("resumedScript");
-}
#endif
void InspectorFrontend::setDocument(const ScriptObject& root)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("setDocument");
function.appendArgument(root);
function.call();
@@ -354,7 +360,7 @@ void InspectorFrontend::setDocument(const ScriptObject& root)
void InspectorFrontend::setDetachedRoot(const ScriptObject& root)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("setDetachedRoot");
function.appendArgument(root);
function.call();
@@ -362,7 +368,7 @@ void InspectorFrontend::setDetachedRoot(const ScriptObject& root)
void InspectorFrontend::setChildNodes(int parentId, const ScriptArray& nodes)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("setChildNodes");
function.appendArgument(parentId);
function.appendArgument(nodes);
@@ -371,7 +377,7 @@ void InspectorFrontend::setChildNodes(int parentId, const ScriptArray& nodes)
void InspectorFrontend::childNodeCountUpdated(int id, int newValue)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("childNodeCountUpdated");
function.appendArgument(id);
function.appendArgument(newValue);
@@ -380,7 +386,7 @@ void InspectorFrontend::childNodeCountUpdated(int id, int newValue)
void InspectorFrontend::childNodeInserted(int parentId, int prevId, const ScriptObject& node)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("childNodeInserted");
function.appendArgument(parentId);
function.appendArgument(prevId);
@@ -390,7 +396,7 @@ void InspectorFrontend::childNodeInserted(int parentId, int prevId, const Script
void InspectorFrontend::childNodeRemoved(int parentId, int id)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("childNodeRemoved");
function.appendArgument(parentId);
function.appendArgument(id);
@@ -399,7 +405,7 @@ void InspectorFrontend::childNodeRemoved(int parentId, int id)
void InspectorFrontend::attributesUpdated(int id, const ScriptArray& attributes)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("attributesUpdated");
function.appendArgument(id);
function.appendArgument(attributes);
@@ -408,7 +414,7 @@ void InspectorFrontend::attributesUpdated(int id, const ScriptArray& attributes)
void InspectorFrontend::didRemoveNode(int callId, int nodeId)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("didRemoveNode");
function.appendArgument(callId);
function.appendArgument(nodeId);
@@ -417,7 +423,7 @@ void InspectorFrontend::didRemoveNode(int callId, int nodeId)
void InspectorFrontend::didGetChildNodes(int callId)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("didGetChildNodes");
function.appendArgument(callId);
function.call();
@@ -425,7 +431,7 @@ void InspectorFrontend::didGetChildNodes(int callId)
void InspectorFrontend::didApplyDomChange(int callId, bool success)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("didApplyDomChange");
function.appendArgument(callId);
function.appendArgument(success);
@@ -434,7 +440,7 @@ void InspectorFrontend::didApplyDomChange(int callId, bool success)
void InspectorFrontend::didGetEventListenersForNode(int callId, int nodeId, ScriptArray& listenersArray)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("didGetEventListenersForNode");
function.appendArgument(callId);
function.appendArgument(nodeId);
@@ -444,7 +450,7 @@ void InspectorFrontend::didGetEventListenersForNode(int callId, int nodeId, Scri
void InspectorFrontend::didGetCookies(int callId, const ScriptArray& cookies, const String& cookiesString)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("didGetCookies");
function.appendArgument(callId);
function.appendArgument(cookies);
@@ -452,12 +458,17 @@ void InspectorFrontend::didGetCookies(int callId, const ScriptArray& cookies, co
function.call();
}
-void InspectorFrontend::didDispatchOnInjectedScript(int callId, const String& result, bool isException)
+void InspectorFrontend::didDispatchOnInjectedScript(int callId, SerializedScriptValue* result, bool isException)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("didDispatchOnInjectedScript");
function.appendArgument(callId);
- function.appendArgument(result);
+ if (isException)
+ function.appendArgument("");
+ else {
+ ScriptValue resultValue = ScriptValue::deserialize(scriptState(), result);
+ function.appendArgument(resultValue);
+ }
function.appendArgument(isException);
function.call();
}
@@ -465,7 +476,7 @@ void InspectorFrontend::didDispatchOnInjectedScript(int callId, const String& re
#if ENABLE(DATABASE)
bool InspectorFrontend::addDatabase(const ScriptObject& dbObject)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("addDatabase");
function.appendArgument(dbObject);
bool hadException = false;
@@ -475,14 +486,14 @@ bool InspectorFrontend::addDatabase(const ScriptObject& dbObject)
void InspectorFrontend::selectDatabase(int databaseId)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("selectDatabase");
function.appendArgument(databaseId);
function.call();
}
void InspectorFrontend::didGetDatabaseTableNames(int callId, const ScriptArray& tableNames)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("didGetDatabaseTableNames");
function.appendArgument(callId);
function.appendArgument(tableNames);
@@ -493,7 +504,7 @@ void InspectorFrontend::didGetDatabaseTableNames(int callId, const ScriptArray&
#if ENABLE(DOM_STORAGE)
bool InspectorFrontend::addDOMStorage(const ScriptObject& domStorageObj)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("addDOMStorage");
function.appendArgument(domStorageObj);
bool hadException = false;
@@ -503,7 +514,7 @@ bool InspectorFrontend::addDOMStorage(const ScriptObject& domStorageObj)
void InspectorFrontend::selectDOMStorage(int storageId)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("selectDOMStorage");
function.appendArgument(storageId);
function.call();
@@ -511,7 +522,7 @@ void InspectorFrontend::selectDOMStorage(int storageId)
void InspectorFrontend::didGetDOMStorageEntries(int callId, const ScriptArray& entries)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("didGetDOMStorageEntries");
function.appendArgument(callId);
function.appendArgument(entries);
@@ -520,7 +531,7 @@ void InspectorFrontend::didGetDOMStorageEntries(int callId, const ScriptArray& e
void InspectorFrontend::didSetDOMStorageItem(int callId, bool success)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("didSetDOMStorageItem");
function.appendArgument(callId);
function.appendArgument(success);
@@ -529,7 +540,7 @@ void InspectorFrontend::didSetDOMStorageItem(int callId, bool success)
void InspectorFrontend::didRemoveDOMStorageItem(int callId, bool success)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("didRemoveDOMStorageItem");
function.appendArgument(callId);
function.appendArgument(success);
@@ -538,7 +549,7 @@ void InspectorFrontend::didRemoveDOMStorageItem(int callId, bool success)
void InspectorFrontend::updateDOMStorage(int storageId)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("updateDOMStorage");
function.appendArgument(storageId);
function.call();
@@ -547,7 +558,7 @@ void InspectorFrontend::updateDOMStorage(int storageId)
void InspectorFrontend::addNodesToSearchResult(const String& nodeIds)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("addNodesToSearchResult");
function.appendArgument(nodeIds);
function.call();
@@ -555,7 +566,7 @@ void InspectorFrontend::addNodesToSearchResult(const String& nodeIds)
void InspectorFrontend::contextMenuItemSelected(int itemId)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("contextMenuItemSelected");
function.appendArgument(itemId);
function.call();
@@ -568,7 +579,7 @@ void InspectorFrontend::contextMenuCleared()
void InspectorFrontend::evaluateForTestInFrontend(int callId, const String& script)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("evaluateForTestInFrontend");
function.appendArgument(callId);
function.appendArgument(script);
@@ -577,7 +588,7 @@ void InspectorFrontend::evaluateForTestInFrontend(int callId, const String& scri
void InspectorFrontend::callSimpleFunction(const String& functionName)
{
- ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch");
+ ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument(functionName);
function.call();
}
diff --git a/WebCore/inspector/InspectorFrontend.h b/WebCore/inspector/InspectorFrontend.h
index a36a323..1a37256 100644
--- a/WebCore/inspector/InspectorFrontend.h
+++ b/WebCore/inspector/InspectorFrontend.h
@@ -50,13 +50,13 @@ namespace WebCore {
class InspectorController;
class InspectorResource;
class Node;
- class ScriptFunctionCall;
class ScriptString;
+ class SerializedScriptValue;
class Storage;
class InspectorFrontend : public Noncopyable {
public:
- InspectorFrontend(InspectorController* inspectorController, ScriptState*, ScriptObject webInspector);
+ InspectorFrontend(InspectorController* inspectorController, ScriptObject webInspector);
~InspectorFrontend();
ScriptArray newScriptArray();
@@ -88,16 +88,18 @@ namespace WebCore {
void attachDebuggerWhenShown();
void debuggerWasEnabled();
void debuggerWasDisabled();
- void profilerWasEnabled();
- void profilerWasDisabled();
void parsedScriptSource(const JSC::SourceCode&);
void failedToParseScriptSource(const JSC::SourceCode&, int errorLine, const JSC::UString& errorMessage);
+ void pausedScript(SerializedScriptValue* callFrames);
+ void resumedScript();
+#endif
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+ void profilerWasEnabled();
+ void profilerWasDisabled();
void addProfileHeader(const ScriptValue& profile);
void setRecordingProfile(bool isProfiling);
void didGetProfileHeaders(int callId, const ScriptArray& headers);
void didGetProfile(int callId, const ScriptValue& profile);
- void pausedScript(const String& callFrames);
- void resumedScript();
#endif
#if ENABLE(DATABASE)
@@ -132,20 +134,19 @@ namespace WebCore {
void addRecordToTimeline(const ScriptObject&);
void didGetCookies(int callId, const ScriptArray& cookies, const String& cookiesString);
- void didDispatchOnInjectedScript(int callId, const String& result, bool isException);
+ void didDispatchOnInjectedScript(int callId, SerializedScriptValue* result, bool isException);
void addNodesToSearchResult(const String& nodeIds);
void contextMenuItemSelected(int itemId);
void contextMenuCleared();
- ScriptState* scriptState() const { return m_scriptState; }
+ ScriptState* scriptState() const { return m_webInspector.scriptState(); }
void evaluateForTestInFrontend(int callId, const String& script);
private:
void callSimpleFunction(const String& functionName);
InspectorController* m_inspectorController;
- ScriptState* m_scriptState;
ScriptObject m_webInspector;
};
diff --git a/WebCore/inspector/InspectorResource.cpp b/WebCore/inspector/InspectorResource.cpp
index 191d271..6f08d58 100644
--- a/WebCore/inspector/InspectorResource.cpp
+++ b/WebCore/inspector/InspectorResource.cpp
@@ -147,7 +147,7 @@ void InspectorResource::updateScriptObject(InspectorFrontend* frontend)
ScriptObject jsonObject = frontend->newScriptObject();
if (m_changes.hasChange(RequestChange)) {
- jsonObject.set("url", requestURL());
+ jsonObject.set("url", m_requestURL.string());
jsonObject.set("documentURL", m_frame->document()->url().string());
jsonObject.set("host", m_requestURL.host());
jsonObject.set("path", m_requestURL.path());
@@ -231,7 +231,7 @@ CachedResource* InspectorResource::cachedResource() const
// Try hard to find a corresponding CachedResource. During preloading, DocLoader may not have the resource in document resources set yet,
// but Inspector will already try to fetch data that is only available via CachedResource (and it won't update once the resource is added,
// because m_changes will not have the appropriate bits set).
- const String& url = requestURL();
+ const String& url = m_requestURL.string();
CachedResource* cachedResource = m_frame->document()->docLoader()->cachedResource(url);
if (!cachedResource)
cachedResource = cache()->resourceForURL(url);
diff --git a/WebCore/inspector/InspectorResource.h b/WebCore/inspector/InspectorResource.h
index ce86dd7..d347e5c 100644
--- a/WebCore/inspector/InspectorResource.h
+++ b/WebCore/inspector/InspectorResource.h
@@ -92,7 +92,7 @@ namespace WebCore {
bool isSameLoader(DocumentLoader* loader) const { return loader == m_loader; }
void markMainResource() { m_isMainResource = true; }
unsigned long identifier() const { return m_identifier; }
- String requestURL() const { return m_requestURL.string(); }
+ KURL requestURL() const { return m_requestURL; }
Frame* frame() const { return m_frame.get(); }
const String& mimeType() const { return m_mimeType; }
const HTTPHeaderMap& requestHeaderFields() const { return m_requestHeaderFields; }
diff --git a/WebCore/inspector/front-end/AuditCategories.js b/WebCore/inspector/front-end/AuditCategories.js
new file mode 100644
index 0000000..6931b5f
--- /dev/null
+++ b/WebCore/inspector/front-end/AuditCategories.js
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.AuditCategories.PagePerformance = function() {
+ WebInspector.AuditCategory.call(this, WebInspector.AuditCategories.PagePerformance.AuditCategoryName);
+}
+
+WebInspector.AuditCategories.PagePerformance.AuditCategoryName = "Web Page Performance";
+
+WebInspector.AuditCategories.PagePerformance.prototype = {
+ initialize: function()
+ {
+ this.addRule(new WebInspector.AuditRules.UnusedCssRule());
+ this.addRule(new WebInspector.AuditRules.CssInHeadRule({InlineURLScore: 6, InlineStylesheetScore: 21}));
+ this.addRule(new WebInspector.AuditRules.StylesScriptsOrderRule({CSSAfterJSURLScore: 11, InlineBetweenResourcesScore: 21}));
+ }
+}
+
+WebInspector.AuditCategories.PagePerformance.prototype.__proto__ = WebInspector.AuditCategory.prototype;
+
+WebInspector.AuditCategories.NetworkUtilization = function() {
+ WebInspector.AuditCategory.call(this, WebInspector.AuditCategories.NetworkUtilization.AuditCategoryName);
+}
+
+WebInspector.AuditCategories.NetworkUtilization.AuditCategoryName = "Network Utilization";
+
+WebInspector.AuditCategories.NetworkUtilization.prototype = {
+ initialize: function()
+ {
+ this.addRule(new WebInspector.AuditRules.GzipRule());
+ this.addRule(new WebInspector.AuditRules.ImageDimensionsRule({ScorePerImageUse: 5}));
+ this.addRule(new WebInspector.AuditRules.CookieSizeRule({MinBytesThreshold: 400, MaxBytesThreshold: 1000}));
+ this.addRule(new WebInspector.AuditRules.StaticCookielessRule({MinResources: 5}));
+ this.addRule(new WebInspector.AuditRules.CombineJsResourcesRule({AllowedPerDomain: 2, ScorePerResource: 11}));
+ this.addRule(new WebInspector.AuditRules.CombineCssResourcesRule({AllowedPerDomain: 2, ScorePerResource: 11}));
+ this.addRule(new WebInspector.AuditRules.MinimizeDnsLookupsRule({HostCountThreshold: 4, ViolationDomainScore: 6}));
+ this.addRule(new WebInspector.AuditRules.ParallelizeDownloadRule({OptimalHostnameCount: 4, MinRequestThreshold: 10, MinBalanceThreshold: 0.5}));
+ this.addRule(new WebInspector.AuditRules.BrowserCacheControlRule());
+ this.addRule(new WebInspector.AuditRules.ProxyCacheControlRule());
+ }
+}
+
+WebInspector.AuditCategories.NetworkUtilization.prototype.__proto__ = WebInspector.AuditCategory.prototype;
diff --git a/WebCore/inspector/front-end/AuditLauncherView.js b/WebCore/inspector/front-end/AuditLauncherView.js
index 79fbb92..f2a2fd2 100644
--- a/WebCore/inspector/front-end/AuditLauncherView.js
+++ b/WebCore/inspector/front-end/AuditLauncherView.js
@@ -63,11 +63,11 @@ WebInspector.AuditLauncherView = function(categoriesById, runnerCallback)
}
WebInspector.AuditLauncherView.prototype = {
- updateResourceTrackingState: function()
+ updateResourceTrackingState: function(isTracking)
{
if (!this._auditPresentStateLabelElement)
return;
- if (InspectorBackend.resourceTrackingEnabled()) {
+ if (isTracking) {
this._auditPresentStateLabelElement.nodeValue = WebInspector.UIString("Audit Present State");
this._auditPresentStateElement.disabled = false;
this._auditPresentStateElement.parentElement.removeStyleClass("disabled");
@@ -197,7 +197,6 @@ WebInspector.AuditLauncherView.prototype = {
this._selectAllClicked(this._selectAllCheckboxElement.checked);
this.updateResourceTrackingState();
this._updateButton();
- this.resize();
},
_updateButton: function()
@@ -209,6 +208,12 @@ WebInspector.AuditLauncherView.prototype = {
this._launchButton.textContent = WebInspector.UIString("Run");
},
+ show: function(parentElement)
+ {
+ WebInspector.View.prototype.show.call(this, parentElement);
+ setTimeout(this.resize(), 0);
+ },
+
resize: function()
{
if (this._categoriesElement)
diff --git a/WebCore/inspector/front-end/AuditRules.js b/WebCore/inspector/front-end/AuditRules.js
new file mode 100644
index 0000000..210b8a9
--- /dev/null
+++ b/WebCore/inspector/front-end/AuditRules.js
@@ -0,0 +1,1213 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.AuditRules.IPAddressRegexp = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;
+
+WebInspector.AuditRules.CacheableResponseCodes =
+{
+ 200: true,
+ 203: true,
+ 206: true,
+ 300: true,
+ 301: true,
+ 410: true,
+
+ 304: true // Underlying resource is cacheable
+}
+
+/**
+ * @param {Array} array Array of Elements (outerHTML is used) or strings (plain value is used as innerHTML)
+ */
+WebInspector.AuditRules.arrayAsUL = function(array, shouldLinkify)
+{
+ if (!array.length)
+ return "";
+ var ulElement = document.createElement("ul");
+ for (var i = 0; i < array.length; ++i) {
+ var liElement = document.createElement("li");
+ if (array[i] instanceof Element)
+ liElement.appendChild(array[i]);
+ else if (shouldLinkify)
+ liElement.appendChild(WebInspector.linkifyURLAsNode(array[i]));
+ else
+ liElement.innerHTML = array[i];
+ ulElement.appendChild(liElement);
+ }
+ return ulElement.outerHTML;
+}
+
+WebInspector.AuditRules.getDomainToResourcesMap = function(resources, types, regexp, needFullResources)
+{
+ var domainToResourcesMap = {};
+ for (var i = 0, size = resources.length; i < size; ++i) {
+ var resource = resources[i];
+ if (types && types.indexOf(resource.type) === -1)
+ continue;
+ var match = resource.url.match(regexp);
+ if (!match)
+ continue;
+ var domain = match[2];
+ var domainResources = domainToResourcesMap[domain];
+ if (domainResources === undefined) {
+ domainResources = [];
+ domainToResourcesMap[domain] = domainResources;
+ }
+ domainResources.push(needFullResources ? resource : resource.url);
+ }
+ return domainToResourcesMap;
+}
+
+WebInspector.AuditRules.evaluateInTargetWindow = function(func, callback)
+{
+ InjectedScriptAccess.getDefault().evaluateOnSelf(func.toString(), callback);
+}
+
+
+WebInspector.AuditRules.GzipRule = function()
+{
+ WebInspector.AuditRule.call(this, "network-gzip", "Enable gzip compression");
+}
+
+WebInspector.AuditRules.GzipRule.prototype = {
+ doRun: function(resources, result, callback)
+ {
+ try {
+ var commonMessage = undefined;
+ var totalSavings = 0;
+ var compressedSize = 0
+ var candidateSize = 0
+ var outputResources = [];
+ for (var i = 0, length = resources.length; i < length; ++i) {
+ var resource = resources[i];
+ if (this._shouldCompress(resource)) {
+ var size = resource.contentLength;
+ candidateSize += size;
+ if (this._isCompressed(resource)) {
+ compressedSize += size;
+ continue;
+ }
+ if (!commonMessage)
+ commonMessage = result.appendChild("");
+ var savings = 2 * size / 3;
+ totalSavings += savings;
+ outputResources.push(
+ String.sprintf("Compressing %s could save ~%s",
+ WebInspector.linkifyURL(resource.url), Number.bytesToString(savings)));
+ }
+ }
+ if (commonMessage) {
+ commonMessage.value =
+ String.sprintf("Compressing the following resources with gzip could reduce their " +
+ "transfer size by about two thirds (~%s):", Number.bytesToString(totalSavings));
+ commonMessage.appendChild(WebInspector.AuditRules.arrayAsUL(outputResources));
+ result.score = 100 * compressedSize / candidateSize;
+ result.type = WebInspector.AuditRuleResult.Type.Violation;
+ }
+ } catch(e) {
+ console.log(e);
+ } finally {
+ callback(result);
+ }
+ },
+
+ _isCompressed: function(resource)
+ {
+ var encoding = resource.responseHeaders["Content-Encoding"];
+ return encoding === "gzip" || encoding === "deflate";
+ },
+
+ _shouldCompress: function(resource)
+ {
+ return WebInspector.Resource.Type.isTextType(resource.type) && resource.domain && resource.contentLength !== undefined && resource.contentLength > 150;
+ }
+}
+
+WebInspector.AuditRules.GzipRule.prototype.__proto__ = WebInspector.AuditRule.prototype;
+
+
+WebInspector.AuditRules.CombineExternalResourcesRule = function(id, name, type, resourceTypeName, parametersObject)
+{
+ WebInspector.AuditRule.call(this, id, name, parametersObject);
+ this._type = type;
+ this._resourceTypeName = resourceTypeName;
+}
+
+WebInspector.AuditRules.CombineExternalResourcesRule.prototype = {
+ doRun: function(resources, result, callback)
+ {
+ try {
+ var domainToResourcesMap = WebInspector.AuditRules.getDomainToResourcesMap(resources, [this._type], WebInspector.URLRegExp);
+ var penalizedResourceCount = 0;
+ // TODO: refactor according to the chosen i18n approach
+ for (var domain in domainToResourcesMap) {
+ var domainResources = domainToResourcesMap[domain];
+ var extraResourceCount = domainResources.length - this.getValue("AllowedPerDomain");
+ if (extraResourceCount <= 0)
+ continue;
+ penalizedResourceCount += extraResourceCount - 1;
+ result.appendChild(
+ String.sprintf("There are %d %s files served from %s. Consider combining them into as few files as possible.",
+ domainResources.length, this._resourceTypeName, domain));
+ }
+ result.score = 100 - (penalizedResourceCount * this.getValue("ScorePerResource"));
+ result.type = WebInspector.AuditRuleResult.Type.Hint;
+ } catch(e) {
+ console.log(e);
+ } finally {
+ callback(result);
+ }
+ }
+};
+
+WebInspector.AuditRules.CombineExternalResourcesRule.prototype.__proto__ = WebInspector.AuditRule.prototype;
+
+
+WebInspector.AuditRules.CombineJsResourcesRule = function(parametersObject) {
+ WebInspector.AuditRules.CombineExternalResourcesRule.call(this, "page-externaljs", "Combine external JavaScript", WebInspector.Resource.Type.Script, "JS", parametersObject);
+}
+
+WebInspector.AuditRules.CombineJsResourcesRule.prototype.__proto__ = WebInspector.AuditRules.CombineExternalResourcesRule.prototype;
+
+
+WebInspector.AuditRules.CombineCssResourcesRule = function(parametersObject) {
+ WebInspector.AuditRules.CombineExternalResourcesRule.call(this, "page-externalcss", "Combine external CSS", WebInspector.Resource.Type.Stylesheet, "CSS", parametersObject);
+}
+
+WebInspector.AuditRules.CombineCssResourcesRule.prototype.__proto__ = WebInspector.AuditRules.CombineExternalResourcesRule.prototype;
+
+
+WebInspector.AuditRules.MinimizeDnsLookupsRule = function(parametersObject) {
+ WebInspector.AuditRule.call(this, "network-minimizelookups", "Minimize DNS lookups", parametersObject);
+}
+
+WebInspector.AuditRules.MinimizeDnsLookupsRule.prototype = {
+ doRun: function(resources, result, callback)
+ {
+ try {
+ var violationDomains = [];
+ var domainToResourcesMap = WebInspector.AuditRules.getDomainToResourcesMap(resources, undefined, WebInspector.URLRegExp);
+ for (var domain in domainToResourcesMap) {
+ if (domainToResourcesMap[domain].length > 1)
+ continue;
+ var match = domain.match(WebInspector.URLRegExp);
+ if (!match)
+ continue;
+ if (!match[2].search(WebInspector.AuditRules.IPAddressRegexp))
+ continue; // an IP address
+ violationDomains.push(match[2]);
+ }
+ if (violationDomains.length <= this.getValue("HostCountThreshold"))
+ return;
+ var commonMessage = result.appendChild(
+ "The following domains only serve one resource each. If possible, avoid the extra DNS " +
+ "lookups by serving these resources from existing domains.");
+ commonMessage.appendChild(WebInspector.AuditRules.arrayAsUL(violationDomains));
+ result.score = 100 - violationDomains.length * this.getValue("ViolationDomainScore");
+ } catch(e) {
+ console.log(e);
+ } finally {
+ callback(result);
+ }
+ }
+}
+
+WebInspector.AuditRules.MinimizeDnsLookupsRule.prototype.__proto__ = WebInspector.AuditRule.prototype;
+
+
+WebInspector.AuditRules.ParallelizeDownloadRule = function(parametersObject)
+{
+ WebInspector.AuditRule.call(this, "network-parallelizehosts", "Parallelize downloads across hostnames", parametersObject);
+}
+
+
+WebInspector.AuditRules.ParallelizeDownloadRule.prototype = {
+ doRun: function(resources, result, callback)
+ {
+ function hostSorter(a, b)
+ {
+ var aCount = domainToResourcesMap[a].length;
+ var bCount = domainToResourcesMap[b].length;
+ return (aCount < bCount) ? 1 : (aCount == bCount) ? 0 : -1;
+ }
+
+ try {
+ var domainToResourcesMap = WebInspector.AuditRules.getDomainToResourcesMap(
+ resources,
+ [WebInspector.Resource.Type.Stylesheet, WebInspector.Resource.Type.Image],
+ WebInspector.URLRegExp,
+ true);
+
+ var hosts = [];
+ for (var url in domainToResourcesMap)
+ hosts.push(url);
+
+ if (!hosts.length)
+ return; // no hosts (local file or something)
+
+ hosts.sort(hostSorter);
+
+ var optimalHostnameCount = this.getValue("OptimalHostnameCount");
+ if (hosts.length > optimalHostnameCount)
+ hosts.splice(optimalHostnameCount);
+
+ var busiestHostResourceCount = domainToResourcesMap[hosts[0]].length;
+ var resourceCountAboveThreshold = busiestHostResourceCount - this.getValue("MinRequestThreshold");
+ if (resourceCountAboveThreshold <= 0)
+ return;
+
+ var avgResourcesPerHost = 0;
+ for (var i = 0, size = hosts.length; i < size; ++i)
+ avgResourcesPerHost += domainToResourcesMap[hosts[i]].length;
+
+ // Assume optimal parallelization.
+ avgResourcesPerHost /= optimalHostnameCount;
+
+ avgResourcesPerHost = Math.max(avgResourcesPerHost, 1);
+
+ var pctAboveAvg = (resourceCountAboveThreshold / avgResourcesPerHost) - 1.0;
+
+ var minBalanceThreshold = this.getValue("MinBalanceThreshold");
+ if (pctAboveAvg < minBalanceThreshold) {
+ result.score = 100;
+ return;
+ }
+
+ result.score = (1 - (pctAboveAvg - minBalanceThreshold)) * 100;
+ result.type = WebInspector.AuditRuleResult.Type.Hint;
+
+ var resourcesOnBusiestHost = domainToResourcesMap[hosts[0]];
+ var commonMessage = result.appendChild(
+ String.sprintf("This page makes %d parallelizable requests to %s" +
+ ". Increase download parallelization by distributing the following" +
+ " requests across multiple hostnames.", busiestHostResourceCount, hosts[0]));
+ var outputResources = [];
+ for (var i = 0, size = resourcesOnBusiestHost.length; i < size; ++i)
+ outputResources.push(resourcesOnBusiestHost[i].url);
+ commonMessage.appendChild(WebInspector.AuditRules.arrayAsUL(outputResources, true));
+ } catch(e) {
+ console.log(e);
+ } finally {
+ callback(result);
+ }
+ }
+}
+
+WebInspector.AuditRules.ParallelizeDownloadRule.prototype.__proto__ = WebInspector.AuditRule.prototype;
+
+
+// The reported CSS rule size is incorrect (parsed != original in WebKit),
+// so use percentages instead, which gives a better approximation.
+WebInspector.AuditRules.UnusedCssRule = function(parametersObject)
+{
+ WebInspector.AuditRule.call(this, "page-unusedcss", "Remove unused CSS", parametersObject);
+}
+
+WebInspector.AuditRules.UnusedCssRule.prototype = {
+ _getUnusedStylesheetRatioMessage: function(unusedLength, type, location, styleSheetLength)
+ {
+ var url = type === "href"
+ ? WebInspector.linkifyURL(location)
+ : String.sprintf("Inline block #%s", location);
+ var pctUnused = Math.round(unusedLength / styleSheetLength * 100);
+ return String.sprintf("%s: %f%% (estimated) is not used by the current page.", url, pctUnused);
+ },
+
+ _getUnusedTotalRatioMessage: function(unusedLength, totalLength)
+ {
+ var pctUnused = Math.round(unusedLength / totalLength * 100);
+ return String.sprintf("%d%% of CSS (estimated) is not used by the current page.", pctUnused);
+ },
+
+ doRun: function(resources, result, callback)
+ {
+ var self = this;
+ function evalCallback(evalResult, isException) {
+ try {
+ if (isException)
+ return;
+
+ var totalLength = 0;
+ var totalUnusedLength = 0;
+ var topMessage;
+ var styleSheetMessage;
+ for (var i = 0; i < evalResult.length; ) {
+ var type = evalResult[i++];
+ if (type === "totalLength") {
+ totalLength = evalResult[i++];
+ continue;
+ }
+
+ var styleSheetLength = evalResult[i++];
+ var location = evalResult[i++];
+ var unusedRules = evalResult[i++];
+ styleSheetMessage = undefined;
+ if (!topMessage)
+ topMessage = result.appendChild("");
+
+ var totalUnusedRuleLength = 0;
+ var ruleSelectors = [];
+ for (var j = 0; j < unusedRules.length; ++j) {
+ var rule = unusedRules[j];
+ totalUnusedRuleLength += parseInt(rule[1]);
+ if (!styleSheetMessage)
+ styleSheetMessage = result.appendChild("");
+ ruleSelectors.push(rule[0]);
+ }
+ styleSheetMessage.appendChild(WebInspector.AuditRules.arrayAsUL(ruleSelectors));
+
+ styleSheetMessage.value = self._getUnusedStylesheetRatioMessage(totalUnusedRuleLength, type, location, styleSheetLength);
+ totalUnusedLength += totalUnusedRuleLength;
+ }
+ if (totalUnusedLength) {
+ var totalUnusedPercent = totalUnusedLength / totalLength;
+ topMessage.value = self._getUnusedTotalRatioMessage(totalUnusedLength, totalLength);
+ var pctMultiplier = Math.log(Math.max(200, totalUnusedLength - 800)) / 7 - 0.6;
+ result.score = (1 - totalUnusedPercent * pctMultiplier) * 100;
+ result.type = WebInspector.AuditRuleResult.Type.Hint;
+ } else
+ result.score = 100;
+ } catch(e) {
+ console.log(e);
+ } finally {
+ callback(result);
+ }
+ }
+
+ function routine()
+ {
+ var styleSheets = document.styleSheets;
+ if (!styleSheets)
+ return {};
+ var styleSheetToUnusedRules = [];
+ var inlineBlockOrdinal = 0;
+ var totalCSSLength = 0;
+ var pseudoSelectorRegexp = /:hover|:link|:active|:visited|:focus/;
+ for (var i = 0; i < styleSheets.length; ++i) {
+ var styleSheet = styleSheets[i];
+ if (!styleSheet.cssRules)
+ continue;
+ var currentStyleSheetSize = 0;
+ var unusedRules = [];
+ for (var curRule = 0; curRule < styleSheet.cssRules.length; ++curRule) {
+ var rule = styleSheet.cssRules[curRule];
+ var textLength = rule.cssText ? rule.cssText.length : 0;
+ currentStyleSheetSize += textLength;
+ totalCSSLength += textLength;
+ if (rule.type !== 1 || rule.selectorText.match(pseudoSelectorRegexp))
+ continue;
+ var nodes = document.querySelectorAll(rule.selectorText);
+ if (nodes && nodes.length)
+ continue;
+ unusedRules.push([rule.selectorText, textLength]);
+ }
+ if (unusedRules.length) {
+ styleSheetToUnusedRules.push(styleSheet.href ? "href" : "inline");
+ styleSheetToUnusedRules.push(currentStyleSheetSize);
+ styleSheetToUnusedRules.push(styleSheet.href ? styleSheet.href : ++inlineBlockOrdinal);
+ styleSheetToUnusedRules.push(unusedRules);
+ }
+ }
+ styleSheetToUnusedRules.push("totalLength");
+ styleSheetToUnusedRules.push(totalCSSLength);
+ return styleSheetToUnusedRules;
+ }
+
+ WebInspector.AuditRules.evaluateInTargetWindow(routine, evalCallback);
+ }
+}
+
+WebInspector.AuditRules.UnusedCssRule.prototype.__proto__ = WebInspector.AuditRule.prototype;
+
+
+WebInspector.AuditRules.CacheControlRule = function(id, name, parametersObject)
+{
+ WebInspector.AuditRule.call(this, id, name, parametersObject);
+}
+
+WebInspector.AuditRules.CacheControlRule.MillisPerMonth = 1000 * 60 * 60 * 24 * 30;
+
+WebInspector.AuditRules.CacheControlRule.prototype = {
+
+ InfoCheck: -1,
+ FailCheck: 0,
+ WarningCheck: 1,
+ SevereCheck: 2,
+
+ doRun: function(resources, result, callback)
+ {
+ try {
+ var cacheableAndNonCacheableResources = this._cacheableAndNonCacheableResources(resources);
+ if (cacheableAndNonCacheableResources[0].length) {
+ result.score = 100;
+ this.runChecks(cacheableAndNonCacheableResources[0], result);
+ }
+ this.handleNonCacheableResources(cacheableAndNonCacheableResources[1], result);
+ } catch(e) {
+ console.log(e);
+ } finally {
+ callback(result);
+ }
+ },
+
+ handleNonCacheableResources: function()
+ {
+ },
+
+ _cacheableAndNonCacheableResources: function(resources)
+ {
+ var processedResources = [[], []];
+ for (var i = 0; i < resources.length; ++i) {
+ var resource = resources[i];
+ if (!this.isCacheableResource(resource))
+ continue;
+ if (this._isExplicitlyNonCacheable(resource))
+ processedResources[1].push(resource);
+ else
+ processedResources[0].push(resource);
+ }
+ return processedResources;
+ },
+
+ execCheck: function(messageText, resourceCheckFunction, resources, severity, result)
+ {
+ var topMessage;
+ var failingResources = 0;
+ var resourceCount = resources.length;
+ var outputResources = [];
+ for (var i = 0; i < resourceCount; ++i) {
+ if (resourceCheckFunction.call(this, resources[i])) {
+ ++failingResources;
+ if (!topMessage)
+ topMessage = result.appendChild(messageText);
+ outputResources.push(resources[i].url);
+ }
+ }
+ if (topMessage)
+ topMessage.appendChild(WebInspector.AuditRules.arrayAsUL(outputResources, true));
+ if (failingResources) {
+ switch (severity) {
+ case this.FailCheck:
+ result.score = 0;
+ result.type = WebInspector.AuditRuleResult.Type.Violation;
+ break;
+ case this.SevereCheck:
+ case this.WarningCheck:
+ result.score -= 50 * severity * failingResources / resourceCount;
+ result.type = WebInspector.AuditRuleResult.Type.Hint;
+ break;
+ }
+ }
+ return topMessage;
+ },
+
+ freshnessLifetimeGreaterThan: function(resource, timeMs)
+ {
+ var dateHeader = this.responseHeader(resource, "Date");
+ if (!dateHeader)
+ return false;
+
+ var dateHeaderMs = Date.parse(dateHeader);
+ if (isNaN(dateHeaderMs))
+ return false;
+
+ var freshnessLifetimeMs;
+ var maxAgeMatch = this.responseHeaderMatch(resource, "Cache-Control", "max-age=(\\d+)");
+
+ if (maxAgeMatch)
+ freshnessLifetimeMs = (maxAgeMatch[1]) ? 1000 * maxAgeMatch[1] : 0;
+ else {
+ var expiresHeader = this.responseHeader(resource, "Expires");
+ if (expiresHeader) {
+ var expDate = Date.parse(expiresHeader);
+ if (!isNaN(expDate))
+ freshnessLifetimeMs = expDate - dateHeaderMs;
+ }
+ }
+
+ return (isNaN(freshnessLifetimeMs)) ? false : freshnessLifetimeMs > timeMs;
+ },
+
+ responseHeader: function(resource, header)
+ {
+ return resource.responseHeaders[header];
+ },
+
+ hasResponseHeader: function(resource, header)
+ {
+ return resource.responseHeaders[header] !== undefined;
+ },
+
+ isCompressible: function(resource)
+ {
+ return WebInspector.Resource.Type.isTextType(resource.type);
+ },
+
+ isPubliclyCacheable: function(resource)
+ {
+ if (this._isExplicitlyNonCacheable(resource))
+ return false;
+
+ if (this.responseHeaderMatch(resource, "Cache-Control", "public"))
+ return true;
+
+ return resource.url.indexOf("?") == -1 && !this.responseHeaderMatch(resource, "Cache-Control", "private");
+ },
+
+ responseHeaderMatch: function(resource, header, regexp)
+ {
+ return resource.responseHeaders[header]
+ ? resource.responseHeaders[header].match(new RegExp(regexp, "im"))
+ : undefined;
+ },
+
+ hasExplicitExpiration: function(resource)
+ {
+ return this.hasResponseHeader(resource, "Date") &&
+ (this.hasResponseHeader(resource, "Expires") || this.responseHeaderMatch(resource, "Cache-Control", "max-age"));
+ },
+
+ _isExplicitlyNonCacheable: function(resource)
+ {
+ var hasExplicitExp = this.hasExplicitExpiration(resource);
+ return this.responseHeaderMatch(resource, "Cache-Control", "(no-cache|no-store|must-revalidate)") ||
+ this.responseHeaderMatch(resource, "Pragma", "no-cache") ||
+ (hasExplicitExp && !this.freshnessLifetimeGreaterThan(resource, 0)) ||
+ (!hasExplicitExp && resource.url && resource.url.indexOf("?") >= 0) ||
+ (!hasExplicitExp && !this.isCacheableResource(resource));
+ },
+
+ isCacheableResource: function(resource)
+ {
+ return resource.statusCode !== undefined && WebInspector.AuditRules.CacheableResponseCodes[resource.statusCode];
+ }
+}
+
+WebInspector.AuditRules.CacheControlRule.prototype.__proto__ = WebInspector.AuditRule.prototype;
+
+
+WebInspector.AuditRules.BrowserCacheControlRule = function(parametersObject)
+{
+ WebInspector.AuditRules.CacheControlRule.call(this, "http-browsercache", "Leverage browser caching", parametersObject);
+}
+
+WebInspector.AuditRules.BrowserCacheControlRule.prototype = {
+ handleNonCacheableResources: function(resources, result)
+ {
+ if (resources.length) {
+ var message = result.appendChild(
+ "The following resources are explicitly non-cacheable. Consider making them cacheable if possible:");
+ var resourceOutput = [];
+ for (var i = 0; i < resources.length; ++i)
+ resourceOutput.push(resources[i].url);
+ message.appendChild(WebInspector.AuditRules.arrayAsUL(resourceOutput, true));
+ }
+ },
+
+ runChecks: function(resources, result, callback)
+ {
+ this.execCheck(
+ "The following resources are missing a cache expiration." +
+ " Resources that do not specify an expiration may not be" +
+ " cached by browsers:",
+ this._missingExpirationCheck, resources, this.SevereCheck, result);
+ this.execCheck(
+ "The following resources specify a \"Vary\" header that" +
+ " disables caching in most versions of Internet Explorer:",
+ this._varyCheck, resources, this.SevereCheck, result);
+ this.execCheck(
+ "The following cacheable resources have a short" +
+ " freshness lifetime:",
+ this._oneMonthExpirationCheck, resources, this.WarningCheck, result);
+
+ // Unable to implement the favicon check due to the WebKit limitations.
+
+ this.execCheck(
+ "To further improve cache hit rate, specify an expiration" +
+ " one year in the future for the following cacheable" +
+ " resources:",
+ this._oneYearExpirationCheck, resources, this.InfoCheck, result);
+ },
+
+ _missingExpirationCheck: function(resource)
+ {
+ return this.isCacheableResource(resource) && !this.hasResponseHeader(resource, "Set-Cookie") && !this.hasExplicitExpiration(resource);
+ },
+
+ _varyCheck: function(resource)
+ {
+ var varyHeader = this.responseHeader(resource, "Vary");
+ if (varyHeader) {
+ varyHeader = varyHeader.replace(/User-Agent/gi, "");
+ varyHeader = varyHeader.replace(/Accept-Encoding/gi, "");
+ varyHeader = varyHeader.replace(/[, ]*/g, "");
+ }
+ return varyHeader && varyHeader.length && this.isCacheableResource(resource) && this.freshnessLifetimeGreaterThan(resource, 0);
+ },
+
+ _oneMonthExpirationCheck: function(resource)
+ {
+ return this.isCacheableResource(resource) &&
+ !this.hasResponseHeader(resource, "Set-Cookie") &&
+ !this.freshnessLifetimeGreaterThan(resource, WebInspector.AuditRules.CacheControlRule.MillisPerMonth) &&
+ this.freshnessLifetimeGreaterThan(resource, 0);
+ },
+
+ _oneYearExpirationCheck: function(resource)
+ {
+ return this.isCacheableResource(resource) &&
+ !this.hasResponseHeader(resource, "Set-Cookie") &&
+ !this.freshnessLifetimeGreaterThan(resource, 11 * WebInspector.AuditRules.CacheControlRule.MillisPerMonth) &&
+ this.freshnessLifetimeGreaterThan(resource, WebInspector.AuditRules.CacheControlRule.MillisPerMonth);
+ }
+}
+
+WebInspector.AuditRules.BrowserCacheControlRule.prototype.__proto__ = WebInspector.AuditRules.CacheControlRule.prototype;
+
+
+WebInspector.AuditRules.ProxyCacheControlRule = function(parametersObject) {
+ WebInspector.AuditRules.CacheControlRule.call(this, "http-proxycache", "Leverage proxy caching", parametersObject);
+}
+
+WebInspector.AuditRules.ProxyCacheControlRule.prototype = {
+ runChecks: function(resources, result, callback)
+ {
+ this.execCheck(
+ "Resources with a \"?\" in the URL are not cached by most" +
+ " proxy caching servers:",
+ this._questionMarkCheck, resources, this.WarningCheck, result);
+ this.execCheck(
+ "Consider adding a \"Cache-Control: public\" header to the" +
+ " following resources:",
+ this._publicCachingCheck, resources, this.InfoCheck, result);
+ this.execCheck(
+ "The following publicly cacheable resources contain" +
+ " a Set-Cookie header. This security vulnerability" +
+ " can cause cookies to be shared by multiple users.",
+ this._setCookieCacheableCheck, resources, this.FailCheck, result);
+ },
+
+ _questionMarkCheck: function(resource)
+ {
+ return resource.url.indexOf("?") >= 0 && !this.hasResponseHeader(resource, "Set-Cookie") && this.isPubliclyCacheable(resource);
+ },
+
+ _publicCachingCheck: function(resource)
+ {
+ return this.isCacheableResource(resource) &&
+ !this.isCompressible(resource) &&
+ !this.responseHeaderMatch(resource, "Cache-Control", "public") &&
+ !this.hasResponseHeader(resource, "Set-Cookie");
+ },
+
+ _setCookieCacheableCheck: function(resource)
+ {
+ return this.hasResponseHeader(resource, "Set-Cookie") && this.isPubliclyCacheable(resource);
+ }
+}
+
+WebInspector.AuditRules.ProxyCacheControlRule.prototype.__proto__ = WebInspector.AuditRules.CacheControlRule.prototype;
+
+
+WebInspector.AuditRules.ImageDimensionsRule = function(parametersObject)
+{
+ WebInspector.AuditRule.call(this, "page-imagedims", "Specify image dimensions", parametersObject);
+}
+
+WebInspector.AuditRules.ImageDimensionsRule.prototype = {
+ doRun: function(resources, result, callback)
+ {
+ function evalCallback(evalResult, isException)
+ {
+ try {
+ if (isException)
+ return;
+ if (!evalResult || !evalResult.totalImages)
+ return;
+ result.score = 100;
+ var topMessage = result.appendChild(
+ "A width and height should be specified for all images in order to " +
+ "speed up page display. The following image(s) are missing a width and/or height:");
+ var map = evalResult.map;
+ var outputResources = [];
+ for (var url in map) {
+ var value = WebInspector.linkifyURL(url);
+ if (map[url] > 1)
+ value += " (" + map[url] + " uses)";
+ outputResources.push(value);
+ result.score -= this.getValue("ScorePerImageUse") * map[url];
+ result.type = WebInspector.AuditRuleResult.Type.Hint;
+ }
+ topMessage.appendChild(WebInspector.AuditRules.arrayAsUL(outputResources));
+ } catch(e) {
+ console.log(e);
+ } finally {
+ callback(result);
+ }
+ }
+
+ function routine()
+ {
+ var images = document.getElementsByTagName("img");
+ const widthRegExp = /width[^:;]*:/gim;
+ const heightRegExp = /height[^:;]*:/gim;
+
+ function hasDimension(element, cssText, rules, regexp, attributeName) {
+ if (element.attributes.getNamedItem(attributeName) != null || (cssText && cssText.match(regexp)))
+ return true;
+
+ if (!rules)
+ return false;
+ for (var i = 0; i < rules.length; ++i) {
+ if (rules.item(i).style.cssText.match(regexp))
+ return true;
+ }
+ return false;
+ }
+
+ function hasWidth(element, cssText, rules) {
+ return hasDimension(element, cssText, rules, widthRegExp, "width");
+ }
+
+ function hasHeight(element, cssText, rules) {
+ return hasDimension(element, cssText, rules, heightRegExp, "height");
+ }
+
+ var urlToNoDimensionCount = {};
+ var found = false;
+ for (var i = 0; i < images.length; ++i) {
+ var image = images[i];
+ if (!image.src)
+ continue;
+ var position = document.defaultView.getComputedStyle(image).getPropertyValue("position");
+ if (position === "absolute")
+ continue;
+ var cssText = (image.style && image.style.cssText) ? image.style.cssText : "";
+ var rules = document.defaultView.getMatchedCSSRules(image, "", true);
+ if (!hasWidth(image, cssText, rules) || !hasHeight(image, cssText, rules)) {
+ found = true;
+ if (urlToNoDimensionCount.hasOwnProperty(image.src))
+ ++urlToNoDimensionCount[image.src];
+ else
+ urlToNoDimensionCount[image.src] = 1;
+ }
+ }
+ return found ? {totalImages: images.length, map: urlToNoDimensionCount} : null;
+ }
+
+ WebInspector.AuditRules.evaluateInTargetWindow(routine, evalCallback.bind(this));
+ }
+}
+
+WebInspector.AuditRules.ImageDimensionsRule.prototype.__proto__ = WebInspector.AuditRule.prototype;
+
+
+WebInspector.AuditRules.CssInHeadRule = function(parametersObject)
+{
+ WebInspector.AuditRule.call(this, "page-cssinhead", "Put CSS in the document head", parametersObject);
+}
+
+WebInspector.AuditRules.CssInHeadRule.prototype = {
+ doRun: function(resources, result, callback)
+ {
+ function evalCallback(evalResult, isException)
+ {
+ try {
+ if (isException)
+ return;
+ if (!evalResult)
+ return;
+ result.score = 100;
+ var outputMessages = [];
+ for (var url in evalResult) {
+ var urlViolations = evalResult[url];
+ var topMessage = result.appendChild(
+ String.sprintf("CSS in the %s document body adversely impacts rendering performance.",
+ WebInspector.linkifyURL(url)));
+ if (urlViolations[0]) {
+ outputMessages.push(
+ String.sprintf("%s style block(s) in the body should be moved to the document head.", urlViolations[0]));
+ result.score -= this.getValue("InlineURLScore") * urlViolations[0];
+ }
+ for (var i = 0; i < urlViolations[1].length; ++i) {
+ outputMessages.push(
+ String.sprintf("Link node %s should be moved to the document head", WebInspector.linkifyURL(urlViolations[1])));
+ }
+ result.score -= this.getValue("InlineStylesheetScore") * urlViolations[1];
+ result.type = WebInspector.AuditRuleResult.Type.Hint;
+ }
+ topMessage.appendChild(WebInspector.AuditRules.arrayAsUL(outputMessages));
+ } catch(e) {
+ console.log(e);
+ } finally {
+ callback(result);
+ }
+ }
+
+ function routine()
+ {
+ function allViews() {
+ var views = [document.defaultView];
+ var curView = 0;
+ while (curView < views.length) {
+ var view = views[curView];
+ var frames = view.frames;
+ for (var i = 0; i < frames.length; ++i) {
+ if (frames[i] !== view)
+ views.push(frames[i]);
+ }
+ ++curView;
+ }
+ return views;
+ }
+
+ var views = allViews();
+ var urlToViolationsArray = {};
+ var found = false;
+ for (var i = 0; i < views.length; ++i) {
+ var view = views[i];
+ if (!view.document)
+ continue;
+
+ var inlineStyles = view.document.querySelectorAll("body style");
+ var inlineStylesheets = view.document.querySelectorAll(
+ "body link[rel~='stylesheet'][href]");
+ if (!inlineStyles.length && !inlineStylesheets.length)
+ continue;
+
+ found = true;
+ var inlineStylesheetHrefs = [];
+ for (var j = 0; j < inlineStylesheets.length; ++j)
+ inlineStylesheetHrefs.push(inlineStylesheets[j].href);
+
+ urlToViolationsArray[view.location.href] =
+ [inlineStyles.length, inlineStylesheetHrefs];
+ }
+ return found ? urlToViolationsArray : null;
+ }
+
+ WebInspector.AuditRules.evaluateInTargetWindow(routine, evalCallback);
+ }
+}
+
+WebInspector.AuditRules.CssInHeadRule.prototype.__proto__ = WebInspector.AuditRule.prototype;
+
+
+WebInspector.AuditRules.StylesScriptsOrderRule = function(parametersObject)
+{
+ WebInspector.AuditRule.call(this, "page-stylescriptorder", "Optimize the order of styles and scripts", parametersObject);
+}
+
+WebInspector.AuditRules.StylesScriptsOrderRule.prototype = {
+ doRun: function(resources, result, callback)
+ {
+ function evalCallback(evalResult, isException)
+ {
+ try {
+ if (isException)
+ return;
+ if (!evalResult)
+ return;
+
+ result.score = 100;
+ var lateCssUrls = evalResult['late'];
+ if (lateCssUrls) {
+ var lateMessage = result.appendChild(
+ 'The following external CSS files were included after ' +
+ 'an external JavaScript file in the document head. To ' +
+ 'ensure CSS files are downloaded in parallel, always ' +
+ 'include external CSS before external JavaScript.');
+ lateMessage.appendChild(WebInspector.AuditRules.arrayAsUL(lateCssUrls, true));
+ result.score -= this.getValue("InlineBetweenResourcesScore") * lateCssUrls.length;
+ result.type = WebInspector.AuditRuleResult.Type.Violation;
+ }
+ if (evalResult['cssBeforeInlineCount']) {
+ var count = evalResult['cssBeforeInlineCount'];
+ result.appendChild(count + ' inline script block' +
+ (count > 1 ? 's were' : ' was') + ' found in the head between an ' +
+ 'external CSS file and another resource. To allow parallel ' +
+ 'downloading, move the inline script before the external CSS ' +
+ 'file, or after the next resource.');
+ result.score -= this.getValue("CSSAfterJSURLScore") * count;
+ result.type = WebInspector.AuditRuleResult.Type.Violation;
+ }
+ } catch(e) {
+ console.log(e);
+ } finally {
+ callback(result);
+ }
+ }
+
+ function routine()
+ {
+ var lateStyles = document.querySelectorAll(
+ "head script[src] ~ link[rel~='stylesheet'][href]");
+ var stylesBeforeInlineScript = document.querySelectorAll(
+ "head link[rel~='stylesheet'][href] ~ script:not([src])");
+
+ var resultObject;
+ if (!lateStyles.length && !stylesBeforeInlineScript.length)
+ resultObject = null;
+ else {
+ resultObject = {};
+ if (lateStyles.length) {
+ lateStyleUrls = [];
+ for (var i = 0; i < lateStyles.length; ++i)
+ lateStyleUrls.push(lateStyles[i].href);
+ resultObject["late"] = lateStyleUrls;
+ }
+ resultObject["cssBeforeInlineCount"] = stylesBeforeInlineScript.length;
+ }
+ return resultObject;
+ }
+
+ WebInspector.AuditRules.evaluateInTargetWindow(routine, evalCallback.bind(this));
+ }
+}
+
+WebInspector.AuditRules.StylesScriptsOrderRule.prototype.__proto__ = WebInspector.AuditRule.prototype;
+
+
+WebInspector.AuditRules.CookieRuleBase = function(id, name, parametersObject)
+{
+ WebInspector.AuditRule.call(this, id, name, parametersObject);
+}
+
+WebInspector.AuditRules.CookieRuleBase.prototype = {
+ doRun: function(resources, result, callback)
+ {
+ var self = this;
+ function resultCallback(receivedCookies, isAdvanced) {
+ try {
+ self.processCookies(isAdvanced ? receivedCookies : [], resources, result);
+ } catch(e) {
+ console.log(e);
+ } finally {
+ callback(result);
+ }
+ }
+ WebInspector.Cookies.getCookiesAsync(resultCallback);
+ },
+
+ mapResourceCookies: function(resourcesByDomain, allCookies, callback)
+ {
+ for (var i = 0; i < allCookies.length; ++i) {
+ for (var resourceDomain in resourcesByDomain) {
+ if (WebInspector.Cookies.cookieDomainMatchesResourceDomain(allCookies[i].domain, resourceDomain))
+ this._callbackForResourceCookiePairs(resourcesByDomain[resourceDomain], allCookies[i], callback);
+ }
+ }
+ },
+
+ _callbackForResourceCookiePairs: function(resources, cookie, callback)
+ {
+ if (!resources)
+ return;
+ for (var i = 0; i < resources.length; ++i) {
+ if (WebInspector.Cookies.cookieMatchesResourceURL(cookie, resources[i].url))
+ callback(resources[i], cookie);
+ }
+ }
+}
+
+WebInspector.AuditRules.CookieRuleBase.prototype.__proto__ = WebInspector.AuditRule.prototype;
+
+
+WebInspector.AuditRules.CookieSizeRule = function(parametersObject)
+{
+ WebInspector.AuditRules.CookieRuleBase.call(this, "http-cookiesize", "Minimize cookie size", parametersObject);
+}
+
+WebInspector.AuditRules.CookieSizeRule.prototype = {
+ _average: function(cookieArray)
+ {
+ var total = 0;
+ for (var i = 0; i < cookieArray.length; ++i)
+ total += cookieArray[i].size;
+ return cookieArray.length ? Math.round(total / cookieArray.length) : 0;
+ },
+
+ _max: function(cookieArray)
+ {
+ var result = 0;
+ for (var i = 0; i < cookieArray.length; ++i)
+ result = Math.max(cookieArray[i].size, result);
+ return result;
+ },
+
+ processCookies: function(allCookies, resources, result)
+ {
+ function maxSizeSorter(a, b)
+ {
+ return b.maxCookieSize - a.maxCookieSize;
+ }
+
+ function avgSizeSorter(a, b)
+ {
+ return b.avgCookieSize - a.avgCookieSize;
+ }
+
+ var cookiesPerResourceDomain = {};
+
+ function collectorCallback(resource, cookie)
+ {
+ var cookies = cookiesPerResourceDomain[resource.domain];
+ if (!cookies) {
+ cookies = [];
+ cookiesPerResourceDomain[resource.domain] = cookies;
+ }
+ cookies.push(cookie);
+ }
+
+ if (!allCookies.length)
+ return;
+
+ var sortedCookieSizes = [];
+
+ var domainToResourcesMap = WebInspector.AuditRules.getDomainToResourcesMap(resources,
+ null,
+ WebInspector.URLRegExp,
+ true);
+ var matchingResourceData = {};
+ this.mapResourceCookies(domainToResourcesMap, allCookies, collectorCallback.bind(this));
+
+ result.score = 100;
+ for (var resourceDomain in cookiesPerResourceDomain) {
+ var cookies = cookiesPerResourceDomain[resourceDomain];
+ sortedCookieSizes.push({
+ domain: resourceDomain,
+ avgCookieSize: this._average(cookies),
+ maxCookieSize: this._max(cookies)
+ });
+ }
+ var avgAllCookiesSize = this._average(allCookies);
+
+ var hugeCookieDomains = [];
+ sortedCookieSizes.sort(maxSizeSorter);
+
+ var maxBytesThreshold = this.getValue("MaxBytesThreshold");
+ var minBytesThreshold = this.getValue("MinBytesThreshold");
+
+ for (var i = 0, len = sortedCookieSizes.length; i < len; ++i) {
+ var maxCookieSize = sortedCookieSizes[i].maxCookieSize;
+ if (maxCookieSize > maxBytesThreshold)
+ hugeCookieDomains.push(sortedCookieSizes[i].domain + ": " + Number.bytesToString(maxCookieSize));
+ }
+
+ var bigAvgCookieDomains = [];
+ sortedCookieSizes.sort(avgSizeSorter);
+ for (var i = 0, len = sortedCookieSizes.length; i < len; ++i) {
+ var domain = sortedCookieSizes[i].domain;
+ var avgCookieSize = sortedCookieSizes[i].avgCookieSize;
+ if (avgCookieSize > minBytesThreshold && avgCookieSize < maxBytesThreshold)
+ bigAvgCookieDomains.push(domain + ": " + Number.bytesToString(avgCookieSize));
+ }
+ result.appendChild("The average cookie size for all requests on this page is " + Number.bytesToString(avgAllCookiesSize));
+
+ var message;
+ if (hugeCookieDomains.length) {
+ result.score = 75;
+ result.type = WebInspector.AuditRuleResult.Type.Violation;
+ message = result.appendChild(
+ String.sprintf("The following domains have a cookie size in excess of %d " +
+ " bytes. This is harmful because requests with cookies larger than 1KB" +
+ " typically cannot fit into a single network packet.", maxBytesThreshold));
+ message.appendChild(WebInspector.AuditRules.arrayAsUL(hugeCookieDomains));
+ }
+
+ if (bigAvgCookieDomains.length) {
+ this.score -= Math.max(0, avgAllCookiesSize - minBytesThreshold) /
+ (minBytesThreshold - minBytesThreshold) / this.getValue("TotalPoints");
+ if (!result.type)
+ result.type = WebInspector.AuditRuleResult.Type.Hint;
+ message = result.appendChild(
+ String.sprintf("The following domains have an average cookie size in excess of %d" +
+ " bytes. Reducing the size of cookies" +
+ " for these domains can reduce the time it takes to send requests.", minBytesThreshold));
+ message.appendChild(WebInspector.AuditRules.arrayAsUL(bigAvgCookieDomains));
+ }
+
+ if (!bigAvgCookieDomains.length && !hugeCookieDomains.length)
+ result.score = WebInspector.AuditCategoryResult.ScoreNA;
+ }
+}
+
+WebInspector.AuditRules.CookieSizeRule.prototype.__proto__ = WebInspector.AuditRules.CookieRuleBase.prototype;
+
+
+WebInspector.AuditRules.StaticCookielessRule = function(parametersObject)
+{
+ WebInspector.AuditRules.CookieRuleBase.call(this, "http-staticcookieless", "Serve static content from a cookieless domain", parametersObject);
+}
+
+WebInspector.AuditRules.StaticCookielessRule.prototype = {
+ processCookies: function(allCookies, resources, result)
+ {
+ var domainToResourcesMap = WebInspector.AuditRules.getDomainToResourcesMap(resources,
+ [WebInspector.Resource.Type.Stylesheet,
+ WebInspector.Resource.Type.Image],
+ WebInspector.URLRegExp,
+ true);
+ var totalStaticResources = 0;
+ var minResources = this.getValue("MinResources");
+ for (var domain in domainToResourcesMap)
+ totalStaticResources += domainToResourcesMap[domain].length;
+ if (totalStaticResources < minResources)
+ return;
+ var matchingResourceData = {};
+ this.mapResourceCookies(domainToResourcesMap, allCookies, this._collectorCallback.bind(this, matchingResourceData));
+
+ var badUrls = [];
+ var cookieBytes = 0;
+ for (var url in matchingResourceData) {
+ badUrls.push(url);
+ cookieBytes += matchingResourceData[url]
+ }
+ if (badUrls.length < minResources)
+ return;
+
+ result.score = 100;
+ var badPoints = cookieBytes / 75;
+ var violationPct = Math.max(badUrls.length / totalStaticResources, 0.6);
+ badPoints *= violationPct;
+ result.score -= badPoints;
+ result.score = Math.max(result.score, 0);
+ result.type = WebInspector.AuditRuleResult.Type.Violation;
+ result.appendChild(String.sprintf("%s of cookies were sent with the following static resources.", Number.bytesToString(cookieBytes)));
+ var message = result.appendChild("Serve these static resources from a domain that does not set cookies:");
+ message.appendChild(WebInspector.AuditRules.arrayAsUL(badUrls, true));
+ },
+
+ _collectorCallback: function(matchingResourceData, resource, cookie)
+ {
+ matchingResourceData[resource.url] = (matchingResourceData[resource.url] || 0) + cookie.size;
+ }
+}
+
+WebInspector.AuditRules.StaticCookielessRule.prototype.__proto__ = WebInspector.AuditRules.CookieRuleBase.prototype;
diff --git a/WebCore/inspector/front-end/AuditsPanel.js b/WebCore/inspector/front-end/AuditsPanel.js
index 696d132..fcadb82 100644
--- a/WebCore/inspector/front-end/AuditsPanel.js
+++ b/WebCore/inspector/front-end/AuditsPanel.js
@@ -105,7 +105,8 @@ WebInspector.AuditsPanel.prototype = {
this._auditCategoriesById = {};
for (var categoryCtorID in WebInspector.AuditCategories) {
var auditCategory = new WebInspector.AuditCategories[categoryCtorID]();
- this.categoriesById[auditCategory.id] = auditCategory;
+ auditCategory._id = categoryCtorID;
+ this.categoriesById[categoryCtorID] = auditCategory;
}
},
@@ -185,15 +186,13 @@ WebInspector.AuditsPanel.prototype = {
_reloadResources: function(callback)
{
- function nullCallback()
- {
- }
this._resourceTrackingCallback = callback;
+
if (!InspectorBackend.resourceTrackingEnabled()) {
InspectorBackend.enableResourceTracking(false);
- this._updateLauncherViewControls();
+ this._updateLauncherViewControls(true);
} else
- InjectedScriptAccess.getDefault().evaluate("window.location.reload()", nullCallback);
+ InjectedScriptAccess.getDefault().evaluate("window.location.reload()", switchCallback);
},
_didMainResourceLoad: function()
@@ -239,7 +238,7 @@ WebInspector.AuditsPanel.prototype = {
WebInspector.Panel.prototype.show.call(this);
this.showView();
- this._updateLauncherViewControls();
+ this._updateLauncherViewControls(InspectorBackend.resourceTrackingEnabled());
},
attach: function()
@@ -254,10 +253,10 @@ WebInspector.AuditsPanel.prototype = {
this.viewsContainerElement.style.left = width + "px";
},
- _updateLauncherViewControls: function()
+ _updateLauncherViewControls: function(isTracking)
{
if (this._launcherView)
- this._launcherView.updateResourceTrackingState();
+ this._launcherView.updateResourceTrackingState(isTracking);
},
_clearButtonClicked: function()
@@ -278,9 +277,8 @@ WebInspector.AuditsPanel.prototype.__proto__ = WebInspector.Panel.prototype;
-WebInspector.AuditCategory = function(id, displayName)
+WebInspector.AuditCategory = function(displayName)
{
- this._id = id;
this._displayName = displayName;
this._rules = [];
}
@@ -288,6 +286,7 @@ WebInspector.AuditCategory = function(id, displayName)
WebInspector.AuditCategory.prototype = {
get id()
{
+ // this._id value is injected at construction time.
return this._id;
},
@@ -298,6 +297,7 @@ WebInspector.AuditCategory.prototype = {
get ruleCount()
{
+ this._ensureInitialized();
return this._rules.length;
},
@@ -308,8 +308,18 @@ WebInspector.AuditCategory.prototype = {
runRules: function(resources, callback)
{
+ this._ensureInitialized();
for (var i = 0; i < this._rules.length; ++i)
this._rules[i].run(resources, callback);
+ },
+
+ _ensureInitialized: function()
+ {
+ if (!this._initialized) {
+ if ("initialize" in this)
+ this.initialize();
+ this._initialized = true;
+ }
}
}
@@ -354,7 +364,6 @@ WebInspector.AuditRule.prototype = {
WebInspector.AuditCategoryResult = function(category)
{
- this.categoryId = category.id;
this.title = category.displayName;
this.entries = [];
}
@@ -378,8 +387,13 @@ WebInspector.AuditRuleResult = function(value)
}
WebInspector.AuditRuleResult.Type = {
+ // Does not denote a discovered flaw but rather represents an informational message.
NA: 0,
+
+ // Denotes a minor impact on the checked metric.
Hint: 1,
+
+ // Denotes a major impact on the checked metric.
Violation: 2
}
diff --git a/WebCore/inspector/front-end/CookieItemsView.js b/WebCore/inspector/front-end/CookieItemsView.js
index b31b7ea..b5674b8 100644
--- a/WebCore/inspector/front-end/CookieItemsView.js
+++ b/WebCore/inspector/front-end/CookieItemsView.js
@@ -27,7 +27,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-WebInspector.CookieItemsView = function(cookieDomain)
+WebInspector.CookieItemsView = function(treeElement, cookieDomain)
{
WebInspector.View.call(this);
@@ -41,7 +41,13 @@ WebInspector.CookieItemsView = function(cookieDomain)
this.refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item");
this.refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this), false);
+ this._treeElement = treeElement;
this._cookieDomain = cookieDomain;
+
+ this._emptyMsgElement = document.createElement("div");
+ this._emptyMsgElement.className = "storage-table-empty";
+ this._emptyMsgElement.textContent = WebInspector.UIString("This site has no cookies.");
+ this.element.appendChild(this._emptyMsgElement);
}
WebInspector.CookieItemsView.prototype = {
@@ -53,7 +59,7 @@ WebInspector.CookieItemsView.prototype = {
show: function(parentElement)
{
WebInspector.View.prototype.show.call(this, parentElement);
- this.update();
+ this._update();
},
hide: function()
@@ -62,37 +68,57 @@ WebInspector.CookieItemsView.prototype = {
this.deleteButton.visible = false;
},
- update: function()
+ _update: function()
{
- this.element.removeChildren();
-
- var self = this;
- function callback(allCookies, isAdvanced) {
- var cookies = self._cookiesForDomain(allCookies);
- var dataGrid = (isAdvanced ? self.dataGridForCookies(cookies) : self.simpleDataGridForCookies(cookies));
- if (dataGrid) {
- self._dataGrid = dataGrid;
- self.element.appendChild(dataGrid.element);
- self._dataGrid.updateWidths();
- if (isAdvanced)
- self.deleteButton.visible = true;
+ WebInspector.Cookies.getCookiesAsync(this._updateWithCookies.bind(this));
+ },
+
+ _updateWithCookies: function(allCookies, isAdvanced)
+ {
+ if (isAdvanced)
+ this._filterCookiesForDomain(allCookies);
+ else
+ this._cookies = allCookies;
+
+ if (!this._cookies.length) {
+ // Nothing to show.
+ this._emptyMsgElement.removeStyleClass("hidden");
+ this.deleteButton.visible = false;
+ if (this._dataGrid)
+ this._dataGrid.element.addStyleClass("hidden");
+ return;
+ }
+
+ if (!this._dataGrid) {
+ if (isAdvanced) {
+ this._createDataGrid();
+ this._populateDataGrid();
+ this._dataGrid.autoSizeColumns(6, 33);
+ this._treeElement.subtitle = String.sprintf(WebInspector.UIString("%d cookies (%s)"), this._cookies.length,
+ Number.bytesToString(this._totalSize, WebInspector.UIString));
} else {
- var emptyMsgElement = document.createElement("div");
- emptyMsgElement.className = "storage-table-empty";
- emptyMsgElement.textContent = WebInspector.UIString("This site has no cookies.");
- self.element.appendChild(emptyMsgElement);
- self._dataGrid = null;
- self.deleteButton.visible = false;
+ this._createSimpleDataGrid();
+ this._populateSimpleDataGrid();
+ this._dataGrid.autoSizeColumns(20, 80);
}
+ } else {
+ if (isAdvanced)
+ this._populateDataGrid();
+ else
+ this._populateSimpleDataGrid();
}
- WebInspector.Cookies.getCookiesAsync(callback);
+ this._dataGrid.element.removeStyleClass("hidden");
+ this._emptyMsgElement.addStyleClass("hidden");
+ if (isAdvanced)
+ this.deleteButton.visible = true;
},
- _cookiesForDomain: function(allCookies)
+ _filterCookiesForDomain: function(allCookies)
{
- var cookiesForDomain = [];
+ this._cookies = [];
var resourceURLsForDocumentURL = [];
+ this._totalSize = 0;
for (var id in WebInspector.resources) {
var resource = WebInspector.resources[id];
@@ -102,179 +128,151 @@ WebInspector.CookieItemsView.prototype = {
}
for (var i = 0; i < allCookies.length; ++i) {
+ var pushed = false;
+ var size = allCookies[i].size;
for (var j = 0; j < resourceURLsForDocumentURL.length; ++j) {
var resourceURL = resourceURLsForDocumentURL[j];
if (WebInspector.Cookies.cookieMatchesResourceURL(allCookies[i], resourceURL)) {
- cookiesForDomain.push(allCookies[i]);
- break;
+ this._totalSize += size;
+ if (!pushed) {
+ pushed = true;
+ this._cookies.push(allCookies[i]);
+ }
}
}
}
- return cookiesForDomain;
},
- dataGridForCookies: function(cookies)
+ _createDataGrid: function()
{
- if (!cookies.length)
- return null;
-
- for (var i = 0; i < cookies.length; ++i)
- cookies[i].expires = new Date(cookies[i].expires);
-
var columns = { 0: {}, 1: {}, 2: {}, 3: {}, 4: {}, 5: {}, 6: {}, 7: {} };
columns[0].title = WebInspector.UIString("Name");
- columns[0].width = columns[0].title.length;
+ columns[0].sortable = true;
columns[1].title = WebInspector.UIString("Value");
- columns[1].width = columns[1].title.length;
+ columns[1].sortable = true;
columns[2].title = WebInspector.UIString("Domain");
- columns[2].width = columns[2].title.length;
+ columns[2].sortable = true;
columns[3].title = WebInspector.UIString("Path");
- columns[3].width = columns[3].title.length;
+ columns[3].sortable = true;
columns[4].title = WebInspector.UIString("Expires");
- columns[4].width = columns[4].title.length;
+ columns[4].sortable = true;
columns[5].title = WebInspector.UIString("Size");
- columns[5].width = columns[5].title.length;
columns[5].aligned = "right";
+ columns[5].sortable = true;
columns[6].title = WebInspector.UIString("HTTP");
- columns[6].width = columns[6].title.length;
columns[6].aligned = "centered";
+ columns[6].sortable = true;
columns[7].title = WebInspector.UIString("Secure");
- columns[7].width = columns[7].title.length;
columns[7].aligned = "centered";
+ columns[7].sortable = true;
- function updateDataAndColumn(index, value) {
- data[index] = value;
- if (value.length > columns[index].width)
- columns[index].width = value.length;
- }
+ this._dataGrid = new WebInspector.DataGrid(columns, null, this._deleteCookieCallback.bind(this));
+ this._dataGrid.addEventListener("sorting changed", this._populateDataGrid, this);
+ this.element.appendChild(this._dataGrid.element);
+ this._dataGrid.updateWidths();
+ },
- var data;
- var nodes = [];
- for (var i = 0; i < cookies.length; ++i) {
- var cookie = cookies[i];
- data = {};
-
- updateDataAndColumn(0, cookie.name);
- updateDataAndColumn(1, cookie.value);
- updateDataAndColumn(2, cookie.domain);
- updateDataAndColumn(3, cookie.path);
- updateDataAndColumn(4, (cookie.session ? WebInspector.UIString("Session") : cookie.expires.toGMTString()));
- updateDataAndColumn(5, Number.bytesToString(cookie.size, WebInspector.UIString));
- updateDataAndColumn(6, (cookie.httpOnly ? "\u2713" : "")); // Checkmark
- updateDataAndColumn(7, (cookie.secure ? "\u2713" : "")); // Checkmark
+ _populateDataGrid: function()
+ {
+ var selectedCookie = this._dataGrid.selectedNode ? this._dataGrid.selectedNode.cookie : null;
+ var sortDirection = this._dataGrid.sortOrder === "ascending" ? 1 : -1;
- var node = new WebInspector.DataGridNode(data, false);
- node.cookie = cookie;
- node.selectable = true;
- nodes.push(node);
+ function localeCompare(field, cookie1, cookie2)
+ {
+ return sortDirection * (cookie1[field] + "").localeCompare(cookie2[field] + "")
}
- var totalColumnWidths = 0;
- for (var columnIdentifier in columns)
- totalColumnWidths += columns[columnIdentifier].width;
-
- // Enforce the Value column (the 2nd column) to be a max of 33%
- // tweaking the raw total width because may massively outshadow the others
- var valueColumnWidth = columns[1].width;
- if (valueColumnWidth / totalColumnWidths > 0.33) {
- totalColumnWidths -= valueColumnWidth;
- totalColumnWidths *= 1.33;
- columns[1].width = totalColumnWidths * 0.33;
+ function numberCompare(field, cookie1, cookie2)
+ {
+ return sortDirection * (cookie1[field] - cookie2[field]);
}
- // Calculate the percentage width for the columns.
- const minimumPrecent = 6;
- var recoupPercent = 0;
- for (var columnIdentifier in columns) {
- var width = columns[columnIdentifier].width;
- width = Math.round((width / totalColumnWidths) * 100);
- if (width < minimumPrecent) {
- recoupPercent += (minimumPrecent - width);
- width = minimumPrecent;
- }
- columns[columnIdentifier].width = width;
- }
+ function expiresCompare(cookie1, cookie2)
+ {
+ if (cookie1.session !== cookie2.session)
+ return sortDirection * (cookie1.session ? 1 : -1);
- // Enforce the minimum percentage width. (need to narrow total percentage due to earlier additions)
- while (recoupPercent > 0) {
- for (var columnIdentifier in columns) {
- if (columns[columnIdentifier].width > minimumPrecent) {
- --columns[columnIdentifier].width;
- --recoupPercent;
- if (!recoupPercent)
- break;
- }
- }
+ if (cookie1.session)
+ return 0;
+
+ return sortDirection * (cookie1.expires - cookie2.expires);
}
- for (var columnIdentifier in columns)
- columns[columnIdentifier].width += "%";
+ var comparator;
+ switch (parseInt(this._dataGrid.sortColumnIdentifier)) {
+ case 0: comparator = localeCompare.bind(this, "name"); break;
+ case 1: comparator = localeCompare.bind(this, "value"); break;
+ case 2: comparator = localeCompare.bind(this, "domain"); break;
+ case 3: comparator = localeCompare.bind(this, "path"); break;
+ case 4: comparator = expiresCompare; break;
+ case 5: comparator = numberCompare.bind(this, "size"); break;
+ case 6: comparator = localeCompare.bind(this, "httpOnly"); break;
+ case 7: comparator = localeCompare.bind(this, "secure"); break;
+ default: localeCompare.bind(this, "name");
+ }
- var dataGrid = new WebInspector.DataGrid(columns, null, this._deleteCookieCallback.bind(this));
- var length = nodes.length;
- for (var i = 0; i < length; ++i)
- dataGrid.appendChild(nodes[i]);
- if (length > 0)
- nodes[0].selected = true;
+ this._cookies.sort(comparator);
- return dataGrid;
+ this._dataGrid.removeChildren();
+ var nodeToSelect;
+ for (var i = 0; i < this._cookies.length; ++i) {
+ var data = {};
+ var cookie = this._cookies[i];
+ data[0] = cookie.name;
+ data[1] = cookie.value;
+ data[2] = cookie.domain;
+ data[3] = cookie.path;
+ data[4] = (cookie.session ? WebInspector.UIString("Session") : new Date(cookie.expires).toGMTString());
+ data[5] = Number.bytesToString(cookie.size, WebInspector.UIString);
+ data[6] = (cookie.httpOnly ? "\u2713" : ""); // Checkmark
+ data[7] = (cookie.secure ? "\u2713" : ""); // Checkmark
+
+ var node = new WebInspector.DataGridNode(data);
+ node.cookie = cookie;
+ node.selectable = true;
+ this._dataGrid.appendChild(node);
+ if (cookie === selectedCookie)
+ nodeToSelect = node;
+ }
+ if (nodeToSelect)
+ nodeToSelect.selected = true;
+ else
+ this._dataGrid.children[0].selected = true;
},
- simpleDataGridForCookies: function(cookies)
+ _createSimpleDataGrid: function()
{
- if (!cookies.length)
- return null;
-
var columns = {};
columns[0] = {};
columns[1] = {};
columns[0].title = WebInspector.UIString("Name");
- columns[0].width = columns[0].title.length;
columns[1].title = WebInspector.UIString("Value");
- columns[1].width = columns[1].title.length;
- var nodes = [];
+ this._dataGrid = new WebInspector.DataGrid(columns);
+ this.element.appendChild(this._dataGrid.element);
+ this._dataGrid.updateWidths();
+ },
+
+ _populateSimpleDataGrid: function()
+ {
+ var cookies = this._cookies;
+ this._dataGrid.removeChildren();
+ var addedCookies = {};
for (var i = 0; i < cookies.length; ++i) {
- var cookie = cookies[i];
+ if (addedCookies[cookies[i].name])
+ continue;
+ addedCookies[cookies[i].name] = true;
var data = {};
-
- var name = cookie.name;
- data[0] = name;
- if (name.length > columns[0].width)
- columns[0].width = name.length;
-
- var value = cookie.value;
- data[1] = value;
- if (value.length > columns[1].width)
- columns[1].width = value.length;
+ data[0] = cookies[i].name;
+ data[1] = cookies[i].value;
var node = new WebInspector.DataGridNode(data, false);
node.selectable = true;
- nodes.push(node);
+ this._dataGrid.appendChild(node);
}
-
- var totalColumnWidths = columns[0].width + columns[1].width;
- var width = Math.round((columns[0].width * 100) / totalColumnWidths);
- const minimumPrecent = 20;
- if (width < minimumPrecent)
- width = minimumPrecent;
- if (width > 100 - minimumPrecent)
- width = 100 - minimumPrecent;
- columns[0].width = width;
- columns[1].width = 100 - width;
- columns[0].width += "%";
- columns[1].width += "%";
-
- var dataGrid = new WebInspector.DataGrid(columns);
- var length = nodes.length;
- for (var i = 0; i < length; ++i)
- dataGrid.appendChild(nodes[i]);
- if (length > 0)
- nodes[0].selected = true;
-
- return dataGrid;
+ this._dataGrid.children[0].selected = true;
},
-
+
resize: function()
{
if (this._dataGrid)
@@ -288,17 +286,17 @@ WebInspector.CookieItemsView.prototype = {
this._deleteCookieCallback(this._dataGrid.selectedNode);
},
-
+
_deleteCookieCallback: function(node)
{
var cookie = node.cookie;
InspectorBackend.deleteCookie(cookie.name, this._cookieDomain);
- this.update();
+ this._update();
},
_refreshButtonClicked: function(event)
{
- this.update();
+ this._update();
}
}
diff --git a/WebCore/inspector/front-end/DOMStorageItemsView.js b/WebCore/inspector/front-end/DOMStorageItemsView.js
index 7441f2e..dbd736b 100644
--- a/WebCore/inspector/front-end/DOMStorageItemsView.js
+++ b/WebCore/inspector/front-end/DOMStorageItemsView.js
@@ -69,7 +69,7 @@ WebInspector.DOMStorageItemsView.prototype = {
{
this._dataGrid = this._dataGridForDOMStorageEntries(entries);
this.element.appendChild(this._dataGrid.element);
- this._dataGrid.updateWidths();
+ this._dataGrid.autoSizeColumns(10);
this.deleteButton.visible = true;
},
@@ -85,9 +85,7 @@ WebInspector.DOMStorageItemsView.prototype = {
columns[0] = {};
columns[1] = {};
columns[0].title = WebInspector.UIString("Key");
- columns[0].width = columns[0].title.length;
columns[1].title = WebInspector.UIString("Value");
- columns[1].width = columns[1].title.length;
var nodes = [];
@@ -98,31 +96,14 @@ WebInspector.DOMStorageItemsView.prototype = {
var key = entries[i][0];
data[0] = key;
- if (key.length > columns[0].width)
- columns[0].width = key.length;
-
var value = entries[i][1];
data[1] = value;
- if (value.length > columns[1].width)
- columns[1].width = value.length;
var node = new WebInspector.DataGridNode(data, false);
node.selectable = true;
nodes.push(node);
keys.push(key);
}
- var totalColumnWidths = columns[0].width + columns[1].width;
- var width = Math.round((columns[0].width * 100) / totalColumnWidths);
- const minimumPrecent = 10;
- if (width < minimumPrecent)
- width = minimumPrecent;
- if (width > 100 - minimumPrecent)
- width = 100 - minimumPrecent;
- columns[0].width = width;
- columns[1].width = 100 - width;
- columns[0].width += "%";
- columns[1].width += "%";
-
var dataGrid = new WebInspector.DataGrid(columns, this._editingCallback.bind(this), this._deleteCallback.bind(this));
var length = nodes.length;
for (var i = 0; i < length; ++i)
diff --git a/WebCore/inspector/front-end/DataGrid.js b/WebCore/inspector/front-end/DataGrid.js
index 3eca9e4..1ecc4f2 100644
--- a/WebCore/inspector/front-end/DataGrid.js
+++ b/WebCore/inspector/front-end/DataGrid.js
@@ -61,7 +61,7 @@ WebInspector.DataGrid = function(columns, editCallback, deleteCallback)
var headerRow = document.createElement("tr");
var columnGroup = document.createElement("colgroup");
- var columnCount = 0;
+ this._columnCount = 0;
for (var columnIdentifier in columns) {
var column = columns[columnIdentifier];
@@ -71,6 +71,7 @@ WebInspector.DataGrid = function(columns, editCallback, deleteCallback)
var col = document.createElement("col");
if (column.width)
col.style.width = column.width;
+ column.element = col;
columnGroup.appendChild(col);
var cell = document.createElement("th");
@@ -98,10 +99,10 @@ WebInspector.DataGrid = function(columns, editCallback, deleteCallback)
headerRow.appendChild(cell);
- ++columnCount;
+ ++this._columnCount;
}
- columnGroup.span = columnCount;
+ columnGroup.span = this._columnCount;
var cell = document.createElement("th");
cell.className = "corner";
@@ -114,7 +115,7 @@ WebInspector.DataGrid = function(columns, editCallback, deleteCallback)
var fillerRow = document.createElement("tr");
fillerRow.className = "filler";
- for (var i = 0; i < columnCount; ++i) {
+ for (var i = 0; i < this._columnCount; ++i) {
var cell = document.createElement("td");
fillerRow.appendChild(cell);
}
@@ -292,7 +293,70 @@ WebInspector.DataGrid.prototype = {
return this._dataTableBody;
},
-
+
+ autoSizeColumns: function(minPercent, maxPercent)
+ {
+ if (minPercent)
+ minPercent = Math.min(minPercent, Math.floor(100 / this._columnCount));
+ var widths = {};
+ var columns = this.columns;
+ for (var columnIdentifier in columns)
+ widths[columnIdentifier] = (columns[columnIdentifier].title || "").length;
+
+ for (var i = 0; i < this.children.length; ++i) {
+ var node = this.children[i];
+ for (var columnIdentifier in columns) {
+ var text = node.data[columnIdentifier] || "";
+ if (text.length > widths[columnIdentifier])
+ widths[columnIdentifier] = text.length;
+ }
+ }
+
+ var totalColumnWidths = 0;
+ for (var columnIdentifier in columns)
+ totalColumnWidths += widths[columnIdentifier];
+
+ var recoupPercent = 0;
+ for (var columnIdentifier in columns) {
+ var width = Math.round(100 * widths[columnIdentifier] / totalColumnWidths);
+ if (minPercent && width < minPercent) {
+ recoupPercent += (minPercent - width);
+ width = minPercent;
+ } else if (maxPercent && width > maxPercent) {
+ recoupPercent -= (width - maxPercent);
+ width = maxPercent;
+ }
+ widths[columnIdentifier] = width;
+ }
+
+ while (minPercent && recoupPercent > 0) {
+ for (var columnIdentifier in columns) {
+ if (widths[columnIdentifier] > minPercent) {
+ --widths[columnIdentifier];
+ --recoupPercent;
+ if (!recoupPercent)
+ break;
+ }
+ }
+ }
+
+ while (maxPercent && recoupPercent < 0) {
+ for (var columnIdentifier in columns) {
+ if (widths[columnIdentifier] < maxPercent) {
+ ++widths[columnIdentifier];
+ ++recoupPercent;
+ if (!recoupPercent)
+ break;
+ }
+ }
+ }
+
+ for (var columnIdentifier in columns)
+ columns[columnIdentifier].element.style.width = widths[columnIdentifier] + "%";
+ this.columnWidthsInitialized = false;
+ this.updateWidths();
+ },
+
// Updates the widths of the table, including the positions of the column
// resizers.
//
diff --git a/WebCore/inspector/front-end/DatabaseQueryView.js b/WebCore/inspector/front-end/DatabaseQueryView.js
index 2656842..cc902e7 100644
--- a/WebCore/inspector/front-end/DatabaseQueryView.js
+++ b/WebCore/inspector/front-end/DatabaseQueryView.js
@@ -144,6 +144,7 @@ WebInspector.DatabaseQueryView.prototype = {
return;
dataGrid.element.addStyleClass("inline");
this._appendQueryResult(query, dataGrid.element);
+ dataGrid.autoSizeColumns(5);
if (query.match(/^create /i) || query.match(/^drop table /i))
WebInspector.panels.storage.updateDatabaseTables(this.database);
diff --git a/WebCore/inspector/front-end/DatabaseTableView.js b/WebCore/inspector/front-end/DatabaseTableView.js
index aa76794..cd66ab7 100644
--- a/WebCore/inspector/front-end/DatabaseTableView.js
+++ b/WebCore/inspector/front-end/DatabaseTableView.js
@@ -68,6 +68,7 @@ WebInspector.DatabaseTableView.prototype = {
}
this.element.appendChild(dataGrid.element);
+ dataGrid.autoSizeColumns(5);
},
_queryError: function(error)
diff --git a/WebCore/inspector/front-end/ElementsTreeOutline.js b/WebCore/inspector/front-end/ElementsTreeOutline.js
index 8d8d5db..4a8dae0 100644
--- a/WebCore/inspector/front-end/ElementsTreeOutline.js
+++ b/WebCore/inspector/front-end/ElementsTreeOutline.js
@@ -925,6 +925,10 @@ WebInspector.ElementsTreeElement.prototype = {
info.title = "Document";
break;
+ case Node.DOCUMENT_FRAGMENT_NODE:
+ info.title = "Document Fragment";
+ break;
+
case Node.ELEMENT_NODE:
info.title = "<span class=\"webkit-html-tag\">&lt;" + node.nodeName.toLowerCase().escapeHTML();
diff --git a/WebCore/inspector/front-end/InjectedScript.js b/WebCore/inspector/front-end/InjectedScript.js
index 337628f..95867c4 100644
--- a/WebCore/inspector/front-end/InjectedScript.js
+++ b/WebCore/inspector/front-end/InjectedScript.js
@@ -52,11 +52,6 @@ InjectedScript.wrapObject = function(object, objectGroupName)
return InjectedScript.createProxyObject(object, objectId);
};
-InjectedScript.wrapAndStringifyObject = function(object, objectGroupName) {
- var r = InjectedScript.wrapObject(object, objectGroupName);
- return InjectedScript.JSON.stringify(r);
-};
-
InjectedScript.unwrapObject = function(objectId) {
return InjectedScript.idToWrappedObject[objectId];
};
@@ -85,7 +80,7 @@ InjectedScript.reset();
InjectedScript.dispatch = function(methodName, args, callId)
{
- var argsArray = InjectedScript.JSON.parse(args);
+ var argsArray = eval("(" + args + ")");
if (callId)
argsArray.splice(0, 0, callId); // Methods that run asynchronously have a call back id parameter.
var result = InjectedScript[methodName].apply(InjectedScript, argsArray);
@@ -93,7 +88,7 @@ InjectedScript.dispatch = function(methodName, args, callId)
InjectedScript._window().console.error("Web Inspector error: InjectedScript.%s returns undefined", methodName);
result = null;
}
- return InjectedScript.JSON.stringify(result);
+ return result;
}
InjectedScript.getStyles = function(nodeId, authorOnly)
@@ -935,7 +930,7 @@ InjectedScript.callFrames = function()
result.push(new InjectedScript.CallFrameProxy(depth++, callFrame));
callFrame = callFrame.caller;
} while (callFrame);
- return InjectedScript.JSON.stringify(result);
+ return result;
}
InjectedScript.evaluateInCallFrame = function(callFrameId, code, objectGroup)
@@ -1220,12 +1215,12 @@ InjectedScript.executeSql = function(callId, databaseId, query)
data[columnIdentifier] = String(text);
}
}
- InjectedScriptHost.reportDidDispatchOnInjectedScript(callId, InjectedScript.JSON.stringify(result), false);
+ InjectedScriptHost.reportDidDispatchOnInjectedScript(callId, result, false);
}
function errorCallback(tx, error)
{
- InjectedScriptHost.reportDidDispatchOnInjectedScript(callId, InjectedScript.JSON.stringify(error), false);
+ InjectedScriptHost.reportDidDispatchOnInjectedScript(callId, error, false);
}
function queryTransaction(tx)
@@ -1339,296 +1334,5 @@ InjectedScript._escapeCharacters = function(str, chars)
return result;
}
-InjectedScript.JSON = {};
-
-// The following code is a slightly modified version of http://www.json.org/json2.js last modified on 2009-09-29.
-// Compared to the original version it ignores toJSON method on objects it serializes.
-// It's done to avoid weird behaviour when inspected application provides it's own implementation
-// of toJSON methods to the Object and other intrinsic types. We use InjectedScript.JSON implementation
-// instead of global JSON object since it can have been modified by the inspected code.
-(function() {
-
- function f(n) {
- // Format integers to have at least two digits.
- return n < 10 ? '0' + n : n;
- }
-
- var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- gap,
- indent,
- meta = { // table of character substitutions
- '\b': '\\b',
- '\t': '\\t',
- '\n': '\\n',
- '\f': '\\f',
- '\r': '\\r',
- '"' : '\\"',
- '\\': '\\\\'
- },
- rep;
-
-
- function quote(string) {
-
-// If the string contains no control characters, no quote characters, and no
-// backslash characters, then we can safely slap some quotes around it.
-// Otherwise we must also replace the offending characters with safe escape
-// sequences.
-
- escapable.lastIndex = 0;
- return escapable.test(string) ?
- '"' + string.replace(escapable, function (a) {
- var c = meta[a];
- return typeof c === 'string' ? c :
- '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- }) + '"' :
- '"' + string + '"';
- }
-
-
- function str(key, holder) {
-
-// Produce a string from holder[key].
-
- var i, // The loop counter.
- k, // The member key.
- v, // The member value.
- length,
- mind = gap,
- partial,
- value = holder[key];
-
-// If we were called with a replacer function, then call the replacer to
-// obtain a replacement value.
-
- if (typeof rep === 'function') {
- value = rep.call(holder, key, value);
- }
-
-// What happens next depends on the value's type.
-
- switch (typeof value) {
- case 'string':
- return quote(value);
-
- case 'number':
-
-// JSON numbers must be finite. Encode non-finite numbers as null.
-
- return isFinite(value) ? String(value) : 'null';
-
- case 'boolean':
- case 'null':
-
-// If the value is a boolean or null, convert it to a string. Note:
-// typeof null does not produce 'null'. The case is included here in
-// the remote chance that this gets fixed someday.
-
- return String(value);
-
-// If the type is 'object', we might be dealing with an object or an array or
-// null.
-
- case 'object':
-
-// Due to a specification blunder in ECMAScript, typeof null is 'object',
-// so watch out for that case.
-
- if (!value) {
- return 'null';
- }
-
-// Make an array to hold the partial results of stringifying this object value.
-
- gap += indent;
- partial = [];
-
-// Is the value an array?
-
- if (Object.prototype.toString.apply(value) === '[object Array]') {
-
-// The value is an array. Stringify every element. Use null as a placeholder
-// for non-JSON values.
-
- length = value.length;
- for (i = 0; i < length; i += 1) {
- partial[i] = str(i, value) || 'null';
- }
-
-// Join all of the elements together, separated with commas, and wrap them in
-// brackets.
-
- v = partial.length === 0 ? '[]' :
- gap ? '[\n' + gap +
- partial.join(',\n' + gap) + '\n' +
- mind + ']' :
- '[' + partial.join(',') + ']';
- gap = mind;
- return v;
- }
-
-// If the replacer is an array, use it to select the members to be stringified.
-
- if (rep && typeof rep === 'object') {
- length = rep.length;
- for (i = 0; i < length; i += 1) {
- k = rep[i];
- if (typeof k === 'string') {
- v = str(k, value);
- if (v) {
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- }
- } else {
-
-// Otherwise, iterate through all of the keys in the object.
-
- for (k in value) {
- if (Object.hasOwnProperty.call(value, k)) {
- v = str(k, value);
- if (v) {
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- }
- }
-
-// Join all of the member texts together, separated with commas,
-// and wrap them in braces.
-
- v = partial.length === 0 ? '{}' :
- gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
- mind + '}' : '{' + partial.join(',') + '}';
- gap = mind;
- return v;
- }
- }
-
- InjectedScript.JSON.stringify = function (value, replacer, space) {
-
-// The stringify method takes a value and an optional replacer, and an optional
-// space parameter, and returns a JSON text. The replacer can be a function
-// that can replace values, or an array of strings that will select the keys.
-// A default replacer method can be provided. Use of the space parameter can
-// produce text that is more easily readable.
-
- var i;
- gap = '';
- indent = '';
-
-// If the space parameter is a number, make an indent string containing that
-// many spaces.
-
- if (typeof space === 'number') {
- for (i = 0; i < space; i += 1) {
- indent += ' ';
- }
-
-// If the space parameter is a string, it will be used as the indent string.
-
- } else if (typeof space === 'string') {
- indent = space;
- }
-
-// If there is a replacer, it must be a function or an array.
-// Otherwise, throw an error.
-
- rep = replacer;
- if (replacer && typeof replacer !== 'function' &&
- (typeof replacer !== 'object' ||
- typeof replacer.length !== 'number')) {
- throw new Error('JSON.stringify');
- }
-
-// Make a fake root object containing our value under the key of ''.
-// Return the result of stringifying the value.
-
- return str('', {'': value});
- };
-
-
-// If the JSON object does not yet have a parse method, give it one.
-
- InjectedScript.JSON.parse = function (text, reviver) {
-
-// The parse method takes a text and an optional reviver function, and returns
-// a JavaScript value if the text is a valid JSON text.
-
- var j;
-
- function walk(holder, key) {
-
-// The walk method is used to recursively walk the resulting structure so
-// that modifications can be made.
-
- var k, v, value = holder[key];
- if (value && typeof value === 'object') {
- for (k in value) {
- if (Object.hasOwnProperty.call(value, k)) {
- v = walk(value, k);
- if (v !== undefined) {
- value[k] = v;
- } else {
- delete value[k];
- }
- }
- }
- }
- return reviver.call(holder, key, value);
- }
-
-
-// Parsing happens in four stages. In the first stage, we replace certain
-// Unicode characters with escape sequences. JavaScript handles many characters
-// incorrectly, either silently deleting them, or treating them as line endings.
-
- cx.lastIndex = 0;
- if (cx.test(text)) {
- text = text.replace(cx, function (a) {
- return '\\u' +
- ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- });
- }
-
-// In the second stage, we run the text against regular expressions that look
-// for non-JSON patterns. We are especially concerned with '()' and 'new'
-// because they can cause invocation, and '=' because it can cause mutation.
-// But just to be safe, we want to reject all unexpected forms.
-
-// We split the second stage into 4 regexp operations in order to work around
-// crippling inefficiencies in IE's and Safari's regexp engines. First we
-// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
-// replace all simple value tokens with ']' characters. Third, we delete all
-// open brackets that follow a colon or comma or that begin the text. Finally,
-// we look to see that the remaining characters are only whitespace or ']' or
-// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
-
- if (/^[\],:{}\s]*$/.
-test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
-replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
-replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
-
-// In the third stage we use the eval function to compile the text into a
-// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
-// in JavaScript: it can begin a block or an object literal. We wrap the text
-// in parens to eliminate the ambiguity.
-
- j = eval('(' + text + ')');
-
-// In the optional fourth stage, we recursively walk the new structure, passing
-// each name/value pair to a reviver function for possible transformation.
-
- return typeof reviver === 'function' ?
- walk({'': j}, '') : j;
- }
-
-// If the text is not JSON parseable, then a SyntaxError is thrown.
-
- throw new SyntaxError('JSON.parse');
- };
-}());
-
return InjectedScript;
});
diff --git a/WebCore/inspector/front-end/InjectedScriptAccess.js b/WebCore/inspector/front-end/InjectedScriptAccess.js
index 2dd2908..2558267 100644
--- a/WebCore/inspector/front-end/InjectedScriptAccess.js
+++ b/WebCore/inspector/front-end/InjectedScriptAccess.js
@@ -56,7 +56,7 @@ InjectedScriptAccess._installHandler = function(methodName, async)
function myCallback(result, isException)
{
if (!isException)
- callback(JSON.parse(result));
+ callback(result);
else
WebInspector.console.addMessage(new WebInspector.ConsoleTextMessage("Error dispatching: " + methodName));
}
diff --git a/WebCore/inspector/front-end/NativeTextViewer.js b/WebCore/inspector/front-end/NativeTextViewer.js
deleted file mode 100644
index 5e7db27..0000000
--- a/WebCore/inspector/front-end/NativeTextViewer.js
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-WebInspector.NativeTextViewer = function(textModel, platform, url)
-{
- WebInspector.TextEditor.call(this, textModel, platform);
- this._sheet.tabIndex = 0;
- this._canvas.style.zIndex = 0;
- this._createLineDivs();
- this._url = url;
- this._selectionColor = "rgb(241, 234, 0)";
-}
-
-WebInspector.NativeTextViewer.prototype = {
- // WebInspector.TextModel listener
- _textChanged: function(oldRange, newRange, oldText, newText)
- {
- this._createLineDivs();
- WebInspector.TextEditor.prototype._textChanged.call(this, oldRange, newRange, oldText, newText);
- },
-
- _createLineDivs: function()
- {
- this._container.removeChild(this._sheet);
- this._sheet.removeChildren();
- for (var i = 0; i < this._textModel.linesCount; ++i) {
- var lineDiv = document.createElement("div");
- lineDiv.className = "native-text-editor-line";
- var text = this._textModel.line(i);
- lineDiv.textContent = text;
- if (!text)
- lineDiv.style.minHeight = this._textLineHeight + "px";
- this._sheet.appendChild(lineDiv);
- this._textModel.setAttribute(i, "line-div", lineDiv);
- this._textModel.removeAttribute(i, "div-highlighted");
- }
- this._container.appendChild(this._sheet);
- },
-
- _updatePreferredSize: function(startLine, endLine)
- {
- // Preferred size is automatically calculated based on the line divs.
- // Only handle line numbers here.
-
- this.setCoalescingUpdate(true);
- var newLineNumberDigits = this._decimalDigits(this._textModel.linesCount);
- this._lineNumberWidth = (newLineNumberDigits + 2) * this._digitWidth;
-
- this._container.style.left = this._lineNumberWidth + "px";
-
- this._lineNumberDigits = newLineNumberDigits;
- this.repaintAll();
-
- // Changes to size can change the client area (scrollers can appear/disappear)
- this.resize();
- this.setCoalescingUpdate(false);
- },
-
- _scroll: function(e)
- {
- // Do instant repaint so that offset of canvas was in sync with the sheet.
- this._repaintOnScroll();
- },
-
- _registerMouseListeners: function()
- {
- this.element.addEventListener("contextmenu", this._contextMenu.bind(this), false);
- this.element.addEventListener("mousedown", this._mouseDown.bind(this), false);
- },
-
- _registerKeyboardListeners: function()
- {
- // Noop - let browser take care of this.
- },
-
- _registerClipboardListeners: function()
- {
- // Noop - let browser take care of this.
- },
-
- _positionDivDecoration: function()
- {
- // Div decorations have fixed positions in our case.
- },
-
- _registerShortcuts: function()
- {
- // Noop.
- },
-
- _mouseDown: function(e)
- {
- if (e.target !== this.element || e.button === 2 || (this._isMac && e.ctrlKey))
- return;
- this._lineNumberDecorator.mouseDown(this._lineForMouseEvent(e), e);
- },
-
- _contextMenu: function(e)
- {
- if (e.target !== this.element)
- return;
- this._lineNumberDecorator.contextMenu(this._lineForMouseEvent(e), e);
- },
-
- _lineForMouseEvent: function(e)
- {
- return Math.max(0, this._offsetToLine(e.offsetY + this._scrollTop) - 1);
- },
-
- _lineHeight: function(lineNumber)
- {
- // Use cached value first.
- if (this._lineOffsetsCache[lineNumber + 1])
- return this._lineOffsetsCache[lineNumber + 1] - this._lineOffsetsCache[lineNumber];
-
- // Get metrics from the browser.
- var element = this._textModel.getAttribute(lineNumber, "line-div");
- if (lineNumber + 1 < this._textModel.linesCount) {
- var nextElement = this._textModel.getAttribute(lineNumber + 1, "line-div");
- return nextElement.offsetTop - element.offsetTop;
- }
- return element.parentElement.offsetHeight - element.offsetTop;
- },
-
- _paintLine: function(lineNumber, lineOffset)
- {
- var divHighlighted = this._textModel.getAttribute(lineNumber, "div-highlighted");
- if (divHighlighted)
- return;
-
- var highlighterState = this._textModel.getAttribute(lineNumber, "highlighter-state");
- if (!highlighterState)
- return;
-
- var line = this._textModel.line(lineNumber);
- var element = this._textModel.getAttribute(lineNumber, "line-div");
- element.removeChildren();
-
- var plainTextStart = -1;
- for (var j = 0; j < line.length;) {
- if (j > 1000) {
- // This line is too long - do not waste cycles on minified js highlighting.
- break;
- }
- var attribute = highlighterState && highlighterState.attributes[j];
- if (!attribute || !attribute.style) {
- if (plainTextStart === -1)
- plainTextStart = j;
- j++;
- } else {
- if (plainTextStart !== -1) {
- element.appendChild(document.createTextNode(line.substring(plainTextStart, j)));
- plainTextStart = -1;
- }
- element.appendChild(this._createSpan(line.substring(j, j + attribute.length), attribute.tokenType));
- j += attribute.length;
- }
- }
- if (plainTextStart !== -1)
- element.appendChild(document.createTextNode(line.substring(plainTextStart, line.length)));
-
- this._textModel.setAttribute(lineNumber, "div-highlighted", true);
- },
-
- _createSpan: function(content, className)
- {
- if (className === "html-resource-link" || className === "html-external-link")
- return this._createLink(content, className === "html-external-link");
-
- var span = document.createElement("span");
- span.className = "webkit-" + className;
- span.appendChild(document.createTextNode(content));
- return span;
- },
-
- _createLink: function(content, isExternal)
- {
- var quote = content.charAt(0);
- if (content.length > 1 && (quote === "\"" || quote === "'"))
- content = content.substring(1, content.length - 1);
- else
- quote = null;
-
- var a = WebInspector.linkifyURLAsNode(this._rewriteHref(content), content, null, isExternal);
- var span = document.createElement("span");
- span.className = "webkit-html-attribute-value";
- if (quote)
- span.appendChild(document.createTextNode(quote));
- span.appendChild(a);
- if (quote)
- span.appendChild(document.createTextNode(quote));
- return span;
- },
-
- _rewriteHref: function(hrefValue, isExternal)
- {
- if (!this._url || !hrefValue || hrefValue.indexOf("://") > 0)
- return hrefValue;
- return WebInspector.completeURL(this._url, hrefValue);
- },
-
- setDivDecoration: function(lineNumber, element)
- {
- var existingElement = this._textModel.getAttribute(lineNumber, "div-decoration");
- if (existingElement && existingElement.parentNode)
- existingElement.parentNode.removeChild(existingElement);
- this._textModel.removeAttribute(lineNumber, "div-decoration");
-
- if (element) {
- if (lineNumber < this._textModel.linesCount - 1) {
- var lineDiv = this._textModel.getAttribute(lineNumber + 1, "line-div");
- this._sheet.insertBefore(element, lineDiv);
- } else
- this._sheet.appendChild(element);
- this._textModel.setAttribute(lineNumber, "div-decoration", element);
- }
- this.revalidateDecorationsAndPaint();
- },
-
- initFontMetrics: function()
- {
- WebInspector.TextEditor.prototype.initFontMetrics.call(this);
- for (var i = 0; i < this._textModel.linesCount; ++i) {
- var lineDiv = this._textModel.getAttribute(i, "line-div");
- if (!this._textModel.line(i))
- lineDiv.style.minHeight = this._textLineHeight + "px";
- }
- }
-}
-
-WebInspector.NativeTextViewer.prototype.__proto__ = WebInspector.TextEditor.prototype;
diff --git a/WebCore/inspector/front-end/ScriptView.js b/WebCore/inspector/front-end/ScriptView.js
index cf7f1b1..c5a8b81 100644
--- a/WebCore/inspector/front-end/ScriptView.js
+++ b/WebCore/inspector/front-end/ScriptView.js
@@ -33,7 +33,7 @@ WebInspector.ScriptView = function(script)
this._frameNeedsSetup = true;
this._sourceFrameSetup = false;
- this.sourceFrame = new WebInspector.SourceFrame(this.element, this._addBreakpoint.bind(this));
+ this.sourceFrame = new WebInspector.SourceFrame(this.element, this._addBreakpoint.bind(this), this._removeBreakpoint.bind(this));
}
WebInspector.ScriptView.prototype = {
@@ -87,6 +87,7 @@ WebInspector.ScriptView.prototype = {
showingLastSearchResult: WebInspector.SourceView.prototype.showingLastSearchResult,
_jumpToSearchResult: WebInspector.SourceView.prototype._jumpToSearchResult,
_sourceFrameSetupFinished: WebInspector.SourceView.prototype._sourceFrameSetupFinished,
+ _removeBreakpoint: WebInspector.SourceView.prototype._removeBreakpoint,
resize: WebInspector.SourceView.prototype.resize
}
diff --git a/WebCore/inspector/front-end/Settings.js b/WebCore/inspector/front-end/Settings.js
index bc0daa5..e6fc0c3 100644
--- a/WebCore/inspector/front-end/Settings.js
+++ b/WebCore/inspector/front-end/Settings.js
@@ -38,8 +38,7 @@ var Preferences = {
styleRulesExpandedState: {},
showMissingLocalizedStrings: false,
samplingCPUProfiler: false,
- showColorNicknames: true,
- useCanvasBasedEditor: false
+ showColorNicknames: true
}
WebInspector.populateFrontendSettings = function(settingsString)
@@ -68,7 +67,7 @@ WebInspector.Settings.prototype = {
this._installSetting("lastViewedScriptFile", "last-viewed-script-file");
this._installSetting("showInheritedComputedStyleProperties", "show-inherited-computed-style-properties", false);
this._installSetting("showUserAgentStyles", "show-user-agent-styles", true);
- this._installSetting("resourceViewTab", "resource-view-tab", "headers");
+ this._installSetting("resourceViewTab", "resource-view-tab", "content");
this.dispatchEventToListeners("loaded");
},
diff --git a/WebCore/inspector/front-end/SourceCSSTokenizer.re2js b/WebCore/inspector/front-end/SourceCSSTokenizer.re2js
index 8d6c5f1..ac22bd4 100644
--- a/WebCore/inspector/front-end/SourceCSSTokenizer.re2js
+++ b/WebCore/inspector/front-end/SourceCSSTokenizer.re2js
@@ -98,35 +98,35 @@ WebInspector.SourceCSSTokenizer = function()
this._valueKeywords = [
"above", "absolute", "activeborder", "activecaption", "afar", "after-white-space", "ahead", "alias", "all", "all-scroll",
- "alternate", "always","amharic", "amharic-abegede", "antialiased", "appworkspace", "aqua", "armenian", "auto", "avoid",
- "background", "backwards", "baseline", "below", "bidi-override", "black", "blink", "block", "block-axis", "blue", "bold",
- "bolder", "border", "border-box", "both", "bottom", "break-all", "break-word", "button", "button-bevel", "buttonface",
- "buttonhighlight", "buttonshadow", "buttontext", "capitalize", "caps-lock-indicator", "caption", "captiontext", "caret", "cell",
- "center", "checkbox", "circle", "cjk-earthly-branch", "cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote",
- "col-resize", "collapse", "compact", "condensed", "contain", "content", "content-box", "context-menu", "continuous", "copy",
- "cover", "crop", "cross", "crosshair", "currentcolor", "cursive", "dashed", "decimal", "decimal-leading-zero", "default",
- "default-button", "destination-atop", "destination-in", "destination-out", "destination-over", "disc", "discard", "document",
+ "alternate", "always","amharic", "amharic-abegede", "antialiased", "appworkspace", "aqua", "arabic-indic", "armenian",
+ "auto", "avoid", "background", "backwards", "baseline", "below", "bidi-override", "binary", "bengali", "black", "blink",
+ "block", "block-axis", "blue", "bold", "bolder", "border", "border-box", "both", "bottom", "break-all", "break-word", "button",
+ "button-bevel", "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "cambodian", "capitalize", "caps-lock-indicator",
+ "caption", "captiontext", "caret", "cell", "center", "checkbox", "circle", "cjk-earthly-branch", "cjk-heavenly-stem", "cjk-ideographic",
+ "clear", "clip", "close-quote", "col-resize", "collapse", "compact", "condensed", "contain", "content", "content-box", "context-menu",
+ "continuous", "copy", "cover", "crop", "cross", "crosshair", "currentcolor", "cursive", "dashed", "decimal", "decimal-leading-zero", "default",
+ "default-button", "destination-atop", "destination-in", "destination-out", "destination-over", "devanagari", "disc", "discard", "document",
"dot-dash", "dot-dot-dash", "dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out", "element",
"ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede", "ethiopic-abegede-am-et", "ethiopic-abegede-gez",
"ethiopic-abegede-ti-er", "ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er", "ethiopic-halehame-aa-et",
"ethiopic-halehame-am-et", "ethiopic-halehame-gez", "ethiopic-halehame-om-et", "ethiopic-halehame-sid-et",
"ethiopic-halehame-so-et", "ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig", "ew-resize", "expanded",
"extra-condensed", "extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "forwards", "from", "fuchsia", "geometricPrecision",
- "georgian", "gray", "graytext", "green", "grey", "groove", "hand", "hangul", "hangul-consonant", "hebrew", "help", "hidden", "hide",
- "higher", "highlight", "highlighttext", "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "icon", "ignore",
+ "georgian", "gray", "graytext", "green", "grey", "groove", "gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hebrew", "help",
+ "hidden", "hide", "higher", "highlight", "highlighttext", "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "icon", "ignore",
"inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite", "infobackground", "infotext", "inherit", "initial", "inline",
- "inline-axis", "inline-block", "inline-table", "inset", "inside", "intrinsic", "invert", "italic", "justify", "katakana",
- "katakana-iroha", "landscape", "large", "larger", "left", "level", "lighter", "lime", "line-through", "linear", "lines",
- "list-button", "list-item", "listbox", "listitem", "local", "logical", "loud", "lower", "lower-alpha", "lower-greek", "lower-latin",
- "lower-norwegian", "lower-roman", "lowercase", "ltr", "maroon", "match", "media-controls-background", "media-current-time-display",
+ "inline-axis", "inline-block", "inline-table", "inset", "inside", "intrinsic", "invert", "italic", "justify", "kannada", "katakana",
+ "katakana-iroha", "khmer", "landscape", "lao", "large", "larger", "left", "level", "lighter", "lime", "line-through", "linear", "lines",
+ "list-button", "list-item", "listbox", "listitem", "local", "logical", "loud", "lower", "lower-alpha", "lower-greek", "lower-hexadecimal", "lower-latin",
+ "lower-norwegian", "lower-roman", "lowercase", "ltr", "malayalam", "maroon", "match", "media-controls-background", "media-current-time-display",
"media-fullscreen-button", "media-mute-button", "media-play-button", "media-return-to-realtime-button", "media-rewind-button",
"media-seek-back-button", "media-seek-forward-button", "media-slider", "media-sliderthumb", "media-time-remaining-display",
"media-volume-slider", "media-volume-slider-container", "media-volume-sliderthumb", "medium", "menu", "menulist", "menulist-button",
- "menulist-text", "menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic", "mix", "monospace", "move", "multiple",
- "n-resize", "narrower", "navy", "ne-resize", "nesw-resize", "no-close-quote", "no-drop", "no-open-quote", "no-repeat", "none",
- "normal", "not-allowed", "nowrap", "ns-resize", "nw-resize", "nwse-resize", "oblique", "olive", "open-quote", "optimizeLegibility",
- "optimizeSpeed", "orange", "oromo", "outset", "outside", "overlay", "overline", "padding", "padding-box", "painted", "paused",
- "plus-darker", "plus-lighter", "pointer", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d", "progress", "purple",
+ "menulist-text", "menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic", "mix", "mongolian", "monospace", "move", "multiple",
+ "myanmar", "n-resize", "narrower", "navy", "ne-resize", "nesw-resize", "no-close-quote", "no-drop", "no-open-quote", "no-repeat", "none",
+ "normal", "not-allowed", "nowrap", "ns-resize", "nw-resize", "nwse-resize", "oblique", "octal", "olive", "open-quote", "optimizeLegibility",
+ "optimizeSpeed", "orange", "oriya", "oromo", "outset", "outside", "overlay", "overline", "padding", "padding-box", "painted", "paused",
+ "persian", "plus-darker", "plus-lighter", "pointer", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d", "progress", "purple",
"push-button", "radio", "read-only", "read-write", "read-write-plaintext-only", "red", "relative", "repeat", "repeat-x",
"repeat-y", "reset", "reverse", "rgb", "rgba", "ridge", "right", "round", "row-resize", "rtl", "run-in", "running", "s-resize", "sans-serif",
"scroll", "scrollbar", "se-resize", "searchfield", "searchfield-cancel-button", "searchfield-decoration", "searchfield-results-button",
@@ -135,15 +135,15 @@ WebInspector.SourceCSSTokenizer = function()
"small", "small-caps", "small-caption", "smaller", "solid", "somali", "source-atop", "source-in", "source-out", "source-over",
"space", "square", "square-button", "start", "static", "status-bar", "stretch", "stroke", "sub", "subpixel-antialiased", "super",
"sw-resize", "table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group",
- "table-row", "table-row-group", "teal", "text", "text-bottom", "text-top", "textarea", "textfield", "thick", "thin", "threeddarkshadow",
- "threedface", "threedhighlight", "threedlightshadow", "threedshadow", "tigre", "tigrinya-er", "tigrinya-er-abegede", "tigrinya-et",
- "tigrinya-et-abegede", "to", "top", "transparent", "ultra-condensed", "ultra-expanded", "underline", "up", "upper-alpha", "upper-greek",
- "upper-latin", "upper-norwegian", "upper-roman", "uppercase", "url", "vertical", "vertical-text", "visible", "visibleFill", "visiblePainted",
- "visibleStroke", "visual", "w-resize", "wait", "wave", "white", "wider", "window", "windowframe", "windowtext", "x-large", "x-small",
- "xor", "xx-large", "xx-small", "yellow", "-wap-marquee", "-webkit-activelink", "-webkit-auto", "-webkit-baseline-middle", "-webkit-body",
- "-webkit-box", "-webkit-center", "-webkit-control", "-webkit-focus-ring-color", "-webkit-grab", "-webkit-grabbing", "-webkit-gradient", "-webkit-inline-box",
- "-webkit-left", "-webkit-link", "-webkit-marquee", "-webkit-mini-control", "-webkit-nowrap", "-webkit-right", "-webkit-small-control",
- "-webkit-text", "-webkit-xxx-large", "-webkit-zoom-in", "-webkit-zoom-out",
+ "table-row", "table-row-group", "teal", "telugu", "text", "text-bottom", "text-top", "textarea", "textfield", "thai", "thick", "thin",
+ "threeddarkshadow", "threedface", "threedhighlight", "threedlightshadow", "threedshadow", "tibetan", "tigre", "tigrinya-er", "tigrinya-er-abegede",
+ "tigrinya-et", "tigrinya-et-abegede", "to", "top", "transparent", "ultra-condensed", "ultra-expanded", "underline", "up", "upper-alpha", "upper-greek",
+ "upper-hexadecimal", "upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url", "vertical", "vertical-text", "visible",
+ "visibleFill", "visiblePainted", "visibleStroke", "visual", "w-resize", "wait", "wave", "white", "wider", "window", "windowframe", "windowtext",
+ "x-large", "x-small", "xor", "xx-large", "xx-small", "yellow", "-wap-marquee", "-webkit-activelink", "-webkit-auto", "-webkit-baseline-middle",
+ "-webkit-body", "-webkit-box", "-webkit-center", "-webkit-control", "-webkit-focus-ring-color", "-webkit-grab", "-webkit-grabbing",
+ "-webkit-gradient", "-webkit-inline-box", "-webkit-left", "-webkit-link", "-webkit-marquee", "-webkit-mini-control", "-webkit-nowrap", "-webkit-right",
+ "-webkit-small-control", "-webkit-text", "-webkit-xxx-large", "-webkit-zoom-in", "-webkit-zoom-out",
].keySet();
this._mediaTypes = ["all", "aural", "braille", "embossed", "handheld", "import", "print", "projection", "screen", "tty", "tv"].keySet();
diff --git a/WebCore/inspector/front-end/SourceFrame.js b/WebCore/inspector/front-end/SourceFrame.js
index e30dbdb..0f90700 100644
--- a/WebCore/inspector/front-end/SourceFrame.js
+++ b/WebCore/inspector/front-end/SourceFrame.js
@@ -28,11 +28,12 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-WebInspector.SourceFrame = function(parentElement, addBreakpointDelegate)
+WebInspector.SourceFrame = function(parentElement, addBreakpointDelegate, removeBreakpointDelegate)
{
this._parentElement = parentElement;
this._textModel = new WebInspector.TextEditorModel();
+ this._textModel.replaceTabsWithSpaces = true;
this._messages = [];
this._rowMessages = {};
@@ -43,6 +44,7 @@ WebInspector.SourceFrame = function(parentElement, addBreakpointDelegate)
this._loaded = false;
this._addBreakpointDelegate = addBreakpointDelegate;
+ this._removeBreakpointDelegate = removeBreakpointDelegate;
}
WebInspector.SourceFrame.prototype = {
@@ -50,7 +52,7 @@ WebInspector.SourceFrame.prototype = {
set visible(visible)
{
this._visible = visible;
- this._createEditorIfNeeded();
+ this._createViewerIfNeeded();
},
get executionLine()
@@ -62,15 +64,18 @@ WebInspector.SourceFrame.prototype = {
{
if (this._executionLine === x)
return;
+
+ var previousLine = this._executionLine;
this._executionLine = x;
- if (this._editor)
- this._editor.repaintAll();
+
+ if (this._textViewer)
+ this._updateExecutionLine(previousLine);
},
revealLine: function(lineNumber)
{
- if (this._editor)
- this._editor.reveal(lineNumber - 1, 0);
+ if (this._textViewer)
+ this._textViewer.revealLine(lineNumber - 1, 0);
else
this._lineNumberToReveal = lineNumber;
},
@@ -81,7 +86,8 @@ WebInspector.SourceFrame.prototype = {
breakpoint.addEventListener("enabled", this._breakpointChanged, this);
breakpoint.addEventListener("disabled", this._breakpointChanged, this);
breakpoint.addEventListener("condition-changed", this._breakpointChanged, this);
- this._addBreakpointToSource(breakpoint);
+ if (this._textViewer)
+ this._addBreakpointToSource(breakpoint);
},
removeBreakpoint: function(breakpoint)
@@ -90,7 +96,8 @@ WebInspector.SourceFrame.prototype = {
breakpoint.removeEventListener("enabled", null, this);
breakpoint.removeEventListener("disabled", null, this);
breakpoint.removeEventListener("condition-changed", null, this);
- this._removeBreakpointFromSource(breakpoint);
+ if (this._textViewer)
+ this._removeBreakpointFromSource(breakpoint);
},
addMessage: function(msg)
@@ -99,7 +106,7 @@ WebInspector.SourceFrame.prototype = {
if (!msg.message || msg.line <= 0 || !msg.isErrorOrWarning())
return;
this._messages.push(msg)
- if (this._editor)
+ if (this._textViewer)
this._addMessageToSource(msg);
},
@@ -113,14 +120,14 @@ WebInspector.SourceFrame.prototype = {
this._messages = [];
this._rowMessages = {};
this._messageBubbles = {};
- if (this._editor)
- this._editor.revalidateDecorationsAndPaint();
+ if (this._textViewer)
+ this._textViewer.resize();
},
sizeToFitContentHeight: function()
{
- if (this._editor)
- this._editor.revalidateDecorationsAndPaint();
+ if (this._textViewer)
+ this._textViewer.revalidateDecorationsAndPaint();
},
setContent: function(mimeType, content, url)
@@ -129,47 +136,56 @@ WebInspector.SourceFrame.prototype = {
this._textModel.setText(null, content);
this._mimeType = mimeType;
this._url = url;
- this._createEditorIfNeeded();
+ this._createViewerIfNeeded();
+ },
+
+ highlightLine: function(line)
+ {
+ if (this._textViewer)
+ this._textViewer.highlightLine(line - 1);
+ else
+ this._lineToHighlight = line;
},
- _createEditorIfNeeded: function()
+ _createViewerIfNeeded: function()
{
- if (!this._visible || !this._loaded || this._editor)
+ if (!this._visible || !this._loaded || this._textViewer)
return;
- var editorConstructor = Preferences.useCanvasBasedEditor ? WebInspector.TextEditor : WebInspector.NativeTextViewer;
- this._editor = new editorConstructor(this._textModel, WebInspector.platform, this._url);
- this._editor.lineNumberDecorator = new WebInspector.BreakpointLineNumberDecorator(this, this._editor.textModel);
- this._editor.lineDecorator = new WebInspector.ExecutionLineDecorator(this);
- this._editor.readOnly = true;
- this._element = this._editor.element;
- this._element.addEventListener("keydown", this._keyDown.bind(this), true);
- this._parentElement.appendChild(this._element);
- this._editor.initFontMetrics();
+ this._textViewer = new WebInspector.TextViewer(this._textModel, WebInspector.platform, this._url);
+ var element = this._textViewer.element;
+ element.addEventListener("keydown", this._keyDown.bind(this), true);
+ element.addEventListener("contextmenu", this._contextMenu.bind(this), true);
+ element.addEventListener("mousedown", this._mouseDown.bind(this), true);
+ this._parentElement.appendChild(element);
- this._editor.mimeType = this._mimeType;
+ this._needsProgramCounterImage = true;
+ this._needsBreakpointImages = true;
+ this._textViewer.beginUpdates();
+
+ this._textViewer.mimeType = this._mimeType;
this._addExistingMessagesToSource();
this._addExistingBreakpointsToSource();
-
- this._editor.setCoalescingUpdate(true);
- this._editor.resize();
- this._editor.revalidateDecorationsAndPaint();
-
- if (this._executionLine)
- this.revealLine(this._executionLine);
+ this._updateExecutionLine();
+ this._textViewer.resize();
if (this._lineNumberToReveal) {
this.revealLine(this._lineNumberToReveal);
delete this._lineNumberToReveal;
}
- if (this._pendingSelectionRange) {
- var range = this._pendingSelectionRange;
- this._editor.setSelection(range.startLine, range.startColumn, range.endLine, range.endColumn);
- delete this._pendingSelectionRange;
+ if (this._pendingMarkRange) {
+ var range = this._pendingMarkRange;
+ this.markAndRevealRange(range);
+ delete this._pendingMarkRange;
}
- this._editor.setCoalescingUpdate(false);
+
+ if (this._lineToHighlight) {
+ this.highlightLine(this._lineToHighlight);
+ delete this._lineToHighlight;
+ }
+ this._textViewer.endUpdates();
},
findSearchMatches: function(query)
@@ -214,21 +230,20 @@ WebInspector.SourceFrame.prototype = {
return ranges;
},
- setSelection: function(range)
+ markAndRevealRange: function(range)
{
- if (this._editor)
- this._editor.setSelection(range.startLine, range.startColumn, range.endLine, range.endColumn);
+ if (this._textViewer)
+ this._textViewer.markAndRevealRange(range);
else
- this._pendingSelectionRange = range;
+ this._pendingMarkRange = range;
},
- clearSelection: function()
+ clearMarkedRange: function()
{
- if (this._editor) {
- var range = this._editor.selection;
- this._editor.setSelection(range.endLine, range.endColumn, range.endLine, range.endColumn);
+ if (this._textViewer) {
+ this._textViewer.markAndRevealRange(null);
} else
- delete this._pendingSelectionRange;
+ delete this._pendingMarkRange;
},
_incrementMessageRepeatCount: function(msg, repeatDelta)
@@ -246,6 +261,40 @@ WebInspector.SourceFrame.prototype = {
msg._resourceMessageRepeatCountElement.textContent = WebInspector.UIString(" (repeated %d times)", msg.repeatCount);
},
+ _breakpointChanged: function(event)
+ {
+ var breakpoint = event.target;
+ var lineNumber = breakpoint.line - 1;
+ if (lineNumber >= this._textModel.linesCount)
+ return;
+
+ if (breakpoint.enabled)
+ this._textViewer.removeDecoration(lineNumber, "webkit-breakpoint-disabled");
+ else
+ this._textViewer.addDecoration(lineNumber, "webkit-breakpoint-disabled");
+
+ if (breakpoint.condition)
+ this._textViewer.addDecoration(lineNumber, "webkit-breakpoint-conditional");
+ else
+ this._textViewer.removeDecoration(lineNumber, "webkit-breakpoint-conditional");
+ },
+
+ _updateExecutionLine: function(previousLine)
+ {
+ if (previousLine) {
+ if (previousLine - 1 < this._textModel.linesCount)
+ this._textViewer.removeDecoration(previousLine - 1, "webkit-execution-line");
+ }
+
+ if (!this._executionLine)
+ return;
+
+ this._drawProgramCounterImageIfNeeded();
+
+ if (this._executionLine < this._textModel.linesCount)
+ this._textViewer.addDecoration(this._executionLine - 1, "webkit-execution-line");
+ },
+
_addExistingMessagesToSource: function()
{
var length = this._messages.length;
@@ -263,7 +312,7 @@ WebInspector.SourceFrame.prototype = {
messageBubbleElement = document.createElement("div");
messageBubbleElement.className = "webkit-html-message-bubble";
this._messageBubbles[msg.line] = messageBubbleElement;
- this._editor.setDivDecoration(msg.line - 1, messageBubbleElement);
+ this._textViewer.addDecoration(msg.line - 1, messageBubbleElement);
}
var rowMessages = this._rowMessages[msg.line];
@@ -275,7 +324,6 @@ WebInspector.SourceFrame.prototype = {
for (var i = 0; i < rowMessages.length; ++i) {
if (rowMessages[i].isEqual(msg, true)) {
this._incrementMessageRepeatCount(rowMessages[i], msg.repeatDelta);
- this._editor.revalidateDecorationsAndPaint();
return;
}
}
@@ -306,35 +354,51 @@ WebInspector.SourceFrame.prototype = {
messageLineElement.appendChild(document.createTextNode(msg.message));
msg._resourceMessageLineElement = messageLineElement;
-
- this._editor.revalidateDecorationsAndPaint();
},
_addExistingBreakpointsToSource: function()
{
- var length = this.breakpoints.length;
- for (var i = 0; i < length; ++i)
+ for (var i = 0; i < this.breakpoints.length; ++i)
this._addBreakpointToSource(this.breakpoints[i]);
},
_addBreakpointToSource: function(breakpoint)
{
- this._textModel.setAttribute(breakpoint.line - 1, "breakpoint", breakpoint);
+ var lineNumber = breakpoint.line - 1;
+ if (lineNumber >= this._textModel.linesCount)
+ return;
+
+ this._textModel.setAttribute(lineNumber, "breakpoint", breakpoint);
breakpoint.sourceText = this._textModel.line(breakpoint.line - 1);
- this._editor.paintLineNumbers();
+ this._drawBreakpointImagesIfNeeded();
+
+ this._textViewer.beginUpdates();
+ this._textViewer.addDecoration(lineNumber, "webkit-breakpoint");
+ if (!breakpoint.enabled)
+ this._textViewer.addDecoration(lineNumber, "webkit-breakpoint-disabled");
+ if (breakpoint.condition)
+ this._textViewer.addDecoration(lineNumber, "webkit-breakpoint-conditional");
+ this._textViewer.endUpdates();
},
_removeBreakpointFromSource: function(breakpoint)
{
- this._textModel.removeAttribute(breakpoint.line - 1, "breakpoint");
- this._editor.paintLineNumbers();
+ var lineNumber = breakpoint.line - 1;
+ this._textViewer.beginUpdates();
+ this._textModel.removeAttribute(lineNumber, "breakpoint");
+ this._textViewer.removeDecoration(lineNumber, "webkit-breakpoint");
+ this._textViewer.removeDecoration(lineNumber, "webkit-breakpoint-disabled");
+ this._textViewer.removeDecoration(lineNumber, "webkit-breakpoint-conditional");
+ this._textViewer.endUpdates();
},
- _contextMenu: function(lineNumber, event)
+ _contextMenu: function(event)
{
- if (!this._addBreakpointDelegate)
+ if (event.target.className !== "webkit-line-number")
return;
+ var row = event.target.parentElement;
+ var lineNumber = row.lineNumber;
var contextMenu = new WebInspector.ContextMenu();
var breakpoint = this._textModel.getAttribute(lineNumber, "breakpoint");
@@ -363,13 +427,19 @@ WebInspector.SourceFrame.prototype = {
contextMenu.show(event);
},
- _toggleBreakpoint: function(lineNumber, event)
+ _mouseDown: function(event)
{
if (event.button != 0 || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey)
return;
+ if (event.target.className !== "webkit-line-number")
+ return;
+ var row = event.target.parentElement;
+
+ var lineNumber = row.lineNumber;
+
var breakpoint = this._textModel.getAttribute(lineNumber, "breakpoint");
if (breakpoint)
- WebInspector.panels.scripts.removeBreakpoint(breakpoint);
+ this._removeBreakpointDelegate(breakpoint);
else if (this._addBreakpointDelegate)
this._addBreakpointDelegate(lineNumber + 1);
event.preventDefault();
@@ -382,14 +452,15 @@ WebInspector.SourceFrame.prototype = {
function committed(element, newText)
{
breakpoint.condition = newText;
- this._editor.paintLineNumbers();
dismissed.call(this);
}
function dismissed()
{
- this._editor.setDivDecoration(breakpoint.line - 1, null);
+ if (this._conditionElement)
+ this._textViewer.removeDecoration(breakpoint.line - 1, this._conditionElement);
delete this._conditionEditorElement;
+ delete this._conditionElement;
}
var dismissedHandler = dismissed.bind(this);
@@ -402,23 +473,23 @@ WebInspector.SourceFrame.prototype = {
_showBreakpointConditionPopup: function(lineNumber)
{
- var conditionElement = this._createConditionElement(lineNumber);
- this._editor.setDivDecoration(lineNumber - 1, conditionElement);
+ this._conditionElement = this._createConditionElement(lineNumber);
+ this._textViewer.addDecoration(lineNumber - 1, this._conditionElement);
},
_createConditionElement: function(lineNumber)
{
var conditionElement = document.createElement("div");
- conditionElement.className = "source-breakpoint-condition";
+ conditionElement.className = "source-frame-breakpoint-condition";
var labelElement = document.createElement("label");
- labelElement.className = "source-breakpoint-message";
- labelElement.htmlFor = "source-breakpoint-condition";
+ labelElement.className = "source-frame-breakpoint-message";
+ labelElement.htmlFor = "source-frame-breakpoint-condition";
labelElement.appendChild(document.createTextNode(WebInspector.UIString("The breakpoint on line %d will stop only if this expression is true:", lineNumber)));
conditionElement.appendChild(labelElement);
var editorElement = document.createElement("input");
- editorElement.id = "source-breakpoint-condition";
+ editorElement.id = "source-frame-breakpoint-condition";
editorElement.className = "monospace";
editorElement.type = "text"
conditionElement.appendChild(editorElement);
@@ -434,9 +505,8 @@ WebInspector.SourceFrame.prototype = {
if (handler) {
handler(event);
event.preventDefault();
- } else {
+ } else
WebInspector.documentKeyDown(event);
- }
},
_evalSelectionInCallFrame: function(event)
@@ -457,146 +527,139 @@ WebInspector.SourceFrame.prototype = {
});
},
- _breakpointChanged: function(event)
+ resize: function()
{
- this._editor.paintLineNumbers();
+ if (this._textViewer)
+ this._textViewer.resize();
},
- resize: function()
+ _drawProgramCounterInContext: function(ctx, glow)
{
- if (this._editor)
- this._editor.resize();
- }
-}
+ if (glow)
+ ctx.save();
-WebInspector.SourceFrame.prototype.__proto__ = WebInspector.Object.prototype;
+ ctx.beginPath();
+ ctx.moveTo(17, 2);
+ ctx.lineTo(19, 2);
+ ctx.lineTo(19, 0);
+ ctx.lineTo(21, 0);
+ ctx.lineTo(26, 5.5);
+ ctx.lineTo(21, 11);
+ ctx.lineTo(19, 11);
+ ctx.lineTo(19, 9);
+ ctx.lineTo(17, 9);
+ ctx.closePath();
+ ctx.fillStyle = "rgb(142, 5, 4)";
-WebInspector.BreakpointLineNumberDecorator = function(sourceFrame, textModel)
-{
- this._sourceFrame = sourceFrame;
- this._textModel = textModel;
-}
+ if (glow) {
+ ctx.shadowBlur = 4;
+ ctx.shadowColor = "rgb(255, 255, 255)";
+ ctx.shadowOffsetX = -1;
+ ctx.shadowOffsetY = 0;
+ }
-WebInspector.BreakpointLineNumberDecorator.prototype = {
- decorate: function(lineNumber, ctx, x, y, width, height, lineHeight)
- {
- var breakpoint = this._textModel.getAttribute(lineNumber, "breakpoint");
- var isExecutionLine = lineNumber + 1 === this._sourceFrame._executionLine;
- if (breakpoint || isExecutionLine) {
- ctx.save();
- ctx.translate(x + 4, y + 2);
- var breakpointWidth = width - 6;
- var breakpointHeight = lineHeight - 4;
-
- if (breakpoint)
- this._paintBreakpoint(ctx, breakpointWidth, breakpointHeight, breakpoint);
-
- if (isExecutionLine)
- this._paintProgramCounter(ctx, breakpointWidth, breakpointHeight, false);
+ ctx.fill();
+ ctx.fill(); // Fill twice to get a good shadow and darker anti-aliased pixels.
+ if (glow)
ctx.restore();
- }
+ },
- if (isExecutionLine) {
- // Override default behavior.
- return true;
- }
+ _drawProgramCounterImageIfNeeded: function()
+ {
+ if (!this._needsProgramCounterImage)
+ return;
+
+ var ctx = document.getCSSCanvasContext("2d", "program-counter", 26, 11);
+ ctx.clearRect(0, 0, 26, 11);
+ this._drawProgramCounterInContext(ctx, true);
- ctx.fillStyle = breakpoint ? "rgb(255,255,255)" : "rgb(155,155,155)";
- return false;
+ delete this._needsProgramCounterImage;
},
- _paintBreakpoint: function(ctx, width, height, breakpoint)
+ _drawBreakpointImagesIfNeeded: function(conditional)
{
- ctx.beginPath();
- ctx.moveTo(0, 2);
- ctx.lineTo(2, 0);
- ctx.lineTo(width - 5, 0);
- ctx.lineTo(width, height / 2);
- ctx.lineTo(width - 5, height);
- ctx.lineTo(2, height);
- ctx.lineTo(0, height - 2);
- ctx.closePath();
- ctx.fillStyle = breakpoint.condition ? "rgb(217, 142, 1)" : "rgb(1, 142, 217)";
- ctx.strokeStyle = breakpoint.condition ? "rgb(205, 103, 0)" : "rgb(0, 103, 205)";
- ctx.lineWidth = 3;
- ctx.fill();
+ if (!this._needsBreakpointImages)
+ return;
+
+ function drawBreakpoint(ctx, disabled, conditional)
+ {
+ ctx.beginPath();
+ ctx.moveTo(0, 2);
+ ctx.lineTo(2, 0);
+ ctx.lineTo(21, 0);
+ ctx.lineTo(26, 5.5);
+ ctx.lineTo(21, 11);
+ ctx.lineTo(2, 11);
+ ctx.lineTo(0, 9);
+ ctx.closePath();
+ ctx.fillStyle = conditional ? "rgb(217, 142, 1)" : "rgb(1, 142, 217)";
+ ctx.strokeStyle = conditional ? "rgb(205, 103, 0)" : "rgb(0, 103, 205)";
+ ctx.lineWidth = 3;
+ ctx.fill();
+ ctx.save();
+ ctx.clip();
+ ctx.stroke();
+ ctx.restore();
- ctx.save();
- ctx.clip();
- ctx.stroke();
- ctx.restore();
+ if (!disabled)
+ return;
- if (!breakpoint.enabled) {
ctx.save();
ctx.globalCompositeOperation = "destination-out";
ctx.fillStyle = "rgba(0, 0, 0, 0.5)";
- ctx.fillRect(0, 0, width, height);
+ ctx.fillRect(0, 0, 26, 11);
ctx.restore();
}
- },
- _paintProgramCounter: function(ctx, width, height)
- {
- ctx.save();
- ctx.beginPath();
- ctx.moveTo(width - 9, 2);
- ctx.lineTo(width - 7, 2);
- ctx.lineTo(width - 7, 0);
- ctx.lineTo(width - 5, 0);
- ctx.lineTo(width, height / 2);
- ctx.lineTo(width - 5, height);
- ctx.lineTo(width - 7, height);
- ctx.lineTo(width - 7, height - 2);
- ctx.lineTo(width - 9, height - 2);
- ctx.closePath();
- ctx.fillStyle = "rgb(142, 5, 4)";
+ // Unconditional breakpoints.
- ctx.shadowBlur = 4;
- ctx.shadowColor = "rgb(255, 255, 255)";
- ctx.shadowOffsetX = -1;
- ctx.shadowOffsetY = 0;
+ var ctx = document.getCSSCanvasContext("2d", "breakpoint", 26, 11);
+ ctx.clearRect(0, 0, 26, 11);
+ drawBreakpoint(ctx);
- ctx.fill();
- ctx.fill(); // Fill twice to get a good shadow and darker anti-aliased pixels.
+ var ctx = document.getCSSCanvasContext("2d", "breakpoint-program-counter", 26, 11);
+ ctx.clearRect(0, 0, 26, 11);
+ drawBreakpoint(ctx);
+ ctx.clearRect(20, 0, 6, 11);
+ this._drawProgramCounterInContext(ctx, true);
- ctx.restore();
- },
+ var ctx = document.getCSSCanvasContext("2d", "breakpoint-disabled", 26, 11);
+ ctx.clearRect(0, 0, 26, 11);
+ drawBreakpoint(ctx, true);
- mouseDown: function(lineNumber, e)
- {
- this._sourceFrame._toggleBreakpoint(lineNumber, e);
- return true;
- },
+ var ctx = document.getCSSCanvasContext("2d", "breakpoint-disabled-program-counter", 26, 11);
+ ctx.clearRect(0, 0, 26, 11);
+ drawBreakpoint(ctx, true);
+ ctx.clearRect(20, 0, 6, 11);
+ this._drawProgramCounterInContext(ctx, true);
- contextMenu: function(lineNumber, e)
- {
- this._sourceFrame._contextMenu(lineNumber, e);
- return true;
- }
-}
-WebInspector.ExecutionLineDecorator = function(sourceFrame)
-{
- this._sourceFrame = sourceFrame;
-}
+ // Conditional breakpoints.
-WebInspector.ExecutionLineDecorator.prototype = {
- decorate: function(lineNumber, ctx, x, y, width, height, lineHeight)
- {
- if (this._sourceFrame._executionLine !== lineNumber + 1)
- return;
- ctx.save();
- ctx.fillStyle = "rgb(171, 191, 254)";
- ctx.fillRect(x, y, width, height);
-
- ctx.beginPath();
- ctx.rect(x - 1, y, width + 2, height);
- ctx.clip();
- ctx.strokeStyle = "rgb(64, 115, 244)";
- ctx.stroke();
+ var ctx = document.getCSSCanvasContext("2d", "breakpoint-conditional", 26, 11);
+ ctx.clearRect(0, 0, 26, 11);
+ drawBreakpoint(ctx, false, true);
- ctx.restore();
+ var ctx = document.getCSSCanvasContext("2d", "breakpoint-conditional-program-counter", 26, 11);
+ ctx.clearRect(0, 0, 26, 11);
+ drawBreakpoint(ctx, false, true);
+ ctx.clearRect(20, 0, 6, 11);
+ this._drawProgramCounterInContext(ctx, true);
+
+ var ctx = document.getCSSCanvasContext("2d", "breakpoint-disabled-conditional", 26, 11);
+ ctx.clearRect(0, 0, 26, 11);
+ drawBreakpoint(ctx, true, true);
+
+ var ctx = document.getCSSCanvasContext("2d", "breakpoint-disabled-conditional-program-counter", 26, 11);
+ ctx.clearRect(0, 0, 26, 11);
+ drawBreakpoint(ctx, true, true);
+ ctx.clearRect(20, 0, 6, 11);
+ this._drawProgramCounterInContext(ctx, true);
+
+ delete this._needsBreakpointImages;
}
}
+
+WebInspector.SourceFrame.prototype.__proto__ = WebInspector.Object.prototype;
diff --git a/WebCore/inspector/front-end/SourceView.js b/WebCore/inspector/front-end/SourceView.js
index 7fc8499..b401c12 100644
--- a/WebCore/inspector/front-end/SourceView.js
+++ b/WebCore/inspector/front-end/SourceView.js
@@ -32,7 +32,7 @@ WebInspector.SourceView = function(resource)
this.element.addStyleClass("source");
- this.sourceFrame = new WebInspector.SourceFrame(this.contentElement, this._addBreakpoint.bind(this));
+ this.sourceFrame = new WebInspector.SourceFrame(this.contentElement, this._addBreakpoint.bind(this), this._removeBreakpoint.bind(this));
resource.addEventListener("finished", this._resourceLoadingFinished, this);
this._frameNeedsSetup = true;
}
@@ -58,16 +58,6 @@ WebInspector.SourceView.prototype = {
this.sourceFrame.resize();
},
- detach: function()
- {
- WebInspector.ResourceView.prototype.detach.call(this);
-
- // FIXME: We need to mark the frame for setup on detach because the frame DOM is cleared
- // when it is removed from the document. Is this a bug?
- this._frameNeedsSetup = true;
- this._sourceFrameSetup = false;
- },
-
setupSourceFrameIfNeeded: function()
{
if (!this._frameNeedsSetup)
@@ -118,6 +108,12 @@ WebInspector.SourceView.prototype = {
}
},
+ _removeBreakpoint: function(breakpoint)
+ {
+ if (WebInspector.panels.scripts)
+ WebInspector.panels.scripts.removeBreakpoint(breakpoint);
+ },
+
// The rest of the methods in this prototype need to be generic enough to work with a ScriptView.
// The ScriptView prototype pulls these methods into it's prototype to avoid duplicate code.
@@ -125,7 +121,7 @@ WebInspector.SourceView.prototype = {
{
this._currentSearchResultIndex = -1;
this._searchResults = [];
- this.sourceFrame.clearSelection();
+ this.sourceFrame.clearMarkedRange();
delete this._delayedFindSearchMatches;
},
@@ -225,7 +221,7 @@ WebInspector.SourceView.prototype = {
if (!foundRange)
return;
- this.sourceFrame.setSelection(foundRange);
+ this.sourceFrame.markAndRevealRange(foundRange);
},
_sourceFrameSetupFinished: function()
diff --git a/WebCore/inspector/front-end/StoragePanel.js b/WebCore/inspector/front-end/StoragePanel.js
index dee4442..ca1b276 100644
--- a/WebCore/inspector/front-end/StoragePanel.js
+++ b/WebCore/inspector/front-end/StoragePanel.js
@@ -220,14 +220,14 @@ WebInspector.StoragePanel.prototype = {
this.storageViewStatusBarItemsContainer.appendChild(statusBarItems[i]);
},
- showCookies: function(cookieDomain)
+ showCookies: function(treeElement, cookieDomain)
{
if (this.visibleView)
this.visibleView.hide();
var view = this._cookieViews[cookieDomain];
if (!view) {
- view = new WebInspector.CookieItemsView(cookieDomain);
+ view = new WebInspector.CookieItemsView(treeElement, cookieDomain);
this._cookieViews[cookieDomain] = view;
}
@@ -300,52 +300,14 @@ WebInspector.StoragePanel.prototype = {
var data = {};
var row = rows[i];
- for (var columnIdentifier in row) {
- var text = row[columnIdentifier];
- data[columnIdentifier] = text;
- if (text.length > columns[columnIdentifier].width)
- columns[columnIdentifier].width = text.length;
- }
+ for (var columnIdentifier in row)
+ data[columnIdentifier] = row[columnIdentifier];
var node = new WebInspector.DataGridNode(data, false);
node.selectable = false;
nodes.push(node);
}
- var totalColumnWidths = 0;
- for (var columnIdentifier in columns)
- totalColumnWidths += columns[columnIdentifier].width;
-
- // Calculate the percentage width for the columns.
- const minimumPrecent = Math.min(5, Math.floor(100/numColumns));
- var recoupPercent = 0;
- for (var columnIdentifier in columns) {
- var width = columns[columnIdentifier].width;
- width = Math.round((width / totalColumnWidths) * 100);
- if (width < minimumPrecent) {
- recoupPercent += (minimumPrecent - width);
- width = minimumPrecent;
- }
-
- columns[columnIdentifier].width = width;
- }
-
- // Enforce the minimum percentage width.
- while (recoupPercent > 0) {
- for (var columnIdentifier in columns) {
- if (columns[columnIdentifier].width > minimumPrecent) {
- --columns[columnIdentifier].width;
- --recoupPercent;
- if (!recoupPercent)
- break;
- }
- }
- }
-
- // Change the width property to a string suitable for a style width.
- for (var columnIdentifier in columns)
- columns[columnIdentifier].width += "%";
-
var dataGrid = new WebInspector.DataGrid(columns);
var length = nodes.length;
for (var i = 0; i < length; ++i)
@@ -507,6 +469,7 @@ WebInspector.CookieSidebarTreeElement = function(cookieDomain)
{
WebInspector.SidebarTreeElement.call(this, "cookie-sidebar-tree-item", cookieDomain, "", null, false);
this._cookieDomain = cookieDomain;
+ this._subtitle = "";
this.refreshTitles();
}
@@ -514,9 +477,9 @@ WebInspector.CookieSidebarTreeElement = function(cookieDomain)
WebInspector.CookieSidebarTreeElement.prototype = {
onselect: function()
{
- WebInspector.panels.storage.showCookies(this._cookieDomain);
+ WebInspector.panels.storage.showCookies(this, this._cookieDomain);
},
-
+
get mainTitle()
{
return this._cookieDomain ? this._cookieDomain : WebInspector.UIString("Local Files");
@@ -529,12 +492,13 @@ WebInspector.CookieSidebarTreeElement.prototype = {
get subtitle()
{
- return "";
+ return this._subtitle;
},
set subtitle(x)
{
- // Do nothing.
+ this._subtitle = x;
+ this.refreshTitles();
}
}
diff --git a/WebCore/inspector/front-end/StylesSidebarPane.js b/WebCore/inspector/front-end/StylesSidebarPane.js
index f04cb66..265e488 100644
--- a/WebCore/inspector/front-end/StylesSidebarPane.js
+++ b/WebCore/inspector/front-end/StylesSidebarPane.js
@@ -60,8 +60,8 @@ WebInspector.StylesSidebarPane = function()
this.settingsSelectElement.addEventListener("click", function(event) { event.stopPropagation() }, false);
this.settingsSelectElement.addEventListener("change", this._changeSetting.bind(this), false);
- WebInspector.settings.addEventListener("loaded", this._settingsLoaded, this);
-
+ WebInspector.settings.addEventListener("loaded", this._settingsLoaded, this);
+
this.titleElement.appendChild(this.settingsSelectElement);
}
@@ -354,7 +354,7 @@ WebInspector.StylesSidebarPane.prototype = {
var blankSection = new WebInspector.BlankStylePropertiesSection(appropriateSelectorForNode(this.node, true));
blankSection.pane = this;
- var elementStyleSection = this.sections[1];
+ var elementStyleSection = this.sections[1];
this.bodyElement.insertBefore(blankSection.element, elementStyleSection.element.nextSibling);
this.sections.splice(2, 0, blankSection);
@@ -445,7 +445,7 @@ WebInspector.StylePropertiesSection = function(styleRule, subtitle, computedStyl
this.identifier = styleRule.selectorText;
if (this.subtitle)
- this.identifier += ":" + this.subtitleElement.textContent;
+ this.identifier += ":" + this.subtitleElement.textContent;
}
WebInspector.StylePropertiesSection.prototype = {
@@ -530,6 +530,11 @@ WebInspector.StylePropertiesSection.prototype = {
}
}
+ this.afterUpdate();
+ },
+
+ afterUpdate: function()
+ {
if (this._afterUpdate) {
this._afterUpdate(this);
delete this._afterUpdate;
@@ -1296,8 +1301,7 @@ WebInspector.StylePropertyTreeElement.prototype = {
if (alreadyNew && !valueChanged)
return;
- var item = section.addNewBlankProperty();
- item.startEditing();
+ section.addNewBlankProperty().startEditing();
return;
}
@@ -1315,6 +1319,7 @@ WebInspector.StylePropertyTreeElement.prototype = {
if (this._newProperty) {
// The user deleted everything, so remove the tree element and update.
this.parent.removeChild(this);
+ section.afterUpdate();
return;
} else {
delete section._afterUpdate;
diff --git a/WebCore/inspector/front-end/TextEditor.js b/WebCore/inspector/front-end/TextEditor.js
deleted file mode 100644
index 9268280..0000000
--- a/WebCore/inspector/front-end/TextEditor.js
+++ /dev/null
@@ -1,1168 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-WebInspector.TextEditor = function(textModel, platform)
-{
- this._textModel = textModel;
- this._textModel.changeListener = this._textChanged.bind(this);
- this._highlighter = new WebInspector.TextEditorHighlighter(this._textModel, this._highlightChanged.bind(this));
-
- this.element = document.createElement("div");
- this.element.className = "text-editor monospace";
- this.element.tabIndex = 0;
-
- this._canvas = document.createElement("canvas");
- this._canvas.className = "text-editor-canvas";
- this.element.appendChild(this._canvas);
-
- this._container = document.createElement("div");
- this._container.className = "text-editor-container";
- this.element.appendChild(this._container);
-
- this._sheet = document.createElement("div");
- this._container.appendChild(this._sheet);
-
- var cursorElement = document.createElement("div");
- cursorElement.className = "text-editor-cursor";
- this._container.appendChild(cursorElement);
- this._cursor = new WebInspector.TextCursor(cursorElement);
-
- this._container.addEventListener("scroll", this._scroll.bind(this), false);
-
- this._registerMouseListeners();
- this._registerKeyboardListeners();
- this._registerClipboardListeners();
-
- this._desiredCaretColumn = 0;
- this._scrollLeft = 0;
- this._scrollTop = 0;
-
- this._ctx = this._canvas.getContext("2d");
- this._selection = new WebInspector.TextSelectionModel(this._selectionChanged.bind(this));
-
- this._isMac = platform && (platform.indexOf("mac") === 0);
- this._paintCoalescingLevel = 0;
-
- this._registerShortcuts();
- // Debugging flags, allow disabling / enabling highlights and track repaints.
- this._highlightingEnabled = true;
- this._debugMode = false;
-
- this._textWidth = 0;
- this._longestLineNumber = 0;
-
- this._lineOffsetsCache = [0];
- this._readOnly = false;
- this._selectionColor = "rgb(181, 213, 255)";
-}
-
-WebInspector.TextEditor.prototype = {
- set text(text)
- {
- var lastLine = this._textModel.linesCount - 1;
- this._textModel.setText(null, text);
- this._textModel.resetUndoStack();
- this._setCaretLocation(0, 0);
- },
-
- set mimeType(mimeType)
- {
- this._highlighter.mimeType = mimeType;
- },
-
- get textModel()
- {
- return this._textModel;
- },
-
- set readOnly(readOnly)
- {
- this._readOnly = readOnly;
- if (readOnly)
- this.element.addStyleClass("text-editor-readonly")
- else
- this.element.removeStyleClass("text-editor-readonly")
- },
-
- set lineNumberDecorator(lineNumberDecorator)
- {
- this._lineNumberDecorator = lineNumberDecorator;
- },
-
- set lineDecorator(lineDecorator)
- {
- this._lineDecorator = lineDecorator;
- },
-
- get selection()
- {
- return this._selection.range();
- },
-
- setSelection: function(startLine, startColumn, endLine, endColumn)
- {
- var start = this._fit(startLine, startColumn);
- this._selection.setStart(start.line, start.column);
- this._setSelectionEnd(endLine, endColumn);
- },
-
- setDivDecoration: function(lineNumber, element)
- {
- var existingElement = this._textModel.getAttribute(lineNumber, "div-decoration");
- if (existingElement && existingElement.parentNode)
- existingElement.parentNode.removeChild(existingElement);
- this._textModel.removeAttribute(lineNumber, "div-decoration");
-
- if (element) {
- this.element.appendChild(element);
- this._textModel.setAttribute(lineNumber, "div-decoration", element);
- }
- this.revalidateDecorationsAndPaint();
- },
-
- _registerMouseListeners: function()
- {
- this.element.addEventListener("contextmenu", this._contextMenu.bind(this), false);
- this.element.addEventListener("mouseup", this._mouseUp.bind(this), false);
- this.element.addEventListener("mousedown", this._mouseDown.bind(this), false);
- this.element.addEventListener("mousemove", this._mouseMove.bind(this), false);
- this.element.addEventListener("mouseout", this._mouseOut.bind(this), false);
- this.element.addEventListener("dblclick", this._dblClick.bind(this), false);
- },
-
- _registerKeyboardListeners: function()
- {
- this._container.addEventListener("keydown", this._keyDown.bind(this), false);
- this._container.addEventListener("textInput", this._textInput.bind(this), false);
- },
-
- _registerClipboardListeners: function()
- {
- this._container.addEventListener("beforecopy", this._beforeCopy.bind(this), false);
- this._container.addEventListener("copy", this._copy.bind(this), false);
- this._container.addEventListener("beforecut", this._beforeCut.bind(this), false);
- this._container.addEventListener("cut", this._cut.bind(this), false);
- this._container.addEventListener("beforepaste", this._beforePaste.bind(this), false);
- this._container.addEventListener("paste", this._paste.bind(this), false);
- },
-
- _offsetToLine: function(offset)
- {
- if (offset > this._lineOffsetsCache[this._lineOffsetsCache.length - 1]) {
- // Seeking outside cached area. Fill the cache.
- var lineNumber = this._lineOffsetsCache.length;
- while (lineNumber < this._textModel.linesCount && this._lineToOffset(lineNumber) < offset)
- lineNumber++;
- return lineNumber;
- }
-
- // Bisect.
- var from = 0;
- var to = this._lineOffsetsCache.length;
- while (to > from + 1) {
- var mid = Math.floor((from + to) / 2);
- if (this._lineOffsetsCache[mid] > offset)
- to = mid;
- else
- from = mid;
- }
- return to;
- },
-
- _lineToOffset: function(lineNumber)
- {
- var offset = this._lineOffsetsCache[lineNumber];
- if (offset)
- return offset;
- for (var line = lineNumber; line > 0; --line) {
- if (this._lineOffsetsCache[line])
- break;
- }
- offset = this._lineOffsetsCache[line];
- for (var i = line + 1; i <= lineNumber; ++i) {
- offset += this._lineHeight(i - 1);
- this._lineOffsetsCache[i] = offset;
- }
- return offset;
- },
-
- _lineHeight: function(lineNumber)
- {
- // Use cached value first.
- if (this._lineOffsetsCache[lineNumber + 1])
- return this._lineOffsetsCache[lineNumber + 1] - this._lineOffsetsCache[lineNumber];
-
- var element = this._textModel.getAttribute(lineNumber, "div-decoration");
- if (element)
- return 2 * this._textLineHeight + element.clientHeight;
- return this._textLineHeight;
- },
-
- reveal: function(line, column)
- {
- this._scrollTop = this._container.scrollTop;
- this._scrollLeft = this._container.scrollLeft;
-
- var maxScrollTop = this._lineToOffset(line);
- var minScrollTop = maxScrollTop + this._lineHeight(line) - this._canvas.height;
- if (this._scrollTop > maxScrollTop)
- this._container.scrollTop = maxScrollTop - this._textLineHeight * 2;
- else if (this._scrollTop < minScrollTop)
- this._container.scrollTop = minScrollTop + this._textLineHeight * 2;
-
- var firstColumn = this._columnForOffset(line, this._scrollLeft);
- var maxScrollLeft = this._columnToOffset(line, column);
- var minScrollLeft = maxScrollLeft - this._container.clientWidth + this._lineNumberWidth;
- if (this._scrollLeft < minScrollLeft)
- this._container.scrollLeft = minScrollLeft + 100;
- else if (this._scrollLeft > maxScrollLeft)
- this._container.scrollLeft = maxScrollLeft;
- else if (minScrollLeft < 0 && maxScrollLeft > 0)
- this._container.scrollLeft = 0;
- },
-
- // WebInspector.TextModel listener
- _textChanged: function(oldRange, newRange, oldText, newText)
- {
- if (newRange.linesCount == oldRange.linesCount)
- this._invalidateLines(newRange.startLine, newRange.endLine + 1);
- else
- // Lines shifted, invalidate all under start line. Also clear lines that now are outside model range.
- this._invalidateLines(newRange.startLine, this._textModel.linesCount + Math.max(0, oldRange.endLine - newRange.endLine));
-
- if (this._highlightingEnabled) {
- var lastVisibleLine = Math.min(this._textModel.linesCount, this._offsetToLine(this._scrollTop + this._canvas.height) + 1);
- this._highlighter.updateHighlight(newRange.startLine, lastVisibleLine);
- }
-
- this._updatePreferredSize(newRange.startLine, Math.max(newRange.endLine, oldRange.endLine));
- if (oldRange.linesCount !== newRange.linesCount) {
- // Invalidate offset cache.
- this._lineOffsetsCache.length = oldRange.startLine + 1;
- // Force linenumber cache to be continuous.
- this._lineToOffset(oldRange.startLine);
- this.paintLineNumbers();
- }
- this._paint();
- },
-
- // WebInspector.TextSelectionModel listener
- _selectionChanged: function(oldRange, newRange)
- {
- if (oldRange.isEmpty() && newRange.isEmpty() && oldRange.startLine === newRange.startLine) {
- // Nothing to repaint.
- return;
- }
-
- this._invalidateLines(oldRange.startLine, oldRange.endLine + 1);
- this._invalidateLines(newRange.startLine, newRange.endLine + 1);
- this._paint();
- },
-
- _highlightChanged: function(fromLine, toLine)
- {
- if (this._muteHighlightListener)
- return;
-
- this._invalidateLines(fromLine, toLine);
- this._paint();
- },
-
- revalidateDecorationsAndPaint: function()
- {
- this.setCoalescingUpdate(true);
- this._lineOffsetsCache = [0];
- this._updatePreferredSize(0, this._textModel.linesCount);
- this.repaintAll();
- this.setCoalescingUpdate(false);
- },
-
- _updatePreferredSize: function(startLine, endLine)
- {
- this._ctx.font = this._font;
- this.setCoalescingUpdate(true);
- var guardedEndLine = Math.min(this._textModel.linesCount, endLine + 1);
- var newMaximum = false;
- for (var i = startLine; i < guardedEndLine; ++i) {
- var lineWidth = this._ctx.measureText(this._textModel.line(i)).width;
- if (lineWidth > this._textWidth) {
- this._textWidth = lineWidth;
- this._longestLineNumber = i;
- newMaximum = true;
- }
- }
-
- if (!newMaximum && startLine <= this._longestLineNumber && this._longestLineNumber <= endLine) {
- this._textWidth = 0;
- this._longestLineNumber = 0;
- for (var i = 0; i < this._textModel.linesCount; ++i) {
- var lineWidth = this._ctx.measureText(this._textModel.line(i)).width;
- if (lineWidth > this._textWidth) {
- this._textWidth = lineWidth;
- this._longestLineNumber = i;
- }
- }
- }
-
- var newLineNumberDigits = this._decimalDigits(this._textModel.linesCount);
- this._lineNumberWidth = (newLineNumberDigits + 2) * this._digitWidth;
- this._container.style.left = this._lineNumberWidth + "px";
-
- var newWidth = this._textWidth + "px";
- var newHeight = this._lineToOffset(this._textModel.linesCount) + "px";
- this._sheet.style.width = newWidth;
- this._sheet.style.height = newHeight;
-
- if (newLineNumberDigits !== this._lineNumberDigits) {
- this._lineNumberDigits = newLineNumberDigits;
- this.repaintAll();
- }
-
- // Changes to size can change the client area (scrollers can appear/disappear)
- this.resize();
- this.setCoalescingUpdate(false);
- },
-
- resize: function()
- {
- if (this._canvas.width !== this._container.clientWidth || this._canvas.height !== this._container.clientHeight) {
- this._canvas.width = this._container.clientWidth + this._lineNumberWidth;
- this._canvas.height = this._container.clientHeight;
- this.repaintAll();
- }
- },
-
- repaintAll: function()
- {
- this._invalidateLines(0, this._textModel.linesCount);
- this._paint();
- },
-
- _invalidateLines: function(startLine, endLine)
- {
- if (!this._damage)
- this._damage = [ { startLine: startLine, endLine: endLine } ];
- else {
- for (var i = 0; i < this._damage.length; ++i) {
- var chunk = this._damage[i];
- if (chunk.startLine <= endLine && chunk.endLine >= startLine) {
- chunk.startLine = Math.min(chunk.startLine, startLine);
- chunk.endLine = Math.max(chunk.endLine, endLine);
- return;
- }
- }
- this._damage.push({ startLine: startLine, endLine: endLine });
- }
- },
-
- _paint: function()
- {
- this._scrollTop = this._container.scrollTop;
- this._scrollLeft = this._container.scrollLeft;
-
- if (this._paintCoalescingLevel)
- return;
-
- this._updateDivDecorations();
-
- this.paintLineNumbers();
-
- for (var i = 0; this._damage && i < this._damage.length; ++i)
- this._paintLines(this._damage[i].startLine, this._damage[i].endLine);
- delete this._damage;
-
- this._updateCursor(this._selection.endLine, this._selection.endColumn);
- },
-
- _paintLines: function(firstLine, lastLine)
- {
- this._ctx.font = this._font;
- this._ctx.textBaseline = "bottom";
-
- firstLine = Math.max(firstLine, this._offsetToLine(this._scrollTop) - 1);
- lastLine = Math.min(lastLine, this._offsetToLine(this._scrollTop + this._canvas.height) + 1);
- if (firstLine > lastLine)
- return;
-
- if (this._debugMode) {
- WebInspector.log("Repaint %d:%d", firstLine, lastLine);
- this._ctx.fillStyle = "rgb(255,255,0)";
- var fromOffset = this._lineToOffset(firstLine);
- var toOffset = this._lineToOffset(lastLine);
- this._ctx.fillRect(this._lineNumberWidth - 1, fromOffset - this._scrollTop, this._canvas.width - this._lineNumberWidth + 1, toOffset - fromOffset);
- setTimeout(this._paintLinesContinuation.bind(this, firstLine, lastLine), 100);
- } else
- this._paintLinesContinuation(firstLine, lastLine);
- },
-
- _paintLinesContinuation: function(firstLine, lastLine) {
- // Clip editor area.
- this._ctx.save();
- this._ctx.beginPath();
- this._ctx.rect(this._lineNumberWidth - 1, 0, this._canvas.width - this._lineNumberWidth + 1, this._canvas.height);
- this._ctx.clip();
-
- // First clear the region, then update last line to fit model (this clears removed lines from the end of the document).
- var fromOffset = this._lineToOffset(firstLine);
- var toOffset = lastLine < this._textModel.linesCount ? this._lineToOffset(lastLine) : this._canvas.height + this._scrollTop;
-
- // Do not clear region when paintCurrentLine is likely to do all the necessary work.
- if (this._readOnly || firstLine + 1 != lastLine || this._selection.endLine != firstLine) {
- this._ctx.fillStyle = "rgb(255,255,255)";
- this._ctx.fillRect(0, fromOffset - this._scrollTop, this._canvas.width, toOffset - fromOffset);
- }
- lastLine = Math.min(lastLine, this._textModel.linesCount);
-
- // Paint current line for editable mode only.
- if (!this._readOnly && this._selection.startLine === this._selection.endLine && firstLine <= this._selection.startLine && this._selection.startLine < lastLine)
- this._paintCurrentLine(this._selection.startLine);
-
- this._paintSelection(firstLine, lastLine);
-
- if (this._highlightingEnabled) {
- this._muteHighlightListener = true;
- this._highlighter.highlight(lastLine);
- delete this._muteHighlightListener;
- }
- for (var i = firstLine; i < lastLine; ++i) {
- var lineOffset = this._lineToOffset(i) - this._scrollTop;
-
- if (this._lineDecorator)
- this._lineDecorator.decorate(i, this._ctx, this._lineNumberWidth - 1, lineOffset, this._canvas.width - this._lineNumberWidth + 1, this._lineHeight(i), this._textLineHeight);
-
- var element = this._textModel.getAttribute(i, "div-decoration");
- if (element)
- this._positionDivDecoration(i, element, true);
-
- this._paintLine(i, lineOffset);
- }
- this._ctx.restore();
- },
-
- _paintLine: function(lineNumber, lineOffset)
- {
- var line = this._textModel.line(lineNumber);
- if (!this._highlightingEnabled) {
- this._ctx.fillStyle = "rgb(0,0,0)";
- this._ctx.fillText(line, this._lineNumberWidth - this._scrollLeft, lineOffset + this._textLineHeight);
- return;
- }
-
- if (line.length > 1000) {
- // Optimization: no need to paint decorations outside visible area.
- var firstColumn = this._columnForOffset(lineNumber, this._scrollLeft);
- var lastColumn = this._columnForOffset(lineNumber, this._scrollLeft + this._canvas.width);
- }
- var highlighterState = this._textModel.getAttribute(lineNumber, "highlighter-state");
- var plainTextStart = -1;
- for (var j = 0; j < line.length;) {
- var attribute = highlighterState && highlighterState.attributes[j];
- if (attribute && firstColumn && j + attribute.length < firstColumn) {
- j += attribute.length;
- continue;
- }
- if (attribute && lastColumn && j > lastColumn)
- break;
- if (!attribute || !attribute.style) {
- if (plainTextStart === -1)
- plainTextStart = j;
- j++;
- } else {
- if (plainTextStart !== -1) {
- this._ctx.fillStyle = "rgb(0,0,0)";
- this._ctx.fillText(line.substring(plainTextStart, j), this._lineNumberWidth - this._scrollLeft + this._columnToOffset(lineNumber, plainTextStart), lineOffset + this._textLineHeight);
- plainTextStart = -1;
- }
- this._ctx.fillStyle = attribute.style;
- this._ctx.fillText(line.substring(j, j + attribute.length), this._lineNumberWidth - this._scrollLeft + this._columnToOffset(lineNumber, j), lineOffset + this._textLineHeight);
- j += attribute.length;
- }
- }
- if (plainTextStart !== -1) {
- this._ctx.fillStyle = "rgb(0,0,0)";
- this._ctx.fillText(line.substring(plainTextStart, j), this._lineNumberWidth - this._scrollLeft + this._columnToOffset(lineNumber, plainTextStart), lineOffset + this._textLineHeight);
- }
- },
-
- paintLineNumbers: function()
- {
- this._ctx.font = this._font;
- this._ctx.textBaseline = "bottom";
-
- this._ctx.fillStyle = "rgb(255,255,255)";
- this._ctx.fillRect(0, 0, this._lineNumberWidth - 2, this._canvas.height);
-
- this._ctx.fillStyle = "rgb(235,235,235)";
- this._ctx.fillRect(this._lineNumberWidth - 2, 0, 1, this._canvas.height);
-
- var firstLine = Math.max(0, this._offsetToLine(this._scrollTop) - 1);
- var lastLine = Math.min(this._textModel.linesCount, this._offsetToLine(this._scrollTop + this._canvas.height) + 1);
-
- for (var i = firstLine; i < lastLine; ++i) {
- var lineOffset = this._lineToOffset(i) - this._scrollTop;
- this._ctx.fillStyle = "rgb(155,155,155)";
- if (this._lineNumberDecorator && this._lineNumberDecorator.decorate(i, this._ctx, 0, lineOffset, this._lineNumberWidth, this._lineHeight(i), this._textLineHeight))
- continue;
- this._ctx.fillText(i + 1, (this._lineNumberDigits - this._decimalDigits(i + 1) + 1) * this._digitWidth, lineOffset + this._textLineHeight);
- }
- },
-
- _paintCurrentLine: function(line)
- {
- this._ctx.fillStyle = "rgb(232, 242, 254)";
- this._ctx.fillRect(0, this._lineToOffset(line) - this._scrollTop, this._canvas.width, this._lineHeight(line));
- },
-
- _scroll: function(e)
- {
- // Hide div-based cursor first.
- this._cursor._cursorElement.style.display = "none";
- setTimeout(this._repaintOnScroll.bind(this), 10);
- },
-
- _repaintOnScroll: function()
- {
- if (this._scrollTop !== this._container.scrollTop || this._scrollLeft !== this._container.scrollLeft) {
- this._scrollTop = this._container.scrollTop;
- this._scrollLeft = this._container.scrollLeft;
- this.repaintAll();
- }
- },
-
- _mouseUp: function(e)
- {
- this._isDragging = false;
- },
-
- _mouseDown: function(e)
- {
- if (e.button === 2 || (this._isMac && e.ctrlKey))
- return;
-
- var location = this._caretForMouseEvent(e);
-
- if (e.target === this.element && this._lineNumberDecorator) {
- if (this._lineNumberDecorator.mouseDown(location.line, e))
- return;
- }
-
- if (e.shiftKey)
- this._setSelectionEnd(location.line, location.column);
- else
- this._setCaretLocation(location.line, location.column);
- this._isDragging = true;
- this._textModel.markUndoableState();
- },
-
- _mouseMove: function(e)
- {
- if (!this._isDragging)
- return;
- var location = this._caretForMouseEvent(e);
- this._setSelectionEnd(location.line, location.column)
- },
-
- _mouseOut: function(e)
- {
- },
-
- _dblClick: function(e)
- {
- var location = this._caretForMouseEvent(e);
- var range = this._textModel.wordRange(location.line, location.column);
- this.setSelection(range.startLine, range.startColumn, range.endLine, range.endColumn);
- },
-
- _contextMenu: function(e)
- {
- if (e.target === this.element && this._lineNumberDecorator) {
- var location = this._caretForMouseEvent(e);
- if (this._lineNumberDecorator.contextMenu(location.line, e))
- return;
- } else {
- var range = this._selection.range();
- if (!range.isEmpty()) {
- var text = this._textModel.copyRange(range);
- var contextMenu = new WebInspector.ContextMenu();
- contextMenu.appendItem(WebInspector.UIString("Copy"), this._copy.bind(this));
- contextMenu.show(event);
- }
- }
- },
-
- _caretForMouseEvent: function(e)
- {
- var lineNumber = Math.max(0, this._offsetToLine(e.offsetY + (e.target === this.element ? this._scrollTop : 0)) - 1);
- var offset = e.offsetX + this._scrollLeft;
- return { line: lineNumber, column: this._columnForOffset(lineNumber, offset) };
- },
-
- _columnForOffset: function(lineNumber, offset)
- {
- var length = 0;
- var line = this._textModel.line(lineNumber);
-
- // First pretend it is monospace to get a quick guess.
- var charWidth = this._ctx.measureText("a").width;
- var index = Math.floor(offset / charWidth);
- var indexOffset = this._ctx.measureText(line.substring(0, index)).width;
- if (offset >= indexOffset && index < line.length && offset < indexOffset + this._ctx.measureText(line.charAt(index)).width)
- return index;
-
- // Fallback to non-monospace.
- var delta = indexOffset < offset ? 1 : -1;
- while (index >=0 && index < line.length) {
- index += delta;
- indexOffset += delta * this._ctx.measureText(line.charAt(index)).width;
- if (offset >= indexOffset && offset < indexOffset + charWidth)
- return index;
- }
- return line.length;
- },
-
- _columnToOffset: function(lineNumber, column)
- {
- var line = this._textModel.line(lineNumber);
- return this._ctx.measureText(line.substring(0, column)).width;
- },
-
- _keyDown: function(e)
- {
- var shortcutKey = WebInspector.KeyboardShortcut.makeKeyFromEvent(e);
- var handler = this._shortcuts[shortcutKey];
- if (handler) {
- handler.call(this);
- e.preventDefault();
- e.stopPropagation();
- return;
- }
-
- if (this._handleNavigationKey(e)) {
- e.preventDefault();
- e.stopPropagation();
- return;
- }
-
- if (this._readOnly)
- return;
-
- var keyCodes = WebInspector.KeyboardShortcut.KeyCodes;
- switch (e.keyCode) {
- case keyCodes.Backspace:
- this._handleBackspaceKey();
- break;
- case keyCodes.Delete:
- this._handleDeleteKey();
- break;
- case keyCodes.Tab:
- this._replaceSelectionWith("\t");
- break;
- case keyCodes.Enter:
- this._replaceSelectionWith("\n");
- break;
- default:
- return;
- }
-
- e.preventDefault();
- e.stopPropagation();
- },
-
- _handleNavigationKey: function(e)
- {
- var caretLine = this._selection.endLine;
- var caretColumn = this._selection.endColumn;
- var arrowAction = e.shiftKey ? this._setSelectionEnd : this._setCaretLocation;
-
- var keyCodes = WebInspector.KeyboardShortcut.KeyCodes;
- switch (e.keyCode) {
- case keyCodes.Up:
- case keyCodes.PageUp:
- if (e.metaKey)
- arrowAction.call(this, 0, 0, true);
- else if (e.ctrlKey)
- this._container.scrollTop -= this._lineHeight(caretLine);
- else {
- if (e.keyCode === keyCodes.Up)
- arrowAction.call(this, caretLine - 1, this._desiredCaretColumn, true);
- else {
- var offset = Math.max(0, this._lineToOffset(caretLine) - this._canvas.height);
- arrowAction.call(this, this._offsetToLine(offset), this._desiredCaretColumn, true);
- }
- }
- break;
- case keyCodes.Down:
- case keyCodes.PageDown:
- if (e.metaKey)
- arrowAction.call(this, this._textModel.linesCount - 1, this._textModel.lineLength(this._textModel.linesCount - 1), true);
- else if (e.ctrlKey)
- this._container.scrollTop += this._lineHeight(caretLine);
- else {
- if (e.keyCode === keyCodes.Down)
- arrowAction.call(this, caretLine + 1, this._desiredCaretColumn, true);
- else {
- var offset = this._lineToOffset(caretLine) + this._canvas.height;
- arrowAction.call(this, this._offsetToLine(offset), this._desiredCaretColumn, true);
- }
- }
- break;
- case keyCodes.Home:
- if (this._isMetaCtrl(e))
- arrowAction.call(this, 0, 0, true);
- else
- arrowAction.call(this, this._selection.endLine, 0);
- break;
- case keyCodes.End:
- if (this._isMetaCtrl(e))
- arrowAction.call(this, this._textModel.linesCount - 1, this._textModel.lineLength(this._textModel.linesCount - 1), true);
- else
- arrowAction.call(this, this._selection.endLine, this._textModel.lineLength(this._selection.endLine));
- break;
- case keyCodes.Left:
- if (!e.shiftKey && !e.metaKey && !this._isAltCtrl(e) && !this._selection.isEmpty()) {
- // Reset selection
- var range = this._selection.range();
- this._setCaretLocation(range.startLine, range.startColumn);
- } else if (e.metaKey)
- arrowAction.call(this, this._selection.endLine, 0);
- else if (caretColumn === 0 && caretLine > 0)
- arrowAction.call(this, caretLine - 1, this._textModel.lineLength(caretLine - 1));
- else if (this._isAltCtrl(e)) {
- caretColumn = this._textModel.wordStart(this._selection.endLine, this._selection.endColumn);
- if (caretColumn === this._selection.endColumn)
- caretColumn = 0;
- arrowAction.call(this, caretLine, caretColumn);
- } else
- arrowAction.call(this, caretLine, caretColumn - 1);
- break;
- case keyCodes.Right:
- var line = this._textModel.line(caretLine);
- if (!e.shiftKey && !e.metaKey && !this._isAltCtrl(e) && !this._selection.isEmpty()) {
- // Reset selection
- var range = this._selection.range();
- this._setCaretLocation(range.endLine, range.endColumn);
- } else if (e.metaKey)
- arrowAction.call(this, this._selection.endLine, this._textModel.lineLength(this._selection.endLine));
- else if (caretColumn === line.length && caretLine < this._textModel.linesCount - 1)
- arrowAction.call(this, caretLine + 1, 0);
- else if (this._isAltCtrl(e)) {
- caretColumn = this._textModel.wordEnd(this._selection.endLine, this._selection.endColumn);
- if (caretColumn === this._selection.endColumn)
- caretColumn = line.length;
- arrowAction.call(this, caretLine, caretColumn);
- } else
- arrowAction.call(this, caretLine, caretColumn + 1);
- break;
- default:
- return false;
- }
- this._textModel.markUndoableState();
- return true;
- },
-
- _textInput: function(e)
- {
- if (this._readOnly)
- return;
-
- if (e.data && !e.altKey && !e.ctrlKey && !e.metaKey) {
- this._replaceSelectionWith(e.data);
- e.preventDefault();
- e.stopPropagation();
- }
- },
-
- _setCaretLocation: function(line, column, updown)
- {
- this.setSelection(line, column, line, column, updown);
- },
-
- _setSelectionEnd: function(line, column, updown)
- {
- if (!updown)
- this._desiredCaretColumn = column;
-
- var end = this._fit(line, column);
- this._selection.setEnd(end.line, end.column);
- this.reveal(this._selection.endLine, this._selection.endColumn);
- this._updateCursor(end.line, end.column);
- },
-
- _updateDivDecorations: function()
- {
- var firstLine = this._offsetToLine(this._scrollTop) - 1;
- var lastLine = this._offsetToLine(this._scrollTop + this._canvas.height) + 1;
-
- var linesCount = this._textModel.linesCount;
- for (var i = 0; i < linesCount; ++i) {
- var element = this._textModel.getAttribute(i, "div-decoration");
- if (element) {
- this._lineOffsetsCache.length = Math.min(this._lineOffsetsCache.length, i + 1);
- this._positionDivDecoration(i, element, i > firstLine && i < lastLine);
- }
- }
- },
-
- _positionDivDecoration: function(lineNumber, element, visible)
- {
- element.style.position = "absolute";
- element.style.top = this._lineToOffset(lineNumber) - this._scrollTop + this._textLineHeight + "px";
- element.style.left = this._lineNumberWidth + "px";
- element.style.setProperty("max-width", this._canvas.width + "px");
- },
-
- _updateCursor: function(line, column)
- {
- if (line >= this._textModel.linesCount)
- return;
- var offset = this._columnToOffset(line, column);
- if (offset >= this._container.scrollLeft && !this._readOnly)
- this._cursor.setLocation(this._lineNumberWidth + offset - 1, this._lineToOffset(line));
- else
- this._cursor.hide();
- },
-
- _fit: function(line, column)
- {
- line = Math.max(0, Math.min(line, this._textModel.linesCount - 1));
- var lineLength = this._textModel.lineLength(line);
- column = Math.max(0, Math.min(column, lineLength));
- return { line: line, column: column };
- },
-
- _paintSelection: function(firstLine, lastLine)
- {
- if (this._selection.isEmpty())
- return;
- var range = this._selection.range();
- this._ctx.fillStyle = this._selectionColor;
-
- firstLine = Math.max(firstLine, range.startLine);
- endLine = Math.min(lastLine, range.endLine + 1);
-
- for (var i = firstLine; i < endLine; ++i) {
- var line = this._textModel.line(i);
- var from, to;
-
- if (i === range.startLine) {
- var offset = this._columnToOffset(range.startLine, range.startColumn);
- from = offset - this._scrollLeft + this._lineNumberWidth - 1;
- } else
- from = 0;
-
- if (i === range.endLine) {
- var offset = this._columnToOffset(range.endLine, range.endColumn);
- to = offset - this._scrollLeft + this._lineNumberWidth - 1;
- } else
- to = this._canvas.width;
-
- this._ctx.fillRect(from, this._lineToOffset(i) - this._scrollTop, to - from, this._lineHeight(i));
- }
- this._ctx.fillStyle = "rgb(0, 0, 0)";
- },
-
- _beforeCopy: function(e)
- {
- if (!this._selection.isEmpty())
- e.preventDefault();
- },
-
- _copy: function(e)
- {
- var range = this._selection.range();
- var text = this._textModel.copyRange(range);
-
- function delayCopy()
- {
- InspectorFrontendHost.copyText(text);
- }
-
- setTimeout(delayCopy);
- if (e)
- e.preventDefault();
- },
-
- _beforeCut: function(e)
- {
- if (!this._selection.isEmpty())
- e.preventDefault();
- },
-
- _cut: function(e)
- {
- if (this._readOnly) {
- e.preventDefault();
- return;
- }
-
- this._textModel.markUndoableState();
- this._copy(e);
- this._replaceSelectionWith("");
- },
-
- _beforePaste: function(e)
- {
- e.preventDefault();
- },
-
- _paste: function(e)
- {
- if (this._readOnly) {
- e.preventDefault();
- return;
- }
-
- var text = e.clipboardData.getData("Text");
- if (!text)
- return;
-
- this._textModel.markUndoableState();
- this._replaceSelectionWith(text);
- e.preventDefault();
- },
-
- _replaceSelectionWith: function(newText, overrideRange)
- {
- var range = overrideRange || this._selection.range();
- this.setCoalescingUpdate(true);
- var newRange = this._textModel.setText(range, newText);
- this._setCaretLocation(newRange.endLine, newRange.endColumn);
- this.setCoalescingUpdate(false);
- },
-
- setCoalescingUpdate: function(enabled)
- {
- if (enabled)
- this._paintCoalescingLevel++;
- else
- this._paintCoalescingLevel--;
- if (!this._paintCoalescingLevel)
- this._paint();
- },
-
- _selectAll: function()
- {
- // No need to reveal last selection line in select all.
- this._selection.setStart(0, 0);
- var lastLineNum = this._textModel.linesCount - 1;
- this._selection.setEnd(lastLineNum, this._textModel.lineLength(lastLineNum));
- this._updateCursor(this._selection.endLine, this._selection.endColumn);
- },
-
- initFontMetrics: function()
- {
- var computedStyle = window.getComputedStyle(this.element);
- this._font = computedStyle.fontSize + " " + computedStyle.fontFamily;
- this._ctx.font = this._font;
- this._digitWidth = this._ctx.measureText("0").width;
- this._textLineHeight = Math.floor(parseInt(this._ctx.font) * 1.4);
- this._cursor.setTextLineHeight(this._textLineHeight);
- },
-
- _registerShortcuts: function()
- {
- var modifiers = WebInspector.KeyboardShortcut.Modifiers;
- this._shortcuts = {};
- this._shortcuts[WebInspector.KeyboardShortcut.makeKey("z", this._isMac ? modifiers.Meta : modifiers.Ctrl)] = this._handleUndo.bind(this);
- this._shortcuts[WebInspector.KeyboardShortcut.makeKey("z", modifiers.Shift | (this._isMac ? modifiers.Meta : modifiers.Ctrl))] = this._handleRedo.bind(this);
- this._shortcuts[WebInspector.KeyboardShortcut.makeKey("a", this._isMac ? modifiers.Meta : modifiers.Ctrl)] = this._selectAll.bind(this);
- if (this._isMac)
- this._shortcuts[WebInspector.KeyboardShortcut.makeKey("d", modifiers.Ctrl)] = this._handleDeleteKey.bind(this);
-
- this._shortcuts[WebInspector.KeyboardShortcut.makeKey("d", modifiers.Ctrl | modifiers.Alt)] = this._handleToggleDebugMode.bind(this);
- this._shortcuts[WebInspector.KeyboardShortcut.makeKey("h", modifiers.Ctrl | modifiers.Alt)] = this._handleToggleHighlightMode.bind(this);
- },
-
- _handleUndo: function()
- {
- this.setCoalescingUpdate(true);
- var range = this._textModel.undo();
- if (range)
- this._setCaretLocation(range.endLine, range.endColumn);
- this.setCoalescingUpdate(false);
- },
-
- _handleRedo: function()
- {
- this.setCoalescingUpdate(true);
- var range = this._textModel.redo();
- if (range)
- this._setCaretLocation(range.endLine, range.endColumn);
- this.setCoalescingUpdate(false);
- },
-
- _handleDeleteKey: function()
- {
- var range = this._selection.range();
- if (range.isEmpty()) {
- if (range.endColumn < this._textModel.lineLength(range.startLine))
- range.endColumn++;
- else if (range.endLine < this._textModel.linesCount) {
- range.endLine++;
- range.endColumn = 0;
- } else
- return;
- } else
- this._textModel.markUndoableState();
- this._replaceSelectionWith("", range);
- },
-
- _handleBackspaceKey: function()
- {
- var range = this._selection.range();
- if (range.isEmpty()) {
- if (range.startColumn > 0)
- range.startColumn--;
- else if (range.startLine > 0) {
- range.startLine--;
- range.startColumn = this._textModel.lineLength(range.startLine);
- } else
- return;
- } else
- this._textModel.markUndoableState();
- this._replaceSelectionWith("", range);
- },
-
- _handleToggleDebugMode: function()
- {
- this._debugMode = !this._debugMode;
- },
-
- _handleToggleHighlightMode: function()
- {
- this._highlightingEnabled = !this._highlightingEnabled;
- },
-
- _isMetaCtrl: function(e)
- {
- return this._isMac ? e.metaKey : e.ctrlKey;
- },
-
- _isAltCtrl: function(e)
- {
- return this._isMac ? e.altKey : e.ctrlKey;
- },
-
- _decimalDigits: function(number)
- {
- return Math.ceil(Math.log(number + 1) / Math.log(10));
- }
-}
-
-WebInspector.TextSelectionModel = function(changeListener)
-{
- this.startLine = 0;
- this.startColumn = 0;
- this.endLine = 0;
- this.endColumn = 0;
- this._changeListener = changeListener;
-}
-
-WebInspector.TextSelectionModel.prototype = {
- setStart: function(line, column)
- {
- var oldRange = this.range();
-
- this.startLine = line;
- this.startColumn = column;
- this.endLine = line;
- this.endColumn = column;
-
- this._changeListener(oldRange, this.range());
- },
-
- setEnd: function(line, column)
- {
- var oldRange = this.range();
-
- this.endLine = line;
- this.endColumn = column;
-
- this._changeListener(oldRange, this.range(), this.endLine, this.endColumn);
- },
-
- range: function()
- {
- if (this.startLine < this.endLine || (this.startLine === this.endLine && this.startColumn <= this.endColumn))
- return new WebInspector.TextRange(this.startLine, this.startColumn, this.endLine, this.endColumn);
- else
- return new WebInspector.TextRange(this.endLine, this.endColumn, this.startLine, this.startColumn);
- },
-
- isEmpty: function()
- {
- return this.startLine === this.endLine && this.startColumn === this.endColumn;
- }
-}
-
-WebInspector.TextCursor = function(cursorElement)
-{
- this._visible = false;
- this._cursorElement = cursorElement;
-}
-
-WebInspector.TextCursor.prototype = {
- setLocation: function(x, y)
- {
- this._x = x;
- this._y = y;
- if (this._paintInterval) {
- window.clearInterval(this._paintInterval);
- delete this._paintInterval;
- }
- this._paintInterval = window.setInterval(this._paint.bind(this, false), 500);
- this._paint(true);
- },
-
- hide: function()
- {
- if (this._paintInterval) {
- window.clearInterval(this._paintInterval);
- delete this._paintInterval;
- }
- this._cursorElement.style.display = "none";
- },
-
- setTextLineHeight: function(textLineHeight)
- {
- this._cursorElement.style.height = textLineHeight + "px";
- },
-
- _paint: function(force)
- {
- if (force)
- this._visible = true;
- else
- this._visible = !this._visible;
- this._cursorElement.style.left = this._x + "px";
- this._cursorElement.style.top = this._y + "px";
- this._cursorElement.style.display = this._visible ? "block" : "none";
- }
-}
diff --git a/WebCore/inspector/front-end/TextEditorModel.js b/WebCore/inspector/front-end/TextEditorModel.js
index fc56026..e56c269 100644
--- a/WebCore/inspector/front-end/TextEditorModel.js
+++ b/WebCore/inspector/front-end/TextEditorModel.js
@@ -97,6 +97,11 @@ WebInspector.TextEditorModel.prototype = {
return newRange;
},
+ set replaceTabsWithSpaces(replaceTabsWithSpaces)
+ {
+ this._replaceTabsWithSpaces = replaceTabsWithSpaces;
+ },
+
_innerSetText: function(range, text)
{
this._eraseRange(range);
@@ -104,6 +109,8 @@ WebInspector.TextEditorModel.prototype = {
return new WebInspector.TextRange(range.startLine, range.startColumn, range.startLine, range.startColumn);
var newLines = text.split("\n");
+ this._replaceTabsIfNeeded(newLines);
+
var prefix = this._lines[range.startLine].substring(0, range.startColumn);
var prefixArguments = this._arguments
var suffix = this._lines[range.startLine].substring(range.startColumn);
@@ -124,6 +131,22 @@ WebInspector.TextEditorModel.prototype = {
range.startLine + newLines.length - 1, postCaret);
},
+ _replaceTabsIfNeeded: function(lines)
+ {
+ if (!this._replaceTabsWithSpaces)
+ return;
+ var spaces = [ " ", " ", " ", " "];
+ for (var i = 0; i < lines.length; ++i) {
+ var line = lines[i];
+ var index = line.indexOf("\t");
+ while (index !== -1) {
+ line = line.substring(0, index) + spaces[index % 4] + line.substring(index + 1);
+ index = line.indexOf("\t", index + 1);
+ }
+ lines[i] = line;
+ }
+ },
+
_eraseRange: function(range)
{
if (range.isEmpty())
diff --git a/WebCore/inspector/front-end/TextViewer.js b/WebCore/inspector/front-end/TextViewer.js
new file mode 100644
index 0000000..096464f
--- /dev/null
+++ b/WebCore/inspector/front-end/TextViewer.js
@@ -0,0 +1,666 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.TextViewer = function(textModel, platform, url)
+{
+ this._textModel = textModel;
+ this._textModel.changeListener = this._buildChunks.bind(this);
+ this._highlighter = new WebInspector.TextEditorHighlighter(this._textModel, this._highlightDataReady.bind(this));
+
+ this.element = document.createElement("div");
+ this.element.className = "text-editor monospace";
+ this.element.tabIndex = 0;
+
+ this.element.addEventListener("scroll", this._scroll.bind(this), false);
+
+ this._url = url;
+
+ this._linesContainerElement = document.createElement("table");
+ this._linesContainerElement.className = "text-editor-lines";
+ this._linesContainerElement.setAttribute("cellspacing", 0);
+ this._linesContainerElement.setAttribute("cellpadding", 0);
+ this.element.appendChild(this._linesContainerElement);
+
+ this._defaultChunkSize = 50;
+ this._paintCoalescingLevel = 0;
+}
+
+WebInspector.TextViewer.prototype = {
+ set mimeType(mimeType)
+ {
+ this._highlighter.mimeType = mimeType;
+ },
+
+ get textModel()
+ {
+ return this._textModel;
+ },
+
+ revealLine: function(lineNumber)
+ {
+ if (lineNumber >= this._textModel.linesCount)
+ return;
+
+ var chunk = this._makeLineAChunk(lineNumber);
+ chunk.element.scrollIntoViewIfNeeded();
+ },
+
+ addDecoration: function(lineNumber, decoration)
+ {
+ var chunk = this._makeLineAChunk(lineNumber);
+ chunk.addDecoration(decoration);
+ },
+
+ removeDecoration: function(lineNumber, decoration)
+ {
+ var chunk = this._makeLineAChunk(lineNumber);
+ chunk.removeDecoration(decoration);
+ },
+
+ markAndRevealRange: function(range)
+ {
+ if (this._rangeToMark) {
+ var markedLine = this._rangeToMark.startLine;
+ this._rangeToMark = null;
+ this._paintLines(markedLine, markedLine + 1);
+ }
+
+ if (range) {
+ this._rangeToMark = range;
+ this.revealLine(range.startLine);
+ this._paintLines(range.startLine, range.startLine + 1);
+ }
+ },
+
+ highlightLine: function(lineNumber)
+ {
+ if (typeof this._highlightedLine === "number") {
+ var chunk = this._makeLineAChunk(this._highlightedLine);
+ chunk.removeDecoration("webkit-highlighted-line");
+ }
+ this._highlightedLine = lineNumber;
+ this.revealLine(lineNumber);
+ var chunk = this._makeLineAChunk(lineNumber);
+ chunk.addDecoration("webkit-highlighted-line");
+ },
+
+ _buildChunks: function()
+ {
+ this._linesContainerElement.removeChildren();
+
+ var paintLinesCallback = this._paintLines.bind(this);
+ this._textChunks = [];
+ for (var i = 0; i < this._textModel.linesCount; i += this._defaultChunkSize) {
+ var chunk = new WebInspector.TextChunk(this._textModel, i, i + this._defaultChunkSize, paintLinesCallback);
+ this._textChunks.push(chunk);
+ this._linesContainerElement.appendChild(chunk.element);
+ }
+ this._indexChunks();
+ this._repaintAll();
+ },
+
+ _makeLineAChunk: function(lineNumber)
+ {
+ if (!this._textChunks)
+ this._buildChunks();
+
+ var chunkNumber = this._chunkNumberForLine(lineNumber);
+ var oldChunk = this._textChunks[chunkNumber];
+ if (oldChunk.linesCount === 1)
+ return oldChunk;
+
+ var wasExpanded = oldChunk.expanded;
+ oldChunk.expanded = false;
+
+ var insertIndex = oldChunk.chunkNumber + 1;
+ var paintLinesCallback = this._paintLines.bind(this);
+
+ // Prefix chunk.
+ if (lineNumber > oldChunk.startLine) {
+ var prefixChunk = new WebInspector.TextChunk(this._textModel, oldChunk.startLine, lineNumber, paintLinesCallback);
+ this._textChunks.splice(insertIndex++, 0, prefixChunk);
+ this._linesContainerElement.insertBefore(prefixChunk.element, oldChunk.element);
+ }
+
+ // Line chunk.
+ var lineChunk = new WebInspector.TextChunk(this._textModel, lineNumber, lineNumber + 1, paintLinesCallback);
+ this._textChunks.splice(insertIndex++, 0, lineChunk);
+ this._linesContainerElement.insertBefore(lineChunk.element, oldChunk.element);
+
+ // Suffix chunk.
+ if (oldChunk.startLine + oldChunk.linesCount > lineNumber + 1) {
+ var suffixChunk = new WebInspector.TextChunk(this._textModel, lineNumber + 1, oldChunk.startLine + oldChunk.linesCount, paintLinesCallback);
+ this._textChunks.splice(insertIndex, 0, suffixChunk);
+ this._linesContainerElement.insertBefore(suffixChunk.element, oldChunk.element);
+ }
+
+ // Remove enclosing chunk.
+ this._textChunks.splice(oldChunk.chunkNumber, 1);
+ this._linesContainerElement.removeChild(oldChunk.element);
+ this._indexChunks();
+
+ if (wasExpanded) {
+ if (prefixChunk)
+ prefixChunk.expanded = true;
+ lineChunk.expanded = true;
+ if (suffixChunk)
+ suffixChunk.expanded = true;
+ }
+
+ return lineChunk;
+ },
+
+ _indexChunks: function()
+ {
+ for (var i = 0; i < this._textChunks.length; ++i)
+ this._textChunks[i].chunkNumber = i;
+ },
+
+ _scroll: function()
+ {
+ this._repaintAll();
+ },
+
+ beginUpdates: function(enabled)
+ {
+ this._paintCoalescingLevel++;
+ },
+
+ endUpdates: function(enabled)
+ {
+ this._paintCoalescingLevel--;
+ if (!this._paintCoalescingLevel)
+ this._repaintAll();
+ },
+
+ _chunkForOffset: function(offset)
+ {
+ var currentOffset = 0;
+ var row = this._linesContainerElement.firstChild;
+ while (row) {
+ var rowHeight = row.offsetHeight;
+ if (offset >= currentOffset && offset < currentOffset + rowHeight)
+ return row.chunkNumber;
+ row = row.nextSibling;
+ currentOffset += rowHeight;
+ }
+ return this._textChunks.length - 1;
+ },
+
+ _chunkNumberForLine: function(lineNumber)
+ {
+ for (var i = 0; i < this._textChunks.length; ++i) {
+ var line = this._textChunks[i].startLine;
+ if (lineNumber >= this._textChunks[i].startLine && lineNumber < this._textChunks[i].startLine + this._textChunks[i].linesCount)
+ return i;
+ }
+ return this._textChunks.length - 1;
+ },
+
+ _chunkForLine: function(lineNumber)
+ {
+ return this._textChunks[this._chunkNumberForLine(lineNumber)];
+ },
+
+ _chunkStartLine: function(chunkNumber)
+ {
+ var lineNumber = 0;
+ for (var i = 0; i < chunkNumber && i < this._textChunks.length; ++i)
+ lineNumber += this._textChunks[i].linesCount;
+ return lineNumber;
+ },
+
+ _repaintAll: function()
+ {
+ if (this._paintCoalescingLevel)
+ return;
+
+ if (!this._textChunks)
+ this._buildChunks();
+
+ var visibleFrom = this.element.scrollTop;
+ var visibleTo = this.element.scrollTop + this.element.clientHeight;
+
+ var offset = 0;
+ var firstVisibleLine = -1;
+ var lastVisibleLine = 0;
+ var toExpand = [];
+ var toCollapse = [];
+ for (var i = 0; i < this._textChunks.length; ++i) {
+ var chunk = this._textChunks[i];
+ var chunkHeight = chunk.height;
+ if (offset + chunkHeight > visibleFrom && offset < visibleTo) {
+ toExpand.push(chunk);
+ if (firstVisibleLine === -1)
+ firstVisibleLine = chunk.startLine;
+ lastVisibleLine = chunk.startLine + chunk.linesCount;
+ } else {
+ toCollapse.push(chunk);
+ if (offset >= visibleTo)
+ break;
+ }
+ offset += chunkHeight;
+ }
+
+ for (var j = i; j < this._textChunks.length; ++j)
+ toCollapse.push(this._textChunks[i]);
+
+ var selection = this._getSelection();
+
+ this._muteHighlightListener = true;
+ this._highlighter.highlight(lastVisibleLine);
+ delete this._muteHighlightListener;
+
+ for (var i = 0; i < toCollapse.length; ++i)
+ toCollapse[i].expanded = false;
+ for (var i = 0; i < toExpand.length; ++i)
+ toExpand[i].expanded = true;
+
+ this._restoreSelection(selection);
+ },
+
+ _highlightDataReady: function(fromLine, toLine)
+ {
+ if (this._muteHighlightListener)
+ return;
+
+ var selection;
+ for (var i = fromLine; i < toLine; ++i) {
+ var lineRow = this._textModel.getAttribute(i, "line-row");
+ if (!lineRow || lineRow.highlighted)
+ continue;
+ if (!selection)
+ selection = this._getSelection();
+ this._paintLine(lineRow, i);
+ }
+ this._restoreSelection(selection);
+ },
+
+ _paintLines: function(fromLine, toLine)
+ {
+ for (var i = fromLine; i < toLine; ++i) {
+ var lineRow = this._textModel.getAttribute(i, "line-row");
+ if (lineRow)
+ this._paintLine(lineRow, i);
+ }
+ },
+
+ _paintLine: function(lineRow, lineNumber)
+ {
+ var element = lineRow.lastChild;
+ var highlighterState = this._textModel.getAttribute(lineNumber, "highlighter-state");
+ var line = this._textModel.line(lineNumber);
+
+ if (!highlighterState) {
+ if (this._rangeToMark && this._rangeToMark.startLine === lineNumber)
+ this._markRange(element, line, this._rangeToMark.startColumn, this._rangeToMark.endColumn);
+ return;
+ }
+
+ element.removeChildren();
+
+ var plainTextStart = -1;
+ for (var j = 0; j < line.length;) {
+ if (j > 1000) {
+ // This line is too long - do not waste cycles on minified js highlighting.
+ break;
+ }
+ var attribute = highlighterState && highlighterState.attributes[j];
+ if (!attribute || !attribute.style) {
+ if (plainTextStart === -1)
+ plainTextStart = j;
+ j++;
+ } else {
+ if (plainTextStart !== -1) {
+ element.appendChild(document.createTextNode(line.substring(plainTextStart, j)));
+ plainTextStart = -1;
+ }
+ element.appendChild(this._createSpan(line.substring(j, j + attribute.length), attribute.tokenType));
+ j += attribute.length;
+ }
+ }
+ if (plainTextStart !== -1)
+ element.appendChild(document.createTextNode(line.substring(plainTextStart, line.length)));
+ if (this._rangeToMark && this._rangeToMark.startLine === lineNumber)
+ this._markRange(element, line, this._rangeToMark.startColumn, this._rangeToMark.endColumn);
+ if (lineRow.decorationsElement)
+ element.appendChild(lineRow.decorationsElement);
+ },
+
+ _getSelection: function()
+ {
+ var selection = window.getSelection();
+ if (selection.isCollapsed)
+ return null;
+ var selectionRange = selection.getRangeAt(0);
+ var start = this._selectionToPosition(selectionRange.startContainer, selectionRange.startOffset);
+ var end = this._selectionToPosition(selectionRange.endContainer, selectionRange.endOffset);
+ return new WebInspector.TextRange(start.line, start.column, end.line, end.column);
+ },
+
+ _restoreSelection: function(range)
+ {
+ if (!range)
+ return;
+ var startRow = this._textModel.getAttribute(range.startLine, "line-row");
+ if (startRow)
+ var start = startRow.lastChild.rangeBoundaryForOffset(range.startColumn);
+ else {
+ var offset = range.startColumn;
+ var chunkNumber = this._chunkNumberForLine(range.startLine);
+ for (var i = this._chunkStartLine(chunkNumber); i < range.startLine; ++i)
+ offset += this._textModel.line(i).length + 1; // \n
+ var lineCell = this._textChunks[chunkNumber].element.lastChild;
+ if (lineCell.firstChild)
+ var start = { container: lineCell.firstChild, offset: offset };
+ else
+ var start = { container: lineCell, offset: 0 };
+ }
+
+ var endRow = this._textModel.getAttribute(range.endLine, "line-row");
+ if (endRow)
+ var end = endRow.lastChild.rangeBoundaryForOffset(range.endColumn);
+ else {
+ var offset = range.endColumn;
+ var chunkNumber = this._chunkNumberForLine(range.endLine);
+ for (var i = this._chunkStartLine(chunkNumber); i < range.endLine; ++i)
+ offset += this._textModel.line(i).length + 1; // \n
+ var lineCell = this._textChunks[chunkNumber].element.lastChild;
+ if (lineCell.firstChild)
+ var end = { container: lineCell.firstChild, offset: offset };
+ else
+ var end = { container: lineCell, offset: 0 };
+ }
+
+ var selectionRange = document.createRange();
+ selectionRange.setStart(start.container, start.offset);
+ selectionRange.setEnd(end.container, end.offset);
+
+ var selection = window.getSelection();
+ selection.removeAllRanges();
+ selection.addRange(selectionRange);
+ },
+
+ _selectionToPosition: function(container, offset)
+ {
+ if (container === this.element && offset === 0)
+ return { line: 0, column: 0 };
+ if (container === this.element && offset === 1)
+ return { line: this._textModel.linesCount - 1, column: this._textModel.lineLength(this._textModel.linesCount - 1) };
+
+ var lineRow = container.enclosingNodeOrSelfWithNodeName("tr");
+ var lineNumber = lineRow.lineNumber;
+ if (container.nodeName === "TD" && offset === 0)
+ return { line: lineNumber, column: 0 };
+ if (container.nodeName === "TD" && offset === 1)
+ return { line: lineNumber, column: this._textModel.lineLength(lineNumber) };
+
+ var column = 0;
+ if (lineRow.chunk) {
+ // This is chunk.
+ var text = lineRow.lastChild.textContent;
+ for (var i = 0; i < offset; ++i) {
+ if (text.charAt(i) === "\n") {
+ lineNumber++;
+ column = 0;
+ } else
+ column++;
+ }
+ return { line: lineNumber, column: column };
+ }
+
+ // This is individul line.
+ var column = 0;
+ var node = lineRow.lastChild.traverseNextTextNode(lineRow.lastChild);
+ while (node && node !== container) {
+ column += node.textContent.length;
+ node = node.traverseNextTextNode(lineRow.lastChild);
+ }
+ column += offset;
+ return { line: lineRow.lineNumber, column: column };
+ },
+
+ _createSpan: function(content, className)
+ {
+ if (className === "html-resource-link" || className === "html-external-link")
+ return this._createLink(content, className === "html-external-link");
+
+ var span = document.createElement("span");
+ span.className = "webkit-" + className;
+ span.appendChild(document.createTextNode(content));
+ return span;
+ },
+
+ _createLink: function(content, isExternal)
+ {
+ var quote = content.charAt(0);
+ if (content.length > 1 && (quote === "\"" || quote === "'"))
+ content = content.substring(1, content.length - 1);
+ else
+ quote = null;
+
+ var a = WebInspector.linkifyURLAsNode(this._rewriteHref(content), content, null, isExternal);
+ var span = document.createElement("span");
+ span.className = "webkit-html-attribute-value";
+ if (quote)
+ span.appendChild(document.createTextNode(quote));
+ span.appendChild(a);
+ if (quote)
+ span.appendChild(document.createTextNode(quote));
+ return span;
+ },
+
+ _rewriteHref: function(hrefValue, isExternal)
+ {
+ if (!this._url || !hrefValue || hrefValue.indexOf("://") > 0)
+ return hrefValue;
+ return WebInspector.completeURL(this._url, hrefValue);
+ },
+
+ _markRange: function(element, lineText, startOffset, endOffset)
+ {
+ var markNode = document.createElement("span");
+ markNode.className = "webkit-markup";
+ markNode.textContent = lineText.substring(startOffset, endOffset);
+
+ var markLength = endOffset - startOffset;
+ var boundary = element.rangeBoundaryForOffset(startOffset);
+ var textNode = boundary.container;
+ var text = textNode.textContent;
+
+ if (boundary.offset + markLength < text.length) {
+ // Selection belong to a single split mode.
+ textNode.textContent = text.substring(boundary.offset + markLength);
+ textNode.parentElement.insertBefore(markNode, textNode);
+ var prefixNode = document.createTextNode(text.substring(0, boundary.offset));
+ textNode.parentElement.insertBefore(prefixNode, markNode);
+ return;
+ }
+
+ var parentElement = textNode.parentElement;
+ var anchorElement = textNode.nextSibling;
+
+ markLength -= text.length - boundary.offset;
+ textNode.textContent = text.substring(0, boundary.offset);
+ textNode = textNode.traverseNextTextNode(element);
+
+ while (textNode) {
+ var text = textNode.textContent;
+ if (markLength < text.length) {
+ textNode.textContent = text.substring(markLength);
+ break;
+ }
+
+ markLength -= text.length;
+ textNode.textContent = "";
+ textNode = textNode.traverseNextTextNode(element);
+ }
+
+ parentElement.insertBefore(markNode, anchorElement);
+ },
+
+ resize: function()
+ {
+ this._repaintAll();
+ }
+}
+
+WebInspector.TextChunk = function(textModel, startLine, endLine, paintLinesCallback)
+{
+ this.element = document.createElement("tr");
+ this._textModel = textModel;
+ this.element.chunk = this;
+ this.element.lineNumber = startLine;
+
+ this.startLine = startLine;
+ endLine = Math.min(this._textModel.linesCount, endLine);
+ this.linesCount = endLine - startLine;
+
+ this._lineNumberElement = document.createElement("td");
+ this._lineNumberElement.className = "webkit-line-number";
+ this._lineNumberElement.textContent = this._lineNumberText(this.startLine);
+ this.element.appendChild(this._lineNumberElement);
+
+ this._lineContentElement = document.createElement("td");
+ this._lineContentElement.className = "webkit-line-content";
+ this.element.appendChild(this._lineContentElement);
+
+ this._expanded = false;
+
+ var lines = [];
+ for (var i = this.startLine; i < this.startLine + this.linesCount; ++i)
+ lines.push(this._textModel.line(i));
+ this._lineContentElement.textContent = lines.join("\n");
+ this._paintLines = paintLinesCallback;
+}
+
+WebInspector.TextChunk.prototype = {
+ addDecoration: function(decoration)
+ {
+ if (typeof decoration === "string") {
+ this.element.addStyleClass(decoration);
+ return;
+ }
+ if (!this.element.decorationsElement) {
+ this.element.decorationsElement = document.createElement("div");
+ this._lineContentElement.appendChild(this.element.decorationsElement);
+ }
+ this.element.decorationsElement.appendChild(decoration);
+ },
+
+ removeDecoration: function(decoration)
+ {
+ if (typeof decoration === "string") {
+ this.element.removeStyleClass(decoration);
+ return;
+ }
+ if (!this.element.decorationsElement)
+ return;
+ this.element.decorationsElement.removeChild(decoration);
+ },
+
+ get expanded()
+ {
+ return this._expanded;
+ },
+
+ set expanded(expanded)
+ {
+ if (this._expanded === expanded)
+ return;
+
+ this._expanded = expanded;
+
+ if (this.linesCount === 1) {
+ this._textModel.setAttribute(this.startLine, "line-row", this.element);
+ if (expanded)
+ this._paintLines(this.startLine, this.startLine + 1);
+ return;
+ }
+
+ if (expanded) {
+ var parentElement = this.element.parentElement;
+ for (var i = this.startLine; i < this.startLine + this.linesCount; ++i) {
+ var lineRow = document.createElement("tr");
+ lineRow.lineNumber = i;
+
+ var lineNumberElement = document.createElement("td");
+ lineNumberElement.className = "webkit-line-number";
+ lineNumberElement.textContent = this._lineNumberText(i);
+ lineRow.appendChild(lineNumberElement);
+
+ var lineContentElement = document.createElement("td");
+ lineContentElement.className = "webkit-line-content";
+ lineContentElement.textContent = this._textModel.line(i);
+ lineRow.appendChild(lineContentElement);
+
+ this._textModel.setAttribute(i, "line-row", lineRow);
+ parentElement.insertBefore(lineRow, this.element);
+ }
+ parentElement.removeChild(this.element);
+
+ this._paintLines(this.startLine, this.startLine + this.linesCount);
+ } else {
+ var firstLine = this._textModel.getAttribute(this.startLine, "line-row");
+ var parentElement = firstLine.parentElement;
+
+ parentElement.insertBefore(this.element, firstLine);
+ for (var i = this.startLine; i < this.startLine + this.linesCount; ++i) {
+ var lineRow = this._textModel.getAttribute(i, "line-row");
+ this._textModel.removeAttribute(i, "line-row");
+ parentElement.removeChild(lineRow);
+ }
+ }
+ },
+
+ get height()
+ {
+ if (!this._expanded)
+ return this.element.offsetHeight;
+ var result = 0;
+ for (var i = this.startLine; i < this.startLine + this.linesCount; ++i) {
+ var lineRow = this._textModel.getAttribute(i, "line-row");
+ result += lineRow.offsetHeight;
+ }
+ return result;
+ },
+
+ _lineNumberText: function(lineNumber)
+ {
+ var totalDigits = Math.ceil(Math.log(this._textModel.linesCount + 1) / Math.log(10));
+ var digits = Math.ceil(Math.log(lineNumber + 2) / Math.log(10));
+
+ var text = "";
+ for (var i = digits; i < totalDigits; ++i)
+ text += " ";
+ text += lineNumber + 1;
+ return text;
+ }
+}
diff --git a/WebCore/inspector/front-end/WebKit.qrc b/WebCore/inspector/front-end/WebKit.qrc
index 20e9aa2..efa2bfc 100644
--- a/WebCore/inspector/front-end/WebKit.qrc
+++ b/WebCore/inspector/front-end/WebKit.qrc
@@ -2,8 +2,10 @@
<qresource prefix="/webkit/inspector">
<file>inspector.html</file>
<file>AbstractTimelinePanel.js</file>
+ <file>AuditCategories.js</file>
<file>AuditLauncherView.js</file>
<file>AuditResultView.js</file>
+ <file>AuditRules.js</file>
<file>AuditsPanel.js</file>
<file>BottomUpProfileDataGridTree.js</file>
<file>Breakpoint.js</file>
@@ -37,7 +39,6 @@
<file>InspectorFrontendHostStub.js</file>
<file>KeyboardShortcut.js</file>
<file>MetricsSidebarPane.js</file>
- <file>NativeTextViewer.js</file>
<file>Object.js</file>
<file>ObjectPropertiesSection.js</file>
<file>ObjectProxy.js</file>
@@ -73,10 +74,10 @@
<file>StylesSidebarPane.js</file>
<file>SummaryBar.js</file>
<file>TestController.js</file>
- <file>TextEditor.js</file>
<file>TextEditorHighlighter.js</file>
<file>TextEditorModel.js</file>
<file>TextPrompt.js</file>
+ <file>TextViewer.js</file>
<file>TimelineAgent.js</file>
<file>TimelineGrid.js</file>
<file>TimelineOverviewPane.js</file>
@@ -90,7 +91,7 @@
<file>audits.css</file>
<file>inspector.css</file>
<file>inspectorSyntaxHighlight.css</file>
- <file>textEditor.css</file>
+ <file>textViewer.css</file>
<file>Images/back.png</file>
<file>Images/checker.png</file>
<file>Images/clearConsoleButtonGlyph.png</file>
diff --git a/WebCore/inspector/front-end/audits.css b/WebCore/inspector/front-end/audits.css
index 35db76b..9d02c80 100644
--- a/WebCore/inspector/front-end/audits.css
+++ b/WebCore/inspector/front-end/audits.css
@@ -262,11 +262,11 @@ body.inactive .audit-launcher-view button, .audit-launcher-view button:disabled
margin: 0 5px 5px 0;
}
-.audit-launcher-view input[type="radio"]:active {
+.audit-launcher-view input[type="radio"]:active:not(:disabled) {
background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(194, 194, 194)), to(rgb(239, 239, 239)));
}
-.audit-launcher-view input[type="radio"]:checked {
+.audit-launcher-view input[type="radio"]:checked:not(:disabled), .audit-launcher-view input[type="radio"]:checked:disabled {
background: url(Images/radioDot.png) center no-repeat,
-webkit-gradient(linear, left top, left bottom, from(rgb(252, 252, 252)), to(rgb(223, 223, 223)));
}
diff --git a/WebCore/inspector/front-end/inspector.css b/WebCore/inspector/front-end/inspector.css
index 45b8ec3..53f1e4b 100644
--- a/WebCore/inspector/front-end/inspector.css
+++ b/WebCore/inspector/front-end/inspector.css
@@ -3772,7 +3772,7 @@ ol.breakpoint-list {
white-space: pre;
}
-.source-breakpoint-condition {
+.source-frame-breakpoint-condition {
z-index: 30;
padding: 4px;
background-color: rgb(203, 226, 255);
@@ -3781,7 +3781,7 @@ ol.breakpoint-list {
width: 90%;
}
-.source-breakpoint-message {
+.source-frame-breakpoint-message {
background-color: transparent;
font-family: Lucida Grande, sans-serif;
font-weight: normal;
@@ -3793,7 +3793,7 @@ ol.breakpoint-list {
margin: 0 0 2px 0;
}
-#source-breakpoint-condition {
+#source-frame-breakpoint-condition {
margin: 0;
border: 1px inset rgb(190, 190, 190) !important;
width: 100%;
diff --git a/WebCore/inspector/front-end/inspector.html b/WebCore/inspector/front-end/inspector.html
index 26264dc..4ddd10e 100644
--- a/WebCore/inspector/front-end/inspector.html
+++ b/WebCore/inspector/front-end/inspector.html
@@ -30,7 +30,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="audits.css">
- <link rel="stylesheet" type="text/css" href="textEditor.css">
+ <link rel="stylesheet" type="text/css" href="textViewer.css">
<link rel="stylesheet" type="text/css" href="inspector.css">
<link rel="stylesheet" type="text/css" href="inspectorSyntaxHighlight.css">
<script type="text/javascript" src="utilities.js"></script>
@@ -91,13 +91,14 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<script type="text/javascript" src="AuditsPanel.js"></script>
<script type="text/javascript" src="AuditResultView.js"></script>
<script type="text/javascript" src="AuditLauncherView.js"></script>
+ <script type="text/javascript" src="AuditRules.js"></script>
+ <script type="text/javascript" src="AuditCategories.js"></script>
<script type="text/javascript" src="ResourceView.js"></script>
<script type="text/javascript" src="SourceFrame.js"></script>
<script type="text/javascript" src="DOMSyntaxHighlighter.js"></script>
<script type="text/javascript" src="TextEditorModel.js"></script>
- <script type="text/javascript" src="TextEditor.js"></script>
<script type="text/javascript" src="TextEditorHighlighter.js"></script>
- <script type="text/javascript" src="NativeTextViewer.js"></script>
+ <script type="text/javascript" src="TextViewer.js"></script>
<script type="text/javascript" src="SourceTokenizer.js"></script>
<script type="text/javascript" src="SourceCSSTokenizer.js"></script>
<script type="text/javascript" src="SourceHTMLTokenizer.js"></script>
diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js
index de20739..77d3f42 100644
--- a/WebCore/inspector/front-end/inspector.js
+++ b/WebCore/inspector/front-end/inspector.js
@@ -468,17 +468,8 @@ WebInspector.loaded = function()
var previousToolbarItem = toolbarElement.children[0];
this.panelOrder = [];
- for (var panelName in this.panels) {
- var panel = this.panels[panelName];
- var panelToolbarItem = panel.toolbarItem;
- this.panelOrder.push(panel);
- panelToolbarItem.addEventListener("click", this._toolbarItemClicked.bind(this));
- if (previousToolbarItem)
- toolbarElement.insertBefore(panelToolbarItem, previousToolbarItem.nextSibling);
- else
- toolbarElement.insertBefore(panelToolbarItem, toolbarElement.firstChild);
- previousToolbarItem = panelToolbarItem;
- }
+ for (var panelName in this.panels)
+ previousToolbarItem = WebInspector.addPanelToolbarIcon(toolbarElement, this.panels[panelName], previousToolbarItem);
this.Tips = {
ResourceNotCompressed: {id: 0, message: WebInspector.UIString("You could save bandwidth by having your web server compress this transfer with gzip or zlib.")}
@@ -529,6 +520,18 @@ WebInspector.loaded = function()
InspectorFrontendHost.loaded();
}
+WebInspector.addPanelToolbarIcon = function(toolbarElement, panel, previousToolbarItem)
+{
+ var panelToolbarItem = panel.toolbarItem;
+ this.panelOrder.push(panel);
+ panelToolbarItem.addEventListener("click", this._toolbarItemClicked.bind(this));
+ if (previousToolbarItem)
+ toolbarElement.insertBefore(panelToolbarItem, previousToolbarItem.nextSibling);
+ else
+ toolbarElement.insertBefore(panelToolbarItem, toolbarElement.firstChild);
+ return panelToolbarItem;
+}
+
var windowLoaded = function()
{
var localizedStringsURL = InspectorFrontendHost.localizedStringsURL();
@@ -749,8 +752,11 @@ WebInspector.documentKeyDown = function(event)
var shouldShowAuditsPanel = event.ctrlKey && !event.shiftKey && !event.metaKey && event.altKey;
if (shouldShowAuditsPanel) {
- if (!this.panels.audits)
+ if (!this.panels.audits) {
this.panels.audits = new WebInspector.AuditsPanel();
+ var toolbarElement = document.getElementById("toolbar");
+ WebInspector.addPanelToolbarIcon(toolbarElement, this.panels.audits, this.panels.console.toolbarItem);
+ }
this.currentPanel = this.panels.audits;
}
@@ -1050,7 +1056,7 @@ WebInspector.updateResource = function(identifier, payload)
if (match) {
var protocol = match[1].toLowerCase();
if (protocol.indexOf("http") === 0 || protocol === "file")
- this.addCookieDomain(protocol === "file" ? "" : match[2]);
+ this._addCookieDomain(protocol === "file" ? "" : match[2]);
}
}
@@ -1131,7 +1137,7 @@ WebInspector.addDatabase = function(payload)
this.panels.storage.addDatabase(database);
}
-WebInspector.addCookieDomain = function(domain)
+WebInspector._addCookieDomain = function(domain)
{
// Eliminate duplicate domains from the list.
if (domain in this.cookieDomains)
@@ -1208,7 +1214,6 @@ WebInspector.failedToParseScriptSource = function(sourceURL, source, startingLin
WebInspector.pausedScript = function(callFrames)
{
- callFrames = JSON.parse(callFrames);
this.panels.scripts.debuggerPaused(callFrames);
}
@@ -1265,7 +1270,7 @@ WebInspector.updateConsoleMessageExpiredCount = function(count)
WebInspector.console.addMessage(new WebInspector.ConsoleTextMessage(message, WebInspector.ConsoleMessage.MessageLevel.Warning));
}
-WebInspector.addConsoleMessage = function(payload, argumentsStringified, opt_args)
+WebInspector.addConsoleMessage = function(payload, opt_args)
{
var consoleMessage = new WebInspector.ConsoleMessage(
payload.source,
@@ -1275,14 +1280,7 @@ WebInspector.addConsoleMessage = function(payload, argumentsStringified, opt_arg
payload.url,
payload.groupLevel,
payload.repeatCount);
- var parsedArguments = [];
- for (var i = 2; i < arguments.length; i++) {
- if (argumentsStringified)
- parsedArguments.push(JSON.parse(arguments[i]));
- else
- parsedArguments.push(arguments[i]);
- }
- consoleMessage.setMessageBody(parsedArguments);
+ consoleMessage.setMessageBody(Array.prototype.slice.call(arguments, 1));
this.console.addMessage(consoleMessage);
}
diff --git a/WebCore/inspector/front-end/textEditor.css b/WebCore/inspector/front-end/textEditor.css
deleted file mode 100644
index 93495f2..0000000
--- a/WebCore/inspector/front-end/textEditor.css
+++ /dev/null
@@ -1,90 +0,0 @@
-.text-editor {
- position: absolute;
- top:0;
- left:0;
- right:0;
- bottom:0;
- -webkit-user-select: text;
- -webkit-user-modify: read-write-plaintext-only;
-}
-
-.text-editor-readonly {
- -webkit-user-modify: read-only;
-}
-
-.text-editor-canvas {
- position: absolute;
- top:0;
- left:0;
- right:0;
- bottom:0;
- z-index: 10;
- pointer-events: none;
-}
-
-.text-editor-container {
- position: absolute;
- top:0;
- left:0;
- right:0;
- bottom:0;
- overflow: auto;
-}
-
-.text-editor-cursor {
- -webkit-user-select: none;
- -webkit-user-modify: none;
- position: absolute;
- top:0;
- left:0;
- width:1px;
- height: 14px;
- z-index: 20;
- background-color: black;
- pointer-events: none;
-}
-
-.native-text-editor-line {
- white-space: pre;
-}
-
-.webkit-html-message-bubble {
- -webkit-box-shadow: black 0px 2px 5px;
- -webkit-border-radius: 9px;
- -webkit-border-fit: lines;
- font-size: 10px;
- font-family: Lucida Grande, sans-serif;
- font-weight: bold;
- margin: 6px 25px;
- padding: 0 7px 1px;
- z-index:20;
-}
-
-.webkit-html-warning-message {
- background-color: rgb(100%, 62%, 42%);
- border: 2px solid rgb(100%, 52%, 21%);
-}
-
-.webkit-html-error-message {
- background-color: rgb(100%, 42%, 42%);
- border: 2px solid rgb(100%, 31%, 31%);
-}
-
-.webkit-html-message-line {
- padding-left: 23px;
- text-indent: -20px;
-}
-
-.webkit-html-message-line-hover {
- padding-left: 23px;
- text-indent: -20px;
- white-space: auto;
- text-overflow: auto;
- overflow: auto;
-}
-
-.webkit-html-message-icon {
- position: relative;
- top: 2px;
- margin: 0 4px;
-}
diff --git a/WebCore/inspector/front-end/textViewer.css b/WebCore/inspector/front-end/textViewer.css
new file mode 100644
index 0000000..af079bc
--- /dev/null
+++ b/WebCore/inspector/front-end/textViewer.css
@@ -0,0 +1,149 @@
+.text-editor {
+ position: absolute;
+ top:0;
+ left:0;
+ right:0;
+ bottom:0;
+ white-space: pre-wrap;
+ overflow: auto;
+}
+
+.text-editor-lines {
+ border: 0;
+ width: 100%;
+ vertical-align: baseline;
+ -webkit-border-horizontal-spacing: 0;
+ -webkit-border-vertical-spacing: 0;
+ -webkit-user-select: text;
+}
+
+.webkit-html-message-bubble {
+ -webkit-box-shadow: black 0px 2px 5px;
+ -webkit-border-radius: 9px;
+ -webkit-border-fit: lines;
+ font-size: 10px;
+ font-family: Lucida Grande, sans-serif;
+ font-weight: bold;
+ margin: 6px 25px;
+ padding: 0 7px 1px;
+ z-index:20;
+ max-width: 80%;
+
+}
+
+.webkit-html-warning-message {
+ background-color: rgb(100%, 62%, 42%);
+ border: 2px solid rgb(100%, 52%, 21%);
+}
+
+.webkit-html-error-message {
+ background-color: rgb(100%, 42%, 42%);
+ border: 2px solid rgb(100%, 31%, 31%);
+}
+
+.webkit-html-message-line {
+ padding-left: 23px;
+ text-indent: -20px;
+}
+
+.webkit-html-message-line-hover {
+ padding-left: 23px;
+ text-indent: -20px;
+ white-space: auto;
+ text-overflow: auto;
+ overflow: auto;
+}
+
+.webkit-html-message-icon {
+ position: relative;
+ top: 2px;
+ margin: 0 4px;
+}
+
+.webkit-line-number {
+ color: rgb(128, 128, 128);
+ text-align: right;
+ white-space: pre;
+ word-break: normal;
+ -webkit-user-select: none;
+ background-color: rgb(240, 240, 240);
+ border-right: 1px solid rgb(187, 187, 187) !important;
+ padding-left: 2px;
+ padding-right: 2px;
+ vertical-align: top;
+ background-repeat: no-repeat;
+ background-position: right 1px;
+}
+
+.webkit-line-content {
+ white-space: pre-wrap;
+ padding-left: 2px;
+}
+
+.webkit-execution-line .webkit-line-number {
+ color: transparent;
+ background-image: -webkit-canvas(program-counter);
+}
+
+.webkit-breakpoint .webkit-line-number {
+ color: white;
+ background-image: -webkit-canvas(breakpoint);
+}
+
+.webkit-breakpoint-disabled .webkit-line-number {
+ color: white;
+ background-image: -webkit-canvas(breakpoint-disabled);
+}
+
+.webkit-breakpoint.webkit-execution-line .webkit-line-number {
+ color: transparent;
+ background-image: -webkit-canvas(breakpoint-program-counter);
+}
+
+.webkit-breakpoint-disabled.webkit-execution-line .webkit-line-number {
+ color: transparent;
+ background-image: -webkit-canvas(breakpoint-disabled-program-counter);
+}
+
+.webkit-breakpoint.webkit-breakpoint-conditional .webkit-line-number {
+ color: white;
+ background-image: -webkit-canvas(breakpoint-conditional);
+}
+
+.webkit-breakpoint-disabled.webkit-breakpoint-conditional .webkit-line-number {
+ color: white;
+ background-image: -webkit-canvas(breakpoint-disabled-conditional);
+}
+
+.webkit-breakpoint.webkit-breakpoint-conditional.webkit-execution-line .webkit-line-number {
+ color: transparent;
+ background-image: -webkit-canvas(breakpoint-conditional-program-counter);
+}
+
+.webkit-breakpoint-disabled.webkit-breakpoint-conditional.webkit-execution-line .webkit-line-number {
+ color: transparent;
+ background-image: -webkit-canvas(breakpoint-disabled-conditional-program-counter);
+}
+
+.webkit-execution-line .webkit-line-content {
+ background-color: rgb(171, 191, 254);
+ outline: 1px solid rgb(64, 115, 244);
+}
+
+.webkit-markup {
+ -webkit-border-radius: 4px;
+ padding: 2px 1px 2px 3px;
+ margin-left: -4px;
+ margin-top: -2px;
+ -webkit-box-shadow: rgba(0, 0, 0, .5) 3px 3px 4px;
+ background-color: rgb(241, 234, 0);
+}
+
+.webkit-highlighted-line .webkit-line-content {
+ -webkit-animation: "fadeout" 2s 0s;
+}
+
+@-webkit-keyframes fadeout {
+ from {background-color: rgb(255, 255, 120); }
+ to { background-color: white; }
+}
diff --git a/WebCore/inspector/front-end/utilities.js b/WebCore/inspector/front-end/utilities.js
index d54005a..60d3b45 100644
--- a/WebCore/inspector/front-end/utilities.js
+++ b/WebCore/inspector/front-end/utilities.js
@@ -145,6 +145,30 @@ Node.prototype.rangeOfWord = function(offset, stopCharacters, stayWithinNode, di
return result;
}
+Node.prototype.traverseNextTextNode = function(stayWithin)
+{
+ var node = this.traverseNextNode(stayWithin);
+ if (!node)
+ return;
+
+ while (node && node.nodeType !== Node.TEXT_NODE)
+ node = node.traverseNextNode(stayWithin);
+
+ return node;
+}
+
+Node.prototype.rangeBoundaryForOffset = function(offset)
+{
+ var node = this.traverseNextTextNode(this);
+ while (node && offset > node.nodeValue.length) {
+ offset -= node.nodeValue.length;
+ node = node.traverseNextTextNode(this);
+ }
+ if (!node)
+ return { container: this, offset: 0 };
+ return { container: node, offset: offset };
+}
+
Element.prototype.removeStyleClass = function(className)
{
// Test for the simple case first.
diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp
index 9e264b5..be782f1 100644
--- a/WebCore/loader/FrameLoader.cpp
+++ b/WebCore/loader/FrameLoader.cpp
@@ -464,7 +464,7 @@ void FrameLoader::submitForm(const char* action, const String& url, PassRefPtr<F
if (u.isEmpty())
return;
- if (isSandboxed(SandboxForms))
+ if (isDocumentSandboxed(SandboxForms))
return;
if (protocolIsJavaScript(u)) {
@@ -1308,7 +1308,7 @@ bool FrameLoader::requestObject(RenderPart* renderer, const String& url, const A
if (!m_client->allowPlugins(settings && settings->arePluginsEnabled())
|| (!settings->isJavaEnabled() && MIMETypeRegistry::isJavaAppletMIMEType(mimeType)))
return false;
- if (isSandboxed(SandboxPlugins))
+ if (isDocumentSandboxed(SandboxPlugins))
return false;
return loadPlugin(renderer, completedURL, mimeType, paramNames, paramValues, useFallback);
}
@@ -2302,7 +2302,7 @@ bool FrameLoader::shouldAllowNavigation(Frame* targetFrame) const
return true;
// A sandboxed frame can only navigate itself and its descendants.
- if (isSandboxed(SandboxNavigation) && !targetFrame->tree()->isDescendantOf(m_frame))
+ if (isDocumentSandboxed(SandboxNavigation) && !targetFrame->tree()->isDescendantOf(m_frame))
return false;
// Let a frame navigate the top-level window that contains it. This is
@@ -4032,12 +4032,15 @@ void FrameLoader::updateSandboxFlags()
m_sandboxFlags = flags;
- m_frame->document()->updateSandboxFlags();
-
for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
child->loader()->updateSandboxFlags();
}
+bool FrameLoader::isDocumentSandboxed(SandboxFlags mask) const
+{
+ return m_frame->document() && m_frame->document()->securityOrigin()->isSandboxed(mask);
+}
+
PassRefPtr<Widget> FrameLoader::createJavaAppletWidget(const IntSize& size, HTMLAppletElement* element, const HashMap<String, String>& args)
{
String baseURLString;
diff --git a/WebCore/loader/FrameLoader.h b/WebCore/loader/FrameLoader.h
index aa1913c..abe3b3a 100644
--- a/WebCore/loader/FrameLoader.h
+++ b/WebCore/loader/FrameLoader.h
@@ -456,7 +456,9 @@ private:
bool shouldTreatURLAsSameAsCurrent(const KURL&) const;
void updateSandboxFlags();
-
+ // FIXME: isDocumentSandboxed should eventually replace isSandboxed.
+ bool isDocumentSandboxed(SandboxFlags) const;
+
Frame* m_frame;
FrameLoaderClient* m_client;
diff --git a/WebCore/loader/ImageLoader.cpp b/WebCore/loader/ImageLoader.cpp
index 9c237cd..c61d133 100644
--- a/WebCore/loader/ImageLoader.cpp
+++ b/WebCore/loader/ImageLoader.cpp
@@ -29,6 +29,24 @@
#include "Element.h"
#include "RenderImage.h"
+#if !ASSERT_DISABLED
+// ImageLoader objects are allocated as members of other objects, so generic pointer check would always fail.
+namespace WTF {
+
+template<> struct ValueCheck<WebCore::ImageLoader*> {
+ typedef WebCore::ImageLoader* TraitType;
+ static void checkConsistency(const WebCore::ImageLoader* p)
+ {
+ if (!p)
+ return;
+ ASSERT(p->element());
+ ValueCheck<WebCore::Element*>::checkConsistency(p->element());
+ }
+};
+
+}
+#endif
+
namespace WebCore {
class ImageEventSender : public Noncopyable {
@@ -40,6 +58,10 @@ public:
void dispatchPendingEvents();
+#if !ASSERT_DISABLED
+ bool hasPendingEvents(ImageLoader* loader) { return m_dispatchSoonList.find(loader) != notFound; }
+#endif
+
private:
void timerFired(Timer<ImageEventSender>*);
@@ -75,8 +97,12 @@ ImageLoader::~ImageLoader()
{
if (m_image)
m_image->removeClient(this);
+
+ ASSERT(!m_firedBeforeLoad || !beforeLoadEventSender().hasPendingEvents(this));
if (!m_firedBeforeLoad)
beforeLoadEventSender().cancelEvent(this);
+
+ ASSERT(!m_firedLoad || !loadEventSender().hasPendingEvents(this));
if (!m_firedLoad)
loadEventSender().cancelEvent(this);
}
@@ -86,9 +112,15 @@ void ImageLoader::setImage(CachedImage* newImage)
ASSERT(m_failedLoadURL.isEmpty());
CachedImage* oldImage = m_image.get();
if (newImage != oldImage) {
- setLoadingImage(newImage);
- m_firedBeforeLoad = true;
- m_firedLoad = true;
+ m_image = newImage;
+ if (!m_firedBeforeLoad) {
+ beforeLoadEventSender().cancelEvent(this);
+ m_firedBeforeLoad = true;
+ }
+ if (!m_firedLoad) {
+ loadEventSender().cancelEvent(this);
+ m_firedLoad = true;
+ }
m_imageComplete = true;
if (newImage)
newImage->addClient(this);
@@ -103,14 +135,6 @@ void ImageLoader::setImage(CachedImage* newImage)
}
}
-void ImageLoader::setLoadingImage(CachedImage* loadingImage)
-{
- m_image = loadingImage;
- m_firedBeforeLoad = !loadingImage;
- m_firedLoad = !loadingImage;
- m_imageComplete = !loadingImage;
-}
-
void ImageLoader::updateFromElement()
{
// If we're not making renderers for the page, then don't load images. We don't want to slow
@@ -146,7 +170,16 @@ void ImageLoader::updateFromElement()
CachedImage* oldImage = m_image.get();
if (newImage != oldImage) {
- setLoadingImage(newImage);
+ if (!m_firedBeforeLoad)
+ beforeLoadEventSender().cancelEvent(this);
+ if (!m_firedLoad)
+ loadEventSender().cancelEvent(this);
+
+ m_image = newImage;
+ m_firedBeforeLoad = !newImage;
+ m_firedLoad = !newImage;
+ m_imageComplete = !newImage;
+
if (newImage) {
newImage->addClient(this);
if (!m_element->document()->hasListenerType(Document::BEFORELOAD_LISTENER))
@@ -180,6 +213,9 @@ void ImageLoader::notifyFinished(CachedResource*)
if (haveFiredBeforeLoadEvent())
updateRenderer();
+ if (m_firedLoad)
+ return;
+
loadEventSender().dispatchEventSoon(this);
}
@@ -282,6 +318,8 @@ void ImageEventSender::dispatchPendingEvents()
m_timer.stop();
+ m_dispatchSoonList.checkConsistency();
+
m_dispatchingList.swap(m_dispatchSoonList);
size_t size = m_dispatchingList.size();
for (size_t i = 0; i < size; ++i) {
diff --git a/WebCore/loader/ImageLoader.h b/WebCore/loader/ImageLoader.h
index e7463d5..44fe98e 100644
--- a/WebCore/loader/ImageLoader.h
+++ b/WebCore/loader/ImageLoader.h
@@ -49,7 +49,7 @@ public:
bool imageComplete() const { return m_imageComplete; }
CachedImage* image() const { return m_image.get(); }
- void setImage(CachedImage*);
+ void setImage(CachedImage*); // Cancels pending beforeload and load events, and doesn't dispatch new ones.
void setLoadManually(bool loadManually) { m_loadManually = loadManually; }
@@ -70,8 +70,6 @@ private:
void dispatchPendingBeforeLoadEvent();
void dispatchPendingLoadEvent();
- void setLoadingImage(CachedImage*);
-
void updateRenderer();
Element* m_element;
diff --git a/WebCore/loader/loader.cpp b/WebCore/loader/loader.cpp
index d693341..4d2b474 100644
--- a/WebCore/loader/loader.cpp
+++ b/WebCore/loader/loader.cpp
@@ -322,6 +322,7 @@ void Loader::Host::servePendingRequests(RequestQueue& requestsPending, bool& ser
bool shouldLimitRequests = !m_name.isNull() || docLoader->doc()->parsing() || !docLoader->doc()->haveStylesheetsLoaded();
if (shouldLimitRequests && m_requestsLoading.size() + m_nonCachedRequestsInFlight >= m_maxRequestsInFlight) {
serveLowerPriority = false;
+ cache()->loader()->scheduleServePendingRequests();
return;
}
requestsPending.removeFirst();
diff --git a/WebCore/manual-tests/drag-image-table-part-decorations.html b/WebCore/manual-tests/drag-image-table-part-decorations.html
index 467cc54..28aa175 100644
--- a/WebCore/manual-tests/drag-image-table-part-decorations.html
+++ b/WebCore/manual-tests/drag-image-table-part-decorations.html
@@ -14,3 +14,6 @@
<fieldset style="background-color: blue; border: none; height: 100px; width: 100px;"><legend></legend></fieldset>
<div style="width: 94px; height: 94px; border: solid; -webkit-user-drag: element; margin-top: -50px; "></div>
+
+<table style="border-collapse: collapse;"><tr><td style="border-bottom: 100px solid blue; width: 100px;"></td></tr></table>
+<div style="width: 94px; height: 94px; border: solid; -webkit-user-drag: element; margin-top: -50px; "></div>
diff --git a/WebCore/manual-tests/onbeforeunload-focused-iframe.html b/WebCore/manual-tests/onbeforeunload-focused-iframe.html
new file mode 100644
index 0000000..9ef0dfa
--- /dev/null
+++ b/WebCore/manual-tests/onbeforeunload-focused-iframe.html
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en">
+<head>
+</head>
+<BODY onbeforeunload="return 'onBeforeUnloadHandler return string is displayed here.';">
+<p><b>BUG ID:</b> <a href="https://bugs.webkit.org/show_bug.cgi?id=27481">27481</a> onbeforeunload not called at window close + frame or iframe focused</p>
+
+<p id="test" style="background-color:skyblue; padding:3px;"><b>STEPS TO TEST:</b>
+<ol>
+ <li>Close this browser window while the inner frame has focus.
+</ol>
+</p>
+
+<p id="success" style="background-color:palegreen; padding:3px;"><b>TEST PASS:</b>
+After the close button is clicked, you should see a dialog that reads:</p>
+<pre>Are you sure you want to navigate away from this page?
+
+onBeforeUnloadHandler return string is displayed here.
+
+Press OK to continue or Cancel to stay on the current page.</pre>
+
+<p id="failure" style="background-color:#FF3300; padding:3px;"><b>TEST FAIL:</b>
+No dialog (as described above) when closing the browser window.
+</p>
+
+<BODY onbeforeunload="return 'onBeforeUnloadHandler return string is displayed here.';">
+<iframe src="resources/focused-iframe.html"></iframe>
+<p>Close this browser window.</p>
+</body>
+</html>
diff --git a/WebCore/manual-tests/resources/focused-iframe.html b/WebCore/manual-tests/resources/focused-iframe.html
new file mode 100644
index 0000000..50b49a5
--- /dev/null
+++ b/WebCore/manual-tests/resources/focused-iframe.html
@@ -0,0 +1,12 @@
+<html>
+<body onload="load()">
+ This frame should get the focus.
+ <input id="box"></input>
+ <script>
+ function load()
+ {
+ document.getElementById("box").focus();
+ }
+ </script>
+</body>
+</html>
diff --git a/WebCore/manual-tests/win/horizontal-scroll-composited.html b/WebCore/manual-tests/win/horizontal-scroll-composited.html
new file mode 100644
index 0000000..c977300
--- /dev/null
+++ b/WebCore/manual-tests/win/horizontal-scroll-composited.html
@@ -0,0 +1,8 @@
+<div>
+<b>Scroll test for composited elements on Windows.</b>
+</div>
+<div>Make sure you browser window is smaller than 1000 pixels so that you see an horizontal scroll bar.
+<br />
+Try scolling right and left and verify that the content is displayed correctly.
+</div>
+<div style="-webkit-transform: translatez(0); width: 1000px; height: 800px; border-style: solid; border-color: Red; border-width: 3px; background-image: url(../resources/apple.jpg); background-repeat:repeat"></div>
diff --git a/WebCore/page/Console.cpp b/WebCore/page/Console.cpp
index 13595a1..99b3106 100644
--- a/WebCore/page/Console.cpp
+++ b/WebCore/page/Console.cpp
@@ -320,7 +320,7 @@ void Console::profile(const String& title, ScriptCallStack* callStack)
if (!page)
return;
-#if ENABLE(INSPECTOR) && USE(JSC)
+#if ENABLE(INSPECTOR)
InspectorController* controller = page->inspectorController();
// FIXME: log a console message when profiling is disabled.
if (!controller->profilerEnabled())
@@ -329,7 +329,7 @@ void Console::profile(const String& title, ScriptCallStack* callStack)
String resolvedTitle = title;
if (title.isNull()) // no title so give it the next user initiated profile title.
-#if ENABLE(INSPECTOR) && USE(JSC)
+#if ENABLE(INSPECTOR)
resolvedTitle = controller->getCurrentUserInitiatedProfileName(true);
#else
resolvedTitle = "";
@@ -337,7 +337,7 @@ void Console::profile(const String& title, ScriptCallStack* callStack)
ScriptProfiler::start(callStack->state(), resolvedTitle);
-#if ENABLE(INSPECTOR) && USE(JSC)
+#if ENABLE(INSPECTOR)
const ScriptCallFrame& lastCaller = callStack->at(0);
controller->addStartProfilingMessageToConsole(resolvedTitle, lastCaller.lineNumber(), lastCaller.sourceURL());
#endif
@@ -349,10 +349,7 @@ void Console::profileEnd(const String& title, ScriptCallStack* callStack)
if (!page)
return;
- if (!this->page())
- return;
-
-#if ENABLE(INSPECTOR) && USE(JSC)
+#if ENABLE(INSPECTOR)
InspectorController* controller = page->inspectorController();
if (!controller->profilerEnabled())
return;
@@ -364,7 +361,7 @@ void Console::profileEnd(const String& title, ScriptCallStack* callStack)
m_profiles.append(profile);
-#if ENABLE(INSPECTOR) && USE(JSC)
+#if ENABLE(INSPECTOR)
const ScriptCallFrame& lastCaller = callStack->at(0);
controller->addProfile(profile, lastCaller.lineNumber(), lastCaller.sourceURL());
#endif
diff --git a/WebCore/page/Console.idl b/WebCore/page/Console.idl
index b3c0c24..c08fcc0 100644
--- a/WebCore/page/Console.idl
+++ b/WebCore/page/Console.idl
@@ -30,7 +30,8 @@ module window {
interface [OmitConstructor] Console {
-#if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER
+ // Not enabled in V8 because it requires request-reply style.
+#if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER && !(defined(V8_BINDING) && V8_BINDING)
readonly attribute [CustomGetter] Array profiles;
#endif
diff --git a/WebCore/page/DOMWindow.idl b/WebCore/page/DOMWindow.idl
index 626d9c4..a4b72d2 100644
--- a/WebCore/page/DOMWindow.idl
+++ b/WebCore/page/DOMWindow.idl
@@ -442,6 +442,7 @@ module window {
attribute [CustomGetter] HTMLOptionElementConstructor Option; // Usable with new operator
attribute CanvasRenderingContext2DConstructor CanvasRenderingContext2D;
+ attribute ImageDataConstructor ImageData;
attribute [Conditional=3D_CANVAS] WebGLRenderingContextConstructor WebGLRenderingContext;
attribute TextMetricsConstructor TextMetrics;
@@ -721,3 +722,4 @@ module window {
};
}
+
diff --git a/WebCore/page/DragController.cpp b/WebCore/page/DragController.cpp
index bde38bc..c9769df 100644
--- a/WebCore/page/DragController.cpp
+++ b/WebCore/page/DragController.cpp
@@ -697,10 +697,16 @@ bool DragController::startDrag(Frame* src, Clipboard* clipboard, DragOperation s
}
doSystemDrag(dragImage, dragLoc, mouseDraggedPoint, clipboard, src, true);
} else if (isSelected && (m_dragSourceAction & DragSourceActionSelection)) {
- RefPtr<Range> selectionRange = src->selection()->toNormalizedRange();
- ASSERT(selectionRange);
- if (!clipboard->hasData())
- clipboard->writeRange(selectionRange.get(), src);
+ if (!clipboard->hasData()) {
+ if (isNodeInTextFormControl(src->selection()->start().node()))
+ clipboard->writePlainText(src->selectedText());
+ else {
+ RefPtr<Range> selectionRange = src->selection()->toNormalizedRange();
+ ASSERT(selectionRange);
+
+ clipboard->writeRange(selectionRange.get(), src);
+ }
+ }
m_client->willPerformDragSourceAction(DragSourceActionSelection, dragOrigin, clipboard);
if (!dragImage) {
dragImage = createDragImageForSelection(src);
diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp
index 33d6457..d3ff143 100644
--- a/WebCore/page/FrameView.cpp
+++ b/WebCore/page/FrameView.cpp
@@ -615,7 +615,7 @@ void FrameView::layout(bool allowSubtree)
RenderObject* rootRenderer = documentElement ? documentElement->renderer() : 0;
Node* body = document->body();
if (body && body->renderer()) {
- if (body->hasTagName(framesetTag)) {
+ if (body->hasTagName(framesetTag) && !m_frame->settings()->frameSetFlatteningEnabled()) {
body->renderer()->setChildNeedsLayout(true);
vMode = ScrollbarAlwaysOff;
hMode = ScrollbarAlwaysOff;
@@ -632,9 +632,11 @@ void FrameView::layout(bool allowSubtree)
if (documentElement->isSVGElement()) {
if (!m_firstLayout && (m_size.width() != layoutWidth() || m_size.height() != layoutHeight()))
rootRenderer->setChildNeedsLayout(true);
- }
-#endif
+ } else
+ applyOverflowToViewport(rootRenderer, hMode, vMode);
+#else
applyOverflowToViewport(rootRenderer, hMode, vMode);
+#endif
}
#ifdef INSTRUMENT_LAYOUT_SCHEDULING
if (m_firstLayout && !document->ownerElement())
@@ -1167,10 +1169,17 @@ void FrameView::scheduleRelayout()
if (!m_frame->document()->shouldScheduleLayout())
return;
+<<<<<<< HEAD
#if defined(FLATTEN_IFRAME) || defined(FLATTEN_FRAMESET)
if (m_frame->ownerRenderer())
m_frame->ownerRenderer()->setNeedsLayoutAndPrefWidthsRecalc();
#endif
+=======
+ // When frameset flattening is enabled, the contents of the frame affects layout of the parent frames.
+ // Also invalidate parent frame starting from the owner element of this frame.
+ if (m_frame->settings()->frameSetFlatteningEnabled() && m_frame->ownerRenderer())
+ m_frame->ownerRenderer()->setNeedsLayout(true, true);
+>>>>>>> webkit.org at r54731
int delay = m_frame->document()->minimumLayoutDelay();
if (m_layoutTimer.isActive() && m_delayedLayout && !delay)
diff --git a/WebCore/page/PrintContext.cpp b/WebCore/page/PrintContext.cpp
index 4c902a9..31c8777 100644
--- a/WebCore/page/PrintContext.cpp
+++ b/WebCore/page/PrintContext.cpp
@@ -184,7 +184,20 @@ int PrintContext::pageNumberForElement(Element* element, const FloatSize& pageSi
if (page.x() <= left && left < page.right() && page.y() <= top && top < page.bottom())
return pageNumber;
}
+ printContext.end();
return -1;
}
+int PrintContext::numberOfPages(Frame* frame, const FloatSize& pageSizeInPixels)
+{
+ frame->document()->updateLayout();
+
+ FloatRect pageRect(FloatPoint(0, 0), pageSizeInPixels);
+ PrintContext printContext(frame);
+ printContext.begin(pageRect.width());
+ printContext.computePageRectsWithPageSize(pageSizeInPixels, 1);
+ printContext.end();
+ return printContext.pageCount();
+}
+
}
diff --git a/WebCore/page/PrintContext.h b/WebCore/page/PrintContext.h
index 38b28c4..ec15b84 100644
--- a/WebCore/page/PrintContext.h
+++ b/WebCore/page/PrintContext.h
@@ -39,7 +39,7 @@ public:
int pageCount() const;
const IntRect& pageRect(int pageNumber) const;
- const Vector<IntRect>& pageRects() const { return m_pageRects; }
+ const Vector<IntRect>& pageRects() const { return m_pageRects; }
void computePageRects(const FloatRect& printRect, float headerHeight, float footerHeight, float userScaleFactor, float& outPageHeight);
@@ -53,6 +53,7 @@ public:
// Used by layout tests.
static int pageNumberForElement(Element*, const FloatSize& pageSizeInPixels);
+ static int numberOfPages(Frame*, const FloatSize& pageSizeInPixels);
protected:
void computePageRectsWithPageSize(const FloatSize& pageSizeInPixels, float userScaleFactor);
diff --git a/WebCore/page/SecurityOrigin.cpp b/WebCore/page/SecurityOrigin.cpp
index b2a1c89..af63637 100644
--- a/WebCore/page/SecurityOrigin.cpp
+++ b/WebCore/page/SecurityOrigin.cpp
@@ -286,15 +286,6 @@ void SecurityOrigin::grantUniversalAccess()
m_universalAccess = true;
}
-void SecurityOrigin::setSandboxFlags(SandboxFlags flags)
-{
- // Although you might think that we should set m_isUnique based on
- // SandboxOrigin, that's not actually the right behavior. We're supposed to
- // freeze the origin of a document when it is created, even if the sandbox
- // flags change after that point in time.
- m_sandboxFlags = flags;
-}
-
bool SecurityOrigin::isLocal() const
{
return shouldTreatURLSchemeAsLocal(m_protocol);
diff --git a/WebCore/page/SecurityOrigin.h b/WebCore/page/SecurityOrigin.h
index 71681d7..b441474 100644
--- a/WebCore/page/SecurityOrigin.h
+++ b/WebCore/page/SecurityOrigin.h
@@ -114,7 +114,6 @@ public:
// WARNING: This is an extremely powerful ability. Use with caution!
void grantUniversalAccess();
- void setSandboxFlags(SandboxFlags);
bool isSandboxed(SandboxFlags mask) const { return m_sandboxFlags & mask; }
bool canAccessDatabase() const { return !isUnique(); }
diff --git a/WebCore/page/Settings.cpp b/WebCore/page/Settings.cpp
index e57fccf..7b5da91 100644
--- a/WebCore/page/Settings.cpp
+++ b/WebCore/page/Settings.cpp
@@ -107,6 +107,7 @@ Settings::Settings(Page* page)
, m_authorAndUserStylesEnabled(true)
, m_needsSiteSpecificQuirks(false)
, m_fontRenderingMode(0)
+ , m_frameSetFlatteningEnabled(false)
, m_webArchiveDebugModeEnabled(false)
, m_localFileContentSniffingEnabled(false)
, m_inApplicationChromeMode(false)
@@ -621,6 +622,11 @@ void Settings::setNeedsSiteSpecificQuirks(bool needsQuirks)
m_needsSiteSpecificQuirks = needsQuirks;
}
+void Settings::setFrameSetFlatteningEnabled(bool frameSetFlatteningEnabled)
+{
+ m_frameSetFlatteningEnabled = frameSetFlatteningEnabled;
+}
+
void Settings::setWebArchiveDebugModeEnabled(bool enabled)
{
m_webArchiveDebugModeEnabled = enabled;
diff --git a/WebCore/page/Settings.h b/WebCore/page/Settings.h
index 8a553de..74d07e6 100644
--- a/WebCore/page/Settings.h
+++ b/WebCore/page/Settings.h
@@ -223,6 +223,7 @@ namespace WebCore {
void setDeveloperExtrasEnabled(bool);
bool developerExtrasEnabled() const { return m_developerExtrasEnabled; }
+<<<<<<< HEAD
#ifdef ANDROID_META_SUPPORT
void resetMetadataSettings();
@@ -262,6 +263,12 @@ namespace WebCore {
bool supportMultipleWindows() const { return m_supportMultipleWindows; }
void setSupportMultipleWindows(bool support) { m_supportMultipleWindows = support; }
#endif
+=======
+
+ void setFrameSetFlatteningEnabled(bool);
+ bool frameSetFlatteningEnabled() const { return m_frameSetFlatteningEnabled; }
+
+>>>>>>> webkit.org at r54731
void setAuthorAndUserStylesEnabled(bool);
bool authorAndUserStylesEnabled() const { return m_authorAndUserStylesEnabled; }
@@ -435,6 +442,7 @@ namespace WebCore {
bool m_authorAndUserStylesEnabled : 1;
bool m_needsSiteSpecificQuirks : 1;
unsigned m_fontRenderingMode : 1;
+ bool m_frameSetFlatteningEnabled : 1;
bool m_webArchiveDebugModeEnabled : 1;
bool m_localFileContentSniffingEnabled : 1;
bool m_inApplicationChromeMode : 1;
diff --git a/WebCore/page/brew/FrameBrew.cpp b/WebCore/page/brew/FrameBrew.cpp
new file mode 100644
index 0000000..a590544
--- /dev/null
+++ b/WebCore/page/brew/FrameBrew.cpp
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2010 Company 100, 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 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 "Frame.h"
+
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+DragImageRef Frame::dragImageForSelection()
+{
+ notImplemented();
+ return 0;
+}
+
+}
diff --git a/WebCore/page/chromium/ChromeClientChromium.h b/WebCore/page/chromium/ChromeClientChromium.h
index f6689d3..fc42250 100644
--- a/WebCore/page/chromium/ChromeClientChromium.h
+++ b/WebCore/page/chromium/ChromeClientChromium.h
@@ -35,20 +35,24 @@
#include <wtf/Forward.h>
namespace WebCore {
- class IntRect;
- class PopupContainer;
+class AccessibilityObject;
+class IntRect;
+class PopupContainer;
- // Contains Chromium-specific extensions to the ChromeClient. Only put
- // things here that don't make sense for other ports.
- class ChromeClientChromium : public ChromeClient {
- public:
- // Notifies the client of a new popup widget. The client should place
- // and size the widget with the given bounds, relative to the screen.
- // If handleExternal is true, then drawing and input handling for the
- // popup will be handled by the external embedder.
- virtual void popupOpened(PopupContainer* popupContainer, const IntRect& bounds,
- bool focusOnShow, bool handleExternal) = 0;
- };
+// Contains Chromium-specific extensions to the ChromeClient. Only put
+// things here that don't make sense for other ports.
+class ChromeClientChromium : public ChromeClient {
+public:
+ // Notifies the client of a new popup widget. The client should place
+ // and size the widget with the given bounds, relative to the screen.
+ // If handleExternal is true, then drawing and input handling for the
+ // popup will be handled by the external embedder.
+ virtual void popupOpened(PopupContainer* popupContainer, const IntRect& bounds,
+ bool focusOnShow, bool handleExternal) = 0;
+
+ // Notifies embedder that the state of an accessibility object has changed.
+ virtual void didChangeAccessibilityObjectState(AccessibilityObject*) = 0;
+};
} // namespace WebCore
diff --git a/WebCore/page/win/FrameCGWin.cpp b/WebCore/page/win/FrameCGWin.cpp
index d9e577b..cce5004 100644
--- a/WebCore/page/win/FrameCGWin.cpp
+++ b/WebCore/page/win/FrameCGWin.cpp
@@ -45,7 +45,7 @@ static void drawRectIntoContext(IntRect rect, FrameView* view, GraphicsContext*
rect.move(-offset.width(), -offset.height());
rect = view->convertToContainingWindow(rect);
- gc->concatCTM(TransformationMatrix().translate(-rect.x(), -rect.y()));
+ gc->concatCTM(AffineTransform().translate(-rect.x(), -rect.y()));
view->paint(gc, rect);
}
diff --git a/WebCore/platform/CookieJar.h b/WebCore/platform/CookieJar.h
index 987543e..fb1abee 100644
--- a/WebCore/platform/CookieJar.h
+++ b/WebCore/platform/CookieJar.h
@@ -36,7 +36,9 @@ namespace WebCore {
struct Cookie;
+ // cookies omits HttpOnly cookies.
String cookies(const Document*, const KURL&);
+ String cookieRequestHeaderFieldValue(const Document*, const KURL&);
void setCookies(Document*, const KURL&, const String&);
bool cookiesEnabled(const Document*);
bool getRawCookies(const Document*, const KURL&, Vector<Cookie>&);
diff --git a/WebCore/platform/DragImage.h b/WebCore/platform/DragImage.h
index f9b7ff3..64b4f02 100644
--- a/WebCore/platform/DragImage.h
+++ b/WebCore/platform/DragImage.h
@@ -50,6 +50,8 @@ class wxDragImage;
typedef struct _GdkPixbuf GdkPixbuf;
#elif PLATFORM(HAIKU)
class BBitmap;
+#elif PLATFORM(BREWMP)
+typedef struct IImage IImage;
#endif
//We need to #define YOffset as it needs to be shared with WebKit
@@ -76,8 +78,13 @@ namespace WebCore {
typedef GdkPixbuf* DragImageRef;
#elif PLATFORM(HAIKU)
typedef BBitmap* DragImageRef;
+<<<<<<< HEAD
#elif PLATFORM(ANDROID)
typedef void* DragImageRef;
+=======
+#elif PLATFORM(BREWMP)
+ typedef IImage* DragImageRef;
+>>>>>>> webkit.org at r54731
#endif
IntSize dragImageSize(DragImageRef);
diff --git a/WebCore/platform/Pasteboard.h b/WebCore/platform/Pasteboard.h
index 188b962..7a47f00 100644
--- a/WebCore/platform/Pasteboard.h
+++ b/WebCore/platform/Pasteboard.h
@@ -82,6 +82,7 @@ public:
//Helper functions to allow Clipboard to share code
static void writeSelection(NSPasteboard* pasteboard, Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame);
static void writeURL(NSPasteboard* pasteboard, NSArray* types, const KURL& url, const String& titleStr, Frame* frame);
+ static void writePlainText(NSPasteboard* pasteboard, const String& text);
#endif
static Pasteboard* generalPasteboard();
diff --git a/WebCore/platform/PlatformMouseEvent.h b/WebCore/platform/PlatformMouseEvent.h
index 436a902..d8f6318 100644
--- a/WebCore/platform/PlatformMouseEvent.h
+++ b/WebCore/platform/PlatformMouseEvent.h
@@ -55,6 +55,12 @@ class wxMouseEvent;
class BMessage;
#endif
+#if PLATFORM(BREWMP)
+typedef unsigned short uint16;
+typedef unsigned long int uint32;
+#define AEEEvent uint16
+#endif
+
namespace WebCore {
// These button numbers match the ones used in the DOM API, 0 through 2, except for NoButton which isn't specified.
@@ -143,6 +149,10 @@ namespace WebCore {
PlatformMouseEvent(const BMessage*);
#endif
+#if PLATFORM(BREWMP)
+ PlatformMouseEvent(AEEEvent, uint16 wParam, uint32 dwParam);
+#endif
+
protected:
IntPoint m_position;
IntPoint m_globalPosition;
diff --git a/WebCore/platform/ScrollView.cpp b/WebCore/platform/ScrollView.cpp
index c8230a6..1e28651 100644
--- a/WebCore/platform/ScrollView.cpp
+++ b/WebCore/platform/ScrollView.cpp
@@ -429,7 +429,7 @@ void ScrollView::updateScrollbars(const IntSize& desiredOffset)
if (m_horizontalScrollbar) {
int clientWidth = visibleWidth();
m_horizontalScrollbar->setEnabled(contentsWidth() > clientWidth);
- int pageStep = max(clientWidth * cFractionToStepWhenPaging, 1.f);
+ int pageStep = max(max<int>(clientWidth * Scrollbar::minFractionToStepWhenPaging(), clientWidth - Scrollbar::maxOverlapBetweenPages()), 1);
IntRect oldRect(m_horizontalScrollbar->frameRect());
IntRect hBarRect = IntRect(0,
height() - m_horizontalScrollbar->height(),
@@ -441,7 +441,7 @@ void ScrollView::updateScrollbars(const IntSize& desiredOffset)
if (m_scrollbarsSuppressed)
m_horizontalScrollbar->setSuppressInvalidation(true);
- m_horizontalScrollbar->setSteps(cScrollbarPixelsPerLineStep, pageStep);
+ m_horizontalScrollbar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep);
m_horizontalScrollbar->setProportion(clientWidth, contentsWidth());
m_horizontalScrollbar->setValue(scroll.width());
if (m_scrollbarsSuppressed)
@@ -451,7 +451,7 @@ void ScrollView::updateScrollbars(const IntSize& desiredOffset)
if (m_verticalScrollbar) {
int clientHeight = visibleHeight();
m_verticalScrollbar->setEnabled(contentsHeight() > clientHeight);
- int pageStep = max(clientHeight * cFractionToStepWhenPaging, 1.f);
+ int pageStep = max(max<int>(clientHeight * Scrollbar::minFractionToStepWhenPaging(), clientHeight - Scrollbar::maxOverlapBetweenPages()), 1);
if (pageStep < 0)
pageStep = clientHeight;
IntRect oldRect(m_verticalScrollbar->frameRect());
@@ -465,7 +465,7 @@ void ScrollView::updateScrollbars(const IntSize& desiredOffset)
if (m_scrollbarsSuppressed)
m_verticalScrollbar->setSuppressInvalidation(true);
- m_verticalScrollbar->setSteps(cScrollbarPixelsPerLineStep, pageStep);
+ m_verticalScrollbar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep);
m_verticalScrollbar->setProportion(clientHeight, contentsHeight());
m_verticalScrollbar->setValue(scroll.height());
if (m_scrollbarsSuppressed)
@@ -667,7 +667,7 @@ void ScrollView::wheelEvent(PlatformWheelEvent& e)
if (e.granularity() == ScrollByPageWheelEvent) {
ASSERT(deltaX == 0);
bool negative = deltaY < 0;
- deltaY = max(visibleHeight() * cFractionToStepWhenPaging, 1.f);
+ deltaY = max(max<int>(visibleHeight() * Scrollbar::minFractionToStepWhenPaging(), visibleHeight() - Scrollbar::maxOverlapBetweenPages()), 1);
if (negative)
deltaY = -deltaY;
}
diff --git a/WebCore/platform/ScrollView.h b/WebCore/platform/ScrollView.h
index 88c78ec..63ae0f0 100644
--- a/WebCore/platform/ScrollView.h
+++ b/WebCore/platform/ScrollView.h
@@ -314,7 +314,7 @@ private:
#if PLATFORM(GTK)
public:
- void setGtkAdjustments(GtkAdjustment* hadj, GtkAdjustment* vadj);
+ void setGtkAdjustments(GtkAdjustment* hadj, GtkAdjustment* vadj, bool resetValues = true);
GtkAdjustment* m_horizontalAdjustment;
GtkAdjustment* m_verticalAdjustment;
void setScrollOffset(const IntSize& offset) { m_scrollOffset = offset; }
diff --git a/WebCore/platform/Scrollbar.cpp b/WebCore/platform/Scrollbar.cpp
index 95f198e..1b4f100 100644
--- a/WebCore/platform/Scrollbar.cpp
+++ b/WebCore/platform/Scrollbar.cpp
@@ -38,8 +38,7 @@
#include <algorithm>
-using std::max;
-using std::min;
+using namespace std;
namespace WebCore {
@@ -50,6 +49,12 @@ PassRefPtr<Scrollbar> Scrollbar::createNativeScrollbar(ScrollbarClient* client,
}
#endif
+int Scrollbar::maxOverlapBetweenPages()
+{
+ static int maxOverlapBetweenPages = ScrollbarTheme::nativeTheme()->maxOverlapBetweenPages();
+ return maxOverlapBetweenPages;
+}
+
Scrollbar::Scrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize controlSize,
ScrollbarTheme* theme)
: m_client(client)
diff --git a/WebCore/platform/Scrollbar.h b/WebCore/platform/Scrollbar.h
index 49907ba..87310c3 100644
--- a/WebCore/platform/Scrollbar.h
+++ b/WebCore/platform/Scrollbar.h
@@ -40,19 +40,17 @@ class ScrollbarClient;
class ScrollbarTheme;
class PlatformMouseEvent;
-const int cScrollbarPixelsPerLineStep = 40;
-const float cFractionToStepWhenPaging = 0.875f;
-
class Scrollbar : public Widget {
-protected:
- Scrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize, ScrollbarTheme* = 0);
-
public:
virtual ~Scrollbar();
// Must be implemented by platforms that can't simply use the Scrollbar base class. Right now the only platform that is not using the base class is GTK.
static PassRefPtr<Scrollbar> createNativeScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize size);
-
+
+ static int pixelsPerLineStep() { return 40; }
+ static float minFractionToStepWhenPaging() { return 0.875f; }
+ static int maxOverlapBetweenPages();
+
void setClient(ScrollbarClient* client) { m_client = client; }
ScrollbarClient* client() const { return m_client; }
@@ -130,6 +128,8 @@ private:
virtual bool isScrollbar() const { return true; }
protected:
+ Scrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize, ScrollbarTheme* = 0);
+
virtual void updateThumbPosition();
virtual void updateThumbProportion();
diff --git a/WebCore/platform/ScrollbarTheme.h b/WebCore/platform/ScrollbarTheme.h
index 01229e1..c5c2094 100644
--- a/WebCore/platform/ScrollbarTheme.h
+++ b/WebCore/platform/ScrollbarTheme.h
@@ -81,7 +81,9 @@ public:
virtual int thumbLength(Scrollbar*) { return 0; } // The length of the thumb along the axis of the scrollbar.
virtual int trackPosition(Scrollbar*) { return 0; } // The position of the track relative to the scrollbar.
virtual int trackLength(Scrollbar*) { return 0; } // The length of the track along the axis of the scrollbar.
-
+
+ virtual int maxOverlapBetweenPages() { return std::numeric_limits<int>::max(); }
+
virtual double initialAutoscrollTimerDelay() { return 0.25; }
virtual double autoscrollTimerDelay() { return 0.05; }
diff --git a/WebCore/platform/android/ClipboardAndroid.cpp b/WebCore/platform/android/ClipboardAndroid.cpp
index da2c230..375f980 100644
--- a/WebCore/platform/android/ClipboardAndroid.cpp
+++ b/WebCore/platform/android/ClipboardAndroid.cpp
@@ -103,6 +103,10 @@ void ClipboardAndroid::writeRange(Range* selectedRange, Frame*)
ASSERT(selectedRange);
}
+void ClipboardAndroid::writePlainText(const String&)
+{
+}
+
bool ClipboardAndroid::hasData()
{
return false;
diff --git a/WebCore/platform/android/ClipboardAndroid.h b/WebCore/platform/android/ClipboardAndroid.h
index 723c991..23bfdf6 100644
--- a/WebCore/platform/android/ClipboardAndroid.h
+++ b/WebCore/platform/android/ClipboardAndroid.h
@@ -56,6 +56,7 @@ public:
virtual void declareAndWriteDragImage(Element*, const KURL&, const String&, Frame*);
virtual void writeURL(const KURL&, const String&, Frame*);
virtual void writeRange(Range*, Frame*);
+ virtual void writePlainText(const String&);
virtual bool hasData();
};
diff --git a/WebCore/platform/brew/CursorBrew.cpp b/WebCore/platform/brew/CursorBrew.cpp
new file mode 100644
index 0000000..3296b03
--- /dev/null
+++ b/WebCore/platform/brew/CursorBrew.cpp
@@ -0,0 +1,320 @@
+/*
+ * Copyright (C) 2010 Company 100, Inc.
+ * Copyright (C) 2004, 2006 Apple Computer, 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 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.
+ */
+
+#define LOG_TAG "WebCore"
+
+#include "config.h"
+#include "Cursor.h"
+
+#include "NotImplemented.h"
+
+#include <wtf/StdLibExtras.h>
+
+namespace WebCore {
+
+Cursor::Cursor(Image*, const IntPoint&)
+{
+ notImplemented();
+}
+
+Cursor::Cursor(const Cursor&)
+{
+ notImplemented();
+}
+
+Cursor::~Cursor()
+{
+ notImplemented();
+}
+
+Cursor& Cursor::operator=(const Cursor&)
+{
+ notImplemented();
+ return *this;
+}
+
+static inline Cursor& dummyCursor()
+{
+ DEFINE_STATIC_LOCAL(Cursor, c, ());
+ return c;
+}
+
+const Cursor& pointerCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& crossCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& handCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& moveCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& iBeamCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& waitCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& helpCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& eastResizeCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& northResizeCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& northEastResizeCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& northWestResizeCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& southResizeCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& southEastResizeCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& southWestResizeCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& westResizeCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& northSouthResizeCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& eastWestResizeCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& northEastSouthWestResizeCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& northWestSouthEastResizeCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& columnResizeCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& rowResizeCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& verticalTextCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& cellCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& contextMenuCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& noDropCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& copyCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& progressCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& aliasCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& noneCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& notAllowedCursor()
+{
+ return dummyCursor();
+}
+
+const Cursor& zoomInCursor()
+{
+ return dummyCursor();
+}
+
+const Cursor& zoomOutCursor()
+{
+ return dummyCursor();
+}
+
+const Cursor& middlePanningCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& eastPanningCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& northPanningCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& northEastPanningCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& northWestPanningCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& southPanningCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& southEastPanningCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& southWestPanningCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& westPanningCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& grabCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+const Cursor& grabbingCursor()
+{
+ notImplemented();
+ return dummyCursor();
+}
+
+} // namespace WebCore
diff --git a/WebCore/platform/brew/KURLBrew.cpp b/WebCore/platform/brew/KURLBrew.cpp
new file mode 100644
index 0000000..e0fb303
--- /dev/null
+++ b/WebCore/platform/brew/KURLBrew.cpp
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2010 Company 100, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#include "config.h"
+#include "KURL.h"
+
+#include "CString.h"
+
+#include <AEEFile.h>
+
+namespace WebCore {
+
+String KURL::fileSystemPath() const
+{
+ // Access files relative to the current module directory in a case-sensitive manner.
+ // As IWeb "file:" engine opens files in BREW's application-relative file namespace,
+ // we follow the same policy here.
+ return String(AEEFS_HOME_DIR) + path();
+}
+
+}
diff --git a/WebCore/platform/brew/PlatformMouseEventBrew.cpp b/WebCore/platform/brew/PlatformMouseEventBrew.cpp
new file mode 100644
index 0000000..32593e6
--- /dev/null
+++ b/WebCore/platform/brew/PlatformMouseEventBrew.cpp
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2009 Company 100, 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 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 "PlatformMouseEvent.h"
+
+#include <AEEEvent.h>
+#include <AEEPointerHelpers.h>
+#include <AEEStdDef.h>
+#include <AEEVCodes.h>
+
+namespace WebCore {
+
+PlatformMouseEvent::PlatformMouseEvent(AEEEvent event, uint16 wParam, uint32 dwParam)
+{
+ switch (event) {
+ case EVT_POINTER_DOWN:
+ m_eventType = MouseEventPressed;
+ break;
+ case EVT_POINTER_UP:
+ m_eventType = MouseEventReleased;
+ break;
+ case EVT_POINTER_MOVE:
+ case EVT_POINTER_STALE_MOVE:
+ m_eventType = MouseEventMoved;
+ break;
+ default:
+ m_eventType = MouseEventMoved;
+ break;
+ };
+
+ char* dwParamStr = reinterpret_cast<char*>(dwParam);
+
+ int x, y;
+ AEE_POINTER_GET_XY(dwParamStr, &x, &y);
+ m_position = IntPoint(x, y);
+ // Use IDisplay, so position and global position are the same.
+ m_globalPosition = m_position;
+
+ uint32 keyModifiers = AEE_POINTER_GET_KEY_MODIFIERS(dwParamStr);
+ m_shiftKey = keyModifiers & (KB_LSHIFT | KB_RSHIFT);
+ m_ctrlKey = keyModifiers & (KB_LCTRL | KB_RCTRL);
+ m_altKey = keyModifiers & (KB_LALT | KB_RALT);
+ m_metaKey = m_altKey;
+
+ uint16 mouseModifiers = AEE_POINTER_GET_MOUSE_MODIFIERS(dwParamStr);
+ if (mouseModifiers & AEE_POINTER_MOUSE_LBUTTON)
+ m_button = LeftButton;
+ else if (mouseModifiers & AEE_POINTER_MOUSE_RBUTTON)
+ m_button = RightButton;
+ else if (mouseModifiers & AEE_POINTER_MOUSE_MBUTTON)
+ m_button = MiddleButton;
+ else
+ m_button = NoButton;
+
+ // AEE_POINTER_GET_TIME returns milliseconds
+ m_timestamp = AEE_POINTER_GET_TIME(dwParamStr) * 0.001;
+
+ m_clickCount = AEE_POINTER_GET_CLICKCOUNT(dwParamStr);
+}
+
+} // namespace WebCore
+
diff --git a/WebCore/platform/chromium/ChromiumBridge.h b/WebCore/platform/chromium/ChromiumBridge.h
index 92b4c13..83f9c81 100644
--- a/WebCore/platform/chromium/ChromiumBridge.h
+++ b/WebCore/platform/chromium/ChromiumBridge.h
@@ -85,6 +85,7 @@ namespace WebCore {
// Cookies ------------------------------------------------------------
static void setCookies(const KURL& url, const KURL& firstPartyForCookies, const String& value);
static String cookies(const KURL& url, const KURL& firstPartyForCookies);
+ static String cookieRequestHeaderFieldValue(const KURL& url, const KURL& firstPartyForCookies);
static bool rawCookies(const KURL& url, const KURL& firstPartyForCookies, Vector<Cookie>*);
static void deleteCookie(const KURL& url, const String& cookieName);
static bool cookiesEnabled(const KURL& url, const KURL& firstPartyForCookies);
diff --git a/WebCore/platform/chromium/ChromiumDataObject.cpp b/WebCore/platform/chromium/ChromiumDataObject.cpp
index df0849c..695da9f 100644
--- a/WebCore/platform/chromium/ChromiumDataObject.cpp
+++ b/WebCore/platform/chromium/ChromiumDataObject.cpp
@@ -38,6 +38,7 @@ void ChromiumDataObject::clear()
url = KURL();
urlTitle = "";
downloadURL = KURL();
+ downloadMetadata = "";
fileExtension = "";
filenames.clear();
plainText = "";
@@ -52,6 +53,7 @@ bool ChromiumDataObject::hasData() const
{
return !url.isEmpty()
|| !downloadURL.isEmpty()
+ || !downloadMetadata.isEmpty()
|| !fileExtension.isEmpty()
|| !filenames.isEmpty()
|| !plainText.isEmpty()
@@ -63,6 +65,7 @@ ChromiumDataObject::ChromiumDataObject(const ChromiumDataObject& other)
: url(other.url)
, urlTitle(other.urlTitle)
, downloadURL(other.downloadURL)
+ , downloadMetadata(other.downloadMetadata)
, fileExtension(other.fileExtension)
, filenames(other.filenames)
, plainText(other.plainText)
diff --git a/WebCore/platform/chromium/ChromiumDataObject.h b/WebCore/platform/chromium/ChromiumDataObject.h
index 15eb911..186a1a0 100644
--- a/WebCore/platform/chromium/ChromiumDataObject.h
+++ b/WebCore/platform/chromium/ChromiumDataObject.h
@@ -60,6 +60,7 @@ namespace WebCore {
String urlTitle;
KURL downloadURL;
+ String downloadMetadata;
String fileExtension;
Vector<String> filenames;
diff --git a/WebCore/platform/chromium/ClipboardChromium.cpp b/WebCore/platform/chromium/ClipboardChromium.cpp
index 32f7d50..933d839 100644
--- a/WebCore/platform/chromium/ClipboardChromium.cpp
+++ b/WebCore/platform/chromium/ClipboardChromium.cpp
@@ -160,11 +160,11 @@ bool ClipboardChromium::setData(const String& type, const String& data)
}
if (winType == ClipboardDataTypeDownloadURL) {
+ m_dataObject->downloadMetadata = data;
KURL url = KURL(ParsedURLString, data);
- if (url.isValid()) {
+ if (url.isValid())
m_dataObject->downloadURL = url;
- return true;
- }
+ return true;
}
return false;
@@ -363,9 +363,6 @@ void ClipboardChromium::writeRange(Range* selectedRange, Frame* frame)
m_dataObject->textHtml = createMarkup(selectedRange, 0,
AnnotateForInterchange);
-#if OS(DARWIN)
- m_dataObject->textHtml = String("<meta charset='utf-8' id='webkit-interchange-charset'>") + m_dataObject->textHtml;
-#endif
m_dataObject->htmlBaseUrl = frame->document()->url();
String str = frame->selectedText();
@@ -376,6 +373,19 @@ void ClipboardChromium::writeRange(Range* selectedRange, Frame* frame)
m_dataObject->plainText = str;
}
+void ClipboardChromium::writePlainText(const String& text)
+{
+ if (!m_dataObject)
+ return;
+
+ String str = text;
+#if OS(WINDOWS)
+ replaceNewlinesWithWindowsStyleNewlines(str);
+#endif
+ replaceNBSPWithSpace(str);
+ m_dataObject->plainText = str;
+}
+
bool ClipboardChromium::hasData()
{
if (!m_dataObject)
diff --git a/WebCore/platform/chromium/ClipboardChromium.h b/WebCore/platform/chromium/ClipboardChromium.h
index cf2f046..fbebde2 100644
--- a/WebCore/platform/chromium/ClipboardChromium.h
+++ b/WebCore/platform/chromium/ClipboardChromium.h
@@ -74,6 +74,7 @@ namespace WebCore {
virtual void declareAndWriteDragImage(Element*, const KURL&, const String& title, Frame*);
virtual void writeURL(const KURL&, const String&, Frame*);
virtual void writeRange(Range*, Frame*);
+ virtual void writePlainText(const String&);
virtual bool hasData();
diff --git a/WebCore/platform/chromium/PasteboardChromium.cpp b/WebCore/platform/chromium/PasteboardChromium.cpp
index 3b3aea6..d4f9a27 100644
--- a/WebCore/platform/chromium/PasteboardChromium.cpp
+++ b/WebCore/platform/chromium/PasteboardChromium.cpp
@@ -82,9 +82,6 @@ void Pasteboard::setSelectionMode(bool selectionMode)
void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame)
{
String html = createMarkup(selectedRange, 0, AnnotateForInterchange);
-#if OS(DARWIN)
- html = String("<meta charset='utf-8' id='webkit-interchange-charset'>") + html;
-#endif
ExceptionCode ec = 0;
KURL url = selectedRange->startContainer(ec)->document()->url();
String plainText = frame->selectedText();
@@ -170,11 +167,6 @@ PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefP
String markup;
KURL srcURL;
ChromiumBridge::clipboardReadHTML(buffer, &markup, &srcURL);
-#if OS(DARWIN)
- DEFINE_STATIC_LOCAL(const String, forceUtf8String, ("<meta charset='utf-8' id='webkit-interchange-charset'>"));
- if (markup.startsWith(forceUtf8String))
- markup = markup.substring(forceUtf8String.length());
-#endif
RefPtr<DocumentFragment> fragment =
createFragmentFromMarkup(frame->document(), markup, srcURL, FragmentScriptingNotAllowed);
diff --git a/WebCore/platform/chromium/ThemeChromiumMac.mm b/WebCore/platform/chromium/ThemeChromiumMac.mm
index 1c14207..15a8382 100644
--- a/WebCore/platform/chromium/ThemeChromiumMac.mm
+++ b/WebCore/platform/chromium/ThemeChromiumMac.mm
@@ -33,6 +33,7 @@
#import "ScrollView.h"
#import "WebCoreSystemInterface.h"
#include <wtf/StdLibExtras.h>
+#import <objc/runtime.h>
using namespace std;
@@ -47,6 +48,8 @@ using namespace std;
// rendering.
// - In updateStates() the code to update the cells' inactive state.
// - In paintButton() the code to save/restore the window's default button cell.
+// - The Snow Leopard focus ring bug fix and its use around every call to
+// -[NSButtonCell drawWithFrame:inView:].
//
// For all other differences, if it was introduced in this file, then the
// maintainer forgot to include it in the list; otherwise it is an update that
@@ -54,6 +57,129 @@ using namespace std;
// FIXME: Default buttons really should be more like push buttons and not like buttons.
+// --- START fix for Snow Leopard focus ring bug ---
+
+// There is a bug in the Cocoa focus ring drawing code. The code calls +[NSView
+// focusView] (to get the currently focused view) and then calls an NSRect-
+// returning method on that view to obtain a clipping rect. However, if there is
+// no focused view (as there won't be if the destination is a context), the rect
+// returned from the method invocation on nil is garbage.
+//
+// The garbage fortunately does not clip the focus ring on Leopard, but
+// unfortunately does so on Snow Leopard. Therefore, if a runtime test shows
+// that focus ring drawing fails, we swizzle NSView to ensure it returns a valid
+// view with a valid clipping rectangle.
+//
+// FIXME: After the referenced bug is fixed on all supported platforms, remove
+// this code.
+//
+// References:
+// <http://crbug.com/27493>
+// <rdar://problem/7604051> (<http://openradar.appspot.com/7604051>)
+
+@interface TCMVisibleView : NSView
+
+@end
+
+@implementation TCMVisibleView
+
+- (struct CGRect)_focusRingVisibleRect
+{
+ return CGRectZero;
+}
+
+- (id)_focusRingClipAncestor
+{
+ return self;
+}
+
+@end
+
+@interface NSView (TCMInterposing)
++ (NSView *)TCMInterposing_focusView;
+@end
+
+namespace FocusIndicationFix {
+
+bool currentOSHasSetFocusRingStyleInBitmapBug()
+{
+ UInt32 pixel = 0;
+ UInt32* pixelPlane = &pixel;
+ UInt32** pixelPlanes = &pixelPlane;
+ NSBitmapImageRep *bitmap = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(UInt8**)pixelPlanes
+ pixelsWide:1
+ pixelsHigh:1
+ bitsPerSample:8
+ samplesPerPixel:4
+ hasAlpha:YES
+ isPlanar:NO
+ colorSpaceName:NSCalibratedRGBColorSpace
+ bitmapFormat:NSAlphaFirstBitmapFormat
+ bytesPerRow:4
+ bitsPerPixel:32];
+ [NSGraphicsContext saveGraphicsState];
+ [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithBitmapImageRep:bitmap]];
+ NSSetFocusRingStyle(NSFocusRingOnly);
+ NSRectFill(NSMakeRect(0, 0, 1, 1));
+ [NSGraphicsContext restoreGraphicsState];
+ [bitmap release];
+
+ return !pixel;
+}
+
+bool swizzleFocusView()
+{
+ if (!currentOSHasSetFocusRingStyleInBitmapBug())
+ return false;
+
+ Class nsview = [NSView class];
+ Method m1 = class_getClassMethod(nsview, @selector(focusView));
+ Method m2 = class_getClassMethod(nsview, @selector(TCMInterposing_focusView));
+ if (m1 && m2) {
+ method_exchangeImplementations(m1, m2);
+ return true;
+ }
+
+ return false;
+}
+
+static bool interpose = false;
+
+// A class to restrict the amount of time spent messing with interposing. It
+// only stacks one-deep.
+class ScopedFixer {
+public:
+ ScopedFixer()
+ {
+ static bool swizzled = swizzleFocusView();
+ interpose = swizzled;
+ }
+
+ ~ScopedFixer()
+ {
+ interpose = false;
+ }
+};
+
+} // namespace FocusIndicationFix
+
+@implementation NSView (TCMInterposing)
+
++ (NSView *)TCMInterposing_focusView
+{
+ NSView *view = [self TCMInterposing_focusView]; // call original (was swizzled)
+ if (!view && FocusIndicationFix::interpose) {
+ static TCMVisibleView* fixedView = [[TCMVisibleView alloc] init];
+ view = fixedView;
+ }
+
+ return view;
+}
+
+@end
+
+// --- END fix for Snow Leopard focus ring bug ---
+
namespace WebCore {
// Pick up utility function from RenderThemeChromiumMac.
@@ -241,7 +367,10 @@ static void paintCheckbox(ControlStates states, GraphicsContext* context, const
context->translate(-inflatedRect.x(), -inflatedRect.y());
}
- [checkboxCell drawWithFrame:NSRect(inflatedRect) inView:FlippedView()];
+ {
+ FocusIndicationFix::ScopedFixer fix;
+ [checkboxCell drawWithFrame:NSRect(inflatedRect) inView:FlippedView()];
+ }
[checkboxCell setControlView:nil];
context->restore();
@@ -319,7 +448,10 @@ static void paintRadio(ControlStates states, GraphicsContext* context, const Int
}
BEGIN_BLOCK_OBJC_EXCEPTIONS
- [radioCell drawWithFrame:NSRect(inflatedRect) inView:FlippedView()];
+ {
+ FocusIndicationFix::ScopedFixer fix;
+ [radioCell drawWithFrame:NSRect(inflatedRect) inView:FlippedView()];
+ }
[radioCell setControlView:nil];
END_BLOCK_OBJC_EXCEPTIONS
@@ -429,7 +561,10 @@ static void paintButton(ControlPart part, ControlStates states, GraphicsContext*
}
}
- [buttonCell drawWithFrame:NSRect(inflatedRect) inView:FlippedView()];
+ {
+ FocusIndicationFix::ScopedFixer fix;
+ [buttonCell drawWithFrame:NSRect(inflatedRect) inView:FlippedView()];
+ }
[buttonCell setControlView:nil];
END_BLOCK_OBJC_EXCEPTIONS
diff --git a/WebCore/platform/graphics/BitmapImage.h b/WebCore/platform/graphics/BitmapImage.h
index 485bb02..e4261e2 100644
--- a/WebCore/platform/graphics/BitmapImage.h
+++ b/WebCore/platform/graphics/BitmapImage.h
@@ -173,7 +173,7 @@ protected:
#endif
virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator);
-#if PLATFORM(WX) || (OS(WINCE) && !PLATFORM(QT))
+#if (OS(WINCE) && !PLATFORM(QT))
virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const TransformationMatrix& patternTransform,
const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect);
#endif
diff --git a/WebCore/platform/graphics/FloatPoint.cpp b/WebCore/platform/graphics/FloatPoint.cpp
index 7765ba9..cf3d548 100644
--- a/WebCore/platform/graphics/FloatPoint.cpp
+++ b/WebCore/platform/graphics/FloatPoint.cpp
@@ -37,6 +37,13 @@ FloatPoint::FloatPoint(const IntPoint& p) : m_x(p.x()), m_y(p.y())
{
}
+FloatPoint FloatPoint::matrixTransform(const AffineTransform& transform) const
+{
+ double newX, newY;
+ transform.map(static_cast<double>(m_x), static_cast<double>(m_y), newX, newY);
+ return narrowPrecision(newX, newY);
+}
+
FloatPoint FloatPoint::matrixTransform(const TransformationMatrix& transform) const
{
double newX, newY;
diff --git a/WebCore/platform/graphics/FloatPoint.h b/WebCore/platform/graphics/FloatPoint.h
index 6b037ff..bf568d4 100644
--- a/WebCore/platform/graphics/FloatPoint.h
+++ b/WebCore/platform/graphics/FloatPoint.h
@@ -61,6 +61,7 @@ struct SkPoint;
namespace WebCore {
+class AffineTransform;
class TransformationMatrix;
class IntPoint;
@@ -106,6 +107,7 @@ public:
#endif
FloatPoint matrixTransform(const TransformationMatrix&) const;
+ FloatPoint matrixTransform(const AffineTransform&) const;
private:
float m_x, m_y;
diff --git a/WebCore/platform/graphics/FloatSize.h b/WebCore/platform/graphics/FloatSize.h
index 1bc3423..a3233d1 100644
--- a/WebCore/platform/graphics/FloatSize.h
+++ b/WebCore/platform/graphics/FloatSize.h
@@ -28,6 +28,8 @@
#ifndef FloatSize_h
#define FloatSize_h
+#include "IntSize.h"
+#include <wtf/MathExtras.h>
#include <wtf/Platform.h>
#if PLATFORM(CG)
@@ -128,6 +130,11 @@ inline bool operator!=(const FloatSize& a, const FloatSize& b)
return a.width() != b.width() || a.height() != b.height();
}
+inline IntSize roundedIntSize(const FloatSize& p)
+{
+ return IntSize(static_cast<int>(roundf(p.width())), static_cast<int>(roundf(p.height())));
+}
+
} // namespace WebCore
#endif // FloatSize_h
diff --git a/WebCore/platform/graphics/FontCache.cpp b/WebCore/platform/graphics/FontCache.cpp
index 2aa68f1..b3eca85 100644
--- a/WebCore/platform/graphics/FontCache.cpp
+++ b/WebCore/platform/graphics/FontCache.cpp
@@ -257,6 +257,15 @@ const int cMaxInactiveFontData = 120; // Pretty Low Threshold
const float cTargetInactiveFontData = 100;
static ListHashSet<const SimpleFontData*>* gInactiveFontData = 0;
+SimpleFontData* FontCache::getCachedFontData(const FontDescription& fontDescription, const AtomicString& family, bool checkingAlternateName)
+{
+ FontPlatformData* platformData = getCachedFontPlatformData(fontDescription, family, checkingAlternateName);
+ if (!platformData)
+ return 0;
+
+ return getCachedFontData(platformData);
+}
+
SimpleFontData* FontCache::getCachedFontData(const FontPlatformData* platformData)
{
if (!platformData)
@@ -361,7 +370,7 @@ size_t FontCache::inactiveFontDataCount()
const FontData* FontCache::getFontData(const Font& font, int& familyIndex, FontSelector* fontSelector)
{
- FontPlatformData* result = 0;
+ SimpleFontData* result = 0;
int startIndex = familyIndex;
const FontFamily* startFamily = &font.fontDescription().family();
@@ -376,7 +385,7 @@ const FontData* FontCache::getFontData(const Font& font, int& familyIndex, FontS
if (data)
return data;
}
- result = getCachedFontPlatformData(font.fontDescription(), currFamily->family());
+ result = getCachedFontData(font.fontDescription(), currFamily->family());
}
currFamily = currFamily->next();
}
@@ -403,9 +412,7 @@ const FontData* FontCache::getFontData(const Font& font, int& familyIndex, FontS
// Still no result. Hand back our last resort fallback font.
result = getLastResortFallbackFont(font.fontDescription());
}
-
- // Now that we have a result, we need to go from FontPlatformData -> FontData.
- return getCachedFontData(result);
+ return result;
}
static HashSet<FontSelector*>* gClients;
diff --git a/WebCore/platform/graphics/FontCache.h b/WebCore/platform/graphics/FontCache.h
index 9b41e38..dd5928d 100644
--- a/WebCore/platform/graphics/FontCache.h
+++ b/WebCore/platform/graphics/FontCache.h
@@ -78,9 +78,8 @@ public:
void getTraitsInFamily(const AtomicString&, Vector<unsigned>&);
- FontPlatformData* getCachedFontPlatformData(const FontDescription&, const AtomicString& family, bool checkingAlternateName = false);
- SimpleFontData* getCachedFontData(const FontPlatformData*);
- FontPlatformData* getLastResortFallbackFont(const FontDescription&);
+ SimpleFontData* getCachedFontData(const FontDescription& fontDescription, const AtomicString& family, bool checkingAlternateName = false);
+ SimpleFontData* getLastResortFallbackFont(const FontDescription&);
void addClient(FontSelector*);
void removeClient(FontSelector*);
@@ -96,16 +95,22 @@ private:
FontCache();
~FontCache();
+ // FIXME: This method should eventually be removed.
+ FontPlatformData* getCachedFontPlatformData(const FontDescription&, const AtomicString& family, bool checkingAlternateName = false);
+
// These methods are implemented by each platform.
- FontPlatformData* getSimilarFontPlatformData(const Font&);
+ SimpleFontData* getSimilarFontPlatformData(const Font&);
FontPlatformData* createFontPlatformData(const FontDescription&, const AtomicString& family);
- friend class SimpleFontData;
+ SimpleFontData* getCachedFontData(const FontPlatformData*);
+
+ friend class SimpleFontData; // For getCachedFontData(const FontPlatformData*)
friend class FontFallbackList;
};
// Get the global fontCache.
FontCache* fontCache();
+
}
#endif
diff --git a/WebCore/platform/graphics/GeneratedImage.cpp b/WebCore/platform/graphics/GeneratedImage.cpp
index 8395aff..cd0748e 100644
--- a/WebCore/platform/graphics/GeneratedImage.cpp
+++ b/WebCore/platform/graphics/GeneratedImage.cpp
@@ -47,7 +47,7 @@ void GeneratedImage::draw(GraphicsContext* context, const FloatRect& dstRect, co
context->restore();
}
-void GeneratedImage::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const TransformationMatrix& patternTransform,
+void GeneratedImage::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const AffineTransform& patternTransform,
const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator compositeOp, const FloatRect& destRect)
{
// Allow the generator to provide visually-equivalent tiling parameters for better performance.
diff --git a/WebCore/platform/graphics/GeneratedImage.h b/WebCore/platform/graphics/GeneratedImage.h
index a4583e3..67a3150 100644
--- a/WebCore/platform/graphics/GeneratedImage.h
+++ b/WebCore/platform/graphics/GeneratedImage.h
@@ -58,7 +58,7 @@ public:
protected:
virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator);
- virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const TransformationMatrix& patternTransform,
+ virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform,
const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect);
GeneratedImage(PassRefPtr<Generator> generator, const IntSize& size)
diff --git a/WebCore/platform/graphics/Gradient.cpp b/WebCore/platform/graphics/Gradient.cpp
index 17d461f..0a751ac 100644
--- a/WebCore/platform/graphics/Gradient.cpp
+++ b/WebCore/platform/graphics/Gradient.cpp
@@ -189,14 +189,19 @@ void Gradient::setSpreadMethod(GradientSpreadMethod spreadMethod)
m_spreadMethod = spreadMethod;
}
-void Gradient::setGradientSpaceTransform(const TransformationMatrix& gradientSpaceTransformation)
+void Gradient::setGradientSpaceTransform(const AffineTransform& gradientSpaceTransformation)
{
m_gradientSpaceTransformation = gradientSpaceTransformation;
setPlatformGradientSpaceTransform(gradientSpaceTransformation);
}
+<<<<<<< HEAD
#if !(PLATFORM(SKIA) && !PLATFORM(ANDROID))
void Gradient::setPlatformGradientSpaceTransform(const TransformationMatrix&)
+=======
+#if !PLATFORM(SKIA)
+void Gradient::setPlatformGradientSpaceTransform(const AffineTransform&)
+>>>>>>> webkit.org at r54731
{
}
#endif
diff --git a/WebCore/platform/graphics/Gradient.h b/WebCore/platform/graphics/Gradient.h
index b65550d..e1be1fe 100644
--- a/WebCore/platform/graphics/Gradient.h
+++ b/WebCore/platform/graphics/Gradient.h
@@ -28,10 +28,10 @@
#ifndef Gradient_h
#define Gradient_h
+#include "AffineTransform.h"
#include "FloatPoint.h"
#include "Generator.h"
#include "GraphicsTypes.h"
-#include "TransformationMatrix.h"
#include <wtf/PassRefPtr.h>
#include <wtf/Vector.h>
@@ -115,14 +115,14 @@ namespace WebCore {
void setSpreadMethod(GradientSpreadMethod);
GradientSpreadMethod spreadMethod() { return m_spreadMethod; }
- void setGradientSpaceTransform(const TransformationMatrix& gradientSpaceTransformation);
+ void setGradientSpaceTransform(const AffineTransform& gradientSpaceTransformation);
// Qt and CG transform the gradient at draw time
- TransformationMatrix gradientSpaceTransform() { return m_gradientSpaceTransformation; }
+ AffineTransform gradientSpaceTransform() { return m_gradientSpaceTransformation; }
virtual void fill(GraphicsContext*, const FloatRect&);
virtual void adjustParametersForTiledDrawing(IntSize& size, FloatRect& srcRect);
- void setPlatformGradientSpaceTransform(const TransformationMatrix& gradientSpaceTransformation);
+ void setPlatformGradientSpaceTransform(const AffineTransform& gradientSpaceTransformation);
#if PLATFORM(CG)
void paint(GraphicsContext*);
@@ -146,7 +146,7 @@ namespace WebCore {
mutable bool m_stopsSorted;
mutable int m_lastStop;
GradientSpreadMethod m_spreadMethod;
- TransformationMatrix m_gradientSpaceTransformation;
+ AffineTransform m_gradientSpaceTransformation;
PlatformGradient m_gradient;
};
diff --git a/WebCore/platform/graphics/GraphicsContext.h b/WebCore/platform/graphics/GraphicsContext.h
index 5199d93..45b516a 100644
--- a/WebCore/platform/graphics/GraphicsContext.h
+++ b/WebCore/platform/graphics/GraphicsContext.h
@@ -130,7 +130,6 @@ namespace WebCore {
class Path;
class Pattern;
class TextRun;
- class TransformationMatrix;
// These bits can be ORed together for a total of 8 possible text drawing modes.
const int cTextInvisible = 0;
@@ -339,10 +338,8 @@ namespace WebCore {
void setURLForRect(const KURL&, const IntRect&);
- void concatCTM(const TransformationMatrix&);
void concatCTM(const AffineTransform&);
- TransformationMatrix getCTM() const;
- AffineTransform getAffineCTM() const;
+ AffineTransform getCTM() const;
#if OS(WINCE) && !PLATFORM(QT)
void setBitmap(PassRefPtr<SharedBitmap>);
@@ -355,7 +352,7 @@ namespace WebCore {
void drawFocusRect(const IntRect& rect);
void paintTextField(const IntRect& rect, unsigned state);
void drawBitmap(SharedBitmap*, const IntRect& dstRect, const IntRect& srcRect, CompositeOperator compositeOp);
- void drawBitmapPattern(SharedBitmap*, const FloatRect& tileRectIn, const TransformationMatrix& patternTransform, const FloatPoint& phase, CompositeOperator op, const FloatRect& destRect, const IntSize& origSourceSize);
+ void drawBitmapPattern(SharedBitmap*, const FloatRect& tileRectIn, const AffineTransform& patternTransform, const FloatPoint& phase, CompositeOperator op, const FloatRect& destRect, const IntSize& origSourceSize);
void drawIcon(HICON icon, const IntRect& dstRect, UINT flags);
HDC getWindowsContext(const IntRect&, bool supportAlphaBlend = false, bool mayCreateBitmap = true); // The passed in rect is used to create a bitmap for compositing inside transparency layers.
void releaseWindowsContext(HDC, const IntRect&, bool supportAlphaBlend = false, bool mayCreateBitmap = true); // The passed in HDC should be the one handed back by getWindowsContext.
diff --git a/WebCore/platform/graphics/GraphicsContext3D.h b/WebCore/platform/graphics/GraphicsContext3D.h
index d7406c9..b7be8fc 100644
--- a/WebCore/platform/graphics/GraphicsContext3D.h
+++ b/WebCore/platform/graphics/GraphicsContext3D.h
@@ -33,7 +33,7 @@
#include <wtf/PassOwnPtr.h>
// FIXME: Find a better way to avoid the name confliction for NO_ERROR.
-#if PLATFORM(CHROMIUM) && OS(WINDOWS)
+#if ((PLATFORM(CHROMIUM) && OS(WINDOWS)) || PLATFORM(WIN))
#undef NO_ERROR
#endif
diff --git a/WebCore/platform/graphics/Image.cpp b/WebCore/platform/graphics/Image.cpp
index 611216a..8263faa 100644
--- a/WebCore/platform/graphics/Image.cpp
+++ b/WebCore/platform/graphics/Image.cpp
@@ -27,7 +27,7 @@
#include "config.h"
#include "Image.h"
-#include "TransformationMatrix.h"
+#include "AffineTransform.h"
#include "BitmapImage.h"
#include "GraphicsContext.h"
#include "IntRect.h"
@@ -136,7 +136,7 @@ void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const Fl
return;
}
- TransformationMatrix patternTransform = TransformationMatrix().scaleNonUniform(scale.width(), scale.height());
+ AffineTransform patternTransform = AffineTransform().scaleNonUniform(scale.width(), scale.height());
FloatRect tileRect(FloatPoint(), intrinsicTileSize);
drawPattern(ctxt, tileRect, patternTransform, oneTileRect.location(), styleColorSpace, op, destRect);
@@ -158,7 +158,7 @@ void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& dstRect, const Flo
vRule = RepeatTile;
FloatSize scale = calculatePatternScale(dstRect, srcRect, hRule, vRule);
- TransformationMatrix patternTransform = TransformationMatrix().scaleNonUniform(scale.width(), scale.height());
+ AffineTransform patternTransform = AffineTransform().scaleNonUniform(scale.width(), scale.height());
// We want to construct the phase such that the pattern is centered (when stretch is not
// set for a particular rule).
diff --git a/WebCore/platform/graphics/Image.h b/WebCore/platform/graphics/Image.h
index 234104a..b786106 100644
--- a/WebCore/platform/graphics/Image.h
+++ b/WebCore/platform/graphics/Image.h
@@ -74,7 +74,7 @@ class FloatSize;
class GraphicsContext;
class SharedBuffer;
class String;
-class TransformationMatrix;
+class AffineTransform;
// This class gets notified when an image creates or destroys decoded frames and when it advances animation frames.
class ImageObserver;
@@ -174,7 +174,7 @@ protected:
virtual bool mayFillWithSolidColor() { return false; }
virtual Color solidColor() const { return Color(); }
- virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const TransformationMatrix& patternTransform,
+ virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform,
const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect);
private:
diff --git a/WebCore/platform/graphics/ImageBuffer.h b/WebCore/platform/graphics/ImageBuffer.h
index 9432058..7821288 100644
--- a/WebCore/platform/graphics/ImageBuffer.h
+++ b/WebCore/platform/graphics/ImageBuffer.h
@@ -27,7 +27,7 @@
#ifndef ImageBuffer_h
#define ImageBuffer_h
-#include "TransformationMatrix.h"
+#include "AffineTransform.h"
#include "Image.h"
#include "IntSize.h"
#include "ImageBufferData.h"
@@ -84,11 +84,11 @@ namespace WebCore {
String toDataURL(const String& mimeType) const;
#if !PLATFORM(CG)
- TransformationMatrix baseTransform() const { return TransformationMatrix(); }
+ AffineTransform baseTransform() const { return AffineTransform(); }
void transformColorSpace(ImageColorSpace srcColorSpace, ImageColorSpace dstColorSpace);
void platformTransformColorSpace(const Vector<int>&);
#else
- TransformationMatrix baseTransform() const { return TransformationMatrix(1, 0, 0, -1, 0, m_size.height()); }
+ AffineTransform baseTransform() const { return AffineTransform(1, 0, 0, -1, 0, m_size.height()); }
#endif
private:
ImageBufferData m_data;
diff --git a/WebCore/platform/graphics/Path.h b/WebCore/platform/graphics/Path.h
index aad6f3e..533ef8f 100644
--- a/WebCore/platform/graphics/Path.h
+++ b/WebCore/platform/graphics/Path.h
@@ -74,7 +74,6 @@ namespace WebCore {
class GraphicsContext;
class String;
class StrokeStyleApplier;
- class TransformationMatrix;
enum WindRule {
RULE_NONZERO = 0,
@@ -147,7 +146,6 @@ namespace WebCore {
void apply(void* info, PathApplierFunction) const;
void transform(const AffineTransform&);
- void transform(const TransformationMatrix&);
private:
PlatformPathPtr m_path;
diff --git a/WebCore/platform/graphics/Pattern.cpp b/WebCore/platform/graphics/Pattern.cpp
index 3409d16..bb07307 100644
--- a/WebCore/platform/graphics/Pattern.cpp
+++ b/WebCore/platform/graphics/Pattern.cpp
@@ -47,7 +47,7 @@ Pattern::~Pattern()
platformDestroy();
}
-void Pattern::setPatternSpaceTransform(const TransformationMatrix& patternSpaceTransformation)
+void Pattern::setPatternSpaceTransform(const AffineTransform& patternSpaceTransformation)
{
m_patternSpaceTransformation = patternSpaceTransformation;
setPlatformPatternSpaceTransform();
diff --git a/WebCore/platform/graphics/Pattern.h b/WebCore/platform/graphics/Pattern.h
index b0188b9..b0cf283 100644
--- a/WebCore/platform/graphics/Pattern.h
+++ b/WebCore/platform/graphics/Pattern.h
@@ -28,10 +28,11 @@
#ifndef Pattern_h
#define Pattern_h
+#include "AffineTransform.h"
+
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
-#include "TransformationMatrix.h"
#if PLATFORM(CG)
typedef struct CGPattern* CGPatternRef;
@@ -61,39 +62,40 @@ typedef void* PlatformPatternPtr;
#endif
namespace WebCore {
- class TransformationMatrix;
- class Image;
- class Pattern : public RefCounted<Pattern> {
- public:
- static PassRefPtr<Pattern> create(Image* tileImage, bool repeatX, bool repeatY)
- {
- return adoptRef(new Pattern(tileImage, repeatX, repeatY));
- }
- virtual ~Pattern();
+class AffineTransform;
+class Image;
+
+class Pattern : public RefCounted<Pattern> {
+public:
+ static PassRefPtr<Pattern> create(Image* tileImage, bool repeatX, bool repeatY)
+ {
+ return adoptRef(new Pattern(tileImage, repeatX, repeatY));
+ }
+ virtual ~Pattern();
- Image* tileImage() const { return m_tileImage.get(); }
+ Image* tileImage() const { return m_tileImage.get(); }
- void platformDestroy();
+ void platformDestroy();
- // Pattern space is an abstract space that maps to the default user space by the transformation 'userSpaceTransformation'
+ // Pattern space is an abstract space that maps to the default user space by the transformation 'userSpaceTransformation'
#if PLATFORM(SKIA)
- PlatformPatternPtr platformPattern(const TransformationMatrix& userSpaceTransformation);
+ PlatformPatternPtr platformPattern(const AffineTransform& userSpaceTransformation);
#else
- PlatformPatternPtr createPlatformPattern(const TransformationMatrix& userSpaceTransformation) const;
+ PlatformPatternPtr createPlatformPattern(const AffineTransform& userSpaceTransformation) const;
#endif
- void setPatternSpaceTransform(const TransformationMatrix& patternSpaceTransformation);
- void setPlatformPatternSpaceTransform();
+ void setPatternSpaceTransform(const AffineTransform& patternSpaceTransformation);
+ void setPlatformPatternSpaceTransform();
- private:
- Pattern(Image*, bool repeatX, bool repeatY);
+private:
+ Pattern(Image*, bool repeatX, bool repeatY);
- RefPtr<Image> m_tileImage;
- bool m_repeatX;
- bool m_repeatY;
- TransformationMatrix m_patternSpaceTransformation;
- PlatformPatternPtr m_pattern;
- };
+ RefPtr<Image> m_tileImage;
+ bool m_repeatX;
+ bool m_repeatY;
+ AffineTransform m_patternSpaceTransformation;
+ PlatformPatternPtr m_pattern;
+};
} //namespace
diff --git a/WebCore/platform/graphics/SimpleFontData.h b/WebCore/platform/graphics/SimpleFontData.h
index 09ed0fc..0366e3b 100644
--- a/WebCore/platform/graphics/SimpleFontData.h
+++ b/WebCore/platform/graphics/SimpleFontData.h
@@ -35,7 +35,8 @@
typedef struct OpaqueATSUStyle* ATSUStyle;
#endif
-#if PLATFORM(WIN) && !OS(WINCE)
+#if (PLATFORM(WIN) && !OS(WINCE)) \
+ || (OS(WINDOWS) && PLATFORM(WX))
#include <usp10.h>
#endif
@@ -86,7 +87,7 @@ public:
float spaceWidth() const { return m_spaceWidth; }
float adjustedSpaceWidth() const { return m_adjustedSpaceWidth; }
-#if PLATFORM(CG) || PLATFORM(CAIRO)
+#if PLATFORM(CG) || PLATFORM(CAIRO) || (OS(WINDOWS) && PLATFORM(WX))
float syntheticBoldOffset() const { return m_syntheticBoldOffset; }
#endif
@@ -138,7 +139,7 @@ public:
QFont getQtFont() const { return m_platformData.font(); }
#endif
-#if PLATFORM(WIN)
+#if PLATFORM(WIN) || (OS(WINDOWS) && PLATFORM(WX))
bool isSystemFont() const { return m_isSystemFont; }
#if !OS(WINCE) // disable unused members to save space
SCRIPT_FONTPROPERTIES* scriptFontProperties() const;
@@ -162,7 +163,8 @@ private:
void commonInit();
-#if PLATFORM(WIN) && !OS(WINCE)
+#if (PLATFORM(WIN) && !OS(WINCE)) \
+ || (OS(WINDOWS) && PLATFORM(WX))
void initGDIFont();
void platformCommonDestroy();
float widthForGDIGlyph(Glyph glyph) const;
@@ -198,7 +200,7 @@ private:
mutable SimpleFontData* m_smallCapsFontData;
-#if PLATFORM(CG) || PLATFORM(CAIRO)
+#if PLATFORM(CG) || PLATFORM(CAIRO) || (OS(WINDOWS) && PLATFORM(WX))
float m_syntheticBoldOffset;
#endif
@@ -224,7 +226,7 @@ private:
mutable HashMap<unsigned, RetainPtr<CFDictionaryRef> > m_CFStringAttributes;
#endif
-#if PLATFORM(WIN)
+#if PLATFORM(WIN) || (OS(WINDOWS) && PLATFORM(WX))
bool m_isSystemFont;
#if !OS(WINCE) // disable unused members to save space
mutable SCRIPT_CACHE m_scriptCache;
diff --git a/WebCore/platform/graphics/cairo/FontCairo.cpp b/WebCore/platform/graphics/cairo/FontCairo.cpp
index 3bfa8f3..169c74c 100644
--- a/WebCore/platform/graphics/cairo/FontCairo.cpp
+++ b/WebCore/platform/graphics/cairo/FontCairo.cpp
@@ -29,13 +29,13 @@
#include "config.h"
#include "Font.h"
+#include "AffineTransform.h"
#include "GlyphBuffer.h"
#include "Gradient.h"
#include "GraphicsContext.h"
#include "ImageBuffer.h"
#include "Pattern.h"
#include "SimpleFontData.h"
-#include "TransformationMatrix.h"
#define SYNTHETIC_OBLIQUE_ANGLE 14
@@ -136,7 +136,7 @@ void Font::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, cons
cairo_pop_group_to_source(cr);
}
} else if (context->fillPattern()) {
- TransformationMatrix affine;
+ AffineTransform affine;
cairo_set_source(cr, context->fillPattern()->createPlatformPattern(affine));
if (context->getAlpha() < 1.0f) {
cairo_push_group(cr);
@@ -166,7 +166,7 @@ void Font::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, cons
cairo_pop_group_to_source(cr);
}
} else if (context->strokePattern()) {
- TransformationMatrix affine;
+ AffineTransform affine;
cairo_set_source(cr, context->strokePattern()->createPlatformPattern(affine));
if (context->getAlpha() < 1.0f) {
cairo_push_group(cr);
diff --git a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
index ccbbf3b..0aa6b83 100644
--- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
+++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
@@ -45,7 +45,6 @@
#include "Pattern.h"
#include "SimpleFontData.h"
#include "SourceGraphic.h"
-#include "TransformationMatrix.h"
#include <cairo.h>
#include <math.h>
@@ -78,7 +77,7 @@ static inline void setPlatformFill(GraphicsContext* context, cairo_t* cr, Graphi
{
cairo_save(cr);
if (gcp->state.fillPattern) {
- TransformationMatrix affine;
+ AffineTransform affine;
cairo_set_source(cr, gcp->state.fillPattern->createPlatformPattern(affine));
} else if (gcp->state.fillGradient)
cairo_set_source(cr, gcp->state.fillGradient->platformGradient());
@@ -93,7 +92,7 @@ static inline void setPlatformStroke(GraphicsContext* context, cairo_t* cr, Grap
{
cairo_save(cr);
if (gcp->state.strokePattern) {
- TransformationMatrix affine;
+ AffineTransform affine;
cairo_set_source(cr, gcp->state.strokePattern->createPlatformPattern(affine));
} else if (gcp->state.strokeGradient)
cairo_set_source(cr, gcp->state.strokeGradient->platformGradient());
@@ -209,15 +208,7 @@ GraphicsContext::~GraphicsContext()
delete m_data;
}
-TransformationMatrix GraphicsContext::getCTM() const
-{
- cairo_t* cr = platformContext();
- cairo_matrix_t m;
- cairo_get_matrix(cr, &m);
- return TransformationMatrix(m.xx, m.yx, m.xy, m.yy, m.x0, m.y0);
-}
-
-AffineTransform GraphicsContext::getAffineCTM() const
+AffineTransform GraphicsContext::getCTM() const
{
cairo_t* cr = platformContext();
cairo_matrix_t m;
@@ -800,17 +791,6 @@ void GraphicsContext::setURLForRect(const KURL& link, const IntRect& destRect)
notImplemented();
}
-void GraphicsContext::concatCTM(const TransformationMatrix& transform)
-{
- if (paintingDisabled())
- return;
-
- cairo_t* cr = m_data->cr;
- const cairo_matrix_t matrix = cairo_matrix_t(transform);
- cairo_transform(cr, &matrix);
- m_data->concatCTM(transform);
-}
-
void GraphicsContext::concatCTM(const AffineTransform& transform)
{
if (paintingDisabled())
diff --git a/WebCore/platform/graphics/cairo/ImageCairo.cpp b/WebCore/platform/graphics/cairo/ImageCairo.cpp
index 92e36fc..e74c495 100644
--- a/WebCore/platform/graphics/cairo/ImageCairo.cpp
+++ b/WebCore/platform/graphics/cairo/ImageCairo.cpp
@@ -30,12 +30,12 @@
#if PLATFORM(CAIRO)
+#include "AffineTransform.h"
#include "Color.h"
#include "FloatRect.h"
#include "GraphicsContext.h"
#include "ImageBuffer.h"
#include "ImageObserver.h"
-#include "TransformationMatrix.h"
#include <cairo.h>
#include <math.h>
#include <wtf/OwnPtr.h>
@@ -170,7 +170,7 @@ void BitmapImage::draw(GraphicsContext* context, const FloatRect& dst, const Flo
imageObserver()->didDraw(this);
}
-void Image::drawPattern(GraphicsContext* context, const FloatRect& tileRect, const TransformationMatrix& patternTransform,
+void Image::drawPattern(GraphicsContext* context, const FloatRect& tileRect, const AffineTransform& patternTransform,
const FloatPoint& phase, ColorSpace, CompositeOperator op, const FloatRect& destRect)
{
cairo_surface_t* image = nativeImageForCurrentFrame();
diff --git a/WebCore/platform/graphics/cairo/PathCairo.cpp b/WebCore/platform/graphics/cairo/PathCairo.cpp
index a265937..bc68b37 100644
--- a/WebCore/platform/graphics/cairo/PathCairo.cpp
+++ b/WebCore/platform/graphics/cairo/PathCairo.cpp
@@ -26,7 +26,6 @@
#include "Path.h"
#include "AffineTransform.h"
-#include "TransformationMatrix.h"
#include "CairoPath.h"
#include "FloatRect.h"
#include "GraphicsContext.h"
@@ -335,14 +334,6 @@ void Path::transform(const AffineTransform& trans)
cairo_transform(m_cr, &c_matrix);
}
-void Path::transform(const TransformationMatrix& trans)
-{
- cairo_t* m_cr = platformPath()->m_cr;
- cairo_matrix_t c_matrix = cairo_matrix_t(trans);
- cairo_matrix_invert(&c_matrix);
- cairo_transform(m_cr, &c_matrix);
-}
-
String Path::debugString() const
{
if (isEmpty())
diff --git a/WebCore/platform/graphics/cairo/PatternCairo.cpp b/WebCore/platform/graphics/cairo/PatternCairo.cpp
index 58c5d00..b067acc 100644
--- a/WebCore/platform/graphics/cairo/PatternCairo.cpp
+++ b/WebCore/platform/graphics/cairo/PatternCairo.cpp
@@ -26,14 +26,14 @@
#include "config.h"
#include "Pattern.h"
+#include "AffineTransform.h"
#include "GraphicsContext.h"
-#include "TransformationMatrix.h"
#include <cairo.h>
namespace WebCore {
-cairo_pattern_t* Pattern::createPlatformPattern(const TransformationMatrix&) const
+cairo_pattern_t* Pattern::createPlatformPattern(const AffineTransform&) const
{
cairo_surface_t* surface = tileImage()->nativeImageForCurrentFrame();
if (!surface)
diff --git a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
index a339982..2e3f829 100644
--- a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
+++ b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
@@ -36,7 +36,6 @@
#include "KURL.h"
#include "Path.h"
#include "Pattern.h"
-#include "TransformationMatrix.h"
#include <CoreGraphics/CGBitmapContext.h>
#include <CoreGraphics/CGPDFContext.h>
@@ -126,6 +125,23 @@ static void setCGStrokeColorSpace(CGContextRef context, ColorSpace colorSpace)
}
}
+CGColorSpaceRef deviceRGBColorSpaceRef()
+{
+ static CGColorSpaceRef deviceSpace = CGColorSpaceCreateDeviceRGB();
+ return deviceSpace;
+}
+
+CGColorSpaceRef sRGBColorSpaceRef()
+{
+ // FIXME: Windows should be able to use kCGColorSpaceSRGB, this is tracked by http://webkit.org/b/31363.
+#if PLATFORM(WIN) || defined(BUILDING_ON_TIGER)
+ return deviceRGBColorSpaceRef();
+#else
+ static CGColorSpaceRef sRGBSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
+ return sRGBSpace;
+#endif
+}
+
GraphicsContext::GraphicsContext(CGContextRef cgContext)
: m_common(createGraphicsContextPrivate())
, m_data(new GraphicsContextPlatformPrivate(cgContext))
@@ -968,27 +984,12 @@ void GraphicsContext::concatCTM(const AffineTransform& transform)
m_data->m_userToDeviceTransformKnownToBeIdentity = false;
}
-void GraphicsContext::concatCTM(const TransformationMatrix& transform)
-{
- if (paintingDisabled())
- return;
- CGContextConcatCTM(platformContext(), transform);
- m_data->concatCTM(transform);
- m_data->m_userToDeviceTransformKnownToBeIdentity = false;
-}
-
-AffineTransform GraphicsContext::getAffineCTM() const
+AffineTransform GraphicsContext::getCTM() const
{
CGAffineTransform t = CGContextGetCTM(platformContext());
return AffineTransform(t.a, t.b, t.c, t.d, t.tx, t.ty);
}
-TransformationMatrix GraphicsContext::getCTM() const
-{
- CGAffineTransform t = CGContextGetCTM(platformContext());
- return TransformationMatrix(t.a, t.b, t.c, t.d, t.tx, t.ty);
-}
-
FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& rect)
{
// It is not enough just to round to pixels in device space. The rotation part of the
diff --git a/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h b/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h
index 7b80d5b..b1efba1 100644
--- a/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h
+++ b/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h
@@ -28,23 +28,10 @@
namespace WebCore {
// FIXME: This would be in GraphicsContextCG.h if that existed.
-inline CGColorSpaceRef deviceRGBColorSpaceRef()
-{
- static CGColorSpaceRef deviceSpace = CGColorSpaceCreateDeviceRGB();
- return deviceSpace;
-}
+CGColorSpaceRef deviceRGBColorSpaceRef();
// FIXME: This would be in GraphicsContextCG.h if that existed.
-inline CGColorSpaceRef sRGBColorSpaceRef()
-{
- // FIXME: Windows should be able to use kCGColorSpaceSRGB, this is tracked by http://webkit.org/b/31363.
-#if PLATFORM(WIN) || defined(BUILDING_ON_TIGER)
- return deviceRGBColorSpaceRef();
-#else
- static CGColorSpaceRef sRGBSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
- return sRGBSpace;
-#endif
-}
+CGColorSpaceRef sRGBColorSpaceRef();
class GraphicsContextPlatformPrivate {
public:
@@ -74,7 +61,6 @@ public:
void rotate(float) {}
void translate(float, float) {}
void concatCTM(const AffineTransform&) {}
- void concatCTM(const TransformationMatrix&) {}
void beginTransparencyLayer() {}
void endTransparencyLayer() {}
#endif
@@ -90,7 +76,6 @@ public:
void rotate(float);
void translate(float, float);
void concatCTM(const AffineTransform&);
- void concatCTM(const TransformationMatrix&);
void beginTransparencyLayer() { m_transparencyCount++; }
void endTransparencyLayer() { m_transparencyCount--; }
diff --git a/WebCore/platform/graphics/cg/ImageBufferCG.cpp b/WebCore/platform/graphics/cg/ImageBufferCG.cpp
index b1896f8..0dc7a53 100644
--- a/WebCore/platform/graphics/cg/ImageBufferCG.cpp
+++ b/WebCore/platform/graphics/cg/ImageBufferCG.cpp
@@ -280,34 +280,19 @@ String ImageBuffer::toDataURL(const String& mimeType) const
if (!image)
return "data:,";
- size_t width = CGImageGetWidth(image.get());
- size_t height = CGImageGetHeight(image.get());
-
- OwnArrayPtr<uint32_t> imageData(new uint32_t[width * height]);
- if (!imageData)
- return "data:,";
-
- RetainPtr<CGImageRef> transformedImage(AdoptCF, CGBitmapContextCreateImage(context()->platformContext()));
- if (!transformedImage)
+ RetainPtr<CFMutableDataRef> data(AdoptCF, CFDataCreateMutable(kCFAllocatorDefault, 0));
+ if (!data)
return "data:,";
- RetainPtr<CFMutableDataRef> transformedImageData(AdoptCF, CFDataCreateMutable(kCFAllocatorDefault, 0));
- if (!transformedImageData)
+ RetainPtr<CGImageDestinationRef> destination(AdoptCF, CGImageDestinationCreateWithData(data.get(), utiFromMIMEType(mimeType).get(), 1, 0));
+ if (!destination)
return "data:,";
- RetainPtr<CGImageDestinationRef> imageDestination(AdoptCF, CGImageDestinationCreateWithData(transformedImageData.get(),
- utiFromMIMEType(mimeType).get(), 1, 0));
- if (!imageDestination)
- return "data:,";
-
- CGImageDestinationAddImage(imageDestination.get(), transformedImage.get(), 0);
- CGImageDestinationFinalize(imageDestination.get());
-
- Vector<char> in;
- in.append(CFDataGetBytePtr(transformedImageData.get()), CFDataGetLength(transformedImageData.get()));
+ CGImageDestinationAddImage(destination.get(), image.get(), 0);
+ CGImageDestinationFinalize(destination.get());
Vector<char> out;
- base64Encode(in, out);
+ base64Encode(reinterpret_cast<const char*>(CFDataGetBytePtr(data.get())), CFDataGetLength(data.get()), out);
out.append('\0');
return String::format("data:%s;base64,%s", mimeType.utf8().data(), out.data());
diff --git a/WebCore/platform/graphics/cg/ImageCG.cpp b/WebCore/platform/graphics/cg/ImageCG.cpp
index 2e372e2..70a80a0 100644
--- a/WebCore/platform/graphics/cg/ImageCG.cpp
+++ b/WebCore/platform/graphics/cg/ImageCG.cpp
@@ -28,7 +28,7 @@
#if PLATFORM(CG)
-#include "TransformationMatrix.h"
+#include "AffineTransform.h"
#include "FloatConversion.h"
#include "FloatRect.h"
#include "GraphicsContext.h"
@@ -244,7 +244,7 @@ static void drawPatternCallback(void* info, CGContextRef context)
CGContextDrawImage(context, GraphicsContext(context).roundToDevicePixels(FloatRect(0, 0, CGImageGetWidth(image), CGImageGetHeight(image))), image);
}
-void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const TransformationMatrix& patternTransform,
+void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const AffineTransform& patternTransform,
const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect)
{
if (!nativeImageForCurrentFrame())
diff --git a/WebCore/platform/graphics/cg/PathCG.cpp b/WebCore/platform/graphics/cg/PathCG.cpp
index 01680df..81454b3 100644
--- a/WebCore/platform/graphics/cg/PathCG.cpp
+++ b/WebCore/platform/graphics/cg/PathCG.cpp
@@ -30,7 +30,6 @@
#if PLATFORM(CG)
#include "AffineTransform.h"
-#include "TransformationMatrix.h"
#include <ApplicationServices/ApplicationServices.h>
#include "FloatRect.h"
#include "GraphicsContext.h"
@@ -356,15 +355,6 @@ void Path::transform(const AffineTransform& transform)
m_path = path;
}
-void Path::transform(const TransformationMatrix& transform)
-{
- CGMutablePathRef path = CGPathCreateMutable();
- CGAffineTransform transformCG = transform;
- CGPathAddPath(path, &transformCG, m_path);
- CGPathRelease(m_path);
- m_path = path;
-}
-
}
#endif // PLATFORM(CG)
diff --git a/WebCore/platform/graphics/cg/PatternCG.cpp b/WebCore/platform/graphics/cg/PatternCG.cpp
index 26f402b..94f37b2 100644
--- a/WebCore/platform/graphics/cg/PatternCG.cpp
+++ b/WebCore/platform/graphics/cg/PatternCG.cpp
@@ -27,7 +27,7 @@
#include "config.h"
#include "Pattern.h"
-#include "TransformationMatrix.h"
+#include "AffineTransform.h"
#include "GraphicsContext.h"
#include <ApplicationServices/ApplicationServices.h>
@@ -50,11 +50,11 @@ static void patternReleaseCallback(void* info)
static_cast<Image*>(info)->deref();
}
-CGPatternRef Pattern::createPlatformPattern(const TransformationMatrix& userSpaceTransformation) const
+CGPatternRef Pattern::createPlatformPattern(const AffineTransform& userSpaceTransformation) const
{
IntRect tileRect = tileImage()->rect();
- TransformationMatrix patternTransform = m_patternSpaceTransformation;
+ AffineTransform patternTransform = m_patternSpaceTransformation;
patternTransform.multiply(userSpaceTransformation);
patternTransform.scaleNonUniform(1, -1);
patternTransform.translate(0, -tileRect.height());
diff --git a/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp b/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp
index e8fa860..8dac612 100644
--- a/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp
+++ b/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp
@@ -406,12 +406,12 @@ const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, cons
}
-FontPlatformData* FontCache::getSimilarFontPlatformData(const Font& font)
+SimpleFontData* FontCache::getSimilarFontPlatformData(const Font& font)
{
return 0;
}
-FontPlatformData* FontCache::getLastResortFallbackFont(const FontDescription& description)
+SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& description)
{
FontDescription::GenericFamilyType generic = description.genericFamily();
@@ -428,7 +428,7 @@ FontPlatformData* FontCache::getLastResortFallbackFont(const FontDescription& de
else if (generic == FontDescription::MonospaceFamily)
fontStr = courierStr;
- return getCachedFontPlatformData(description, fontStr);
+ return getCachedFontData(description, fontStr);
}
static LONG toGDIFontWeight(FontWeight fontWeight)
diff --git a/WebCore/platform/graphics/chromium/FontCacheLinux.cpp b/WebCore/platform/graphics/chromium/FontCacheLinux.cpp
index 3fe1561..03d23c7 100644
--- a/WebCore/platform/graphics/chromium/FontCacheLinux.cpp
+++ b/WebCore/platform/graphics/chromium/FontCacheLinux.cpp
@@ -66,12 +66,12 @@ const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font,
return getCachedFontData(getCachedFontPlatformData(font.fontDescription(), atomicFamily, false));
}
-FontPlatformData* FontCache::getSimilarFontPlatformData(const Font& font)
+SimpleFontData* FontCache::getSimilarFontPlatformData(const Font& font)
{
return 0;
}
-FontPlatformData* FontCache::getLastResortFallbackFont(const FontDescription& description)
+SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& description)
{
static const AtomicString sansStr("Sans");
static const AtomicString serifStr("Serif");
@@ -92,7 +92,7 @@ FontPlatformData* FontCache::getLastResortFallbackFont(const FontDescription& de
}
ASSERT(fontPlatformData);
- return fontPlatformData;
+ return getCachedFontData(fontPlatformData);
}
void FontCache::getTraitsInFamily(const AtomicString& familyName,
diff --git a/WebCore/platform/graphics/chromium/TransparencyWin.cpp b/WebCore/platform/graphics/chromium/TransparencyWin.cpp
index 80df2ec..47cc894 100644
--- a/WebCore/platform/graphics/chromium/TransparencyWin.cpp
+++ b/WebCore/platform/graphics/chromium/TransparencyWin.cpp
@@ -31,11 +31,11 @@
#include "config.h"
#include <windows.h>
+#include "AffineTransform.h"
#include "GraphicsContext.h"
#include "ImageBuffer.h"
#include "PlatformContextSkia.h"
#include "SimpleFontData.h"
-#include "TransformationMatrix.h"
#include "TransparencyWin.h"
#include "SkColorPriv.h"
@@ -61,7 +61,7 @@ inline const SkBitmap& bitmapForContext(const GraphicsContext& context)
void compositeToCopy(const GraphicsContext& sourceLayers,
GraphicsContext& destContext,
- const TransformationMatrix& matrix)
+ const AffineTransform& matrix)
{
// Make a list of all devices. The iterator goes top-down, and we want
// bottom-up. Note that each layer can also have an offset in canvas
@@ -247,7 +247,7 @@ void TransparencyWin::setupLayerForOpaqueCompositeLayer()
if (!m_validLayer)
return;
- TransformationMatrix mapping;
+ AffineTransform mapping;
mapping.translate(-m_transformedSourceRect.x(), -m_transformedSourceRect.y());
if (m_transformMode == Untransform){
// Compute the inverse mapping from the canvas space to the
@@ -307,7 +307,7 @@ void TransparencyWin::setupTransformForKeepTransform(const IntRect& region)
// Account for the fact that the layer may be offset from the
// original. This only happens when we create a layer that has the
// same coordinate space as the parent.
- TransformationMatrix xform;
+ AffineTransform xform;
xform.translate(-m_transformedSourceRect.x(), -m_transformedSourceRect.y());
// We're making a layer, so apply the old transform to the new one
diff --git a/WebCore/platform/graphics/chromium/TransparencyWin.h b/WebCore/platform/graphics/chromium/TransparencyWin.h
index ab75375..b6bef91 100644
--- a/WebCore/platform/graphics/chromium/TransparencyWin.h
+++ b/WebCore/platform/graphics/chromium/TransparencyWin.h
@@ -33,9 +33,9 @@
#include <windows.h>
+#include "AffineTransform.h"
#include "ImageBuffer.h"
#include "Noncopyable.h"
-#include "TransformationMatrix.h"
#include "wtf/OwnPtr.h"
class SkBitmap;
@@ -193,7 +193,7 @@ private:
GraphicsContext* m_destContext;
// The original transform from the destination context.
- TransformationMatrix m_orgTransform;
+ AffineTransform m_orgTransform;
LayerMode m_layerMode;
TransformMode m_transformMode;
diff --git a/WebCore/platform/graphics/gtk/FontCacheGtk.cpp b/WebCore/platform/graphics/gtk/FontCacheGtk.cpp
index e0b88da..d2b2f39 100644
--- a/WebCore/platform/graphics/gtk/FontCacheGtk.cpp
+++ b/WebCore/platform/graphics/gtk/FontCacheGtk.cpp
@@ -59,17 +59,17 @@ const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, cons
return 0;
}
-FontPlatformData* FontCache::getSimilarFontPlatformData(const Font& font)
+SimpleFontData* FontCache::getSimilarFontPlatformData(const Font& font)
{
return 0;
}
-FontPlatformData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription)
+SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription)
{
// FIXME: Would be even better to somehow get the user's default font here.
// For now we'll pick the default that the user would get without changing any prefs.
static AtomicString timesStr("Times New Roman");
- return getCachedFontPlatformData(fontDescription, timesStr);
+ return getCachedFontData(fontDescription, timesStr);
}
void FontCache::getTraitsInFamily(const AtomicString& familyName, Vector<unsigned>& traitsMasks)
diff --git a/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp b/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp
index 0372021..1866c36 100644
--- a/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp
+++ b/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp
@@ -43,6 +43,7 @@
#include "SecurityOrigin.h"
#include "TimeRanges.h"
#include "VideoSinkGStreamer.h"
+#include "WebKitWebSourceGStreamer.h"
#include "Widget.h"
#include <gst/gst.h>
@@ -137,55 +138,12 @@ void mediaPlayerPrivateSourceChangedCallback(GObject *object, GParamSpec *pspec,
g_object_get(mp->m_playBin, "source", &element.outPtr(), NULL);
gst_object_replace((GstObject**) &mp->m_source, (GstObject*) element.get());
- if (!element)
- return;
-
- GOwnPtr<char> location;
- g_object_get(element.get(), "location", &location.outPtr(), NULL);
-
- // Do injection only for elements dealing with uris.
- if (!gst_uri_is_valid(location.get()))
- return;
+ if (WEBKIT_IS_WEB_SRC(element.get())) {
+ Frame* frame = mp->m_player->frameView() ? mp->m_player->frameView()->frame() : 0;
- GOwnPtr<SoupURI> uri(soup_uri_new(location.get()));
-
- // Do injection only for http(s) uris.
- if (!SOUP_URI_VALID_FOR_HTTP(uri))
- return;
-
- // Let Apple web servers know we want to access their nice movie trailers.
- if (g_str_equal(uri->host, "movies.apple.com"))
- g_object_set(element.get(), "user-agent", "Quicktime/7.2.0", NULL);
-
- // Set the HTTP referer.
- Frame* frame = mp->m_player->frameView() ? mp->m_player->frameView()->frame() : 0;
- Document* document = frame ? frame->document() : 0;
- if (document) {
- GstStructure* extraHeaders = gst_structure_new("extra-headers",
- "Referer", G_TYPE_STRING,
- document->documentURI().utf8().data(), 0);
- g_object_set(element.get(), "extra-headers", extraHeaders, NULL);
- gst_structure_free(extraHeaders);
+ if (frame)
+ webKitWebSrcSetFrame(WEBKIT_WEB_SRC(element.get()), frame);
}
-
- // Deal with the cookies from now on.
- GParamSpec* cookiesParamSpec = g_object_class_find_property(G_OBJECT_GET_CLASS(element.get()), "cookies");
-
- // First check if the source element has a cookies property
- // of the format we expect
- if (!cookiesParamSpec || cookiesParamSpec->value_type != G_TYPE_STRV)
- return;
-
- // Then get the cookies for the URI and set them
- SoupSession* session = webkit_get_default_session();
- SoupSessionFeature* cookieJarFeature = soup_session_get_feature(session, SOUP_TYPE_COOKIE_JAR);
- if (!cookieJarFeature)
- return;
-
- SoupCookieJar* cookieJar = SOUP_COOKIE_JAR(cookieJarFeature);
- GOwnPtr<char> cookies(soup_cookie_jar_get_cookies(cookieJar, uri.get(), FALSE));
- char* cookiesStrv[] = {cookies.get(), 0};
- g_object_set(element.get(), "cookies", cookiesStrv, NULL);
}
void mediaPlayerPrivateVolumeChangedCallback(GObject *element, GParamSpec *pspec, gpointer data)
@@ -270,12 +228,15 @@ static bool doGstInit()
if (!gstInitialized) {
GOwnPtr<GError> error;
gstInitialized = gst_init_check(0, 0, &error.outPtr());
- if (!gstInitialized)
+ if (!gstInitialized) {
LOG_VERBOSE(Media, "Could not initialize GStreamer: %s",
error ? error->message : "unknown error occurred");
- else
+ } else {
gst_element_register(0, "webkitmediasrc", GST_RANK_PRIMARY,
WEBKIT_TYPE_DATA_SRC);
+ gst_element_register(0, "webkitwebsrc", GST_RANK_PRIMARY + 100,
+ WEBKIT_TYPE_WEB_SRC);
+ }
}
return gstInitialized;
diff --git a/WebCore/platform/graphics/gtk/WebKitWebSourceGStreamer.cpp b/WebCore/platform/graphics/gtk/WebKitWebSourceGStreamer.cpp
new file mode 100644
index 0000000..390c0ec
--- /dev/null
+++ b/WebCore/platform/graphics/gtk/WebKitWebSourceGStreamer.cpp
@@ -0,0 +1,726 @@
+/*
+ * Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ *
+ * 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 "WebKitWebSourceGStreamer.h"
+
+#include "CString.h"
+#include "Document.h"
+#include "GOwnPtr.h"
+#include "GRefPtr.h"
+#include "Noncopyable.h"
+#include "NotImplemented.h"
+#include "ResourceHandleClient.h"
+#include "ResourceHandleInternal.h"
+#include "ResourceRequest.h"
+#include "ResourceResponse.h"
+#include <gst/app/gstappsrc.h>
+#include <gst/pbutils/missing-plugins.h>
+
+using namespace WebCore;
+
+class StreamingClient : public Noncopyable, public ResourceHandleClient {
+ public:
+ StreamingClient(WebKitWebSrc*);
+ virtual ~StreamingClient();
+
+ virtual void willSendRequest(ResourceHandle*, ResourceRequest&, const ResourceResponse&);
+ virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&);
+ virtual void didReceiveData(ResourceHandle*, const char*, int, int);
+ virtual void didFinishLoading(ResourceHandle*);
+ virtual void didFail(ResourceHandle*, const ResourceError&);
+ virtual void wasBlocked(ResourceHandle*);
+ virtual void cannotShowURL(ResourceHandle*);
+
+ private:
+ WebKitWebSrc* m_src;
+};
+
+#define WEBKIT_WEB_SRC_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_SRC, WebKitWebSrcPrivate))
+struct _WebKitWebSrcPrivate {
+ GstAppSrc* appsrc;
+ GstPad* srcpad;
+ gchar* uri;
+
+ RefPtr<WebCore::Frame> frame;
+
+ StreamingClient* client;
+ RefPtr<ResourceHandle> resourceHandle;
+
+ guint64 offset;
+ guint64 size;
+ gboolean seekable;
+ gboolean paused;
+
+ guint64 requestedOffset;
+
+ guint needDataID;
+ guint enoughDataID;
+ guint seekID;
+
+ // icecast stuff
+ gboolean iradioMode;
+ gchar* iradioName;
+ gchar* iradioGenre;
+ gchar* iradioUrl;
+ gchar* iradioTitle;
+};
+
+enum {
+ PROP_IRADIO_MODE = 1,
+ PROP_IRADIO_NAME,
+ PROP_IRADIO_GENRE,
+ PROP_IRADIO_URL,
+ PROP_IRADIO_TITLE
+};
+
+static GstStaticPadTemplate srcTemplate = GST_STATIC_PAD_TEMPLATE("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS_ANY);
+
+GST_DEBUG_CATEGORY_STATIC(webkit_web_src_debug);
+#define GST_CAT_DEFAULT webkit_web_src_debug
+
+static void webKitWebSrcUriHandlerInit(gpointer gIface,
+ gpointer ifaceData);
+
+static void webKitWebSrcFinalize(GObject* object);
+static void webKitWebSrcSetProperty(GObject* object, guint propID, const GValue* value, GParamSpec* pspec);
+static void webKitWebSrcGetProperty(GObject* object, guint propID, GValue* value, GParamSpec* pspec);
+static GstStateChangeReturn webKitWebSrcChangeState(GstElement* element, GstStateChange transition);
+
+static void webKitWebSrcNeedDataCb(GstAppSrc* appsrc, guint length, gpointer userData);
+static void webKitWebSrcEnoughDataCb(GstAppSrc* appsrc, gpointer userData);
+static gboolean webKitWebSrcSeekDataCb(GstAppSrc* appsrc, guint64 offset, gpointer userData);
+
+static void webKitWebSrcStop(WebKitWebSrc* src, bool resetRequestedOffset);
+
+static GstAppSrcCallbacks appsrcCallbacks = {
+ webKitWebSrcNeedDataCb,
+ webKitWebSrcEnoughDataCb,
+ webKitWebSrcSeekDataCb,
+ { 0 }
+};
+
+static void doInit(GType gtype)
+{
+ static const GInterfaceInfo uriHandlerInfo = {
+ webKitWebSrcUriHandlerInit,
+ 0, 0
+ };
+
+ GST_DEBUG_CATEGORY_INIT(webkit_web_src_debug, "webkitwebsrc", 0, "websrc element");
+ g_type_add_interface_static(gtype, GST_TYPE_URI_HANDLER,
+ &uriHandlerInfo);
+}
+
+GST_BOILERPLATE_FULL(WebKitWebSrc, webkit_web_src, GstBin, GST_TYPE_BIN, doInit);
+
+static void webkit_web_src_base_init(gpointer klass)
+{
+ GstElementClass* eklass = GST_ELEMENT_CLASS(klass);
+
+ gst_element_class_add_pad_template(eklass,
+ gst_static_pad_template_get(&srcTemplate));
+ gst_element_class_set_details_simple(eklass,
+ (gchar*) "WebKit Web source element",
+ (gchar*) "Source",
+ (gchar*) "Handles HTTP/HTTPS uris",
+ (gchar*) "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
+}
+
+static void webkit_web_src_class_init(WebKitWebSrcClass* klass)
+{
+ GObjectClass* oklass = G_OBJECT_CLASS(klass);
+ GstElementClass* eklass = GST_ELEMENT_CLASS(klass);
+
+ oklass->finalize = webKitWebSrcFinalize;
+ oklass->set_property = webKitWebSrcSetProperty;
+ oklass->get_property = webKitWebSrcGetProperty;
+
+ // icecast stuff
+ g_object_class_install_property(oklass,
+ PROP_IRADIO_MODE,
+ g_param_spec_boolean("iradio-mode",
+ "iradio-mode",
+ "Enable internet radio mode (extraction of shoutcast/icecast metadata)",
+ FALSE,
+ (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
+
+ g_object_class_install_property(oklass,
+ PROP_IRADIO_NAME,
+ g_param_spec_string("iradio-name",
+ "iradio-name",
+ "Name of the stream",
+ 0,
+ (GParamFlags) (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)));
+
+ g_object_class_install_property(oklass,
+ PROP_IRADIO_GENRE,
+ g_param_spec_string("iradio-genre",
+ "iradio-genre",
+ "Genre of the stream",
+ 0,
+ (GParamFlags) (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)));
+
+ g_object_class_install_property(oklass,
+ PROP_IRADIO_URL,
+ g_param_spec_string("iradio-url",
+ "iradio-url",
+ "Homepage URL for radio stream",
+ 0,
+ (GParamFlags) (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)));
+
+ g_object_class_install_property(oklass,
+ PROP_IRADIO_TITLE,
+ g_param_spec_string("iradio-title",
+ "iradio-title",
+ "Name of currently playing song",
+ 0,
+ (GParamFlags) (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)));
+
+ eklass->change_state = webKitWebSrcChangeState;
+
+ g_type_class_add_private(klass, sizeof(WebKitWebSrcPrivate));
+}
+
+static void webkit_web_src_init(WebKitWebSrc* src,
+ WebKitWebSrcClass* gKlass)
+{
+ GstPadTemplate* padTemplate = gst_static_pad_template_get(&srcTemplate);
+ GstPad* targetpad;
+ WebKitWebSrcPrivate* priv = WEBKIT_WEB_SRC_GET_PRIVATE(src);
+
+ src->priv = priv;
+
+ priv->client = new StreamingClient(src);
+
+ priv->srcpad = gst_ghost_pad_new_no_target_from_template("src",
+ padTemplate);
+
+ gst_element_add_pad(GST_ELEMENT(src), priv->srcpad);
+
+ priv->appsrc = GST_APP_SRC(gst_element_factory_make("appsrc", 0));
+ if (!priv->appsrc) {
+ GST_ERROR_OBJECT(src, "Failed to create appsrc");
+ return;
+ }
+
+ gst_bin_add(GST_BIN(src), GST_ELEMENT(priv->appsrc));
+
+ targetpad = gst_element_get_static_pad(GST_ELEMENT(priv->appsrc), "src");
+ gst_ghost_pad_set_target(GST_GHOST_PAD(priv->srcpad), targetpad);
+ gst_object_unref(targetpad);
+
+ gst_app_src_set_callbacks(priv->appsrc, &appsrcCallbacks, src, 0);
+ gst_app_src_set_emit_signals(priv->appsrc, FALSE);
+ gst_app_src_set_stream_type(priv->appsrc, GST_APP_STREAM_TYPE_SEEKABLE);
+
+ // 512k is a abitrary number but we should choose a value
+ // here to not pause/unpause the SoupMessage too often and
+ // to make sure there's always some data available for
+ // GStreamer to handle.
+ gst_app_src_set_max_bytes(priv->appsrc, 512 * 1024);
+
+ webKitWebSrcStop(src, true);
+}
+
+static void webKitWebSrcFinalize(GObject* object)
+{
+ WebKitWebSrc* src = WEBKIT_WEB_SRC(object);
+ WebKitWebSrcPrivate* priv = src->priv;
+
+ delete priv->client;
+
+ g_free(priv->uri);
+
+ GST_CALL_PARENT(G_OBJECT_CLASS, finalize, ((GObject* )(src)));
+}
+
+static void webKitWebSrcSetProperty(GObject* object, guint propID, const GValue* value, GParamSpec* pspec)
+{
+ WebKitWebSrc* src = WEBKIT_WEB_SRC(object);
+ WebKitWebSrcPrivate* priv = src->priv;
+
+ switch (propID) {
+ case PROP_IRADIO_MODE:
+ priv->iradioMode = g_value_get_boolean(value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, pspec);
+ break;
+ }
+}
+
+static void webKitWebSrcGetProperty(GObject* object, guint propID, GValue* value, GParamSpec* pspec)
+{
+ WebKitWebSrc* src = WEBKIT_WEB_SRC(object);
+ WebKitWebSrcPrivate* priv = src->priv;
+
+ switch (propID) {
+ case PROP_IRADIO_MODE:
+ g_value_set_boolean(value, priv->iradioMode);
+ break;
+ case PROP_IRADIO_NAME:
+ g_value_set_string(value, priv->iradioName);
+ break;
+ case PROP_IRADIO_GENRE:
+ g_value_set_string(value, priv->iradioGenre);
+ break;
+ case PROP_IRADIO_URL:
+ g_value_set_string(value, priv->iradioUrl);
+ break;
+ case PROP_IRADIO_TITLE:
+ g_value_set_string(value, priv->iradioTitle);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, pspec);
+ break;
+ }
+}
+
+
+static void webKitWebSrcStop(WebKitWebSrc* src, bool resetRequestedOffset)
+{
+ WebKitWebSrcPrivate* priv = src->priv;
+
+ if (priv->resourceHandle) {
+ priv->resourceHandle->cancel();
+ priv->resourceHandle.release();
+ }
+ priv->resourceHandle = 0;
+
+ if (priv->frame)
+ priv->frame.release();
+
+ if (priv->needDataID)
+ g_source_remove(priv->needDataID);
+ priv->needDataID = 0;
+
+ if (priv->enoughDataID)
+ g_source_remove(priv->enoughDataID);
+ priv->enoughDataID = 0;
+
+ if (priv->seekID)
+ g_source_remove(priv->seekID);
+ priv->seekID = 0;
+
+ priv->paused = FALSE;
+
+ g_free(priv->iradioName);
+ priv->iradioName = 0;
+
+ g_free(priv->iradioGenre);
+ priv->iradioGenre = 0;
+
+ g_free(priv->iradioUrl);
+ priv->iradioUrl = 0;
+
+ g_free(priv->iradioTitle);
+ priv->iradioTitle = 0;
+
+ if (priv->appsrc)
+ gst_app_src_set_caps(priv->appsrc, 0);
+
+ priv->offset = 0;
+ priv->size = 0;
+ priv->seekable = FALSE;
+
+ if (resetRequestedOffset)
+ priv->requestedOffset = 0;
+
+ GST_DEBUG_OBJECT(src, "Stopped request");
+}
+
+static bool webKitWebSrcStart(WebKitWebSrc* src)
+{
+ WebKitWebSrcPrivate* priv = src->priv;
+
+ if (!priv->uri) {
+ GST_ERROR_OBJECT(src, "No URI provided");
+ return false;
+ }
+
+ KURL url = KURL(KURL(), priv->uri);
+
+ ResourceRequest request(url);
+ request.setTargetType(ResourceRequestBase::TargetIsMedia);
+ request.setAllowCookies(true);
+
+ // Let Apple web servers know we want to access their nice movie trailers.
+ if (!g_ascii_strcasecmp("movies.apple.com", url.host().utf8().data()))
+ request.setHTTPUserAgent("Quicktime/7.2.0");
+
+ if (priv->frame) {
+ Document* document = priv->frame->document();
+ if (document)
+ request.setHTTPReferrer(document->documentURI());
+
+ FrameLoader* loader = priv->frame->loader();
+ if (loader)
+ loader->addExtraFieldsToSubresourceRequest(request);
+ }
+
+ if (priv->requestedOffset) {
+ GOwnPtr<gchar> val;
+
+ val.set(g_strdup_printf("bytes=%" G_GUINT64_FORMAT "-", priv->requestedOffset));
+ request.setHTTPHeaderField("Range", val.get());
+ }
+
+ if (priv->iradioMode)
+ request.setHTTPHeaderField("icy-metadata", "1");
+
+ // Needed to use DLNA streaming servers
+ request.setHTTPHeaderField("transferMode.dlna", "Streaming");
+
+ priv->resourceHandle = ResourceHandle::create(request, priv->client, 0, false, false, false);
+ if (!priv->resourceHandle) {
+ GST_ERROR_OBJECT(src, "Failed to create ResourceHandle");
+ return false;
+ }
+
+ GST_DEBUG_OBJECT(src, "Started request");
+
+ return true;
+}
+
+static GstStateChangeReturn webKitWebSrcChangeState(GstElement* element, GstStateChange transition)
+{
+ GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
+ WebKitWebSrc* src = WEBKIT_WEB_SRC(element);
+ WebKitWebSrcPrivate* priv = src->priv;
+
+ switch (transition) {
+ case GST_STATE_CHANGE_NULL_TO_READY:
+ if (!priv->appsrc) {
+ gst_element_post_message(element,
+ gst_missing_element_message_new(element, "appsrc"));
+ GST_ELEMENT_ERROR(src, CORE, MISSING_PLUGIN, (0), ("no appsrc"));
+ return GST_STATE_CHANGE_FAILURE;
+ }
+ break;
+ default:
+ break;
+ }
+
+ ret = GST_ELEMENT_CLASS(parent_class)->change_state(element, transition);
+ if (G_UNLIKELY(ret == GST_STATE_CHANGE_FAILURE)) {
+ GST_DEBUG_OBJECT(src, "State change failed");
+ return ret;
+ }
+
+ switch (transition) {
+ case GST_STATE_CHANGE_READY_TO_PAUSED:
+ GST_DEBUG_OBJECT(src, "READY->PAUSED");
+ if (!webKitWebSrcStart(src))
+ ret = GST_STATE_CHANGE_FAILURE;
+ break;
+ case GST_STATE_CHANGE_PAUSED_TO_READY:
+ GST_DEBUG_OBJECT(src, "PAUSED->READY");
+ webKitWebSrcStop(src, true);
+ break;
+ default:
+ break;
+ }
+
+ return ret;
+}
+
+// uri handler interface
+
+static GstURIType webKitWebSrcUriGetType(void)
+{
+ return GST_URI_SRC;
+}
+
+static gchar** webKitWebSrcGetProtocols(void)
+{
+ static gchar* protocols[] = {(gchar*) "http", (gchar*) "https", 0 };
+
+ return protocols;
+}
+
+static const gchar* webKitWebSrcGetUri(GstURIHandler* handler)
+{
+ WebKitWebSrc* src = WEBKIT_WEB_SRC(handler);
+ WebKitWebSrcPrivate* priv = src->priv;
+
+ return priv->uri;
+}
+
+static gboolean webKitWebSrcSetUri(GstURIHandler* handler, const gchar* uri)
+{
+ WebKitWebSrc* src = WEBKIT_WEB_SRC(handler);
+ WebKitWebSrcPrivate* priv = src->priv;
+
+ if (GST_STATE(src) >= GST_STATE_PAUSED) {
+ GST_ERROR_OBJECT(src, "URI can only be set in states < PAUSED");
+ return FALSE;
+ }
+
+ g_free(priv->uri);
+ priv->uri = 0;
+
+ if (!uri)
+ return TRUE;
+
+ SoupURI* soupUri = soup_uri_new(uri);
+
+ if (!soupUri || !SOUP_URI_VALID_FOR_HTTP(soupUri)) {
+ GST_ERROR_OBJECT(src, "Invalid URI '%s'", uri);
+ soup_uri_free(soupUri);
+ return FALSE;
+ }
+
+ priv->uri = soup_uri_to_string(soupUri, FALSE);
+ soup_uri_free(soupUri);
+
+ return TRUE;
+}
+
+static void webKitWebSrcUriHandlerInit(gpointer gIface, gpointer ifaceData)
+{
+ GstURIHandlerInterface* iface = (GstURIHandlerInterface *) gIface;
+
+ iface->get_type = webKitWebSrcUriGetType;
+ iface->get_protocols = webKitWebSrcGetProtocols;
+ iface->get_uri = webKitWebSrcGetUri;
+ iface->set_uri = webKitWebSrcSetUri;
+}
+
+// appsrc callbacks
+
+static gboolean webKitWebSrcNeedDataMainCb(WebKitWebSrc* src)
+{
+ WebKitWebSrcPrivate* priv = src->priv;
+
+ ResourceHandleInternal* d = priv->resourceHandle->getInternal();
+ if (d->m_msg)
+ soup_session_unpause_message(ResourceHandle::defaultSession(), d->m_msg);
+
+ priv->paused = FALSE;
+ priv->needDataID = 0;
+ return FALSE;
+}
+
+static void webKitWebSrcNeedDataCb(GstAppSrc* appsrc, guint length, gpointer userData)
+{
+ WebKitWebSrc* src = WEBKIT_WEB_SRC(userData);
+ WebKitWebSrcPrivate* priv = src->priv;
+
+ GST_DEBUG_OBJECT(src, "Need more data: %u", length);
+ if (priv->needDataID || !priv->paused)
+ return;
+
+ priv->needDataID = g_timeout_add_full(G_PRIORITY_HIGH, 0, (GSourceFunc) webKitWebSrcNeedDataMainCb, gst_object_ref(src), (GDestroyNotify) gst_object_unref);
+}
+
+static gboolean webKitWebSrcEnoughDataMainCb(WebKitWebSrc* src)
+{
+ WebKitWebSrcPrivate* priv = src->priv;
+
+ ResourceHandleInternal* d = priv->resourceHandle->getInternal();
+ soup_session_pause_message(ResourceHandle::defaultSession(), d->m_msg);
+
+ priv->paused = TRUE;
+ priv->enoughDataID = 0;
+ return FALSE;
+}
+
+static void webKitWebSrcEnoughDataCb(GstAppSrc* appsrc, gpointer userData)
+{
+ WebKitWebSrc* src = WEBKIT_WEB_SRC(userData);
+ WebKitWebSrcPrivate* priv = src->priv;
+
+ GST_DEBUG_OBJECT(src, "Have enough data");
+ if (priv->enoughDataID || priv->paused)
+ return;
+
+ priv->enoughDataID = g_timeout_add_full(G_PRIORITY_HIGH, 0, (GSourceFunc) webKitWebSrcEnoughDataMainCb, gst_object_ref(src), (GDestroyNotify) gst_object_unref);
+}
+
+static gboolean webKitWebSrcSeekMainCb(WebKitWebSrc* src)
+{
+ webKitWebSrcStop(src, false);
+ webKitWebSrcStart(src);
+
+ return FALSE;
+}
+
+static gboolean webKitWebSrcSeekDataCb(GstAppSrc* appsrc, guint64 offset, gpointer userData)
+{
+ WebKitWebSrc* src = WEBKIT_WEB_SRC(userData);
+ WebKitWebSrcPrivate* priv = src->priv;
+
+ GST_DEBUG_OBJECT(src, "Seeking to offset: %" G_GUINT64_FORMAT, offset);
+ if (offset == priv->offset)
+ return TRUE;
+
+ if (!priv->seekable)
+ return FALSE;
+ if (offset > priv->size)
+ return FALSE;
+
+ GST_DEBUG_OBJECT(src, "Doing range-request seek");
+ priv->requestedOffset = offset;
+ if (priv->seekID)
+ g_source_remove(priv->seekID);
+ priv->seekID = g_timeout_add_full(G_PRIORITY_HIGH, 0, (GSourceFunc) webKitWebSrcSeekMainCb, gst_object_ref(src), (GDestroyNotify) gst_object_unref);
+
+ return TRUE;
+}
+
+void webKitWebSrcSetFrame(WebKitWebSrc* src, WebCore::Frame* frame)
+{
+ WebKitWebSrcPrivate* priv = src->priv;
+
+ priv->frame = frame;
+}
+
+StreamingClient::StreamingClient(WebKitWebSrc* src) : m_src(src)
+{
+
+}
+
+StreamingClient::~StreamingClient()
+{
+
+}
+
+void StreamingClient::willSendRequest(ResourceHandle*, ResourceRequest&, const ResourceResponse&)
+{
+}
+
+void StreamingClient::didReceiveResponse(ResourceHandle*, const ResourceResponse& response)
+{
+ WebKitWebSrcPrivate* priv = m_src->priv;
+
+ GST_DEBUG_OBJECT(m_src, "Received response: %d", response.httpStatusCode());
+
+ // If we seeked we need 206 == PARTIAL_CONTENT
+ if (priv->requestedOffset && response.httpStatusCode() != 206) {
+ GST_ELEMENT_ERROR(m_src, RESOURCE, READ, (0), (0));
+ webKitWebSrcStop(m_src, true);
+ return;
+ }
+
+ long long length = response.expectedContentLength();
+ if (length > 0) {
+ length += priv->requestedOffset;
+ gst_app_src_set_size(priv->appsrc, length);
+ }
+
+ priv->size = length >= 0 ? length : 0;
+ priv->seekable = length > 0 && g_ascii_strcasecmp("none", response.httpHeaderField("Accept-Ranges").utf8().data());
+
+ // icecast stuff
+ String value = response.httpHeaderField("icy-metaint");
+ if (!value.isEmpty()) {
+ gchar* endptr = 0;
+ gint64 icyMetaInt = g_ascii_strtoll(value.utf8().data(), &endptr, 10);
+
+ if (endptr && *endptr == '\0' && icyMetaInt > 0) {
+ GstCaps* caps = gst_caps_new_simple("application/x-icy", "metadata-interval", G_TYPE_INT, (gint) icyMetaInt, NULL);
+
+ gst_app_src_set_caps(priv->appsrc, caps);
+ gst_caps_unref(caps);
+ }
+ }
+
+ GstTagList* tags = gst_tag_list_new();
+ value = response.httpHeaderField("icy-name");
+ if (!value.isEmpty()) {
+ g_free(priv->iradioName);
+ priv->iradioName = g_strdup(value.utf8().data());
+ g_object_notify(G_OBJECT(m_src), "iradio-name");
+ gst_tag_list_add(tags, GST_TAG_MERGE_REPLACE, GST_TAG_ORGANIZATION, priv->iradioName, NULL);
+ }
+ value = response.httpHeaderField("icy-genre");
+ if (!value.isEmpty()) {
+ g_free(priv->iradioGenre);
+ priv->iradioGenre = g_strdup(value.utf8().data());
+ g_object_notify(G_OBJECT(m_src), "iradio-genre");
+ gst_tag_list_add(tags, GST_TAG_MERGE_REPLACE, GST_TAG_GENRE, priv->iradioGenre, NULL);
+ }
+ value = response.httpHeaderField("icy-url");
+ if (!value.isEmpty()) {
+ g_free(priv->iradioUrl);
+ priv->iradioUrl = g_strdup(value.utf8().data());
+ g_object_notify(G_OBJECT(m_src), "iradio-url");
+ gst_tag_list_add(tags, GST_TAG_MERGE_REPLACE, GST_TAG_LOCATION, priv->iradioUrl, NULL);
+ }
+ value = response.httpHeaderField("icy-title");
+ if (!value.isEmpty()) {
+ g_free(priv->iradioTitle);
+ priv->iradioTitle = g_strdup(value.utf8().data());
+ g_object_notify(G_OBJECT(m_src), "iradio-title");
+ gst_tag_list_add(tags, GST_TAG_MERGE_REPLACE, GST_TAG_TITLE, priv->iradioTitle, NULL);
+ }
+
+ if (gst_tag_list_is_empty(tags))
+ gst_tag_list_free(tags);
+ else
+ gst_element_found_tags_for_pad(GST_ELEMENT(m_src), m_src->priv->srcpad, tags);
+}
+
+void StreamingClient::didReceiveData(ResourceHandle* handle, const char* data, int length, int lengthReceived)
+{
+ WebKitWebSrcPrivate* priv = m_src->priv;
+
+ GST_LOG_OBJECT(m_src, "Have %d bytes of data", length);
+
+ if (priv->seekID || handle != priv->resourceHandle) {
+ GST_DEBUG_OBJECT(m_src, "Seek in progress, ignoring data");
+ return;
+ }
+
+ GstBuffer* buffer = gst_buffer_new_and_alloc(length);
+
+ memcpy(GST_BUFFER_DATA(buffer), data, length);
+ GST_BUFFER_OFFSET(buffer) = priv->offset;
+ priv->offset += length;
+ GST_BUFFER_OFFSET_END(buffer) = priv->offset;
+
+ GstFlowReturn ret = gst_app_src_push_buffer(priv->appsrc, buffer);
+ if (ret != GST_FLOW_OK && ret != GST_FLOW_UNEXPECTED)
+ GST_ELEMENT_ERROR(m_src, CORE, FAILED, (0), (0));
+}
+
+void StreamingClient::didFinishLoading(ResourceHandle*)
+{
+ GST_DEBUG_OBJECT(m_src, "Have EOS");
+ gst_app_src_end_of_stream(m_src->priv->appsrc);
+}
+
+void StreamingClient::didFail(ResourceHandle*, const ResourceError& error)
+{
+ GST_ERROR_OBJECT(m_src, "Have failure: %s", error.localizedDescription().utf8().data());
+ GST_ELEMENT_ERROR(m_src, RESOURCE, FAILED, ("%s", error.localizedDescription().utf8().data()), (0));
+ gst_app_src_end_of_stream(m_src->priv->appsrc);
+}
+
+void StreamingClient::wasBlocked(ResourceHandle*)
+{
+}
+
+void StreamingClient::cannotShowURL(ResourceHandle*)
+{
+}
+
diff --git a/WebCore/platform/graphics/gtk/WebKitWebSourceGStreamer.h b/WebCore/platform/graphics/gtk/WebKitWebSourceGStreamer.h
new file mode 100644
index 0000000..045e7d7
--- /dev/null
+++ b/WebCore/platform/graphics/gtk/WebKitWebSourceGStreamer.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ *
+ * 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 WebKitWebSourceGStreamer_h
+#define WebKitWebSourceGStreamer_h
+
+#include "Frame.h"
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_TYPE_WEB_SRC (webkit_web_src_get_type ())
+#define WEBKIT_WEB_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WEBKIT_TYPE_WEB_SRC, WebKitWebSrc))
+#define WEBKIT_WEB_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WEBKIT_TYPE_WEB_SRC, WebKitWebSrcClass))
+#define WEBKIT_IS_WEB_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WEBKIT_TYPE_WEB_SRC))
+#define WEBKIT_IS_WEB_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WEBKIT_TYPE_WEB_SRC))
+
+typedef struct _WebKitWebSrc WebKitWebSrc;
+typedef struct _WebKitWebSrcClass WebKitWebSrcClass;
+typedef struct _WebKitWebSrcPrivate WebKitWebSrcPrivate;
+
+struct _WebKitWebSrc {
+ GstBin parent;
+
+ WebKitWebSrcPrivate *priv;
+};
+
+struct _WebKitWebSrcClass {
+ GstBinClass parentClass;
+};
+
+GType webkit_web_src_get_type(void);
+void webKitWebSrcSetFrame(WebKitWebSrc* src, WebCore::Frame* frame);
+
+G_END_DECLS
+
+#endif
diff --git a/WebCore/platform/graphics/haiku/FloatRectHaiku.cpp b/WebCore/platform/graphics/haiku/FloatRectHaiku.cpp
index 67af3af..18fd94b 100644
--- a/WebCore/platform/graphics/haiku/FloatRectHaiku.cpp
+++ b/WebCore/platform/graphics/haiku/FloatRectHaiku.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
+ * Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
*
* All rights reserved.
*
@@ -35,13 +36,13 @@ namespace WebCore {
FloatRect::FloatRect(const BRect& rect)
: m_location(rect.LeftTop())
- , m_size(rect.Width(), rect.Height())
+ , m_size(rect.Width() + 1, rect.Height() + 1)
{
}
FloatRect::operator BRect() const
{
- return BRect(BPoint(x(), y()), BSize(width(), height()));
+ return BRect(BPoint(x(), y()), BSize(width() - 1, height() - 1));
}
} // namespace WebCore
diff --git a/WebCore/platform/graphics/haiku/FontCacheHaiku.cpp b/WebCore/platform/graphics/haiku/FontCacheHaiku.cpp
index b99bf42..7ade370 100644
--- a/WebCore/platform/graphics/haiku/FontCacheHaiku.cpp
+++ b/WebCore/platform/graphics/haiku/FontCacheHaiku.cpp
@@ -51,18 +51,18 @@ const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, cons
return getCachedFontData(&data);
}
-FontPlatformData* FontCache::getSimilarFontPlatformData(const Font& font)
+SimpleFontData* FontCache::getSimilarFontPlatformData(const Font& font)
{
notImplemented();
return 0;
}
-FontPlatformData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription)
+SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription)
{
// FIXME: Would be even better to somehow get the user's default font here.
// For now we'll pick the default that the user would get without changing any prefs.
static AtomicString defaultString("DejaVu Serif");
- return getCachedFontPlatformData(fontDescription, defaultString);
+ return getCachedFontData(fontDescription, defaultString);
}
FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family)
diff --git a/WebCore/platform/graphics/haiku/GlyphPageTreeNodeHaiku.cpp b/WebCore/platform/graphics/haiku/GlyphPageTreeNodeHaiku.cpp
new file mode 100644
index 0000000..3ae9aeb
--- /dev/null
+++ b/WebCore/platform/graphics/haiku/GlyphPageTreeNodeHaiku.cpp
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2006 George Staikos <staikos@kde.org>
+ * Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
+ * Copyright (C) 2006 Zack Rusin <zack@kde.org>
+ * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
+ *
+ * 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 "GlyphPageTreeNode.h"
+
+#include "SimpleFontData.h"
+#include <wtf/Assertions.h>
+#include <wtf/unicode/Unicode.h>
+
+
+namespace WebCore {
+
+bool GlyphPage::fill(unsigned offset, unsigned length, UChar* characterBuffer, unsigned bufferLength, const SimpleFontData* fontData)
+{
+ bool isUtf16 = bufferLength != GlyphPage::size;
+ bool haveGlyphs = false;
+
+ for (unsigned i = 0; i < GlyphPage::size; i++) {
+ UChar32 character;
+
+ if (isUtf16) {
+ UChar lead = characterBuffer[i * 2];
+ UChar trail = characterBuffer[i * 2 + 1];
+ character = U16_GET_SUPPLEMENTARY(lead, trail);
+ } else
+ character = characterBuffer[i];
+
+ if (!character)
+ setGlyphDataForIndex(offset + i, 0, 0);
+ else {
+ haveGlyphs = true;
+ setGlyphDataForIndex(offset + i, character, fontData);
+ }
+ }
+
+ return haveGlyphs;
+}
+
+} // namespace WebCore
+
diff --git a/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp b/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
index 3970ebc..7ab3a40 100644
--- a/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
+++ b/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
@@ -36,7 +36,6 @@
#include "NotImplemented.h"
#include "Path.h"
#include "Pen.h"
-#include "TransformationMatrix.h"
#include <GraphicsDefs.h>
#include <Region.h>
#include <View.h>
@@ -392,18 +391,12 @@ void GraphicsContext::clipToImageBuffer(const FloatRect&, const ImageBuffer*)
notImplemented();
}
-AffineTransform GraphicsContext::getAffineCTM() const
+AffineTransform GraphicsContext::getCTM() const
{
notImplemented();
return AffineTransform();
}
-TransformationMatrix GraphicsContext::getCTM() const
-{
- notImplemented();
- return TransformationMatrix();
-}
-
void GraphicsContext::translate(float x, float y)
{
if (paintingDisabled())
@@ -466,14 +459,6 @@ void GraphicsContext::concatCTM(const AffineTransform& transform)
notImplemented();
}
-void GraphicsContext::concatCTM(const TransformationMatrix& transform)
-{
- if (paintingDisabled())
- return;
-
- notImplemented();
-}
-
void GraphicsContext::setPlatformShouldAntialias(bool enable)
{
if (paintingDisabled())
diff --git a/WebCore/platform/graphics/haiku/ImageHaiku.cpp b/WebCore/platform/graphics/haiku/ImageHaiku.cpp
index df08822..976154c 100644
--- a/WebCore/platform/graphics/haiku/ImageHaiku.cpp
+++ b/WebCore/platform/graphics/haiku/ImageHaiku.cpp
@@ -4,6 +4,7 @@
* Copyright (C) 2006 Simon Hausmann <hausmann@kde.org>
* Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
* Copyright (C) 2008 Andrea Anzani <andrea.anzani@gmail.com>
+ * Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
*
* All rights reserved.
*
@@ -35,13 +36,14 @@
#include "BitmapImage.h"
#include "FloatRect.h"
#include "GraphicsContext.h"
+#include "ImageObserver.h"
#include "NotImplemented.h"
#include "PlatformString.h"
+#include "TransformationMatrix.h"
#include <Application.h>
#include <Bitmap.h>
#include <View.h>
-
// This function loads resources from WebKit
Vector<char> loadResourceIntoArray(const char*);
@@ -85,6 +87,12 @@ void BitmapImage::invalidatePlatformData()
// Drawing Routines
void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst, const FloatRect& src, ColorSpace styleColorSpace, CompositeOperator op)
{
+ if (!m_source.initialized())
+ return;
+
+ // Spin the animation to the correct frame before we try to draw it, so we
+ // don't draw an old frame and then immediately need to draw a newer one,
+ // causing flicker and wasting CPU.
startAnimation();
BBitmap* image = nativeImageForCurrentFrame();
@@ -105,42 +113,76 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst, const FloatR
// Test using example site at
// http://www.meyerweb.com/eric/css/edge/complexspiral/demo.html
ctxt->platformContext()->SetDrawingMode(B_OP_ALPHA);
- ctxt->platformContext()->DrawBitmap(image, srcRect & image->Bounds(), dstRect);
+ ctxt->platformContext()->DrawBitmapAsync(image, srcRect, dstRect);
ctxt->restore();
+
+ if (imageObserver())
+ imageObserver()->didDraw(this);
}
-void Image::drawPattern(GraphicsContext* context, const FloatRect& tileRect, const TransformationMatrix& patternTransform, const FloatPoint& srcPoint, ColorSpace, CompositeOperator op, const FloatRect& dstRect)
+void Image::drawPattern(GraphicsContext* context, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& srcPoint, ColorSpace, CompositeOperator op, const FloatRect& dstRect)
{
- // FIXME: finish this to support also phased position (srcPoint)
- startAnimation();
-
BBitmap* image = nativeImageForCurrentFrame();
if (!image || !image->IsValid()) // If the image hasn't fully loaded.
return;
- float currentW = 0;
- float currentH = 0;
+ // Figure out if the image has any alpha transparency, we can use faster drawing if not
+ bool hasAlpha = false;
+
+ uint8* bits = reinterpret_cast<uint8*>(image->Bits());
+ uint32 width = image->Bounds().IntegerWidth() + 1;
+ uint32 height = image->Bounds().IntegerHeight() + 1;
+
+ uint32 bytesPerRow = image->BytesPerRow();
+ for (uint32 y = 0; y < height && !hasAlpha; y++) {
+ uint8* p = bits;
+ for (uint32 x = 0; x < width && !hasAlpha; x++) {
+ hasAlpha = p[3] < 255;
+ p += 4;
+ }
+ bits += bytesPerRow;
+ }
context->save();
- context->platformContext()->SetDrawingMode(B_OP_ALPHA);
+ if (hasAlpha)
+ context->platformContext()->SetDrawingMode(B_OP_ALPHA);
+ else
+ context->platformContext()->SetDrawingMode(B_OP_COPY);
context->clip(enclosingIntRect(dstRect));
-
- while (currentW < dstRect.width()) {
- while (currentH < dstRect.height()) {
- context->platformContext()->DrawBitmap(image, BPoint(dstRect.x() + currentW, dstRect.y() + currentH));
- currentH += tileRect.height();
+ float currentW = phase.x();
+ BRect bTileRect(tileRect);
+ while (currentW < dstRect.x() + dstRect.width()) {
+ float currentH = phase.y();
+ while (currentH < dstRect.y() + dstRect.height()) {
+ BRect bDstRect(currentW, currentH, currentW + width - 1, currentH + height - 1);
+ context->platformContext()->DrawBitmapAsync(image, bTileRect, bDstRect);
+ currentH += height;
}
- currentW += tileRect.width();
- currentH = 0;
+ currentW += width;
}
context->restore();
+
+ if (imageObserver())
+ imageObserver()->didDraw(this);
}
void BitmapImage::checkForSolidColor()
{
- // FIXME: need to check the RGBA32 buffer to see if it is 1x1.
m_isSolidColor = false;
m_checkedForSolidColor = true;
+
+ if (frameCount() > 1)
+ return;
+
+ BBitmap* image = getBBitmap();
+ if (!image || !image->Bounds().IsValid()
+ || image->Bounds().IntegerWidth() > 0 || image->Bounds().IntegerHeight() > 0) {
+ return;
+ }
+
+ m_isSolidColor = true;
+ uint8* bits = reinterpret_cast<uint8*>(image->Bits());
+ m_solidColor = Color(bits[2], bits[1], bits[0], bits[3]);
}
BBitmap* BitmapImage::getBBitmap() const
diff --git a/WebCore/platform/graphics/haiku/IntRectHaiku.cpp b/WebCore/platform/graphics/haiku/IntRectHaiku.cpp
index 74a0b9d..5ee7207 100644
--- a/WebCore/platform/graphics/haiku/IntRectHaiku.cpp
+++ b/WebCore/platform/graphics/haiku/IntRectHaiku.cpp
@@ -35,13 +35,13 @@ namespace WebCore {
IntRect::IntRect(const BRect& rect)
: m_location(rect.LeftTop())
- , m_size(rect.IntegerWidth(), rect.IntegerHeight())
+ , m_size(rect.IntegerWidth() + 1, rect.IntegerHeight() + 1)
{
}
IntRect::operator BRect() const
{
- return BRect(BPoint(x(), y()), BSize(width(), height()));
+ return BRect(BPoint(x(), y()), BSize(width() - 1, height() - 1));
}
} // namespace WebCore
diff --git a/WebCore/platform/graphics/haiku/PathHaiku.cpp b/WebCore/platform/graphics/haiku/PathHaiku.cpp
index 70dad29..d8b6932 100644
--- a/WebCore/platform/graphics/haiku/PathHaiku.cpp
+++ b/WebCore/platform/graphics/haiku/PathHaiku.cpp
@@ -152,11 +152,6 @@ void Path::transform(const AffineTransform& transform)
notImplemented();
}
-void Path::transform(const TransformationMatrix& transform)
-{
- notImplemented();
-}
-
FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier)
{
notImplemented();
diff --git a/WebCore/platform/graphics/mac/ComplexTextController.cpp b/WebCore/platform/graphics/mac/ComplexTextController.cpp
index 7d12b61..543d885 100644
--- a/WebCore/platform/graphics/mac/ComplexTextController.cpp
+++ b/WebCore/platform/graphics/mac/ComplexTextController.cpp
@@ -316,6 +316,7 @@ ComplexTextController::ComplexTextRun::ComplexTextRun(const SimpleFontData* font
, m_characters(characters)
, m_stringLocation(stringLocation)
, m_stringLength(stringLength)
+ , m_isMonotonic(true)
{
#if USE(CORE_TEXT) && USE(ATSUI)
shouldUseATSUIAPI() ? createTextRunFromFontDataATSUI(ltr) : createTextRunFromFontDataCoreText(ltr);
@@ -326,6 +327,30 @@ ComplexTextController::ComplexTextRun::ComplexTextRun(const SimpleFontData* font
#endif
}
+void ComplexTextController::ComplexTextRun::setIsNonMonotonic()
+{
+ ASSERT(m_isMonotonic);
+ m_isMonotonic = false;
+
+ Vector<bool, 64> mappedIndices(m_stringLength);
+ for (size_t i = 0; i < m_glyphCount; ++i) {
+ ASSERT(indexAt(i) < static_cast<CFIndex>(m_stringLength));
+ mappedIndices[indexAt(i)] = true;
+ }
+
+ m_glyphEndOffsets.grow(m_glyphCount);
+ for (size_t i = 0; i < m_glyphCount; ++i) {
+ CFIndex nextMappedIndex = m_stringLength;
+ for (size_t j = indexAt(i) + 1; j < m_stringLength; ++j) {
+ if (mappedIndices[j]) {
+ nextMappedIndex = j;
+ break;
+ }
+ }
+ m_glyphEndOffsets[i] = nextMappedIndex;
+ }
+}
+
void ComplexTextController::advance(unsigned offset, GlyphBuffer* glyphBuffer)
{
if (static_cast<int>(offset) > m_end)
@@ -348,10 +373,13 @@ void ComplexTextController::advance(unsigned offset, GlyphBuffer* glyphBuffer)
while (m_glyphInCurrentRun < glyphCount) {
unsigned glyphStartOffset = complexTextRun.indexAt(g);
unsigned glyphEndOffset;
- if (ltr)
- glyphEndOffset = max<unsigned>(glyphStartOffset, g + 1 < glyphCount ? complexTextRun.indexAt(g + 1) : complexTextRun.stringLength());
- else
- glyphEndOffset = max<unsigned>(glyphStartOffset, g > 0 ? complexTextRun.indexAt(g - 1) : complexTextRun.stringLength());
+ if (complexTextRun.isMonotonic()) {
+ if (ltr)
+ glyphEndOffset = max<unsigned>(glyphStartOffset, g + 1 < glyphCount ? complexTextRun.indexAt(g + 1) : complexTextRun.stringLength());
+ else
+ glyphEndOffset = max<unsigned>(glyphStartOffset, g > 0 ? complexTextRun.indexAt(g - 1) : complexTextRun.stringLength());
+ } else
+ glyphEndOffset = complexTextRun.endOffsetAt(g);
CGSize adjustedAdvance = m_adjustedAdvances[k];
@@ -393,7 +421,7 @@ void ComplexTextController::adjustGlyphsAndAdvances()
{
size_t runCount = m_complexTextRuns.size();
for (size_t r = 0; r < runCount; ++r) {
- const ComplexTextRun& complexTextRun = *m_complexTextRuns[r];
+ ComplexTextRun& complexTextRun = *m_complexTextRuns[r];
unsigned glyphCount = complexTextRun.glyphCount();
const SimpleFontData* fontData = complexTextRun.fontData();
@@ -405,10 +433,18 @@ void ComplexTextController::adjustGlyphsAndAdvances()
CGFloat roundedSpaceWidth = roundCGFloat(fontData->spaceWidth());
bool roundsAdvances = !m_font.isPrinterFont() && fontData->platformData().roundsGlyphAdvances();
bool hasExtraSpacing = (m_font.letterSpacing() || m_font.wordSpacing() || m_padding) && !m_run.spacingDisabled();
-
+ CFIndex lastCharacterIndex = m_run.ltr() ? numeric_limits<CFIndex>::min() : numeric_limits<CFIndex>::max();
+ bool isMonotonic = true;
for (unsigned i = 0; i < glyphCount; i++) {
CFIndex characterIndex = complexTextRun.indexAt(i);
+ if (m_run.ltr()) {
+ if (characterIndex < lastCharacterIndex)
+ isMonotonic = false;
+ } else {
+ if (characterIndex > lastCharacterIndex)
+ isMonotonic = false;
+ }
UChar ch = *(cp + characterIndex);
bool lastGlyph = lastRun && i + 1 == glyphCount;
UChar nextCh;
@@ -500,7 +536,10 @@ void ComplexTextController::adjustGlyphsAndAdvances()
advance.height *= -1;
m_adjustedAdvances.append(advance);
m_adjustedGlyphs.append(glyph);
+ lastCharacterIndex = characterIndex;
}
+ if (!isMonotonic)
+ complexTextRun.setIsNonMonotonic();
}
}
diff --git a/WebCore/platform/graphics/mac/ComplexTextController.h b/WebCore/platform/graphics/mac/ComplexTextController.h
index 3fec18a..53e8f7a 100644
--- a/WebCore/platform/graphics/mac/ComplexTextController.h
+++ b/WebCore/platform/graphics/mac/ComplexTextController.h
@@ -88,8 +88,11 @@ private:
unsigned stringLocation() const { return m_stringLocation; }
size_t stringLength() const { return m_stringLength; }
ALWAYS_INLINE CFIndex indexAt(size_t i) const;
+ CFIndex endOffsetAt(size_t i) const { ASSERT(!m_isMonotonic); return m_glyphEndOffsets[i]; }
const CGGlyph* glyphs() const { return m_glyphs; }
const CGSize* advances() const { return m_advances; }
+ bool isMonotonic() const { return m_isMonotonic; }
+ void setIsNonMonotonic();
private:
#if USE(CORE_TEXT)
@@ -124,14 +127,15 @@ private:
#if USE(ATSUI)
Vector<CFIndex, 64> m_atsuiIndices;
#endif
+ Vector<CFIndex, 64> m_glyphEndOffsets;
Vector<CGGlyph, 64> m_glyphsVector;
const CGGlyph* m_glyphs;
Vector<CGSize, 64> m_advancesVector;
const CGSize* m_advances;
#if USE(ATSUI)
- bool m_ltr;
bool m_directionalOverride;
#endif
+ bool m_isMonotonic;
};
void collectComplexTextRuns();
diff --git a/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp b/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp
index 48aa174..1656854 100644
--- a/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp
+++ b/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp
@@ -145,8 +145,8 @@ ComplexTextController::ComplexTextRun::ComplexTextRun(ATSUTextLayout atsuTextLay
, m_characters(characters)
, m_stringLocation(stringLocation)
, m_stringLength(stringLength)
- , m_ltr(ltr)
, m_directionalOverride(directionalOverride)
+ , m_isMonotonic(true)
{
OSStatus status;
diff --git a/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp b/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp
index dd5e96a..9f20b68 100644
--- a/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp
+++ b/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp
@@ -46,6 +46,7 @@ ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const Simp
, m_characters(characters)
, m_stringLocation(stringLocation)
, m_stringLength(stringLength)
+ , m_isMonotonic(true)
{
m_glyphCount = CTRunGetGlyphCount(m_coreTextRun.get());
m_coreTextIndices = CTRunGetStringIndicesPtr(m_coreTextRun.get());
diff --git a/WebCore/platform/graphics/mac/FontCacheMac.mm b/WebCore/platform/graphics/mac/FontCacheMac.mm
index 2730d5a..0747dd7 100644
--- a/WebCore/platform/graphics/mac/FontCacheMac.mm
+++ b/WebCore/platform/graphics/mac/FontCacheMac.mm
@@ -146,43 +146,43 @@ const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, cons
return getCachedFontData(&alternateFont);
}
-FontPlatformData* FontCache::getSimilarFontPlatformData(const Font& font)
+SimpleFontData* FontCache::getSimilarFontPlatformData(const Font& font)
{
// Attempt to find an appropriate font using a match based on
// the presence of keywords in the the requested names. For example, we'll
// match any name that contains "Arabic" to Geeza Pro.
- FontPlatformData* platformData = 0;
+ SimpleFontData* simpleFontData = 0;
const FontFamily* currFamily = &font.fontDescription().family();
- while (currFamily && !platformData) {
+ while (currFamily && !simpleFontData) {
if (currFamily->family().length()) {
static String* matchWords[3] = { new String("Arabic"), new String("Pashto"), new String("Urdu") };
DEFINE_STATIC_LOCAL(AtomicString, geezaStr, ("Geeza Pro"));
- for (int j = 0; j < 3 && !platformData; ++j)
+ for (int j = 0; j < 3 && !simpleFontData; ++j)
if (currFamily->family().contains(*matchWords[j], false))
- platformData = getCachedFontPlatformData(font.fontDescription(), geezaStr);
+ simpleFontData = getCachedFontData(font.fontDescription(), geezaStr);
}
currFamily = currFamily->next();
}
- return platformData;
+ return simpleFontData;
}
-FontPlatformData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription)
+SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription)
{
DEFINE_STATIC_LOCAL(AtomicString, timesStr, ("Times"));
- DEFINE_STATIC_LOCAL(AtomicString, lucidaGrandeStr, ("Lucida Grande"));
// FIXME: Would be even better to somehow get the user's default font here. For now we'll pick
// the default that the user would get without changing any prefs.
- FontPlatformData* platformFont = getCachedFontPlatformData(fontDescription, timesStr);
- if (!platformFont)
- // The Times fallback will almost always work, but in the highly unusual case where
- // the user doesn't have it, we fall back on Lucida Grande because that's
- // guaranteed to be there, according to Nathan Taylor. This is good enough
- // to avoid a crash at least.
- platformFont = getCachedFontPlatformData(fontDescription, lucidaGrandeStr);
-
- return platformFont;
+ SimpleFontData* simpleFontData = getCachedFontData(fontDescription, timesStr);
+ if (simpleFontData)
+ return simpleFontData;
+
+ // The Times fallback will almost always work, but in the highly unusual case where
+ // the user doesn't have it, we fall back on Lucida Grande because that's
+ // guaranteed to be there, according to Nathan Taylor. This is good enough
+ // to avoid a crash at least.
+ DEFINE_STATIC_LOCAL(AtomicString, lucidaGrandeStr, ("Lucida Grande"));
+ return getCachedFontData(fontDescription, lucidaGrandeStr);
}
void FontCache::getTraitsInFamily(const AtomicString& familyName, Vector<unsigned>& traitsMasks)
diff --git a/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp b/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
index 5e5e1f4..99ad130 100644
--- a/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
+++ b/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
@@ -223,7 +223,6 @@ void GraphicsContext3D::reshape(int width, int height)
notImplemented();
}
- ::glViewport(0, 0, m_currentWidth, m_currentHeight);
::glClear(GL_COLOR_BUFFER_BIT);
::glFlush();
}
diff --git a/WebCore/platform/graphics/qt/FontCacheQt.cpp b/WebCore/platform/graphics/qt/FontCacheQt.cpp
index 83df0f3..bfcc5c3 100644
--- a/WebCore/platform/graphics/qt/FontCacheQt.cpp
+++ b/WebCore/platform/graphics/qt/FontCacheQt.cpp
@@ -49,15 +49,15 @@ const SimpleFontData* FontCache::getFontDataForCharacters(const Font&, const UCh
return 0;
}
-FontPlatformData* FontCache::getSimilarFontPlatformData(const Font& font)
+SimpleFontData* FontCache::getSimilarFontPlatformData(const Font& font)
{
return 0;
}
-FontPlatformData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription)
+SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription)
{
const AtomicString fallbackFamily = QFont(fontDescription.family().family()).lastResortFamily();
- return new FontPlatformData(fontDescription, fallbackFamily);
+ return getCachedFontData(new FontPlatformData(fontDescription, fallbackFamily));
}
void FontCache::getTraitsInFamily(const AtomicString&, Vector<unsigned>&)
diff --git a/WebCore/platform/graphics/qt/FontCustomPlatformData.cpp b/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp
index 6e9d053..6e9d053 100644
--- a/WebCore/platform/graphics/qt/FontCustomPlatformData.cpp
+++ b/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp
diff --git a/WebCore/platform/graphics/qt/FontQt.cpp b/WebCore/platform/graphics/qt/FontQt.cpp
index 0196ab2..9ff7c1a 100644
--- a/WebCore/platform/graphics/qt/FontQt.cpp
+++ b/WebCore/platform/graphics/qt/FontQt.cpp
@@ -21,14 +21,14 @@
#include "config.h"
#include "Font.h"
+
+#include "AffineTransform.h"
#include "FontDescription.h"
#include "FontFallbackList.h"
#include "FontSelector.h"
-
#include "Gradient.h"
#include "GraphicsContext.h"
#include "Pattern.h"
-#include "TransformationMatrix.h"
#include <QBrush>
#include <QFontInfo>
@@ -79,7 +79,7 @@ void Font::drawComplexText(GraphicsContext* ctx, const TextRun& run, const Float
brush.setTransform(ctx->fillGradient()->gradientSpaceTransform());
p->setPen(QPen(brush, 0));
} else if (ctx->fillPattern()) {
- TransformationMatrix affine;
+ AffineTransform affine;
p->setPen(QPen(QBrush(ctx->fillPattern()->createPlatformPattern(affine)), 0));
} else
p->setPen(QColor(ctx->fillColor()));
@@ -91,7 +91,7 @@ void Font::drawComplexText(GraphicsContext* ctx, const TextRun& run, const Float
brush.setTransform(ctx->strokeGradient()->gradientSpaceTransform());
p->setPen(QPen(brush, ctx->strokeThickness()));
} else if (ctx->strokePattern()) {
- TransformationMatrix affine;
+ AffineTransform affine;
p->setPen(QPen(QBrush(ctx->strokePattern()->createPlatformPattern(affine)), ctx->strokeThickness()));
} else
p->setPen(QPen(QColor(ctx->strokeColor()), ctx->strokeThickness()));
diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index 9046449..105d866 100644
--- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -50,7 +50,6 @@
#include "Path.h"
#include "Pattern.h"
#include "Pen.h"
-#include "TransformationMatrix.h"
#include <QBrush>
#include <QDebug>
@@ -222,6 +221,8 @@ public:
QBrush solidColor;
+ InterpolationQuality imageInterpolationQuality;
+
// Only used by SVG for now.
QPainterPath currentPath;
@@ -237,6 +238,8 @@ GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate(QPainter* p)
solidColor = QBrush(Qt::black);
+ imageInterpolationQuality = InterpolationDefault;
+
if (painter) {
// use the default the QPainter was constructed with
antiAliasingForRectsAndLines = painter->testRenderHint(QPainter::Antialiasing);
@@ -276,22 +279,13 @@ PlatformGraphicsContext* GraphicsContext::platformContext() const
return m_data->p();
}
-AffineTransform GraphicsContext::getAffineCTM() const
+AffineTransform GraphicsContext::getCTM() const
{
QTransform matrix(platformContext()->combinedTransform());
return AffineTransform(matrix.m11(), matrix.m12(), matrix.m21(),
matrix.m22(), matrix.dx(), matrix.dy());
}
-TransformationMatrix GraphicsContext::getCTM() const
-{
- QTransform matrix(platformContext()->combinedTransform());
- return TransformationMatrix(matrix.m11(), matrix.m12(), 0, matrix.m13(),
- matrix.m21(), matrix.m22(), 0, matrix.m23(),
- 0, 0, 1, 0,
- matrix.m31(), matrix.m32(), 0, matrix.m33());
-}
-
void GraphicsContext::savePlatformState()
{
m_data->p()->save();
@@ -307,112 +301,6 @@ void GraphicsContext::restorePlatformState()
}
}
-/* FIXME: DISABLED WHILE MERGING BACK FROM UNITY
-void GraphicsContext::drawTextShadow(const TextRun& run, const IntPoint& point, const FontStyle& style)
-{
- if (paintingDisabled())
- return;
-
- if (m_data->shadow.isNull())
- return;
-
- TextShadow* shadow = &m_data->shadow;
-
- if (shadow->blur <= 0) {
- Pen p = pen();
- setPen(shadow->color);
- font().drawText(this, run, style, IntPoint(point.x() + shadow->x, point.y() + shadow->y));
- setPen(p);
- } else {
- const int thickness = shadow->blur;
- // FIXME: OPTIMIZE: limit the area to only the actually painted area + 2*thickness
- const int w = m_data->p()->device()->width();
- const int h = m_data->p()->device()->height();
- const QRgb color = qRgb(255, 255, 255);
- const QRgb bgColor = qRgb(0, 0, 0);
- QImage image(QSize(w, h), QImage::Format_ARGB32);
- image.fill(bgColor);
- QPainter p;
-
- Pen curPen = pen();
- p.begin(&image);
- setPen(color);
- m_data->redirect = &p;
- font().drawText(this, run, style, IntPoint(point.x() + shadow->x, point.y() + shadow->y));
- m_data->redirect = 0;
- p.end();
- setPen(curPen);
-
- int md = thickness * thickness; // max-dist^2
-
- // blur map/precalculated shadow-decay
- float* bmap = (float*) alloca(sizeof(float) * (md + 1));
- for (int n = 0; n <= md; n++) {
- float f;
- f = n / (float) (md + 1);
- f = 1.0 - f * f;
- bmap[n] = f;
- }
-
- float factor = 0.0; // maximal potential opacity-sum
- for (int n = -thickness; n <= thickness; n++) {
- for (int m = -thickness; m <= thickness; m++) {
- int d = n * n + m * m;
- if (d <= md)
- factor += bmap[d];
- }
- }
-
- // alpha map
- float* amap = (float*) alloca(sizeof(float) * (h * w));
- memset(amap, 0, h * w * (sizeof(float)));
-
- for (int j = thickness; j<h-thickness; j++) {
- for (int i = thickness; i<w-thickness; i++) {
- QRgb col = image.pixel(i,j);
- if (col == bgColor)
- continue;
-
- float g = qAlpha(col);
- g = g / 255;
-
- for (int n = -thickness; n <= thickness; n++) {
- for (int m = -thickness; m <= thickness; m++) {
- int d = n * n + m * m;
- if (d > md)
- continue;
-
- float f = bmap[d];
- amap[(i + m) + (j + n) * w] += (g * f);
- }
- }
- }
- }
-
- QImage res(QSize(w,h),QImage::Format_ARGB32);
- int r = shadow->color.red();
- int g = shadow->color.green();
- int b = shadow->color.blue();
- int a1 = shadow->color.alpha();
-
- // arbitratry factor adjustment to make shadows more solid.
- factor = 1.333 / factor;
-
- for (int j = 0; j < h; j++) {
- for (int i = 0; i < w; i++) {
- int a = (int) (amap[i + j * w] * factor * a1);
- if (a > 255)
- a = 255;
-
- res.setPixel(i,j, qRgba(r, g, b, a));
- }
- }
-
- m_data->p()->drawImage(0, 0, res, 0, 0, -1, -1, Qt::DiffuseAlphaDither | Qt::ColorOnly | Qt::PreferDither);
- }
-}
-*/
-
// Draws a filled rectangle with a stroked border.
void GraphicsContext::drawRect(const IntRect& rect)
{
@@ -650,7 +538,7 @@ void GraphicsContext::fillPath()
if (m_common->state.fillPattern || m_common->state.fillGradient || fillColor().alpha()) {
drawFilledShadowPath(this, p, path);
if (m_common->state.fillPattern) {
- TransformationMatrix affine;
+ AffineTransform affine;
p->fillPath(path, QBrush(m_common->state.fillPattern->createPlatformPattern(affine)));
} else if (m_common->state.fillGradient) {
QBrush brush(*m_common->state.fillGradient->platformGradient());
@@ -687,7 +575,7 @@ void GraphicsContext::strokePath()
p->setWorldTransform(t);
}
if (m_common->state.strokePattern) {
- TransformationMatrix affine;
+ AffineTransform affine;
pen.setBrush(QBrush(m_common->state.strokePattern->createPlatformPattern(affine)));
p->setPen(pen);
p->strokePath(path, pen);
@@ -727,7 +615,7 @@ void GraphicsContext::fillRect(const FloatRect& rect)
if (m_common->state.fillPattern || m_common->state.fillGradient || fillColor().alpha()) {
drawBorderlessRectShadow(this, p, rect);
if (m_common->state.fillPattern) {
- TransformationMatrix affine;
+ AffineTransform affine;
p->fillRect(rect, QBrush(m_common->state.fillPattern->createPlatformPattern(affine)));
} else if (m_common->state.fillGradient) {
QBrush brush(*m_common->state.fillGradient->platformGradient());
@@ -1061,7 +949,7 @@ void GraphicsContext::clipOut(const Path& path)
QPainterPath newClip;
newClip.setFillRule(Qt::OddEvenFill);
if (p->hasClipping()) {
- newClip.addRect(p->clipPath().boundingRect());
+ newClip.addRect(p->clipRegion().boundingRect());
newClip.addPath(clippedOut);
p->setClipPath(newClip, Qt::IntersectClip);
} else {
@@ -1130,7 +1018,7 @@ void GraphicsContext::clipOut(const IntRect& rect)
QPainterPath newClip;
newClip.setFillRule(Qt::OddEvenFill);
if (p->hasClipping()) {
- newClip.addRect(p->clipPath().boundingRect());
+ newClip.addRect(p->clipRegion().boundingRect());
newClip.addRect(QRect(rect));
p->setClipPath(newClip, Qt::IntersectClip);
} else {
@@ -1152,7 +1040,7 @@ void GraphicsContext::clipOutEllipseInRect(const IntRect& rect)
QPainterPath newClip;
newClip.setFillRule(Qt::OddEvenFill);
if (p->hasClipping()) {
- newClip.addRect(p->clipPath().boundingRect());
+ newClip.addRect(p->clipRegion().boundingRect());
newClip.addEllipse(QRect(rect));
p->setClipPath(newClip, Qt::IntersectClip);
} else {
@@ -1213,24 +1101,6 @@ void GraphicsContext::concatCTM(const AffineTransform& transform)
}
}
-
-void GraphicsContext::concatCTM(const TransformationMatrix& transform)
-{
- if (paintingDisabled())
- return;
-
- m_data->p()->setWorldTransform(transform, true);
-
- // Transformations to the context shouldn't transform the currentPath.
- // We have to undo every change made to the context from the currentPath
- // to avoid wrong drawings.
- if (!m_data->currentPath.isEmpty() && transform.isInvertible()) {
- QTransform matrix = transform.inverse();
- m_data->currentPath = m_data->currentPath * matrix;
- m_common->state.pathTransform.multiply(transform);
- }
-}
-
void GraphicsContext::setURLForRect(const KURL&, const IntRect&)
{
notImplemented();
@@ -1270,7 +1140,8 @@ void GraphicsContext::setPlatformFillColor(const Color& color, ColorSpace colorS
{
if (paintingDisabled())
return;
- m_data->p()->setBrush(QBrush(color));
+ m_data->solidColor.setColor(color);
+ m_data->p()->setBrush(m_data->solidColor);
}
void GraphicsContext::setPlatformShouldAntialias(bool enable)
@@ -1366,13 +1237,30 @@ void GraphicsContext::releaseWindowsContext(HDC hdc, const IntRect& dstRect, boo
}
#endif
-void GraphicsContext::setImageInterpolationQuality(InterpolationQuality)
+void GraphicsContext::setImageInterpolationQuality(InterpolationQuality quality)
{
+ m_data->imageInterpolationQuality = quality;
+
+ switch (quality) {
+ case InterpolationDefault:
+ case InterpolationNone:
+ case InterpolationLow:
+ // use nearest-neigbor
+ m_data->p()->setRenderHint(QPainter::SmoothPixmapTransform, false);
+ break;
+
+ case InterpolationMedium:
+ case InterpolationHigh:
+ default:
+ // use the filter
+ m_data->p()->setRenderHint(QPainter::SmoothPixmapTransform, true);
+ break;
+ };
}
InterpolationQuality GraphicsContext::imageInterpolationQuality() const
{
- return InterpolationDefault;
+ return m_data->imageInterpolationQuality;
}
}
diff --git a/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp b/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
index 5712eee..11f7384 100644
--- a/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
@@ -44,6 +44,55 @@
namespace WebCore {
+class MaskEffectQt : public QGraphicsEffect {
+public:
+ MaskEffectQt(QObject* parent, QGraphicsItem* maskLayer)
+ : QGraphicsEffect(parent)
+ , m_maskLayer(maskLayer)
+ {
+ }
+
+ void draw(QPainter* painter)
+ {
+ // this is a modified clone of QGraphicsOpacityEffect.
+ // It's more efficient to do it this way because
+ // (a) we don't need the QBrush abstraction - we always end up using QGraphicsItem::paint from the mask layer
+ // (b) QGraphicsOpacityEffect detaches the pixmap, which is inefficient on OpenGL.
+ QPixmap maskPixmap(sourceBoundingRect().toAlignedRect().size());
+
+ // we need to do this so the pixmap would have hasAlpha()
+ maskPixmap.fill(Qt::transparent);
+ QPainter maskPainter(&maskPixmap);
+ QStyleOptionGraphicsItem option;
+ option.exposedRect = option.rect = maskPixmap.rect();
+ maskPainter.setRenderHints(painter->renderHints(), true);
+ m_maskLayer->paint(&maskPainter, &option, 0);
+ maskPainter.end();
+ QPoint offset;
+ QPixmap srcPixmap = sourcePixmap(Qt::LogicalCoordinates, &offset, QGraphicsEffect::NoPad);
+
+ // we have to use another intermediate pixmap, to make sure the mask applies only to this item
+ // and doesn't modify pixels already painted into this paint-device
+ QPixmap pixmap(srcPixmap.size());
+ pixmap.fill(Qt::transparent);
+
+ if (pixmap.isNull())
+ return;
+
+ QPainter pixmapPainter(&pixmap);
+ pixmapPainter.setRenderHints(painter->renderHints());
+ pixmapPainter.setCompositionMode(QPainter::CompositionMode_Source);
+ // We use drawPixmap rather than detaching, because it's more efficient on OpenGL
+ pixmapPainter.drawPixmap(0, 0, srcPixmap);
+ pixmapPainter.setCompositionMode(QPainter::CompositionMode_DestinationIn);
+ pixmapPainter.drawPixmap(0, 0, maskPixmap);
+ pixmapPainter.end();
+ painter->drawPixmap(offset, pixmap);
+ }
+
+ QGraphicsItem* m_maskLayer;
+};
+
class GraphicsLayerQtImpl : public QGraphicsObject {
Q_OBJECT
@@ -88,7 +137,6 @@ public:
// we manage transforms ourselves because transform-origin acts differently in webkit and in Qt
void setBaseTransform(const QTransform&);
- void drawContents(QPainter*, const QRectF&, bool mask = false);
// let the compositor-API tell us which properties were changed
void notifyChange(ChangeMask);
@@ -99,16 +147,29 @@ public:
// or ChromeClientQt::scheduleCompositingLayerSync (meaning the sync will happen ASAP)
void flushChanges(bool recursive = true);
+ // optimization: when we have an animation running on an element with no contents, that has child-elements with contents,
+ // ALL of them have to have ItemCoordinateCache and not DeviceCoordinateCache
+ void adjustCachingRecursively(bool animationIsRunning);
+
+ // optimization: returns true if this or an ancestor has a transform animation running.
+ // this enables us to use ItemCoordinatesCache while the animation is running, otherwise we have to recache for every frame
+ bool isTransformAnimationRunning() const;
+
public slots:
// we need to notify the client (aka the layer compositor) when the animation actually starts
void notifyAnimationStarted();
+signals:
+ // optimization: we don't want to use QTimer::singleShot
+ void notifyAnimationStartedAsync();
+
public:
GraphicsLayerQt* m_layer;
- QTransform m_baseTransfom;
+ QTransform m_baseTransform;
bool m_transformAnimationRunning;
bool m_opacityAnimationRunning;
+ QWeakPointer<MaskEffectQt> m_maskEffect;
struct ContentData {
QPixmap pixmap;
@@ -157,30 +218,31 @@ public:
bool backfaceVisibility: 1;
bool distributeOpacity: 1;
bool align: 2;
- State(): maskLayer(0), opacity(1), preserves3D(false), masksToBounds(false),
+ State(): maskLayer(0), opacity(1.f), preserves3D(false), masksToBounds(false),
drawsContent(false), contentsOpaque(false), backfaceVisibility(false),
distributeOpacity(false)
{
}
} m_state;
+
+ friend class AnimationQtBase;
};
GraphicsLayerQtImpl::GraphicsLayerQtImpl(GraphicsLayerQt* newLayer)
: QGraphicsObject(0)
, m_layer(newLayer)
, m_transformAnimationRunning(false)
+ , m_opacityAnimationRunning(false)
, m_changeMask(NoChanges)
{
- // better to calculate the exposed rect in QGraphicsView than over-render in WebCore
- // FIXME: test different approaches
- setFlag(QGraphicsItem::ItemUsesExtendedStyleOption, true);
-
// we use graphics-view for compositing, not for interactivity
setAcceptedMouseButtons(Qt::NoButton);
setEnabled(false);
// we'll set the cache when we know what's going on
setCacheMode(NoCache);
+
+ connect(this, SIGNAL(notifyAnimationStartedAsync()), this, SLOT(notifyAnimationStarted()), Qt::QueuedConnection);
}
GraphicsLayerQtImpl::~GraphicsLayerQtImpl()
@@ -203,22 +265,42 @@ GraphicsLayerQtImpl::~GraphicsLayerQtImpl()
delete anim;
}
+void GraphicsLayerQtImpl::adjustCachingRecursively(bool animationIsRunning)
+{
+ // optimization: we make sure all our children have ItemCoordinateCache -
+ // otherwise we end up re-rendering them during the animation
+ const QList<QGraphicsItem*> children = childItems();
+
+ for (QList<QGraphicsItem*>::const_iterator it = children.begin(); it != children.end(); ++it) {
+ if (QGraphicsItem* item = *it)
+ if (GraphicsLayerQtImpl* layer = qobject_cast<GraphicsLayerQtImpl*>(item->toGraphicsObject())) {
+ if (layer->m_layer->drawsContent() && layer->m_currentContent.contentType == HTMLContentType)
+ layer->setCacheMode(animationIsRunning ? QGraphicsItem::ItemCoordinateCache : QGraphicsItem::DeviceCoordinateCache);
+ }
+ }
+}
+
void GraphicsLayerQtImpl::setBaseTransform(const QTransform& transform)
{
if (!m_layer)
return;
- // webkit has relative-to-size originPoint, graphics-view has a pixel originPoint
- // here we convert
- QPointF originTranslate(
- m_layer->anchorPoint().x() * m_layer->size().width(), m_layer->anchorPoint().y() * m_layer->size().height());
-
- resetTransform();
-
- // we have to manage this ourselves because QGraphicsView's transformOrigin is incomplete
- translate(originTranslate.x(), originTranslate.y());
+ // webkit has relative-to-size originPoint, graphics-view has a pixel originPoint, here we convert
+ // we have to manage this ourselves because QGraphicsView's transformOrigin is incompatible
+ const qreal x = m_layer->anchorPoint().x() * m_layer->size().width();
+ const qreal y = m_layer->anchorPoint().y() * m_layer->size().height();
+ setTransform(QTransform::fromTranslate(x, y));
setTransform(transform, true);
- translate(-originTranslate.x(), -originTranslate.y());
- m_baseTransfom = transform;
+ translate(-x, -y);
+ m_baseTransform = transform;
+}
+
+bool GraphicsLayerQtImpl::isTransformAnimationRunning() const
+{
+ if (m_transformAnimationRunning)
+ return true;
+ if (GraphicsLayerQtImpl* parent = qobject_cast<GraphicsLayerQtImpl*>(parentObject()))
+ return parent->isTransformAnimationRunning();
+ return false;
}
QPainterPath GraphicsLayerQtImpl::opaqueArea() const
@@ -245,67 +327,29 @@ QRectF GraphicsLayerQtImpl::boundingRect() const
void GraphicsLayerQtImpl::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
{
- if (m_state.maskLayer && m_state.maskLayer->platformLayer()) {
- // FIXME: see if this is better done somewhere else
- GraphicsLayerQtImpl* otherMask = static_cast<GraphicsLayerQtImpl*>(m_state.maskLayer->platformLayer());
- otherMask->flushChanges(true);
-
- // CSS3 mask and QGraphicsOpacityEffect are the same thing! we just need to convert...
- // The conversion is as fast as we can make it - we render the layer once and send it to the QGraphicsOpacityEffect
- if (!graphicsEffect()) {
- QPixmap mask(QSize(m_state.maskLayer->size().width(), m_state.maskLayer->size().height()));
- mask.fill(Qt::transparent);
- {
- QPainter p(&mask);
- p.setRenderHints(painter->renderHints(), true);
- p.setCompositionMode(QPainter::CompositionMode_Source);
- static_cast<GraphicsLayerQtImpl*>(m_state.maskLayer->platformLayer())->drawContents(&p, option->exposedRect, true);
- }
- QGraphicsOpacityEffect* opacityEffect = new QGraphicsOpacityEffect(this);
- opacityEffect->setOpacity(1);
- opacityEffect->setOpacityMask(QBrush(mask));
- setGraphicsEffect(opacityEffect);
- }
- }
- drawContents(painter, option->exposedRect);
-}
-
-void GraphicsLayerQtImpl::drawContents(QPainter* painter, const QRectF& r, bool mask)
-{
- QRect rect = r.toAlignedRect();
-
- if (m_currentContent.contentType != HTMLContentType && !m_state.contentsRect.isEmpty())
- rect = rect.intersected(m_state.contentsRect);
-
if (m_currentContent.backgroundColor.isValid())
- painter->fillRect(r, QColor(m_currentContent.backgroundColor));
-
- if (!rect.isEmpty()) {
- switch (m_currentContent.contentType) {
- case PixmapContentType:
- // we have to scale the image to the contentsRect
- // FIXME: a better way would probably be drawPixmap with a src/target rect
- painter->drawPixmap(rect.topLeft(), m_currentContent.pixmap.scaled(m_state.contentsRect.size()), r);
- break;
- case ColorContentType:
- painter->fillRect(rect, m_currentContent.contentsBackgroundColor);
- break;
- default:
- if (m_state.drawsContent) {
- // this is the "expensive" bit. we try to minimize calls to this
- // neck of the woods by proper caching
- GraphicsContext gc(painter);
- m_layer->paintGraphicsLayerContents(gc, rect);
- }
- break;
+ painter->fillRect(option->exposedRect, QColor(m_currentContent.backgroundColor));
+
+ switch (m_currentContent.contentType) {
+ case HTMLContentType:
+ if (m_state.drawsContent) {
+ // this is the expensive bit. we try to minimize calls to this area by proper caching
+ GraphicsContext gc(painter);
+ m_layer->paintGraphicsLayerContents(gc, option->exposedRect.toAlignedRect());
}
+ break;
+ case PixmapContentType:
+ painter->drawPixmap(m_state.contentsRect, m_currentContent.pixmap);
+ break;
+ case ColorContentType:
+ painter->fillRect(m_state.contentsRect, m_currentContent.contentsBackgroundColor);
+ break;
}
}
void GraphicsLayerQtImpl::notifyChange(ChangeMask changeMask)
{
- if (!this)
- return;
+ Q_ASSERT(this);
m_changeMask |= changeMask;
@@ -342,14 +386,14 @@ void GraphicsLayerQtImpl::flushChanges(bool recursive)
const QSet<QGraphicsItem*> currentChildren = childItems().toSet();
const QSet<QGraphicsItem*> childrenToAdd = newChildren - currentChildren;
const QSet<QGraphicsItem*> childrenToRemove = currentChildren - newChildren;
- for (QSet<QGraphicsItem*>::const_iterator it = childrenToAdd.begin(); it != childrenToAdd.end(); ++it) {
+
+ for (QSet<QGraphicsItem*>::const_iterator it = childrenToAdd.begin(); it != childrenToAdd.end(); ++it)
if (QGraphicsItem* w = *it)
w->setParentItem(this);
- }
- for (QSet<QGraphicsItem*>::const_iterator it = childrenToRemove.begin(); it != childrenToRemove.end(); ++it) {
+
+ for (QSet<QGraphicsItem*>::const_iterator it = childrenToRemove.begin(); it != childrenToRemove.end(); ++it)
if (QGraphicsItem* w = *it)
w->setParentItem(0);
- }
// children are ordered by z-value, let graphics-view know.
for (size_t i = 0; i < newChildrenVector.size(); ++i)
@@ -360,12 +404,15 @@ void GraphicsLayerQtImpl::flushChanges(bool recursive)
if (m_changeMask & MaskLayerChange) {
// we can't paint here, because we don't know if the mask layer
// itself is ready... we'll have to wait till this layer tries to paint
+ setFlag(ItemClipsChildrenToShape, m_layer->maskLayer() || m_layer->masksToBounds());
setGraphicsEffect(0);
- if (m_layer->maskLayer())
- setFlag(ItemClipsChildrenToShape, true);
- else
- setFlag(ItemClipsChildrenToShape, m_layer->masksToBounds());
- update();
+ if (m_layer->maskLayer()) {
+ if (GraphicsLayerQtImpl* mask = qobject_cast<GraphicsLayerQtImpl*>(m_layer->maskLayer()->platformLayer()->toGraphicsObject())) {
+ mask->m_maskEffect = new MaskEffectQt(this, mask);
+ mask->setCacheMode(NoCache);
+ setGraphicsEffect(mask->m_maskEffect.data());
+ }
+ }
}
if ((m_changeMask & PositionChange) && (m_layer->position() != m_state.pos))
@@ -383,26 +430,29 @@ void GraphicsLayerQtImpl::flushChanges(bool recursive)
// the anchor-point, transform and size from WebCore all affect the one
// that we give Qt
if (m_state.transform != m_layer->transform() || m_state.anchorPoint != m_layer->anchorPoint() || m_state.size != m_layer->size())
- setBaseTransform(QTransform(m_layer->transform()));
+ setBaseTransform(m_layer->transform());
}
- if (m_changeMask & (ContentChange | DrawsContentChange)) {
+ if (m_changeMask & (ContentChange | DrawsContentChange | MaskLayerChange)) {
switch (m_pendingContent.contentType) {
case PixmapContentType:
- // we need cache even for images, because they need to be resized
- // to the contents rect. maybe this can be optimized though
- setCacheMode(m_transformAnimationRunning ? ItemCoordinateCache : DeviceCoordinateCache);
update();
setFlag(ItemHasNoContents, false);
+
+ // we only use ItemUsesExtendedStyleOption for HTML content - pixmap can be handled better with regular clipping
+ setFlag(QGraphicsItem::ItemUsesExtendedStyleOption, false);
break;
case ColorContentType:
// no point in caching a solid-color rectangle
- setCacheMode(QGraphicsItem::NoCache);
+ setCacheMode(m_layer->maskLayer() ? QGraphicsItem::DeviceCoordinateCache : QGraphicsItem::NoCache);
if (m_pendingContent.contentType != m_currentContent.contentType || m_pendingContent.contentsBackgroundColor != m_currentContent.contentsBackgroundColor)
update();
m_state.drawsContent = false;
setFlag(ItemHasNoContents, false);
+
+ // we only use ItemUsesExtendedStyleOption for HTML content - colors don't gain much from that anyway
+ setFlag(QGraphicsItem::ItemUsesExtendedStyleOption, false);
break;
case HTMLContentType:
@@ -410,8 +460,16 @@ void GraphicsLayerQtImpl::flushChanges(bool recursive)
update();
if (!m_state.drawsContent && m_layer->drawsContent())
update();
- if (m_layer->drawsContent())
- setCacheMode(m_transformAnimationRunning ? ItemCoordinateCache : DeviceCoordinateCache);
+ if (m_layer->drawsContent() && !m_maskEffect) {
+ const QGraphicsItem::CacheMode mewCacheMode = isTransformAnimationRunning() ? ItemCoordinateCache : DeviceCoordinateCache;
+
+ // optimization: QGraphicsItem doesn't always perform this test
+ if (mewCacheMode != cacheMode())
+ setCacheMode(mewCacheMode);
+
+ // HTML content: we want to use exposedRect so we don't use WebCore rendering if we don't have to
+ setFlag(QGraphicsItem::ItemUsesExtendedStyleOption, true);
+ }
else
setCacheMode(NoCache);
@@ -441,14 +499,16 @@ void GraphicsLayerQtImpl::flushChanges(bool recursive)
if ((m_changeMask & ContentsOpaqueChange) && m_state.contentsOpaque != m_layer->contentsOpaque())
prepareGeometryChange();
- if (m_changeMask & DisplayChange)
+ if (m_maskEffect)
+ m_maskEffect.data()->update();
+ else if (m_changeMask & DisplayChange)
update(m_pendingContent.regionToUpdate.boundingRect());
if ((m_changeMask & BackgroundColorChange) && (m_pendingContent.backgroundColor != m_currentContent.backgroundColor))
update();
// FIXME: the following flags are currently not handled, as they don't have a clear test or are in low priority
- // GeometryOrientationChange, ContentsOrientationChange, BackfaceVisibilityChange, ChildrenTransformChange
+ // GeometryOrientationChange, ContentsOrientationChange, BackfaceVisibilityChange, ChildrenTransformChange, Preserves3DChange
m_state.maskLayer = m_layer->maskLayer();
m_state.pos = m_layer->position();
@@ -477,7 +537,9 @@ afterLayerChanges:
if (!recursive)
return;
- const QList<QGraphicsItem*> children = childItems();
+ QList<QGraphicsItem*> children = childItems();
+ if (m_state.maskLayer)
+ children.append(m_state.maskLayer->platformLayer());
for (QList<QGraphicsItem*>::const_iterator it = children.begin(); it != children.end(); ++it) {
if (QGraphicsItem* item = *it)
@@ -523,9 +585,9 @@ void GraphicsLayerQt::setNeedsDisplay()
}
// reimp from GraphicsLayer.h
-void GraphicsLayerQt::setNeedsDisplayInRect(const FloatRect& r)
+void GraphicsLayerQt::setNeedsDisplayInRect(const FloatRect& rect)
{
- m_impl->m_pendingContent.regionToUpdate|= QRectF(r).toAlignedRect();
+ m_impl->m_pendingContent.regionToUpdate|= QRectF(rect).toAlignedRect();
m_impl->notifyChange(GraphicsLayerQtImpl::DisplayChange);
}
@@ -807,16 +869,16 @@ static inline double solveCubicBezierFunction(qreal p1x, qreal p1y, qreal p2x, q
// Using easing-curves would probably work for some of the cases, but wouldn't really buy us anything as we'd have to convert the bezier function back to an easing curve
static inline qreal applyTimingFunction(const TimingFunction& timingFunction, qreal progress, int duration)
{
- if (timingFunction.type() == LinearTimingFunction)
+ if (timingFunction.type() == LinearTimingFunction)
+ return progress;
+ if (timingFunction.type() == CubicBezierTimingFunction) {
+ return solveCubicBezierFunction(timingFunction.x1(),
+ timingFunction.y1(),
+ timingFunction.x2(),
+ timingFunction.y2(),
+ double(progress), double(duration) / 1000);
+ }
return progress;
- if (timingFunction.type() == CubicBezierTimingFunction) {
- return solveCubicBezierFunction(timingFunction.x1(),
- timingFunction.y1(),
- timingFunction.x2(),
- timingFunction.y2(),
- double(progress), double(duration) / 1000);
- }
- return progress;
}
// helper functions to safely get a value out of WebCore's AnimationValue*
@@ -826,9 +888,7 @@ static void webkitAnimationToQtAnimationValue(const AnimationValue* animationVal
if (!animationValue)
return;
- const TransformOperations* ops = static_cast<const TransformAnimationValue*>(animationValue)->value();
-
- if (ops)
+ if (const TransformOperations* ops = static_cast<const TransformAnimationValue*>(animationValue)->value())
transformOperations = *ops;
}
@@ -856,8 +916,8 @@ public:
QAbstractAnimation::updateState(newState, oldState);
// for some reason I have do this asynchronously - or the animation won't work
- if (newState == Running && oldState == Stopped)
- QTimer::singleShot(0, m_layer.data(), SLOT(notifyAnimationStarted()));
+ if (newState == Running && oldState == Stopped && m_layer.data())
+ m_layer.data()->notifyAnimationStartedAsync();
}
virtual int duration() const { return m_duration; }
@@ -932,9 +992,10 @@ protected:
// now we have a source keyframe, origin keyframe and a timing function
// we can now process the progress and apply the frame
- qreal normalizedProgress = (it.key() == it2.key()) ? 0 : (progress - it.key()) / (it2.key() - it.key());
- normalizedProgress = applyTimingFunction(timingFunc, normalizedProgress, duration() / 1000);
- applyFrame(fromValue, toValue, normalizedProgress);
+ progress = (!progress || progress == 1 || it.key() == it2.key())
+ ? progress
+ : applyTimingFunction(timingFunc, (progress - it.key()) / (it2.key() - it.key()), duration() / 1000);
+ applyFrame(fromValue, toValue, progress);
}
QMap<qreal, KeyframeValueQt<T> > m_keyframeValues;
@@ -943,7 +1004,7 @@ protected:
class TransformAnimationQt : public AnimationQt<TransformOperations> {
public:
TransformAnimationQt(GraphicsLayerQtImpl* layer, const KeyframeValueList& values, const IntSize& boxSize, const Animation* anim, const QString & name)
- : AnimationQt<TransformOperations>(layer, values, boxSize, anim, name)
+ : AnimationQt<TransformOperations>(layer, values, boxSize, anim, name)
{
}
@@ -952,7 +1013,7 @@ public:
// this came up during the compositing/animation LayoutTests
// when the animation dies, the transform has to go back to default
if (m_layer)
- m_layer.data()->setBaseTransform(QTransform(m_layer.data()->m_layer->transform()));
+ m_layer.data()->setBaseTransform(m_layer.data()->m_layer->transform());
}
// the idea is that we let WebCore manage the transform-operations
@@ -963,11 +1024,22 @@ public:
{
TransformationMatrix transformMatrix;
- // this looks simple but is really tricky to get right. Use caution.
- for (size_t i = 0; i < targetOperations.size(); ++i)
- targetOperations.operations()[i]->blend(sourceOperations.at(i), progress)->apply(transformMatrix, m_boxSize);
-
- m_layer.data()->setBaseTransform(QTransform(transformMatrix));
+ // sometimes the animation values from WebCore are misleading and we have to use the actual matrix as source
+ // The Mac implementation simply doesn't try to accelerate those (e.g. 360deg rotation), but we do.
+ if (progress == 1 || !targetOperations.size() || sourceOperations == targetOperations) {
+ TransformationMatrix sourceMatrix;
+ sourceOperations.apply(m_boxSize, sourceMatrix);
+ transformMatrix = m_sourceMatrix;
+ transformMatrix.blend(sourceMatrix, 1 - progress);
+ } else if (targetOperations.size() != sourceOperations.size()) {
+ transformMatrix = m_sourceMatrix;
+ targetOperations.apply(m_boxSize, transformMatrix);
+ transformMatrix.blend(m_sourceMatrix, progress);
+ } else {
+ for (size_t i = 0; i < targetOperations.size(); ++i)
+ targetOperations.operations()[i]->blend(sourceOperations.at(i), progress)->apply(transformMatrix, m_boxSize);
+ }
+ m_layer.data()->setBaseTransform(transformMatrix);
}
virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
@@ -980,15 +1052,16 @@ public:
// to increase FPS, we use a less accurate caching mechanism while animation is going on
// this is a UX choice that should probably be customizable
if (newState == QAbstractAnimation::Running) {
+ m_sourceMatrix = m_layer.data()->m_layer->transform();
m_layer.data()->m_transformAnimationRunning = true;
- if (m_layer.data()->cacheMode() == QGraphicsItem::DeviceCoordinateCache)
- m_layer.data()->setCacheMode(QGraphicsItem::ItemCoordinateCache);
+ m_layer.data()->adjustCachingRecursively(true);
} else {
m_layer.data()->m_transformAnimationRunning = false;
- if (m_layer.data()->cacheMode() == QGraphicsItem::ItemCoordinateCache)
- m_layer.data()->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
+ m_layer.data()->adjustCachingRecursively(false);
}
}
+
+ TransformationMatrix m_sourceMatrix;
};
class OpacityAnimationQt : public AnimationQt<qreal> {
@@ -1006,6 +1079,7 @@ public:
virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
{
QAbstractAnimation::updateState(newState, oldState);
+
if (m_layer)
m_layer.data()->m_opacityAnimationRunning = (newState == QAbstractAnimation::Running);
}
@@ -1043,7 +1117,8 @@ bool GraphicsLayerQt::addAnimation(const KeyframeValueList& values, const IntSiz
else
newAnim->start();
- QObject::connect(newAnim, SIGNAL(finished()), newAnim, SLOT(deleteLater()));
+ // we don't need to manage the animation object's lifecycle:
+ // WebCore would call removeAnimations when it's time to delete.
return true;
}
@@ -1054,7 +1129,7 @@ void GraphicsLayerQt::removeAnimationsForProperty(AnimatedPropertyID id)
if (*it) {
AnimationQtBase* anim = static_cast<AnimationQtBase*>(it->data());
if (anim && anim->m_webkitPropertyID == id) {
- delete anim;
+ anim->deleteLater();
it = m_impl->m_animations.erase(it);
--it;
}
@@ -1079,11 +1154,12 @@ void GraphicsLayerQt::removeAnimationsForKeyframes(const String& name)
void GraphicsLayerQt::pauseAnimation(const String& name, double timeOffset)
{
for (QList<QWeakPointer<QAbstractAnimation> >::iterator it = m_impl->m_animations.begin(); it != m_impl->m_animations.end(); ++it) {
- if (*it) {
- AnimationQtBase* anim = static_cast<AnimationQtBase*>((*it).data());
- if (anim && anim->m_keyframesName == QString(name))
- QTimer::singleShot(timeOffset * 1000, anim, SLOT(pause()));
- }
+ if (!(*it))
+ continue;
+
+ AnimationQtBase* anim = static_cast<AnimationQtBase*>((*it).data());
+ if (anim && anim->m_keyframesName == QString(name))
+ QTimer::singleShot(timeOffset * 1000, anim, SLOT(pause()));
}
}
diff --git a/WebCore/platform/graphics/qt/ImageQt.cpp b/WebCore/platform/graphics/qt/ImageQt.cpp
index fea1448..db12738 100644
--- a/WebCore/platform/graphics/qt/ImageQt.cpp
+++ b/WebCore/platform/graphics/qt/ImageQt.cpp
@@ -31,12 +31,12 @@
#include "config.h"
#include "Image.h"
+#include "AffineTransform.h"
#include "ImageObserver.h"
#include "BitmapImage.h"
#include "FloatRect.h"
#include "PlatformString.h"
#include "GraphicsContext.h"
-#include "TransformationMatrix.h"
#include "StillImageQt.h"
#include "qwebsettings.h"
@@ -93,7 +93,7 @@ PassRefPtr<Image> Image::loadPlatformResource(const char* name)
return StillImage::create(loadResourcePixmap(name));
}
-void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const TransformationMatrix& patternTransform,
+void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const AffineTransform& patternTransform,
const FloatPoint& phase, ColorSpace, CompositeOperator op, const FloatRect& destRect)
{
QPixmap* framePixmap = nativeImageForCurrentFrame();
diff --git a/WebCore/platform/graphics/qt/PathQt.cpp b/WebCore/platform/graphics/qt/PathQt.cpp
index 2721984..507f029 100644
--- a/WebCore/platform/graphics/qt/PathQt.cpp
+++ b/WebCore/platform/graphics/qt/PathQt.cpp
@@ -36,7 +36,6 @@
#include "ImageBuffer.h"
#include "PlatformString.h"
#include "StrokeStyleApplier.h"
-#include "TransformationMatrix.h"
#include <QPainterPath>
#include <QTransform>
#include <QString>
@@ -311,10 +310,10 @@ String Path::debugString() const
switch (cur.type) {
case QPainterPath::MoveToElement:
- ret += QString(QLatin1String("M %1 %2")).arg(cur.x).arg(cur.y);
+ ret += QString(QLatin1String("M%1,%2 ")).arg(cur.x, 0, 'f', 2).arg(cur.y, 0, 'f', 2);
break;
case QPainterPath::LineToElement:
- ret += QString(QLatin1String("L %1 %2")).arg(cur.x).arg(cur.y);
+ ret += QString(QLatin1String("L%1,%2 ")).arg(cur.x, 0, 'f', 2).arg(cur.y, 0, 'f', 2);
break;
case QPainterPath::CurveToElement:
{
@@ -324,8 +323,8 @@ String Path::debugString() const
Q_ASSERT(c1.type == QPainterPath::CurveToDataElement);
Q_ASSERT(c2.type == QPainterPath::CurveToDataElement);
- ret += QString(QLatin1String("C %1 %2 %3 %4 %5 %6")).arg(cur.x).arg(cur.y).arg(c1.x).arg(c1.y).arg(c2.x).arg(c2.y);
-
+ ret += QString(QLatin1String("C%1,%2,%3,%4,%5,%6 ")).arg(cur.x, 0, 'f', 2).arg(cur.y, 0, 'f', 2).arg(c1.x, 0, 'f', 2)
+ .arg(c1.y, 0, 'f', 2).arg(c2.x, 0, 'f', 2).arg(c2.y, 0, 'f', 2);
i += 2;
break;
}
@@ -335,7 +334,7 @@ String Path::debugString() const
}
}
- return ret;
+ return ret.trimmed();
}
void Path::apply(void* info, PathApplierFunction function) const
@@ -385,11 +384,6 @@ void Path::transform(const AffineTransform& transform)
m_path = QTransform(transform).map(m_path);
}
-void Path::transform(const TransformationMatrix& transform)
-{
- m_path = QTransform(transform).map(m_path);
-}
-
}
// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/graphics/qt/PatternQt.cpp b/WebCore/platform/graphics/qt/PatternQt.cpp
index b261613..af7b128 100644
--- a/WebCore/platform/graphics/qt/PatternQt.cpp
+++ b/WebCore/platform/graphics/qt/PatternQt.cpp
@@ -26,12 +26,12 @@
#include "config.h"
#include "Pattern.h"
-#include "TransformationMatrix.h"
+#include "AffineTransform.h"
#include "GraphicsContext.h"
namespace WebCore {
-QBrush Pattern::createPlatformPattern(const TransformationMatrix&) const
+QBrush Pattern::createPlatformPattern(const AffineTransform&) const
{
QPixmap* pixmap = tileImage()->nativeImageForCurrentFrame();
if (!pixmap)
diff --git a/WebCore/platform/graphics/skia/GradientSkia.cpp b/WebCore/platform/graphics/skia/GradientSkia.cpp
index 268b17e..7370a49 100644
--- a/WebCore/platform/graphics/skia/GradientSkia.cpp
+++ b/WebCore/platform/graphics/skia/GradientSkia.cpp
@@ -187,7 +187,7 @@ void Gradient::fill(GraphicsContext* context, const FloatRect& rect)
context->fillRect(rect);
}
-void Gradient::setPlatformGradientSpaceTransform(const TransformationMatrix& matrix)
+void Gradient::setPlatformGradientSpaceTransform(const AffineTransform& matrix)
{
if (m_gradient)
m_gradient->setLocalMatrix(m_gradientSpaceTransformation);
diff --git a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
index bd97ca2..8986685 100644
--- a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
+++ b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
@@ -42,7 +42,6 @@
#include "NativeImageSkia.h"
#include "NotImplemented.h"
#include "PlatformContextSkia.h"
-#include "TransformationMatrix.h"
#include "SkBitmap.h"
#include "SkBlurDrawLooper.h"
@@ -447,13 +446,6 @@ void GraphicsContext::concatCTM(const AffineTransform& affine)
platformContext()->canvas()->concat(affine);
}
-void GraphicsContext::concatCTM(const TransformationMatrix& xform)
-{
- if (paintingDisabled())
- return;
- platformContext()->canvas()->concat(xform);
-}
-
void GraphicsContext::drawConvexPolygon(size_t numPoints,
const FloatPoint* points,
bool shouldAntialias)
@@ -813,26 +805,15 @@ void GraphicsContext::fillRoundedRect(const IntRect& rect,
platformContext()->canvas()->drawPath(path, paint);
}
-AffineTransform GraphicsContext::getAffineCTM() const
-{
- const SkMatrix& m = platformContext()->canvas()->getTotalMatrix();
- return AffineTransform(SkScalarToDouble(m.getScaleX()), // a
- SkScalarToDouble(m.getSkewY()), // b
- SkScalarToDouble(m.getSkewX()), // c
- SkScalarToDouble(m.getScaleY()), // d
- SkScalarToDouble(m.getTranslateX()), // e
- SkScalarToDouble(m.getTranslateY())); // f
-}
-
-TransformationMatrix GraphicsContext::getCTM() const
+AffineTransform GraphicsContext::getCTM() const
{
const SkMatrix& m = platformContext()->canvas()->getTotalMatrix();
- return TransformationMatrix(SkScalarToDouble(m.getScaleX()), // a
- SkScalarToDouble(m.getSkewY()), // b
- SkScalarToDouble(m.getSkewX()), // c
- SkScalarToDouble(m.getScaleY()), // d
- SkScalarToDouble(m.getTranslateX()), // e
- SkScalarToDouble(m.getTranslateY())); // f
+ return AffineTransform(SkScalarToDouble(m.getScaleX()),
+ SkScalarToDouble(m.getSkewY()),
+ SkScalarToDouble(m.getSkewX()),
+ SkScalarToDouble(m.getScaleY()),
+ SkScalarToDouble(m.getTranslateX()),
+ SkScalarToDouble(m.getTranslateY()));
}
FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& rect)
diff --git a/WebCore/platform/graphics/skia/ImageSkia.cpp b/WebCore/platform/graphics/skia/ImageSkia.cpp
index 6d8ed22..ba9f824 100644
--- a/WebCore/platform/graphics/skia/ImageSkia.cpp
+++ b/WebCore/platform/graphics/skia/ImageSkia.cpp
@@ -30,6 +30,7 @@
#include "config.h"
+#include "AffineTransform.h"
#include "BitmapImage.h"
#include "BitmapImageSingleFrameSkia.h"
#include "ChromiumBridge.h"
@@ -43,7 +44,6 @@
#include "SkiaUtils.h"
#include "SkRect.h"
#include "SkShader.h"
-#include "TransformationMatrix.h"
#include "skia/ext/image_operations.h"
#include "skia/ext/platform_canvas.h"
@@ -300,7 +300,7 @@ PassRefPtr<Image> Image::loadPlatformResource(const char *name)
void Image::drawPattern(GraphicsContext* context,
const FloatRect& floatSrcRect,
- const TransformationMatrix& patternTransform,
+ const AffineTransform& patternTransform,
const FloatPoint& phase,
ColorSpace styleColorSpace,
CompositeOperator compositeOp,
diff --git a/WebCore/platform/graphics/skia/PathSkia.cpp b/WebCore/platform/graphics/skia/PathSkia.cpp
index fe4c3d0..a0d4c79 100644
--- a/WebCore/platform/graphics/skia/PathSkia.cpp
+++ b/WebCore/platform/graphics/skia/PathSkia.cpp
@@ -220,11 +220,6 @@ void Path::transform(const AffineTransform& xform)
m_path->transform(xform);
}
-void Path::transform(const TransformationMatrix& xform)
-{
- m_path->transform(xform);
-}
-
String Path::debugString() const
{
String result;
diff --git a/WebCore/platform/graphics/skia/PatternSkia.cpp b/WebCore/platform/graphics/skia/PatternSkia.cpp
index b98825b..bd27b6a 100644
--- a/WebCore/platform/graphics/skia/PatternSkia.cpp
+++ b/WebCore/platform/graphics/skia/PatternSkia.cpp
@@ -29,9 +29,9 @@
#include "config.h"
#include "Pattern.h"
+#include "AffineTransform.h"
#include "Image.h"
#include "NativeImageSkia.h"
-#include "TransformationMatrix.h"
#include "SkCanvas.h"
#include "SkColor.h"
@@ -46,7 +46,7 @@ void Pattern::platformDestroy()
m_pattern = 0;
}
-PlatformPatternPtr Pattern::platformPattern(const TransformationMatrix& patternTransform)
+PlatformPatternPtr Pattern::platformPattern(const AffineTransform& patternTransform)
{
if (m_pattern)
return m_pattern;
diff --git a/WebCore/platform/graphics/skia/SkiaFontWin.cpp b/WebCore/platform/graphics/skia/SkiaFontWin.cpp
index f1c5cdc..58fa7d3 100644
--- a/WebCore/platform/graphics/skia/SkiaFontWin.cpp
+++ b/WebCore/platform/graphics/skia/SkiaFontWin.cpp
@@ -31,13 +31,13 @@
#include "config.h"
#include "SkiaFontWin.h"
+#include "AffineTransform.h"
#include "PlatformContextSkia.h"
#include "Gradient.h"
#include "Pattern.h"
#include "SkCanvas.h"
#include "SkPaint.h"
#include "SkShader.h"
-#include "TransformationMatrix.h"
#include <wtf/ListHashSet.h>
#include <wtf/Vector.h>
@@ -237,7 +237,7 @@ bool windowsCanHandleTextDrawing(GraphicsContext* context)
// in using Skia will show you the hinted outlines for the smaller size,
// which look weird. All else being equal, it's better to use Windows' text
// drawing, so we don't check for zooms.
- const TransformationMatrix& matrix = context->getCTM();
+ const AffineTransform& matrix = context->getCTM();
if (matrix.b() != 0 || matrix.c() != 0) // Check for skew.
return false;
diff --git a/WebCore/platform/graphics/transforms/AffineTransform.cpp b/WebCore/platform/graphics/transforms/AffineTransform.cpp
index f26bcb7..d6688d2 100644
--- a/WebCore/platform/graphics/transforms/AffineTransform.cpp
+++ b/WebCore/platform/graphics/transforms/AffineTransform.cpp
@@ -97,7 +97,7 @@ AffineTransform::AffineTransform(double a, double b, double c, double d, double
setMatrix(a, b, c, d, e, f);
}
-void AffineTransform::reset()
+void AffineTransform::makeIdentity()
{
setMatrix(1, 0, 0, 1, 0, 0);
}
@@ -136,6 +136,12 @@ AffineTransform AffineTransform::inverse() const
return AffineTransform();
AffineTransform result;
+ if (isIdentityOrTranslation()) {
+ result.m_transform[4] = -m_transform[4];
+ result.m_transform[5] = -m_transform[5];
+ return result;
+ }
+
result.m_transform[0] = m_transform[3] / determinant;
result.m_transform[1] = -m_transform[1] / determinant;
result.m_transform[2] = -m_transform[2] / determinant;
@@ -188,12 +194,29 @@ AffineTransform& AffineTransform::scale(double s)
AffineTransform& AffineTransform::scale(double sx, double sy)
{
m_transform[0] *= sx;
+ m_transform[1] *= sx;
+ m_transform[2] *= sy;
m_transform[3] *= sy;
return *this;
}
+// *this = *this * translation
AffineTransform& AffineTransform::translate(double tx, double ty)
{
+ if (isIdentityOrTranslation()) {
+ m_transform[4] += tx;
+ m_transform[5] += ty;
+ return *this;
+ }
+
+ m_transform[4] += tx * m_transform[0] + ty * m_transform[2];
+ m_transform[5] += tx * m_transform[1] + ty * m_transform[3];
+ return *this;
+}
+
+// *this = translation * *this
+AffineTransform& AffineTransform::translateRight(double tx, double ty)
+{
m_transform[4] += tx;
m_transform[5] += ty;
return *this;
@@ -221,9 +244,14 @@ AffineTransform& AffineTransform::flipY()
AffineTransform& AffineTransform::shear(double sx, double sy)
{
- AffineTransform shear(1, sy, sx, 1, 0, 0);
+ double a = m_transform[0];
+ double b = m_transform[1];
+
+ m_transform[0] += sy * m_transform[2];
+ m_transform[1] += sy * m_transform[3];
+ m_transform[2] += sx * a;
+ m_transform[3] += sx * b;
- multLeft(shear);
return *this;
}
@@ -250,16 +278,16 @@ AffineTransform makeMapBetweenRects(const FloatRect& source, const FloatRect& de
return transform;
}
-void AffineTransform::map(double x, double y, double* x2, double* y2) const
+void AffineTransform::map(double x, double y, double& x2, double& y2) const
{
- *x2 = (m_transform[0] * x + m_transform[2] * y + m_transform[4]);
- *y2 = (m_transform[1] * x + m_transform[3] * y + m_transform[5]);
+ x2 = (m_transform[0] * x + m_transform[2] * y + m_transform[4]);
+ y2 = (m_transform[1] * x + m_transform[3] * y + m_transform[5]);
}
IntPoint AffineTransform::mapPoint(const IntPoint& point) const
{
double x2, y2;
- map(point.x(), point.y(), &x2, &y2);
+ map(point.x(), point.y(), x2, y2);
// Round the point.
return IntPoint(lround(x2), lround(y2));
@@ -268,13 +296,24 @@ IntPoint AffineTransform::mapPoint(const IntPoint& point) const
FloatPoint AffineTransform::mapPoint(const FloatPoint& point) const
{
double x2, y2;
- map(point.x(), point.y(), &x2, &y2);
+ map(point.x(), point.y(), x2, y2);
return FloatPoint(narrowPrecisionToFloat(x2), narrowPrecisionToFloat(y2));
}
+IntRect AffineTransform::mapRect(const IntRect &rect) const
+{
+ return enclosingIntRect(mapRect(FloatRect(rect)));
+}
+
FloatRect AffineTransform::mapRect(const FloatRect& rect) const
{
+ if (isIdentityOrTranslation()) {
+ FloatRect mappedRect(rect);
+ mappedRect.move(narrowPrecisionToFloat(m_transform[4]), narrowPrecisionToFloat(m_transform[5]));
+ return mappedRect;
+ }
+
FloatQuad q(rect);
FloatQuad result;
diff --git a/WebCore/platform/graphics/transforms/AffineTransform.h b/WebCore/platform/graphics/transforms/AffineTransform.h
index 49add18..00631c2 100644
--- a/WebCore/platform/graphics/transforms/AffineTransform.h
+++ b/WebCore/platform/graphics/transforms/AffineTransform.h
@@ -51,6 +51,7 @@ class FloatQuad;
class FloatRect;
class IntPoint;
class IntRect;
+class TransformationMatrix;
class AffineTransform : public FastAllocBase {
public:
@@ -61,7 +62,7 @@ public:
void setMatrix(double a, double b, double c, double d, double e, double f);
- void map(double x, double y, double* x2, double* y2) const;
+ void map(double x, double y, double& x2, double& y2) const;
// Rounds the mapped point to the nearest integer value.
IntPoint mapPoint(const IntPoint&) const;
@@ -89,7 +90,7 @@ public:
double f() const { return m_transform[5]; }
void setF(double f) { m_transform[5] = f; }
- void reset();
+ void makeIdentity();
AffineTransform& multiply(const AffineTransform&);
AffineTransform& multLeft(const AffineTransform&);
@@ -99,6 +100,7 @@ public:
AffineTransform& rotate(double d);
AffineTransform& rotateFromVector(double x, double y);
AffineTransform& translate(double tx, double ty);
+ AffineTransform& translateRight(double tx, double ty);
AffineTransform& shear(double sx, double sy);
AffineTransform& flipX();
AffineTransform& flipY();
@@ -114,6 +116,11 @@ public:
TransformationMatrix toTransformationMatrix() const;
+ bool isIdentityOrTranslation() const
+ {
+ return m_transform[0] == 1 && m_transform[1] == 0 && m_transform[2] == 0 && m_transform[3] == 1;
+ }
+
bool operator== (const AffineTransform& m2) const
{
return (m_transform[0] == m2.m_transform[0]
diff --git a/WebCore/platform/graphics/transforms/TransformationMatrix.cpp b/WebCore/platform/graphics/transforms/TransformationMatrix.cpp
index 13ef281..0400d40 100644
--- a/WebCore/platform/graphics/transforms/TransformationMatrix.cpp
+++ b/WebCore/platform/graphics/transforms/TransformationMatrix.cpp
@@ -999,6 +999,12 @@ void TransformationMatrix::makeAffine()
m_matrix[3][3] = 1;
}
+AffineTransform TransformationMatrix::toAffineTransform() const
+{
+ return AffineTransform(m_matrix[0][0], m_matrix[0][1], m_matrix[1][0],
+ m_matrix[1][1], m_matrix[3][0], m_matrix[3][1]);
+}
+
static inline void blendFloat(double& from, double to, double progress)
{
if (from != to)
diff --git a/WebCore/platform/graphics/transforms/TransformationMatrix.h b/WebCore/platform/graphics/transforms/TransformationMatrix.h
index 9e724d5..cdf101d 100644
--- a/WebCore/platform/graphics/transforms/TransformationMatrix.h
+++ b/WebCore/platform/graphics/transforms/TransformationMatrix.h
@@ -26,6 +26,7 @@
#ifndef TransformationMatrix_h
#define TransformationMatrix_h
+#include "AffineTransform.h"
#include "FloatPoint.h"
#include "IntPoint.h"
#include <string.h> //for memcpy
@@ -55,6 +56,7 @@ typedef struct tagXFORM XFORM;
namespace WebCore {
+class AffineTransform;
class IntRect;
class FloatPoint3D;
class FloatRect;
@@ -268,6 +270,8 @@ public:
// Throw away the non-affine parts of the matrix (lossy!)
void makeAffine();
+ AffineTransform toAffineTransform() const;
+
bool operator==(const TransformationMatrix& m2) const
{
return (m_matrix[0][0] == m2.m_matrix[0][0] &&
diff --git a/WebCore/platform/graphics/win/FontCGWin.cpp b/WebCore/platform/graphics/win/FontCGWin.cpp
index 653b573..8ed8712 100644
--- a/WebCore/platform/graphics/win/FontCGWin.cpp
+++ b/WebCore/platform/graphics/win/FontCGWin.cpp
@@ -26,7 +26,7 @@
#include "config.h"
#include "Font.h"
-#include "TransformationMatrix.h"
+#include "AffineTransform.h"
#include "FloatConversion.h"
#include "GlyphBuffer.h"
#include "GraphicsContext.h"
@@ -225,7 +225,7 @@ static void drawGDIGlyphs(GraphicsContext* graphicsContext, const SimpleFontData
} else {
XFORM xform;
GetWorldTransform(hdc, &xform);
- TransformationMatrix hdcTransform(xform.eM11, xform.eM21, xform.eM12, xform.eM22, xform.eDx, xform.eDy);
+ AffineTransform hdcTransform(xform.eM11, xform.eM21, xform.eM12, xform.eM22, xform.eDx, xform.eDy);
CGAffineTransform initialGlyphTransform = hdcTransform.isInvertible() ? hdcTransform.inverse() : CGAffineTransformIdentity;
if (font->platformData().syntheticOblique())
initialGlyphTransform = CGAffineTransformConcat(initialGlyphTransform, CGAffineTransformMake(1, 0, tanf(syntheticObliqueAngle * piFloat / 180.0f), 1, 0, 0));
diff --git a/WebCore/platform/graphics/win/FontCacheWin.cpp b/WebCore/platform/graphics/win/FontCacheWin.cpp
index 5e61ef3..8869a90 100644
--- a/WebCore/platform/graphics/win/FontCacheWin.cpp
+++ b/WebCore/platform/graphics/win/FontCacheWin.cpp
@@ -296,18 +296,18 @@ const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, cons
return fontData;
}
-FontPlatformData* FontCache::getSimilarFontPlatformData(const Font& font)
+SimpleFontData* FontCache::getSimilarFontPlatformData(const Font& font)
{
return 0;
}
-FontPlatformData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription)
+SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription)
{
// FIXME: Would be even better to somehow get the user's default font here. For now we'll pick
// the default that the user would get without changing any prefs.
static AtomicString timesStr("Times New Roman");
- if (FontPlatformData* platformFont = getCachedFontPlatformData(fontDescription, timesStr))
- return platformFont;
+ if (SimpleFontData* simpleFont = getCachedFontData(fontDescription, timesStr))
+ return simpleFont;
DEFINE_STATIC_LOCAL(String, defaultGUIFontFamily, ());
if (defaultGUIFontFamily.isEmpty()) {
@@ -316,7 +316,7 @@ FontPlatformData* FontCache::getLastResortFallbackFont(const FontDescription& fo
GetObject(defaultGUIFont, sizeof(logFont), &logFont);
defaultGUIFontFamily = String(logFont.lfFaceName, wcsnlen(logFont.lfFaceName, LF_FACESIZE));
}
- return getCachedFontPlatformData(fontDescription, defaultGUIFontFamily);
+ return getCachedFontData(fontDescription, defaultGUIFontFamily);
}
static LONG toGDIFontWeight(FontWeight fontWeight)
diff --git a/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp b/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp
index 47a51de..84c4ce0 100644
--- a/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp
+++ b/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp
@@ -26,7 +26,7 @@
#include "config.h"
#include "GraphicsContext.h"
-#include "TransformationMatrix.h"
+#include "AffineTransform.h"
#include "Path.h"
#include <CoreGraphics/CGBitmapContext.h>
diff --git a/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp b/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp
index 43d92fb..7387a14 100644
--- a/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp
+++ b/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp
@@ -26,7 +26,7 @@
#include "config.h"
#include "GraphicsContext.h"
-#include "TransformationMatrix.h"
+#include "AffineTransform.h"
#include "Path.h"
#include <cairo-win32.h>
diff --git a/WebCore/platform/graphics/win/GraphicsContextWin.cpp b/WebCore/platform/graphics/win/GraphicsContextWin.cpp
index 68c12d1..b110145 100644
--- a/WebCore/platform/graphics/win/GraphicsContextWin.cpp
+++ b/WebCore/platform/graphics/win/GraphicsContextWin.cpp
@@ -195,17 +195,7 @@ void GraphicsContextPlatformPrivate::concatCTM(const AffineTransform& transform)
if (!m_hdc)
return;
- XFORM xform = TransformationMatrix(transform.a(), transform.b(), transform.c(),
- transform.d(), transform.e(), transform.f());
- ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY);
-}
-
-void GraphicsContextPlatformPrivate::concatCTM(const TransformationMatrix& transform)
-{
- if (!m_hdc)
- return;
-
- XFORM xform = transform;
+ XFORM xform = transform.toTransformationMatrix();
ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY);
}
diff --git a/WebCore/platform/graphics/win/GraphicsLayerCACF.cpp b/WebCore/platform/graphics/win/GraphicsLayerCACF.cpp
index 5ec90b8..49b5af3 100644
--- a/WebCore/platform/graphics/win/GraphicsLayerCACF.cpp
+++ b/WebCore/platform/graphics/win/GraphicsLayerCACF.cpp
@@ -135,6 +135,9 @@ GraphicsLayerCACF::~GraphicsLayerCACF()
if (m_layer)
m_layer->removeFromSuperlayer();
+ if (m_contentsLayer)
+ m_contentsLayer->removeFromSuperlayer();
+
if (m_transformLayer)
m_transformLayer->removeFromSuperlayer();
}
@@ -364,21 +367,18 @@ void GraphicsLayerCACF::setContentsToImage(Image* image)
updateSublayerList();
}
-void GraphicsLayerCACF::setContentsToVideo(PlatformLayer* videoLayer)
+void GraphicsLayerCACF::setContentsToMedia(PlatformLayer* mediaLayer)
{
- bool childrenChanged = false;
-
- if (videoLayer != m_contentsLayer.get())
- childrenChanged = true;
+ if (mediaLayer == m_contentsLayer)
+ return;
- m_contentsLayer = videoLayer;
- m_contentsLayerPurpose = videoLayer ? ContentsLayerForVideo : NoContentsLayer;
+ m_contentsLayer = mediaLayer;
+ m_contentsLayerPurpose = mediaLayer ? ContentsLayerForMedia : NoContentsLayer;
- updateContentsVideo();
+ updateContentsMedia();
- // This has to happen after updateContentsVideo
- if (childrenChanged)
- updateSublayerList();
+ // This has to happen after updateContentsMedia
+ updateSublayerList();
}
void GraphicsLayerCACF::setGeometryOrientation(CompositingCoordinatesOrientation orientation)
@@ -633,9 +633,9 @@ void GraphicsLayerCACF::updateContentsImage()
}
}
-void GraphicsLayerCACF::updateContentsVideo()
+void GraphicsLayerCACF::updateContentsMedia()
{
- // Video layer was set as m_contentsLayer, and will get parented in updateSublayerList().
+ // Media layer was set as m_contentsLayer, and will get parented in updateSublayerList().
if (m_contentsLayer) {
setupContentsLayer(m_contentsLayer.get());
updateContentsRect();
diff --git a/WebCore/platform/graphics/win/GraphicsLayerCACF.h b/WebCore/platform/graphics/win/GraphicsLayerCACF.h
index 93ddf25..0a52764 100644
--- a/WebCore/platform/graphics/win/GraphicsLayerCACF.h
+++ b/WebCore/platform/graphics/win/GraphicsLayerCACF.h
@@ -82,7 +82,7 @@ public:
virtual void setContentsRect(const IntRect&);
virtual void setContentsToImage(Image*);
- virtual void setContentsToVideo(PlatformLayer*);
+ virtual void setContentsToMedia(PlatformLayer*);
virtual PlatformLayer* platformLayer() const;
@@ -115,7 +115,7 @@ private:
void updateLayerBackgroundColor();
void updateContentsImage();
- void updateContentsVideo();
+ void updateContentsMedia();
void updateContentsRect();
void updateGeometryOrientation();
@@ -129,7 +129,7 @@ private:
enum ContentsLayerPurpose {
NoContentsLayer = 0,
ContentsLayerForImage,
- ContentsLayerForVideo
+ ContentsLayerForMedia
};
ContentsLayerPurpose m_contentsLayerPurpose;
diff --git a/WebCore/platform/graphics/win/QTMovieWin.cpp b/WebCore/platform/graphics/win/QTMovieWin.cpp
index 8fd6c71..4831062 100644
--- a/WebCore/platform/graphics/win/QTMovieWin.cpp
+++ b/WebCore/platform/graphics/win/QTMovieWin.cpp
@@ -99,6 +99,7 @@ public:
void deleteGWorld();
void clearGWorld();
void cacheMovieScale();
+ void updateMovieSize();
void setSize(int, int);
@@ -226,8 +227,8 @@ void QTMovieWinPrivate::cacheMovieScale()
GetMovieNaturalBoundsRect(m_movie, &naturalRect);
GetMovieBox(m_movie, &initialRect);
- int naturalWidth = naturalRect.right - naturalRect.left;
- int naturalHeight = naturalRect.bottom - naturalRect.top;
+ float naturalWidth = naturalRect.right - naturalRect.left;
+ float naturalHeight = naturalRect.bottom - naturalRect.top;
if (naturalWidth)
m_widthScaleFactor = (initialRect.right - initialRect.left) / naturalWidth;
@@ -259,14 +260,16 @@ void QTMovieWinPrivate::task()
// we only need to erase the movie gworld when the load state changes to loaded while it
// is visible as the gworld is destroyed/created when visibility changes
bool shouldRestorePlaybackState = false;
- if (loadState >= QTMovieLoadStateLoaded && m_loadState < QTMovieLoadStateLoaded) {
+ bool movieNewlyPlayable = loadState >= QTMovieLoadStateLoaded && m_loadState < QTMovieLoadStateLoaded;
+ m_loadState = loadState;
+ if (movieNewlyPlayable) {
+ cacheMovieScale();
+ updateMovieSize();
if (m_visible)
clearGWorld();
- cacheMovieScale();
shouldRestorePlaybackState = true;
}
- m_loadState = loadState;
if (!m_movieController && m_loadState >= QTMovieLoadStateLoaded)
createMovieController();
m_client->movieLoadStateChanged(m_movieWin);
@@ -403,7 +406,6 @@ void QTMovieWinPrivate::clearGWorld()
MacSetPort(savePort);
}
-
void QTMovieWinPrivate::setSize(int width, int height)
{
if (m_width == width && m_height == height)
@@ -421,17 +423,26 @@ void QTMovieWinPrivate::setSize(int width, int height)
ASSERT(m_scaleCached);
#endif
+ updateMovieSize();
+}
+
+void QTMovieWinPrivate::updateMovieSize()
+{
+ if (!m_movie || m_loadState < QTMovieLoadStateLoaded)
+ return;
+
Rect bounds;
bounds.top = 0;
bounds.left = 0;
- bounds.right = width;
- bounds.bottom = height;
+ bounds.right = m_width;
+ bounds.bottom = m_height;
if (m_movieController)
MCSetControllerBoundsRect(m_movieController, &bounds);
SetMovieBox(m_movie, &bounds);
updateGWorld();
}
+
void QTMovieWinPrivate::deleteGWorld()
{
ASSERT(m_gWorld);
diff --git a/WebCore/platform/graphics/win/WKCACFLayer.cpp b/WebCore/platform/graphics/win/WKCACFLayer.cpp
index e97fac9..e5b184d 100644
--- a/WebCore/platform/graphics/win/WKCACFLayer.cpp
+++ b/WebCore/platform/graphics/win/WKCACFLayer.cpp
@@ -29,6 +29,7 @@
#include "WKCACFLayer.h"
+#include "CString.h"
#include "WKCACFContextFlusher.h"
#include "WKCACFLayerRenderer.h"
@@ -37,6 +38,10 @@
#include <QuartzCore/CARender.h>
#include <QuartzCoreInterface/QuartzCoreInterface.h>
+#ifndef NDEBUG
+#include <wtf/CurrentTime.h>
+#endif
+
#ifdef DEBUG_ALL
#pragma comment(lib, "QuartzCore_debug")
#pragma comment(lib, "QuartzCoreInterface_debug")
@@ -282,6 +287,11 @@ void WKCACFLayer::setNeedsCommit()
m_owner->notifySyncRequired();
}
+bool WKCACFLayer::isTransformLayer() const
+{
+ return CACFLayerGetClass(layer()) == kCACFTransformLayer();
+}
+
void WKCACFLayer::addSublayer(PassRefPtr<WKCACFLayer> sublayer)
{
insertSublayer(sublayer, numSublayers());
@@ -372,6 +382,15 @@ void WKCACFLayer::removeSublayer(const WKCACFLayer* sublayer)
setNeedsCommit();
}
+const WKCACFLayer* WKCACFLayer::sublayerAtIndex(int index) const
+{
+ CFArrayRef sublayers = CACFLayerGetSublayers(layer());
+ if (index < 0 || CFArrayGetCount(sublayers) <= index)
+ return 0;
+
+ return layer(static_cast<CACFLayerRef>(const_cast<void*>(CFArrayGetValueAtIndex(sublayers, index))));
+}
+
int WKCACFLayer::indexOfSublayer(const WKCACFLayer* reference)
{
CACFLayerRef ref = reference->layer();
@@ -518,7 +537,108 @@ void WKCACFLayer::setNeedsDisplay()
setNeedsCommit();
}
+#ifndef NDEBUG
+static void printIndent(int indent)
+{
+ for ( ; indent > 0; --indent)
+ fprintf(stderr, " ");
+}
+
+static void printTransform(const CATransform3D& transform)
+{
+ fprintf(stderr, "[%g %g %g %g; %g %g %g %g; %g %g %g %g; %g %g %g %g]",
+ transform.m11, transform.m12, transform.m13, transform.m14,
+ transform.m21, transform.m22, transform.m23, transform.m24,
+ transform.m31, transform.m32, transform.m33, transform.m34,
+ transform.m41, transform.m42, transform.m43, transform.m44);
+}
+
+void WKCACFLayer::printTree() const
+{
+ // Print heading info
+ CGRect rootBounds = bounds();
+ fprintf(stderr, "\n\n** Render tree at time %g (bounds %g, %g %gx%g) **\n\n",
+ currentTime(), rootBounds.origin.x, rootBounds.origin.y, rootBounds.size.width, rootBounds.size.height);
+
+ // Print layer tree from the root
+ printLayer(0);
+}
+
+void WKCACFLayer::printLayer(int indent) const
+{
+ CGPoint layerPosition = position();
+ CGPoint layerAnchorPoint = anchorPoint();
+ CGRect layerBounds = bounds();
+ printIndent(indent);
+ fprintf(stderr, "(%s [%g %g %g] [%g %g %g %g] [%g %g %g]\n",
+ isTransformLayer() ? "transform-layer" : "layer",
+ layerPosition.x, layerPosition.y, zPosition(),
+ layerBounds.origin.x, layerBounds.origin.y, layerBounds.size.width, layerBounds.size.height,
+ layerAnchorPoint.x, layerAnchorPoint.y, anchorPointZ());
+
+ // Print name if needed
+ String layerName = name();
+ if (!layerName.isEmpty()) {
+ printIndent(indent + 1);
+ fprintf(stderr, "(name %s)\n", layerName.utf8().data());
+ }
+
+ // Print masksToBounds if needed
+ bool layerMasksToBounds = masksToBounds();
+ if (layerMasksToBounds) {
+ printIndent(indent + 1);
+ fprintf(stderr, "(masksToBounds true)\n");
+ }
+
+ // Print opacity if needed
+ float layerOpacity = opacity();
+ if (layerOpacity != 1) {
+ printIndent(indent + 1);
+ fprintf(stderr, "(opacity %hf)\n", layerOpacity);
+ }
+
+ // Print sublayerTransform if needed
+ CATransform3D layerTransform = sublayerTransform();
+ if (!CATransform3DIsIdentity(layerTransform)) {
+ printIndent(indent + 1);
+ fprintf(stderr, "(sublayerTransform ");
+ printTransform(layerTransform);
+ fprintf(stderr, ")\n");
+ }
+
+ // Print transform if needed
+ layerTransform = transform();
+ if (!CATransform3DIsIdentity(layerTransform)) {
+ printIndent(indent + 1);
+ fprintf(stderr, "(transform ");
+ printTransform(layerTransform);
+ fprintf(stderr, ")\n");
+ }
+
+ // Print contents if needed
+ CGImageRef layerContents = contents();
+ if (layerContents) {
+ printIndent(indent + 1);
+ fprintf(stderr, "(contents (image [%d %d]))\n",
+ CGImageGetWidth(layerContents), CGImageGetHeight(layerContents));
+ }
+
+ // Print sublayers if needed
+ int n = numSublayers();
+ if (n > 0) {
+ printIndent(indent + 1);
+ fprintf(stderr, "(sublayers\n");
+ for (int i = 0; i < n; ++i)
+ sublayerAtIndex(i)->printLayer(indent + 2);
+ printIndent(indent + 1);
+ fprintf(stderr, ")\n");
+ }
+
+ printIndent(indent);
+ fprintf(stderr, ")\n");
+}
+#endif // #ifndef NDEBUG
}
#endif // USE(ACCELERATED_COMPOSITING)
diff --git a/WebCore/platform/graphics/win/WKCACFLayer.h b/WebCore/platform/graphics/win/WKCACFLayer.h
index 6892c6e..e5568c9 100644
--- a/WebCore/platform/graphics/win/WKCACFLayer.h
+++ b/WebCore/platform/graphics/win/WKCACFLayer.h
@@ -108,7 +108,7 @@ public:
void display(PlatformGraphicsContext*);
- bool isTransformLayer() const { return CACFLayerGetClass(layer()) == kCACFTransformLayer; }
+ bool isTransformLayer() const;
void addSublayer(PassRefPtr<WKCACFLayer> sublayer);
void insertSublayer(PassRefPtr<WKCACFLayer>, size_t index);
@@ -223,6 +223,11 @@ public:
void setGeometryFlipped(bool flipped) { CACFLayerSetGeometryFlipped(layer(), flipped); setNeedsCommit(); }
bool geometryFlipped() const { return CACFLayerIsGeometryFlipped(layer()); }
+#ifndef NDEBUG
+ // Print the tree from the root. Also does consistency checks
+ void printTree() const;
+#endif
+
private:
WKCACFLayer(LayerType, GraphicsLayerCACF* owner);
@@ -233,6 +238,8 @@ private:
CFArrayRef sublayers = CACFLayerGetSublayers(layer());
return sublayers ? CFArrayGetCount(sublayers) : 0;
}
+
+ const WKCACFLayer* sublayerAtIndex(int) const;
// Returns the index of the passed layer in this layer's sublayers list
// or -1 if not found
@@ -241,6 +248,11 @@ private:
// This should only be called from removeFromSuperlayer.
void removeSublayer(const WKCACFLayer*);
+#ifndef NDEBUG
+ // Print this layer and its children to the console
+ void printLayer(int indent) const;
+#endif
+
RetainPtr<CACFLayerRef> m_layer;
bool m_needsDisplayOnBoundsChange;
GraphicsLayerCACF* m_owner;
diff --git a/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp b/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp
index 3bbd4f8..78ebb9d 100644
--- a/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp
+++ b/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp
@@ -142,6 +142,10 @@ WKCACFLayerRenderer::WKCACFLayerRenderer()
, m_renderTimer(this, &WKCACFLayerRenderer::renderTimerFired)
, m_scrollFrame(0, 0, 1, 1) // Default to 1 to avoid 0 size frames
{
+#ifndef NDEBUG
+ char* printTreeFlag = getenv("CA_PRINT_TREE");
+ m_printTree = printTreeFlag && atoi(printTreeFlag);
+#endif
}
WKCACFLayerRenderer::~WKCACFLayerRenderer()
@@ -157,7 +161,7 @@ void WKCACFLayerRenderer::setScrollFrame(const IntRect& scrollFrame)
m_scrollLayer->setPosition(CGPointMake(0, frameBounds.size.height));
if (m_rootChildLayer)
- m_rootChildLayer->setPosition(CGPointMake(m_scrollFrame.x(), m_scrollFrame.height() + m_scrollFrame.y()));
+ m_rootChildLayer->setPosition(CGPointMake(-m_scrollFrame.x(), m_scrollFrame.height() + m_scrollFrame.y()));
}
void WKCACFLayerRenderer::setRootContents(CGImageRef image)
@@ -173,6 +177,7 @@ void WKCACFLayerRenderer::setRootChildLayer(WebCore::PlatformLayer* layer)
return;
m_scrollLayer->removeAllSublayers();
+ m_rootChildLayer = layer;
if (layer) {
m_scrollLayer->addSublayer(layer);
@@ -180,9 +185,6 @@ void WKCACFLayerRenderer::setRootChildLayer(WebCore::PlatformLayer* layer)
layer->setAnchorPoint(CGPointMake(0, 1));
setScrollFrame(m_scrollFrame);
}
-
- m_rootChildLayer = layer;
-
}
void WKCACFLayerRenderer::setNeedsDisplay()
@@ -230,7 +232,9 @@ void WKCACFLayerRenderer::createRenderer()
// Create the root hierarchy
m_rootLayer = WKCACFLayer::create(WKCACFLayer::Layer);
+ m_rootLayer->setName("WKCACFLayerRenderer rootLayer");
m_scrollLayer = WKCACFLayer::create(WKCACFLayer::Layer);
+ m_scrollLayer->setName("WKCACFLayerRenderer scrollLayer");
m_rootLayer->addSublayer(m_scrollLayer);
m_scrollLayer->setMasksToBounds(true);
@@ -400,6 +404,11 @@ void WKCACFLayerRenderer::render(const Vector<CGRect>& dirtyRects)
} while (err == D3DERR_DEVICELOST);
CARenderUpdateFinish(u);
+
+#ifndef NDEBUG
+ if (m_printTree)
+ m_rootLayer->printTree();
+#endif
}
void WKCACFLayerRenderer::renderSoon()
diff --git a/WebCore/platform/graphics/win/WKCACFLayerRenderer.h b/WebCore/platform/graphics/win/WKCACFLayerRenderer.h
index cb9f04f..4e76f55 100644
--- a/WebCore/platform/graphics/win/WKCACFLayerRenderer.h
+++ b/WebCore/platform/graphics/win/WKCACFLayerRenderer.h
@@ -97,6 +97,10 @@ private:
HWND m_hostWindow;
Timer<WKCACFLayerRenderer> m_renderTimer;
IntRect m_scrollFrame;
+
+#ifndef NDEBUG
+ bool m_printTree;
+#endif
};
}
diff --git a/WebCore/platform/graphics/wince/FontCacheWince.cpp b/WebCore/platform/graphics/wince/FontCacheWince.cpp
index f67f1b4..3262fc0 100644
--- a/WebCore/platform/graphics/wince/FontCacheWince.cpp
+++ b/WebCore/platform/graphics/wince/FontCacheWince.cpp
@@ -316,16 +316,16 @@ const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, cons
return 0;
}
-FontPlatformData* FontCache::getSimilarFontPlatformData(const Font& font)
+SimpleFontData* FontCache::getSimilarFontPlatformData(const Font& font)
{
return 0;
}
-FontPlatformData* FontCache::getLastResortFallbackFont(const FontDescription& fontDesc)
+SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& fontDesc)
{
// FIXME: Would be even better to somehow get the user's default font here. For now we'll pick
// the default that the user would get without changing any prefs.
- return getCachedFontPlatformData(fontDesc, FontPlatformData::defaultFontFamily());
+ return getCachedFontData(fontDesc, FontPlatformData::defaultFontFamily());
}
FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family)
diff --git a/WebCore/platform/graphics/wince/FontWince.cpp b/WebCore/platform/graphics/wince/FontWince.cpp
index d00336b..6c03712 100644
--- a/WebCore/platform/graphics/wince/FontWince.cpp
+++ b/WebCore/platform/graphics/wince/FontWince.cpp
@@ -29,6 +29,7 @@
#include "config.h"
#include "Font.h"
+#include "AffineTransform.h"
#include "FloatRect.h"
#include "FontCache.h"
#include "FontData.h"
@@ -37,7 +38,6 @@
#include "GraphicsContext.h"
#include "IntRect.h"
#include "NotImplemented.h"
-#include "TransformationMatrix.h"
#include "WidthIterator.h"
#include <wtf/MathExtras.h>
#include <wtf/OwnPtr.h>
diff --git a/WebCore/platform/graphics/wince/GraphicsContextWince.cpp b/WebCore/platform/graphics/wince/GraphicsContextWince.cpp
index 410aeb1..42e94a4 100644
--- a/WebCore/platform/graphics/wince/GraphicsContextWince.cpp
+++ b/WebCore/platform/graphics/wince/GraphicsContextWince.cpp
@@ -31,7 +31,6 @@
#include "PlatformPathWince.h"
#include "SharedBitmap.h"
#include "SimpleFontData.h"
-#include "TransformationMatrix.h"
#include <wtf/OwnPtr.h>
#include <windows.h>
@@ -169,7 +168,7 @@ public:
{
}
- TransformationMatrix m_transform;
+ AffineTransform m_transform;
float m_opacity;
Vector<Path> m_paths;
};
@@ -212,7 +211,7 @@ public:
m_transform.rotate(rad2deg(radians));
}
- void concatCTM(const TransformationMatrix& transform)
+ void concatCTM(const AffineTransform& transform)
{
m_transform = transform * m_transform;
}
@@ -1149,11 +1148,6 @@ void GraphicsContext::concatCTM(const AffineTransform& transform)
m_data->concatCTM(transform);
}
-void GraphicsContext::concatCTM(const TransformationMatrix& transform)
-{
- m_data->concatCTM(transform);
-}
-
TransformationMatrix& GraphicsContext::affineTransform()
{
return m_data->m_transform;
@@ -1386,7 +1380,7 @@ void GraphicsContext::fillPath()
if (!dc)
continue;
- TransformationMatrix tr = m_data->m_transform;
+ AffineTransform tr = m_data->m_transform;
tr.translate(transparentDC.toShift().width(), transparentDC.toShift().height());
SelectObject(dc, GetStockObject(NULL_PEN));
@@ -1426,7 +1420,7 @@ void GraphicsContext::strokePath()
if (!dc)
continue;
- TransformationMatrix tr = m_data->m_transform;
+ AffineTransform tr = m_data->m_transform;
tr.translate(transparentDC.toShift().width(), transparentDC.toShift().height());
SelectObject(dc, GetStockObject(NULL_BRUSH));
@@ -1537,12 +1531,7 @@ void GraphicsContext::fillRect(const FloatRect& r, const Gradient* gradient)
GradientFill(dc, tv.data(), tv.size(), mesh.data(), mesh.size(), vertical ? GRADIENT_FILL_RECT_V : GRADIENT_FILL_RECT_H);
}
-AffineTransform GraphicsContext::getAffineCTM() const
-{
- return m_data->m_transform;
-}
-
-TransformationMatrix GraphicsContext::getCTM() const
+AffineTransform GraphicsContext::getCTM() const
{
return m_data->m_transform;
}
@@ -1885,7 +1874,7 @@ void GraphicsContext::drawBitmap(SharedBitmap* bmp, const IntRect& dstRectIn, co
transparentDC.fillAlphaChannel();
}
-void GraphicsContext::drawBitmapPattern(SharedBitmap* bmp, const FloatRect& tileRectIn, const TransformationMatrix& patternTransform,
+void GraphicsContext::drawBitmapPattern(SharedBitmap* bmp, const FloatRect& tileRectIn, const AffineTransform& patternTransform,
const FloatPoint& phase, CompositeOperator op, const FloatRect& destRectIn, const IntSize& origSourceSize)
{
if (!m_data->m_opacity)
@@ -1904,7 +1893,7 @@ void GraphicsContext::drawBitmapPattern(SharedBitmap* bmp, const FloatRect& tile
trRect.move(transparentDC.toShift());
FloatRect movedDstRect = m_data->m_transform.inverse().mapRect(FloatRect(trRect));
FloatSize moved(movedDstRect.location() - destRectIn.location());
- TransformationMatrix transform = m_data->m_transform;
+ AffineTransform transform = m_data->m_transform;
transform.translate(moved.width(), moved.height());
bmp->drawPattern(dc, transform, tileRectIn, patternTransform, phase, op, destRectIn, origSourceSize);
diff --git a/WebCore/platform/graphics/wince/ImageBufferWince.cpp b/WebCore/platform/graphics/wince/ImageBufferWince.cpp
index 3417f5f..9624e26 100644
--- a/WebCore/platform/graphics/wince/ImageBufferWince.cpp
+++ b/WebCore/platform/graphics/wince/ImageBufferWince.cpp
@@ -42,7 +42,7 @@ public:
virtual void destroyDecodedData(bool destroyAll = true) {}
virtual unsigned decodedSize() const { return 0; }
virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator);
- virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const TransformationMatrix& patternTransform,
+ virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform,
const FloatPoint& phase, CompositeOperator, const FloatRect& destRect);
const ImageBufferData* m_data;
@@ -55,7 +55,7 @@ void BufferedImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const
m_data->m_bitmap->draw(ctxt, intDstRect, intSrcRect, compositeOp);
}
-void BufferedImage::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRectIn, const TransformationMatrix& patternTransform,
+void BufferedImage::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRectIn, const AffineTransform& patternTransform,
const FloatPoint& phase, CompositeOperator op, const FloatRect& destRect)
{
m_data->m_bitmap->drawPattern(ctxt, tileRectIn, patternTransform, phase, op, destRect, size());
diff --git a/WebCore/platform/graphics/wince/PathWince.cpp b/WebCore/platform/graphics/wince/PathWince.cpp
index 7589ccb..00d03b1 100644
--- a/WebCore/platform/graphics/wince/PathWince.cpp
+++ b/WebCore/platform/graphics/wince/PathWince.cpp
@@ -20,11 +20,11 @@
#include "config.h"
#include "Path.h"
+#include "AffineTransform.h"
#include "FloatRect.h"
#include "NotImplemented.h"
#include "PlatformPathWince.h"
#include "PlatformString.h"
-#include "TransformationMatrix.h"
#include <wtf/OwnPtr.h>
namespace WebCore {
@@ -133,7 +133,7 @@ void Path::apply(void* info, PathApplierFunction function) const
m_path->apply(info, function);
}
-void Path::transform(const TransformationMatrix& t)
+void Path::transform(const AffineTransform& t)
{
m_path->transform(t);
}
diff --git a/WebCore/platform/graphics/wince/PlatformPathWince.cpp b/WebCore/platform/graphics/wince/PlatformPathWince.cpp
index 66fad50..cde5461 100644
--- a/WebCore/platform/graphics/wince/PlatformPathWince.cpp
+++ b/WebCore/platform/graphics/wince/PlatformPathWince.cpp
@@ -20,11 +20,11 @@
#include "config.h"
#include "PlatformPathWince.h"
+#include "AffineTransform.h"
#include "FloatRect.h"
#include "GraphicsContext.h"
#include "Path.h"
#include "PlatformString.h"
-#include "TransformationMatrix.h"
#include "WinceGraphicsExtras.h"
#include <wtf/MathExtras.h>
#include <wtf/OwnPtr.h>
@@ -232,7 +232,7 @@ static void addArcPoints(PathPolygon& poly, const PlatformPathElement::ArcTo& da
poly.append(data.m_end);
}
-static void drawPolygons(HDC dc, const Vector<PathPolygon>& polygons, bool fill, const TransformationMatrix* transformation)
+static void drawPolygons(HDC dc, const Vector<PathPolygon>& polygons, bool fill, const AffineTransform* transformation)
{
MemoryAllocationCanFail canFail;
for (Vector<PathPolygon>::const_iterator i = polygons.begin(); i != polygons.end(); ++i) {
@@ -317,7 +317,7 @@ void PathPolygon::move(const FloatSize& offset)
i->move(offset);
}
-void PathPolygon::transform(const TransformationMatrix& t)
+void PathPolygon::transform(const AffineTransform& t)
{
for (Vector<PathPoint>::iterator i = begin(); i < end(); ++i)
*i = t.mapPoint(*i);
@@ -403,7 +403,7 @@ void PlatformPathElement::move(const FloatSize& offset)
m_data.m_points[i].move(offset);
}
-void PlatformPathElement::transform(const TransformationMatrix& t)
+void PlatformPathElement::transform(const AffineTransform& t)
{
int n = numControlPoints();
for (int i = 0; i < n; ++i) {
@@ -571,12 +571,12 @@ void PlatformPath::clear()
m_penLifted = true;
}
-void PlatformPath::strokePath(HDC dc, const TransformationMatrix* transformation) const
+void PlatformPath::strokePath(HDC dc, const AffineTransform* transformation) const
{
drawPolygons(dc, m_subpaths, false, transformation);
}
-void PlatformPath::fillPath(HDC dc, const TransformationMatrix* transformation) const
+void PlatformPath::fillPath(HDC dc, const AffineTransform* transformation) const
{
HGDIOBJ oldPen = SelectObject(dc, GetStockObject(NULL_PEN));
drawPolygons(dc, m_subpaths, true, transformation);
@@ -593,7 +593,7 @@ void PlatformPath::translate(const FloatSize& size)
it->move(size);
}
-void PlatformPath::transform(const TransformationMatrix& t)
+void PlatformPath::transform(const AffineTransform& t)
{
for (PlatformPathElements::iterator it(m_elements.begin()); it != m_elements.end(); ++it)
it->transform(t);
diff --git a/WebCore/platform/graphics/wince/PlatformPathWince.h b/WebCore/platform/graphics/wince/PlatformPathWince.h
index fca00a7..e614cec 100644
--- a/WebCore/platform/graphics/wince/PlatformPathWince.h
+++ b/WebCore/platform/graphics/wince/PlatformPathWince.h
@@ -51,7 +51,7 @@ namespace WebCore {
struct PathPolygon: public Vector<PathPoint> {
void move(const FloatSize& offset);
- void transform(const TransformationMatrix& t);
+ void transform(const AffineTransform& t);
bool contains(const FloatPoint& point) const;
};
@@ -113,7 +113,7 @@ namespace WebCore {
int numPoints() const;
int numControlPoints() const;
void move(const FloatSize& offset);
- void transform(const TransformationMatrix& t);
+ void transform(const AffineTransform& t);
PathElementType type() const;
PlaformPathElementType platformType() const { return m_type; }
void inflateRectToContainMe(FloatRect& r, const FloatPoint& lastPoint) const;
@@ -141,14 +141,14 @@ namespace WebCore {
void clear();
bool isEmpty() const { return m_elements.isEmpty(); }
- void strokePath(HDC, const TransformationMatrix* tr) const;
- void fillPath(HDC, const TransformationMatrix* tr) const;
+ void strokePath(HDC, const AffineTransform* tr) const;
+ void fillPath(HDC, const AffineTransform* tr) const;
FloatPoint lastPoint() const { return m_elements.isEmpty() ? FloatPoint(0, 0) : m_elements.last().lastPoint(); }
const FloatRect& boundingRect() const { return m_boundingRect; }
bool contains(const FloatPoint& point, WindRule rule) const;
void translate(const FloatSize& size);
- void transform(const TransformationMatrix& t);
+ void transform(const AffineTransform& t);
void moveTo(const FloatPoint&);
void addLineTo(const FloatPoint&);
diff --git a/WebCore/platform/graphics/wx/FontCacheWx.cpp b/WebCore/platform/graphics/wx/FontCacheWx.cpp
index db107e4..b2dea2e 100644
--- a/WebCore/platform/graphics/wx/FontCacheWx.cpp
+++ b/WebCore/platform/graphics/wx/FontCacheWx.cpp
@@ -46,17 +46,17 @@ const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, cons
return fontData;
}
-FontPlatformData* FontCache::getSimilarFontPlatformData(const Font& font)
+SimpleFontData* FontCache::getSimilarFontPlatformData(const Font& font)
{
- return new FontPlatformData(font.fontDescription(), font.family().family());
+ return getCachedFontData(font.fontDescription(), font.family().family());
}
-FontPlatformData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription)
+SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription)
{
// FIXME: Would be even better to somehow get the user's default font here. For now we'll pick
// the default that the user would get without changing any prefs.
static AtomicString timesStr("systemfont");
- return getCachedFontPlatformData(fontDescription, timesStr);
+ return getCachedFontData(fontDescription, timesStr);
}
FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family)
diff --git a/WebCore/platform/graphics/wx/FontPlatformData.h b/WebCore/platform/graphics/wx/FontPlatformData.h
index 3b99830..be00edc 100644
--- a/WebCore/platform/graphics/wx/FontPlatformData.h
+++ b/WebCore/platform/graphics/wx/FontPlatformData.h
@@ -113,6 +113,13 @@ public:
bool isHashTableDeletedValue() const { return m_fontState == DELETED; }
+ bool roundsGlyphAdvances() const { return false; }
+
+#if OS(WINDOWS)
+ bool useGDI() const;
+ HFONT hfont() const;
+#endif
+
#ifndef NDEBUG
String description() const;
#endif
diff --git a/WebCore/platform/graphics/wx/FontPlatformDataWx.cpp b/WebCore/platform/graphics/wx/FontPlatformDataWx.cpp
index fd3322f..c9646d7 100644
--- a/WebCore/platform/graphics/wx/FontPlatformDataWx.cpp
+++ b/WebCore/platform/graphics/wx/FontPlatformDataWx.cpp
@@ -129,4 +129,16 @@ String FontPlatformData::description() const
}
#endif
+#if OS(WINDOWS)
+bool FontPlatformData::useGDI() const
+{
+ return true;
+}
+
+HFONT FontPlatformData::hfont() const
+{
+ return static_cast<HFONT>(m_font->font()->GetHFONT());
+}
+#endif
+
}
diff --git a/WebCore/platform/graphics/wx/FontWx.cpp b/WebCore/platform/graphics/wx/FontWx.cpp
index 04b2ec4..98b5a0a 100644
--- a/WebCore/platform/graphics/wx/FontWx.cpp
+++ b/WebCore/platform/graphics/wx/FontWx.cpp
@@ -33,6 +33,10 @@
#include "NotImplemented.h"
#include "SimpleFontData.h"
+#if OS(WINDOWS)
+#include "UniscribeController.h"
+#endif
+
#include <wx/dcclient.h>
#include "fontprops.h"
#include "non-kerned-drawing.h"
@@ -41,7 +45,11 @@ namespace WebCore {
bool Font::canReturnFallbackFontsForComplexText()
{
+#if OS(WINDOWS)
+ return true;
+#else
return false;
+#endif
}
void Font::drawGlyphs(GraphicsContext* graphicsContext, const SimpleFontData* font, const GlyphBuffer& glyphBuffer,
@@ -59,25 +67,80 @@ void Font::drawGlyphs(GraphicsContext* graphicsContext, const SimpleFontData* fo
FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint& point, int h, int from, int to) const
{
+#if OS(WINDOWS)
+ UniscribeController it(this, run);
+ it.advance(from);
+ float beforeWidth = it.runWidthSoFar();
+ it.advance(to);
+ float afterWidth = it.runWidthSoFar();
+
+ // Using roundf() rather than ceilf() for the right edge as a compromise to ensure correct caret positioning
+ if (run.rtl()) {
+ it.advance(run.length());
+ float totalWidth = it.runWidthSoFar();
+ return FloatRect(point.x() + floorf(totalWidth - afterWidth), point.y(), roundf(totalWidth - beforeWidth) - floorf(totalWidth - afterWidth), h);
+ }
+
+ return FloatRect(point.x() + floorf(beforeWidth), point.y(), roundf(afterWidth) - floorf(beforeWidth), h);
+#else
notImplemented();
return FloatRect();
+#endif
}
-void Font::drawComplexText(GraphicsContext* graphicsContext, const TextRun& run, const FloatPoint& point, int from, int to) const
+void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const
{
+#if OS(WINDOWS)
+ // This glyph buffer holds our glyphs + advances + font data for each glyph.
+ GlyphBuffer glyphBuffer;
+
+ float startX = point.x();
+ UniscribeController controller(this, run);
+ controller.advance(from);
+ float beforeWidth = controller.runWidthSoFar();
+ controller.advance(to, &glyphBuffer);
+
+ // We couldn't generate any glyphs for the run. Give up.
+ if (glyphBuffer.isEmpty())
+ return;
+
+ float afterWidth = controller.runWidthSoFar();
+
+ if (run.rtl()) {
+ controller.advance(run.length());
+ startX += controller.runWidthSoFar() - afterWidth;
+ } else
+ startX += beforeWidth;
+
+ // Draw the glyph buffer now at the starting point returned in startX.
+ FloatPoint startPoint(startX, point.y());
+ drawGlyphBuffer(context, glyphBuffer, run, startPoint);
+#else
notImplemented();
+#endif
}
-float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>* /* fallbackFonts */) const
+
+float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts) const
{
+#if OS(WINDOWS)
+ UniscribeController controller(this, run, fallbackFonts);
+ controller.advance(run.length());
+ return controller.runWidthSoFar();
+#else
notImplemented();
return 0;
+#endif
}
int Font::offsetForPositionForComplexText(const TextRun& run, int x, bool includePartialGlyphs) const
{
+#if OS(WINDOWS)
+ UniscribeController controller(this, run);
+ return controller.offsetForPosition(x, includePartialGlyphs);
+#else
notImplemented();
return 0;
+#endif
}
-
}
diff --git a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
index e35334e..8e1a391 100644
--- a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
+++ b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
@@ -27,7 +27,6 @@
#include "GraphicsContext.h"
#include "AffineTransform.h"
-#include "TransformationMatrix.h"
#include "FloatRect.h"
#include "Font.h"
#include "IntRect.h"
@@ -360,18 +359,12 @@ void GraphicsContext::clipToImageBuffer(const FloatRect&, const ImageBuffer*)
notImplemented();
}
-AffineTransform GraphicsContext::getAffineCTM() const
+AffineTransform GraphicsContext::getCTM() const
{
notImplemented();
return AffineTransform();
}
-TransformationMatrix GraphicsContext::getCTM() const
-{
- notImplemented();
- return TransformationMatrix();
-}
-
void GraphicsContext::translate(float tx, float ty)
{
#if USE(WXGC)
@@ -487,15 +480,6 @@ void GraphicsContext::concatCTM(const AffineTransform& transform)
return;
}
-void GraphicsContext::concatCTM(const TransformationMatrix& transform)
-{
- if (paintingDisabled())
- return;
-
- notImplemented();
- return;
-}
-
void GraphicsContext::setPlatformShouldAntialias(bool enable)
{
if (paintingDisabled())
diff --git a/WebCore/platform/graphics/wx/ImageWx.cpp b/WebCore/platform/graphics/wx/ImageWx.cpp
index ff60d6f..c246ec1 100644
--- a/WebCore/platform/graphics/wx/ImageWx.cpp
+++ b/WebCore/platform/graphics/wx/ImageWx.cpp
@@ -26,13 +26,13 @@
#include "config.h"
#include "Image.h"
+#include "AffineTransform.h"
#include "BitmapImage.h"
#include "FloatConversion.h"
#include "FloatRect.h"
#include "GraphicsContext.h"
#include "ImageObserver.h"
#include "NotImplemented.h"
-#include "TransformationMatrix.h"
#include <math.h>
#include <stdio.h>
@@ -176,17 +176,16 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst, const FloatR
observer->didDraw(this);
}
-void BitmapImage::drawPattern(GraphicsContext* ctxt, const FloatRect& srcRect, const TransformationMatrix& patternTransform, const FloatPoint& phase, ColorSpace, CompositeOperator, const FloatRect& dstRect)
+void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace, CompositeOperator, const FloatRect& dstRect)
{
- if (!m_source.initialized())
- return;
+
#if USE(WXGC)
wxGCDC* context = (wxGCDC*)ctxt->platformContext();
- wxGraphicsBitmap* bitmap = frameAtIndex(m_currentFrame);
+ wxGraphicsBitmap* bitmap = nativeImageForCurrentFrame();
#else
wxWindowDC* context = ctxt->platformContext();
- wxBitmap* bitmap = frameAtIndex(m_currentFrame);
+ wxBitmap* bitmap = nativeImageForCurrentFrame();
#endif
if (!bitmap) // If it's too early we won't have an image yet.
@@ -261,9 +260,4 @@ void BitmapImage::invalidatePlatformData()
}
-void Image::drawPattern(GraphicsContext*, const FloatRect& srcRect, const TransformationMatrix& patternTransform, const FloatPoint& phase, ColorSpace, CompositeOperator, const FloatRect& destRect)
-{
- notImplemented();
-}
-
}
diff --git a/WebCore/platform/graphics/wx/PathWx.cpp b/WebCore/platform/graphics/wx/PathWx.cpp
index 21693c9..6c115ac 100644
--- a/WebCore/platform/graphics/wx/PathWx.cpp
+++ b/WebCore/platform/graphics/wx/PathWx.cpp
@@ -27,7 +27,6 @@
#include "Path.h"
#include "AffineTransform.h"
-#include "TransformationMatrix.h"
#include "FloatPoint.h"
#include "FloatRect.h"
#include "NotImplemented.h"
@@ -211,14 +210,6 @@ void Path::transform(const AffineTransform& transform)
#endif
}
-void Path::transform(const TransformationMatrix& transform)
-{
-#if USE(WXGC)
- if (m_path)
- m_path->Transform(transform);
-#endif
-}
-
void Path::apply(void* info, PathApplierFunction function) const
{
notImplemented();
diff --git a/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp b/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp
index 85979de..d9fd2b3 100644
--- a/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp
+++ b/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp
@@ -55,6 +55,13 @@ void SimpleFontData::platformInit()
m_unitsPerEm = 1; // FIXME!
m_lineGap = props.GetLineGap();
}
+
+#if OS(WINDOWS)
+ m_scriptCache = 0;
+ m_scriptFontProperties = 0;
+ m_isSystemFont = false;
+ m_syntheticBoldOffset = 0.0f;
+#endif
}
void SimpleFontData::platformCharWidthInit()
@@ -68,6 +75,16 @@ void SimpleFontData::platformDestroy()
{
delete m_smallCapsFontData;
m_smallCapsFontData = 0;
+
+#if OS(WINDOWS)
+ if (m_scriptFontProperties) {
+ delete m_scriptFontProperties;
+ m_scriptFontProperties = 0;
+ }
+
+ if (m_scriptCache)
+ ScriptFreeCache(&m_scriptCache);
+#endif
}
SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDescription) const
@@ -84,7 +101,7 @@ SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDes
bool SimpleFontData::containsCharacters(const UChar* characters, int length) const
{
// FIXME: We will need to implement this to load non-ASCII encoding sites
- return true;
+ return wxFontContainsCharacters(*m_platformData.font(), characters, length);
}
void SimpleFontData::determinePitch()
@@ -97,10 +114,44 @@ void SimpleFontData::determinePitch()
float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
{
+#if __WXMSW__
+ // under Windows / wxMSW we currently always use GDI fonts.
+ return widthForGDIGlyph(glyph);
+#else
// TODO: fix this! Make GetTextExtents a method of wxFont in 2.9
int width = 10;
GetTextExtent(*m_platformData.font(), (wxChar)glyph, &width, NULL);
return width;
+#endif
+}
+
+#if OS(WINDOWS)
+SCRIPT_FONTPROPERTIES* SimpleFontData::scriptFontProperties() const
+{
+ // AFAICT this is never called even by the Win port anymore.
+ return 0;
+}
+
+void SimpleFontData::initGDIFont()
+{
+ // unused by wx port
+}
+
+void SimpleFontData::platformCommonDestroy()
+{
+ // unused by wx port
+}
+
+float SimpleFontData::widthForGDIGlyph(Glyph glyph) const
+{
+ HDC hdc = GetDC(0);
+ HGDIOBJ oldFont = SelectObject(hdc, m_platformData.hfont());
+ int width;
+ GetCharWidthI(hdc, glyph, 1, 0, &width);
+ SelectObject(hdc, oldFont);
+ ReleaseDC(0, hdc);
+ return width;
}
+#endif
}
diff --git a/WebCore/platform/gtk/ClipboardGtk.cpp b/WebCore/platform/gtk/ClipboardGtk.cpp
index 450966e..6122d8f 100644
--- a/WebCore/platform/gtk/ClipboardGtk.cpp
+++ b/WebCore/platform/gtk/ClipboardGtk.cpp
@@ -176,6 +176,15 @@ void ClipboardGtk::writeRange(Range* range, Frame* frame)
gtk_clipboard_set_text(htmlClipboard, createMarkup(range, 0, AnnotateForInterchange).utf8().data(), -1);
}
+void ClipboardGtk::writePlainText(const String& text)
+{
+ GtkClipboard* textClipboard = gtk_clipboard_get(gdk_atom_intern_static_string("WebKitClipboardText"));
+
+ gtk_clipboard_clear(textClipboard);
+
+ gtk_clipboard_set_text(textClipboard, text.utf8().data(), -1);
+}
+
bool ClipboardGtk::hasData()
{
notImplemented();
diff --git a/WebCore/platform/gtk/ClipboardGtk.h b/WebCore/platform/gtk/ClipboardGtk.h
index bb21d92..74e36b1 100644
--- a/WebCore/platform/gtk/ClipboardGtk.h
+++ b/WebCore/platform/gtk/ClipboardGtk.h
@@ -60,6 +60,7 @@ namespace WebCore {
virtual void declareAndWriteDragImage(Element*, const KURL&, const String&, Frame*);
virtual void writeURL(const KURL&, const String&, Frame*);
virtual void writeRange(Range*, Frame*);
+ virtual void writePlainText(const String&);
virtual bool hasData();
diff --git a/WebCore/platform/gtk/GOwnPtrGtk.cpp b/WebCore/platform/gtk/GOwnPtrGtk.cpp
index 3bb1335..8538105 100644
--- a/WebCore/platform/gtk/GOwnPtrGtk.cpp
+++ b/WebCore/platform/gtk/GOwnPtrGtk.cpp
@@ -20,7 +20,9 @@
#include "config.h"
#include "GOwnPtrGtk.h"
+#if ENABLE(VIDEO)
#include <gst/gstelement.h>
+#endif
#include <libsoup/soup-uri.h>
namespace WTF {
@@ -31,10 +33,12 @@ template <> void freeOwnedGPtr<SoupURI>(SoupURI* ptr)
soup_uri_free(ptr);
}
+#if ENABLE(VIDEO)
template <> void freeOwnedGPtr<GstElement>(GstElement* ptr)
{
if (ptr)
gst_object_unref(ptr);
}
+#endif
}
diff --git a/WebCore/platform/gtk/RenderThemeGtk.cpp b/WebCore/platform/gtk/RenderThemeGtk.cpp
index 0c157cf..727788a 100644
--- a/WebCore/platform/gtk/RenderThemeGtk.cpp
+++ b/WebCore/platform/gtk/RenderThemeGtk.cpp
@@ -24,6 +24,7 @@
#include "config.h"
#include "RenderThemeGtk.h"
+#include "AffineTransform.h"
#include "CString.h"
#include "GOwnPtr.h"
#include "GraphicsContext.h"
@@ -32,7 +33,6 @@
#include "NotImplemented.h"
#include "RenderBox.h"
#include "RenderObject.h"
-#include "TransformationMatrix.h"
#include "UserAgentStyleSheets.h"
#include "gtkdrawing.h"
@@ -307,7 +307,7 @@ static bool paintMozillaGtkWidget(const RenderThemeGtk* theme, GtkThemeWidgetTyp
break;
}
- TransformationMatrix ctm = i.context->getCTM();
+ AffineTransform ctm = i.context->getCTM();
IntPoint pos = ctm.mapPoint(rect.location());
GdkRectangle gdkRect = IntRect(pos.x(), pos.y(), rect.width(), rect.height());
diff --git a/WebCore/platform/gtk/ScrollViewGtk.cpp b/WebCore/platform/gtk/ScrollViewGtk.cpp
index a7e7e15..e868250 100644
--- a/WebCore/platform/gtk/ScrollViewGtk.cpp
+++ b/WebCore/platform/gtk/ScrollViewGtk.cpp
@@ -2,7 +2,7 @@
* Copyright (C) 2006, 2007, 2008 Apple Computer, Inc. All rights reserved.
* Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
* Copyright (C) 2007, 2009 Holger Hans Peter Freyther
- * Copyright (C) 2008 Collabora Ltd.
+ * Copyright (C) 2008, 2010 Collabora Ltd.
*
* All rights reserved.
*
@@ -76,7 +76,7 @@ PassRefPtr<Scrollbar> ScrollView::createScrollbar(ScrollbarOrientation orientati
* The following is assumed:
* (hadj && vadj) || (!hadj && !vadj)
*/
-void ScrollView::setGtkAdjustments(GtkAdjustment* hadj, GtkAdjustment* vadj)
+void ScrollView::setGtkAdjustments(GtkAdjustment* hadj, GtkAdjustment* vadj, bool resetValues)
{
ASSERT(!hadj == !vadj);
@@ -85,17 +85,40 @@ void ScrollView::setGtkAdjustments(GtkAdjustment* hadj, GtkAdjustment* vadj)
// Reset the adjustments to a sane default
if (m_horizontalAdjustment) {
+ ScrollbarGtk* hScrollbar = reinterpret_cast<ScrollbarGtk*>(horizontalScrollbar());
+ if (hScrollbar)
+ hScrollbar->attachAdjustment(m_horizontalAdjustment);
+
+ ScrollbarGtk* vScrollbar = reinterpret_cast<ScrollbarGtk*>(verticalScrollbar());
+ if (vScrollbar)
+ vScrollbar->attachAdjustment(m_verticalAdjustment);
+
+ // We used to reset everything to 0 here, but when page cache
+ // is enabled we reuse FrameViews that are cached. Since their
+ // size is not going to change when being restored, (which is
+ // what would cause the upper limit in the adjusments to be
+ // set in the normal case), we make sure they are up-to-date
+ // here. This is needed for the parent scrolling widget to be
+ // able to report correct values.
m_horizontalAdjustment->lower = 0;
- m_horizontalAdjustment->upper = 0;
- m_horizontalAdjustment->value = 0;
+ m_horizontalAdjustment->upper = resetValues ? 0 : frameRect().width();
+ m_horizontalAdjustment->value = resetValues ? 0 : scrollOffset().width();
gtk_adjustment_changed(m_horizontalAdjustment);
gtk_adjustment_value_changed(m_horizontalAdjustment);
m_verticalAdjustment->lower = 0;
- m_verticalAdjustment->upper = 0;
- m_verticalAdjustment->value = 0;
+ m_verticalAdjustment->upper = resetValues ? 0 : frameRect().height();
+ m_verticalAdjustment->value = resetValues ? 0 : scrollOffset().height();
gtk_adjustment_changed(m_verticalAdjustment);
gtk_adjustment_value_changed(m_verticalAdjustment);
+ } else {
+ ScrollbarGtk* hScrollbar = reinterpret_cast<ScrollbarGtk*>(horizontalScrollbar());
+ if (hScrollbar)
+ hScrollbar->detachAdjustment();
+
+ ScrollbarGtk* vScrollbar = reinterpret_cast<ScrollbarGtk*>(verticalScrollbar());
+ if (vScrollbar)
+ vScrollbar->detachAdjustment();
}
/* reconsider having a scrollbar */
diff --git a/WebCore/platform/gtk/ScrollbarGtk.cpp b/WebCore/platform/gtk/ScrollbarGtk.cpp
index 00c6ea0..0c3037a 100644
--- a/WebCore/platform/gtk/ScrollbarGtk.cpp
+++ b/WebCore/platform/gtk/ScrollbarGtk.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2007, 2009 Holger Hans Peter Freyther zecke@selfish.org
+ * Copyright (C) 2010 Gustavo Noronha Silva <gns@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -87,6 +88,32 @@ ScrollbarGtk::ScrollbarGtk(ScrollbarClient* client, ScrollbarOrientation orienta
ScrollbarGtk::~ScrollbarGtk()
{
+ if (m_adjustment)
+ detachAdjustment();
+}
+
+void ScrollbarGtk::attachAdjustment(GtkAdjustment* adjustment)
+{
+ if (platformWidget())
+ return;
+
+ if (m_adjustment)
+ detachAdjustment();
+
+ m_adjustment = adjustment;
+
+ g_object_ref(m_adjustment);
+ g_signal_connect(m_adjustment, "value-changed", G_CALLBACK(ScrollbarGtk::gtkValueChanged), this);
+
+ updateThumbProportion();
+ updateThumbPosition();
+}
+
+void ScrollbarGtk::detachAdjustment()
+{
+ if (!m_adjustment)
+ return;
+
g_signal_handlers_disconnect_by_func(G_OBJECT(m_adjustment), (gpointer)ScrollbarGtk::gtkValueChanged, this);
// For the case where we only operate on the GtkAdjustment it is best to
@@ -98,6 +125,7 @@ ScrollbarGtk::~ScrollbarGtk()
gtk_adjustment_changed(m_adjustment);
gtk_adjustment_value_changed(m_adjustment);
g_object_unref(m_adjustment);
+ m_adjustment = 0;
}
IntPoint ScrollbarGtk::getLocationInParentWindow(const IntRect& rect)
diff --git a/WebCore/platform/gtk/ScrollbarGtk.h b/WebCore/platform/gtk/ScrollbarGtk.h
index b4b5989..e02bb50 100644
--- a/WebCore/platform/gtk/ScrollbarGtk.h
+++ b/WebCore/platform/gtk/ScrollbarGtk.h
@@ -59,7 +59,9 @@ protected:
virtual void updateThumbPosition();
virtual void updateThumbProportion();
-
+
+ void detachAdjustment();
+ void attachAdjustment(GtkAdjustment*);
private:
static void gtkValueChanged(GtkAdjustment*, ScrollbarGtk*);
IntPoint getLocationInParentWindow(const IntRect&);
diff --git a/WebCore/platform/gtk/WheelEventGtk.cpp b/WebCore/platform/gtk/WheelEventGtk.cpp
index 404bf29..fc6206f 100644
--- a/WebCore/platform/gtk/WheelEventGtk.cpp
+++ b/WebCore/platform/gtk/WheelEventGtk.cpp
@@ -69,8 +69,8 @@ PlatformWheelEvent::PlatformWheelEvent(GdkEventScroll* event)
m_metaKey = event->state & GDK_META_MASK;
// FIXME: retrieve the user setting for the number of lines to scroll on each wheel event
- m_deltaX *= static_cast<float>(cScrollbarPixelsPerLineStep);
- m_deltaY *= static_cast<float>(cScrollbarPixelsPerLineStep);
+ m_deltaX *= static_cast<float>(Scrollbar::pixelsPerLineStep());
+ m_deltaY *= static_cast<float>(Scrollbar::pixelsPerLineStep());
}
}
diff --git a/WebCore/platform/haiku/ClipboardHaiku.cpp b/WebCore/platform/haiku/ClipboardHaiku.cpp
index a62c30c..f73be01 100644
--- a/WebCore/platform/haiku/ClipboardHaiku.cpp
+++ b/WebCore/platform/haiku/ClipboardHaiku.cpp
@@ -187,6 +187,11 @@ void ClipboardHaiku::writeRange(Range*, Frame*)
notImplemented();
}
+void ClipboardHaiku::writePlainText(const String&)
+{
+ notImplemented();
+}
+
bool ClipboardHaiku::hasData()
{
bool result = false;
diff --git a/WebCore/platform/haiku/ClipboardHaiku.h b/WebCore/platform/haiku/ClipboardHaiku.h
index 23e3d7b..37ffe5c 100644
--- a/WebCore/platform/haiku/ClipboardHaiku.h
+++ b/WebCore/platform/haiku/ClipboardHaiku.h
@@ -61,6 +61,7 @@ namespace WebCore {
virtual void declareAndWriteDragImage(Element*, const KURL&, const String& title, Frame*);
virtual void writeURL(const KURL&, const String&, Frame*);
virtual void writeRange(Range*, Frame*);
+ virtual void writePlainText(const String&);
virtual bool hasData();
diff --git a/WebCore/platform/haiku/ContextMenuItemHaiku.cpp b/WebCore/platform/haiku/ContextMenuItemHaiku.cpp
index cd5abaf..469590d 100644
--- a/WebCore/platform/haiku/ContextMenuItemHaiku.cpp
+++ b/WebCore/platform/haiku/ContextMenuItemHaiku.cpp
@@ -70,7 +70,7 @@ ContextMenuItem::~ContextMenuItem()
PlatformMenuItemDescription ContextMenuItem::releasePlatformDescription()
{
BMenuItem* item = m_platformDescription;
- m_platformDescription = NULL;
+ m_platformDescription = 0;
return item;
}
@@ -116,7 +116,7 @@ void ContextMenuItem::setAction(ContextMenuAction action)
m_platformDescription->Message()->what = action;
}
-String ContextMenuItem::title() const
+String ContextMenuItem::title() const
{
if (m_platformDescription)
return "";
diff --git a/WebCore/platform/haiku/CookieJarHaiku.cpp b/WebCore/platform/haiku/CookieJarHaiku.cpp
index 831b379..f619f00 100644
--- a/WebCore/platform/haiku/CookieJarHaiku.cpp
+++ b/WebCore/platform/haiku/CookieJarHaiku.cpp
@@ -52,6 +52,12 @@ String cookies(const Document*, const KURL& url)
return cookieJar.get(url.string());
}
+String cookieRequestHeaderFieldValue(const Document*, const KURL& url)
+{
+ // FIXME: include HttpOnly cookies.
+ return cookieJar.get(url.string());
+}
+
bool cookiesEnabled(const Document*)
{
// FIXME: This should probably be a setting
diff --git a/WebCore/platform/haiku/DragImageHaiku.cpp b/WebCore/platform/haiku/DragImageHaiku.cpp
index 17a79f4..87f780a 100644
--- a/WebCore/platform/haiku/DragImageHaiku.cpp
+++ b/WebCore/platform/haiku/DragImageHaiku.cpp
@@ -67,7 +67,7 @@ DragImageRef createDragImageFromImage(Image*)
DragImageRef createDragImageIconForCachedImage(CachedImage*)
{
notImplemented();
- return 0;
+ return 0;
}
} // namespace WebCore
diff --git a/WebCore/platform/haiku/FileChooserHaiku.cpp b/WebCore/platform/haiku/FileChooserHaiku.cpp
index f56e02b..3a44de8 100644
--- a/WebCore/platform/haiku/FileChooserHaiku.cpp
+++ b/WebCore/platform/haiku/FileChooserHaiku.cpp
@@ -22,8 +22,8 @@
#include "config.h"
#include "FileChooser.h"
-#include "NotImplemented.h"
#include "Icon.h"
+#include "NotImplemented.h"
namespace WebCore {
diff --git a/WebCore/platform/haiku/LocalizedStringsHaiku.cpp b/WebCore/platform/haiku/LocalizedStringsHaiku.cpp
index 3b94bcb..5321792 100644
--- a/WebCore/platform/haiku/LocalizedStringsHaiku.cpp
+++ b/WebCore/platform/haiku/LocalizedStringsHaiku.cpp
@@ -28,6 +28,7 @@
#include "config.h"
#include "LocalizedStrings.h"
+#include "NotImplemented.h"
#include "PlatformString.h"
diff --git a/WebCore/platform/haiku/PlatformWheelEventHaiku.cpp b/WebCore/platform/haiku/PlatformWheelEventHaiku.cpp
index 3945f48..21003b6 100644
--- a/WebCore/platform/haiku/PlatformWheelEventHaiku.cpp
+++ b/WebCore/platform/haiku/PlatformWheelEventHaiku.cpp
@@ -54,8 +54,8 @@ PlatformWheelEvent::PlatformWheelEvent(BMessage* message)
m_wheelTicksX = m_deltaX;
m_wheelTicksY = m_deltaY;
- m_deltaX *= -cScrollbarPixelsPerLineStep;
- m_deltaY *= -cScrollbarPixelsPerLineStep;
+ m_deltaX *= -Scrollbar::pixelsPerLineStep();
+ m_deltaY *= -Scrollbar::pixelsPerLineStep();
}
} // namespace WebCore
diff --git a/WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp b/WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp
index dc120e3..7f00db2 100644
--- a/WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp
+++ b/WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2010 Stephan Aßmus, <superstippi@gmx.de>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,9 +33,41 @@ namespace WebCore {
NativeImagePtr RGBA32Buffer::asNewNativeImage() const
{
- BBitmap* bmp = new BBitmap(BRect(0, 0, width(), height()), B_RGB32);
- bmp->SetBits(m_bytes.data(), m_size.width() * m_size.height(), 0, B_RGB32);
- return bmp;
+ int bytesPerRow = width() * sizeof(PixelData);
+ OwnPtr<BBitmap> bitmap(new BBitmap(BRect(0, 0, width() - 1, height() - 1), 0, B_RGBA32, bytesPerRow));
+
+ const uint8* source = reinterpret_cast<const uint8*>(m_bytes.data());
+ uint8* destination = reinterpret_cast<uint8*>(bitmap->Bits());
+ int h = height();
+ int w = width();
+ for (int y = 0; y < h; y++) {
+#if 0
+// FIXME: Enable this conversion once Haiku has B_RGBA32P[remultiplied]...
+ memcpy(dst, source, bytesPerRow);
+#else
+ const uint8* sourceHandle = source;
+ uint8* destinationHandle = destination;
+ for (int x = 0; x < w; x++) {
+ if (sourceHandle[3] == 255 || !sourceHandle[3]) {
+ destinationHandle[0] = sourceHandle[0];
+ destinationHandle[1] = sourceHandle[1];
+ destinationHandle[2] = sourceHandle[2];
+ destinationHandle[3] = sourceHandle[3];
+ } else {
+ destinationHandle[0] = static_cast<uint16>(sourceHandle[0]) * 255 / sourceHandle[3];
+ destinationHandle[1] = static_cast<uint16>(sourceHandle[1]) * 255 / sourceHandle[3];
+ destinationHandle[2] = static_cast<uint16>(sourceHandle[2]) * 255 / sourceHandle[3];
+ destinationHandle[3] = sourceHandle[3];
+ }
+ destinationHandle += 4;
+ sourceHandle += 4;
+ }
+#endif
+ destination += bytesPerRow;
+ source += bytesPerRow;
+ }
+
+ return bitmap.release();
}
} // namespace WebCore
diff --git a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
index 2a2636a..aaa9047 100644
--- a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
+++ b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
@@ -41,7 +41,7 @@
#include "JPEGImageDecoder.h"
#include <stdio.h> // Needed by jpeglib.h for FILE.
-#if OS(WINCE)
+#if OS(WINCE) || PLATFORM(BREWMP_SIMULATOR)
// Remove warning: 'FAR' macro redefinition
#undef FAR
diff --git a/WebCore/platform/mac/ClipboardMac.h b/WebCore/platform/mac/ClipboardMac.h
index 3d3c78e..adde09c 100644
--- a/WebCore/platform/mac/ClipboardMac.h
+++ b/WebCore/platform/mac/ClipboardMac.h
@@ -72,6 +72,7 @@ public:
#endif
virtual void writeRange(Range*, Frame* frame);
virtual void writeURL(const KURL&, const String&, Frame* frame);
+ virtual void writePlainText(const String&);
// Methods for getting info in Cocoa's type system
NSImage *dragNSImage(NSPoint&) const; // loc converted from dragLoc, based on whole image size
diff --git a/WebCore/platform/mac/ClipboardMac.mm b/WebCore/platform/mac/ClipboardMac.mm
index f4321ad..ddfa0d5 100644
--- a/WebCore/platform/mac/ClipboardMac.mm
+++ b/WebCore/platform/mac/ClipboardMac.mm
@@ -367,7 +367,12 @@ void ClipboardMac::writeRange(Range* range, Frame* frame)
ASSERT(frame);
Pasteboard::writeSelection(m_pasteboard.get(), range, frame->editor()->smartInsertDeleteEnabled() && frame->selectionGranularity() == WordGranularity, frame);
}
-
+
+void ClipboardMac::writePlainText(const String& text)
+{
+ Pasteboard::writePlainText(m_pasteboard.get(), text);
+}
+
void ClipboardMac::writeURL(const KURL& url, const String& title, Frame* frame)
{
ASSERT(frame);
diff --git a/WebCore/platform/mac/CookieJar.mm b/WebCore/platform/mac/CookieJar.mm
index e1d3e5a..df24b03 100644
--- a/WebCore/platform/mac/CookieJar.mm
+++ b/WebCore/platform/mac/CookieJar.mm
@@ -86,6 +86,18 @@ String cookies(const Document*, const KURL& url)
return String();
}
+String cookieRequestHeaderFieldValue(const Document*, const KURL& url)
+{
+ BEGIN_BLOCK_OBJC_EXCEPTIONS;
+
+ NSURL *cookieURL = url;
+ NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:cookieURL];
+ return [[NSHTTPCookie requestHeaderFieldsWithCookies:cookies] objectForKey:@"Cookie"];
+
+ END_BLOCK_OBJC_EXCEPTIONS;
+ return String();
+}
+
void setCookies(Document* document, const KURL& url, const String& cookieStr)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
diff --git a/WebCore/platform/mac/PasteboardMac.mm b/WebCore/platform/mac/PasteboardMac.mm
index 8aa7f2c..690637a 100644
--- a/WebCore/platform/mac/PasteboardMac.mm
+++ b/WebCore/platform/mac/PasteboardMac.mm
@@ -197,6 +197,14 @@ void Pasteboard::writeSelection(NSPasteboard* pasteboard, Range* selectedRange,
[pasteboard setData:nil forType:WebSmartPastePboardType];
}
}
+
+void Pasteboard::writePlainText(NSPasteboard* pasteboard, const String& text)
+{
+ NSArray *types = [NSArray arrayWithObject:NSStringPboardType];
+ [pasteboard declareTypes:types owner:nil];
+
+ [pasteboard setString:text forType:NSStringPboardType];
+}
void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame)
{
diff --git a/WebCore/platform/mac/ScrollbarThemeMac.h b/WebCore/platform/mac/ScrollbarThemeMac.h
index 5af5fd5..c833ee7 100644
--- a/WebCore/platform/mac/ScrollbarThemeMac.h
+++ b/WebCore/platform/mac/ScrollbarThemeMac.h
@@ -57,6 +57,8 @@ protected:
virtual IntRect forwardButtonRect(Scrollbar*, ScrollbarPart, bool painting = false);
virtual IntRect trackRect(Scrollbar*, bool painting = false);
+ virtual int maxOverlapBetweenPages() { return 40; }
+
virtual int minimumThumbLength(Scrollbar*);
virtual bool shouldCenterOnThumb(Scrollbar*, const PlatformMouseEvent&);
diff --git a/WebCore/platform/mac/WheelEventMac.mm b/WebCore/platform/mac/WheelEventMac.mm
index f380e3e..c9a0efc 100644
--- a/WebCore/platform/mac/WheelEventMac.mm
+++ b/WebCore/platform/mac/WheelEventMac.mm
@@ -45,13 +45,13 @@ PlatformWheelEvent::PlatformWheelEvent(NSEvent* event, NSView *windowView)
BOOL continuous;
wkGetWheelEventDeltas(event, &m_deltaX, &m_deltaY, &continuous);
if (continuous) {
- m_wheelTicksX = m_deltaX / static_cast<float>(cScrollbarPixelsPerLineStep);
- m_wheelTicksY = m_deltaY / static_cast<float>(cScrollbarPixelsPerLineStep);
+ m_wheelTicksX = m_deltaX / static_cast<float>(Scrollbar::pixelsPerLineStep());
+ m_wheelTicksY = m_deltaY / static_cast<float>(Scrollbar::pixelsPerLineStep());
} else {
m_wheelTicksX = m_deltaX;
m_wheelTicksY = m_deltaY;
- m_deltaX *= static_cast<float>(cScrollbarPixelsPerLineStep);
- m_deltaY *= static_cast<float>(cScrollbarPixelsPerLineStep);
+ m_deltaX *= static_cast<float>(Scrollbar::pixelsPerLineStep());
+ m_deltaY *= static_cast<float>(Scrollbar::pixelsPerLineStep());
}
}
diff --git a/WebCore/platform/network/android/CookieJarAndroid.cpp b/WebCore/platform/network/android/CookieJarAndroid.cpp
index ba4b5dc..dd324c5 100644
--- a/WebCore/platform/network/android/CookieJarAndroid.cpp
+++ b/WebCore/platform/network/android/CookieJarAndroid.cpp
@@ -41,6 +41,12 @@ String cookies(const Document*, const KURL& url)
return PlatformBridge::cookies(url);
}
+String cookieRequestHeaderFieldValue(const Document*, const KURL& url)
+{
+ // FIXME: include HttpOnly cookie.
+ return PlatformBridge::cookies(url);
+}
+
bool cookiesEnabled(const Document*)
{
return PlatformBridge::cookiesEnabled();
diff --git a/WebCore/platform/network/chromium/CookieJarChromium.cpp b/WebCore/platform/network/chromium/CookieJarChromium.cpp
index 35f1c3f..41cf331 100644
--- a/WebCore/platform/network/chromium/CookieJarChromium.cpp
+++ b/WebCore/platform/network/chromium/CookieJarChromium.cpp
@@ -47,6 +47,25 @@ String cookies(const Document* document, const KURL& url)
return ChromiumBridge::cookies(url, document->firstPartyForCookies());
}
+String cookieRequestHeaderFieldValue(const Document* document, const KURL& url)
+{
+ // FIXME: move in ChromiumBridge?
+ Vector<Cookie> cookies;
+ getRawCookies(document, url, cookies);
+ String cookieLine;
+ // FIXME: Set $Version=v;
+ for (size_t i = 0; i < cookies.size(); i++) {
+ Cookie cookie = cookies[i];
+ if (i > 0)
+ cookieLine += "; ";
+ if (!cookie.name.isEmpty())
+ cookieLine += cookie.name + "=";
+ cookieLine += cookie.value;
+ // FIXME: set $Path, $Domain, ...
+ }
+ return cookieLine;
+}
+
bool cookiesEnabled(const Document* document)
{
return ChromiumBridge::cookiesEnabled(document->cookieURL(), document->firstPartyForCookies());
diff --git a/WebCore/platform/network/curl/CookieJarCurl.cpp b/WebCore/platform/network/curl/CookieJarCurl.cpp
index 3bad4e4..7c906a0 100644
--- a/WebCore/platform/network/curl/CookieJarCurl.cpp
+++ b/WebCore/platform/network/curl/CookieJarCurl.cpp
@@ -39,6 +39,12 @@ String cookies(const Document* /*document*/, const KURL& url)
return cookieJar.get(url.string());
}
+String cookieRequestHeaderFieldValue(const Document* /*document*/, const KURL& url)
+{
+ // FIXME: include HttpOnly cookie.
+ return cookieJar.get(url.string());
+}
+
bool cookiesEnabled(const Document* /*document*/)
{
return true;
diff --git a/WebCore/platform/network/curl/ResourceHandleCurl.cpp b/WebCore/platform/network/curl/ResourceHandleCurl.cpp
index 81ac1a3..4212562 100644
--- a/WebCore/platform/network/curl/ResourceHandleCurl.cpp
+++ b/WebCore/platform/network/curl/ResourceHandleCurl.cpp
@@ -91,7 +91,7 @@ static HashSet<String>& allowsAnyHTTPSCertificateHosts()
ResourceHandleInternal::~ResourceHandleInternal()
{
- free(m_url);
+ fastFree(m_url);
if (m_customHeaders)
curl_slist_free_all(m_customHeaders);
}
diff --git a/WebCore/platform/network/curl/ResourceHandleManager.cpp b/WebCore/platform/network/curl/ResourceHandleManager.cpp
index bcae67f..962754c 100644
--- a/WebCore/platform/network/curl/ResourceHandleManager.cpp
+++ b/WebCore/platform/network/curl/ResourceHandleManager.cpp
@@ -135,13 +135,13 @@ ResourceHandleManager::~ResourceHandleManager()
curl_multi_cleanup(m_curlMultiHandle);
curl_share_cleanup(m_curlShareHandle);
if (m_cookieJarFileName)
- free(m_cookieJarFileName);
+ fastFree(m_cookieJarFileName);
curl_global_cleanup();
}
void ResourceHandleManager::setCookieJarFileName(const char* cookieJarFileName)
{
- m_cookieJarFileName = strdup(cookieJarFileName);
+ m_cookieJarFileName = fastStrDup(cookieJarFileName);
}
ResourceHandleManager* ResourceHandleManager::sharedInstance()
@@ -741,7 +741,7 @@ void ResourceHandleManager::initializeHandle(ResourceHandle* job)
ASSERT(!d->m_url);
// url is in ASCII so latin1() will only convert it to char* without character translation.
- d->m_url = strdup(url.latin1().data());
+ d->m_url = fastStrDup(url.latin1().data());
curl_easy_setopt(d->m_handle, CURLOPT_URL, d->m_url);
if (m_cookieJarFileName) {
diff --git a/WebCore/platform/network/soup/CookieJarSoup.cpp b/WebCore/platform/network/soup/CookieJarSoup.cpp
index 3eb578a..d6479b2 100644
--- a/WebCore/platform/network/soup/CookieJarSoup.cpp
+++ b/WebCore/platform/network/soup/CookieJarSoup.cpp
@@ -24,6 +24,7 @@
#include "Cookie.h"
#include "CString.h"
#include "Document.h"
+#include "GOwnPtrGtk.h"
#include "KURL.h"
namespace WebCore {
@@ -54,16 +55,26 @@ void setDefaultCookieJar(SoupCookieJar* jar)
g_object_ref(cookieJar);
}
-void setCookies(Document* /*document*/, const KURL& url, const String& value)
+void setCookies(Document* document, const KURL& url, const String& value)
{
SoupCookieJar* jar = defaultCookieJar();
if (!jar)
return;
- SoupURI* origin = soup_uri_new(url.string().utf8().data());
+ GOwnPtr<SoupURI> origin(soup_uri_new(url.string().utf8().data()));
- soup_cookie_jar_set_cookie(jar, origin, value.utf8().data());
- soup_uri_free(origin);
+#ifdef HAVE_LIBSOUP_2_29_90
+ GOwnPtr<SoupURI> firstParty(soup_uri_new(document->firstPartyForCookies().string().utf8().data()));
+
+ soup_cookie_jar_set_cookie_with_first_party(jar,
+ origin.get(),
+ firstParty.get(),
+ value.utf8().data());
+#else
+ soup_cookie_jar_set_cookie(jar,
+ origin.get(),
+ value.utf8().data());
+#endif
}
String cookies(const Document* /*document*/, const KURL& url)
@@ -82,6 +93,22 @@ String cookies(const Document* /*document*/, const KURL& url)
return result;
}
+String cookieRequestHeaderFieldValue(const Document* /*document*/, const KURL& url)
+{
+ SoupCookieJar* jar = defaultCookieJar();
+ if (!jar)
+ return String();
+
+ SoupURI* uri = soup_uri_new(url.string().utf8().data());
+ char* cookies = soup_cookie_jar_get_cookies(jar, uri, TRUE);
+ soup_uri_free(uri);
+
+ String result(String::fromUTF8(cookies));
+ g_free(cookies);
+
+ return result;
+}
+
bool cookiesEnabled(const Document* /*document*/)
{
return defaultCookieJar();
diff --git a/WebCore/platform/network/soup/DNSSoup.cpp b/WebCore/platform/network/soup/DNSSoup.cpp
index ce55143..7f47efd 100644
--- a/WebCore/platform/network/soup/DNSSoup.cpp
+++ b/WebCore/platform/network/soup/DNSSoup.cpp
@@ -28,18 +28,21 @@
#include "DNS.h"
#include "CString.h"
+#include "GOwnPtrGtk.h"
#include "ResourceHandle.h"
namespace WebCore {
void prefetchDNS(const String& hostname)
{
- #ifdef HAVE_LIBSOUP_2_29_3
+#ifdef HAVE_LIBSOUP_2_29_90
String uri = "http://"+hostname;
- SoupURI* soupUri = soup_uri_new(uri.utf8().data());
- soup_session_prepare_for_uri(ResourceHandle::defaultSession(), soupUri);
- soup_uri_free(soupUri);
- #endif
+ GOwnPtr<SoupURI> soupURI(soup_uri_new(uri.utf8().data()));
+ // We may get invalid hostnames, so NULL-check here.
+ if (!soupURI)
+ return;
+ soup_session_prepare_for_uri(ResourceHandle::defaultSession(), soupURI.get());
+#endif
}
}
diff --git a/WebCore/platform/network/soup/ResourceHandleSoup.cpp b/WebCore/platform/network/soup/ResourceHandleSoup.cpp
index da16f4a..ee8e7aa 100644
--- a/WebCore/platform/network/soup/ResourceHandleSoup.cpp
+++ b/WebCore/platform/network/soup/ResourceHandleSoup.cpp
@@ -34,6 +34,7 @@
#include "DocLoader.h"
#include "FileSystem.h"
#include "Frame.h"
+#include "GOwnPtrGtk.h"
#include "HTTPParsers.h"
#include "Logging.h"
#include "MIMETypeRegistry.h"
@@ -209,6 +210,15 @@ static void restartedCallback(SoupMessage* msg, gpointer data)
if (d->client())
d->client()->willSendRequest(handle, request, response);
+
+#ifdef HAVE_LIBSOUP_2_29_90
+ // Update the first party in case the base URL changed with the redirect
+ String firstPartyString = request.firstPartyForCookies().string();
+ if (!firstPartyString.isEmpty()) {
+ GOwnPtr<SoupURI> firstParty(soup_uri_new(firstPartyString.utf8().data()));
+ soup_message_set_first_party(d->m_msg, firstParty.get());
+ }
+#endif
}
static void gotHeadersCallback(SoupMessage* msg, gpointer data)
@@ -484,6 +494,13 @@ static bool startHttp(ResourceHandle* handle)
g_signal_connect(d->m_msg, "content-sniffed", G_CALLBACK(contentSniffedCallback), handle);
g_signal_connect(d->m_msg, "got-chunk", G_CALLBACK(gotChunkCallback), handle);
+#ifdef HAVE_LIBSOUP_2_29_90
+ String firstPartyString = request.firstPartyForCookies().string();
+ if (!firstPartyString.isEmpty()) {
+ GOwnPtr<SoupURI> firstParty(soup_uri_new(firstPartyString.utf8().data()));
+ soup_message_set_first_party(d->m_msg, firstParty.get());
+ }
+#endif
g_object_set_data(G_OBJECT(d->m_msg), "resourceHandle", reinterpret_cast<void*>(handle));
FormData* httpBody = d->m_request.httpBody();
diff --git a/WebCore/platform/network/soup/ResourceRequestSoup.cpp b/WebCore/platform/network/soup/ResourceRequestSoup.cpp
index 0d4e0f9..d2c46a6 100644
--- a/WebCore/platform/network/soup/ResourceRequestSoup.cpp
+++ b/WebCore/platform/network/soup/ResourceRequestSoup.cpp
@@ -22,6 +22,7 @@
#include "CString.h"
#include "GOwnPtr.h"
+#include "GOwnPtrGtk.h"
#include "PlatformString.h"
#include <libsoup/soup.h>
@@ -44,6 +45,14 @@ SoupMessage* ResourceRequest::toSoupMessage() const
soup_message_headers_append(soupHeaders, it->first.string().utf8().data(), it->second.utf8().data());
}
+#ifdef HAVE_LIBSOUP_2_29_90
+ String firstPartyString = firstPartyForCookies().string();
+ if (!firstPartyString.isEmpty()) {
+ GOwnPtr<SoupURI> firstParty(soup_uri_new(firstPartyString.utf8().data()));
+ soup_message_set_first_party(soupMessage, firstParty.get());
+ }
+#endif
+
// Body data is only handled at ResourceHandleSoup::startHttp for
// now; this is because this may not be a good place to go
// openning and mmapping files. We should maybe revisit this.
@@ -69,9 +78,16 @@ void ResourceRequest::updateFromSoupMessage(SoupMessage* soupMessage)
if (soupMessage->request_body->data)
m_httpBody = FormData::create(soupMessage->request_body->data, soupMessage->request_body->length);
- // FIXME: m_allowCookies and m_firstPartyForCookies should
- // probably be handled here and on doUpdatePlatformRequest
- // somehow.
+#ifdef HAVE_LIBSOUP_2_29_90
+ SoupURI* firstParty = soup_message_get_first_party(soupMessage);
+ if (firstParty) {
+ GOwnPtr<gchar> firstPartyURI(soup_uri_to_string(firstParty, FALSE));
+ m_firstPartyForCookies = KURL(KURL(), String::fromUTF8(firstPartyURI.get()));
+ }
+#endif
+
+ // FIXME: m_allowCookies should probably be handled here and on
+ // doUpdatePlatformRequest somehow.
}
unsigned initializeMaximumHTTPConnectionCountPerHost()
diff --git a/WebCore/platform/network/win/CookieJarCFNetWin.cpp b/WebCore/platform/network/win/CookieJarCFNetWin.cpp
index 33b795a..d431289 100644
--- a/WebCore/platform/network/win/CookieJarCFNetWin.cpp
+++ b/WebCore/platform/network/win/CookieJarCFNetWin.cpp
@@ -106,6 +106,20 @@ String cookies(const Document* /*document*/, const KURL& url)
return (CFStringRef)CFDictionaryGetValue(headerCF.get(), s_cookieCF);
}
+String cookieRequestHeaderFieldValue(const Document* /*document*/, const KURL& url)
+{
+ CFHTTPCookieStorageRef cookieStorage = currentCookieStorage();
+ if (!cookieStorage)
+ return String();
+
+ RetainPtr<CFURLRef> urlCF(AdoptCF, url.createCFURL());
+
+ bool secure = url.protocolIs("https");
+ RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieStorageCopyCookiesForURL(cookieStorage, urlCF.get(), secure));
+ RetainPtr<CFDictionaryRef> headerCF(AdoptCF, CFHTTPCookieCopyRequestHeaderFields(kCFAllocatorDefault, cookiesCF.get()));
+ return (CFStringRef)CFDictionaryGetValue(headerCF.get(), s_cookieCF);
+}
+
bool cookiesEnabled(const Document* /*document*/)
{
CFHTTPCookieStorageAcceptPolicy policy = CFHTTPCookieStorageAcceptPolicyOnlyFromMainDocumentDomain;
diff --git a/WebCore/platform/network/win/CookieJarWin.cpp b/WebCore/platform/network/win/CookieJarWin.cpp
index 6576e07..2bdd6b3 100644
--- a/WebCore/platform/network/win/CookieJarWin.cpp
+++ b/WebCore/platform/network/win/CookieJarWin.cpp
@@ -59,6 +59,12 @@ String cookies(const Document* /*document*/, const KURL& url)
return String::adopt(buffer);
}
+String cookieRequestHeaderFieldValue(const Document* document, const KURL& url)
+{
+ // FIXME: include HttpOnly cookie
+ return cookies(document, url);
+}
+
bool cookiesEnabled(const Document* /*document*/)
{
return true;
diff --git a/WebCore/platform/qt/ClipboardQt.cpp b/WebCore/platform/qt/ClipboardQt.cpp
index f9940a6..c23e42e 100644
--- a/WebCore/platform/qt/ClipboardQt.cpp
+++ b/WebCore/platform/qt/ClipboardQt.cpp
@@ -290,6 +290,19 @@ void ClipboardQt::writeRange(Range* range, Frame* frame)
#endif
}
+void ClipboardQt::writePlainText(const String& str)
+{
+ if (!m_writableData)
+ m_writableData = new QMimeData;
+ QString text = str;
+ text.replace(QChar(0xa0), QLatin1Char(' '));
+ m_writableData->setText(text);
+#ifndef QT_NO_CLIPBOARD
+ if (!isForDragging())
+ QApplication::clipboard()->setMimeData(m_writableData);
+#endif
+}
+
bool ClipboardQt::hasData()
{
const QMimeData *data = m_readableData ? m_readableData : m_writableData;
diff --git a/WebCore/platform/qt/ClipboardQt.h b/WebCore/platform/qt/ClipboardQt.h
index 9a918ed..9b54d5f 100644
--- a/WebCore/platform/qt/ClipboardQt.h
+++ b/WebCore/platform/qt/ClipboardQt.h
@@ -66,6 +66,7 @@ namespace WebCore {
virtual void declareAndWriteDragImage(Element*, const KURL&, const String& title, Frame*);
virtual void writeURL(const KURL&, const String&, Frame*);
virtual void writeRange(Range*, Frame*);
+ virtual void writePlainText(const String&);
virtual bool hasData();
diff --git a/WebCore/platform/qt/CookieJarQt.cpp b/WebCore/platform/qt/CookieJarQt.cpp
index b621e7e..01d1756 100644
--- a/WebCore/platform/qt/CookieJarQt.cpp
+++ b/WebCore/platform/qt/CookieJarQt.cpp
@@ -103,6 +103,26 @@ String cookies(const Document* document, const KURL& url)
return resultCookies.join(QLatin1String("; "));
}
+String cookieRequestHeaderFieldValue(const Document* document, const KURL &url)
+{
+ QUrl u(url);
+ QNetworkCookieJar* jar = cookieJar(document);
+ if (!jar)
+ return String();
+
+ QList<QNetworkCookie> cookies = jar->cookiesForUrl(u);
+ if (cookies.isEmpty())
+ return String();
+
+ QStringList resultCookies;
+ foreach (QNetworkCookie networkCookie, cookies) {
+ resultCookies.append(QString::fromAscii(
+ networkCookie.toRawForm(QNetworkCookie::NameAndValueOnly).constData()));
+ }
+
+ return resultCookies.join(QLatin1String("; "));
+}
+
bool cookiesEnabled(const Document* document)
{
QNetworkCookieJar* jar = cookieJar(document);
diff --git a/WebCore/platform/sql/SQLiteDatabase.cpp b/WebCore/platform/sql/SQLiteDatabase.cpp
index d170db5..faaf5de 100644
--- a/WebCore/platform/sql/SQLiteDatabase.cpp
+++ b/WebCore/platform/sql/SQLiteDatabase.cpp
@@ -361,4 +361,9 @@ void SQLiteDatabase::unlock()
m_lockingMutex.unlock();
}
+bool SQLiteDatabase::isAutoCommitOn() const
+{
+ return sqlite3_get_autocommit(m_db);
+}
+
} // namespace WebCore
diff --git a/WebCore/platform/sql/SQLiteDatabase.h b/WebCore/platform/sql/SQLiteDatabase.h
index 9982254..a3e9852 100644
--- a/WebCore/platform/sql/SQLiteDatabase.h
+++ b/WebCore/platform/sql/SQLiteDatabase.h
@@ -106,6 +106,7 @@ public:
// (un)locks the database like a mutex
void lock();
void unlock();
+ bool isAutoCommitOn() const;
private:
static int authorizerFunction(void*, int, const char*, const char*, const char*, const char*);
diff --git a/WebCore/platform/sql/SQLiteTransaction.cpp b/WebCore/platform/sql/SQLiteTransaction.cpp
index a34613f..6f90eac 100644
--- a/WebCore/platform/sql/SQLiteTransaction.cpp
+++ b/WebCore/platform/sql/SQLiteTransaction.cpp
@@ -55,33 +55,31 @@ void SQLiteTransaction::begin()
// http://www.sqlite.org/lang_transaction.html
// http://www.sqlite.org/lockingv3.html#locking
if (m_readOnly)
- m_inProgress = m_db.executeCommand("BEGIN;");
+ m_inProgress = m_db.executeCommand("BEGIN");
else
- m_inProgress = m_db.executeCommand("BEGIN IMMEDIATE;");
+ m_inProgress = m_db.executeCommand("BEGIN IMMEDIATE");
m_db.m_transactionInProgress = m_inProgress;
}
}
void SQLiteTransaction::commit()
{
- // FIXME: this code is buggy; it assumes that COMMIT always succeeds which is not the case:
- // the transaction could've been silently rolled back before getting to the COMMIT statement
- // (https://bugs.webkit.org/show_bug.cgi?id=34280). However, the rest of the code does not
- // know how to deal with a premature rollback and a failed COMMIT at this moment, so until
- // we figure out what to do with bug 34280, it's better to leave this code as it is.
if (m_inProgress) {
ASSERT(m_db.m_transactionInProgress);
- m_db.executeCommand("COMMIT;");
- m_inProgress = false;
- m_db.m_transactionInProgress = false;
+ m_inProgress = !m_db.executeCommand("COMMIT");
+ m_db.m_transactionInProgress = m_inProgress;
}
}
void SQLiteTransaction::rollback()
{
+ // We do not use the 'm_inProgress = m_db.executeCommand("ROLLBACK")' construct here,
+ // because m_inProgress should always be set to false after a ROLLBACK, and
+ // m_db.executeCommand("ROLLBACK") can sometimes harmlessly fail, thus returning
+ // a non-zero/true result (http://www.sqlite.org/lang_transaction.html).
if (m_inProgress) {
ASSERT(m_db.m_transactionInProgress);
- m_db.executeCommand("ROLLBACK;");
+ m_db.executeCommand("ROLLBACK");
m_inProgress = false;
m_db.m_transactionInProgress = false;
}
@@ -95,4 +93,11 @@ void SQLiteTransaction::stop()
}
}
+bool SQLiteTransaction::wasRolledBackBySqlite() const
+{
+ // According to http://www.sqlite.org/c3ref/get_autocommit.html,
+ // the auto-commit flag should be off in the middle of a transaction
+ return m_inProgress && m_db.isAutoCommitOn();
+}
+
} // namespace WebCore
diff --git a/WebCore/platform/sql/SQLiteTransaction.h b/WebCore/platform/sql/SQLiteTransaction.h
index 557d81c..924241f 100644
--- a/WebCore/platform/sql/SQLiteTransaction.h
+++ b/WebCore/platform/sql/SQLiteTransaction.h
@@ -44,6 +44,7 @@ public:
void stop();
bool inProgress() const { return m_inProgress; }
+ bool wasRolledBackBySqlite() const;
private:
SQLiteDatabase& m_db;
bool m_inProgress;
diff --git a/WebCore/platform/text/Base64.cpp b/WebCore/platform/text/Base64.cpp
index be19164..82ec9fa 100644
--- a/WebCore/platform/text/Base64.cpp
+++ b/WebCore/platform/text/Base64.cpp
@@ -62,21 +62,24 @@ static const char base64DecMap[128] = {
void base64Encode(const Vector<char>& in, Vector<char>& out, bool insertLFs)
{
+ base64Encode(in.data(), in.size(), out, insertLFs);
+}
+
+void base64Encode(const char* data, unsigned len, Vector<char>& out, bool insertLFs)
+{
out.clear();
- if (in.isEmpty())
+ if (!len)
return;
// If the input string is pathologically large, just return nothing.
// Note: Keep this in sync with the "out_len" computation below.
// Rather than being perfectly precise, this is a bit conservative.
const unsigned maxInputBufferSize = UINT_MAX / 77 * 76 / 4 * 3 - 2;
- if (in.size() > maxInputBufferSize)
+ if (len > maxInputBufferSize)
return;
unsigned sidx = 0;
unsigned didx = 0;
- const char* data = in.data();
- const unsigned len = in.size();
unsigned out_len = ((len + 2) / 3) * 4;
diff --git a/WebCore/platform/text/Base64.h b/WebCore/platform/text/Base64.h
index 0b176e6..53b29b0 100644
--- a/WebCore/platform/text/Base64.h
+++ b/WebCore/platform/text/Base64.h
@@ -31,6 +31,7 @@
namespace WebCore {
void base64Encode(const Vector<char>&, Vector<char>&, bool insertLFs = false);
+void base64Encode(const char*, unsigned, Vector<char>&, bool insertLFs = false);
// this decoder is not general purpose - it returns an error if it encounters a linefeed, as needed for window.atob
bool base64Decode(const Vector<char>&, Vector<char>&);
diff --git a/WebCore/platform/text/CharacterNames.h b/WebCore/platform/text/CharacterNames.h
index ebaa1f1..c0b1750 100644
--- a/WebCore/platform/text/CharacterNames.h
+++ b/WebCore/platform/text/CharacterNames.h
@@ -41,6 +41,7 @@ namespace WebCore {
const UChar hebrewPunctuationGeresh = 0x05F3;
const UChar hebrewPunctuationGershayim = 0x05F4;
const UChar horizontalEllipsis = 0x2026;
+ const UChar hyphenMinus = 0x002D;
const UChar ideographicComma = 0x3001;
const UChar ideographicFullStop = 0x3002;
const UChar ideographicSpace = 0x3000;
diff --git a/WebCore/platform/text/StringImpl.cpp b/WebCore/platform/text/StringImpl.cpp
index 3b61a0b..db6152d 100644
--- a/WebCore/platform/text/StringImpl.cpp
+++ b/WebCore/platform/text/StringImpl.cpp
@@ -97,6 +97,16 @@ inline StringImpl::StringImpl(const UChar* characters, unsigned length)
{
ASSERT(characters);
ASSERT(length);
+ ASSERT(!bufferIsInternal());
+}
+
+inline StringImpl::StringImpl(unsigned length)
+ : m_data(reinterpret_cast<const UChar*>(this + 1))
+ , m_length(length)
+ , m_hash(0)
+{
+ ASSERT(length);
+ ASSERT(bufferIsInternal());
}
StringImpl::~StringImpl()
@@ -927,7 +937,7 @@ PassRefPtr<StringImpl> StringImpl::createUninitialized(unsigned length, UChar*&
size_t size = sizeof(StringImpl) + length * sizeof(UChar);
StringImpl* string = static_cast<StringImpl*>(fastMalloc(size));
data = reinterpret_cast<UChar*>(string + 1);
- string = new (string) StringImpl(data, length);
+ string = new (string) StringImpl(length);
return adoptRef(string);
}
diff --git a/WebCore/platform/text/StringImpl.h b/WebCore/platform/text/StringImpl.h
index f7a9d06..21f936d 100644
--- a/WebCore/platform/text/StringImpl.h
+++ b/WebCore/platform/text/StringImpl.h
@@ -66,9 +66,12 @@ private:
friend class ThreadGlobalData;
StringImpl();
- // This adopts the UChar* without copying the buffer.
+ // This constructor adopts the UChar* without copying the buffer.
StringImpl(const UChar*, unsigned length);
+ // This constructor assumes that 'this' was allocated with a UChar buffer of size 'length' at the end.
+ StringImpl(unsigned length);
+
// For use only by AtomicString's XXXTranslator helpers.
void setHash(unsigned hash) { ASSERT(!m_hash); m_hash = hash; }
diff --git a/WebCore/platform/text/haiku/StringHaiku.cpp b/WebCore/platform/text/haiku/StringHaiku.cpp
index 9e0fd3f..fe32215 100644
--- a/WebCore/platform/text/haiku/StringHaiku.cpp
+++ b/WebCore/platform/text/haiku/StringHaiku.cpp
@@ -24,19 +24,26 @@
*/
#include "config.h"
-#include "CString.h"
-
#include "PlatformString.h"
+#include "CString.h"
#include <String.h>
-
namespace WebCore {
// String conversions
-String::String(const BString& str)
+String::String(const BString& bstring)
{
- m_impl = String::fromUTF8(str.String(), str.Length()).impl();
+ const UChar* str = reinterpret_cast<const UChar*>(bstring.String());
+ const size_t size = bstring.Length();
+
+ if (!str)
+ return;
+
+ if (!size)
+ m_impl = StringImpl::empty();
+ else
+ m_impl = StringImpl::create(str, size);
}
String::operator BString() const
diff --git a/WebCore/platform/win/ClipboardWin.cpp b/WebCore/platform/win/ClipboardWin.cpp
index f83927d..d61e681 100644
--- a/WebCore/platform/win/ClipboardWin.cpp
+++ b/WebCore/platform/win/ClipboardWin.cpp
@@ -776,6 +776,25 @@ void ClipboardWin::writeRange(Range* selectedRange, Frame* frame)
m_writableDataObject->SetData(smartPasteFormat(), &medium, TRUE);
}
+void ClipboardWin::writePlainText(const String& text)
+{
+ if (!m_writableDataObject)
+ return;
+
+ STGMEDIUM medium = {0};
+ medium.tymed = TYMED_HGLOBAL;
+ ExceptionCode ec = 0;
+
+ String str = text;
+ replaceNewlinesWithWindowsStyleNewlines(str);
+ replaceNBSPWithSpace(str);
+ medium.hGlobal = createGlobalData(str);
+ if (medium.hGlobal && FAILED(m_writableDataObject->SetData(plainTextWFormat(), &medium, TRUE)))
+ ::GlobalFree(medium.hGlobal);
+
+ medium.hGlobal = 0;
+}
+
bool ClipboardWin::hasData()
{
if (!m_dataObject)
diff --git a/WebCore/platform/win/ClipboardWin.h b/WebCore/platform/win/ClipboardWin.h
index 6e60254..49fdcfe 100644
--- a/WebCore/platform/win/ClipboardWin.h
+++ b/WebCore/platform/win/ClipboardWin.h
@@ -67,6 +67,7 @@ namespace WebCore {
virtual void declareAndWriteDragImage(Element*, const KURL&, const String& title, Frame*);
virtual void writeURL(const KURL&, const String&, Frame*);
virtual void writeRange(Range*, Frame*);
+ virtual void writePlainText(const String&);
virtual bool hasData();
diff --git a/WebCore/platform/wx/ClipboardWx.cpp b/WebCore/platform/wx/ClipboardWx.cpp
index 0b02009..6100831 100644
--- a/WebCore/platform/wx/ClipboardWx.cpp
+++ b/WebCore/platform/wx/ClipboardWx.cpp
@@ -133,4 +133,9 @@ bool ClipboardWx::hasData()
return false;
}
+void ClipboardWx::writePlainText(const WebCore::String& text)
+{
+ Pasteboard::generalPasteboard()->writePlainText(text);
+}
+
}
diff --git a/WebCore/platform/wx/ClipboardWx.h b/WebCore/platform/wx/ClipboardWx.h
index 5e3ba86..b0c520b 100644
--- a/WebCore/platform/wx/ClipboardWx.h
+++ b/WebCore/platform/wx/ClipboardWx.h
@@ -59,6 +59,8 @@ namespace WebCore {
virtual void declareAndWriteDragImage(Element*, const KURL&, const String& title, Frame*);
virtual void writeURL(const KURL&, const String&, Frame*);
virtual void writeRange(Range*, Frame*);
+ virtual void writePlainText(const WebCore::String&);
+
virtual bool hasData();
diff --git a/WebCore/platform/wx/MouseWheelEventWx.cpp b/WebCore/platform/wx/MouseWheelEventWx.cpp
index 9f3923d..aa41df4 100644
--- a/WebCore/platform/wx/MouseWheelEventWx.cpp
+++ b/WebCore/platform/wx/MouseWheelEventWx.cpp
@@ -47,7 +47,7 @@ PlatformWheelEvent::PlatformWheelEvent(const wxMouseEvent& event, const wxPoint&
, m_isAccepted(false)
{
// FIXME: retrieve the user setting for the number of lines to scroll on each wheel event
- m_deltaY *= static_cast<float>(cScrollbarPixelsPerLineStep);
+ m_deltaY *= static_cast<float>(Scrollbar::pixelsPerLineStep());
}
}
diff --git a/WebCore/platform/wx/ScrollViewWx.cpp b/WebCore/platform/wx/ScrollViewWx.cpp
index 35acf68..35d62b2 100644
--- a/WebCore/platform/wx/ScrollViewWx.cpp
+++ b/WebCore/platform/wx/ScrollViewWx.cpp
@@ -84,27 +84,27 @@ public:
}
else if (scrollType == wxEVT_SCROLLWIN_LINEDOWN) {
if (horiz)
- pos.x += cScrollbarPixelsPerLineStep;
+ pos.x += Scrollbar::pixelsPerLineStep();
else
- pos.y += cScrollbarPixelsPerLineStep;
+ pos.y += Scrollbar::pixelsPerLineStep();
}
else if (scrollType == wxEVT_SCROLLWIN_LINEUP) {
if (horiz)
- pos.x -= cScrollbarPixelsPerLineStep;
+ pos.x -= Scrollbar::pixelsPerLineStep();
else
- pos.y -= cScrollbarPixelsPerLineStep;
+ pos.y -= Scrollbar::pixelsPerLineStep();
}
else if (scrollType == wxEVT_SCROLLWIN_PAGEUP) {
if (horiz)
- pos.x -= m_scrollView->visibleWidth() * cFractionToStepWhenPaging;
+ pos.x -= max<int>(m_scrollView->visibleWidth() * Scrollbar::minFractionToStepWhenPaging(), m_scrollView->visibleWidth() - Scrollbar::maxOverlapBetweenPages());
else
- pos.y -= m_scrollView->visibleHeight() * cFractionToStepWhenPaging;
+ pos.y -= max<int>(m_scrollView->visibleHeight() * Scrollbar::minFractionToStepWhenPaging(), m_scrollView->visibleHeight() - Scrollbar::maxOverlapBetweenPages());
}
else if (scrollType == wxEVT_SCROLLWIN_PAGEDOWN) {
if (horiz)
- pos.x += m_scrollView->visibleWidth() * cFractionToStepWhenPaging;
+ pos.x += max<int>(m_scrollView->visibleWidth() * Scrollbar::minFractionToStepWhenPaging(), m_scrollView->visibleWidth() - Scrollbar::maxOverlapBetweenPages());
else
- pos.y += m_scrollView->visibleHeight() * cFractionToStepWhenPaging;
+ pos.y += max<int>(m_scrollView->visibleHeight() * Scrollbar::minFractionToStepWhenPaging(), m_scrollView->visibleHeight() - Scrollbar::maxOverlapBetweenPages());
}
else
return e.Skip();
diff --git a/WebCore/platform/wx/wxcode/fontprops.h b/WebCore/platform/wx/wxcode/fontprops.h
index 7f38bcf..3f99462 100644
--- a/WebCore/platform/wx/wxcode/fontprops.h
+++ b/WebCore/platform/wx/wxcode/fontprops.h
@@ -48,3 +48,4 @@ private:
};
+bool wxFontContainsCharacters(const wxFont& font, const UChar* characters, int length);
diff --git a/WebCore/platform/wx/wxcode/gtk/fontprops.cpp b/WebCore/platform/wx/wxcode/gtk/fontprops.cpp
index df14812..491458d 100644
--- a/WebCore/platform/wx/wxcode/gtk/fontprops.cpp
+++ b/WebCore/platform/wx/wxcode/gtk/fontprops.cpp
@@ -24,6 +24,8 @@
*/
#include "config.h"
+// this needs to be included before fontprops.h for UChar* to be defined.
+#include <wtf/unicode/Unicode.h>
#include <wx/defs.h>
#include <wx/gdicmn.h>
@@ -92,6 +94,11 @@ m_ascent(0), m_descent(0), m_lineGap(0), m_lineSpacing(0), m_xHeight(0)
#endif
}
+bool wxFontContainsCharacters(const wxFont& font, const UChar* characters, int length)
+{
+ return true;
+}
+
void GetTextExtent( const wxFont& font, const wxString& str, wxCoord *width, wxCoord *height,
wxCoord *descent, wxCoord *externalLeading )
{
diff --git a/WebCore/platform/wx/wxcode/mac/carbon/fontprops.cpp b/WebCore/platform/wx/wxcode/mac/carbon/fontprops.mm
index 23dea6b..2312dec 100644
--- a/WebCore/platform/wx/wxcode/mac/carbon/fontprops.cpp
+++ b/WebCore/platform/wx/wxcode/mac/carbon/fontprops.mm
@@ -24,6 +24,9 @@
*/
#include "config.h"
+// this needs to be included before fontprops.h for UChar* to be defined.
+#include <wtf/unicode/Unicode.h>
+
#include "fontprops.h"
#include <ApplicationServices/ApplicationServices.h>
@@ -89,6 +92,19 @@ m_ascent(0), m_descent(0), m_lineGap(0), m_lineSpacing(0), m_xHeight(0)
}
+bool wxFontContainsCharacters(const wxFont& font, const UChar* characters, int length)
+{
+#if wxOSX_USE_COCOA
+ NSString* string = [[NSString alloc] initWithCharactersNoCopy:const_cast<unichar*>(characters) length:length freeWhenDone:NO];
+ NSCharacterSet* set = [[font.GetNSFont() coveredCharacterSet] invertedSet];
+ bool result = set && [string rangeOfCharacterFromSet:set].location == NSNotFound;
+ [string release];
+ return result;
+#else
+ return true;
+#endif
+}
+
void GetTextExtent( const wxFont& font, const wxString& str, wxCoord *width, wxCoord *height,
wxCoord *descent, wxCoord *externalLeading )
{
diff --git a/WebCore/platform/wx/wxcode/win/fontprops.cpp b/WebCore/platform/wx/wxcode/win/fontprops.cpp
index 531db08..d6ba964 100644
--- a/WebCore/platform/wx/wxcode/win/fontprops.cpp
+++ b/WebCore/platform/wx/wxcode/win/fontprops.cpp
@@ -24,15 +24,21 @@
*/
#include "config.h"
-#include <wx/defs.h>
-#include <wx/gdicmn.h>
+// this needs to be included before fontprops.h for UChar* to be defined.
+#include <wtf/unicode/Unicode.h>
+
#include "fontprops.h"
#include "math.h"
#include "MathExtras.h"
+#include <wx/defs.h>
+#include <wx/gdicmn.h>
#include <wx/wx.h>
#include "wx/msw/private.h"
+#include <mlang.h>
+#include <usp10.h>
+
inline long my_round(double x)
{
return (long)(x < 0 ? x - 0.5 : x + 0.5);
@@ -60,6 +66,46 @@ m_ascent(0), m_descent(0), m_lineGap(0), m_lineSpacing(0), m_xHeight(0)
ReleaseDC(0, dc);
}
+bool wxFontContainsCharacters(const wxFont& font, const UChar* characters, int length)
+{
+ // FIXME: Microsoft documentation seems to imply that characters can be output using a given font and DC
+ // merely by testing code page intersection. This seems suspect though. Can't a font only partially
+ // cover a given code page?
+ static IMultiLanguage *multiLanguage;
+ if (!multiLanguage) {
+ if (CoCreateInstance(CLSID_CMultiLanguage, 0, CLSCTX_ALL, IID_IMultiLanguage, (void**)&multiLanguage) != S_OK)
+ return true;
+ }
+
+ static IMLangFontLink2* langFontLink;
+ if (!langFontLink) {
+ if (multiLanguage->QueryInterface(&langFontLink) != S_OK)
+ return true;
+ }
+
+ HDC dc = GetDC(0);
+
+ DWORD acpCodePages;
+ langFontLink->CodePageToCodePages(CP_ACP, &acpCodePages);
+
+ DWORD fontCodePages;
+ langFontLink->GetFontCodePages(dc, static_cast<HFONT>(font.GetHFONT()), &fontCodePages);
+
+ DWORD actualCodePages;
+ long numCharactersProcessed;
+ long offset = 0;
+ while (offset < length) {
+ langFontLink->GetStrCodePages(characters, length, acpCodePages, &actualCodePages, &numCharactersProcessed);
+ if ((actualCodePages & fontCodePages))
+ return false;
+ offset += numCharactersProcessed;
+ }
+
+ ReleaseDC(0, dc);
+
+ return true;
+}
+
void GetTextExtent( const wxFont& font, const wxString& str, wxCoord *width, wxCoord *height,
wxCoord *descent, wxCoord *externalLeading )
{
diff --git a/WebCore/platform/wx/wxcode/win/non-kerned-drawing.cpp b/WebCore/platform/wx/wxcode/win/non-kerned-drawing.cpp
index 72fcc54..2fcd761 100644
--- a/WebCore/platform/wx/wxcode/win/non-kerned-drawing.cpp
+++ b/WebCore/platform/wx/wxcode/win/non-kerned-drawing.cpp
@@ -122,7 +122,7 @@ void drawTextWithSpacing(GraphicsContext* graphicsContext, const SimpleFontData*
// draw text with optional character widths array
wxString string = wxString((wxChar*)(&glyphs[from]), numGlyphs);
- ::ExtTextOut(hdc, x, y, 0, NULL, string.c_str(), string.length(), spacing);
+ ::ExtTextOut(hdc, x, y, ETO_GLYPH_INDEX, 0, reinterpret_cast<const WCHAR*>(glyphs), numGlyphs, spacing);
::SetBkMode(hdc, TRANSPARENT);
diff --git a/WebCore/plugins/PluginStream.cpp b/WebCore/plugins/PluginStream.cpp
index 4be3d13..bf35ba4 100644
--- a/WebCore/plugins/PluginStream.cpp
+++ b/WebCore/plugins/PluginStream.cpp
@@ -84,7 +84,7 @@ PluginStream::~PluginStream()
ASSERT(m_streamState != StreamStarted);
ASSERT(!m_loader);
- free((char*)m_stream.url);
+ fastFree((char*)m_stream.url);
streams().remove(&m_stream);
}
@@ -133,9 +133,9 @@ void PluginStream::startStream()
// Some plugins (Flash) expect that javascript URLs are passed back decoded as this is the
// format used when requesting the URL.
if (protocolIsJavaScript(responseURL))
- m_stream.url = strdup(decodeURLEscapeSequences(responseURL.string()).utf8().data());
+ m_stream.url = fastStrDup(decodeURLEscapeSequences(responseURL.string()).utf8().data());
else
- m_stream.url = strdup(responseURL.string().utf8().data());
+ m_stream.url = fastStrDup(responseURL.string().utf8().data());
CString mimeTypeStr = m_resourceResponse.mimeType().utf8();
diff --git a/WebCore/plugins/PluginView.cpp b/WebCore/plugins/PluginView.cpp
index d763219..a0ae79f 100644
--- a/WebCore/plugins/PluginView.cpp
+++ b/WebCore/plugins/PluginView.cpp
@@ -95,6 +95,14 @@ using namespace HTMLNames;
static int s_callingPlugin;
+typedef HashMap<NPP, PluginView*> InstanceMap;
+
+static InstanceMap& instanceMap()
+{
+ static InstanceMap& map = *new InstanceMap;
+ return map;
+}
+
static String scriptStringIfJavaScriptURL(const KURL& url)
{
if (!protocolIsJavaScript(url))
@@ -210,7 +218,10 @@ bool PluginView::startOrAddToUnstartedList()
if (!m_parentFrame->page())
return false;
- if (!m_parentFrame->page()->canStartPlugins()) {
+ // We only delay starting the plug-in if we're going to kick off the load
+ // ourselves. Otherwise, the loader will try to deliver data before we've
+ // started the plug-in.
+ if (!m_loadManually && !m_parentFrame->page()->canStartPlugins()) {
m_parentFrame->page()->addUnstartedPlugin(this);
m_isWaitingToStart = true;
return true;
@@ -278,6 +289,10 @@ PluginView::~PluginView()
{
LOG(Plugins, "PluginView::~PluginView()");
+ ASSERT(!m_lifeSupportTimer.isActive());
+
+ instanceMap().remove(m_instance);
+
removeFromUnstartedListIfNecessary();
stop();
@@ -451,7 +466,7 @@ void PluginView::performRequest(PluginRequest* request)
// if this is not a targeted request, create a stream for it. otherwise,
// just pass it off to the loader
if (targetFrameName.isEmpty()) {
- RefPtr<PluginStream> stream = PluginStream::create(this, m_parentFrame, request->frameLoadRequest().resourceRequest(), request->sendNotification(), request->notifyData(), plugin()->pluginFuncs(), instance(), m_plugin->quirks());
+ RefPtr<PluginStream> stream = PluginStream::create(this, m_parentFrame.get(), request->frameLoadRequest().resourceRequest(), request->sendNotification(), request->notifyData(), plugin()->pluginFuncs(), instance(), m_plugin->quirks());
m_streams.add(stream);
stream->start();
} else {
@@ -492,7 +507,7 @@ void PluginView::performRequest(PluginRequest* request)
if (getString(parentFrame->script(), result, resultString))
cstr = resultString.utf8();
- RefPtr<PluginStream> stream = PluginStream::create(this, m_parentFrame, request->frameLoadRequest().resourceRequest(), request->sendNotification(), request->notifyData(), plugin()->pluginFuncs(), instance(), m_plugin->quirks());
+ RefPtr<PluginStream> stream = PluginStream::create(this, m_parentFrame.get(), request->frameLoadRequest().resourceRequest(), request->sendNotification(), request->notifyData(), plugin()->pluginFuncs(), instance(), m_plugin->quirks());
m_streams.add(stream);
stream->sendJavaScriptStream(requestURL, cstr);
}
@@ -632,7 +647,7 @@ NPError PluginView::destroyStream(NPStream* stream, NPReason reason)
void PluginView::status(const char* message)
{
if (Page* page = m_parentFrame->page())
- page->chrome()->setStatusbarText(m_parentFrame, String(message));
+ page->chrome()->setStatusbarText(m_parentFrame.get(), String(message));
}
NPError PluginView::setValue(NPPVariable variable, void* value)
@@ -860,6 +875,7 @@ PluginView::PluginView(Frame* parentFrame, const IntSize& size, PluginPackage* p
, m_requestTimer(this, &PluginView::requestTimerFired)
, m_invalidateTimer(this, &PluginView::invalidateTimerFired)
, m_popPopupsStateTimer(this, &PluginView::popPopupsStateTimerFired)
+ , m_lifeSupportTimer(this, &PluginView::lifeSupportTimerFired)
, m_mode(loadManually ? NP_FULL : NP_EMBED)
, m_paramNames(0)
, m_paramValues(0)
@@ -917,6 +933,8 @@ PluginView::PluginView(Frame* parentFrame, const IntSize& size, PluginPackage* p
m_instance->ndata = this;
m_instance->pdata = 0;
+ instanceMap().add(m_instance, this);
+
setParameters(paramNames, paramValues);
memset(&m_npWindow, 0, sizeof(m_npWindow));
@@ -943,7 +961,7 @@ void PluginView::didReceiveResponse(const ResourceResponse& response)
ASSERT(m_loadManually);
ASSERT(!m_manualStream);
- m_manualStream = PluginStream::create(this, m_parentFrame, m_parentFrame->loader()->activeDocumentLoader()->request(), false, 0, plugin()->pluginFuncs(), instance(), m_plugin->quirks());
+ m_manualStream = PluginStream::create(this, m_parentFrame.get(), m_parentFrame->loader()->activeDocumentLoader()->request(), false, 0, plugin()->pluginFuncs(), instance(), m_plugin->quirks());
m_manualStream->setLoadManually(true);
m_manualStream->didReceiveResponse(0, response);
@@ -1336,4 +1354,27 @@ String PluginView::pluginName() const
return m_plugin->name();
}
+void PluginView::lifeSupportTimerFired(Timer<PluginView>*)
+{
+ deref();
+}
+
+void PluginView::keepAlive()
+{
+ if (m_lifeSupportTimer.isActive())
+ return;
+
+ ref();
+ m_lifeSupportTimer.startOneShot(0);
+}
+
+void PluginView::keepAlive(NPP instance)
+{
+ PluginView* view = instanceMap().get(instance);
+ if (!view)
+ return;
+
+ view->keepAlive();
+}
+
} // namespace WebCore
diff --git a/WebCore/plugins/PluginView.h b/WebCore/plugins/PluginView.h
index 48c8ff1..093ca5a 100644
--- a/WebCore/plugins/PluginView.h
+++ b/WebCore/plugins/PluginView.h
@@ -204,7 +204,7 @@ namespace WebCore {
virtual bool isPluginView() const { return true; }
- Frame* parentFrame() const { return m_parentFrame; }
+ Frame* parentFrame() const { return m_parentFrame.get(); }
void focusPluginElement();
@@ -242,6 +242,9 @@ namespace WebCore {
bool start();
+ static void keepAlive(NPP);
+ void keepAlive();
+
private:
PluginView(Frame* parentFrame, const IntSize&, PluginPackage*, Element*, const KURL&, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually);
@@ -267,7 +270,7 @@ namespace WebCore {
static BOOL WINAPI hookedEndPaint(HWND, const PAINTSTRUCT*);
#endif
- Frame* m_parentFrame;
+ RefPtr<Frame> m_parentFrame;
RefPtr<PluginPackage> m_plugin;
Element* m_element;
bool m_isStarted;
@@ -286,6 +289,9 @@ namespace WebCore {
void popPopupsStateTimerFired(Timer<PluginView>*);
Timer<PluginView> m_popPopupsStateTimer;
+ void lifeSupportTimerFired(Timer<PluginView>*);
+ Timer<PluginView> m_lifeSupportTimer;
+
#ifndef NP_NO_CARBON
bool dispatchNPEvent(NPEvent&);
#endif
@@ -376,7 +382,11 @@ public:
private:
+<<<<<<< HEAD
#if defined(XP_UNIX) || PLATFORM(SYMBIAN) || defined(ANDROID_PLUGINS)
+=======
+#if defined(XP_UNIX) || OS(SYMBIAN)
+>>>>>>> webkit.org at r54731
void setNPWindowIfNeeded();
#elif defined(XP_MACOSX)
NP_CGContext m_npCgContext;
diff --git a/WebCore/plugins/PluginViewNone.cpp b/WebCore/plugins/PluginViewNone.cpp
index 725af82..2821afc 100644
--- a/WebCore/plugins/PluginViewNone.cpp
+++ b/WebCore/plugins/PluginViewNone.cpp
@@ -73,7 +73,7 @@ NPError PluginView::getValue(NPNVariable, void*)
}
#if ENABLE(NETSCAPE_PLUGIN_API)
-NPError PluginView::getValueStatic(NPNVariable variable, void* value)
+NPError PluginView::getValueStatic(NPNVariable, void*)
{
return 0;
}
@@ -120,4 +120,8 @@ void PluginView::restart()
{
}
+void PluginView::keepAlive(NPP)
+{
+}
+
} // namespace WebCore
diff --git a/WebCore/plugins/gtk/PluginViewGtk.cpp b/WebCore/plugins/gtk/PluginViewGtk.cpp
index 8f4b2d5..6d992fb 100644
--- a/WebCore/plugins/gtk/PluginViewGtk.cpp
+++ b/WebCore/plugins/gtk/PluginViewGtk.cpp
@@ -137,7 +137,7 @@ void PluginView::updatePluginWidget()
if (m_drawable)
XFreePixmap(GDK_DISPLAY(), m_drawable);
- m_drawable = XCreatePixmap(GDK_DISPLAY(), getRootWindow(m_parentFrame),
+ m_drawable = XCreatePixmap(GDK_DISPLAY(), getRootWindow(m_parentFrame.get()),
m_windowRect.width(), m_windowRect.height(),
((NPSetWindowCallbackStruct*)m_npWindow.ws_info)->depth);
XSync(GDK_DISPLAY(), False); // make sure that the server knows about the Drawable
@@ -319,7 +319,7 @@ void PluginView::handleKeyboardEvent(KeyboardEvent* event)
GdkEventKey* gdkEvent = event->keyEvent()->gdkEventKey();
xEvent.type = (event->type() == eventNames().keydownEvent) ? 2 : 3; // KeyPress/Release get unset somewhere
- xEvent.xkey.root = getRootWindow(m_parentFrame);
+ xEvent.xkey.root = getRootWindow(m_parentFrame.get());
xEvent.xkey.subwindow = 0; // we have no child window
xEvent.xkey.time = event->timeStamp();
xEvent.xkey.state = gdkEvent->state; // GdkModifierType mirrors xlib state masks
@@ -445,11 +445,11 @@ void PluginView::handleMouseEvent(MouseEvent* event)
IntPoint postZoomPos = roundedIntPoint(m_element->renderer()->absoluteToLocal(event->absoluteLocation()));
if (event->type() == eventNames().mousedownEvent || event->type() == eventNames().mouseupEvent)
- setXButtonEventSpecificFields(&xEvent, event, postZoomPos, m_parentFrame);
+ setXButtonEventSpecificFields(&xEvent, event, postZoomPos, m_parentFrame.get());
else if (event->type() == eventNames().mousemoveEvent)
- setXMotionEventSpecificFields(&xEvent, event, postZoomPos, m_parentFrame);
+ setXMotionEventSpecificFields(&xEvent, event, postZoomPos, m_parentFrame.get());
else if (event->type() == eventNames().mouseoutEvent || event->type() == eventNames().mouseoverEvent)
- setXCrossingEventSpecificFields(&xEvent, event, postZoomPos, m_parentFrame);
+ setXCrossingEventSpecificFields(&xEvent, event, postZoomPos, m_parentFrame.get());
else
return;
#endif
diff --git a/WebCore/plugins/win/PluginViewWin.cpp b/WebCore/plugins/win/PluginViewWin.cpp
index 2ade663..04fda8e 100644
--- a/WebCore/plugins/win/PluginViewWin.cpp
+++ b/WebCore/plugins/win/PluginViewWin.cpp
@@ -585,9 +585,9 @@ void PluginView::paintWindowedPluginIntoContext(GraphicsContext* context, const
// The plugin expects the DC to be in client coordinates, so we translate
// the DC to make that so.
- TransformationMatrix ctm = context->getCTM();
+ AffineTransform ctm = context->getCTM();
ctm.translate(locationInWindow.x(), locationInWindow.y());
- XFORM transform = static_cast<XFORM>(ctm);
+ XFORM transform = static_cast<XFORM>(ctm.toTransformationMatrix());
SetWorldTransform(hdc, &transform);
diff --git a/WebCore/rendering/BidiRun.cpp b/WebCore/rendering/BidiRun.cpp
new file mode 100644
index 0000000..ac13046
--- /dev/null
+++ b/WebCore/rendering/BidiRun.cpp
@@ -0,0 +1,74 @@
+/**
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "BidiRun.h"
+#include "InlineBox.h"
+#include "RenderArena.h"
+#include <wtf/RefCountedLeakCounter.h>
+
+using namespace WTF;
+
+namespace WebCore {
+
+#ifndef NDEBUG
+static RefCountedLeakCounter bidiRunCounter("BidiRun");
+
+static bool inBidiRunDestroy;
+#endif
+
+void BidiRun::destroy()
+{
+#ifndef NDEBUG
+ inBidiRunDestroy = true;
+#endif
+ RenderArena* renderArena = m_object->renderArena();
+ delete this;
+#ifndef NDEBUG
+ inBidiRunDestroy = false;
+#endif
+
+ // Recover the size left there for us by operator delete and free the memory.
+ renderArena->free(*reinterpret_cast<size_t*>(this), this);
+}
+
+void* BidiRun::operator new(size_t sz, RenderArena* renderArena) throw()
+{
+#ifndef NDEBUG
+ bidiRunCounter.increment();
+#endif
+ return renderArena->allocate(sz);
+}
+
+void BidiRun::operator delete(void* ptr, size_t sz)
+{
+#ifndef NDEBUG
+ bidiRunCounter.decrement();
+#endif
+ ASSERT(inBidiRunDestroy);
+
+ // Stash size where destroy() can find it.
+ *(size_t*)ptr = sz;
+}
+
+}
diff --git a/WebCore/rendering/BidiRun.h b/WebCore/rendering/BidiRun.h
new file mode 100644
index 0000000..542081a
--- /dev/null
+++ b/WebCore/rendering/BidiRun.h
@@ -0,0 +1,65 @@
+/**
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef BidiRun_h
+#define BidiRun_h
+
+#include <wtf/StdLibExtras.h>
+#include "BidiResolver.h"
+#include "RenderText.h"
+
+namespace WebCore {
+
+class BidiContext;
+class InlineBox;
+
+struct BidiRun : BidiCharacterRun {
+ BidiRun(int start, int stop, RenderObject* object, BidiContext* context, WTF::Unicode::Direction dir)
+ : BidiCharacterRun(start, stop, context, dir)
+ , m_object(object)
+ , m_box(0)
+ {
+ }
+
+ void destroy();
+
+ // Overloaded new operator.
+ void* operator new(size_t, RenderArena*) throw();
+
+ // Overridden to prevent the normal delete from being called.
+ void operator delete(void*, size_t);
+
+ BidiRun* next() { return static_cast<BidiRun*>(m_next); }
+
+private:
+ // The normal operator new is disallowed.
+ void* operator new(size_t) throw();
+
+public:
+ RenderObject* m_object;
+ InlineBox* m_box;
+};
+
+}
+
+#endif // BidiRun_h
diff --git a/WebCore/rendering/InlineIterator.h b/WebCore/rendering/InlineIterator.h
new file mode 100644
index 0000000..9310ea8
--- /dev/null
+++ b/WebCore/rendering/InlineIterator.h
@@ -0,0 +1,266 @@
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010 Apple Inc. All right reserved.
+ * Copyright (C) 2010 Google 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
+ * 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef InlineIterator_h
+#define InlineIterator_h
+
+#include "BidiRun.h"
+#include "RenderBlock.h"
+#include "RenderText.h"
+#include <wtf/AlwaysInline.h>
+#include <wtf/StdLibExtras.h>
+
+namespace WebCore {
+
+class InlineIterator {
+public:
+ InlineIterator()
+ : block(0)
+ , obj(0)
+ , pos(0)
+ , nextBreakablePosition(-1)
+ {
+ }
+
+ InlineIterator(RenderBlock* b, RenderObject* o, unsigned p)
+ : block(b)
+ , obj(o)
+ , pos(p)
+ , nextBreakablePosition(-1)
+ {
+ }
+
+ void increment(InlineBidiResolver* resolver = 0);
+ bool atEnd() const;
+
+ UChar current() const;
+ WTF::Unicode::Direction direction() const;
+
+ RenderBlock* block;
+ RenderObject* obj;
+ unsigned pos;
+ int nextBreakablePosition;
+};
+
+inline bool operator==(const InlineIterator& it1, const InlineIterator& it2)
+{
+ return it1.pos == it2.pos && it1.obj == it2.obj;
+}
+
+inline bool operator!=(const InlineIterator& it1, const InlineIterator& it2)
+{
+ return it1.pos != it2.pos || it1.obj != it2.obj;
+}
+
+static inline RenderObject* bidiNext(RenderBlock* block, RenderObject* current, InlineBidiResolver* resolver = 0, bool skipInlines = true, bool* endOfInlinePtr = 0)
+{
+ RenderObject* next = 0;
+ bool oldEndOfInline = endOfInlinePtr ? *endOfInlinePtr : false;
+ bool endOfInline = false;
+
+ while (current) {
+ next = 0;
+ if (!oldEndOfInline && !current->isFloating() && !current->isReplaced() && !current->isPositioned() && !current->isText()) {
+ next = current->firstChild();
+ if (next && resolver && next->isRenderInline()) {
+ EUnicodeBidi ub = next->style()->unicodeBidi();
+ if (ub != UBNormal) {
+ TextDirection dir = next->style()->direction();
+ WTF::Unicode::Direction d = (ub == Embed
+ ? (dir == RTL ? WTF::Unicode::RightToLeftEmbedding : WTF::Unicode::LeftToRightEmbedding)
+ : (dir == RTL ? WTF::Unicode::RightToLeftOverride : WTF::Unicode::LeftToRightOverride));
+ resolver->embed(d);
+ }
+ }
+ }
+
+ if (!next) {
+ if (!skipInlines && !oldEndOfInline && current->isRenderInline()) {
+ next = current;
+ endOfInline = true;
+ break;
+ }
+
+ while (current && current != block) {
+ if (resolver && current->isRenderInline() && current->style()->unicodeBidi() != UBNormal)
+ resolver->embed(WTF::Unicode::PopDirectionalFormat);
+
+ next = current->nextSibling();
+ if (next) {
+ if (resolver && next->isRenderInline()) {
+ EUnicodeBidi ub = next->style()->unicodeBidi();
+ if (ub != UBNormal) {
+ TextDirection dir = next->style()->direction();
+ WTF::Unicode::Direction d = (ub == Embed
+ ? (dir == RTL ? WTF::Unicode::RightToLeftEmbedding: WTF::Unicode::LeftToRightEmbedding)
+ : (dir == RTL ? WTF::Unicode::RightToLeftOverride : WTF::Unicode::LeftToRightOverride));
+ resolver->embed(d);
+ }
+ }
+ break;
+ }
+
+ current = current->parent();
+ if (!skipInlines && current && current != block && current->isRenderInline()) {
+ next = current;
+ endOfInline = true;
+ break;
+ }
+ }
+ }
+
+ if (!next)
+ break;
+
+ if (next->isText() || next->isFloating() || next->isReplaced() || next->isPositioned()
+ || ((!skipInlines || !next->firstChild()) // Always return EMPTY inlines.
+ && next->isRenderInline()))
+ break;
+ current = next;
+ }
+
+ if (endOfInlinePtr)
+ *endOfInlinePtr = endOfInline;
+
+ return next;
+}
+
+static inline RenderObject* bidiFirst(RenderBlock* block, InlineBidiResolver* resolver, bool skipInlines = true)
+{
+ if (!block->firstChild())
+ return 0;
+
+ RenderObject* o = block->firstChild();
+ if (o->isRenderInline()) {
+ if (resolver) {
+ EUnicodeBidi ub = o->style()->unicodeBidi();
+ if (ub != UBNormal) {
+ TextDirection dir = o->style()->direction();
+ WTF::Unicode::Direction d = (ub == Embed
+ ? (dir == RTL ? WTF::Unicode::RightToLeftEmbedding : WTF::Unicode::LeftToRightEmbedding)
+ : (dir == RTL ? WTF::Unicode::RightToLeftOverride : WTF::Unicode::LeftToRightOverride));
+ resolver->embed(d);
+ }
+ }
+ if (skipInlines && o->firstChild())
+ o = bidiNext(block, o, resolver, skipInlines);
+ else {
+ // Never skip empty inlines.
+ if (resolver)
+ resolver->commitExplicitEmbedding();
+ return o;
+ }
+ }
+
+ if (o && !o->isText() && !o->isReplaced() && !o->isFloating() && !o->isPositioned())
+ o = bidiNext(block, o, resolver, skipInlines);
+
+ if (resolver)
+ resolver->commitExplicitEmbedding();
+ return o;
+}
+
+inline void InlineIterator::increment(InlineBidiResolver* resolver)
+{
+ if (!obj)
+ return;
+ if (obj->isText()) {
+ pos++;
+ if (pos >= toRenderText(obj)->textLength()) {
+ obj = bidiNext(block, obj, resolver);
+ pos = 0;
+ nextBreakablePosition = -1;
+ }
+ } else {
+ obj = bidiNext(block, obj, resolver);
+ pos = 0;
+ nextBreakablePosition = -1;
+ }
+}
+
+inline bool InlineIterator::atEnd() const
+{
+ return !obj;
+}
+
+inline UChar InlineIterator::current() const
+{
+ if (!obj || !obj->isText())
+ return 0;
+
+ RenderText* text = toRenderText(obj);
+ if (pos >= text->textLength())
+ return 0;
+
+ return text->characters()[pos];
+}
+
+ALWAYS_INLINE WTF::Unicode::Direction InlineIterator::direction() const
+{
+ if (UChar c = current())
+ return WTF::Unicode::direction(c);
+
+ if (obj && obj->isListMarker())
+ return obj->style()->direction() == LTR ? WTF::Unicode::LeftToRight : WTF::Unicode::RightToLeft;
+
+ return WTF::Unicode::OtherNeutral;
+}
+
+template<>
+inline void InlineBidiResolver::increment()
+{
+ current.increment(this);
+}
+
+template <>
+inline void InlineBidiResolver::appendRun()
+{
+ if (!emptyRun && !eor.atEnd()) {
+ int start = sor.pos;
+ RenderObject *obj = sor.obj;
+ while (obj && obj != eor.obj && obj != endOfLine.obj) {
+ RenderBlock::appendRunsForObject(start, obj->length(), obj, *this);
+ start = 0;
+ obj = bidiNext(sor.block, obj);
+ }
+ if (obj) {
+ unsigned pos = obj == eor.obj ? eor.pos : UINT_MAX;
+ if (obj == endOfLine.obj && endOfLine.pos <= pos) {
+ reachedEndOfLine = true;
+ pos = endOfLine.pos;
+ }
+ // It's OK to add runs for zero-length RenderObjects, just don't make the run larger than it should be
+ int end = obj->length() ? pos+1 : 0;
+ RenderBlock::appendRunsForObject(start, end, obj, *this);
+ }
+
+ eor.increment();
+ sor = eor;
+ }
+
+ m_direction = WTF::Unicode::OtherNeutral;
+ m_status.eor = WTF::Unicode::OtherNeutral;
+}
+
+}
+
+#endif // InlineIterator_h
diff --git a/WebCore/rendering/RenderBlock.h b/WebCore/rendering/RenderBlock.h
index 884695a..d1d105a 100644
--- a/WebCore/rendering/RenderBlock.h
+++ b/WebCore/rendering/RenderBlock.h
@@ -138,6 +138,9 @@ public:
// style from this RenderBlock.
RenderBlock* createAnonymousBlock(bool isFlexibleBox = false) const;
+ static void appendRunsForObject(int start, int end, RenderObject*, InlineBidiResolver&);
+ static bool requiresLineBox(const InlineIterator&, bool isLineEmpty = true, bool previousLineBrokeCleanly = true);
+
protected:
void moveChildTo(RenderObject* to, RenderObjectChildList* toChildList, RenderObject* child);
void moveChildTo(RenderObject* to, RenderObjectChildList* toChildList, RenderObject* beforeChild, RenderObject* child);
diff --git a/WebCore/rendering/RenderBlockLineLayout.cpp b/WebCore/rendering/RenderBlockLineLayout.cpp
index c76d963..a7f3553 100644
--- a/WebCore/rendering/RenderBlockLineLayout.cpp
+++ b/WebCore/rendering/RenderBlockLineLayout.cpp
@@ -24,6 +24,7 @@
#include "BidiResolver.h"
#include "CharacterNames.h"
+#include "InlineIterator.h"
#include "InlineTextBox.h"
#include "Logging.h"
#include "RenderArena.h"
@@ -53,36 +54,6 @@ namespace WebCore {
// We don't let our line box tree for a single line get any deeper than this.
const unsigned cMaxLineDepth = 200;
-class InlineIterator {
-public:
- InlineIterator()
- : block(0)
- , obj(0)
- , pos(0)
- , nextBreakablePosition(-1)
- {
- }
-
- InlineIterator(RenderBlock* b, RenderObject* o, unsigned p)
- : block(b)
- , obj(o)
- , pos(p)
- , nextBreakablePosition(-1)
- {
- }
-
- void increment(InlineBidiResolver* resolver = 0);
- bool atEnd() const;
-
- UChar current() const;
- Direction direction() const;
-
- RenderBlock* block;
- RenderObject* obj;
- unsigned pos;
- int nextBreakablePosition;
-};
-
static int getBorderPaddingMargin(RenderBoxModelObject* child, bool endOfInline)
{
bool leftSide = (child->style()->direction() == LTR) ? !endOfInline : endOfInline;
@@ -107,247 +78,6 @@ static int inlineWidth(RenderObject* child, bool start = true, bool end = true)
return extraWidth;
}
-struct BidiRun : BidiCharacterRun {
- BidiRun(int start, int stop, RenderObject* object, BidiContext* context, Direction dir)
- : BidiCharacterRun(start, stop, context, dir)
- , m_object(object)
- , m_box(0)
- {
- }
-
- void destroy();
-
- // Overloaded new operator.
- void* operator new(size_t, RenderArena*) throw();
-
- // Overridden to prevent the normal delete from being called.
- void operator delete(void*, size_t);
-
- BidiRun* next() { return static_cast<BidiRun*>(m_next); }
-
-private:
- // The normal operator new is disallowed.
- void* operator new(size_t) throw();
-
-public:
- RenderObject* m_object;
- InlineBox* m_box;
-};
-
-#ifndef NDEBUG
-static RefCountedLeakCounter bidiRunCounter("BidiRun");
-
-static bool inBidiRunDestroy;
-#endif
-
-void BidiRun::destroy()
-{
-#ifndef NDEBUG
- inBidiRunDestroy = true;
-#endif
- RenderArena* renderArena = m_object->renderArena();
- delete this;
-#ifndef NDEBUG
- inBidiRunDestroy = false;
-#endif
-
- // Recover the size left there for us by operator delete and free the memory.
- renderArena->free(*reinterpret_cast<size_t*>(this), this);
-}
-
-void* BidiRun::operator new(size_t sz, RenderArena* renderArena) throw()
-{
-#ifndef NDEBUG
- bidiRunCounter.increment();
-#endif
- return renderArena->allocate(sz);
-}
-
-void BidiRun::operator delete(void* ptr, size_t sz)
-{
-#ifndef NDEBUG
- bidiRunCounter.decrement();
-#endif
- ASSERT(inBidiRunDestroy);
-
- // Stash size where destroy() can find it.
- *(size_t*)ptr = sz;
-}
-
-// ---------------------------------------------------------------------
-
-inline bool operator==(const InlineIterator& it1, const InlineIterator& it2)
-{
- return it1.pos == it2.pos && it1.obj == it2.obj;
-}
-
-inline bool operator!=(const InlineIterator& it1, const InlineIterator& it2)
-{
- return it1.pos != it2.pos || it1.obj != it2.obj;
-}
-
-static inline RenderObject* bidiNext(RenderBlock* block, RenderObject* current, InlineBidiResolver* resolver = 0, bool skipInlines = true, bool* endOfInlinePtr = 0)
-{
- RenderObject* next = 0;
- bool oldEndOfInline = endOfInlinePtr ? *endOfInlinePtr : false;
- bool endOfInline = false;
-
- while (current) {
- next = 0;
- if (!oldEndOfInline && !current->isFloating() && !current->isReplaced() && !current->isPositioned() && !current->isText()) {
- next = current->firstChild();
- if (next && resolver && next->isRenderInline()) {
- EUnicodeBidi ub = next->style()->unicodeBidi();
- if (ub != UBNormal) {
- TextDirection dir = next->style()->direction();
- Direction d = (ub == Embed
- ? (dir == RTL ? RightToLeftEmbedding : LeftToRightEmbedding)
- : (dir == RTL ? RightToLeftOverride : LeftToRightOverride));
- resolver->embed(d);
- }
- }
- }
-
- if (!next) {
- if (!skipInlines && !oldEndOfInline && current->isRenderInline()) {
- next = current;
- endOfInline = true;
- break;
- }
-
- while (current && current != block) {
- if (resolver && current->isRenderInline() && current->style()->unicodeBidi() != UBNormal)
- resolver->embed(PopDirectionalFormat);
-
- next = current->nextSibling();
- if (next) {
- if (resolver && next->isRenderInline()) {
- EUnicodeBidi ub = next->style()->unicodeBidi();
- if (ub != UBNormal) {
- TextDirection dir = next->style()->direction();
- Direction d = (ub == Embed
- ? (dir == RTL ? RightToLeftEmbedding: LeftToRightEmbedding)
- : (dir == RTL ? RightToLeftOverride : LeftToRightOverride));
- resolver->embed(d);
- }
- }
- break;
- }
-
- current = current->parent();
- if (!skipInlines && current && current != block && current->isRenderInline()) {
- next = current;
- endOfInline = true;
- break;
- }
- }
- }
-
- if (!next)
- break;
-
- if (next->isText() || next->isFloating() || next->isReplaced() || next->isPositioned()
- || ((!skipInlines || !next->firstChild()) // Always return EMPTY inlines.
- && next->isRenderInline()))
- break;
- current = next;
- }
-
- if (endOfInlinePtr)
- *endOfInlinePtr = endOfInline;
-
- return next;
-}
-
-static RenderObject* bidiFirst(RenderBlock* block, InlineBidiResolver* resolver, bool skipInlines = true)
-{
- if (!block->firstChild())
- return 0;
-
- RenderObject* o = block->firstChild();
- if (o->isRenderInline()) {
- if (resolver) {
- EUnicodeBidi ub = o->style()->unicodeBidi();
- if (ub != UBNormal) {
- TextDirection dir = o->style()->direction();
- Direction d = (ub == Embed
- ? (dir == RTL ? RightToLeftEmbedding : LeftToRightEmbedding)
- : (dir == RTL ? RightToLeftOverride : LeftToRightOverride));
- resolver->embed(d);
- }
- }
- if (skipInlines && o->firstChild())
- o = bidiNext(block, o, resolver, skipInlines);
- else {
- // Never skip empty inlines.
- if (resolver)
- resolver->commitExplicitEmbedding();
- return o;
- }
- }
-
- if (o && !o->isText() && !o->isReplaced() && !o->isFloating() && !o->isPositioned())
- o = bidiNext(block, o, resolver, skipInlines);
-
- if (resolver)
- resolver->commitExplicitEmbedding();
- return o;
-}
-
-inline void InlineIterator::increment(InlineBidiResolver* resolver)
-{
- if (!obj)
- return;
- if (obj->isText()) {
- pos++;
- if (pos >= toRenderText(obj)->textLength()) {
- obj = bidiNext(block, obj, resolver);
- pos = 0;
- nextBreakablePosition = -1;
- }
- } else {
- obj = bidiNext(block, obj, resolver);
- pos = 0;
- nextBreakablePosition = -1;
- }
-}
-
-template<>
-inline void InlineBidiResolver::increment()
-{
- current.increment(this);
-}
-
-inline bool InlineIterator::atEnd() const
-{
- return !obj;
-}
-
-inline UChar InlineIterator::current() const
-{
- if (!obj || !obj->isText())
- return 0;
-
- RenderText* text = toRenderText(obj);
- if (pos >= text->textLength())
- return 0;
-
- return text->characters()[pos];
-}
-
-ALWAYS_INLINE Direction InlineIterator::direction() const
-{
- if (UChar c = current())
- return Unicode::direction(c);
-
- if (obj && obj->isListMarker())
- return obj->style()->direction() == LTR ? LeftToRight : RightToLeft;
-
- return OtherNeutral;
-}
-
-// -------------------------------------------------------------------------------------------------
-
static void chopMidpointsAt(LineMidpointState& lineMidpointState, RenderObject* obj, unsigned pos)
{
if (!lineMidpointState.numMidpoints)
@@ -405,7 +135,7 @@ static void addMidpoint(LineMidpointState& lineMidpointState, const InlineIterat
midpoints[lineMidpointState.numMidpoints++] = midpoint;
}
-static void appendRunsForObject(int start, int end, RenderObject* obj, InlineBidiResolver& resolver)
+void RenderBlock::appendRunsForObject(int start, int end, RenderObject* obj, InlineBidiResolver& resolver)
{
if (start > end || obj->isFloating() ||
(obj->isPositioned() && !obj->style()->hasStaticX() && !obj->style()->hasStaticY() && !obj->container()->isRenderInline()))
@@ -448,36 +178,6 @@ static void appendRunsForObject(int start, int end, RenderObject* obj, InlineBid
}
}
-template <>
-void InlineBidiResolver::appendRun()
-{
- if (!emptyRun && !eor.atEnd()) {
- int start = sor.pos;
- RenderObject *obj = sor.obj;
- while (obj && obj != eor.obj && obj != endOfLine.obj) {
- appendRunsForObject(start, obj->length(), obj, *this);
- start = 0;
- obj = bidiNext(sor.block, obj);
- }
- if (obj) {
- unsigned pos = obj == eor.obj ? eor.pos : UINT_MAX;
- if (obj == endOfLine.obj && endOfLine.pos <= pos) {
- reachedEndOfLine = true;
- pos = endOfLine.pos;
- }
- // It's OK to add runs for zero-length RenderObjects, just don't make the run larger than it should be
- int end = obj->length() ? pos+1 : 0;
- appendRunsForObject(start, end, obj, *this);
- }
-
- eor.increment();
- sor = eor;
- }
-
- m_direction = OtherNeutral;
- m_status.eor = OtherNeutral;
-}
-
static inline InlineBox* createInlineBoxForRenderer(RenderObject* obj, bool isRootLineBox, bool isOnlyRun = false)
{
if (isRootLineBox)
@@ -1551,7 +1251,7 @@ static bool inlineFlowRequiresLineBox(RenderInline* flow)
return !flow->firstChild() && flow->hasHorizontalBordersPaddingOrMargin();
}
-static inline bool requiresLineBox(const InlineIterator& it, bool isLineEmpty, bool previousLineBrokeCleanly)
+bool RenderBlock::requiresLineBox(const InlineIterator& it, bool isLineEmpty, bool previousLineBrokeCleanly)
{
if (it.obj->isFloatingOrPositioned())
return false;
@@ -2265,19 +1965,12 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool
lBreak.nextBreakablePosition = -1;
}
} else if (lBreak.obj) {
- if (last != o && !last->isListMarker()) {
- // better to break between object boundaries than in the middle of a word (except for list markers)
- lBreak.obj = o;
- lBreak.pos = 0;
- lBreak.nextBreakablePosition = -1;
- } else {
- // Don't ever break in the middle of a word if we can help it.
- // There's no room at all. We just have to be on this line,
- // even though we'll spill out.
- lBreak.obj = o;
- lBreak.pos = pos;
- lBreak.nextBreakablePosition = -1;
- }
+ // Don't ever break in the middle of a word if we can help it.
+ // There's no room at all. We just have to be on this line,
+ // even though we'll spill out.
+ lBreak.obj = o;
+ lBreak.pos = pos;
+ lBreak.nextBreakablePosition = -1;
}
}
diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp
index 60230d4..92c3d99 100644
--- a/WebCore/rendering/RenderBox.cpp
+++ b/WebCore/rendering/RenderBox.cpp
@@ -2951,9 +2951,9 @@ void RenderBox::clearLayoutOverflow()
#if ENABLE(SVG)
-TransformationMatrix RenderBox::localTransform() const
+AffineTransform RenderBox::localTransform() const
{
- return TransformationMatrix(1, 0, 0, 1, x(), y());
+ return AffineTransform(1, 0, 0, 1, x(), y());
}
#endif
diff --git a/WebCore/rendering/RenderBox.h b/WebCore/rendering/RenderBox.h
index 11c65e8..401a46d 100644
--- a/WebCore/rendering/RenderBox.h
+++ b/WebCore/rendering/RenderBox.h
@@ -297,7 +297,7 @@ public:
virtual bool avoidsFloats() const;
#if ENABLE(SVG)
- virtual TransformationMatrix localTransform() const;
+ virtual AffineTransform localTransform() const;
#endif
protected:
diff --git a/WebCore/rendering/RenderBoxModelObject.cpp b/WebCore/rendering/RenderBoxModelObject.cpp
index a68c930..f8bf05e 100644
--- a/WebCore/rendering/RenderBoxModelObject.cpp
+++ b/WebCore/rendering/RenderBoxModelObject.cpp
@@ -50,7 +50,7 @@ static const double cLowQualityTimeThreshold = 0.500; // 500 ms
class RenderBoxModelScaleData : public Noncopyable {
public:
- RenderBoxModelScaleData(RenderBoxModelObject* object, const IntSize& size, const TransformationMatrix& transform, double time, bool lowQualityScale)
+ RenderBoxModelScaleData(RenderBoxModelObject* object, const IntSize& size, const AffineTransform& transform, double time, bool lowQualityScale)
: m_size(size)
, m_transform(transform)
, m_lastPaintTime(time)
@@ -71,8 +71,8 @@ public:
double lastPaintTime() const { return m_lastPaintTime; }
void setLastPaintTime(double t) { m_lastPaintTime = t; }
bool useLowQualityScale() const { return m_lowQualityScale; }
- const TransformationMatrix& transform() const { return m_transform; }
- void setTransform(const TransformationMatrix& transform) { m_transform = transform; }
+ const AffineTransform& transform() const { return m_transform; }
+ void setTransform(const AffineTransform& transform) { m_transform = transform; }
void setUseLowQualityScale(bool b)
{
m_highQualityRepaintTimer.stop();
@@ -83,7 +83,7 @@ public:
private:
IntSize m_size;
- TransformationMatrix m_transform;
+ AffineTransform m_transform;
double m_lastPaintTime;
bool m_lowQualityScale;
Timer<RenderBoxModelObject> m_highQualityRepaintTimer;
@@ -130,7 +130,7 @@ bool RenderBoxModelScaleObserver::shouldPaintBackgroundAtLowQuality(GraphicsCont
if (gBoxModelObjects)
data = gBoxModelObjects->get(object);
- const TransformationMatrix& currentTransform = context->getCTM();
+ const AffineTransform& currentTransform = context->getCTM();
bool contextIsScaled = !currentTransform.isIdentityOrTranslation();
if (!contextIsScaled && imageSize == size) {
// There is no scale in effect. If we had a scale in effect before, we can just delete this data.
@@ -1390,7 +1390,7 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int
// edges if they are not pixel-aligned. Those are avoided by insetting the clipping path
// by one pixel.
if (hasOpaqueBackground) {
- TransformationMatrix currentTransformation = context->getCTM();
+ AffineTransform currentTransformation = context->getCTM();
if (currentTransformation.a() != 1 || (currentTransformation.d() != 1 && currentTransformation.d() != -1)
|| currentTransformation.b() || currentTransformation.c())
rectToClipOut.inflate(-1);
diff --git a/WebCore/rendering/RenderForeignObject.cpp b/WebCore/rendering/RenderForeignObject.cpp
index 6597554..5bb4439 100644
--- a/WebCore/rendering/RenderForeignObject.cpp
+++ b/WebCore/rendering/RenderForeignObject.cpp
@@ -38,10 +38,10 @@ RenderForeignObject::RenderForeignObject(SVGForeignObjectElement* node)
{
}
-TransformationMatrix RenderForeignObject::translationForAttributes() const
+FloatPoint RenderForeignObject::translationForAttributes() const
{
SVGForeignObjectElement* foreign = static_cast<SVGForeignObjectElement*>(node());
- return TransformationMatrix().translate(foreign->x().value(foreign), foreign->y().value(foreign));
+ return FloatPoint(foreign->x().value(foreign), foreign->y().value(foreign));
}
void RenderForeignObject::paint(PaintInfo& paintInfo, int, int)
@@ -88,9 +88,10 @@ void RenderForeignObject::computeRectForRepaint(RenderBoxModelObject* repaintCon
RenderBlock::computeRectForRepaint(repaintContainer, rect, fixed);
}
-const TransformationMatrix& RenderForeignObject::localToParentTransform() const
+const AffineTransform& RenderForeignObject::localToParentTransform() const
{
- m_localToParentTransform = localTransform() * translationForAttributes();
+ FloatPoint attributeTranslation(translationForAttributes());
+ m_localToParentTransform = localTransform().translateRight(attributeTranslation.x(), attributeTranslation.y());
return m_localToParentTransform;
}
diff --git a/WebCore/rendering/RenderForeignObject.h b/WebCore/rendering/RenderForeignObject.h
index 8cb9a55..f32069c 100644
--- a/WebCore/rendering/RenderForeignObject.h
+++ b/WebCore/rendering/RenderForeignObject.h
@@ -23,7 +23,8 @@
#define RenderForeignObject_h
#if ENABLE(SVG) && ENABLE(SVG_FOREIGN_OBJECT)
-#include "TransformationMatrix.h"
+#include "AffineTransform.h"
+#include "FloatPoint.h"
#include "RenderSVGBlock.h"
namespace WebCore {
@@ -38,7 +39,7 @@ public:
virtual void paint(PaintInfo&, int parentX, int parentY);
- virtual const TransformationMatrix& localToParentTransform() const;
+ virtual const AffineTransform& localToParentTransform() const;
virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect&, bool fixed = false);
virtual bool requiresLayer() const { return false; }
@@ -55,12 +56,12 @@ public:
virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed , bool useTransforms, TransformState& transformState) const;
private:
- TransformationMatrix translationForAttributes() const;
+ FloatPoint translationForAttributes() const;
- virtual TransformationMatrix localTransform() const { return m_localTransform; }
+ virtual AffineTransform localTransform() const { return m_localTransform; }
- TransformationMatrix m_localTransform;
- mutable TransformationMatrix m_localToParentTransform;
+ AffineTransform m_localTransform;
+ mutable AffineTransform m_localToParentTransform;
};
} // namespace WebCore
diff --git a/WebCore/rendering/RenderFrame.cpp b/WebCore/rendering/RenderFrame.cpp
index 482d10d..8f704e3 100644
--- a/WebCore/rendering/RenderFrame.cpp
+++ b/WebCore/rendering/RenderFrame.cpp
@@ -26,6 +26,7 @@
#include "FrameView.h"
#include "HTMLFrameElement.h"
+#include "RenderView.h"
#ifdef FLATTEN_FRAMESET
#include "Frame.h"
@@ -64,6 +65,7 @@ void RenderFrame::viewCleared()
view->setMarginHeight(marginh);
}
+<<<<<<< HEAD
#ifdef FLATTEN_FRAMESET
void RenderFrame::layout()
{
@@ -92,5 +94,58 @@ void RenderFrame::layout()
setNeedsLayout(false);
}
#endif
+=======
+void RenderFrame::layoutWithFlattening(bool fixedWidth, bool fixedHeight)
+{
+ // NOTE: The width and height have been set at this point by
+ // RenderFrameSet::positionFramesWithFlattening()
+
+ FrameView* childFrameView = static_cast<FrameView*>(widget());
+ RenderView* childRoot = childFrameView ? static_cast<RenderView*>(childFrameView->frame()->contentRenderer()) : 0;
+ HTMLFrameElement* element = static_cast<HTMLFrameElement*>(node());
+
+ // Do not expand framesets which has zero width or height
+ if (!width() || !height() || !childRoot) {
+ updateWidgetPosition();
+ if (childFrameView)
+ childFrameView->layout();
+ setNeedsLayout(false);
+ return;
+ }
+
+ // need to update to calculate min/max correctly
+ updateWidgetPosition();
+ if (childRoot->prefWidthsDirty())
+ childRoot->calcPrefWidths();
+
+ // if scrollbars are off, and the width or height are fixed
+ // we obey them and do not expand. With frame flattening
+ // no subframe much ever become scrollable.
+
+ bool isScrollable = element->scrollingMode() != ScrollbarAlwaysOff;
+
+ // make sure minimum preferred width is enforced
+ if (isScrollable || !fixedWidth || childRoot->isFrameSet())
+ setWidth(max(width(), childRoot->minPrefWidth()));
+
+ // update again to pass the width to the child frame
+ updateWidgetPosition();
+ childFrameView->layout();
+
+ // expand the frame by setting frame height = content height
+ if (isScrollable || !fixedHeight || childRoot->isFrameSet())
+ setHeight(max(height(), childFrameView->contentsHeight()));
+ if (isScrollable || !fixedWidth || childRoot->isFrameSet())
+ setWidth(max(width(), childFrameView->contentsWidth()));
+
+ updateWidgetPosition();
+
+ ASSERT(!childFrameView->layoutPending());
+ ASSERT(!childRoot->needsLayout());
+ ASSERT(!childRoot->firstChild() || !childRoot->firstChild()->firstChild() || !childRoot->firstChild()->firstChild()->needsLayout());
+
+ setNeedsLayout(false);
+}
+>>>>>>> webkit.org at r54731
} // namespace WebCore
diff --git a/WebCore/rendering/RenderFrame.h b/WebCore/rendering/RenderFrame.h
index 5b3b533..a66aa14 100644
--- a/WebCore/rendering/RenderFrame.h
+++ b/WebCore/rendering/RenderFrame.h
@@ -35,6 +35,7 @@ public:
RenderFrame(HTMLFrameElement*);
FrameEdgeInfo edgeInfo() const;
+ void layoutWithFlattening(bool fixedWidth, bool fixedHeight);
private:
virtual const char* renderName() const { return "RenderFrame"; }
diff --git a/WebCore/rendering/RenderFrameSet.cpp b/WebCore/rendering/RenderFrameSet.cpp
index 09ad11f..cf78b2b 100644
--- a/WebCore/rendering/RenderFrameSet.cpp
+++ b/WebCore/rendering/RenderFrameSet.cpp
@@ -36,6 +36,7 @@
#include "MouseEvent.h"
#include "RenderFrame.h"
#include "RenderView.h"
+#include "Settings.h"
namespace WebCore {
@@ -496,7 +497,10 @@ void RenderFrameSet::layout()
}
#endif
- positionFrames();
+ if (flattenFrameSet())
+ positionFramesWithFlattening();
+ else
+ positionFrames();
RenderBox::layout();
@@ -635,6 +639,119 @@ void RenderFrameSet::positionFrames()
}
}
+void RenderFrameSet::positionFramesWithFlattening()
+{
+ RenderBox* child = firstChildBox();
+ if (!child)
+ return;
+
+ int rows = frameSet()->totalRows();
+ int cols = frameSet()->totalCols();
+
+ int borderThickness = frameSet()->border();
+ bool repaintNeeded = false;
+
+ // calculate frameset height based on actual content height to eliminate scrolling
+ bool out = false;
+ for (int r = 0; r < rows && !out; r++) {
+ int extra = 0;
+ int height = m_rows.m_sizes[r];
+
+ for (int c = 0; c < cols; c++) {
+ IntRect oldFrameRect = child->frameRect();
+
+ int width = m_cols.m_sizes[c];
+
+ bool fixedWidth = frameSet()->colLengths() && frameSet()->colLengths()[c].isFixed();
+ bool fixedHeight = frameSet()->rowLengths() && frameSet()->rowLengths()[r].isFixed();
+
+ // has to be resized and itself resize its contents
+ if (!fixedWidth)
+ child->setWidth(width ? width + extra / (cols - c) : 0);
+ else
+ child->setWidth(width);
+ child->setHeight(height);
+
+ child->setNeedsLayout(true);
+
+ if (child->isFrameSet())
+ toRenderFrameSet(child)->layout();
+ else
+ toRenderFrame(child)->layoutWithFlattening(fixedWidth, fixedHeight);
+
+ if (child->height() > m_rows.m_sizes[r])
+ m_rows.m_sizes[r] = child->height();
+ if (child->width() > m_cols.m_sizes[c])
+ m_cols.m_sizes[c] = child->width();
+
+ if (child->frameRect() != oldFrameRect)
+ repaintNeeded = true;
+
+ // difference between calculated frame width and the width it actually decides to have
+ extra += width - m_cols.m_sizes[c];
+
+ child = child->nextSiblingBox();
+ if (!child) {
+ out = true;
+ break;
+ }
+ }
+ }
+
+ int xPos = 0;
+ int yPos = 0;
+ out = false;
+ child = firstChildBox();
+ for (int r = 0; r < rows && !out; r++) {
+ xPos = 0;
+ for (int c = 0; c < cols; c++) {
+ // ensure the rows and columns are filled
+ IntRect oldRect = child->frameRect();
+
+ child->setLocation(xPos, yPos);
+ child->setHeight(m_rows.m_sizes[r]);
+ child->setWidth(m_cols.m_sizes[c]);
+
+ if (child->frameRect() != oldRect) {
+ repaintNeeded = true;
+
+ // update to final size
+ child->setNeedsLayout(true);
+ if (child->isFrameSet())
+ toRenderFrameSet(child)->layout();
+ else
+ toRenderFrame(child)->layoutWithFlattening(true, true);
+ }
+
+ xPos += m_cols.m_sizes[c] + borderThickness;
+ child = child->nextSiblingBox();
+ if (!child) {
+ out = true;
+ break;
+ }
+ }
+ yPos += m_rows.m_sizes[r] + borderThickness;
+ }
+
+ setWidth(xPos - borderThickness);
+ setHeight(yPos - borderThickness);
+
+ if (repaintNeeded)
+ repaint();
+
+ // all the remaining frames are hidden to avoid ugly spurious unflowed frames
+ for (; child; child = child->nextSiblingBox()) {
+ child->setWidth(0);
+ child->setHeight(0);
+ child->setNeedsLayout(false);
+ }
+}
+
+bool RenderFrameSet::flattenFrameSet() const
+{
+ return document()->frame() && document()->frame()->settings()->frameSetFlatteningEnabled();
+}
+
void RenderFrameSet::startResizing(GridAxis& axis, int position)
{
int split = hitTestSplit(axis, position);
@@ -663,6 +780,9 @@ void RenderFrameSet::continueResizing(GridAxis& axis, int position)
bool RenderFrameSet::userResize(MouseEvent* evt)
{
+ if (flattenFrameSet())
+ return false;
+
if (!m_isResizing) {
if (needsLayout())
return false;
diff --git a/WebCore/rendering/RenderFrameSet.h b/WebCore/rendering/RenderFrameSet.h
index ef92c39..0e8ef2f 100644
--- a/WebCore/rendering/RenderFrameSet.h
+++ b/WebCore/rendering/RenderFrameSet.h
@@ -70,9 +70,13 @@ public:
bool canResizeRow(const IntPoint&) const;
bool canResizeColumn(const IntPoint&) const;
+<<<<<<< HEAD
#ifdef FLATTEN_FRAMESET
void setGridNeedsLayout() { m_gridCalculated = false; }
#endif
+=======
+ bool flattenFrameSet() const;
+>>>>>>> webkit.org at r54731
private:
static const int noSplit = -1;
@@ -108,6 +112,7 @@ private:
void computeEdgeInfo();
void fillFromEdgeInfo(const FrameEdgeInfo& edgeInfo, int r, int c);
void positionFrames();
+ void positionFramesWithFlattening();
int splitPosition(const GridAxis&, int split) const;
int hitTestSplit(const GridAxis&, int position) const;
diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp
index 38e5f44..645edf9 100644
--- a/WebCore/rendering/RenderLayer.cpp
+++ b/WebCore/rendering/RenderLayer.cpp
@@ -1934,8 +1934,8 @@ RenderLayer::updateScrollInfoAfterLayout()
// Set up the range (and page step/line step).
if (m_hBar) {
int clientWidth = box->clientWidth();
- int pageStep = max(clientWidth * cFractionToStepWhenPaging, 1.f);
- m_hBar->setSteps(cScrollbarPixelsPerLineStep, pageStep);
+ int pageStep = max(max<int>(clientWidth * Scrollbar::minFractionToStepWhenPaging(), clientWidth - Scrollbar::maxOverlapBetweenPages()), 1);
+ m_hBar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep);
m_hBar->setProportion(clientWidth, m_scrollWidth);
// Explicitly set the horizontal scroll value. This ensures that when a
// right-to-left scrollable area's width (or content width) changes, the
@@ -1949,8 +1949,8 @@ RenderLayer::updateScrollInfoAfterLayout()
}
if (m_vBar) {
int clientHeight = box->clientHeight();
- int pageStep = max(clientHeight * cFractionToStepWhenPaging, 1.f);
- m_vBar->setSteps(cScrollbarPixelsPerLineStep, pageStep);
+ int pageStep = max(max<int>(clientHeight * Scrollbar::minFractionToStepWhenPaging(), clientHeight - Scrollbar::maxOverlapBetweenPages()), 1);
+ m_vBar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep);
m_vBar->setProportion(clientHeight, m_scrollHeight);
}
@@ -2241,7 +2241,7 @@ void RenderLayer::paintLayer(RenderLayer* rootLayer, GraphicsContext* p,
// Apply the transform.
p->save();
- p->concatCTM(transform);
+ p->concatCTM(transform.toAffineTransform());
// Now do a paint with the root layer shifted to be us.
paintLayer(this, p, transform.inverse().mapRect(paintDirtyRect), paintBehavior, paintingRoot, overlapTestRequests, paintFlags | PaintLayerAppliedTransform);
diff --git a/WebCore/rendering/RenderListMarker.cpp b/WebCore/rendering/RenderListMarker.cpp
index f67bc0f..d0353ee 100644
--- a/WebCore/rendering/RenderListMarker.cpp
+++ b/WebCore/rendering/RenderListMarker.cpp
@@ -41,6 +41,8 @@ namespace WebCore {
const int cMarkerPadding = 7;
+enum SequenceType { NumericSequence, AlphabeticSequence };
+
static String toRoman(int number, bool upper)
{
// FIXME: CSS3 describes how to make this work for much larger numbers,
@@ -78,31 +80,63 @@ static String toRoman(int number, bool upper)
return String(&letters[lettersSize - length], length);
}
-static String toAlphabetic(int number, const UChar* alphabet, int alphabetSize)
+static inline String toAlphabeticOrNumeric(int number, const UChar* sequence, int sequenceSize, SequenceType type)
{
- ASSERT(alphabetSize >= 10);
+ ASSERT(sequenceSize >= 2);
- if (number < 1)
- return String::number(number);
+ const int lettersSize = sizeof(number) * 8 + 1; // Binary is the worst case; requires one character per bit plus a minus sign.
- const int lettersSize = 10; // big enough for a 32-bit int, with a 10-letter alphabet
UChar letters[lettersSize];
- --number;
- letters[lettersSize - 1] = alphabet[number % alphabetSize];
+ bool isNegativeNumber = false;
+ unsigned numberShadow = number;
+ if (type == AlphabeticSequence) {
+ ASSERT(number > 0);
+ --numberShadow;
+ } else if (number < 0) {
+ numberShadow = -number;
+ isNegativeNumber = true;
+ }
+ letters[lettersSize - 1] = sequence[numberShadow % sequenceSize];
int length = 1;
- while ((number /= alphabetSize) > 0)
- letters[lettersSize - ++length] = alphabet[number % alphabetSize - 1];
+
+ if (type == AlphabeticSequence) {
+ while ((numberShadow /= sequenceSize) > 0)
+ letters[lettersSize - ++length] = sequence[numberShadow % sequenceSize - 1];
+ } else {
+ while ((numberShadow /= sequenceSize) > 0)
+ letters[lettersSize - ++length] = sequence[numberShadow % sequenceSize];
+ }
+ if (isNegativeNumber)
+ letters[lettersSize - ++length] = hyphenMinus;
ASSERT(length <= lettersSize);
return String(&letters[lettersSize - length], length);
}
+static String toAlphabetic(int number, const UChar* alphabet, int alphabetSize)
+{
+ if (number < 1)
+ return String::number(number);
+
+ return toAlphabeticOrNumeric(number, alphabet, alphabetSize, AlphabeticSequence);
+}
+
+static String toNumeric(int number, const UChar* numerals, int numeralsSize)
+{
+ return toAlphabeticOrNumeric(number, numerals, numeralsSize, NumericSequence);
+}
+
template <size_t size> static inline String toAlphabetic(int number, const UChar(&alphabet)[size])
{
return toAlphabetic(number, alphabet, size);
}
+template <size_t size> static inline String toNumeric(int number, const UChar(&alphabet)[size])
+{
+ return toNumeric(number, alphabet, size);
+}
+
static int toHebrewUnder1000(int number, UChar letters[5])
{
// FIXME: CSS3 mentions various refinements not implemented here.
@@ -383,29 +417,51 @@ static UChar listMarkerSuffix(EListStyleType type)
case TigrinyaEtAbegede:
return ethiopicPrefaceColon;
case Armenian:
+ case ArabicIndic:
+ case Bengali:
+ case BinaryListStyle:
+ case Cambodian:
case CJKIdeographic:
case CjkEarthlyBranch:
case CjkHeavenlyStem:
case DecimalLeadingZero:
case DecimalListStyle:
+ case Devanagari:
case Georgian:
+ case Gujarati:
+ case Gurmukhi:
case Hangul:
case HangulConsonant:
case Hebrew:
case Hiragana:
case HiraganaIroha:
+ case Kannada:
case Katakana:
case KatakanaIroha:
+ case Khmer:
+ case Lao:
case LowerAlpha:
case LowerGreek:
+ case LowerHexadecimal:
case LowerLatin:
case LowerNorwegian:
case LowerRoman:
+ case Malayalam:
+ case Mongolian:
+ case Myanmar:
+ case Octal:
+ case Oriya:
+ case Persian:
+ case Telugu:
+ case Thai:
+ case Tibetan:
case UpperAlpha:
case UpperGreek:
+ case UpperHexadecimal:
case UpperLatin:
case UpperNorwegian:
case UpperRoman:
+ case Urdu:
return '.';
}
@@ -439,6 +495,129 @@ String listMarkerText(EListStyleType type, int value)
return "-0" + String::number(-value); // -01 to -09
return "0" + String::number(value); // 00 to 09
+ case ArabicIndic: {
+ static const UChar arabicIndicNumerals[10] = {
+ 0x0660, 0x0661, 0x0662, 0x0663, 0x0664, 0x0665, 0x0666, 0x0667, 0x0668, 0x0669
+ };
+ return toNumeric(value, arabicIndicNumerals);
+ }
+ case BinaryListStyle: {
+ static const UChar binaryNumerals[2] = {
+ '0', '1'
+ };
+ return toNumeric(value, binaryNumerals);
+ }
+ case Bengali: {
+ static const UChar bengaliNumerals[10] = {
+ 0x09E6, 0x09E7, 0x09E8, 0x09E9, 0x09EA, 0x09EB, 0x09EC, 0x09ED, 0x09EE, 0x09EF
+ };
+ return toNumeric(value, bengaliNumerals);
+ }
+ case Cambodian:
+ case Khmer: {
+ static const UChar khmerNumerals[10] = {
+ 0x17E0, 0x17E1, 0x17E2, 0x17E3, 0x17E4, 0x17E5, 0x17E6, 0x17E7, 0x17E8, 0x17E9
+ };
+ return toNumeric(value, khmerNumerals);
+ }
+ case Devanagari: {
+ static const UChar devanagariNumerals[10] = {
+ 0x0966, 0x0967, 0x0968, 0x0969, 0x096A, 0x096B, 0x096C, 0x096D, 0x096E, 0x096F
+ };
+ return toNumeric(value, devanagariNumerals);
+ }
+ case Gujarati: {
+ static const UChar gujaratiNumerals[10] = {
+ 0x0AE6, 0x0AE7, 0x0AE8, 0x0AE9, 0x0AEA, 0x0AEB, 0x0AEC, 0x0AED, 0x0AEE, 0x0AEF
+ };
+ return toNumeric(value, gujaratiNumerals);
+ }
+ case Gurmukhi: {
+ static const UChar gurmukhiNumerals[10] = {
+ 0x0A66, 0x0A67, 0x0A68, 0x0A69, 0x0A6A, 0x0A6B, 0x0A6C, 0x0A6D, 0x0A6E, 0x0A6F
+ };
+ return toNumeric(value, gurmukhiNumerals);
+ }
+ case Kannada: {
+ static const UChar kannadaNumerals[10] = {
+ 0x0CE6, 0x0CE7, 0x0CE8, 0x0CE9, 0x0CEA, 0x0CEB, 0x0CEC, 0x0CED, 0x0CEE, 0x0CEF
+ };
+ return toNumeric(value, kannadaNumerals);
+ }
+ case LowerHexadecimal: {
+ static const UChar lowerHexadecimalNumerals[16] = {
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
+ };
+ return toNumeric(value, lowerHexadecimalNumerals);
+ }
+ case Lao: {
+ static const UChar laoNumerals[10] = {
+ 0x0ED0, 0x0ED1, 0x0ED2, 0x0ED3, 0x0ED4, 0x0ED5, 0x0ED6, 0x0ED7, 0x0ED8, 0x0ED9
+ };
+ return toNumeric(value, laoNumerals);
+ }
+ case Malayalam: {
+ static const UChar malayalamNumerals[10] = {
+ 0x0D66, 0x0D67, 0x0D68, 0x0D69, 0x0D6A, 0x0D6B, 0x0D6C, 0x0D6D, 0x0D6E, 0x0D6F
+ };
+ return toNumeric(value, malayalamNumerals);
+ }
+ case Mongolian: {
+ static const UChar mongolianNumerals[10] = {
+ 0x1810, 0x1811, 0x1812, 0x1813, 0x1814, 0x1815, 0x1816, 0x1817, 0x1818, 0x1819
+ };
+ return toNumeric(value, mongolianNumerals);
+ }
+ case Myanmar: {
+ static const UChar myanmarNumerals[10] = {
+ 0x1040, 0x1041, 0x1042, 0x1043, 0x1044, 0x1045, 0x1046, 0x1047, 0x1048, 0x1049
+ };
+ return toNumeric(value, myanmarNumerals);
+ }
+ case Octal: {
+ static const UChar octalNumerals[8] = {
+ '0', '1', '2', '3', '4', '5', '6', '7'
+ };
+ return toNumeric(value, octalNumerals);
+ }
+ case Oriya: {
+ static const UChar oriyaNumerals[10] = {
+ 0x0B66, 0x0B67, 0x0B68, 0x0B69, 0x0B6A, 0x0B6B, 0x0B6C, 0x0B6D, 0x0B6E, 0x0B6F
+ };
+ return toNumeric(value, oriyaNumerals);
+ }
+ case Persian:
+ case Urdu: {
+ static const UChar urduNumerals[10] = {
+ 0x06F0, 0x06F1, 0x06F2, 0x06F3, 0x06F4, 0x06F5, 0x06F6, 0x06F7, 0x06F8, 0x06F9
+ };
+ return toNumeric(value, urduNumerals);
+ }
+ case Telugu: {
+ static const UChar teluguNumerals[10] = {
+ 0x0C66, 0x0C67, 0x0C68, 0x0C69, 0x0C6A, 0x0C6B, 0x0C6C, 0x0C6D, 0x0C6E, 0x0C6F
+ };
+ return toNumeric(value, teluguNumerals);
+ }
+ case Tibetan: {
+ static const UChar tibetanNumerals[10] = {
+ 0x0F20, 0x0F21, 0x0F22, 0x0F23, 0x0F24, 0x0F25, 0x0F26, 0x0F27, 0x0F28, 0x0F29
+ };
+ return toNumeric(value, tibetanNumerals);
+ }
+ case Thai: {
+ static const UChar thaiNumerals[10] = {
+ 0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, 0x0E58, 0x0E59
+ };
+ return toNumeric(value, thaiNumerals);
+ }
+ case UpperHexadecimal: {
+ static const UChar upperHexadecimalNumerals[16] = {
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
+ };
+ return toNumeric(value, upperHexadecimalNumerals);
+ }
+
case LowerAlpha:
case LowerLatin: {
static const UChar lowerLatinAlphabet[26] = {
@@ -851,12 +1030,17 @@ void RenderListMarker::paint(PaintInfo& paintInfo, int tx, int ty)
case Afar:
case Amharic:
case AmharicAbegede:
+ case ArabicIndic:
case Armenian:
+ case BinaryListStyle:
+ case Bengali:
+ case Cambodian:
case CJKIdeographic:
case CjkEarthlyBranch:
case CjkHeavenlyStem:
case DecimalLeadingZero:
case DecimalListStyle:
+ case Devanagari:
case Ethiopic:
case EthiopicAbegede:
case EthiopicAbegedeAmEt:
@@ -874,21 +1058,36 @@ void RenderListMarker::paint(PaintInfo& paintInfo, int tx, int ty)
case EthiopicHalehameTiEt:
case EthiopicHalehameTig:
case Georgian:
+ case Gujarati:
+ case Gurmukhi:
case Hangul:
case HangulConsonant:
case Hebrew:
case Hiragana:
case HiraganaIroha:
+ case Kannada:
case Katakana:
case KatakanaIroha:
+ case Khmer:
+ case Lao:
case LowerAlpha:
case LowerGreek:
+ case LowerHexadecimal:
case LowerLatin:
case LowerNorwegian:
case LowerRoman:
+ case Malayalam:
+ case Mongolian:
+ case Myanmar:
+ case Octal:
+ case Oriya:
case Oromo:
+ case Persian:
case Sidama:
case Somali:
+ case Telugu:
+ case Thai:
+ case Tibetan:
case Tigre:
case TigrinyaEr:
case TigrinyaErAbegede:
@@ -896,9 +1095,11 @@ void RenderListMarker::paint(PaintInfo& paintInfo, int tx, int ty)
case TigrinyaEtAbegede:
case UpperAlpha:
case UpperGreek:
+ case UpperHexadecimal:
case UpperLatin:
case UpperNorwegian:
case UpperRoman:
+ case Urdu:
break;
}
if (m_text.isEmpty())
@@ -1004,12 +1205,17 @@ void RenderListMarker::calcPrefWidths()
case Afar:
case Amharic:
case AmharicAbegede:
+ case ArabicIndic:
case Armenian:
+ case BinaryListStyle:
+ case Bengali:
+ case Cambodian:
case CJKIdeographic:
case CjkEarthlyBranch:
case CjkHeavenlyStem:
case DecimalLeadingZero:
case DecimalListStyle:
+ case Devanagari:
case Ethiopic:
case EthiopicAbegede:
case EthiopicAbegedeAmEt:
@@ -1027,21 +1233,36 @@ void RenderListMarker::calcPrefWidths()
case EthiopicHalehameTiEt:
case EthiopicHalehameTig:
case Georgian:
+ case Gujarati:
+ case Gurmukhi:
case Hangul:
case HangulConsonant:
case Hebrew:
case Hiragana:
case HiraganaIroha:
+ case Kannada:
case Katakana:
case KatakanaIroha:
+ case Khmer:
+ case Lao:
case LowerAlpha:
case LowerGreek:
+ case LowerHexadecimal:
case LowerLatin:
case LowerNorwegian:
case LowerRoman:
+ case Malayalam:
+ case Mongolian:
+ case Myanmar:
+ case Octal:
+ case Oriya:
case Oromo:
+ case Persian:
case Sidama:
case Somali:
+ case Telugu:
+ case Thai:
+ case Tibetan:
case Tigre:
case TigrinyaEr:
case TigrinyaErAbegede:
@@ -1049,9 +1270,11 @@ void RenderListMarker::calcPrefWidths()
case TigrinyaEtAbegede:
case UpperAlpha:
case UpperGreek:
+ case UpperHexadecimal:
case UpperLatin:
case UpperNorwegian:
case UpperRoman:
+ case Urdu:
m_text = listMarkerText(type, m_listItem->value());
if (m_text.isEmpty())
width = 0;
@@ -1185,12 +1408,17 @@ IntRect RenderListMarker::getRelativeMarkerRect()
case Afar:
case Amharic:
case AmharicAbegede:
+ case ArabicIndic:
case Armenian:
+ case BinaryListStyle:
+ case Bengali:
+ case Cambodian:
case CJKIdeographic:
case CjkEarthlyBranch:
case CjkHeavenlyStem:
case DecimalLeadingZero:
case DecimalListStyle:
+ case Devanagari:
case Ethiopic:
case EthiopicAbegede:
case EthiopicAbegedeAmEt:
@@ -1208,21 +1436,36 @@ IntRect RenderListMarker::getRelativeMarkerRect()
case EthiopicHalehameTiEt:
case EthiopicHalehameTig:
case Georgian:
+ case Gujarati:
+ case Gurmukhi:
case Hangul:
case HangulConsonant:
case Hebrew:
case Hiragana:
case HiraganaIroha:
+ case Kannada:
case Katakana:
case KatakanaIroha:
+ case Khmer:
+ case Lao:
case LowerAlpha:
case LowerGreek:
+ case LowerHexadecimal:
case LowerLatin:
case LowerNorwegian:
case LowerRoman:
+ case Malayalam:
+ case Mongolian:
+ case Myanmar:
+ case Octal:
+ case Oriya:
case Oromo:
+ case Persian:
case Sidama:
case Somali:
+ case Telugu:
+ case Thai:
+ case Tibetan:
case Tigre:
case TigrinyaEr:
case TigrinyaErAbegede:
@@ -1230,9 +1473,11 @@ IntRect RenderListMarker::getRelativeMarkerRect()
case TigrinyaEtAbegede:
case UpperAlpha:
case UpperGreek:
+ case UpperHexadecimal:
case UpperLatin:
case UpperNorwegian:
case UpperRoman:
+ case Urdu:
if (m_text.isEmpty())
return IntRect();
const Font& font = style()->font();
diff --git a/WebCore/rendering/RenderObject.cpp b/WebCore/rendering/RenderObject.cpp
index 0368490..1d1e7c2 100644
--- a/WebCore/rendering/RenderObject.cpp
+++ b/WebCore/rendering/RenderObject.cpp
@@ -114,6 +114,7 @@ RenderObject* RenderObject::createObject(Node* node, RenderStyle* style)
return image;
}
+#if ENABLE(RUBY)
if (node->hasTagName(rubyTag)) {
if (style->display() == INLINE)
return new (arena) RenderRubyAsInline(node);
@@ -123,6 +124,7 @@ RenderObject* RenderObject::createObject(Node* node, RenderStyle* style)
// treat <rt> as ruby text ONLY if it still has its default treatment of block
if (node->hasTagName(rtTag) && style->display() == BLOCK)
return new (arena) RenderRubyText(node);
+#endif
switch (style->display()) {
case NONE:
@@ -1686,6 +1688,15 @@ void RenderObject::styleDidChange(StyleDifference diff, const RenderStyle* oldSt
if (diff == StyleDifferenceLayout) {
RenderCounter::rendererStyleChanged(this, oldStyle, m_style.get());
+
+ // If the object already needs layout, then setNeedsLayout won't do
+ // any work. But if the containing block has changed, then we may need
+ // to mark the new containing blocks for layout. The change that can
+ // directly affect the containing block of this object is a change to
+ // the position style.
+ if (m_needsLayout && oldStyle->position() != m_style->position())
+ markContainingBlocksForLayout();
+
setNeedsLayoutAndPrefWidthsRecalc();
} else if (diff == StyleDifferenceLayoutPositionedMovementOnly)
setNeedsPositionedMovementLayout();
@@ -2523,27 +2534,18 @@ FloatRect RenderObject::repaintRectInLocalCoordinates() const
return FloatRect();
}
-TransformationMatrix RenderObject::localTransform() const
+AffineTransform RenderObject::localTransform() const
{
- static const TransformationMatrix identity;
+ static const AffineTransform identity;
return identity;
}
-const TransformationMatrix& RenderObject::localToParentTransform() const
+const AffineTransform& RenderObject::localToParentTransform() const
{
- static const TransformationMatrix identity;
+ static const AffineTransform identity;
return identity;
}
-TransformationMatrix RenderObject::absoluteTransform() const
-{
- // FIXME: This should use localToParentTransform(), but much of the SVG code
- // depends on RenderBox::absoluteTransform() being the sum of the localTransform()s of all parent renderers.
- if (parent())
- return localTransform() * parent()->absoluteTransform();
- return localTransform();
-}
-
bool RenderObject::nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint&, HitTestAction)
{
ASSERT_NOT_REACHED();
diff --git a/WebCore/rendering/RenderObject.h b/WebCore/rendering/RenderObject.h
index 03ba1e6..6764818 100644
--- a/WebCore/rendering/RenderObject.h
+++ b/WebCore/rendering/RenderObject.h
@@ -26,6 +26,7 @@
#ifndef RenderObject_h
#define RenderObject_h
+#include "AffineTransform.h"
#include "CachedResourceClient.h"
#include "Document.h"
#include "Element.h"
@@ -282,10 +283,12 @@ public:
virtual bool isRenderPart() const { return false; }
virtual bool isRenderView() const { return false; }
virtual bool isReplica() const { return false; }
+#if ENABLE(RUBY)
virtual bool isRuby() const { return false; }
virtual bool isRubyBase() const { return false; }
virtual bool isRubyRun() const { return false; }
virtual bool isRubyText() const { return false; }
+#endif
virtual bool isSlider() const { return false; }
virtual bool isTable() const { return false; }
virtual bool isTableCell() const { return false; }
@@ -347,16 +350,11 @@ public:
// FIXME: This accessor is deprecated and mostly around for SVGRenderTreeAsText.
// This only returns the transform="" value from the element
// most callsites want localToParentTransform() instead.
- virtual TransformationMatrix localTransform() const;
+ virtual AffineTransform localTransform() const;
// Returns the full transform mapping from local coordinates to local coords for the parent SVG renderer
// This includes any viewport transforms and x/y offsets as well as the transform="" value off the element.
- virtual const TransformationMatrix& localToParentTransform() const;
-
- // Walks up the parent chain to create a transform which maps from local to document coords
- // NOTE: This method is deprecated! It doesn't respect scroll offsets or repaint containers.
- // FIXME: This is only virtual so that RenderSVGHiddenContainer can override it to match old LayoutTest results.
- virtual TransformationMatrix absoluteTransform() const;
+ virtual const AffineTransform& localToParentTransform() const;
// SVG uses FloatPoint precise hit testing, and passes the point in parent
// coordinates instead of in repaint container coordinates. Eventually the
diff --git a/WebCore/rendering/RenderPath.cpp b/WebCore/rendering/RenderPath.cpp
index f497dcf..7dbde42 100644
--- a/WebCore/rendering/RenderPath.cpp
+++ b/WebCore/rendering/RenderPath.cpp
@@ -69,12 +69,12 @@ RenderPath::RenderPath(SVGStyledTransformableElement* node)
{
}
-const TransformationMatrix& RenderPath::localToParentTransform() const
+const AffineTransform& RenderPath::localToParentTransform() const
{
return m_localTransform;
}
-TransformationMatrix RenderPath::localTransform() const
+AffineTransform RenderPath::localTransform() const
{
return m_localTransform;
}
diff --git a/WebCore/rendering/RenderPath.h b/WebCore/rendering/RenderPath.h
index be4c2dc..d530f3c 100644
--- a/WebCore/rendering/RenderPath.h
+++ b/WebCore/rendering/RenderPath.h
@@ -25,10 +25,10 @@
#define RenderPath_h
#if ENABLE(SVG)
+#include "AffineTransform.h"
#include "FloatRect.h"
#include "RenderSVGModelObject.h"
#include "SVGMarkerLayoutInfo.h"
-#include "TransformationMatrix.h"
namespace WebCore {
@@ -52,7 +52,7 @@ private:
virtual FloatRect markerBoundingBox() const;
virtual FloatRect repaintRectInLocalCoordinates() const;
- virtual const TransformationMatrix& localToParentTransform() const;
+ virtual const AffineTransform& localToParentTransform() const;
void setPath(const Path&);
@@ -68,7 +68,7 @@ private:
void calculateMarkerBoundsIfNeeded() const;
private:
- virtual TransformationMatrix localTransform() const;
+ virtual AffineTransform localTransform() const;
mutable Path m_path;
mutable FloatRect m_cachedLocalFillBBox;
@@ -76,7 +76,7 @@ private:
mutable FloatRect m_cachedLocalRepaintRect;
mutable FloatRect m_cachedLocalMarkerBBox;
mutable SVGMarkerLayoutInfo m_markerLayoutInfo;
- TransformationMatrix m_localTransform;
+ AffineTransform m_localTransform;
};
inline RenderPath* toRenderPath(RenderObject* object)
diff --git a/WebCore/rendering/RenderRuby.cpp b/WebCore/rendering/RenderRuby.cpp
index 8d113f9..f13e2b4 100644
--- a/WebCore/rendering/RenderRuby.cpp
+++ b/WebCore/rendering/RenderRuby.cpp
@@ -29,6 +29,8 @@
*/
#include "config.h"
+
+#if ENABLE(RUBY)
#include "RenderRuby.h"
#include "RenderRubyRun.h"
@@ -192,3 +194,4 @@ void RenderRubyAsBlock::removeChild(RenderObject* child)
} // namespace WebCore
+#endif
diff --git a/WebCore/rendering/RenderRuby.h b/WebCore/rendering/RenderRuby.h
index 49a84d8..a5dafe9 100644
--- a/WebCore/rendering/RenderRuby.h
+++ b/WebCore/rendering/RenderRuby.h
@@ -31,6 +31,8 @@
#ifndef RenderRuby_h
#define RenderRuby_h
+#if ENABLE(RUBY)
+
#include "RenderBlock.h"
#include "RenderInline.h"
@@ -84,4 +86,6 @@ private:
} // namespace WebCore
+#endif
+
#endif // RenderRuby_h
diff --git a/WebCore/rendering/RenderRubyBase.cpp b/WebCore/rendering/RenderRubyBase.cpp
index 41ac4e3..65f9bc0 100644
--- a/WebCore/rendering/RenderRubyBase.cpp
+++ b/WebCore/rendering/RenderRubyBase.cpp
@@ -29,6 +29,8 @@
*/
#include "config.h"
+
+#if ENABLE(RUBY)
#include "RenderRubyBase.h"
namespace WebCore {
@@ -184,3 +186,5 @@ void RenderRubyBase::mergeBlockChildren(RenderRubyBase* toBase, RenderObject* fr
}
} // namespace WebCore
+
+#endif
diff --git a/WebCore/rendering/RenderRubyBase.h b/WebCore/rendering/RenderRubyBase.h
index c029bd5..29c4858 100644
--- a/WebCore/rendering/RenderRubyBase.h
+++ b/WebCore/rendering/RenderRubyBase.h
@@ -31,6 +31,8 @@
#ifndef RenderRubyBase_h
#define RenderRubyBase_h
+#if ENABLE(RUBY)
+
#include "RenderBlock.h"
namespace WebCore {
@@ -60,4 +62,6 @@ private:
} // namespace WebCore
+#endif
+
#endif // RenderRubyBase_h
diff --git a/WebCore/rendering/RenderRubyRun.cpp b/WebCore/rendering/RenderRubyRun.cpp
index a3e6281..61be455 100644
--- a/WebCore/rendering/RenderRubyRun.cpp
+++ b/WebCore/rendering/RenderRubyRun.cpp
@@ -29,6 +29,8 @@
*/
#include "config.h"
+
+#if ENABLE(RUBY)
#include "RenderRubyRun.h"
#include "RenderRubyBase.h"
@@ -222,3 +224,5 @@ RenderRubyRun* RenderRubyRun::staticCreateRubyRun(const RenderObject* parentRuby
}
} // namespace WebCore
+
+#endif
diff --git a/WebCore/rendering/RenderRubyRun.h b/WebCore/rendering/RenderRubyRun.h
index 222ddb6..acf359b 100644
--- a/WebCore/rendering/RenderRubyRun.h
+++ b/WebCore/rendering/RenderRubyRun.h
@@ -31,6 +31,8 @@
#ifndef RenderRubyRun_h
#define RenderRubyRun_h
+#if ENABLE(RUBY)
+
#include "RenderBlock.h"
namespace WebCore {
@@ -78,4 +80,6 @@ private:
} // namespace WebCore
+#endif
+
#endif // RenderRubyRun_h
diff --git a/WebCore/rendering/RenderRubyText.cpp b/WebCore/rendering/RenderRubyText.cpp
index cfe3b5c..1cf2b9e 100644
--- a/WebCore/rendering/RenderRubyText.cpp
+++ b/WebCore/rendering/RenderRubyText.cpp
@@ -29,6 +29,8 @@
*/
#include "config.h"
+
+#if ENABLE(RUBY)
#include "RenderRubyText.h"
namespace WebCore {
@@ -48,3 +50,5 @@ bool RenderRubyText::isChildAllowed(RenderObject* child, RenderStyle*) const
}
} // namespace WebCore
+
+#endif
diff --git a/WebCore/rendering/RenderRubyText.h b/WebCore/rendering/RenderRubyText.h
index e475914..865d179 100644
--- a/WebCore/rendering/RenderRubyText.h
+++ b/WebCore/rendering/RenderRubyText.h
@@ -31,6 +31,8 @@
#ifndef RenderRubyText_h
#define RenderRubyText_h
+#if ENABLE(RUBY)
+
#include "RenderBlock.h"
namespace WebCore {
@@ -49,4 +51,6 @@ public:
} // namespace WebCore
+#endif
+
#endif // RenderRubyText_h
diff --git a/WebCore/rendering/RenderSVGHiddenContainer.h b/WebCore/rendering/RenderSVGHiddenContainer.h
index 0ef0a43..fdbd2bc 100644
--- a/WebCore/rendering/RenderSVGHiddenContainer.h
+++ b/WebCore/rendering/RenderSVGHiddenContainer.h
@@ -51,9 +51,6 @@ namespace WebCore {
virtual void absoluteRects(Vector<IntRect>& rects, int tx, int ty);
virtual void absoluteQuads(Vector<FloatQuad>&);
- // FIXME: This override only exists to match existing LayoutTest results.
- virtual TransformationMatrix absoluteTransform() const { return TransformationMatrix(); }
-
virtual FloatRect objectBoundingBox() const;
virtual FloatRect repaintRectInLocalCoordinates() const;
diff --git a/WebCore/rendering/RenderSVGImage.cpp b/WebCore/rendering/RenderSVGImage.cpp
index c8fb132..96eeaf9 100644
--- a/WebCore/rendering/RenderSVGImage.cpp
+++ b/WebCore/rendering/RenderSVGImage.cpp
@@ -177,7 +177,6 @@ IntRect RenderSVGImage::clippedOverflowRectForRepaint(RenderBoxModelObject* repa
void RenderSVGImage::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed)
{
- style()->svgStyle()->inflateForShadow(repaintRect);
SVGRenderBase::computeRectForRepaint(this, repaintContainer, repaintRect, fixed);
}
diff --git a/WebCore/rendering/RenderSVGImage.h b/WebCore/rendering/RenderSVGImage.h
index 0558aed..8ed9146 100644
--- a/WebCore/rendering/RenderSVGImage.h
+++ b/WebCore/rendering/RenderSVGImage.h
@@ -24,17 +24,17 @@
#define RenderSVGImage_h
#if ENABLE(SVG)
+#include "AffineTransform.h"
#include "FloatRect.h"
#include "RenderImage.h"
#include "SVGPreserveAspectRatio.h"
#include "SVGRenderSupport.h"
-#include "TransformationMatrix.h"
namespace WebCore {
class SVGImageElement;
- class RenderSVGImage : public RenderImage, SVGRenderBase {
+ class RenderSVGImage : public RenderImage, protected SVGRenderBase {
public:
RenderSVGImage(SVGImageElement*);
@@ -43,7 +43,7 @@ namespace WebCore {
virtual const char* renderName() const { return "RenderSVGImage"; }
virtual bool isSVGImage() const { return true; }
- virtual const TransformationMatrix& localToParentTransform() const { return m_localTransform; }
+ virtual const AffineTransform& localToParentTransform() const { return m_localTransform; }
virtual FloatRect objectBoundingBox() const;
virtual FloatRect strokeBoundingBox() const { return m_localBounds; }
@@ -68,9 +68,9 @@ namespace WebCore {
virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction);
virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
- virtual TransformationMatrix localTransform() const { return m_localTransform; }
+ virtual AffineTransform localTransform() const { return m_localTransform; }
- TransformationMatrix m_localTransform;
+ AffineTransform m_localTransform;
FloatRect m_localBounds;
mutable FloatRect m_cachedLocalRepaintRect;
};
diff --git a/WebCore/rendering/RenderSVGModelObject.cpp b/WebCore/rendering/RenderSVGModelObject.cpp
index 7a76fbd..3fab5a6 100644
--- a/WebCore/rendering/RenderSVGModelObject.cpp
+++ b/WebCore/rendering/RenderSVGModelObject.cpp
@@ -56,7 +56,6 @@ IntRect RenderSVGModelObject::clippedOverflowRectForRepaint(RenderBoxModelObject
void RenderSVGModelObject::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed)
{
- style()->svgStyle()->inflateForShadow(repaintRect);
SVGRenderBase::computeRectForRepaint(this, repaintContainer, repaintRect, fixed);
}
diff --git a/WebCore/rendering/RenderSVGRoot.cpp b/WebCore/rendering/RenderSVGRoot.cpp
index 4a3bbcc..74172fc 100644
--- a/WebCore/rendering/RenderSVGRoot.cpp
+++ b/WebCore/rendering/RenderSVGRoot.cpp
@@ -129,7 +129,7 @@ void RenderSVGRoot::paint(PaintInfo& paintInfo, int parentX, int parentY)
paintBoxDecorations(paintInfo, borderBoxOriginInContainer.x(), borderBoxOriginInContainer.y());
// An empty viewport disables rendering. FIXME: Should we still render filters?
- if (viewportSize().isEmpty())
+ if (m_viewportSize.isEmpty())
return;
// Don't paint if we don't have kids, except if we have filters we should paint those.
@@ -140,9 +140,8 @@ void RenderSVGRoot::paint(PaintInfo& paintInfo, int parentX, int parentY)
RenderObject::PaintInfo childPaintInfo(paintInfo);
childPaintInfo.context->save();
- // SVG does not support independent x/y clipping
- if (style()->overflowX() != OVISIBLE)
- childPaintInfo.context->clip(overflowClipRect(borderBoxOriginInContainer.x(), borderBoxOriginInContainer.y()));
+ // Apply initial viewport clip - not affected by overflow handling
+ childPaintInfo.context->clip(overflowClipRect(borderBoxOriginInContainer.x(), borderBoxOriginInContainer.y()));
// Convert from container offsets (html renderers) to a relative transform (svg renderers).
// Transform from our paint container's coordinate system to our local coords.
@@ -167,11 +166,6 @@ void RenderSVGRoot::paint(PaintInfo& paintInfo, int parentX, int parentY)
paintOutline(paintInfo.context, borderBoxOriginInContainer.x(), borderBoxOriginInContainer.y(), width(), height(), style());
}
-const FloatSize& RenderSVGRoot::viewportSize() const
-{
- return m_viewportSize;
-}
-
void RenderSVGRoot::calcViewport()
{
SVGSVGElement* svg = static_cast<SVGSVGElement*>(node());
@@ -196,13 +190,12 @@ void RenderSVGRoot::calcViewport()
// RenderBox methods will expect coordinates w/o any transforms in coordinates
// relative to our borderBox origin. This method gives us exactly that.
-TransformationMatrix RenderSVGRoot::localToBorderBoxTransform() const
+AffineTransform RenderSVGRoot::localToBorderBoxTransform() const
{
- TransformationMatrix ctm;
IntSize borderAndPadding = borderOriginToContentBox();
- ctm.translate(borderAndPadding.width(), borderAndPadding.height());
SVGSVGElement* svg = static_cast<SVGSVGElement*>(node());
- ctm.scale(svg->currentScale());
+ float scale = svg->currentScale();
+ AffineTransform ctm(scale, 0, 0, scale, borderAndPadding.width(), borderAndPadding.height());
ctm.translate(svg->currentTranslate().x(), svg->currentTranslate().y());
return svg->viewBoxToViewTransform(width(), height()) * ctm;
}
@@ -217,31 +210,23 @@ IntSize RenderSVGRoot::borderOriginToContentBox() const
return IntSize(borderLeft() + paddingLeft(), borderTop() + paddingTop());
}
-TransformationMatrix RenderSVGRoot::localToRepaintContainerTransform(const IntPoint& parentOriginInContainer) const
+AffineTransform RenderSVGRoot::localToRepaintContainerTransform(const IntPoint& parentOriginInContainer) const
{
- TransformationMatrix parentToContainer;
- parentToContainer.translate(parentOriginInContainer.x(), parentOriginInContainer.y());
- return localToParentTransform() * parentToContainer;
+ AffineTransform parentToContainer(localToParentTransform());
+ return parentToContainer.translateRight(parentOriginInContainer.x(), parentOriginInContainer.y());
}
-const TransformationMatrix& RenderSVGRoot::localToParentTransform() const
+const AffineTransform& RenderSVGRoot::localToParentTransform() const
{
IntSize parentToBorderBoxOffset = parentOriginToBorderBox();
- TransformationMatrix borderBoxOriginToParentOrigin;
- borderBoxOriginToParentOrigin.translate(parentToBorderBoxOffset.width(), parentToBorderBoxOffset.height());
+ AffineTransform borderBoxOriginToParentOrigin(localToBorderBoxTransform());
+ borderBoxOriginToParentOrigin.translateRight(parentToBorderBoxOffset.width(), parentToBorderBoxOffset.height());
- m_localToParentTransform = localToBorderBoxTransform() * borderBoxOriginToParentOrigin;
+ m_localToParentTransform = borderBoxOriginToParentOrigin;
return m_localToParentTransform;
}
-// FIXME: This method should be removed as soon as callers to RenderBox::absoluteTransform() can be removed.
-TransformationMatrix RenderSVGRoot::absoluteTransform() const
-{
- // This would apply localTransform() twice if localTransform() were not the identity.
- return localToParentTransform() * RenderBox::absoluteTransform();
-}
-
FloatRect RenderSVGRoot::objectBoundingBox() const
{
return computeContainerBoundingBox(this, false);
@@ -255,9 +240,9 @@ FloatRect RenderSVGRoot::repaintRectInLocalCoordinates() const
return repaintRect;
}
-TransformationMatrix RenderSVGRoot::localTransform() const
+AffineTransform RenderSVGRoot::localTransform() const
{
- return TransformationMatrix();
+ return AffineTransform();
}
void RenderSVGRoot::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed)
@@ -265,6 +250,10 @@ void RenderSVGRoot::computeRectForRepaint(RenderBoxModelObject* repaintContainer
// Apply our local transforms (except for x/y translation), then our shadow,
// and then call RenderBox's method to handle all the normal CSS Box model bits
repaintRect = localToBorderBoxTransform().mapRect(repaintRect);
+
+ // Apply initial viewport clip - not affected by overflow settings
+ repaintRect.intersect(enclosingIntRect(FloatRect(FloatPoint(), m_viewportSize)));
+
style()->svgStyle()->inflateForShadow(repaintRect);
RenderBox::computeRectForRepaint(repaintContainer, repaintRect, fixed);
}
@@ -288,14 +277,9 @@ bool RenderSVGRoot::nodeAtPoint(const HitTestRequest& request, HitTestResult& re
IntPoint pointInBorderBox = pointInParent - parentOriginToBorderBox();
// Note: For now, we're ignoring hits to border and padding for <svg>
-
- if (style()->overflowX() == OHIDDEN) {
- // SVG doesn't support independent x/y overflow
- ASSERT(style()->overflowY() == OHIDDEN);
- IntPoint pointInContentBox = pointInBorderBox - borderOriginToContentBox();
- if (!contentBoxRect().contains(pointInContentBox))
- return false;
- }
+ IntPoint pointInContentBox = pointInBorderBox - borderOriginToContentBox();
+ if (!contentBoxRect().contains(pointInContentBox))
+ return false;
IntPoint localPoint = localToParentTransform().inverse().mapPoint(pointInParent);
diff --git a/WebCore/rendering/RenderSVGRoot.h b/WebCore/rendering/RenderSVGRoot.h
index b2f8f7c..8ad5e40 100644
--- a/WebCore/rendering/RenderSVGRoot.h
+++ b/WebCore/rendering/RenderSVGRoot.h
@@ -31,9 +31,9 @@
namespace WebCore {
class SVGStyledElement;
-class TransformationMatrix;
+class AffineTransform;
-class RenderSVGRoot : public RenderBox, SVGRenderBase {
+class RenderSVGRoot : public RenderBox, protected SVGRenderBase {
public:
RenderSVGRoot(SVGStyledElement*);
@@ -54,7 +54,7 @@ private:
virtual void layout();
virtual void paint(PaintInfo&, int parentX, int parentY);
- virtual const TransformationMatrix& localToParentTransform() const;
+ virtual const AffineTransform& localToParentTransform() const;
bool fillContains(const FloatPoint&) const;
bool strokeContains(const FloatPoint&) const;
@@ -63,9 +63,8 @@ private:
virtual FloatRect strokeBoundingBox() const { return computeContainerBoundingBox(this, true); }
virtual FloatRect repaintRectInLocalCoordinates() const;
- // FIXME: Both of these overrides should be removed.
- virtual TransformationMatrix localTransform() const;
- virtual TransformationMatrix absoluteTransform() const;
+ // FIXME: This override should be removed.
+ virtual AffineTransform localTransform() const;
virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
@@ -74,18 +73,17 @@ private:
virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&) const;
void calcViewport();
- const FloatSize& viewportSize() const;
bool selfWillPaint() const;
IntSize parentOriginToBorderBox() const;
IntSize borderOriginToContentBox() const;
- TransformationMatrix localToRepaintContainerTransform(const IntPoint& parentOriginInContainer) const;
- TransformationMatrix localToBorderBoxTransform() const;
+ AffineTransform localToRepaintContainerTransform(const IntPoint& parentOriginInContainer) const;
+ AffineTransform localToBorderBoxTransform() const;
RenderObjectChildList m_children;
FloatSize m_viewportSize;
- mutable TransformationMatrix m_localToParentTransform;
+ mutable AffineTransform m_localToParentTransform;
};
inline RenderSVGRoot* toRenderSVGRoot(RenderObject* object)
diff --git a/WebCore/rendering/RenderSVGText.cpp b/WebCore/rendering/RenderSVGText.cpp
index 0cf0332..e332c85 100644
--- a/WebCore/rendering/RenderSVGText.cpp
+++ b/WebCore/rendering/RenderSVGText.cpp
@@ -59,7 +59,6 @@ IntRect RenderSVGText::clippedOverflowRectForRepaint(RenderBoxModelObject* repai
void RenderSVGText::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed)
{
- style()->svgStyle()->inflateForShadow(repaintRect);
SVGRenderBase::computeRectForRepaint(this, repaintContainer, repaintRect, fixed);
}
@@ -71,10 +70,6 @@ void RenderSVGText::mapLocalToContainer(RenderBoxModelObject* repaintContainer,
void RenderSVGText::layout()
{
ASSERT(needsLayout());
-
- // FIXME: This is a hack to avoid the RenderBlock::layout() partial repainting code which is not (yet) SVG aware
- setNeedsLayout(true);
-
LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
// Best guess for a relative starting point
@@ -192,7 +187,7 @@ FloatRect RenderSVGText::strokeBoundingBox() const
// SVG needs to include the strokeWidth(), not the textStrokeWidth().
if (style()->svgStyle()->hasStroke()) {
- float strokeWidth = SVGRenderStyle::cssPrimitiveToLength(this, style()->svgStyle()->strokeWidth(), 0.0f);
+ float strokeWidth = SVGRenderStyle::cssPrimitiveToLength(this, style()->svgStyle()->strokeWidth(), 1.0f);
#if ENABLE(SVG_FONTS)
const Font& font = style()->font();
diff --git a/WebCore/rendering/RenderSVGText.h b/WebCore/rendering/RenderSVGText.h
index d001d1c..9ae96a0 100644
--- a/WebCore/rendering/RenderSVGText.h
+++ b/WebCore/rendering/RenderSVGText.h
@@ -26,7 +26,7 @@
#if ENABLE(SVG)
-#include "TransformationMatrix.h"
+#include "AffineTransform.h"
#include "RenderSVGBlock.h"
namespace WebCore {
@@ -44,7 +44,7 @@ private:
virtual bool isSVGText() const { return true; }
- virtual const TransformationMatrix& localToParentTransform() const { return m_localTransform; }
+ virtual const AffineTransform& localToParentTransform() const { return m_localTransform; }
virtual void paint(PaintInfo&, int tx, int ty);
virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
@@ -66,11 +66,11 @@ private:
virtual FloatRect repaintRectInLocalCoordinates() const;
// FIXME: This can be removed when localTransform() is removed from RenderObject
- virtual TransformationMatrix localTransform() const { return m_localTransform; }
+ virtual AffineTransform localTransform() const { return m_localTransform; }
virtual RootInlineBox* createRootInlineBox();
- TransformationMatrix m_localTransform;
+ AffineTransform m_localTransform;
};
}
diff --git a/WebCore/rendering/RenderSVGTransformableContainer.cpp b/WebCore/rendering/RenderSVGTransformableContainer.cpp
index 050e1bd..4bec7a7 100644
--- a/WebCore/rendering/RenderSVGTransformableContainer.cpp
+++ b/WebCore/rendering/RenderSVGTransformableContainer.cpp
@@ -34,12 +34,12 @@ RenderSVGTransformableContainer::RenderSVGTransformableContainer(SVGStyledTransf
{
}
-const TransformationMatrix& RenderSVGTransformableContainer::localToParentTransform() const
+const AffineTransform& RenderSVGTransformableContainer::localToParentTransform() const
{
return m_localTransform;
}
-TransformationMatrix RenderSVGTransformableContainer::localTransform() const
+AffineTransform RenderSVGTransformableContainer::localTransform() const
{
return m_localTransform;
}
@@ -54,7 +54,7 @@ void RenderSVGTransformableContainer::calculateLocalTransform()
if (translation.width() == 0 && translation.height() == 0)
return;
- m_localTransform.translateRight(translation.width(), translation.height());
+ m_localTransform.translate(translation.width(), translation.height());
}
}
diff --git a/WebCore/rendering/RenderSVGTransformableContainer.h b/WebCore/rendering/RenderSVGTransformableContainer.h
index 43e4001..1de0b19 100644
--- a/WebCore/rendering/RenderSVGTransformableContainer.h
+++ b/WebCore/rendering/RenderSVGTransformableContainer.h
@@ -31,14 +31,14 @@ namespace WebCore {
public:
RenderSVGTransformableContainer(SVGStyledTransformableElement*);
- virtual const TransformationMatrix& localToParentTransform() const;
+ virtual const AffineTransform& localToParentTransform() const;
private:
virtual void calculateLocalTransform();
// FIXME: This can be made non-virtual once SVGRenderTreeAsText stops using localTransform()
- virtual TransformationMatrix localTransform() const;
+ virtual AffineTransform localTransform() const;
- TransformationMatrix m_localTransform;
+ AffineTransform m_localTransform;
};
}
diff --git a/WebCore/rendering/RenderSVGViewportContainer.cpp b/WebCore/rendering/RenderSVGViewportContainer.cpp
index b46e8c2..103d9d2 100644
--- a/WebCore/rendering/RenderSVGViewportContainer.cpp
+++ b/WebCore/rendering/RenderSVGViewportContainer.cpp
@@ -38,7 +38,7 @@ RenderSVGViewportContainer::RenderSVGViewportContainer(SVGStyledElement* node)
{
}
-FloatRect RenderSVGViewportContainer::markerBoundaries(const TransformationMatrix& markerTransformation) const
+FloatRect RenderSVGViewportContainer::markerBoundaries(const AffineTransform& markerTransformation) const
{
FloatRect coordinates = repaintRectInLocalCoordinates();
@@ -48,12 +48,12 @@ FloatRect RenderSVGViewportContainer::markerBoundaries(const TransformationMatri
return markerTransformation.mapRect(coordinates);
}
-TransformationMatrix RenderSVGViewportContainer::markerContentTransformation(const TransformationMatrix& contentTransformation, const FloatPoint& origin, float strokeWidth) const
+AffineTransform RenderSVGViewportContainer::markerContentTransformation(const AffineTransform& contentTransformation, const FloatPoint& origin, float strokeWidth) const
{
// The 'origin' coordinate maps to SVGs refX/refY, given in coordinates relative to the viewport established by the marker
FloatPoint mappedOrigin = viewportTransform().mapPoint(origin);
- TransformationMatrix transformation = contentTransformation;
+ AffineTransform transformation = contentTransformation;
if (strokeWidth != -1)
transformation.scaleNonUniform(strokeWidth, strokeWidth);
@@ -63,8 +63,8 @@ TransformationMatrix RenderSVGViewportContainer::markerContentTransformation(con
void RenderSVGViewportContainer::applyViewportClip(PaintInfo& paintInfo)
{
- if (style()->overflowX() != OVISIBLE)
- paintInfo.context->clip(enclosingIntRect(m_viewport)); // FIXME: Eventually we'll want float-precision clipping
+ if (SVGRenderBase::isOverflowHidden(this))
+ paintInfo.context->clip(m_viewport);
}
void RenderSVGViewportContainer::calcViewport()
@@ -92,7 +92,7 @@ void RenderSVGViewportContainer::calcViewport()
}
}
-TransformationMatrix RenderSVGViewportContainer::viewportTransform() const
+AffineTransform RenderSVGViewportContainer::viewportTransform() const
{
if (node()->hasTagName(SVGNames::svgTag)) {
SVGSVGElement* svg = static_cast<SVGSVGElement*>(node());
@@ -102,35 +102,25 @@ TransformationMatrix RenderSVGViewportContainer::viewportTransform() const
return marker->viewBoxToViewTransform(m_viewport.width(), m_viewport.height());
}
- return TransformationMatrix();
+ return AffineTransform();
}
-const TransformationMatrix& RenderSVGViewportContainer::localToParentTransform() const
+const AffineTransform& RenderSVGViewportContainer::localToParentTransform() const
{
- TransformationMatrix viewportTranslation;
- viewportTranslation.translate(m_viewport.x(), m_viewport.y());
- m_localToParentTransform = viewportTransform() * viewportTranslation;
+ AffineTransform viewportTranslation(viewportTransform());
+ m_localToParentTransform = viewportTranslation.translateRight(m_viewport.x(), m_viewport.y());
return m_localToParentTransform;
// If this class were ever given a localTransform(), then the above would read:
// return viewportTransform() * localTransform() * viewportTranslation;
}
-// FIXME: This method should be removed as soon as callers to RenderBox::absoluteTransform() can be removed.
-TransformationMatrix RenderSVGViewportContainer::absoluteTransform() const
-{
- // This would apply localTransform() twice if localTransform() were not the identity.
- return localToParentTransform() * RenderSVGContainer::absoluteTransform();
-}
-
bool RenderSVGViewportContainer::pointIsInsideViewportClip(const FloatPoint& pointInParent)
{
- // Respect the viewport clip (which is in parent coords). SVG does not support separate x/y overflow rules.
- if (style()->overflowX() == OHIDDEN) {
- ASSERT(style()->overflowY() == OHIDDEN);
- if (!m_viewport.contains(pointInParent))
- return false;
- }
- return true;
+ // Respect the viewport clip (which is in parent coords)
+ if (!SVGRenderBase::isOverflowHidden(this))
+ return true;
+
+ return m_viewport.contains(pointInParent);
}
}
diff --git a/WebCore/rendering/RenderSVGViewportContainer.h b/WebCore/rendering/RenderSVGViewportContainer.h
index ee08b60..c4043ec 100644
--- a/WebCore/rendering/RenderSVGViewportContainer.h
+++ b/WebCore/rendering/RenderSVGViewportContainer.h
@@ -35,21 +35,18 @@ public:
RenderSVGViewportContainer(SVGStyledElement*);
// Calculates marker boundaries, mapped to the target element's coordinate space
- FloatRect markerBoundaries(const TransformationMatrix& markerTransformation) const;
+ FloatRect markerBoundaries(const AffineTransform& markerTransformation) const;
// Generates a transformation matrix usable to render marker content. Handles scaling the marker content
// acording to SVGs markerUnits="strokeWidth" concept, when a strokeWidth value != -1 is passed in.
- TransformationMatrix markerContentTransformation(const TransformationMatrix& contentTransformation, const FloatPoint& origin, float strokeWidth = -1) const;
+ AffineTransform markerContentTransformation(const AffineTransform& contentTransformation, const FloatPoint& origin, float strokeWidth = -1) const;
private:
virtual bool isSVGContainer() const { return true; }
virtual const char* renderName() const { return "RenderSVGViewportContainer"; }
- TransformationMatrix viewportTransform() const;
- virtual const TransformationMatrix& localToParentTransform() const;
-
- // FIXME: This override should be removed once callers of RenderBox::absoluteTransform() can be removed.
- virtual TransformationMatrix absoluteTransform() const;
+ AffineTransform viewportTransform() const;
+ virtual const AffineTransform& localToParentTransform() const;
virtual void calcViewport();
@@ -57,7 +54,7 @@ private:
virtual bool pointIsInsideViewportClip(const FloatPoint& pointInParent);
FloatRect m_viewport;
- mutable TransformationMatrix m_localToParentTransform;
+ mutable AffineTransform m_localToParentTransform;
};
inline RenderSVGViewportContainer* toRenderSVGViewportContainer(RenderObject* object)
diff --git a/WebCore/rendering/RenderTableCell.cpp b/WebCore/rendering/RenderTableCell.cpp
index 39a821f..d97ae6e 100644
--- a/WebCore/rendering/RenderTableCell.cpp
+++ b/WebCore/rendering/RenderTableCell.cpp
@@ -643,6 +643,9 @@ int RenderTableCell::borderHalfBottom(bool outer) const
void RenderTableCell::paint(PaintInfo& paintInfo, int tx, int ty)
{
if (paintInfo.phase == PaintPhaseCollapsedTableBorders && style()->visibility() == VISIBLE) {
+ if (!shouldPaintWithinRoot(paintInfo))
+ return;
+
tx += x();
ty += y();
int os = 2 * maximalOutlineSize(paintInfo.phase);
diff --git a/WebCore/rendering/RenderThemeChromiumWin.cpp b/WebCore/rendering/RenderThemeChromiumWin.cpp
index 4b38d53..db31825 100644
--- a/WebCore/rendering/RenderThemeChromiumWin.cpp
+++ b/WebCore/rendering/RenderThemeChromiumWin.cpp
@@ -86,7 +86,7 @@ private:
return transformMode == KeepTransform ? NoLayer : OpaqueCompositeLayer;
}
- static TransformMode getTransformMode(const TransformationMatrix& matrix)
+ static TransformMode getTransformMode(const AffineTransform& matrix)
{
if (matrix.b() != 0 || matrix.c() != 0) // Skew.
return Untransform;
diff --git a/WebCore/rendering/SVGCharacterLayoutInfo.cpp b/WebCore/rendering/SVGCharacterLayoutInfo.cpp
index 900e0ba..7e85672 100644
--- a/WebCore/rendering/SVGCharacterLayoutInfo.cpp
+++ b/WebCore/rendering/SVGCharacterLayoutInfo.cpp
@@ -512,9 +512,9 @@ bool SVGChar::isHidden() const
return pathData && pathData->hidden;
}
-TransformationMatrix SVGChar::characterTransform() const
+AffineTransform SVGChar::characterTransform() const
{
- TransformationMatrix ctm;
+ AffineTransform ctm;
// Rotate character around angle, and possibly scale.
ctm.translate(x, y);
diff --git a/WebCore/rendering/SVGCharacterLayoutInfo.h b/WebCore/rendering/SVGCharacterLayoutInfo.h
index fb29110..f80c79c 100644
--- a/WebCore/rendering/SVGCharacterLayoutInfo.h
+++ b/WebCore/rendering/SVGCharacterLayoutInfo.h
@@ -24,15 +24,15 @@
#define SVGCharacterLayoutInfo_h
#if ENABLE(SVG)
+#include "AffineTransform.h"
+#include "SVGRenderStyle.h"
+#include "SVGTextContentElement.h"
+
#include <wtf/Assertions.h>
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
-#include <wtf/Vector.h>
-
-#include "TransformationMatrix.h"
#include <wtf/RefCounted.h>
-#include "SVGRenderStyle.h"
-#include "SVGTextContentElement.h"
+#include <wtf/Vector.h>
namespace WebCore {
@@ -234,7 +234,7 @@ struct SVGChar {
// Helper methods
bool isHidden() const;
- TransformationMatrix characterTransform() const;
+ AffineTransform characterTransform() const;
};
struct SVGInlineBoxCharacterRange {
@@ -275,7 +275,7 @@ struct SVGTextChunk {
// textLength & lengthAdjust support
float textLength;
ELengthAdjust lengthAdjust;
- TransformationMatrix ctm;
+ AffineTransform ctm;
// status flags
bool isVerticalText : 1;
@@ -291,7 +291,7 @@ struct SVGTextChunk {
struct SVGTextChunkWalkerBase {
virtual ~SVGTextChunkWalkerBase() { }
- virtual void operator()(SVGInlineTextBox* textBox, int startOffset, const TransformationMatrix& chunkCtm,
+ virtual void operator()(SVGInlineTextBox* textBox, int startOffset, const AffineTransform& chunkCtm,
const Vector<SVGChar>::iterator& start, const Vector<SVGChar>::iterator& end) = 0;
// Followings methods are only used for painting text chunks
@@ -300,7 +300,9 @@ struct SVGTextChunkWalkerBase {
virtual bool setupBackground(InlineBox*) = 0;
virtual bool setupFill(InlineBox*) = 0;
+ virtual bool setupFillSelection(InlineBox*) = 0;
virtual bool setupStroke(InlineBox*) = 0;
+ virtual bool setupStrokeSelection(InlineBox*) = 0;
virtual bool setupForeground(InlineBox*) = 0;
};
@@ -309,7 +311,7 @@ struct SVGTextChunkWalker : public SVGTextChunkWalkerBase {
public:
typedef void (CallbackClass::*SVGTextChunkWalkerCallback)(SVGInlineTextBox* textBox,
int startOffset,
- const TransformationMatrix& chunkCtm,
+ const AffineTransform& chunkCtm,
const Vector<SVGChar>::iterator& start,
const Vector<SVGChar>::iterator& end);
@@ -328,7 +330,9 @@ public:
SVGTextChunkEndCallback end = 0,
SVGTextChunkSetupBackgroundCallback background = 0,
SVGTextChunkSetupFillCallback fill = 0,
+ SVGTextChunkSetupFillCallback fillSelection = 0,
SVGTextChunkSetupStrokeCallback stroke = 0,
+ SVGTextChunkSetupStrokeCallback strokeSelection = 0,
SVGTextChunkSetupForegroundCallback foreground = 0)
: m_object(object)
, m_walkerCallback(walker)
@@ -336,14 +340,16 @@ public:
, m_endCallback(end)
, m_setupBackgroundCallback(background)
, m_setupFillCallback(fill)
+ , m_setupFillSelectionCallback(fillSelection)
, m_setupStrokeCallback(stroke)
+ , m_setupStrokeSelectionCallback(strokeSelection)
, m_setupForegroundCallback(foreground)
{
ASSERT(object);
ASSERT(walker);
}
- virtual void operator()(SVGInlineTextBox* textBox, int startOffset, const TransformationMatrix& chunkCtm,
+ virtual void operator()(SVGInlineTextBox* textBox, int startOffset, const AffineTransform& chunkCtm,
const Vector<SVGChar>::iterator& start, const Vector<SVGChar>::iterator& end)
{
(*m_object.*m_walkerCallback)(textBox, startOffset, chunkCtm, start, end);
@@ -384,6 +390,15 @@ public:
return false;
}
+ virtual bool setupFillSelection(InlineBox* box)
+ {
+ if (m_setupFillSelectionCallback)
+ return (*m_object.*m_setupFillSelectionCallback)(box);
+
+ ASSERT_NOT_REACHED();
+ return false;
+ }
+
virtual bool setupStroke(InlineBox* box)
{
if (m_setupStrokeCallback)
@@ -393,6 +408,15 @@ public:
return false;
}
+ virtual bool setupStrokeSelection(InlineBox* box)
+ {
+ if (m_setupStrokeSelectionCallback)
+ return (*m_object.*m_setupStrokeSelectionCallback)(box);
+
+ ASSERT_NOT_REACHED();
+ return false;
+ }
+
virtual bool setupForeground(InlineBox* box)
{
if (m_setupForegroundCallback)
@@ -409,7 +433,9 @@ private:
SVGTextChunkEndCallback m_endCallback;
SVGTextChunkSetupBackgroundCallback m_setupBackgroundCallback;
SVGTextChunkSetupFillCallback m_setupFillCallback;
+ SVGTextChunkSetupFillCallback m_setupFillSelectionCallback;
SVGTextChunkSetupStrokeCallback m_setupStrokeCallback;
+ SVGTextChunkSetupStrokeCallback m_setupStrokeSelectionCallback;
SVGTextChunkSetupForegroundCallback m_setupForegroundCallback;
};
diff --git a/WebCore/rendering/SVGInlineTextBox.cpp b/WebCore/rendering/SVGInlineTextBox.cpp
index 2f56e68..65aa5a1 100644
--- a/WebCore/rendering/SVGInlineTextBox.cpp
+++ b/WebCore/rendering/SVGInlineTextBox.cpp
@@ -108,9 +108,7 @@ FloatRect SVGInlineTextBox::calculateGlyphBoundaries(RenderStyle* style, int off
FloatRect glyphRect(x1, y1, x2 - x1, y2 - y1);
// Take per-character transformations into account
- TransformationMatrix ctm = svgChar.characterTransform();
- if (!ctm.isIdentity())
- glyphRect = ctm.mapRect(glyphRect);
+ glyphRect = svgChar.characterTransform().mapRect(glyphRect);
return glyphRect;
}
@@ -126,7 +124,7 @@ struct SVGInlineTextBoxClosestCharacterToPositionWalker {
{
}
- void chunkPortionCallback(SVGInlineTextBox* textBox, int startOffset, const TransformationMatrix& chunkCtm,
+ void chunkPortionCallback(SVGInlineTextBox* textBox, int startOffset, const AffineTransform& chunkCtm,
const Vector<SVGChar>::iterator& start, const Vector<SVGChar>::iterator& end)
{
RenderStyle* style = textBox->textRenderer()->style();
@@ -193,7 +191,7 @@ struct SVGInlineTextBoxSelectionRectWalker {
{
}
- void chunkPortionCallback(SVGInlineTextBox* textBox, int startOffset, const TransformationMatrix& chunkCtm,
+ void chunkPortionCallback(SVGInlineTextBox* textBox, int startOffset, const AffineTransform& chunkCtm,
const Vector<SVGChar>::iterator& start, const Vector<SVGChar>::iterator& end)
{
RenderStyle* style = textBox->textRenderer()->style();
@@ -324,6 +322,32 @@ IntRect SVGInlineTextBox::selectionRect(int, int, int startPos, int endPos)
return enclosingIntRect(walkerCallback.selectionRect());
}
+bool SVGInlineTextBox::chunkSelectionStartEnd(const UChar* chunk, int chunkLength, int& selectionStart, int& selectionEnd)
+{
+ // NOTE: We ignore SVGInlineTextBox::m_start here because it is always 0.
+ // Curently SVG doesn't use HTML block-level layout, in which m_start would be set.
+
+ int chunkStart = chunk - textRenderer()->characters();
+ ASSERT(0 <= chunkStart);
+
+ selectionStartEnd(selectionStart, selectionEnd);
+ if (selectionEnd <= chunkStart)
+ return false;
+ if (chunkStart + chunkLength <= selectionStart)
+ return false;
+
+ // Map indices from view-global to chunk-local.
+ selectionStart -= chunkStart;
+ selectionEnd -= chunkStart;
+ // Then clamp with chunk range
+ if (selectionStart < 0)
+ selectionStart = 0;
+ if (chunkLength < selectionEnd)
+ selectionEnd = chunkLength;
+
+ return selectionStart < selectionEnd;
+}
+
void SVGInlineTextBox::paintCharacters(RenderObject::PaintInfo& paintInfo, int tx, int ty, const SVGChar& svgChar, const UChar* chars, int length, SVGTextPaintInfo& textPaintInfo)
{
if (renderer()->style()->visibility() != VISIBLE || paintInfo.phase == PaintPhaseOutline)
@@ -350,7 +374,7 @@ void SVGInlineTextBox::paintCharacters(RenderObject::PaintInfo& paintInfo, int t
RenderStyle* styleToUse = text->style(isFirstLineStyle());
const Font& font = styleToUse->font();
- TransformationMatrix ctm = svgChar.characterTransform();
+ AffineTransform ctm = svgChar.characterTransform();
if (!ctm.isIdentity())
paintInfo.context->concatCTM(ctm);
@@ -376,7 +400,10 @@ void SVGInlineTextBox::paintCharacters(RenderObject::PaintInfo& paintInfo, int t
}
}
- if (textPaintInfo.subphase == SVGTextPaintSubphaseGlyphFill || textPaintInfo.subphase == SVGTextPaintSubphaseGlyphStroke) {
+ bool isGlyphPhase = textPaintInfo.subphase == SVGTextPaintSubphaseGlyphFill || textPaintInfo.subphase == SVGTextPaintSubphaseGlyphStroke;
+ bool isSelectionGlyphPhase = textPaintInfo.subphase == SVGTextPaintSubphaseGlyphFillSelection || textPaintInfo.subphase == SVGTextPaintSubphaseGlyphStrokeSelection;
+
+ if (isGlyphPhase || isSelectionGlyphPhase) {
// Set a text shadow if we have one.
// FIXME: Support multiple shadow effects. Need more from the CG API before
// we can do this.
@@ -398,7 +425,21 @@ void SVGInlineTextBox::paintCharacters(RenderObject::PaintInfo& paintInfo, int t
run.setActivePaintServer(textPaintInfo.activePaintServer);
#endif
- paintInfo.context->drawText(font, run, origin);
+ int selectionStart = 0;
+ int selectionEnd = 0;
+ bool haveSelectedRange = haveSelection && chunkSelectionStartEnd(chars, length, selectionStart, selectionEnd);
+
+ if (isGlyphPhase) {
+ if (haveSelectedRange) {
+ paintInfo.context->drawText(font, run, origin, 0, selectionStart);
+ paintInfo.context->drawText(font, run, origin, selectionEnd, run.length());
+ } else
+ paintInfo.context->drawText(font, run, origin);
+ } else {
+ ASSERT(isSelectionGlyphPhase);
+ if (haveSelectedRange)
+ paintInfo.context->drawText(font, run, origin, selectionStart, selectionEnd);
+ }
if (setShadow)
paintInfo.context->clearShadow();
@@ -523,7 +564,7 @@ void SVGInlineTextBox::paintDecoration(ETextDecoration decoration, GraphicsConte
context->save();
context->beginPath();
- TransformationMatrix ctm = svgChar.characterTransform();
+ AffineTransform ctm = svgChar.characterTransform();
if (!ctm.isIdentity())
context->concatCTM(ctm);
diff --git a/WebCore/rendering/SVGInlineTextBox.h b/WebCore/rendering/SVGInlineTextBox.h
index eea6744..596fdf3 100644
--- a/WebCore/rendering/SVGInlineTextBox.h
+++ b/WebCore/rendering/SVGInlineTextBox.h
@@ -35,7 +35,9 @@ namespace WebCore {
enum SVGTextPaintSubphase {
SVGTextPaintSubphaseBackground,
SVGTextPaintSubphaseGlyphFill,
+ SVGTextPaintSubphaseGlyphFillSelection,
SVGTextPaintSubphaseGlyphStroke,
+ SVGTextPaintSubphaseGlyphStrokeSelection,
SVGTextPaintSubphaseForeground
};
@@ -83,6 +85,7 @@ namespace WebCore {
private:
friend class RenderSVGInlineText;
bool svgCharacterHitsPosition(int x, int y, int& offset) const;
+ bool chunkSelectionStartEnd(const UChar* chunk, int chunkLength, int& selectionStart, int& selectionEnd);
int m_height;
};
diff --git a/WebCore/rendering/SVGMarkerLayoutInfo.h b/WebCore/rendering/SVGMarkerLayoutInfo.h
index 1dfeee9..517c993 100644
--- a/WebCore/rendering/SVGMarkerLayoutInfo.h
+++ b/WebCore/rendering/SVGMarkerLayoutInfo.h
@@ -31,7 +31,7 @@ class Path;
class SVGResourceMarker;
struct MarkerLayout {
- MarkerLayout(SVGResourceMarker* markerObj = 0, TransformationMatrix matrixObj = TransformationMatrix())
+ MarkerLayout(SVGResourceMarker* markerObj = 0, AffineTransform matrixObj = AffineTransform())
: marker(markerObj)
, matrix(matrixObj)
{
@@ -39,7 +39,7 @@ struct MarkerLayout {
}
SVGResourceMarker* marker;
- TransformationMatrix matrix;
+ AffineTransform matrix;
};
class SVGMarkerLayoutInfo : public Noncopyable {
diff --git a/WebCore/rendering/SVGRenderSupport.cpp b/WebCore/rendering/SVGRenderSupport.cpp
index 86cbf32..079a36e 100644
--- a/WebCore/rendering/SVGRenderSupport.cpp
+++ b/WebCore/rendering/SVGRenderSupport.cpp
@@ -27,6 +27,7 @@
#if ENABLE(SVG)
#include "SVGRenderSupport.h"
+#include "AffineTransform.h"
#include "ImageBuffer.h"
#include "RenderObject.h"
#include "RenderSVGContainer.h"
@@ -37,7 +38,6 @@
#include "SVGStyledElement.h"
#include "SVGURIReference.h"
#include "TransformState.h"
-#include "TransformationMatrix.h"
#include <wtf/UnusedParam.h>
namespace WebCore {
@@ -61,6 +61,8 @@ IntRect SVGRenderBase::clippedOverflowRectForRepaint(RenderObject* object, Rende
void SVGRenderBase::computeRectForRepaint(RenderObject* object, RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed)
{
+ object->style()->svgStyle()->inflateForShadow(repaintRect);
+
// Translate to coords in our parent renderer, and then call computeRectForRepaint on our parent
repaintRect = object->localToParentTransform().mapRect(repaintRect);
object->parent()->computeRectForRepaint(repaintContainer, repaintRect, fixed);
@@ -258,6 +260,20 @@ void SVGRenderBase::layoutChildren(RenderObject* start, bool selfNeedsLayout)
}
}
+bool SVGRenderBase::isOverflowHidden(const RenderObject* object)
+{
+ // SVG doesn't support independent x/y overflow
+ ASSERT(object->style()->overflowX() == object->style()->overflowY());
+
+ // OSCROLL is never set for SVG - see CSSStyleSelector::adjustRenderStyle
+ ASSERT(object->style()->overflowX() != OSCROLL);
+
+ // RenderSVGRoot should never query for overflow state - it should always clip itself to the initial viewport size.
+ ASSERT(!object->isRoot());
+
+ return object->style()->overflowX() == OHIDDEN;
+}
+
FloatRect SVGRenderBase::filterBoundingBoxForRenderer(const RenderObject* object) const
{
#if ENABLE(FILTERS)
@@ -288,7 +304,7 @@ FloatRect SVGRenderBase::maskerBoundingBoxForRenderer(const RenderObject* object
return FloatRect();
}
-void applyTransformToPaintInfo(RenderObject::PaintInfo& paintInfo, const TransformationMatrix& localToAncestorTransform)
+void applyTransformToPaintInfo(RenderObject::PaintInfo& paintInfo, const AffineTransform& localToAncestorTransform)
{
if (localToAncestorTransform.isIdentity())
return;
diff --git a/WebCore/rendering/SVGRenderSupport.h b/WebCore/rendering/SVGRenderSupport.h
index 0804ede..cf75365 100644
--- a/WebCore/rendering/SVGRenderSupport.h
+++ b/WebCore/rendering/SVGRenderSupport.h
@@ -51,6 +51,9 @@ namespace WebCore {
// Layout all children of the passed render object
static void layoutChildren(RenderObject*, bool selfNeedsLayout);
+ // Helper function determining wheter overflow is hidden
+ static bool isOverflowHidden(const RenderObject*);
+
virtual FloatRect strokeBoundingBox() const { return FloatRect(); }
virtual FloatRect markerBoundingBox() const { return FloatRect(); }
@@ -72,7 +75,7 @@ namespace WebCore {
// FIXME: This should move to RenderObject or PaintInfo
// Used for transforming the GraphicsContext and damage rect before passing PaintInfo to child renderers.
- void applyTransformToPaintInfo(RenderObject::PaintInfo&, const TransformationMatrix& localToChildTransform);
+ void applyTransformToPaintInfo(RenderObject::PaintInfo&, const AffineTransform& localToChildTransform);
// This offers a way to render parts of a WebKit rendering tree into a ImageBuffer.
void renderSubtreeToImage(ImageBuffer*, RenderObject*);
diff --git a/WebCore/rendering/SVGRenderTreeAsText.cpp b/WebCore/rendering/SVGRenderTreeAsText.cpp
index bd6a465..aff718f 100644
--- a/WebCore/rendering/SVGRenderTreeAsText.cpp
+++ b/WebCore/rendering/SVGRenderTreeAsText.cpp
@@ -179,7 +179,7 @@ TextStream& operator<<(TextStream& ts, const FloatSize& s)
return ts;
}
-TextStream& operator<<(TextStream& ts, const TransformationMatrix& transform)
+TextStream& operator<<(TextStream& ts, const AffineTransform& transform)
{
if (transform.isIdentity())
ts << "identity";
@@ -310,7 +310,7 @@ static void writeStyle(TextStream& ts, const RenderObject& object)
static TextStream& writePositionAndStyle(TextStream& ts, const RenderObject& object)
{
- ts << " " << object.absoluteTransform().mapRect(object.repaintRectInLocalCoordinates());
+ ts << " " << const_cast<RenderObject&>(object).absoluteClippedOverflowRect();
writeStyle(ts, object);
return ts;
}
diff --git a/WebCore/rendering/SVGRenderTreeAsText.h b/WebCore/rendering/SVGRenderTreeAsText.h
index bee4f36..13fc475 100644
--- a/WebCore/rendering/SVGRenderTreeAsText.h
+++ b/WebCore/rendering/SVGRenderTreeAsText.h
@@ -45,7 +45,7 @@ namespace WebCore {
class RenderPath;
class RenderSVGRoot;
class RenderText;
- class TransformationMatrix;
+ class AffineTransform;
// functions used by the main RenderTreeAsText code
void write(TextStream&, const RenderPath&, int indent);
@@ -58,7 +58,7 @@ void writeSVGText(TextStream&, const RenderBlock&, int indent);
void writeRenderResources(TextStream&, Node* parent);
// helper operators defined used in various classes to dump the render tree.
-TextStream& operator<<(TextStream&, const TransformationMatrix&);
+TextStream& operator<<(TextStream&, const AffineTransform&);
TextStream& operator<<(TextStream&, const IntRect&);
TextStream& operator<<(TextStream&, const Color&);
TextStream& operator<<(TextStream&, const IntPoint&);
diff --git a/WebCore/rendering/SVGRootInlineBox.cpp b/WebCore/rendering/SVGRootInlineBox.cpp
index 92e7654..d0dd4a8 100644
--- a/WebCore/rendering/SVGRootInlineBox.cpp
+++ b/WebCore/rendering/SVGRootInlineBox.cpp
@@ -363,6 +363,13 @@ struct SVGRootInlineBoxPaintWalker {
ASSERT(!m_chunkStarted);
}
+ bool mayHaveSelection(InlineBox* box) const
+ {
+ int selectionStart = 0, selectionEnd = 0;
+ box->renderer()->selectionStartEnd(selectionStart, selectionEnd);
+ return selectionStart < selectionEnd;
+ }
+
void teardownFillPaintServer()
{
if (!m_fillPaintServer)
@@ -457,6 +464,34 @@ struct SVGRootInlineBoxPaintWalker {
return false;
}
+ bool chunkSetupFillSelectionCallback(InlineBox* box)
+ {
+ InlineFlowBox* flowBox = box->parent();
+
+ // Setup fill paint server
+ RenderObject* object = flowBox->renderer();
+ ASSERT(object);
+ RenderStyle* style = object->getCachedPseudoStyle(SELECTION);
+ if (!style)
+ style = object->style();
+
+ ASSERT(!m_strokePaintServer);
+ teardownFillPaintServer();
+
+ if (!mayHaveSelection(box))
+ return false;
+
+ m_textPaintInfo.subphase = SVGTextPaintSubphaseGlyphFillSelection;
+ m_fillPaintServer = SVGPaintServer::fillPaintServer(style, object);
+ if (m_fillPaintServer) {
+ m_fillPaintServer->setup(m_paintInfo.context, object, style, ApplyToFillTargetType, true);
+ m_fillPaintServerObject = object;
+ return true;
+ }
+
+ return false;
+ }
+
bool chunkSetupStrokeCallback(InlineBox* box)
{
InlineFlowBox* flowBox = box->parent();
@@ -481,6 +516,35 @@ struct SVGRootInlineBoxPaintWalker {
return false;
}
+ bool chunkSetupStrokeSelectionCallback(InlineBox* box)
+ {
+ InlineFlowBox* flowBox = box->parent();
+
+ // Setup stroke paint server
+ RenderObject* object = flowBox->renderer();
+ ASSERT(object);
+ RenderStyle* style = object->getCachedPseudoStyle(SELECTION);
+ if (!style)
+ style = object->style();
+
+ // If we're both stroked & filled, teardown fill paint server before stroking.
+ teardownFillPaintServer();
+ teardownStrokePaintServer();
+
+ if (!mayHaveSelection(box))
+ return false;
+
+ m_textPaintInfo.subphase = SVGTextPaintSubphaseGlyphStrokeSelection;
+ m_strokePaintServer = SVGPaintServer::strokePaintServer(style, object);
+ if (m_strokePaintServer) {
+ m_strokePaintServer->setup(m_paintInfo.context, object, style, ApplyToStrokeTargetType, true);
+ m_strokePaintServerObject = object;
+ return true;
+ }
+
+ return false;
+ }
+
bool chunkSetupForegroundCallback(InlineBox* /*box*/)
{
teardownFillPaintServer();
@@ -495,9 +559,11 @@ struct SVGRootInlineBoxPaintWalker {
{
switch (m_textPaintInfo.subphase) {
case SVGTextPaintSubphaseGlyphFill:
+ case SVGTextPaintSubphaseGlyphFillSelection:
ASSERT(m_fillPaintServer);
return m_fillPaintServer;
case SVGTextPaintSubphaseGlyphStroke:
+ case SVGTextPaintSubphaseGlyphStrokeSelection:
ASSERT(m_strokePaintServer);
return m_strokePaintServer;
case SVGTextPaintSubphaseBackground:
@@ -507,7 +573,7 @@ struct SVGRootInlineBoxPaintWalker {
}
}
- void chunkPortionCallback(SVGInlineTextBox* textBox, int startOffset, const TransformationMatrix& chunkCtm,
+ void chunkPortionCallback(SVGInlineTextBox* textBox, int startOffset, const AffineTransform& chunkCtm,
const Vector<SVGChar>::iterator& start, const Vector<SVGChar>::iterator& end)
{
RenderText* text = textBox->textRenderer();
@@ -616,7 +682,9 @@ void SVGRootInlineBox::paint(RenderObject::PaintInfo& paintInfo, int tx, int ty)
&SVGRootInlineBoxPaintWalker::chunkEndCallback,
&SVGRootInlineBoxPaintWalker::chunkSetupBackgroundCallback,
&SVGRootInlineBoxPaintWalker::chunkSetupFillCallback,
+ &SVGRootInlineBoxPaintWalker::chunkSetupFillSelectionCallback,
&SVGRootInlineBoxPaintWalker::chunkSetupStrokeCallback,
+ &SVGRootInlineBoxPaintWalker::chunkSetupStrokeSelectionCallback,
&SVGRootInlineBoxPaintWalker::chunkSetupForegroundCallback);
walkTextChunks(&walker);
@@ -865,9 +933,8 @@ static void applyTextLengthCorrectionToTextChunk(SVGTextChunk& chunk)
SVGChar& firstChar = *(chunk.start);
// Assure we apply the chunk scaling in the right origin
- TransformationMatrix newChunkCtm;
- newChunkCtm.translate(firstChar.x, firstChar.y);
- newChunkCtm = chunk.ctm * newChunkCtm;
+ AffineTransform newChunkCtm(chunk.ctm);
+ newChunkCtm.translateRight(firstChar.x, firstChar.y);
newChunkCtm.translate(-firstChar.x, -firstChar.y);
chunk.ctm = newChunkCtm;
@@ -978,7 +1045,6 @@ void SVGRootInlineBox::buildLayoutInformation(InlineFlowBox* start, SVGCharacter
Vector<SVGTextChunk>::iterator it = tempChunks.begin();
Vector<SVGTextChunk>::iterator end = tempChunks.end();
- TransformationMatrix ctm;
float computedLength = 0.0f;
for (; it != end; ++it) {
@@ -1720,9 +1786,15 @@ void SVGRootInlineBox::walkTextChunks(SVGTextChunkWalkerBase* walker, const SVGI
if (walker->setupFill(range.box))
(*walker)(rangeTextBox, range.startOffset, curChunk.ctm, itCharBegin, itCharEnd);
+ if (walker->setupFillSelection(range.box))
+ (*walker)(rangeTextBox, range.startOffset, curChunk.ctm, itCharBegin, itCharEnd);
+
if (walker->setupStroke(range.box))
(*walker)(rangeTextBox, range.startOffset, curChunk.ctm, itCharBegin, itCharEnd);
+ if (walker->setupStrokeSelection(range.box))
+ (*walker)(rangeTextBox, range.startOffset, curChunk.ctm, itCharBegin, itCharEnd);
+
if (walker->setupForeground(range.box))
(*walker)(rangeTextBox, range.startOffset, curChunk.ctm, itCharBegin, itCharEnd);
diff --git a/WebCore/rendering/SVGRootInlineBox.h b/WebCore/rendering/SVGRootInlineBox.h
index d2dab98..7b1dcc4 100644
--- a/WebCore/rendering/SVGRootInlineBox.h
+++ b/WebCore/rendering/SVGRootInlineBox.h
@@ -44,7 +44,7 @@ struct LastGlyphInfo {
bool isValid;
};
-class SVGRootInlineBox : public RootInlineBox, SVGRenderBase {
+class SVGRootInlineBox : public RootInlineBox, protected SVGRenderBase {
public:
SVGRootInlineBox(RenderObject* obj)
: RootInlineBox(obj)
diff --git a/WebCore/rendering/TransformState.cpp b/WebCore/rendering/TransformState.cpp
index 700831b..ecc614e 100644
--- a/WebCore/rendering/TransformState.cpp
+++ b/WebCore/rendering/TransformState.cpp
@@ -49,6 +49,12 @@ void TransformState::move(int x, int y, TransformAccumulation accumulate)
m_accumulatingTransform = accumulate == AccumulateTransform;
}
+// FIXME: We transform AffineTransform to TransformationMatrix. This is rather inefficient.
+void TransformState::applyTransform(const AffineTransform& transformFromContainer, TransformAccumulation accumulate)
+{
+ applyTransform(transformFromContainer.toTransformationMatrix(), accumulate);
+}
+
void TransformState::applyTransform(const TransformationMatrix& transformFromContainer, TransformAccumulation accumulate)
{
// If we have an accumulated transform from last time, multiply in this transform
diff --git a/WebCore/rendering/TransformState.h b/WebCore/rendering/TransformState.h
index d2c962a..0b4ca46 100644
--- a/WebCore/rendering/TransformState.h
+++ b/WebCore/rendering/TransformState.h
@@ -26,6 +26,7 @@
#ifndef TransformState_h
#define TransformState_h
+#include "AffineTransform.h"
#include "FloatPoint.h"
#include "FloatQuad.h"
#include "IntSize.h"
@@ -59,6 +60,7 @@ public:
}
void move(int x, int y, TransformAccumulation = FlattenTransform);
+ void applyTransform(const AffineTransform& transformFromContainer, TransformAccumulation = FlattenTransform);
void applyTransform(const TransformationMatrix& transformFromContainer, TransformAccumulation = FlattenTransform);
void flatten();
diff --git a/WebCore/rendering/style/RenderStyle.h b/WebCore/rendering/style/RenderStyle.h
index c59d953..696a2b7 100644
--- a/WebCore/rendering/style/RenderStyle.h
+++ b/WebCore/rendering/style/RenderStyle.h
@@ -183,7 +183,7 @@ protected:
unsigned _empty_cells : 1; // EEmptyCell
unsigned _caption_side : 2; // ECaptionSide
- unsigned _list_style_type : 6; // EListStyleType
+ unsigned _list_style_type : 7; // EListStyleType
unsigned _list_style_position : 1; // EListStylePosition
unsigned _visibility : 2; // EVisibility
unsigned _text_align : 3; // ETextAlign
@@ -194,14 +194,14 @@ protected:
bool _border_collapse : 1 ;
unsigned _white_space : 3; // EWhiteSpace
unsigned _box_direction : 1; // EBoxDirection (CSS3 box_direction property, flexible box layout module)
- // 33 bits
+ // 34 bits
// non CSS2 inherited
bool _visuallyOrdered : 1;
bool _htmlHacks : 1;
bool _force_backgrounds_to_white : 1;
unsigned _pointerEvents : 4; // EPointerEvents
- // 40 bits
+ // 41 bits
} inherited_flags;
// don't inherit
diff --git a/WebCore/rendering/style/RenderStyleConstants.h b/WebCore/rendering/style/RenderStyleConstants.h
index d2c80ca..01862f6 100644
--- a/WebCore/rendering/style/RenderStyleConstants.h
+++ b/WebCore/rendering/style/RenderStyleConstants.h
@@ -205,61 +205,83 @@ enum EResize {
// The order of this enum must match the order of the list style types in CSSValueKeywords.in.
enum EListStyleType {
- Disc,
- Circle,
- Square,
- DecimalListStyle,
- DecimalLeadingZero,
- LowerRoman,
- UpperRoman,
- LowerGreek,
- LowerAlpha,
- LowerLatin,
- UpperAlpha,
- UpperLatin,
- Afar,
- EthiopicHalehameAaEt,
- EthiopicHalehameAaEr,
- Amharic,
- EthiopicHalehameAmEt,
- AmharicAbegede,
- EthiopicAbegedeAmEt,
- CjkEarthlyBranch,
- CjkHeavenlyStem,
- Ethiopic,
- EthiopicHalehameGez,
- EthiopicAbegede,
- EthiopicAbegedeGez,
- HangulConsonant,
- Hangul,
- LowerNorwegian,
- Oromo,
- EthiopicHalehameOmEt,
- Sidama,
- EthiopicHalehameSidEt,
- Somali,
- EthiopicHalehameSoEt,
- Tigre,
- EthiopicHalehameTig,
- TigrinyaEr,
- EthiopicHalehameTiEr,
- TigrinyaErAbegede,
- EthiopicAbegedeTiEr,
- TigrinyaEt,
- EthiopicHalehameTiEt,
- TigrinyaEtAbegede,
- EthiopicAbegedeTiEt,
- UpperGreek,
- UpperNorwegian,
- Hebrew,
- Armenian,
- Georgian,
- CJKIdeographic,
- Hiragana,
- Katakana,
- HiraganaIroha,
- KatakanaIroha,
- NoneListStyle
+ Disc,
+ Circle,
+ Square,
+ DecimalListStyle,
+ DecimalLeadingZero,
+ ArabicIndic,
+ BinaryListStyle,
+ Bengali,
+ Cambodian,
+ Khmer,
+ Devanagari,
+ Gujarati,
+ Gurmukhi,
+ Kannada,
+ LowerHexadecimal,
+ Lao,
+ Malayalam,
+ Mongolian,
+ Myanmar,
+ Octal,
+ Oriya,
+ Persian,
+ Urdu,
+ Telugu,
+ Tibetan,
+ Thai,
+ UpperHexadecimal,
+ LowerRoman,
+ UpperRoman,
+ LowerGreek,
+ LowerAlpha,
+ LowerLatin,
+ UpperAlpha,
+ UpperLatin,
+ Afar,
+ EthiopicHalehameAaEt,
+ EthiopicHalehameAaEr,
+ Amharic,
+ EthiopicHalehameAmEt,
+ AmharicAbegede,
+ EthiopicAbegedeAmEt,
+ CjkEarthlyBranch,
+ CjkHeavenlyStem,
+ Ethiopic,
+ EthiopicHalehameGez,
+ EthiopicAbegede,
+ EthiopicAbegedeGez,
+ HangulConsonant,
+ Hangul,
+ LowerNorwegian,
+ Oromo,
+ EthiopicHalehameOmEt,
+ Sidama,
+ EthiopicHalehameSidEt,
+ Somali,
+ EthiopicHalehameSoEt,
+ Tigre,
+ EthiopicHalehameTig,
+ TigrinyaEr,
+ EthiopicHalehameTiEr,
+ TigrinyaErAbegede,
+ EthiopicAbegedeTiEr,
+ TigrinyaEt,
+ EthiopicHalehameTiEt,
+ TigrinyaEtAbegede,
+ EthiopicAbegedeTiEt,
+ UpperGreek,
+ UpperNorwegian,
+ Hebrew,
+ Armenian,
+ Georgian,
+ CJKIdeographic,
+ Hiragana,
+ Katakana,
+ HiraganaIroha,
+ KatakanaIroha,
+ NoneListStyle
};
enum StyleContentType {
diff --git a/WebCore/storage/DatabaseTracker.cpp b/WebCore/storage/DatabaseTracker.cpp
index bed83a7..76492c9 100644
--- a/WebCore/storage/DatabaseTracker.cpp
+++ b/WebCore/storage/DatabaseTracker.cpp
@@ -478,6 +478,24 @@ void DatabaseTracker::removeOpenDatabase(Database* database)
delete nameMap;
}
+void DatabaseTracker::getOpenDatabases(SecurityOrigin* origin, const String& name, HashSet<RefPtr<Database> >* databases)
+{
+ MutexLocker openDatabaseMapLock(m_openDatabaseMapGuard);
+ if (!m_openDatabaseMap)
+ return;
+
+ DatabaseNameMap* nameMap = m_openDatabaseMap->get(origin);
+ if (!nameMap)
+ return;
+
+ DatabaseSet* databaseSet = nameMap->get(name);
+ if (!databaseSet)
+ return;
+
+ for (DatabaseSet::iterator it = databaseSet->begin(); it != databaseSet->end(); ++it)
+ databases->add(*it);
+}
+
unsigned long long DatabaseTracker::usageForOrigin(SecurityOrigin* origin)
{
ASSERT(currentThread() == m_thread);
diff --git a/WebCore/storage/DatabaseTracker.h b/WebCore/storage/DatabaseTracker.h
index 38a3418..4640b18 100644
--- a/WebCore/storage/DatabaseTracker.h
+++ b/WebCore/storage/DatabaseTracker.h
@@ -32,13 +32,13 @@
#if ENABLE(DATABASE)
#include "PlatformString.h"
+#include "StringHash.h"
+#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
#if !PLATFORM(CHROMIUM)
#include "DatabaseDetails.h"
#include "SQLiteDatabase.h"
-#include "StringHash.h"
-#include <wtf/HashMap.h>
-#include <wtf/HashSet.h>
#include <wtf/OwnPtr.h>
#endif // !PLATFORM(CHROMIUM)
@@ -48,11 +48,12 @@ class Database;
class ScriptExecutionContext;
class SecurityOrigin;
+struct SecurityOriginHash;
+
#if !PLATFORM(CHROMIUM)
class DatabaseTrackerClient;
class OriginQuotaManager;
-struct SecurityOriginHash;
struct SecurityOriginTraits;
#endif // !PLATFORM(CHROMIUM)
@@ -69,12 +70,20 @@ public:
void addOpenDatabase(Database*);
void removeOpenDatabase(Database*);
+ void getOpenDatabases(SecurityOrigin* origin, const String& name, HashSet<RefPtr<Database> >* databases);
unsigned long long getMaxSizeForDatabase(const Database*);
private:
DatabaseTracker();
+ typedef HashSet<Database*> DatabaseSet;
+ typedef HashMap<String, DatabaseSet*> DatabaseNameMap;
+ typedef HashMap<RefPtr<SecurityOrigin>, DatabaseNameMap*, SecurityOriginHash> DatabaseOriginMap;
+
+ Mutex m_openDatabaseMapGuard;
+ mutable OwnPtr<DatabaseOriginMap> m_openDatabaseMap;
+
#if !PLATFORM(CHROMIUM)
public:
void setDatabaseDirectoryPath(const String&);
@@ -123,13 +132,6 @@ private:
Mutex m_quotaMapGuard;
mutable OwnPtr<QuotaMap> m_quotaMap;
- typedef HashSet<Database*> DatabaseSet;
- typedef HashMap<String, DatabaseSet*> DatabaseNameMap;
- typedef HashMap<RefPtr<SecurityOrigin>, DatabaseNameMap*, SecurityOriginHash> DatabaseOriginMap;
-
- Mutex m_openDatabaseMapGuard;
- mutable OwnPtr<DatabaseOriginMap> m_openDatabaseMap;
-
OwnPtr<OriginQuotaManager> m_quotaManager;
String m_databaseDirectoryPath;
diff --git a/WebCore/storage/SQLTransaction.cpp b/WebCore/storage/SQLTransaction.cpp
index db25e1a..754cebc 100644
--- a/WebCore/storage/SQLTransaction.cpp
+++ b/WebCore/storage/SQLTransaction.cpp
@@ -313,7 +313,7 @@ void SQLTransaction::runStatements()
// If there is a series of statements queued up that are all successful and have no associated
// SQLStatementCallback objects, then we can burn through the queue
do {
- if (m_shouldRetryCurrentStatement) {
+ if (m_shouldRetryCurrentStatement && !m_sqliteTransaction->wasRolledBackBySqlite()) {
m_shouldRetryCurrentStatement = false;
// FIXME - Another place that needs fixing up after <rdar://problem/5628468> is addressed.
// See ::openTransactionAndPreflight() for discussion
@@ -393,8 +393,8 @@ bool SQLTransaction::runCurrentStatement()
void SQLTransaction::handleCurrentStatementError()
{
// Transaction Steps 6.error - Call the statement's error callback, but if there was no error callback,
- // jump to the transaction error callback
- if (m_currentStatement->hasStatementErrorCallback()) {
+ // or the transaction was rolled back, jump to the transaction error callback
+ if (m_currentStatement->hasStatementErrorCallback() && !m_sqliteTransaction->wasRolledBackBySqlite()) {
m_nextStep = &SQLTransaction::deliverStatementCallback;
LOG(StorageAPI, "Scheduling deliverStatementCallback for transaction %p\n", this);
m_database->scheduleTransactionCallback(this);
diff --git a/WebCore/storage/chromium/DatabaseTrackerChromium.cpp b/WebCore/storage/chromium/DatabaseTrackerChromium.cpp
index e18706b..ac58e07 100644
--- a/WebCore/storage/chromium/DatabaseTrackerChromium.cpp
+++ b/WebCore/storage/chromium/DatabaseTrackerChromium.cpp
@@ -38,6 +38,7 @@
#include "QuotaTracker.h"
#include "ScriptExecutionContext.h"
#include "SecurityOrigin.h"
+#include "SecurityOriginHash.h"
#include "SQLiteFileSystem.h"
#include <wtf/HashSet.h>
#include <wtf/MainThread.h>
@@ -76,6 +77,25 @@ String DatabaseTracker::fullPathForDatabase(SecurityOrigin* origin, const String
void DatabaseTracker::addOpenDatabase(Database* database)
{
ASSERT(database->scriptExecutionContext()->isContextThread());
+ MutexLocker openDatabaseMapLock(m_openDatabaseMapGuard);
+ if (!m_openDatabaseMap)
+ m_openDatabaseMap.set(new DatabaseOriginMap());
+
+ DatabaseNameMap* nameMap = m_openDatabaseMap->get(database->securityOrigin());
+ if (!nameMap) {
+ nameMap = new DatabaseNameMap();
+ m_openDatabaseMap->set(database->securityOrigin(), nameMap);
+ }
+
+ String name(database->stringIdentifier());
+ DatabaseSet* databaseSet = nameMap->get(name);
+ if (!databaseSet) {
+ databaseSet = new DatabaseSet();
+ nameMap->set(name, databaseSet);
+ }
+
+ databaseSet->add(database);
+
DatabaseObserver::databaseOpened(database);
}
@@ -107,9 +127,46 @@ void DatabaseTracker::removeOpenDatabase(Database* database)
return;
}
+ MutexLocker openDatabaseMapLock(m_openDatabaseMapGuard);
+ ASSERT(m_openDatabaseMap);
+ DatabaseNameMap* nameMap = m_openDatabaseMap->get(database->securityOrigin());
+ ASSERT(nameMap);
+ String name(database->stringIdentifier());
+ DatabaseSet* databaseSet = nameMap->get(name);
+ ASSERT(databaseSet);
+ databaseSet->remove(database);
+
+ if (databaseSet->isEmpty()) {
+ nameMap->remove(name);
+ delete databaseSet;
+ if (nameMap->isEmpty()) {
+ m_openDatabaseMap->remove(database->securityOrigin());
+ delete nameMap;
+ }
+ }
+
DatabaseObserver::databaseClosed(database);
}
+
+void DatabaseTracker::getOpenDatabases(SecurityOrigin* origin, const String& name, HashSet<RefPtr<Database> >* databases)
+{
+ MutexLocker openDatabaseMapLock(m_openDatabaseMapGuard);
+ if (!m_openDatabaseMap)
+ return;
+
+ DatabaseNameMap* nameMap = m_openDatabaseMap->get(origin);
+ if (!nameMap)
+ return;
+
+ DatabaseSet* databaseSet = nameMap->get(name);
+ if (!databaseSet)
+ return;
+
+ for (DatabaseSet::iterator it = databaseSet->begin(); it != databaseSet->end(); ++it)
+ databases->add(*it);
+}
+
unsigned long long DatabaseTracker::getMaxSizeForDatabase(const Database* database)
{
ASSERT(currentThread() == database->scriptExecutionContext()->databaseThread()->getThreadID());
diff --git a/WebCore/svg/GradientAttributes.h b/WebCore/svg/GradientAttributes.h
index 941e816..ba513b8 100644
--- a/WebCore/svg/GradientAttributes.h
+++ b/WebCore/svg/GradientAttributes.h
@@ -36,12 +36,12 @@ namespace WebCore {
GradientSpreadMethod spreadMethod() const { return m_spreadMethod; }
bool boundingBoxMode() const { return m_boundingBoxMode; }
- TransformationMatrix gradientTransform() const { return m_gradientTransform; }
+ AffineTransform gradientTransform() const { return m_gradientTransform; }
const Vector<SVGGradientStop>& stops() const { return m_stops; }
void setSpreadMethod(GradientSpreadMethod value) { m_spreadMethod = value; m_spreadMethodSet = true; }
void setBoundingBoxMode(bool value) { m_boundingBoxMode = value; m_boundingBoxModeSet = true; }
- void setGradientTransform(const TransformationMatrix& value) { m_gradientTransform = value; m_gradientTransformSet = true; }
+ void setGradientTransform(const AffineTransform& value) { m_gradientTransform = value; m_gradientTransformSet = true; }
void setStops(const Vector<SVGGradientStop>& value) { m_stops = value; m_stopsSet = true; }
bool hasSpreadMethod() const { return m_spreadMethodSet; }
@@ -53,7 +53,7 @@ namespace WebCore {
// Properties
GradientSpreadMethod m_spreadMethod;
bool m_boundingBoxMode;
- TransformationMatrix m_gradientTransform;
+ AffineTransform m_gradientTransform;
Vector<SVGGradientStop> m_stops;
// Property states
diff --git a/WebCore/svg/PatternAttributes.h b/WebCore/svg/PatternAttributes.h
index 36d1765..2d25763 100644
--- a/WebCore/svg/PatternAttributes.h
+++ b/WebCore/svg/PatternAttributes.h
@@ -49,7 +49,7 @@ namespace WebCore {
SVGLength height() const { return m_height; }
bool boundingBoxMode() const { return m_boundingBoxMode; }
bool boundingBoxModeContent() const { return m_boundingBoxModeContent; }
- TransformationMatrix patternTransform() const { return m_patternTransform; }
+ AffineTransform patternTransform() const { return m_patternTransform; }
const SVGPatternElement* patternContentElement() const { return m_patternContentElement; }
void setX(const SVGLength& value) { m_x = value; m_xSet = true; }
@@ -58,7 +58,7 @@ namespace WebCore {
void setHeight(const SVGLength& value) { m_height = value; m_heightSet = true; }
void setBoundingBoxMode(bool value) { m_boundingBoxMode = value; m_boundingBoxModeSet = true; }
void setBoundingBoxModeContent(bool value) { m_boundingBoxModeContent = value; m_boundingBoxModeContentSet = true; }
- void setPatternTransform(const TransformationMatrix& value) { m_patternTransform = value; m_patternTransformSet = true; }
+ void setPatternTransform(const AffineTransform& value) { m_patternTransform = value; m_patternTransformSet = true; }
void setPatternContentElement(const SVGPatternElement* value) { m_patternContentElement = value; m_patternContentElementSet = true; }
bool hasX() const { return m_xSet; }
@@ -78,7 +78,7 @@ namespace WebCore {
SVGLength m_height;
bool m_boundingBoxMode;
bool m_boundingBoxModeContent;
- TransformationMatrix m_patternTransform;
+ AffineTransform m_patternTransform;
const SVGPatternElement* m_patternContentElement;
// Property states
diff --git a/WebCore/svg/SVGAnimateMotionElement.cpp b/WebCore/svg/SVGAnimateMotionElement.cpp
index bd6de49..9355436 100644
--- a/WebCore/svg/SVGAnimateMotionElement.cpp
+++ b/WebCore/svg/SVGAnimateMotionElement.cpp
@@ -149,7 +149,7 @@ void SVGAnimateMotionElement::resetToBaseValue(const String&)
if (!hasValidTarget())
return;
SVGElement* target = targetElement();
- TransformationMatrix* transform = target->supplementalTransform();
+ AffineTransform* transform = target->supplementalTransform();
if (!transform)
return;
transform->makeIdentity();
@@ -176,7 +176,7 @@ void SVGAnimateMotionElement::calculateAnimatedValue(float percentage, unsigned,
SVGElement* target = targetElement();
if (!target)
return;
- TransformationMatrix* transform = target->supplementalTransform();
+ AffineTransform* transform = target->supplementalTransform();
if (!transform)
return;
@@ -220,8 +220,8 @@ void SVGAnimateMotionElement::applyResultsToTarget()
for (HashSet<SVGElementInstance*>::const_iterator it = instances.begin(); it != end; ++it) {
SVGElement* shadowTreeElement = (*it)->shadowTreeElement();
ASSERT(shadowTreeElement);
- TransformationMatrix* transform = shadowTreeElement->supplementalTransform();
- TransformationMatrix* t = targetElement->supplementalTransform();
+ AffineTransform* transform = shadowTreeElement->supplementalTransform();
+ AffineTransform* t = targetElement->supplementalTransform();
transform->setMatrix(t->a(), t->b(), t->c(), t->d(), t->e(), t->f());
if (shadowTreeElement->renderer())
shadowTreeElement->renderer()->setNeedsLayout(true);
diff --git a/WebCore/svg/SVGAnimateMotionElement.h b/WebCore/svg/SVGAnimateMotionElement.h
index 910ef17..f401220 100644
--- a/WebCore/svg/SVGAnimateMotionElement.h
+++ b/WebCore/svg/SVGAnimateMotionElement.h
@@ -23,10 +23,9 @@
#ifndef SVGAnimateMotionElement_h
#define SVGAnimateMotionElement_h
#if ENABLE(SVG_ANIMATION)
-
-#include "SVGAnimationElement.h"
-#include "TransformationMatrix.h"
+#include "AffineTransform.h"
#include "Path.h"
+#include "SVGAnimationElement.h"
namespace WebCore {
diff --git a/WebCore/svg/SVGAnimateTransformElement.cpp b/WebCore/svg/SVGAnimateTransformElement.cpp
index ac6eac9..8e077a4 100644
--- a/WebCore/svg/SVGAnimateTransformElement.cpp
+++ b/WebCore/svg/SVGAnimateTransformElement.cpp
@@ -27,6 +27,7 @@
#if ENABLE(SVG) && ENABLE(SVG_ANIMATION)
#include "SVGAnimateTransformElement.h"
+#include "AffineTransform.h"
#include "MappedAttribute.h"
#include "RenderObject.h"
#include "SVGAngle.h"
@@ -38,7 +39,6 @@
#include "SVGTransform.h"
#include "SVGTransformList.h"
#include "SVGUseElement.h"
-#include "TransformationMatrix.h"
#include <math.h>
#include <wtf/MathExtras.h>
diff --git a/WebCore/svg/SVGAnimateTransformElement.h b/WebCore/svg/SVGAnimateTransformElement.h
index c9139c4..c93e694 100644
--- a/WebCore/svg/SVGAnimateTransformElement.h
+++ b/WebCore/svg/SVGAnimateTransformElement.h
@@ -30,34 +30,34 @@
namespace WebCore {
- class TransformationMatrix;
+class AffineTransform;
- class SVGAnimateTransformElement : public SVGAnimationElement {
- public:
- SVGAnimateTransformElement(const QualifiedName&, Document*);
- virtual ~SVGAnimateTransformElement();
-
- virtual bool hasValidTarget() const;
+class SVGAnimateTransformElement : public SVGAnimationElement {
+public:
+ SVGAnimateTransformElement(const QualifiedName&, Document*);
+ virtual ~SVGAnimateTransformElement();
+
+ virtual bool hasValidTarget() const;
- virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void parseMappedAttribute(MappedAttribute*);
- private:
- virtual void resetToBaseValue(const String&);
- virtual bool calculateFromAndToValues(const String& fromString, const String& toString);
- virtual bool calculateFromAndByValues(const String& fromString, const String& byString);
- virtual void calculateAnimatedValue(float percentage, unsigned repeat, SVGSMILElement* resultElement);
- virtual void applyResultsToTarget();
- virtual float calculateDistance(const String& fromString, const String& toString);
+private:
+ virtual void resetToBaseValue(const String&);
+ virtual bool calculateFromAndToValues(const String& fromString, const String& toString);
+ virtual bool calculateFromAndByValues(const String& fromString, const String& byString);
+ virtual void calculateAnimatedValue(float percentage, unsigned repeat, SVGSMILElement* resultElement);
+ virtual void applyResultsToTarget();
+ virtual float calculateDistance(const String& fromString, const String& toString);
- SVGTransform parseTransformValue(const String&) const;
-
- SVGTransform::SVGTransformType m_type;
-
- unsigned m_baseIndexInTransformList;
+ SVGTransform parseTransformValue(const String&) const;
+
+ SVGTransform::SVGTransformType m_type;
+
+ unsigned m_baseIndexInTransformList;
- SVGTransform m_toTransform;
- SVGTransform m_fromTransform;
- };
+ SVGTransform m_toTransform;
+ SVGTransform m_fromTransform;
+};
} // namespace WebCore
diff --git a/WebCore/svg/SVGElement.h b/WebCore/svg/SVGElement.h
index 679c265..88d7412 100644
--- a/WebCore/svg/SVGElement.h
+++ b/WebCore/svg/SVGElement.h
@@ -34,7 +34,7 @@ namespace WebCore {
class SVGElementInstance;
class SVGElementRareData;
class SVGSVGElement;
- class TransformationMatrix;
+ class AffineTransform;
class SVGElement : public StyledElement {
public:
@@ -70,7 +70,7 @@ namespace WebCore {
void sendSVGLoadEventIfPossible(bool sendParentLoadEvents = false);
- virtual TransformationMatrix* supplementalTransform() { return 0; }
+ virtual AffineTransform* supplementalTransform() { return 0; }
void setSynchronizedSVGAttributes(bool value) { m_areSVGAttributesValid = value; }
diff --git a/WebCore/svg/SVGFitToViewBox.cpp b/WebCore/svg/SVGFitToViewBox.cpp
index 80dead6..64c978f 100644
--- a/WebCore/svg/SVGFitToViewBox.cpp
+++ b/WebCore/svg/SVGFitToViewBox.cpp
@@ -23,6 +23,7 @@
#if ENABLE(SVG)
#include "SVGFitToViewBox.h"
+#include "AffineTransform.h"
#include "Attr.h"
#include "Document.h"
#include "FloatRect.h"
@@ -31,7 +32,6 @@
#include "SVGParserUtilities.h"
#include "SVGPreserveAspectRatio.h"
#include "StringImpl.h"
-#include "TransformationMatrix.h"
namespace WebCore {
@@ -75,10 +75,10 @@ bool SVGFitToViewBox::parseViewBox(Document* doc, const UChar*& c, const UChar*
return true;
}
-TransformationMatrix SVGFitToViewBox::viewBoxToViewTransform(const FloatRect& viewBoxRect, const SVGPreserveAspectRatio& preserveAspectRatio, float viewWidth, float viewHeight)
+AffineTransform SVGFitToViewBox::viewBoxToViewTransform(const FloatRect& viewBoxRect, const SVGPreserveAspectRatio& preserveAspectRatio, float viewWidth, float viewHeight)
{
if (!viewBoxRect.width() || !viewBoxRect.height())
- return TransformationMatrix();
+ return AffineTransform();
return preserveAspectRatio.getCTM(viewBoxRect.x(), viewBoxRect.y(), viewBoxRect.width(), viewBoxRect.height(), 0, 0, viewWidth, viewHeight);
}
diff --git a/WebCore/svg/SVGFitToViewBox.h b/WebCore/svg/SVGFitToViewBox.h
index 20fb7c1..ef7e54b 100644
--- a/WebCore/svg/SVGFitToViewBox.h
+++ b/WebCore/svg/SVGFitToViewBox.h
@@ -27,22 +27,22 @@
namespace WebCore {
- class TransformationMatrix;
+class AffineTransform;
- class SVGFitToViewBox {
- public:
- SVGFitToViewBox();
- virtual ~SVGFitToViewBox();
+class SVGFitToViewBox {
+public:
+ SVGFitToViewBox();
+ virtual ~SVGFitToViewBox();
- bool parseViewBox(Document*, const UChar*& start, const UChar* end, float& x, float& y, float& w, float& h, bool validate = true);
- static TransformationMatrix viewBoxToViewTransform(const FloatRect& viewBoxRect, const SVGPreserveAspectRatio&, float viewWidth, float viewHeight);
+ bool parseViewBox(Document*, const UChar*& start, const UChar* end, float& x, float& y, float& w, float& h, bool validate = true);
+ static AffineTransform viewBoxToViewTransform(const FloatRect& viewBoxRect, const SVGPreserveAspectRatio&, float viewWidth, float viewHeight);
- bool parseMappedAttribute(Document*, MappedAttribute*);
- bool isKnownAttribute(const QualifiedName&);
+ bool parseMappedAttribute(Document*, MappedAttribute*);
+ bool isKnownAttribute(const QualifiedName&);
- virtual void setViewBoxBaseValue(SVGAnimatedPropertyTraits<FloatRect>::PassType) = 0;
- virtual void setPreserveAspectRatioBaseValue(SVGAnimatedPropertyTraits<SVGPreserveAspectRatio>::PassType) = 0;
- };
+ virtual void setViewBoxBaseValue(SVGAnimatedPropertyTraits<FloatRect>::PassType) = 0;
+ virtual void setPreserveAspectRatioBaseValue(SVGAnimatedPropertyTraits<SVGPreserveAspectRatio>::PassType) = 0;
+};
} // namespace WebCore
diff --git a/WebCore/svg/SVGFont.cpp b/WebCore/svg/SVGFont.cpp
index d978328..b7ca5f2 100644
--- a/WebCore/svg/SVGFont.cpp
+++ b/WebCore/svg/SVGFont.cpp
@@ -240,8 +240,7 @@ struct SVGTextRunWalker {
void walk(const TextRun& run, bool isVerticalText, const String& language, int from, int to)
{
- // Should hold true for SVG text, otherwhise sth. is wrong
- ASSERT(to - from == run.length());
+ ASSERT(0 <= from && from <= to && to - from <= run.length());
const String text = Font::normalizeSpaces(String(run.data(from), run.length()));
Vector<SVGGlyphIdentifier::ArabicForm> chars(charactersWithArabicForm(text, run.rtl()));
diff --git a/WebCore/svg/SVGLocatable.cpp b/WebCore/svg/SVGLocatable.cpp
index 00acc2a..39cf589 100644
--- a/WebCore/svg/SVGLocatable.cpp
+++ b/WebCore/svg/SVGLocatable.cpp
@@ -24,7 +24,7 @@
#include "SVGLocatable.h"
-#include "TransformationMatrix.h"
+#include "AffineTransform.h"
#include "RenderPath.h"
#include "SVGException.h"
#include "SVGSVGElement.h"
@@ -82,16 +82,16 @@ FloatRect SVGLocatable::getBBox(const SVGElement* element)
return element->renderer()->objectBoundingBox();
}
-TransformationMatrix SVGLocatable::getCTM(const SVGElement* element)
+AffineTransform SVGLocatable::getCTM(const SVGElement* element)
{
ASSERT(element);
- TransformationMatrix ctm;
+ AffineTransform ctm;
Node* parent = element->parentNode();
if (parent && parent->isSVGElement()) {
SVGElement* parentElement = static_cast<SVGElement*>(parent);
if (parentElement && parentElement->isStyledLocatable()) {
- TransformationMatrix parentCTM = static_cast<SVGStyledLocatableElement*>(parentElement)->getCTM();
+ AffineTransform parentCTM = static_cast<SVGStyledLocatableElement*>(parentElement)->getCTM();
ctm = parentCTM * ctm;
}
}
@@ -99,16 +99,16 @@ TransformationMatrix SVGLocatable::getCTM(const SVGElement* element)
return ctm;
}
-TransformationMatrix SVGLocatable::getScreenCTM(const SVGElement* element)
+AffineTransform SVGLocatable::getScreenCTM(const SVGElement* element)
{
ASSERT(element);
- TransformationMatrix ctm;
+ AffineTransform ctm;
Node* parent = element->parentNode();
if (parent && parent->isSVGElement()) {
SVGElement* parentElement = static_cast<SVGElement*>(parent);
if (parentElement && parentElement->isStyledLocatable()) {
- TransformationMatrix parentCTM = static_cast<SVGStyledLocatableElement*>(parentElement)->getScreenCTM();
+ AffineTransform parentCTM = static_cast<SVGStyledLocatableElement*>(parentElement)->getScreenCTM();
ctm = parentCTM * ctm;
}
}
@@ -116,12 +116,12 @@ TransformationMatrix SVGLocatable::getScreenCTM(const SVGElement* element)
return ctm;
}
-TransformationMatrix SVGLocatable::getTransformToElement(SVGElement* target, ExceptionCode& ec) const
+AffineTransform SVGLocatable::getTransformToElement(SVGElement* target, ExceptionCode& ec) const
{
- TransformationMatrix ctm = getCTM();
+ AffineTransform ctm = getCTM();
if (target && target->isStyledLocatable()) {
- TransformationMatrix targetCTM = static_cast<SVGStyledLocatableElement*>(target)->getCTM();
+ AffineTransform targetCTM = static_cast<SVGStyledLocatableElement*>(target)->getCTM();
if (!targetCTM.isInvertible()) {
ec = SVGException::SVG_MATRIX_NOT_INVERTABLE;
return ctm;
diff --git a/WebCore/svg/SVGLocatable.h b/WebCore/svg/SVGLocatable.h
index 180dae5..b7d8d30 100644
--- a/WebCore/svg/SVGLocatable.h
+++ b/WebCore/svg/SVGLocatable.h
@@ -27,32 +27,32 @@
namespace WebCore {
- class TransformationMatrix;
- class FloatRect;
- class SVGElement;
-
- class SVGLocatable {
- public:
- SVGLocatable();
- virtual ~SVGLocatable();
-
- // 'SVGLocatable' functions
- virtual SVGElement* nearestViewportElement() const = 0;
- virtual SVGElement* farthestViewportElement() const = 0;
-
- virtual FloatRect getBBox() const = 0;
- virtual TransformationMatrix getCTM() const = 0;
- virtual TransformationMatrix getScreenCTM() const = 0;
- TransformationMatrix getTransformToElement(SVGElement*, ExceptionCode&) const;
-
- static SVGElement* nearestViewportElement(const SVGElement*);
- static SVGElement* farthestViewportElement(const SVGElement*);
-
- protected:
- static FloatRect getBBox(const SVGElement*);
- static TransformationMatrix getCTM(const SVGElement*);
- static TransformationMatrix getScreenCTM(const SVGElement*);
- };
+class AffineTransform;
+class FloatRect;
+class SVGElement;
+
+class SVGLocatable {
+public:
+ SVGLocatable();
+ virtual ~SVGLocatable();
+
+ // 'SVGLocatable' functions
+ virtual SVGElement* nearestViewportElement() const = 0;
+ virtual SVGElement* farthestViewportElement() const = 0;
+
+ virtual FloatRect getBBox() const = 0;
+ virtual AffineTransform getCTM() const = 0;
+ virtual AffineTransform getScreenCTM() const = 0;
+ AffineTransform getTransformToElement(SVGElement*, ExceptionCode&) const;
+
+ static SVGElement* nearestViewportElement(const SVGElement*);
+ static SVGElement* farthestViewportElement(const SVGElement*);
+
+protected:
+ static FloatRect getBBox(const SVGElement*);
+ static AffineTransform getCTM(const SVGElement*);
+ static AffineTransform getScreenCTM(const SVGElement*);
+};
} // namespace WebCore
diff --git a/WebCore/svg/SVGMarkerElement.cpp b/WebCore/svg/SVGMarkerElement.cpp
index ca57fa6..7716af7 100644
--- a/WebCore/svg/SVGMarkerElement.cpp
+++ b/WebCore/svg/SVGMarkerElement.cpp
@@ -56,7 +56,7 @@ SVGMarkerElement::~SVGMarkerElement()
{
}
-TransformationMatrix SVGMarkerElement::viewBoxToViewTransform(float viewWidth, float viewHeight) const
+AffineTransform SVGMarkerElement::viewBoxToViewTransform(float viewWidth, float viewHeight) const
{
return SVGFitToViewBox::viewBoxToViewTransform(viewBox(), preserveAspectRatio(), viewWidth, viewHeight);
}
diff --git a/WebCore/svg/SVGMarkerElement.h b/WebCore/svg/SVGMarkerElement.h
index 8a25cba..fd5a13b 100644
--- a/WebCore/svg/SVGMarkerElement.h
+++ b/WebCore/svg/SVGMarkerElement.h
@@ -57,7 +57,7 @@ namespace WebCore {
SVGMarkerElement(const QualifiedName&, Document*);
virtual ~SVGMarkerElement();
- TransformationMatrix viewBoxToViewTransform(float viewWidth, float viewHeight) const;
+ AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const;
void setOrientToAuto();
void setOrientToAngle(const SVGAngle&);
diff --git a/WebCore/svg/SVGMaskElement.cpp b/WebCore/svg/SVGMaskElement.cpp
index 75f3dcd..86d1062 100644
--- a/WebCore/svg/SVGMaskElement.cpp
+++ b/WebCore/svg/SVGMaskElement.cpp
@@ -105,9 +105,6 @@ void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName)
{
SVGStyledElement::svgAttributeChanged(attrName);
- if (m_masker.isEmpty())
- return;
-
if (attrName == SVGNames::maskUnitsAttr || attrName == SVGNames::maskContentUnitsAttr ||
attrName == SVGNames::xAttr || attrName == SVGNames::yAttr ||
attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr ||
@@ -116,8 +113,7 @@ void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName)
SVGLangSpace::isKnownAttribute(attrName) ||
SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
SVGStyledElement::isKnownAttribute(attrName))
- for (HashMap<const RenderObject*, RefPtr<SVGResourceMasker> >::iterator it = m_masker.begin(); it != m_masker.end(); ++it)
- it->second->invalidate();
+ invalidateCanvasResources();
}
void SVGMaskElement::synchronizeProperty(const QualifiedName& attrName)
@@ -151,12 +147,7 @@ void SVGMaskElement::synchronizeProperty(const QualifiedName& attrName)
void SVGMaskElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
{
SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
-
- if (m_masker.isEmpty())
- return;
-
- for (HashMap<const RenderObject*, RefPtr<SVGResourceMasker> >::iterator it = m_masker.begin(); it != m_masker.end(); ++it)
- it->second->invalidate();
+ invalidateCanvasResources();
}
FloatRect SVGMaskElement::maskBoundingBox(const FloatRect& objectBoundingBox) const
@@ -198,7 +189,7 @@ PassOwnPtr<ImageBuffer> SVGMaskElement::drawMaskerContent(const RenderObject* ob
repaintRect.unite(node->renderer()->localToParentTransform().mapRect(node->renderer()->repaintRectInLocalCoordinates()));
}
- TransformationMatrix contextTransform;
+ AffineTransform contextTransform;
// We need to scale repaintRect for objectBoundingBox to get the drawing area.
if (maskContentUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
contextTransform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height());
@@ -285,6 +276,15 @@ SVGResource* SVGMaskElement::canvasResource(const RenderObject* object)
return maskerPtr;
}
+void SVGMaskElement::invalidateCanvasResources()
+{
+ // Don't call through to the base class since the base class will just
+ // invalidate one item in the HashMap.
+ HashMap<const RenderObject*, RefPtr<SVGResourceMasker> >::const_iterator end = m_masker.end();
+ for (HashMap<const RenderObject*, RefPtr<SVGResourceMasker> >::const_iterator it = m_masker.begin(); it != end; ++it)
+ it->second->invalidate();
+}
+
}
#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGMaskElement.h b/WebCore/svg/SVGMaskElement.h
index 3abc08b..005fa4f 100644
--- a/WebCore/svg/SVGMaskElement.h
+++ b/WebCore/svg/SVGMaskElement.h
@@ -71,6 +71,8 @@ namespace WebCore {
// SVGExternalResourcesRequired
DECLARE_ANIMATED_PROPERTY(SVGMaskElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired)
+ virtual void invalidateCanvasResources();
+
HashMap<const RenderObject*, RefPtr<SVGResourceMasker> > m_masker;
};
diff --git a/WebCore/svg/SVGMatrix.idl b/WebCore/svg/SVGMatrix.idl
index d064aa9..1b91d53 100644
--- a/WebCore/svg/SVGMatrix.idl
+++ b/WebCore/svg/SVGMatrix.idl
@@ -22,9 +22,9 @@
module svg {
- interface [Conditional=SVG, PODType=TransformationMatrix] SVGMatrix {
+ interface [Conditional=SVG, PODType=AffineTransform] SVGMatrix {
// FIXME: these attributes should all be floats but since we implement
- // TransformationMatrix with doubles setting these as doubles makes more sense.
+ // AffineTransform with doubles setting these as doubles makes more sense.
attribute double a;
attribute double b;
attribute double c;
diff --git a/WebCore/svg/SVGPatternElement.cpp b/WebCore/svg/SVGPatternElement.cpp
index b3c040b..7659afa 100644
--- a/WebCore/svg/SVGPatternElement.cpp
+++ b/WebCore/svg/SVGPatternElement.cpp
@@ -23,6 +23,7 @@
#if ENABLE(SVG)
#include "SVGPatternElement.h"
+#include "AffineTransform.h"
#include "Document.h"
#include "FloatConversion.h"
#include "GraphicsContext.h"
@@ -39,7 +40,6 @@
#include "SVGTransformList.h"
#include "SVGTransformable.h"
#include "SVGUnitTypes.h"
-#include "TransformationMatrix.h"
#include <math.h>
#include <wtf/MathExtras.h>
#include <wtf/OwnPtr.h>
@@ -209,13 +209,6 @@ void SVGPatternElement::buildPattern(const FloatRect& targetRect) const
attributes.width().value(this),
attributes.height().value(this));
- // Clip pattern boundaries to target boundaries
- if (patternBoundaries.width() > targetRect.width())
- patternBoundaries.setWidth(targetRect.width());
-
- if (patternBoundaries.height() > targetRect.height())
- patternBoundaries.setHeight(targetRect.height());
-
IntSize patternSize(patternBoundaries.width(), patternBoundaries.height());
clampImageBufferSizeToViewport(document()->view(), patternSize);
@@ -235,7 +228,7 @@ void SVGPatternElement::buildPattern(const FloatRect& targetRect) const
}
}
- TransformationMatrix viewBoxCTM = viewBoxToViewTransform(viewBox(), preserveAspectRatio(), patternBoundaries.width(), patternBoundaries.height());
+ AffineTransform viewBoxCTM = viewBoxToViewTransform(viewBox(), preserveAspectRatio(), patternBoundaries.width(), patternBoundaries.height());
FloatRect patternBoundariesIncludingOverflow = patternBoundaries;
// Apply objectBoundingBoxMode fixup for patternContentUnits, if viewBox is not set.
diff --git a/WebCore/svg/SVGPreserveAspectRatio.cpp b/WebCore/svg/SVGPreserveAspectRatio.cpp
index be07a26..6853a14 100644
--- a/WebCore/svg/SVGPreserveAspectRatio.cpp
+++ b/WebCore/svg/SVGPreserveAspectRatio.cpp
@@ -24,7 +24,7 @@
#if ENABLE(SVG)
#include "SVGPreserveAspectRatio.h"
-#include "TransformationMatrix.h"
+#include "AffineTransform.h"
#include "SVGParserUtilities.h"
#include "SVGSVGElement.h"
@@ -235,12 +235,12 @@ void SVGPreserveAspectRatio::transformRect(FloatRect& destRect, FloatRect& srcRe
}
}
-TransformationMatrix SVGPreserveAspectRatio::getCTM(double logicX, double logicY,
+AffineTransform SVGPreserveAspectRatio::getCTM(double logicX, double logicY,
double logicWidth, double logicHeight,
double /*physX*/, double /*physY*/,
double physWidth, double physHeight) const
{
- TransformationMatrix temp;
+ AffineTransform temp;
if (align() == SVG_PRESERVEASPECTRATIO_UNKNOWN)
return temp;
diff --git a/WebCore/svg/SVGPreserveAspectRatio.h b/WebCore/svg/SVGPreserveAspectRatio.h
index 2be053c..8ee8d07 100644
--- a/WebCore/svg/SVGPreserveAspectRatio.h
+++ b/WebCore/svg/SVGPreserveAspectRatio.h
@@ -29,7 +29,7 @@
namespace WebCore {
class String;
- class TransformationMatrix;
+ class AffineTransform;
class SVGPreserveAspectRatio {
public:
@@ -64,7 +64,7 @@ namespace WebCore {
void transformRect(FloatRect& destRect, FloatRect& srcRect);
- TransformationMatrix getCTM(double logicX, double logicY,
+ AffineTransform getCTM(double logicX, double logicY,
double logicWidth, double logicHeight,
double physX, double physY,
double physWidth, double physHeight) const;
diff --git a/WebCore/svg/SVGSVGElement.cpp b/WebCore/svg/SVGSVGElement.cpp
index eed8b54..cfe1615 100644
--- a/WebCore/svg/SVGSVGElement.cpp
+++ b/WebCore/svg/SVGSVGElement.cpp
@@ -24,6 +24,7 @@
#if ENABLE(SVG)
#include "SVGSVGElement.h"
+#include "AffineTransform.h"
#include "CSSHelper.h"
#include "CSSPropertyNames.h"
#include "Document.h"
@@ -48,7 +49,6 @@
#include "SVGZoomEvent.h"
#include "ScriptEventListener.h"
#include "SelectionController.h"
-#include "TransformationMatrix.h"
#include <wtf/StdLibExtras.h>
namespace WebCore {
@@ -119,7 +119,7 @@ FloatRect SVGSVGElement::viewport() const
}
float w = width().value(this);
float h = height().value(this);
- TransformationMatrix viewBox = viewBoxToViewTransform(w, h);
+ AffineTransform viewBox = viewBoxToViewTransform(w, h);
double wDouble = w;
double hDouble = h;
viewBox.map(_x, _y, _x, _y);
@@ -414,9 +414,9 @@ FloatPoint SVGSVGElement::createSVGPoint()
return FloatPoint();
}
-TransformationMatrix SVGSVGElement::createSVGMatrix()
+AffineTransform SVGSVGElement::createSVGMatrix()
{
- return TransformationMatrix();
+ return AffineTransform();
}
FloatRect SVGSVGElement::createSVGRect()
@@ -429,26 +429,26 @@ SVGTransform SVGSVGElement::createSVGTransform()
return SVGTransform();
}
-SVGTransform SVGSVGElement::createSVGTransformFromMatrix(const TransformationMatrix& matrix)
+SVGTransform SVGSVGElement::createSVGTransformFromMatrix(const AffineTransform& matrix)
{
return SVGTransform(matrix);
}
-TransformationMatrix SVGSVGElement::getCTM() const
+AffineTransform SVGSVGElement::getCTM() const
{
- TransformationMatrix mat;
+ AffineTransform mat;
if (!isOutermostSVG())
mat.translate(x().value(this), y().value(this));
if (attributes()->getAttributeItem(SVGNames::viewBoxAttr)) {
- TransformationMatrix viewBox = viewBoxToViewTransform(width().value(this), height().value(this));
+ AffineTransform viewBox = viewBoxToViewTransform(width().value(this), height().value(this));
mat = viewBox * mat;
}
return mat;
}
-TransformationMatrix SVGSVGElement::getScreenCTM() const
+AffineTransform SVGSVGElement::getScreenCTM() const
{
document()->updateLayoutIgnorePendingStylesheets();
FloatPoint rootLocation;
@@ -464,11 +464,11 @@ TransformationMatrix SVGSVGElement::getScreenCTM() const
rootLocation.move(x().value(this), y().value(this));
}
- TransformationMatrix mat = SVGStyledLocatableElement::getScreenCTM();
+ AffineTransform mat = SVGStyledLocatableElement::getScreenCTM();
mat.translate(rootLocation.x(), rootLocation.y());
if (attributes()->getAttributeItem(SVGNames::viewBoxAttr)) {
- TransformationMatrix viewBox = viewBoxToViewTransform(width().value(this), height().value(this));
+ AffineTransform viewBox = viewBoxToViewTransform(width().value(this), height().value(this));
mat = viewBox * mat;
}
@@ -538,7 +538,7 @@ bool SVGSVGElement::isOutermostSVG() const
return !parentNode()->isSVGElement();
}
-TransformationMatrix SVGSVGElement::viewBoxToViewTransform(float viewWidth, float viewHeight) const
+AffineTransform SVGSVGElement::viewBoxToViewTransform(float viewWidth, float viewHeight) const
{
FloatRect viewBoxRect;
if (useCurrentView()) {
@@ -547,7 +547,7 @@ TransformationMatrix SVGSVGElement::viewBoxToViewTransform(float viewWidth, floa
} else
viewBoxRect = viewBox();
- TransformationMatrix ctm = SVGFitToViewBox::viewBoxToViewTransform(viewBoxRect, preserveAspectRatio(), viewWidth, viewHeight);
+ AffineTransform ctm = SVGFitToViewBox::viewBoxToViewTransform(viewBoxRect, preserveAspectRatio(), viewWidth, viewHeight);
if (useCurrentView() && currentView())
return currentView()->transform()->concatenate().matrix() * ctm;
diff --git a/WebCore/svg/SVGSVGElement.h b/WebCore/svg/SVGSVGElement.h
index 3d6f109..dde6534 100644
--- a/WebCore/svg/SVGSVGElement.h
+++ b/WebCore/svg/SVGSVGElement.h
@@ -107,16 +107,16 @@ namespace WebCore {
static SVGLength createSVGLength();
static SVGAngle createSVGAngle();
static FloatPoint createSVGPoint();
- static TransformationMatrix createSVGMatrix();
+ static AffineTransform createSVGMatrix();
static FloatRect createSVGRect();
static SVGTransform createSVGTransform();
- static SVGTransform createSVGTransformFromMatrix(const TransformationMatrix&);
+ static SVGTransform createSVGTransformFromMatrix(const AffineTransform&);
virtual void parseMappedAttribute(MappedAttribute*);
// 'virtual SVGLocatable' functions
- virtual TransformationMatrix getCTM() const;
- virtual TransformationMatrix getScreenCTM() const;
+ virtual AffineTransform getCTM() const;
+ virtual AffineTransform getScreenCTM() const;
virtual bool rendererIsNeeded(RenderStyle* style) { return StyledElement::rendererIsNeeded(style); }
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
@@ -127,7 +127,7 @@ namespace WebCore {
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
- TransformationMatrix viewBoxToViewTransform(float viewWidth, float viewHeight) const;
+ AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const;
void inheritViewAttributes(SVGViewElement*);
diff --git a/WebCore/svg/SVGStyledElement.cpp b/WebCore/svg/SVGStyledElement.cpp
index 4228a4c..be1ba9c 100644
--- a/WebCore/svg/SVGStyledElement.cpp
+++ b/WebCore/svg/SVGStyledElement.cpp
@@ -251,15 +251,19 @@ void SVGStyledElement::invalidateResourcesInAncestorChain() const
break;
SVGElement* element = static_cast<SVGElement*>(node);
- if (SVGStyledElement* styledElement = static_cast<SVGStyledElement*>(element->isStyled() ? element : 0)) {
- if (SVGResource* resource = styledElement->canvasResource(node->renderer()))
- resource->invalidate();
- }
+ if (SVGStyledElement* styledElement = static_cast<SVGStyledElement*>(element->isStyled() ? element : 0))
+ styledElement->invalidateCanvasResources();
node = node->parentNode();
}
}
+void SVGStyledElement::invalidateCanvasResources()
+{
+ if (SVGResource* resource = canvasResource(renderer()))
+ resource->invalidate();
+}
+
void SVGStyledElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
{
SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
diff --git a/WebCore/svg/SVGStyledElement.h b/WebCore/svg/SVGStyledElement.h
index 9f76c68..aec3e75 100644
--- a/WebCore/svg/SVGStyledElement.h
+++ b/WebCore/svg/SVGStyledElement.h
@@ -71,6 +71,8 @@ namespace WebCore {
protected:
static int cssPropertyIdForSVGAttributeName(const QualifiedName&);
+ virtual void invalidateCanvasResources();
+
private:
DECLARE_ANIMATED_PROPERTY(SVGStyledElement, HTMLNames::classAttr, String, ClassName, className)
};
diff --git a/WebCore/svg/SVGStyledLocatableElement.cpp b/WebCore/svg/SVGStyledLocatableElement.cpp
index a48082c..79b1fe3 100644
--- a/WebCore/svg/SVGStyledLocatableElement.cpp
+++ b/WebCore/svg/SVGStyledLocatableElement.cpp
@@ -23,9 +23,9 @@
#if ENABLE(SVG)
#include "SVGStyledLocatableElement.h"
+#include "AffineTransform.h"
#include "RenderPath.h"
#include "SVGElement.h"
-#include "TransformationMatrix.h"
#include "SVGSVGElement.h"
namespace WebCore {
@@ -55,12 +55,12 @@ FloatRect SVGStyledLocatableElement::getBBox() const
return SVGLocatable::getBBox(this);
}
-TransformationMatrix SVGStyledLocatableElement::getCTM() const
+AffineTransform SVGStyledLocatableElement::getCTM() const
{
return SVGLocatable::getCTM(this);
}
-TransformationMatrix SVGStyledLocatableElement::getScreenCTM() const
+AffineTransform SVGStyledLocatableElement::getScreenCTM() const
{
return SVGLocatable::getScreenCTM(this);
}
diff --git a/WebCore/svg/SVGStyledLocatableElement.h b/WebCore/svg/SVGStyledLocatableElement.h
index 3902c73..5e835bd 100644
--- a/WebCore/svg/SVGStyledLocatableElement.h
+++ b/WebCore/svg/SVGStyledLocatableElement.h
@@ -41,8 +41,8 @@ namespace WebCore {
virtual SVGElement* farthestViewportElement() const;
virtual FloatRect getBBox() const;
- virtual TransformationMatrix getCTM() const;
- virtual TransformationMatrix getScreenCTM() const;
+ virtual AffineTransform getCTM() const;
+ virtual AffineTransform getScreenCTM() const;
};
} // namespace WebCore
diff --git a/WebCore/svg/SVGStyledTransformableElement.cpp b/WebCore/svg/SVGStyledTransformableElement.cpp
index 6815914..a71cd16 100644
--- a/WebCore/svg/SVGStyledTransformableElement.cpp
+++ b/WebCore/svg/SVGStyledTransformableElement.cpp
@@ -23,13 +23,13 @@
#if ENABLE(SVG)
#include "SVGStyledTransformableElement.h"
+#include "AffineTransform.h"
#include "Attr.h"
#include "MappedAttribute.h"
#include "RenderPath.h"
#include "SVGDocument.h"
#include "SVGStyledElement.h"
#include "SVGTransformList.h"
-#include "TransformationMatrix.h"
namespace WebCore {
@@ -44,25 +44,25 @@ SVGStyledTransformableElement::~SVGStyledTransformableElement()
{
}
-TransformationMatrix SVGStyledTransformableElement::getCTM() const
+AffineTransform SVGStyledTransformableElement::getCTM() const
{
return SVGTransformable::getCTM(this);
}
-TransformationMatrix SVGStyledTransformableElement::getScreenCTM() const
+AffineTransform SVGStyledTransformableElement::getScreenCTM() const
{
return SVGTransformable::getScreenCTM(this);
}
-TransformationMatrix SVGStyledTransformableElement::animatedLocalTransform() const
+AffineTransform SVGStyledTransformableElement::animatedLocalTransform() const
{
return m_supplementalTransform ? transform()->concatenate().matrix() * *m_supplementalTransform : transform()->concatenate().matrix();
}
-TransformationMatrix* SVGStyledTransformableElement::supplementalTransform()
+AffineTransform* SVGStyledTransformableElement::supplementalTransform()
{
if (!m_supplementalTransform)
- m_supplementalTransform.set(new TransformationMatrix());
+ m_supplementalTransform.set(new AffineTransform());
return m_supplementalTransform.get();
}
diff --git a/WebCore/svg/SVGStyledTransformableElement.h b/WebCore/svg/SVGStyledTransformableElement.h
index b6ab6dd..ee204ad 100644
--- a/WebCore/svg/SVGStyledTransformableElement.h
+++ b/WebCore/svg/SVGStyledTransformableElement.h
@@ -28,42 +28,42 @@
namespace WebCore {
- class TransformationMatrix;
-
- class SVGStyledTransformableElement : public SVGStyledLocatableElement,
- public SVGTransformable {
- public:
- SVGStyledTransformableElement(const QualifiedName&, Document*);
- virtual ~SVGStyledTransformableElement();
-
- virtual bool isStyledTransformable() const { return true; }
-
- virtual TransformationMatrix getCTM() const;
- virtual TransformationMatrix getScreenCTM() const;
- virtual SVGElement* nearestViewportElement() const;
- virtual SVGElement* farthestViewportElement() const;
-
- virtual TransformationMatrix animatedLocalTransform() const;
- virtual TransformationMatrix* supplementalTransform();
-
- virtual FloatRect getBBox() const;
-
- virtual void parseMappedAttribute(MappedAttribute*);
- virtual void synchronizeProperty(const QualifiedName&);
- bool isKnownAttribute(const QualifiedName&);
-
- // "base class" methods for all the elements which render as paths
- virtual Path toPathData() const { return Path(); }
- virtual Path toClipPath() const;
- virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
-
- protected:
- DECLARE_ANIMATED_PROPERTY(SVGStyledTransformableElement, SVGNames::transformAttr, SVGTransformList*, Transform, transform)
-
- private:
- // Used by <animateMotion>
- OwnPtr<TransformationMatrix> m_supplementalTransform;
- };
+class AffineTransform;
+
+class SVGStyledTransformableElement : public SVGStyledLocatableElement,
+ public SVGTransformable {
+public:
+ SVGStyledTransformableElement(const QualifiedName&, Document*);
+ virtual ~SVGStyledTransformableElement();
+
+ virtual bool isStyledTransformable() const { return true; }
+
+ virtual AffineTransform getCTM() const;
+ virtual AffineTransform getScreenCTM() const;
+ virtual SVGElement* nearestViewportElement() const;
+ virtual SVGElement* farthestViewportElement() const;
+
+ virtual AffineTransform animatedLocalTransform() const;
+ virtual AffineTransform* supplementalTransform();
+
+ virtual FloatRect getBBox() const;
+
+ virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void synchronizeProperty(const QualifiedName&);
+ bool isKnownAttribute(const QualifiedName&);
+
+ // "base class" methods for all the elements which render as paths
+ virtual Path toPathData() const { return Path(); }
+ virtual Path toClipPath() const;
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+
+protected:
+ DECLARE_ANIMATED_PROPERTY(SVGStyledTransformableElement, SVGNames::transformAttr, SVGTransformList*, Transform, transform)
+
+private:
+ // Used by <animateMotion>
+ OwnPtr<AffineTransform> m_supplementalTransform;
+};
} // namespace WebCore
diff --git a/WebCore/svg/SVGTextContentElement.cpp b/WebCore/svg/SVGTextContentElement.cpp
index 167d241..b28536b 100644
--- a/WebCore/svg/SVGTextContentElement.cpp
+++ b/WebCore/svg/SVGTextContentElement.cpp
@@ -124,7 +124,7 @@ struct SVGInlineTextBoxQueryWalker {
{
}
- void chunkPortionCallback(SVGInlineTextBox* textBox, int startOffset, const TransformationMatrix&,
+ void chunkPortionCallback(SVGInlineTextBox* textBox, int startOffset, const AffineTransform&,
const Vector<SVGChar>::iterator& start, const Vector<SVGChar>::iterator& end)
{
RenderStyle* style = textBox->textRenderer()->style();
diff --git a/WebCore/svg/SVGTextElement.cpp b/WebCore/svg/SVGTextElement.cpp
index 7de34fe..96fd11a 100644
--- a/WebCore/svg/SVGTextElement.cpp
+++ b/WebCore/svg/SVGTextElement.cpp
@@ -23,6 +23,7 @@
#if ENABLE(SVG)
#include "SVGTextElement.h"
+#include "AffineTransform.h"
#include "FloatRect.h"
#include "MappedAttribute.h"
#include "RenderSVGText.h"
@@ -30,7 +31,6 @@
#include "SVGRenderStyle.h"
#include "SVGTSpanElement.h"
#include "SVGTransformList.h"
-#include "TransformationMatrix.h"
namespace WebCore {
@@ -72,25 +72,25 @@ FloatRect SVGTextElement::getBBox() const
return SVGTransformable::getBBox(this);
}
-TransformationMatrix SVGTextElement::getScreenCTM() const
+AffineTransform SVGTextElement::getScreenCTM() const
{
return SVGTransformable::getScreenCTM(this);
}
-TransformationMatrix SVGTextElement::getCTM() const
+AffineTransform SVGTextElement::getCTM() const
{
return SVGTransformable::getCTM(this);
}
-TransformationMatrix SVGTextElement::animatedLocalTransform() const
+AffineTransform SVGTextElement::animatedLocalTransform() const
{
return m_supplementalTransform ? transform()->concatenate().matrix() * *m_supplementalTransform : transform()->concatenate().matrix();
}
-TransformationMatrix* SVGTextElement::supplementalTransform()
+AffineTransform* SVGTextElement::supplementalTransform()
{
if (!m_supplementalTransform)
- m_supplementalTransform.set(new TransformationMatrix());
+ m_supplementalTransform.set(new AffineTransform());
return m_supplementalTransform.get();
}
diff --git a/WebCore/svg/SVGTextElement.h b/WebCore/svg/SVGTextElement.h
index 217964a..4fca6bf 100644
--- a/WebCore/svg/SVGTextElement.h
+++ b/WebCore/svg/SVGTextElement.h
@@ -39,10 +39,10 @@ namespace WebCore {
virtual SVGElement* farthestViewportElement() const;
virtual FloatRect getBBox() const;
- virtual TransformationMatrix getCTM() const;
- virtual TransformationMatrix getScreenCTM() const;
- virtual TransformationMatrix animatedLocalTransform() const;
- virtual TransformationMatrix* supplementalTransform();
+ virtual AffineTransform getCTM() const;
+ virtual AffineTransform getScreenCTM() const;
+ virtual AffineTransform animatedLocalTransform() const;
+ virtual AffineTransform* supplementalTransform();
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
virtual bool childShouldCreateRenderer(Node*) const;
@@ -55,7 +55,7 @@ namespace WebCore {
DECLARE_ANIMATED_PROPERTY(SVGTextElement, SVGNames::transformAttr, SVGTransformList*, Transform, transform)
// Used by <animateMotion>
- OwnPtr<TransformationMatrix> m_supplementalTransform;
+ OwnPtr<AffineTransform> m_supplementalTransform;
};
} // namespace WebCore
diff --git a/WebCore/svg/SVGTextPathElement.cpp b/WebCore/svg/SVGTextPathElement.cpp
index eec6fc8..a428a44 100644
--- a/WebCore/svg/SVGTextPathElement.cpp
+++ b/WebCore/svg/SVGTextPathElement.cpp
@@ -22,6 +22,7 @@
#if ENABLE(SVG)
#include "SVGTextPathElement.h"
+#include "AffineTransform.h"
#include "FloatRect.h"
#include "MappedAttribute.h"
#include "RenderSVGTextPath.h"
@@ -29,7 +30,6 @@
#include "SVGPathElement.h"
#include "SVGRenderStyle.h"
#include "SVGTransformList.h"
-#include "TransformationMatrix.h"
namespace WebCore {
diff --git a/WebCore/svg/SVGTransform.cpp b/WebCore/svg/SVGTransform.cpp
index 9fe770c..1af0cd9 100644
--- a/WebCore/svg/SVGTransform.cpp
+++ b/WebCore/svg/SVGTransform.cpp
@@ -41,11 +41,11 @@ SVGTransform::SVGTransform(SVGTransformType type)
: m_type(type)
, m_angle(0)
, m_center(FloatPoint())
- , m_matrix(TransformationMatrix())
+ , m_matrix(AffineTransform())
{
}
-SVGTransform::SVGTransform(const TransformationMatrix& matrix)
+SVGTransform::SVGTransform(const AffineTransform& matrix)
: m_type(SVG_TRANSFORM_MATRIX)
, m_angle(0)
, m_matrix(matrix)
@@ -66,7 +66,7 @@ SVGTransform::SVGTransformType SVGTransform::type() const
return m_type;
}
-TransformationMatrix SVGTransform::matrix() const
+AffineTransform SVGTransform::matrix() const
{
return m_matrix;
}
@@ -81,7 +81,7 @@ FloatPoint SVGTransform::rotationCenter() const
return m_center;
}
-void SVGTransform::setMatrix(TransformationMatrix matrix) //const TransformationMatrix& matrix)
+void SVGTransform::setMatrix(AffineTransform matrix)
{
m_type = SVG_TRANSFORM_MATRIX;
m_angle = 0;
@@ -149,6 +149,5 @@ void SVGTransform::setSkewY(float angle)
m_matrix.skewY(angle);
}
-// vim:ts=4:noet
#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGTransform.h b/WebCore/svg/SVGTransform.h
index aad7a60..88912c2 100644
--- a/WebCore/svg/SVGTransform.h
+++ b/WebCore/svg/SVGTransform.h
@@ -22,7 +22,7 @@
#define SVGTransform_h
#if ENABLE(SVG)
-#include "TransformationMatrix.h"
+#include "AffineTransform.h"
#include "FloatPoint.h"
#include "SVGNames.h"
@@ -44,17 +44,17 @@ namespace WebCore {
SVGTransform();
SVGTransform(SVGTransformType);
- explicit SVGTransform(const TransformationMatrix&);
+ explicit SVGTransform(const AffineTransform&);
virtual ~SVGTransform();
SVGTransformType type() const;
- TransformationMatrix matrix() const;
+ AffineTransform matrix() const;
float angle() const;
FloatPoint rotationCenter() const;
- void setMatrix(TransformationMatrix);
+ void setMatrix(AffineTransform);
void setTranslate(float tx, float ty);
void setScale(float sx, float sy);
@@ -72,7 +72,7 @@ namespace WebCore {
SVGTransformType m_type;
float m_angle;
FloatPoint m_center;
- TransformationMatrix m_matrix;
+ AffineTransform m_matrix;
};
inline bool operator==(const SVGTransform& a, const SVGTransform& b)
diff --git a/WebCore/svg/SVGTransformDistance.cpp b/WebCore/svg/SVGTransformDistance.cpp
index 00b5387..51dfd74 100644
--- a/WebCore/svg/SVGTransformDistance.cpp
+++ b/WebCore/svg/SVGTransformDistance.cpp
@@ -40,7 +40,7 @@ SVGTransformDistance::SVGTransformDistance()
{
}
-SVGTransformDistance::SVGTransformDistance(SVGTransform::SVGTransformType type, float angle, float cx, float cy, const TransformationMatrix& transform)
+SVGTransformDistance::SVGTransformDistance(SVGTransform::SVGTransformType type, float angle, float cx, float cy, const AffineTransform& transform)
: m_type(type)
, m_angle(angle)
, m_cx(cx)
@@ -97,20 +97,20 @@ SVGTransformDistance SVGTransformDistance::scaledDistance(float scaleFactor) con
case SVGTransform::SVG_TRANSFORM_UNKNOWN:
return SVGTransformDistance();
case SVGTransform::SVG_TRANSFORM_ROTATE:
- return SVGTransformDistance(m_type, m_angle * scaleFactor, m_cx * scaleFactor, m_cy * scaleFactor, TransformationMatrix());
+ return SVGTransformDistance(m_type, m_angle * scaleFactor, m_cx * scaleFactor, m_cy * scaleFactor, AffineTransform());
case SVGTransform::SVG_TRANSFORM_SCALE:
case SVGTransform::SVG_TRANSFORM_MATRIX:
- return SVGTransformDistance(m_type, m_angle * scaleFactor, m_cx * scaleFactor, m_cy * scaleFactor, TransformationMatrix(m_transform).scale(scaleFactor));
+ return SVGTransformDistance(m_type, m_angle * scaleFactor, m_cx * scaleFactor, m_cy * scaleFactor, AffineTransform(m_transform).scale(scaleFactor));
case SVGTransform::SVG_TRANSFORM_TRANSLATE:
{
- TransformationMatrix newTransform(m_transform);
+ AffineTransform newTransform(m_transform);
newTransform.setE(m_transform.e() * scaleFactor);
newTransform.setF(m_transform.f() * scaleFactor);
return SVGTransformDistance(m_type, 0, 0, 0, newTransform);
}
case SVGTransform::SVG_TRANSFORM_SKEWX:
case SVGTransform::SVG_TRANSFORM_SKEWY:
- return SVGTransformDistance(m_type, m_angle * scaleFactor, m_cx * scaleFactor, m_cy * scaleFactor, TransformationMatrix());
+ return SVGTransformDistance(m_type, m_angle * scaleFactor, m_cx * scaleFactor, m_cy * scaleFactor, AffineTransform());
}
ASSERT_NOT_REACHED();
@@ -251,7 +251,7 @@ SVGTransform SVGTransformDistance::addToSVGTransform(const SVGTransform& transfo
bool SVGTransformDistance::isZero() const
{
- return (m_transform == TransformationMatrix() && m_angle == 0);
+ return (m_transform == AffineTransform() && m_angle == 0);
}
float SVGTransformDistance::distance() const
diff --git a/WebCore/svg/SVGTransformDistance.h b/WebCore/svg/SVGTransformDistance.h
index 470e2eb..7c54dc7 100644
--- a/WebCore/svg/SVGTransformDistance.h
+++ b/WebCore/svg/SVGTransformDistance.h
@@ -27,31 +27,31 @@
namespace WebCore {
- class TransformationMatrix;
-
- class SVGTransformDistance {
- public:
- SVGTransformDistance();
- SVGTransformDistance(const SVGTransform& fromTransform, const SVGTransform& toTransform);
-
- SVGTransformDistance scaledDistance(float scaleFactor) const;
- SVGTransform addToSVGTransform(const SVGTransform&) const;
- void addSVGTransform(const SVGTransform&, bool absoluteValue = false);
-
- static SVGTransform addSVGTransforms(const SVGTransform&, const SVGTransform&);
-
- bool isZero() const;
+class AffineTransform;
+
+class SVGTransformDistance {
+public:
+ SVGTransformDistance();
+ SVGTransformDistance(const SVGTransform& fromTransform, const SVGTransform& toTransform);
+
+ SVGTransformDistance scaledDistance(float scaleFactor) const;
+ SVGTransform addToSVGTransform(const SVGTransform&) const;
+ void addSVGTransform(const SVGTransform&, bool absoluteValue = false);
+
+ static SVGTransform addSVGTransforms(const SVGTransform&, const SVGTransform&);
+
+ bool isZero() const;
+
+ float distance() const;
+private:
+ SVGTransformDistance(SVGTransform::SVGTransformType, float angle, float cx, float cy, const AffineTransform&);
- float distance() const;
- private:
- SVGTransformDistance(SVGTransform::SVGTransformType, float angle, float cx, float cy, const TransformationMatrix&);
-
- SVGTransform::SVGTransformType m_type;
- float m_angle;
- float m_cx;
- float m_cy;
- TransformationMatrix m_transform; // for storing scale, translation or matrix transforms
- };
+ SVGTransform::SVGTransformType m_type;
+ float m_angle;
+ float m_cx;
+ float m_cy;
+ AffineTransform m_transform; // for storing scale, translation or matrix transforms
+};
}
#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGTransformList.cpp b/WebCore/svg/SVGTransformList.cpp
index f4f0965..38dbc9a 100644
--- a/WebCore/svg/SVGTransformList.cpp
+++ b/WebCore/svg/SVGTransformList.cpp
@@ -21,11 +21,12 @@
#include "config.h"
#if ENABLE(SVG)
-#include "TransformationMatrix.h"
-#include "SVGTransform.h"
-#include "SVGSVGElement.h"
#include "SVGTransformList.h"
+#include "AffineTransform.h"
+#include "SVGSVGElement.h"
+#include "SVGTransform.h"
+
using namespace WebCore;
SVGTransformList::SVGTransformList(const QualifiedName& attributeName)
@@ -37,7 +38,7 @@ SVGTransformList::~SVGTransformList()
{
}
-SVGTransform SVGTransformList::createSVGTransformFromMatrix(const TransformationMatrix& matrix) const
+SVGTransform SVGTransformList::createSVGTransformFromMatrix(const AffineTransform& matrix) const
{
return SVGSVGElement::createSVGTransformFromMatrix(matrix);
}
@@ -54,7 +55,7 @@ SVGTransform SVGTransformList::concatenate() const
if (!length)
return SVGTransform();
- TransformationMatrix matrix;
+ AffineTransform matrix;
ExceptionCode ec = 0;
for (unsigned int i = 0; i < length; i++)
matrix = getItem(i, ec).matrix() * matrix;
@@ -67,7 +68,7 @@ String SVGTransformList::valueAsString() const
// TODO: We may want to build a real transform string, instead of concatting to a matrix(...).
SVGTransform transform = concatenate();
if (transform.type() == SVGTransform::SVG_TRANSFORM_MATRIX) {
- TransformationMatrix matrix = transform.matrix();
+ AffineTransform matrix = transform.matrix();
return String::format("matrix(%f %f %f %f %f %f)", matrix.a(), matrix.b(), matrix.c(), matrix.d(), matrix.e(), matrix.f());
}
diff --git a/WebCore/svg/SVGTransformList.h b/WebCore/svg/SVGTransformList.h
index 9aea524..683f0f7 100644
--- a/WebCore/svg/SVGTransformList.h
+++ b/WebCore/svg/SVGTransformList.h
@@ -35,7 +35,7 @@ namespace WebCore {
static PassRefPtr<SVGTransformList> create(const QualifiedName& attributeName) { return adoptRef(new SVGTransformList(attributeName)); }
virtual ~SVGTransformList();
- SVGTransform createSVGTransformFromMatrix(const TransformationMatrix&) const;
+ SVGTransform createSVGTransformFromMatrix(const AffineTransform&) const;
SVGTransform consolidate();
// Internal use only
diff --git a/WebCore/svg/SVGTransformable.cpp b/WebCore/svg/SVGTransformable.cpp
index 78afbc8..d710a34 100644
--- a/WebCore/svg/SVGTransformable.cpp
+++ b/WebCore/svg/SVGTransformable.cpp
@@ -26,7 +26,7 @@
#if ENABLE(SVG)
#include "SVGTransformable.h"
-#include "TransformationMatrix.h"
+#include "AffineTransform.h"
#include "FloatConversion.h"
#include "SVGNames.h"
#include "SVGParserUtilities.h"
@@ -43,15 +43,15 @@ SVGTransformable::~SVGTransformable()
{
}
-TransformationMatrix SVGTransformable::getCTM(const SVGElement* element) const
+AffineTransform SVGTransformable::getCTM(const SVGElement* element) const
{
- TransformationMatrix ctm = SVGLocatable::getCTM(element);
+ AffineTransform ctm = SVGLocatable::getCTM(element);
return animatedLocalTransform() * ctm;
}
-TransformationMatrix SVGTransformable::getScreenCTM(const SVGElement* element) const
+AffineTransform SVGTransformable::getScreenCTM(const SVGElement* element) const
{
- TransformationMatrix ctm = SVGLocatable::getScreenCTM(element);
+ AffineTransform ctm = SVGLocatable::getScreenCTM(element);
return animatedLocalTransform() * ctm;
}
@@ -147,7 +147,7 @@ bool SVGTransformable::parseTransformValue(unsigned type, const UChar*& ptr, con
t.setRotate(values[0], values[1], values[2]);
break;
case SVGTransform::SVG_TRANSFORM_MATRIX:
- t.setMatrix(TransformationMatrix(values[0], values[1], values[2], values[3], values[4], values[5]));
+ t.setMatrix(AffineTransform(values[0], values[1], values[2], values[3], values[4], values[5]));
break;
}
diff --git a/WebCore/svg/SVGTransformable.h b/WebCore/svg/SVGTransformable.h
index a74eff7..7579fa9 100644
--- a/WebCore/svg/SVGTransformable.h
+++ b/WebCore/svg/SVGTransformable.h
@@ -28,33 +28,33 @@
namespace WebCore {
- class TransformationMatrix;
- class AtomicString;
- class SVGTransform;
- class QualifiedName;
-
- class SVGTransformable : virtual public SVGLocatable {
- public:
- SVGTransformable();
- virtual ~SVGTransformable();
-
- enum TransformParsingMode {
- ClearList,
- DoNotClearList
- };
-
- static bool parseTransformAttribute(SVGTransformList*, const AtomicString& transform);
- static bool parseTransformAttribute(SVGTransformList*, const UChar*& ptr, const UChar* end, TransformParsingMode mode = ClearList);
- static bool parseTransformValue(unsigned type, const UChar*& ptr, const UChar* end, SVGTransform&);
-
- TransformationMatrix getCTM(const SVGElement*) const;
- TransformationMatrix getScreenCTM(const SVGElement*) const;
-
- virtual TransformationMatrix animatedLocalTransform() const = 0;
-
- bool isKnownAttribute(const QualifiedName&);
+class AffineTransform;
+class AtomicString;
+class SVGTransform;
+class QualifiedName;
+
+class SVGTransformable : virtual public SVGLocatable {
+public:
+ SVGTransformable();
+ virtual ~SVGTransformable();
+
+ enum TransformParsingMode {
+ ClearList,
+ DoNotClearList
};
+ static bool parseTransformAttribute(SVGTransformList*, const AtomicString& transform);
+ static bool parseTransformAttribute(SVGTransformList*, const UChar*& ptr, const UChar* end, TransformParsingMode mode = ClearList);
+ static bool parseTransformValue(unsigned type, const UChar*& ptr, const UChar* end, SVGTransform&);
+
+ AffineTransform getCTM(const SVGElement*) const;
+ AffineTransform getScreenCTM(const SVGElement*) const;
+
+ virtual AffineTransform animatedLocalTransform() const = 0;
+
+ bool isKnownAttribute(const QualifiedName&);
+};
+
} // namespace WebCore
#endif // ENABLE(SVG)
diff --git a/WebCore/svg/graphics/SVGPaintServer.cpp b/WebCore/svg/graphics/SVGPaintServer.cpp
index 9d84b0e..fdb6581 100644
--- a/WebCore/svg/graphics/SVGPaintServer.cpp
+++ b/WebCore/svg/graphics/SVGPaintServer.cpp
@@ -151,7 +151,7 @@ SVGPaintServer* SVGPaintServer::strokePaintServer(const RenderStyle* style, cons
return strokePaintServer;
}
-void applyStrokeStyleToContext(GraphicsContext* context, RenderStyle* style, const RenderObject* object)
+void applyStrokeStyleToContext(GraphicsContext* context, const RenderStyle* style, const RenderObject* object)
{
context->setStrokeThickness(SVGRenderStyle::cssPrimitiveToLength(object, style->svgStyle()->strokeWidth(), 1.0f));
context->setLineCap(style->svgStyle()->capStyle());
@@ -164,6 +164,11 @@ void applyStrokeStyleToContext(GraphicsContext* context, RenderStyle* style, con
context->setLineDash(dashes, dashOffset);
}
+bool SVGPaintServer::setup(GraphicsContext*& context, const RenderObject* object, SVGPaintTargetType type, bool isPaintingText) const
+{
+ return setup(context, object, object ? object->style() : 0, type, isPaintingText);
+}
+
void SVGPaintServer::draw(GraphicsContext*& context, const RenderObject* path, SVGPaintTargetType type) const
{
if (!setup(context, path, type))
diff --git a/WebCore/svg/graphics/SVGPaintServer.h b/WebCore/svg/graphics/SVGPaintServer.h
index 6e8997c..d9d2218 100644
--- a/WebCore/svg/graphics/SVGPaintServer.h
+++ b/WebCore/svg/graphics/SVGPaintServer.h
@@ -71,7 +71,9 @@ namespace WebCore {
virtual void teardown(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText = false) const;
virtual void renderPath(GraphicsContext*&, const RenderObject*, SVGPaintTargetType) const;
- virtual bool setup(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText = false) const = 0;
+ virtual bool setup(GraphicsContext*&, const RenderObject*, const RenderStyle*, SVGPaintTargetType, bool isPaintingText = false) const = 0;
+
+ bool setup(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText = false) const;
static SVGPaintServer* strokePaintServer(const RenderStyle*, const RenderObject*);
static SVGPaintServer* fillPaintServer(const RenderStyle*, const RenderObject*);
@@ -85,7 +87,7 @@ namespace WebCore {
SVGPaintServer* getPaintServerById(Document*, const AtomicString&, const RenderObject*);
- void applyStrokeStyleToContext(GraphicsContext*, RenderStyle*, const RenderObject*);
+ void applyStrokeStyleToContext(GraphicsContext*, const RenderStyle*, const RenderObject*);
DashArray dashArrayFromRenderingStyle(const RenderStyle* style, RenderStyle* rootStyle);
} // namespace WebCore
diff --git a/WebCore/svg/graphics/SVGPaintServerGradient.cpp b/WebCore/svg/graphics/SVGPaintServerGradient.cpp
index 6c58a82..c4ed95b 100644
--- a/WebCore/svg/graphics/SVGPaintServerGradient.cpp
+++ b/WebCore/svg/graphics/SVGPaintServerGradient.cpp
@@ -106,12 +106,12 @@ void SVGPaintServerGradient::setBoundingBoxMode(bool mode)
m_boundingBoxMode = mode;
}
-TransformationMatrix SVGPaintServerGradient::gradientTransform() const
+AffineTransform SVGPaintServerGradient::gradientTransform() const
{
return m_gradientTransform;
}
-void SVGPaintServerGradient::setGradientTransform(const TransformationMatrix& transform)
+void SVGPaintServerGradient::setGradientTransform(const AffineTransform& transform)
{
m_gradientTransform = transform;
}
@@ -127,71 +127,75 @@ static inline const RenderObject* findTextRootObject(const RenderObject* start)
return start;
}
+static inline AffineTransform absoluteTransformForRenderer(const RenderObject* object)
+{
+ AffineTransform absoluteTransform;
+
+ const RenderObject* currentObject = object;
+ while (currentObject) {
+ absoluteTransform = currentObject->localToParentTransform() * absoluteTransform;
+ currentObject = currentObject->parent();
+ }
+
+ return absoluteTransform;
+}
+
static inline bool createMaskAndSwapContextForTextGradient(
GraphicsContext*& context, GraphicsContext*& savedContext,
OwnPtr<ImageBuffer>& imageBuffer, const RenderObject* object)
{
- FloatRect maskBBox = const_cast<RenderObject*>(findTextRootObject(object))->objectBoundingBox();
- IntRect maskRect = enclosingIntRect(object->absoluteTransform().mapRect(maskBBox));
+ const RenderObject* textRootBlock = findTextRootObject(object);
- IntSize maskSize(maskRect.width(), maskRect.height());
- clampImageBufferSizeToViewport(object->view()->frameView(), maskSize);
+ AffineTransform transform = absoluteTransformForRenderer(textRootBlock);
+ FloatRect maskAbsoluteBoundingBox = transform.mapRect(textRootBlock->repaintRectInLocalCoordinates());
- OwnPtr<ImageBuffer> maskImage = ImageBuffer::create(maskSize);
+ IntRect maskImageRect = enclosingIntRect(maskAbsoluteBoundingBox);
+ if (maskImageRect.isEmpty())
+ return false;
+ // Allocate an image buffer as big as the absolute unclipped size of the object
+ OwnPtr<ImageBuffer> maskImage = ImageBuffer::create(maskImageRect.size());
if (!maskImage)
return false;
GraphicsContext* maskImageContext = maskImage->context();
- maskImageContext->save();
- maskImageContext->translate(-maskRect.x(), -maskRect.y());
- maskImageContext->concatCTM(object->absoluteTransform());
+ // Transform the mask image coordinate system to absolute screen coordinates
+ maskImageContext->translate(-maskAbsoluteBoundingBox.x(), -maskAbsoluteBoundingBox.y());
+ maskImageContext->concatCTM(transform);
imageBuffer.set(maskImage.release());
savedContext = context;
-
context = maskImageContext;
return true;
}
-static inline TransformationMatrix clipToTextMask(GraphicsContext* context,
+static inline AffineTransform clipToTextMask(GraphicsContext* context,
OwnPtr<ImageBuffer>& imageBuffer, const RenderObject* object,
const SVGPaintServerGradient* gradientServer)
{
- FloatRect maskBBox = const_cast<RenderObject*>(findTextRootObject(object))->objectBoundingBox();
-
- // Fixup transformations to be able to clip to mask
- TransformationMatrix transform = object->absoluteTransform();
- FloatRect textBoundary = transform.mapRect(maskBBox);
-
- IntSize maskSize(lroundf(textBoundary.width()), lroundf(textBoundary.height()));
- clampImageBufferSizeToViewport(object->view()->frameView(), maskSize);
- textBoundary.setSize(textBoundary.size().shrunkTo(maskSize));
-
- // Clip current context to mask image (gradient)
- context->concatCTM(transform.inverse());
- context->clipToImageBuffer(textBoundary, imageBuffer.get());
- context->concatCTM(transform);
+ const RenderObject* textRootBlock = findTextRootObject(object);
+ context->clipToImageBuffer(textRootBlock->repaintRectInLocalCoordinates(), imageBuffer.get());
- TransformationMatrix matrix;
+ AffineTransform matrix;
if (gradientServer->boundingBoxMode()) {
- matrix.translate(maskBBox.x(), maskBBox.y());
- matrix.scaleNonUniform(maskBBox.width(), maskBBox.height());
+ FloatRect maskBoundingBox = textRootBlock->objectBoundingBox();
+ matrix.translate(maskBoundingBox.x(), maskBoundingBox.y());
+ matrix.scaleNonUniform(maskBoundingBox.width(), maskBoundingBox.height());
}
matrix.multiply(gradientServer->gradientTransform());
return matrix;
}
#endif
-bool SVGPaintServerGradient::setup(GraphicsContext*& context, const RenderObject* object, SVGPaintTargetType type, bool isPaintingText) const
+bool SVGPaintServerGradient::setup(GraphicsContext*& context, const RenderObject* object, const RenderStyle*style, SVGPaintTargetType type, bool isPaintingText) const
{
m_ownerElement->buildGradient();
- const SVGRenderStyle* style = object->style()->svgStyle();
- bool isFilled = (type & ApplyToFillTargetType) && style->hasFill();
- bool isStroked = (type & ApplyToStrokeTargetType) && style->hasStroke();
+ const SVGRenderStyle* svgStyle = style->svgStyle();
+ bool isFilled = (type & ApplyToFillTargetType) && svgStyle->hasFill();
+ bool isStroked = (type & ApplyToStrokeTargetType) && svgStyle->hasStroke();
ASSERT((isFilled && !isStroked) || (!isFilled && isStroked));
@@ -208,17 +212,17 @@ bool SVGPaintServerGradient::setup(GraphicsContext*& context, const RenderObject
}
if (isFilled) {
- context->setAlpha(style->fillOpacity());
+ context->setAlpha(svgStyle->fillOpacity());
context->setFillGradient(m_gradient);
- context->setFillRule(style->fillRule());
+ context->setFillRule(svgStyle->fillRule());
}
if (isStroked) {
- context->setAlpha(style->strokeOpacity());
+ context->setAlpha(svgStyle->strokeOpacity());
context->setStrokeGradient(m_gradient);
- applyStrokeStyleToContext(context, object->style(), object);
+ applyStrokeStyleToContext(context, style, object);
}
- TransformationMatrix matrix;
+ AffineTransform matrix;
// CG platforms will handle the gradient space transform for text in
// teardown, so we don't apply it here. For non-CG platforms, we
// want the text bounding box applied to the gradient space transform now,
@@ -233,7 +237,7 @@ bool SVGPaintServerGradient::setup(GraphicsContext*& context, const RenderObject
// lines or rectangles without width or height.
if (bbox.width() == 0 || bbox.height() == 0) {
Color color(0, 0, 0);
- context->setStrokeColor(color, object->style()->colorSpace());
+ context->setStrokeColor(color, style->colorSpace());
return true;
}
matrix.translate(bbox.x(), bbox.y());
@@ -250,20 +254,18 @@ void SVGPaintServerGradient::teardown(GraphicsContext*& context, const RenderObj
#if PLATFORM(CG)
// renderPath() is not used when painting text, so we paint the gradient during teardown()
if (isPaintingText && m_savedContext) {
-
// Restore on-screen drawing context
context = m_savedContext;
m_savedContext = 0;
- TransformationMatrix matrix = clipToTextMask(context, m_imageBuffer, object, this);
+ AffineTransform matrix = clipToTextMask(context, m_imageBuffer, object, this);
m_gradient->setGradientSpaceTransform(matrix);
context->setFillGradient(m_gradient);
+
+ const RenderObject* textRootBlock = findTextRootObject(object);
+ context->fillRect(textRootBlock->repaintRectInLocalCoordinates());
- FloatRect maskBBox = const_cast<RenderObject*>(findTextRootObject(object))->objectBoundingBox();
-
- context->fillRect(maskBBox);
-
- m_imageBuffer.clear(); // we're done with our text mask buffer
+ m_imageBuffer.clear();
}
#endif
context->restore();
diff --git a/WebCore/svg/graphics/SVGPaintServerGradient.h b/WebCore/svg/graphics/SVGPaintServerGradient.h
index b24c417..953b0d9 100644
--- a/WebCore/svg/graphics/SVGPaintServerGradient.h
+++ b/WebCore/svg/graphics/SVGPaintServerGradient.h
@@ -29,7 +29,7 @@
#if ENABLE(SVG)
-#include "TransformationMatrix.h"
+#include "AffineTransform.h"
#include "Color.h"
#include "Gradient.h"
#include "GraphicsContext.h"
@@ -58,15 +58,15 @@ namespace WebCore {
bool boundingBoxMode() const;
void setBoundingBoxMode(bool mode = true);
- TransformationMatrix gradientTransform() const;
- void setGradientTransform(const TransformationMatrix&);
+ AffineTransform gradientTransform() const;
+ void setGradientTransform(const AffineTransform&);
void setGradientStops(const Vector<SVGGradientStop>& stops) { m_stops = stops; }
const Vector<SVGGradientStop>& gradientStops() const { return m_stops; }
virtual TextStream& externalRepresentation(TextStream&) const;
- virtual bool setup(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText) const;
+ virtual bool setup(GraphicsContext*&, const RenderObject*, const RenderStyle*, SVGPaintTargetType, bool isPaintingText) const;
virtual void teardown(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText) const;
protected:
@@ -76,7 +76,7 @@ namespace WebCore {
Vector<SVGGradientStop> m_stops;
RefPtr<Gradient> m_gradient;
bool m_boundingBoxMode;
- TransformationMatrix m_gradientTransform;
+ AffineTransform m_gradientTransform;
const SVGGradientElement* m_ownerElement;
#if PLATFORM(CG)
diff --git a/WebCore/svg/graphics/SVGPaintServerPattern.cpp b/WebCore/svg/graphics/SVGPaintServerPattern.cpp
index 28706ba..7fc75fb 100644
--- a/WebCore/svg/graphics/SVGPaintServerPattern.cpp
+++ b/WebCore/svg/graphics/SVGPaintServerPattern.cpp
@@ -29,6 +29,7 @@
#if ENABLE(SVG)
#include "SVGPaintServerPattern.h"
+#include "AffineTransform.h"
#include "GraphicsContext.h"
#include "Image.h"
#include "ImageBuffer.h"
@@ -36,7 +37,6 @@
#include "RenderObject.h"
#include "SVGPatternElement.h"
#include "SVGRenderTreeAsText.h"
-#include "TransformationMatrix.h"
using namespace std;
@@ -73,12 +73,12 @@ void SVGPaintServerPattern::setTile(PassOwnPtr<ImageBuffer> tile)
m_tile = tile;
}
-TransformationMatrix SVGPaintServerPattern::patternTransform() const
+AffineTransform SVGPaintServerPattern::patternTransform() const
{
return m_patternTransform;
}
-void SVGPaintServerPattern::setPatternTransform(const TransformationMatrix& transform)
+void SVGPaintServerPattern::setPatternTransform(const AffineTransform& transform)
{
m_patternTransform = transform;
}
@@ -95,13 +95,13 @@ TextStream& SVGPaintServerPattern::externalRepresentation(TextStream& ts) const
return ts;
}
-bool SVGPaintServerPattern::setup(GraphicsContext*& context, const RenderObject* object, SVGPaintTargetType type, bool isPaintingText) const
+bool SVGPaintServerPattern::setup(GraphicsContext*& context, const RenderObject* object, const RenderStyle* style, SVGPaintTargetType type, bool isPaintingText) const
{
FloatRect targetRect = object->objectBoundingBox();
- const SVGRenderStyle* style = object->style()->svgStyle();
- bool isFilled = (type & ApplyToFillTargetType) && style->hasFill();
- bool isStroked = (type & ApplyToStrokeTargetType) && style->hasStroke();
+ const SVGRenderStyle* svgStyle = style->svgStyle();
+ bool isFilled = (type & ApplyToFillTargetType) && svgStyle->hasFill();
+ bool isStroked = (type & ApplyToStrokeTargetType) && svgStyle->hasStroke();
ASSERT((isFilled && !isStroked) || (!isFilled && isStroked));
@@ -131,7 +131,7 @@ bool SVGPaintServerPattern::setup(GraphicsContext*& context, const RenderObject*
tileImageContext->translate(0, patternBoundaries().height());
for (int j = numX; j > 0; j--) {
tileImageContext->translate(patternBoundaries().width(), 0);
- tileImageContext->drawImage(tile()->image(), object->style()->colorSpace(), tileRect, tileRect);
+ tileImageContext->drawImage(tile()->image(), style->colorSpace(), tileRect, tileRect);
}
tileImageContext->translate(-patternBoundaries().width() * numX, 0);
}
@@ -143,17 +143,17 @@ bool SVGPaintServerPattern::setup(GraphicsContext*& context, const RenderObject*
m_pattern = Pattern::create(tile()->image(), true, true);
if (isFilled) {
- context->setAlpha(style->fillOpacity());
+ context->setAlpha(svgStyle->fillOpacity());
context->setFillPattern(m_pattern);
- context->setFillRule(style->fillRule());
+ context->setFillRule(svgStyle->fillRule());
}
if (isStroked) {
- context->setAlpha(style->strokeOpacity());
+ context->setAlpha(svgStyle->strokeOpacity());
context->setStrokePattern(m_pattern);
- applyStrokeStyleToContext(context, object->style(), object);
+ applyStrokeStyleToContext(context, style, object);
}
- TransformationMatrix matrix;
+ AffineTransform matrix;
matrix.translate(patternBoundaries().x(), patternBoundaries().y());
matrix.multiply(patternTransform());
m_pattern->setPatternSpaceTransform(matrix);
diff --git a/WebCore/svg/graphics/SVGPaintServerPattern.h b/WebCore/svg/graphics/SVGPaintServerPattern.h
index 253e012..3d3da49 100644
--- a/WebCore/svg/graphics/SVGPaintServerPattern.h
+++ b/WebCore/svg/graphics/SVGPaintServerPattern.h
@@ -28,7 +28,7 @@
#if ENABLE(SVG)
-#include "TransformationMatrix.h"
+#include "AffineTransform.h"
#include "FloatRect.h"
#include "Pattern.h"
#include "SVGPaintServer.h"
@@ -59,12 +59,12 @@ namespace WebCore {
ImageBuffer* tile() const;
void setTile(PassOwnPtr<ImageBuffer>);
- TransformationMatrix patternTransform() const;
- void setPatternTransform(const TransformationMatrix&);
+ AffineTransform patternTransform() const;
+ void setPatternTransform(const AffineTransform&);
virtual TextStream& externalRepresentation(TextStream&) const;
- virtual bool setup(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText) const;
+ virtual bool setup(GraphicsContext*&, const RenderObject*, const RenderStyle*, SVGPaintTargetType, bool isPaintingText) const;
virtual void teardown(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText) const;
private:
@@ -72,7 +72,7 @@ namespace WebCore {
OwnPtr<ImageBuffer> m_tile;
const SVGPatternElement* m_ownerElement;
- TransformationMatrix m_patternTransform;
+ AffineTransform m_patternTransform;
FloatRect m_patternBoundaries;
mutable RefPtr<Pattern> m_pattern;
diff --git a/WebCore/svg/graphics/SVGPaintServerSolid.cpp b/WebCore/svg/graphics/SVGPaintServerSolid.cpp
index 72baad2..8921bb0 100644
--- a/WebCore/svg/graphics/SVGPaintServerSolid.cpp
+++ b/WebCore/svg/graphics/SVGPaintServerSolid.cpp
@@ -60,9 +60,8 @@ TextStream& SVGPaintServerSolid::externalRepresentation(TextStream& ts) const
return ts;
}
-bool SVGPaintServerSolid::setup(GraphicsContext*& context, const RenderObject* object, SVGPaintTargetType type, bool isPaintingText) const
+bool SVGPaintServerSolid::setup(GraphicsContext*& context, const RenderObject* object, const RenderStyle* style, SVGPaintTargetType type, bool isPaintingText) const
{
- RenderStyle* style = object ? object->style() : 0;
const SVGRenderStyle* svgStyle = style ? style->svgStyle() : 0;
ColorSpace colorSpace = style ? style->colorSpace() : DeviceColorSpace;
diff --git a/WebCore/svg/graphics/SVGPaintServerSolid.h b/WebCore/svg/graphics/SVGPaintServerSolid.h
index 0166c87..680b0fe 100644
--- a/WebCore/svg/graphics/SVGPaintServerSolid.h
+++ b/WebCore/svg/graphics/SVGPaintServerSolid.h
@@ -45,7 +45,7 @@ namespace WebCore {
virtual TextStream& externalRepresentation(TextStream&) const;
- virtual bool setup(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText) const;
+ virtual bool setup(GraphicsContext*&, const RenderObject*, const RenderStyle*, SVGPaintTargetType, bool isPaintingText) const;
private:
SVGPaintServerSolid();
diff --git a/WebCore/svg/graphics/SVGResourceClipper.cpp b/WebCore/svg/graphics/SVGResourceClipper.cpp
index c0fccaf..5316c95 100644
--- a/WebCore/svg/graphics/SVGResourceClipper.cpp
+++ b/WebCore/svg/graphics/SVGResourceClipper.cpp
@@ -29,9 +29,9 @@
#if ENABLE(SVG)
#include "SVGResourceClipper.h"
+#include "AffineTransform.h"
#include "GraphicsContext.h"
#include "SVGRenderTreeAsText.h"
-#include "TransformationMatrix.h"
#if PLATFORM(CG)
#include <ApplicationServices/ApplicationServices.h>
@@ -101,7 +101,7 @@ void SVGResourceClipper::applyClip(GraphicsContext* context, const FloatRect& bo
Path clipPath = clipData.path;
if (clipData.bboxUnits) {
- TransformationMatrix transform;
+ AffineTransform transform;
transform.translate(boundingBox.x(), boundingBox.y());
transform.scaleNonUniform(boundingBox.width(), boundingBox.height());
clipPath.transform(transform);
diff --git a/WebCore/svg/graphics/SVGResourceMarker.cpp b/WebCore/svg/graphics/SVGResourceMarker.cpp
index 955c048..2c036a4 100644
--- a/WebCore/svg/graphics/SVGResourceMarker.cpp
+++ b/WebCore/svg/graphics/SVGResourceMarker.cpp
@@ -28,7 +28,7 @@
#if ENABLE(SVG)
#include "SVGResourceMarker.h"
-#include "TransformationMatrix.h"
+#include "AffineTransform.h"
#include "GraphicsContext.h"
#include "RenderSVGViewportContainer.h"
#include "TextStream.h"
@@ -48,18 +48,18 @@ SVGResourceMarker::~SVGResourceMarker()
{
}
-TransformationMatrix SVGResourceMarker::markerTransformation(const FloatPoint& origin, float angle, float strokeWidth) const
+AffineTransform SVGResourceMarker::markerTransformation(const FloatPoint& origin, float angle, float strokeWidth) const
{
ASSERT(m_renderer);
- TransformationMatrix transform;
+ AffineTransform transform;
transform.translate(origin.x(), origin.y());
transform.rotate(m_angle == -1 ? angle : m_angle);
transform = m_renderer->markerContentTransformation(transform, m_referencePoint, m_useStrokeWidth ? strokeWidth : -1);
return transform;
}
-void SVGResourceMarker::draw(RenderObject::PaintInfo& paintInfo, const TransformationMatrix& transform)
+void SVGResourceMarker::draw(RenderObject::PaintInfo& paintInfo, const AffineTransform& transform)
{
if (!m_renderer)
return;
diff --git a/WebCore/svg/graphics/SVGResourceMarker.h b/WebCore/svg/graphics/SVGResourceMarker.h
index 5c98d2f..f2ce33d 100644
--- a/WebCore/svg/graphics/SVGResourceMarker.h
+++ b/WebCore/svg/graphics/SVGResourceMarker.h
@@ -35,7 +35,7 @@
namespace WebCore {
class RenderSVGViewportContainer;
- class TransformationMatrix;
+ class AffineTransform;
class SVGResourceMarker : public SVGResource {
public:
@@ -55,8 +55,8 @@ namespace WebCore {
void setUseStrokeWidth(bool useStrokeWidth = true) { m_useStrokeWidth = useStrokeWidth; }
bool useStrokeWidth() const { return m_useStrokeWidth; }
- TransformationMatrix markerTransformation(const FloatPoint& origin, float angle, float strokeWidth) const;
- void draw(RenderObject::PaintInfo&, const TransformationMatrix&);
+ AffineTransform markerTransformation(const FloatPoint& origin, float angle, float strokeWidth) const;
+ void draw(RenderObject::PaintInfo&, const AffineTransform&);
virtual SVGResourceType resourceType() const { return MarkerResourceType; }
virtual TextStream& externalRepresentation(TextStream&) const;
diff --git a/WebCore/svg/graphics/filters/SVGFEImage.cpp b/WebCore/svg/graphics/filters/SVGFEImage.cpp
index 331de4f..950203a 100644
--- a/WebCore/svg/graphics/filters/SVGFEImage.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEImage.cpp
@@ -25,11 +25,11 @@
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFEImage.h"
+#include "AffineTransform.h"
#include "Filter.h"
#include "GraphicsContext.h"
#include "SVGPreserveAspectRatio.h"
#include "SVGRenderTreeAsText.h"
-#include "TransformationMatrix.h"
namespace WebCore {
diff --git a/WebCore/svg/graphics/filters/SVGFETile.cpp b/WebCore/svg/graphics/filters/SVGFETile.cpp
index 42da34d..5bc2129 100644
--- a/WebCore/svg/graphics/filters/SVGFETile.cpp
+++ b/WebCore/svg/graphics/filters/SVGFETile.cpp
@@ -23,10 +23,10 @@
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFETile.h"
+#include "AffineTransform.h"
#include "Filter.h"
#include "GraphicsContext.h"
#include "Pattern.h"
-#include "TransformationMatrix.h"
#include "SVGRenderTreeAsText.h"
namespace WebCore {
@@ -75,7 +75,7 @@ void FETile::apply(Filter* filter)
tileImageContext->drawImage(m_in->resultImage()->image(), DeviceColorSpace, IntPoint());
RefPtr<Pattern> pattern = Pattern::create(tileImage->image(), true, true);
- TransformationMatrix matrix;
+ AffineTransform matrix;
matrix.translate(m_in->scaledSubRegion().x() - scaledSubRegion().x(), m_in->scaledSubRegion().y() - scaledSubRegion().y());
pattern.get()->setPatternSpaceTransform(matrix);
diff --git a/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.h b/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.h
index 8bf51fa..28d6129 100644
--- a/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.h
+++ b/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.h
@@ -99,10 +99,10 @@ public:
m_client->didReceiveMessage(msg);
}
- void didClose()
+ void didClose(unsigned long unhandledBufferedAmount)
{
if (m_client)
- m_client->didClose();
+ m_client->didClose(unhandledBufferedAmount);
}
protected:
diff --git a/WebCore/websockets/WebSocket.cpp b/WebCore/websockets/WebSocket.cpp
index f50dc5c..5a64b71 100644
--- a/WebCore/websockets/WebSocket.cpp
+++ b/WebCore/websockets/WebSocket.cpp
@@ -97,6 +97,7 @@ bool WebSocket::isAvailable()
WebSocket::WebSocket(ScriptExecutionContext* context)
: ActiveDOMObject(context, this)
, m_state(CONNECTING)
+ , m_bufferedAmountAfterClose(0)
{
}
@@ -162,9 +163,12 @@ bool WebSocket::send(const String& message, ExceptionCode& ec)
return false;
}
// No exception is raised if the connection was once established but has subsequently been closed.
- if (m_state == CLOSED)
+ if (m_state == CLOSED) {
+ m_bufferedAmountAfterClose += message.utf8().length() + 2; // 2 for framing
return false;
+ }
// FIXME: check message is valid utf8.
+ ASSERT(m_channel);
return m_channel->send(message);
}
@@ -174,6 +178,7 @@ void WebSocket::close()
if (m_state == CLOSED)
return;
m_state = CLOSED;
+ m_bufferedAmountAfterClose = m_channel->bufferedAmount();
m_channel->close();
}
@@ -191,7 +196,7 @@ unsigned long WebSocket::bufferedAmount() const
{
if (m_state == OPEN)
return m_channel->bufferedAmount();
- return 0;
+ return m_bufferedAmountAfterClose;
}
ScriptExecutionContext* WebSocket::scriptExecutionContext() const
@@ -223,7 +228,7 @@ void WebSocket::didConnect()
{
LOG(Network, "WebSocket %p didConnect", this);
if (m_state != CONNECTING || !scriptExecutionContext()) {
- didClose();
+ didClose(0);
return;
}
m_state = OPEN;
@@ -240,10 +245,11 @@ void WebSocket::didReceiveMessage(const String& msg)
dispatchEvent(evt);
}
-void WebSocket::didClose()
+void WebSocket::didClose(unsigned long unhandledBufferedAmount)
{
LOG(Network, "WebSocket %p didClose", this);
m_state = CLOSED;
+ m_bufferedAmountAfterClose += unhandledBufferedAmount;
dispatchEvent(Event::create(eventNames().closeEvent, false, false));
m_channel = 0;
if (hasPendingActivity())
diff --git a/WebCore/websockets/WebSocket.h b/WebCore/websockets/WebSocket.h
index c72dbbd..8bda882 100644
--- a/WebCore/websockets/WebSocket.h
+++ b/WebCore/websockets/WebSocket.h
@@ -91,7 +91,7 @@ namespace WebCore {
// WebSocketChannelClient
virtual void didConnect();
virtual void didReceiveMessage(const String& message);
- virtual void didClose();
+ virtual void didClose(unsigned long unhandledBufferedAmount);
private:
WebSocket(ScriptExecutionContext*);
@@ -111,6 +111,7 @@ namespace WebCore {
KURL m_url;
String m_protocol;
EventTargetData m_eventTargetData;
+ unsigned long m_bufferedAmountAfterClose;
};
} // namespace WebCore
diff --git a/WebCore/websockets/WebSocketChannel.cpp b/WebCore/websockets/WebSocketChannel.cpp
index df66c14..2ab133c 100644
--- a/WebCore/websockets/WebSocketChannel.cpp
+++ b/WebCore/websockets/WebSocketChannel.cpp
@@ -57,7 +57,6 @@ WebSocketChannel::WebSocketChannel(ScriptExecutionContext* context, WebSocketCha
, m_handshake(url, protocol, context)
, m_buffer(0)
, m_bufferSize(0)
- , m_unhandledBufferSize(0)
{
}
@@ -78,22 +77,18 @@ void WebSocketChannel::connect()
bool WebSocketChannel::send(const String& msg)
{
LOG(Network, "WebSocketChannel %p send %s", this, msg.utf8().data());
+ ASSERT(m_handle);
Vector<char> buf;
buf.append('\0'); // frame type
buf.append(msg.utf8().data(), msg.utf8().length());
buf.append('\xff'); // frame end
- if (!m_handle) {
- m_unhandledBufferSize += buf.size();
- return false;
- }
return m_handle->send(buf.data(), buf.size());
}
unsigned long WebSocketChannel::bufferedAmount() const
{
LOG(Network, "WebSocketChannel %p bufferedAmount", this);
- if (!m_handle)
- return m_unhandledBufferSize;
+ ASSERT(m_handle);
return m_handle->bufferedAmount();
}
@@ -126,14 +121,14 @@ void WebSocketChannel::didOpen(SocketStreamHandle* handle)
void WebSocketChannel::didClose(SocketStreamHandle* handle)
{
LOG(Network, "WebSocketChannel %p didClose", this);
- ASSERT(handle == m_handle || !m_handle);
+ ASSERT_UNUSED(handle, handle == m_handle || !m_handle);
if (m_handle) {
- m_unhandledBufferSize = handle->bufferedAmount();
+ unsigned long unhandledBufferedAmount = m_handle->bufferedAmount();
WebSocketChannelClient* client = m_client;
m_client = 0;
m_handle = 0;
if (client)
- client->didClose();
+ client->didClose(unhandledBufferedAmount);
}
deref();
}
diff --git a/WebCore/websockets/WebSocketChannel.h b/WebCore/websockets/WebSocketChannel.h
index 7ec826c..41a03ab 100644
--- a/WebCore/websockets/WebSocketChannel.h
+++ b/WebCore/websockets/WebSocketChannel.h
@@ -83,7 +83,6 @@ namespace WebCore {
RefPtr<SocketStreamHandle> m_handle;
char* m_buffer;
int m_bufferSize;
- unsigned long m_unhandledBufferSize;
};
} // namespace WebCore
diff --git a/WebCore/websockets/WebSocketChannelClient.h b/WebCore/websockets/WebSocketChannelClient.h
index 163070f..5328eb7 100644
--- a/WebCore/websockets/WebSocketChannelClient.h
+++ b/WebCore/websockets/WebSocketChannelClient.h
@@ -40,7 +40,7 @@ namespace WebCore {
virtual ~WebSocketChannelClient() { }
virtual void didConnect() { }
virtual void didReceiveMessage(const String&) { }
- virtual void didClose() { }
+ virtual void didClose(unsigned long /* unhandledBufferedAmount */) { }
protected:
WebSocketChannelClient() { }
diff --git a/WebCore/websockets/WebSocketHandshake.cpp b/WebCore/websockets/WebSocketHandshake.cpp
index 883f84b..4471096 100644
--- a/WebCore/websockets/WebSocketHandshake.cpp
+++ b/WebCore/websockets/WebSocketHandshake.cpp
@@ -36,6 +36,7 @@
#include "AtomicString.h"
#include "CString.h"
+#include "Cookie.h"
#include "CookieJar.h"
#include "Document.h"
#include "HTTPHeaderMap.h"
@@ -186,7 +187,7 @@ CString WebSocketHandshake::clientHandshakeMessage() const
// Set "Authorization: <credentials>" if authentication information exists for url.
if (m_context->isDocument()) {
Document* document = static_cast<Document*>(m_context);
- String cookie = cookies(document, url);
+ String cookie = cookieRequestHeaderFieldValue(document, url);
if (!cookie.isEmpty()) {
builder.append("Cookie: ");
builder.append(cookie);
diff --git a/WebCore/websockets/WorkerThreadableWebSocketChannel.cpp b/WebCore/websockets/WorkerThreadableWebSocketChannel.cpp
index 8db81b7..3dda104 100644
--- a/WebCore/websockets/WorkerThreadableWebSocketChannel.cpp
+++ b/WebCore/websockets/WorkerThreadableWebSocketChannel.cpp
@@ -84,7 +84,7 @@ unsigned long WorkerThreadableWebSocketChannel::bufferedAmount() const
void WorkerThreadableWebSocketChannel::close()
{
- if (!m_bridge)
+ if (m_bridge)
m_bridge->close();
}
@@ -190,17 +190,17 @@ void WorkerThreadableWebSocketChannel::Peer::didReceiveMessage(const String& mes
m_loaderProxy.postTaskForModeToWorkerContext(createCallbackTask(&workerContextDidReceiveMessage, m_workerClientWrapper, message), m_taskMode);
}
-static void workerContextDidClose(ScriptExecutionContext* context, RefPtr<ThreadableWebSocketChannelClientWrapper> workerClientWrapper)
+static void workerContextDidClose(ScriptExecutionContext* context, RefPtr<ThreadableWebSocketChannelClientWrapper> workerClientWrapper, unsigned long unhandledBufferedAmount)
{
ASSERT_UNUSED(context, context->isWorkerContext());
- workerClientWrapper->didClose();
+ workerClientWrapper->didClose(unhandledBufferedAmount);
}
-void WorkerThreadableWebSocketChannel::Peer::didClose()
+void WorkerThreadableWebSocketChannel::Peer::didClose(unsigned long unhandledBufferedAmount)
{
ASSERT(isMainThread());
m_mainWebSocketChannel = 0;
- m_loaderProxy.postTaskForModeToWorkerContext(createCallbackTask(&workerContextDidClose, m_workerClientWrapper), m_taskMode);
+ m_loaderProxy.postTaskForModeToWorkerContext(createCallbackTask(&workerContextDidClose, m_workerClientWrapper, unhandledBufferedAmount), m_taskMode);
}
void WorkerThreadableWebSocketChannel::Bridge::setWebSocketChannel(ScriptExecutionContext* context, Bridge* thisPtr, Peer* peer, RefPtr<ThreadableWebSocketChannelClientWrapper> workerClientWrapper)
diff --git a/WebCore/websockets/WorkerThreadableWebSocketChannel.h b/WebCore/websockets/WorkerThreadableWebSocketChannel.h
index 1106f43..a6a1680 100644
--- a/WebCore/websockets/WorkerThreadableWebSocketChannel.h
+++ b/WebCore/websockets/WorkerThreadableWebSocketChannel.h
@@ -91,7 +91,7 @@ private:
virtual void didConnect();
virtual void didReceiveMessage(const String& message);
- virtual void didClose();
+ virtual void didClose(unsigned long unhandledBufferedAmount);
private:
Peer(RefPtr<ThreadableWebSocketChannelClientWrapper>, WorkerLoaderProxy&, ScriptExecutionContext*, const String& taskMode, const KURL&, const String& protocol);
diff --git a/WebCore/wml/WMLInputElement.cpp b/WebCore/wml/WMLInputElement.cpp
index 560fd09..979a294 100644
--- a/WebCore/wml/WMLInputElement.cpp
+++ b/WebCore/wml/WMLInputElement.cpp
@@ -123,10 +123,10 @@ const AtomicString& WMLInputElement::formControlName() const
return m_data.name();
}
-const String& WMLInputElement::suggestedValue() const
-{
- return m_data.suggestedValue();
-}
+const String& WMLInputElement::suggestedValue() const
+{
+ return m_data.suggestedValue();
+}
String WMLInputElement::value() const
{
diff --git a/WebCore/wml/WMLInputElement.h b/WebCore/wml/WMLInputElement.h
index 217d9c7..eea633b 100644
--- a/WebCore/wml/WMLInputElement.h
+++ b/WebCore/wml/WMLInputElement.h
@@ -56,7 +56,7 @@ public:
virtual int size() const;
virtual const AtomicString& formControlType() const;
virtual const AtomicString& formControlName() const;
- virtual const String& suggestedValue() const;
+ virtual const String& suggestedValue() const;
virtual String value() const;
virtual void setValue(const String&, bool sendChangeEvent = false);
virtual void setValueForUser(const String&);
diff --git a/WebCore/wscript b/WebCore/wscript
index 19cc392..8aa279c 100644
--- a/WebCore/wscript
+++ b/WebCore/wscript
@@ -33,10 +33,10 @@ if build_port == "wx":
if building_on_win32:
webcore_dirs.extend(['platform/wx/wxcode/win', 'plugins/win'])
webcore_sources['wx-win'] = [
+ 'platform/graphics/win/TransformationMatrixWin.cpp',
# wxTimer on Windows has a bug that causes it to eat crashes in callbacks
# so we need to use the Win port's implementation until the wx bug fix is
# widely available (it was fixed in 2.8.10).
- 'platform/graphics/win/TransformationMatrixWin.cpp',
'platform/win/SharedTimerWin.cpp',
# Use the Windows plugin architecture
'page/win/PageWin.cpp',
@@ -53,6 +53,7 @@ if build_port == "wx":
webcore_sources['wx-mac'] = [
'platform/mac/WebCoreNSStringExtras.mm',
'platform/mac/PurgeableBufferMac.cpp',
+ 'platform/wx/wxcode/mac/carbon/fontprops.mm',
'plugins/wx/PluginDataWx.cpp',
'plugins/mac/PluginPackageMac.cpp',
'plugins/mac/PluginViewMac.cpp'
@@ -90,6 +91,13 @@ def set_options(opt):
def configure(conf):
common_configure(conf)
generate_webcore_derived_sources()
+ if sys.platform.startswith('win'):
+ graphics_dir = os.path.join(wk_root, 'WebCore', 'platform', 'graphics')
+ # HACK ALERT: MSVC automatically adds the source file's directory as the first entry in the
+ # path. Unfortunately, that means when compiling these files we will end up including
+ # win/FontPlatformData.h, which breaks wx compilation. So we copy the files to the wx dir.
+ for afile in ['UniscribeController.h', 'UniscribeController.cpp', 'GlyphPageTreeNodeCairoWin.cpp']:
+ shutil.copy(os.path.join(graphics_dir, 'win', afile), os.path.join(graphics_dir, 'wx'))
def build(bld):
import Options
@@ -106,9 +114,11 @@ def build(bld):
]
features = [build_port]
- exclude_patterns = ['*None.cpp', '*CFNet.cpp', '*Qt.cpp', '*Win.cpp', '*Wince.cpp', '*Gtk.cpp', '*Mac.cpp', '*Safari.cpp', '*Chromium*.cpp','*SVG*.cpp', '*AllInOne.cpp', 'test*bindings.*']
+ exclude_patterns = ['*None.cpp', '*CFNet.cpp', '*Qt.cpp', '*Wince.cpp', '*Gtk.cpp', '*Mac.cpp', '*Safari.cpp', '*Chromium*.cpp','*SVG*.cpp', '*AllInOne.cpp', 'test*bindings.*']
if build_port == 'wx':
features.append('curl')
+ if not building_on_win32:
+ exclude_patterns.append('*Win.cpp')
if sys.platform.startswith('darwin'):
features.append('cf')
@@ -126,6 +136,8 @@ def build(bld):
wk_includes.append(os.path.join(jscore_dir, 'wtf', 'unicode'))
wk_includes.append(os.path.join(jscore_dir, 'wtf', 'unicode', 'icu'))
wk_includes += common_includes + full_dirs
+ if sys.platform.startswith('darwin'):
+ wk_includes.append(os.path.join(webcore_dir, 'icu'))
cxxflags = []
if building_on_win32:
@@ -168,6 +180,9 @@ def build(bld):
excludes.append('JSInspectorController.cpp')
if building_on_win32:
excludes.append('SharedTimerWx.cpp')
+ excludes.append('GlyphMapWx.cpp')
+ excludes.append('RenderThemeWin.cpp')
+ excludes.append('KeyEventWin.cpp')
excludes.append('AuthenticationCF.cpp')
excludes.append('LoaderRunLoopCF.cpp')
diff --git a/WebCore/xml/XSLImportRule.cpp b/WebCore/xml/XSLImportRule.cpp
index c0f6363..0908d75 100644
--- a/WebCore/xml/XSLImportRule.cpp
+++ b/WebCore/xml/XSLImportRule.cpp
@@ -87,14 +87,14 @@ void XSLImportRule::loadSheet()
String absHref = m_strHref;
XSLStyleSheet* parentSheet = parentStyleSheet();
- if (!parentSheet->putativeBaseURL().isNull())
+ if (!parentSheet->finalURL().isNull())
// use parent styleheet's URL as the base URL
- absHref = KURL(parentSheet->putativeBaseURL(), m_strHref).string();
+ absHref = KURL(parentSheet->finalURL(), m_strHref).string();
// Check for a cycle in our import chain. If we encounter a stylesheet
// in our parent chain with the same URL, then just bail.
for (parent = this->parent(); parent; parent = parent->parent()) {
- if (parent->isXSLStyleSheet() && absHref == static_cast<XSLStyleSheet*>(parent)->putativeBaseURL().string())
+ if (parent->isXSLStyleSheet() && absHref == static_cast<XSLStyleSheet*>(parent)->finalURL().string())
return;
}
diff --git a/WebCore/xml/XSLStyleSheet.h b/WebCore/xml/XSLStyleSheet.h
index b3861a0..e6e4063 100644
--- a/WebCore/xml/XSLStyleSheet.h
+++ b/WebCore/xml/XSLStyleSheet.h
@@ -43,18 +43,18 @@ class XSLImportRule;
class XSLStyleSheet : public StyleSheet {
public:
#if !USE(QXMLQUERY)
- static PassRefPtr<XSLStyleSheet> create(XSLImportRule* parentImport, const String& href, const KURL& baseURL)
+ static PassRefPtr<XSLStyleSheet> create(XSLImportRule* parentImport, const String& originalURL, const KURL& finalURL)
{
- return adoptRef(new XSLStyleSheet(parentImport, href, baseURL));
+ return adoptRef(new XSLStyleSheet(parentImport, originalURL, finalURL));
}
#endif
- static PassRefPtr<XSLStyleSheet> create(Node* parentNode, const String& href, const KURL& baseURL)
+ static PassRefPtr<XSLStyleSheet> create(Node* parentNode, const String& originalURL, const KURL& finalURL)
{
- return adoptRef(new XSLStyleSheet(parentNode, href, baseURL, false));
+ return adoptRef(new XSLStyleSheet(parentNode, originalURL, finalURL, false));
}
- static PassRefPtr<XSLStyleSheet> createEmbedded(Node* parentNode, const String& href, const KURL& baseURL)
+ static PassRefPtr<XSLStyleSheet> createInline(Node* parentNode, const KURL& finalURL)
{
- return adoptRef(new XSLStyleSheet(parentNode, href, baseURL, true));
+ return adoptRef(new XSLStyleSheet(parentNode, finalURL.string(), finalURL, true));
}
virtual ~XSLStyleSheet();
@@ -90,9 +90,9 @@ public:
bool processed() const { return m_processed; }
private:
- XSLStyleSheet(Node* parentNode, const String& href, const KURL& baseURL, bool embedded);
+ XSLStyleSheet(Node* parentNode, const String& originalURL, const KURL& finalURL, bool embedded);
#if !USE(QXMLQUERY)
- XSLStyleSheet(XSLImportRule* parentImport, const String& href, const KURL& baseURL);
+ XSLStyleSheet(XSLImportRule* parentImport, const String& originalURL, const KURL& finalURL);
#endif
Document* m_ownerDocument;
diff --git a/WebCore/xml/XSLStyleSheetLibxslt.cpp b/WebCore/xml/XSLStyleSheetLibxslt.cpp
index 4122aa1..dbd806a 100644
--- a/WebCore/xml/XSLStyleSheetLibxslt.cpp
+++ b/WebCore/xml/XSLStyleSheetLibxslt.cpp
@@ -55,8 +55,8 @@ SOFT_LINK(libxslt, xsltLoadStylesheetPI, xsltStylesheetPtr, (xmlDocPtr doc), (do
namespace WebCore {
-XSLStyleSheet::XSLStyleSheet(XSLImportRule* parentRule, const String& href, const KURL& baseURL)
- : StyleSheet(parentRule, href, baseURL)
+XSLStyleSheet::XSLStyleSheet(XSLImportRule* parentRule, const String& originalURL, const KURL& finalURL)
+ : StyleSheet(parentRule, originalURL, finalURL)
, m_ownerDocument(0)
, m_embedded(false)
, m_processed(false) // Child sheets get marked as processed when the libxslt engine has finally seen them.
@@ -66,8 +66,8 @@ XSLStyleSheet::XSLStyleSheet(XSLImportRule* parentRule, const String& href, cons
{
}
-XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& href, const KURL& baseURL, bool embedded)
- : StyleSheet(parentNode, href, baseURL)
+XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& originalURL, const KURL& finalURL, bool embedded)
+ : StyleSheet(parentNode, originalURL, finalURL)
, m_ownerDocument(parentNode->document())
, m_embedded(embedded)
, m_processed(true) // The root sheet starts off processed.
@@ -168,7 +168,7 @@ bool XSLStyleSheet::parseString(const String& string, bool)
}
m_stylesheetDoc = xmlCtxtReadMemory(ctxt, buffer, size,
- putativeBaseURL().string().utf8().data(),
+ finalURL().string().utf8().data(),
BOMHighByte == 0xFF ? "UTF-16LE" : "UTF-16BE",
XML_PARSE_NOENT | XML_PARSE_DTDATTR | XML_PARSE_NOWARNING | XML_PARSE_NOCDATA);
xmlFreeParserCtxt(ctxt);
@@ -192,7 +192,7 @@ void XSLStyleSheet::loadChildSheets()
if (m_embedded) {
// We have to locate (by ID) the appropriate embedded stylesheet element, so that we can walk the
// import/include list.
- xmlAttrPtr idNode = xmlGetID(document(), (const xmlChar*)(putativeBaseURL().string().utf8().data()));
+ xmlAttrPtr idNode = xmlGetID(document(), (const xmlChar*)(finalURL().string().utf8().data()));
if (!idNode)
return;
stylesheetRoot = idNode->parent;
diff --git a/WebCore/xml/XSLStyleSheetQt.cpp b/WebCore/xml/XSLStyleSheetQt.cpp
index 4151be4..cb55993 100644
--- a/WebCore/xml/XSLStyleSheetQt.cpp
+++ b/WebCore/xml/XSLStyleSheetQt.cpp
@@ -33,8 +33,8 @@
namespace WebCore {
-XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& href, const KURL& baseURL, bool embedded)
- : StyleSheet(parentNode, href, baseURL)
+XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& originalURL, const KURL& finalURL, bool embedded)
+ : StyleSheet(parentNode, originalURL, finalURL)
, m_ownerDocument(parentNode->document())
, m_embedded(embedded)
{
diff --git a/WebCore/xml/XSLTProcessorLibxslt.cpp b/WebCore/xml/XSLTProcessorLibxslt.cpp
index ded5c68..e2da3ed 100644
--- a/WebCore/xml/XSLTProcessorLibxslt.cpp
+++ b/WebCore/xml/XSLTProcessorLibxslt.cpp
@@ -201,8 +201,8 @@ static const char** xsltParamArrayFromParameterMap(XSLTProcessor::ParameterMap&
XSLTProcessor::ParameterMap::iterator end = parameters.end();
unsigned index = 0;
for (XSLTProcessor::ParameterMap::iterator it = parameters.begin(); it != end; ++it) {
- parameterArray[index++] = strdup(it->first.utf8().data());
- parameterArray[index++] = strdup(it->second.utf8().data());
+ parameterArray[index++] = fastStrDup(it->first.utf8().data());
+ parameterArray[index++] = fastStrDup(it->second.utf8().data());
}
parameterArray[index] = 0;
@@ -216,8 +216,8 @@ static void freeXsltParamArray(const char** params)
return;
while (*temp) {
- free((void*)*(temp++)); // strdup returns malloc'd blocks, so we have to use free() here
- free((void*)*(temp++));
+ fastFree((void*)*(temp++));
+ fastFree((void*)*(temp++));
}
fastFree(params);
}