summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--JavaScriptCore/API/JSClassRef.cpp41
-rw-r--r--JavaScriptCore/API/JSStringRef.h3
-rw-r--r--JavaScriptCore/ChangeLog806
-rw-r--r--JavaScriptCore/Configurations/FeatureDefines.xcconfig3
-rw-r--r--JavaScriptCore/Configurations/Version.xcconfig4
-rw-r--r--JavaScriptCore/GNUmakefile.am2
-rw-r--r--JavaScriptCore/JavaScriptCore.exp8
-rw-r--r--JavaScriptCore/JavaScriptCore.gypi1
-rw-r--r--JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def2
-rw-r--r--JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj4
-rw-r--r--JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj18
-rw-r--r--JavaScriptCore/debugger/Debugger.cpp2
-rw-r--r--JavaScriptCore/debugger/DebuggerCallFrame.cpp4
-rw-r--r--JavaScriptCore/jit/JIT.h9
-rw-r--r--JavaScriptCore/jit/JITArithmetic.cpp56
-rw-r--r--JavaScriptCore/jit/JITOpcodes.cpp109
-rw-r--r--JavaScriptCore/jit/JITStubs.cpp2
-rw-r--r--JavaScriptCore/jit/JITStubs.h22
-rw-r--r--JavaScriptCore/parser/Grammar.y8
-rw-r--r--JavaScriptCore/parser/NodeConstructors.h6
-rw-r--r--JavaScriptCore/parser/Parser.cpp2
-rw-r--r--JavaScriptCore/profiler/Profile.cpp2
-rw-r--r--JavaScriptCore/profiler/ProfileGenerator.cpp2
-rw-r--r--JavaScriptCore/qt/api/qscriptengine.cpp20
-rw-r--r--JavaScriptCore/qt/api/qscriptengine.h2
-rw-r--r--JavaScriptCore/qt/api/qscriptvalue_p.h28
-rw-r--r--JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp19
-rw-r--r--JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h28
-rw-r--r--JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp447
-rw-r--r--JavaScriptCore/runtime/ArrayPrototype.cpp81
-rw-r--r--JavaScriptCore/runtime/Collector.cpp26
-rw-r--r--JavaScriptCore/runtime/Collector.h1
-rw-r--r--JavaScriptCore/runtime/CollectorHeapIterator.h22
-rw-r--r--JavaScriptCore/runtime/CommonIdentifiers.cpp3
-rw-r--r--JavaScriptCore/runtime/CommonIdentifiers.h1
-rw-r--r--JavaScriptCore/runtime/DateConstructor.cpp3
-rw-r--r--JavaScriptCore/runtime/DatePrototype.cpp7
-rw-r--r--JavaScriptCore/runtime/Error.cpp8
-rw-r--r--JavaScriptCore/runtime/ErrorPrototype.cpp5
-rw-r--r--JavaScriptCore/runtime/ExceptionHelpers.cpp7
-rw-r--r--JavaScriptCore/runtime/ExceptionHelpers.h1
-rw-r--r--JavaScriptCore/runtime/Executable.cpp2
-rw-r--r--JavaScriptCore/runtime/FunctionConstructor.cpp2
-rw-r--r--JavaScriptCore/runtime/FunctionPrototype.cpp7
-rw-r--r--JavaScriptCore/runtime/Identifier.cpp6
-rw-r--r--JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp26
-rw-r--r--JavaScriptCore/runtime/JSONObject.cpp2
-rw-r--r--JavaScriptCore/runtime/JSPropertyNameIterator.cpp18
-rw-r--r--JavaScriptCore/runtime/JSPropertyNameIterator.h34
-rw-r--r--JavaScriptCore/runtime/JSString.h5
-rw-r--r--JavaScriptCore/runtime/JSStringBuilder.h105
-rw-r--r--JavaScriptCore/runtime/JSValue.cpp4
-rw-r--r--JavaScriptCore/runtime/LiteralParser.cpp2
-rw-r--r--JavaScriptCore/runtime/NumberPrototype.cpp11
-rw-r--r--JavaScriptCore/runtime/ObjectPrototype.cpp3
-rw-r--r--JavaScriptCore/runtime/Operations.cpp7
-rw-r--r--JavaScriptCore/runtime/Operations.h2
-rw-r--r--JavaScriptCore/runtime/PropertyNameArray.cpp2
-rw-r--r--JavaScriptCore/runtime/RegExpPrototype.cpp3
-rw-r--r--JavaScriptCore/runtime/SmallStrings.cpp37
-rw-r--r--JavaScriptCore/runtime/SmallStrings.h1
-rw-r--r--JavaScriptCore/runtime/StringBuilder.h8
-rw-r--r--JavaScriptCore/runtime/StringPrototype.cpp118
-rw-r--r--JavaScriptCore/runtime/Structure.h8
-rw-r--r--JavaScriptCore/runtime/UString.cpp178
-rw-r--r--JavaScriptCore/runtime/UString.h129
-rw-r--r--JavaScriptCore/runtime/UStringImpl.cpp39
-rw-r--r--JavaScriptCore/runtime/UStringImpl.h18
-rw-r--r--JavaScriptCore/runtime/WeakGCPtr.h6
-rw-r--r--JavaScriptCore/wscript2
-rw-r--r--JavaScriptCore/wtf/Complex.h46
-rw-r--r--JavaScriptCore/wtf/FastMalloc.cpp20
-rw-r--r--JavaScriptCore/wtf/HashTable.h3
-rw-r--r--JavaScriptCore/wtf/HashTraits.h21
-rw-r--r--JavaScriptCore/wtf/MathExtras.h11
-rw-r--r--JavaScriptCore/wtf/PassRefPtr.h45
-rw-r--r--JavaScriptCore/wtf/Platform.h16
-rw-r--r--JavaScriptCore/wtf/RefPtr.h47
-rw-r--r--JavaScriptCore/wtf/ValueCheck.h (renamed from WebKitTools/DrawTest/DrawTestInspectorController.m)56
-rw-r--r--JavaScriptCore/wtf/Vector.h21
-rw-r--r--JavaScriptCore/wtf/Vector3.h138
-rw-r--r--JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h2
-rw-r--r--JavaScriptGlue/ChangeLog18
-rw-r--r--JavaScriptGlue/Configurations/Version.xcconfig4
-rw-r--r--JavaScriptGlue/ForwardingHeaders/wtf/ValueCheck.h1
-rw-r--r--JavaScriptGlue/JavaScriptGlue.xcodeproj/project.pbxproj8
-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.cpp (renamed from WebKitTools/DrawTest/DrawTestView.m)28
-rw-r--r--WebCore/bindings/js/ScriptDebugServer.h (renamed from WebKitTools/DrawTest/DrawTestToolbarController.h)29
-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.cpp (renamed from WebKitTools/DrawTest/ScalingImageView.h)17
-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.cpp (renamed from WebKitTools/DrawTest/ScalingImageView.m)61
-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
-rw-r--r--WebKit/ChangeLog19
-rw-r--r--WebKit/WebKit.xcodeproj/project.pbxproj16
-rw-r--r--WebKit/chromium/ChangeLog1271
-rw-r--r--WebKit/chromium/DEPS23
-rw-r--r--WebKit/chromium/WebKit.gyp13
-rw-r--r--WebKit/chromium/WebKit.gypi67
-rw-r--r--WebKit/chromium/features.gypi3
-rw-r--r--WebKit/chromium/public/WebContextMenuData.h3
-rw-r--r--WebKit/chromium/public/WebDatabase.h2
-rw-r--r--WebKit/chromium/public/WebDragData.h2
-rw-r--r--WebKit/chromium/public/WebFileInfo.h46
-rw-r--r--WebKit/chromium/public/WebHTTPBody.h8
-rw-r--r--WebKit/chromium/public/WebInputElement.h4
-rw-r--r--WebKit/chromium/public/WebKitClient.h1
-rw-r--r--WebKit/chromium/public/WebStorageArea.h26
-rw-r--r--WebKit/chromium/public/WebView.h24
-rw-r--r--WebKit/chromium/public/WebViewClient.h3
-rw-r--r--WebKit/chromium/src/AutoFillPopupMenuClient.cpp95
-rw-r--r--WebKit/chromium/src/AutoFillPopupMenuClient.h80
-rw-r--r--WebKit/chromium/src/AutocompletePopupMenuClient.cpp134
-rw-r--r--WebKit/chromium/src/AutocompletePopupMenuClient.h59
-rw-r--r--WebKit/chromium/src/BackForwardListClientImpl.cpp2
-rw-r--r--WebKit/chromium/src/ChromeClientImpl.cpp8
-rw-r--r--WebKit/chromium/src/ChromeClientImpl.h2
-rw-r--r--WebKit/chromium/src/DebuggerAgent.h5
-rw-r--r--WebKit/chromium/src/DebuggerAgentImpl.cpp45
-rw-r--r--WebKit/chromium/src/DebuggerAgentImpl.h5
-rw-r--r--WebKit/chromium/src/EditorClientImpl.cpp6
-rw-r--r--WebKit/chromium/src/GraphicsContext3D.cpp30
-rw-r--r--WebKit/chromium/src/SuggestionsPopupMenuClient.cpp186
-rw-r--r--WebKit/chromium/src/SuggestionsPopupMenuClient.h109
-rw-r--r--WebKit/chromium/src/ToolsAgent.h3
-rw-r--r--WebKit/chromium/src/WebDatabase.cpp18
-rw-r--r--WebKit/chromium/src/WebDevToolsAgentImpl.cpp9
-rw-r--r--WebKit/chromium/src/WebDevToolsAgentImpl.h1
-rw-r--r--WebKit/chromium/src/WebDevToolsFrontendImpl.cpp3
-rw-r--r--WebKit/chromium/src/WebDragData.cpp12
-rw-r--r--WebKit/chromium/src/WebHTTPBody.cpp12
-rw-r--r--WebKit/chromium/src/WebInputElement.cpp7
-rw-r--r--WebKit/chromium/src/WebRuntimeFeatures.cpp8
-rw-r--r--WebKit/chromium/src/WebStorageAreaImpl.cpp6
-rw-r--r--WebKit/chromium/src/WebStorageAreaImpl.h2
-rw-r--r--WebKit/chromium/src/WebViewImpl.cpp222
-rw-r--r--WebKit/chromium/src/WebViewImpl.h55
-rw-r--r--WebKit/chromium/src/WebWorkerBase.cpp2
-rw-r--r--WebKit/chromium/src/js/DebuggerAgent.js1528
-rw-r--r--WebKit/chromium/src/js/DevTools.js504
-rw-r--r--WebKit/chromium/src/js/DevToolsHostStub.js309
-rw-r--r--WebKit/chromium/src/js/HeapProfilerPanel.js966
-rwxr-xr-xWebKit/chromium/src/js/Images/segmentChromium.pngbin0 -> 4253 bytes
-rwxr-xr-xWebKit/chromium/src/js/Images/segmentHoverChromium.pngbin0 -> 4160 bytes
-rwxr-xr-xWebKit/chromium/src/js/Images/segmentHoverEndChromium.pngbin0 -> 4143 bytes
-rwxr-xr-xWebKit/chromium/src/js/Images/segmentSelectedChromium.pngbin0 -> 4113 bytes
-rwxr-xr-xWebKit/chromium/src/js/Images/segmentSelectedEndChromium.pngbin0 -> 4104 bytes
-rwxr-xr-xWebKit/chromium/src/js/Images/statusbarBackgroundChromium.pngbin0 -> 4070 bytes
-rwxr-xr-xWebKit/chromium/src/js/Images/statusbarBottomBackgroundChromium.pngbin0 -> 4070 bytes
-rwxr-xr-xWebKit/chromium/src/js/Images/statusbarButtonsChromium.pngbin0 -> 4258 bytes
-rwxr-xr-xWebKit/chromium/src/js/Images/statusbarMenuButtonChromium.pngbin0 -> 4391 bytes
-rwxr-xr-xWebKit/chromium/src/js/Images/statusbarMenuButtonSelectedChromium.pngbin0 -> 4372 bytes
-rw-r--r--WebKit/chromium/src/js/InjectDispatch.js106
-rw-r--r--WebKit/chromium/src/js/InspectorControllerImpl.js279
-rw-r--r--WebKit/chromium/src/js/ProfilerAgent.js227
-rw-r--r--WebKit/chromium/src/js/ProfilerProcessor.js543
-rw-r--r--WebKit/chromium/src/js/Tests.js1862
-rwxr-xr-xWebKit/chromium/src/js/devTools.css223
-rw-r--r--WebKit/chromium/tests/TransparencyWinTest.cpp693
-rw-r--r--WebKit/chromium/tests/UniscribeHelperTest.cpp165
-rw-r--r--WebKit/gtk/ChangeLog94
-rw-r--r--WebKit/gtk/NEWS14
-rw-r--r--WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp53
-rw-r--r--WebKit/gtk/tests/testwebview.c104
-rw-r--r--WebKit/gtk/webkit/webkitprivate.h3
-rw-r--r--WebKit/gtk/webkit/webkitwebframe.cpp26
-rw-r--r--WebKit/gtk/webkit/webkitwebview.cpp63
-rw-r--r--WebKit/mac/ChangeLog186
-rw-r--r--WebKit/mac/Configurations/FeatureDefines.xcconfig3
-rw-r--r--WebKit/mac/Configurations/Version.xcconfig4
-rw-r--r--WebKit/mac/ForwardingHeaders/wtf/ValueCheck.h1
-rw-r--r--WebKit/mac/MigrateHeaders.make2
-rw-r--r--WebKit/mac/Misc/WebCoreStatistics.h2
-rw-r--r--WebKit/mac/Misc/WebCoreStatistics.mm20
-rw-r--r--WebKit/mac/Misc/WebLocalizableStrings.mm (renamed from WebKit/mac/Misc/WebLocalizableStrings.m)7
-rw-r--r--WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm105
-rw-r--r--WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h5
-rw-r--r--WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm25
-rw-r--r--WebKit/mac/Plugins/Hosted/ProxyInstance.mm5
-rw-r--r--WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm16
-rw-r--r--WebKit/mac/Plugins/Hosted/WebKitPluginClient.defs15
-rw-r--r--WebKit/mac/Plugins/WebBaseNetscapePluginView.h1
-rw-r--r--WebKit/mac/Plugins/WebBaseNetscapePluginView.mm16
-rw-r--r--WebKit/mac/Plugins/WebNetscapePluginView.mm27
-rw-r--r--WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm8
-rw-r--r--WebKit/mac/WebView/WebFrameView.mm6
-rw-r--r--WebKit/mac/WebView/WebPDFDocumentExtras.h8
-rw-r--r--WebKit/mac/WebView/WebPDFDocumentExtras.mm14
-rw-r--r--WebKit/mac/WebView/WebPDFRepresentation.mm12
-rw-r--r--WebKit/mac/WebView/WebPreferenceKeysPrivate.h1
-rw-r--r--WebKit/mac/WebView/WebPreferences.mm11
-rw-r--r--WebKit/mac/WebView/WebPreferencesPrivate.h3
-rw-r--r--WebKit/mac/WebView/WebView.mm1
-rw-r--r--WebKit/qt/Api/DerivedSources.pro96
-rw-r--r--WebKit/qt/Api/qgraphicswebview.cpp11
-rw-r--r--WebKit/qt/Api/qwebelement.cpp1
-rw-r--r--WebKit/qt/Api/qwebframe.cpp13
-rw-r--r--WebKit/qt/Api/qwebpage.cpp12
-rw-r--r--WebKit/qt/Api/qwebpage_p.h3
-rw-r--r--WebKit/qt/Api/qwebview.cpp141
-rw-r--r--WebKit/qt/ChangeLog219
-rw-r--r--WebKit/qt/WebCoreSupport/ChromeClientQt.cpp13
-rw-r--r--WebKit/qt/WebCoreSupport/ChromeClientQt.h2
-rw-r--r--WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp6
-rw-r--r--WebKit/qt/tests/qwebelement/tst_qwebelement.cpp2
-rw-r--r--WebKit/qt/tests/qwebpage/tst_qwebpage.cpp22
-rw-r--r--WebKit/qt/tests/tests.pri3
-rw-r--r--WebKit/win/AccessibleBase.cpp22
-rw-r--r--WebKit/win/ChangeLog110
-rw-r--r--WebKit/win/Interfaces/IWebPreferencesPrivate.idl3
-rw-r--r--WebKit/win/Interfaces/WebKit.idl1
-rw-r--r--WebKit/win/WebFrame.cpp41
-rw-r--r--WebKit/win/WebPreferenceKeysPrivate.h2
-rw-r--r--WebKit/win/WebPreferences.cpp16
-rw-r--r--WebKit/win/WebPreferences.h6
-rw-r--r--WebKit/win/WebView.cpp9
-rw-r--r--WebKit/wx/ChangeLog17
-rw-r--r--WebKit/wx/WebView.cpp12
-rw-r--r--WebKitLibraries/ChangeLog33
-rw-r--r--WebKitLibraries/win/tools/scripts/VERSION2
-rwxr-xr-xWebKitLibraries/win/tools/scripts/auto-version.sh22
-rw-r--r--WebKitLibraries/win/tools/vsprops/FeatureDefines.vsprops7
-rw-r--r--WebKitTools/ChangeLog827
-rw-r--r--WebKitTools/DrawTest/AppDelegate.h37
-rw-r--r--WebKitTools/DrawTest/AppDelegate.m52
-rw-r--r--WebKitTools/DrawTest/DrawTest.xcodeproj/project.pbxproj387
-rw-r--r--WebKitTools/DrawTest/DrawTestDocument.h45
-rw-r--r--WebKitTools/DrawTest/DrawTestDocument.m151
-rw-r--r--WebKitTools/DrawTest/DrawTestInspectorController.h37
-rw-r--r--WebKitTools/DrawTest/DrawTestToolbarController.m354
-rw-r--r--WebKitTools/DrawTest/DrawTestView.h38
-rw-r--r--WebKitTools/DrawTest/DrawTest_Prefix.pch37
-rw-r--r--WebKitTools/DrawTest/English.lproj/DrawTestDocument.nib/classes.nib34
-rw-r--r--WebKitTools/DrawTest/English.lproj/DrawTestDocument.nib/info.nib22
-rw-r--r--WebKitTools/DrawTest/English.lproj/DrawTestDocument.nib/keyedobjects.nibbin6746 -> 0 bytes
-rw-r--r--WebKitTools/DrawTest/English.lproj/InfoPlist.stringsbin262 -> 0 bytes
-rw-r--r--WebKitTools/DrawTest/English.lproj/Inspector.nib/classes.nib12
-rw-r--r--WebKitTools/DrawTest/English.lproj/Inspector.nib/info.nib16
-rw-r--r--WebKitTools/DrawTest/English.lproj/Inspector.nib/keyedobjects.nibbin9256 -> 0 bytes
-rw-r--r--WebKitTools/DrawTest/English.lproj/MainMenu.nib/classes.nib44
-rw-r--r--WebKitTools/DrawTest/English.lproj/MainMenu.nib/info.nib21
-rw-r--r--WebKitTools/DrawTest/English.lproj/MainMenu.nib/keyedobjects.nibbin17633 -> 0 bytes
-rw-r--r--WebKitTools/DrawTest/English.lproj/TestViewer.nib/classes.nib36
-rw-r--r--WebKitTools/DrawTest/English.lproj/TestViewer.nib/info.nib17
-rw-r--r--WebKitTools/DrawTest/English.lproj/TestViewer.nib/keyedobjects.nibbin11724 -> 0 bytes
-rw-r--r--WebKitTools/DrawTest/Info.plist49
-rw-r--r--WebKitTools/DrawTest/SVGTest.h48
-rw-r--r--WebKitTools/DrawTest/SVGTest.m113
-rw-r--r--WebKitTools/DrawTest/TestController.h72
-rw-r--r--WebKitTools/DrawTest/TestController.m270
-rw-r--r--WebKitTools/DrawTest/TestViewerSplitView.h31
-rw-r--r--WebKitTools/DrawTest/TestViewerSplitView.m77
-rw-r--r--WebKitTools/DrawTest/main.m29
-rw-r--r--WebKitTools/DumpRenderTree/LayoutTestController.cpp55
-rw-r--r--WebKitTools/DumpRenderTree/LayoutTestController.h2
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp20
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp3
-rw-r--r--WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp16
-rw-r--r--WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm2
-rw-r--r--WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm10
-rw-r--r--WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp28
-rw-r--r--WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h4
-rw-r--r--WebKitTools/DumpRenderTree/qt/main.cpp10
-rw-r--r--WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp1
-rw-r--r--WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp23
-rw-r--r--WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp34
-rw-r--r--WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp11
-rw-r--r--WebKitTools/QtLauncher/QtLauncher.pro2
-rw-r--r--WebKitTools/QtLauncher/main.cpp210
-rw-r--r--WebKitTools/QtLauncher/mainwindow.cpp8
-rw-r--r--WebKitTools/QtLauncher/utils.cpp50
-rw-r--r--WebKitTools/QtLauncher/utils.h9
-rw-r--r--WebKitTools/QtLauncher/webview.cpp62
-rw-r--r--WebKitTools/QtLauncher/webview.h43
-rwxr-xr-xWebKitTools/Scripts/build-webkit11
-rwxr-xr-xWebKitTools/Scripts/check-for-global-initializers2
-rwxr-xr-xWebKitTools/Scripts/check-for-weak-vtables-and-externals (renamed from WebKitTools/Scripts/check-for-weak-vtables)35
-rwxr-xr-xWebKitTools/Scripts/rebaseline-chromium-webkit-tests2
-rwxr-xr-xWebKitTools/Scripts/run-chromium-webkit-tests3
-rwxr-xr-xWebKitTools/Scripts/run-drawtest47
-rwxr-xr-xWebKitTools/Scripts/run-iexploder-tests15
-rwxr-xr-xWebKitTools/Scripts/run-webkit-tests42
-rwxr-xr-xWebKitTools/Scripts/run-webkit-websocketserver1
-rwxr-xr-xWebKitTools/Scripts/test-webkitpy2
-rwxr-xr-xWebKitTools/Scripts/webkit-build-directory (renamed from WebKitTools/Scripts/build-drawtest)47
-rw-r--r--WebKitTools/Scripts/webkitdirs.pm248
-rw-r--r--WebKitTools/Scripts/webkitperl/features.pm104
-rw-r--r--WebKitTools/Scripts/webkitperl/httpd.pm169
-rw-r--r--WebKitTools/Scripts/webkitpy/bugzilla.py3
-rw-r--r--WebKitTools/Scripts/webkitpy/commands/upload.py45
-rw-r--r--WebKitTools/Scripts/webkitpy/commands/upload_unittest.py5
-rw-r--r--WebKitTools/Scripts/webkitpy/committers.py1
-rw-r--r--WebKitTools/Scripts/webkitpy/credentials.py3
-rw-r--r--WebKitTools/Scripts/webkitpy/grammar.py8
-rw-r--r--WebKitTools/Scripts/webkitpy/grammar_unittest.py38
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/driver_test.py77
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py8
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py56
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_expectations.py112
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_files.py7
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_shell_thread.py219
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/__init__.py49
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/apache_http_server.py37
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/base.py645
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py260
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_linux.py327
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_mac.py293
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py293
-rwxr-xr-xWebKitTools/Scripts/webkitpy/layout_tests/port/http_server.py97
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/http_server_base.py11
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/mac.py439
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/path_utils.py395
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/test.py144
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/websocket_server.py103
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py4
-rwxr-xr-xWebKitTools/Scripts/webkitpy/layout_tests/run_chromium_webkit_tests.py213
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/test_types/fuzzy_image_diff.py9
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/test_types/image_diff.py63
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/test_types/test_type_base.py106
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/test_types/text_diff.py19
-rw-r--r--WebKitTools/Scripts/webkitpy/mock_bugzillatool.py3
-rw-r--r--WebKitTools/Scripts/webkitpy/style/checker.py167
-rwxr-xr-xWebKitTools/Scripts/webkitpy/style/checker_unittest.py108
-rw-r--r--WebKitTools/Scripts/webkitpy/style/error_handlers.py6
-rw-r--r--WebKitTools/Scripts/webkitpy/style/error_handlers_unittest.py23
-rw-r--r--WebKitTools/Scripts/webkitpy/style/filter.py203
-rw-r--r--WebKitTools/Scripts/webkitpy/style/filter_unittest.py196
-rw-r--r--WebKitTools/Scripts/webkitpy/style/processors/cpp.py40
-rw-r--r--WebKitTools/Scripts/webkitpy/style/processors/cpp_unittest.py17
-rw-r--r--WebKitTools/Scripts/webkitpy/user.py9
-rw-r--r--WebKitTools/Scripts/webkitpy/user_unittest.py53
-rw-r--r--WebKitTools/pywebsocket/mod_pywebsocket/standalone.py30
-rw-r--r--WebKitTools/pywebsocket/setup.py2
-rw-r--r--WebKitTools/wx/build/settings.py6
905 files changed, 32037 insertions, 11313 deletions
diff --git a/JavaScriptCore/API/JSClassRef.cpp b/JavaScriptCore/API/JSClassRef.cpp
index c6685bf..747aa16 100644
--- a/JavaScriptCore/API/JSClassRef.cpp
+++ b/JavaScriptCore/API/JSClassRef.cpp
@@ -33,12 +33,28 @@
#include <runtime/JSGlobalObject.h>
#include <runtime/ObjectPrototype.h>
#include <runtime/Identifier.h>
+#include <wtf/unicode/UTF8.h>
using namespace std;
using namespace JSC;
+using namespace WTF::Unicode;
const JSClassDefinition kJSClassDefinitionEmpty = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+static inline UString tryCreateStringFromUTF8(const char* string)
+{
+ if (!string)
+ return UString::null();
+
+ size_t length = strlen(string);
+ Vector<UChar, 1024> buffer(length);
+ UChar* p = buffer.data();
+ if (conversionOK != convertUTF8ToUTF16(&string, string + length, &p, p + length))
+ return UString::null();
+
+ return UString(buffer.data(), p - buffer.data());
+}
+
OpaqueJSClass::OpaqueJSClass(const JSClassDefinition* definition, OpaqueJSClass* protoClass)
: parentClass(definition->parentClass)
, prototypeClass(0)
@@ -53,7 +69,7 @@ OpaqueJSClass::OpaqueJSClass(const JSClassDefinition* definition, OpaqueJSClass*
, callAsConstructor(definition->callAsConstructor)
, hasInstance(definition->hasInstance)
, convertToType(definition->convertToType)
- , m_className(UString::createFromUTF8(definition->className).rep()->ref())
+ , m_className(tryCreateStringFromUTF8(definition->className))
, m_staticValues(0)
, m_staticFunctions(0)
{
@@ -62,9 +78,12 @@ OpaqueJSClass::OpaqueJSClass(const JSClassDefinition* definition, OpaqueJSClass*
if (const JSStaticValue* staticValue = definition->staticValues) {
m_staticValues = new OpaqueJSClassStaticValuesTable();
while (staticValue->name) {
- // Use a local variable here to sidestep an RVCT compiler bug.
- StaticValueEntry* entry = new StaticValueEntry(staticValue->getProperty, staticValue->setProperty, staticValue->attributes);
- m_staticValues->add(UString::createFromUTF8(staticValue->name).rep()->ref(), entry);
+ UString valueName = tryCreateStringFromUTF8(staticValue->name);
+ if (!valueName.isNull()) {
+ // Use a local variable here to sidestep an RVCT compiler bug.
+ StaticValueEntry* entry = new StaticValueEntry(staticValue->getProperty, staticValue->setProperty, staticValue->attributes);
+ m_staticValues->add(valueName.rep()->ref(), entry);
+ }
++staticValue;
}
}
@@ -72,9 +91,12 @@ OpaqueJSClass::OpaqueJSClass(const JSClassDefinition* definition, OpaqueJSClass*
if (const JSStaticFunction* staticFunction = definition->staticFunctions) {
m_staticFunctions = new OpaqueJSClassStaticFunctionsTable();
while (staticFunction->name) {
- // Use a local variable here to sidestep an RVCT compiler bug.
- StaticFunctionEntry* entry = new StaticFunctionEntry(staticFunction->callAsFunction, staticFunction->attributes);
- m_staticFunctions->add(UString::createFromUTF8(staticFunction->name).rep()->ref(), entry);
+ UString functionName = tryCreateStringFromUTF8(staticFunction->name);
+ if (!functionName.isNull()) {
+ // Use a local variable here to sidestep an RVCT compiler bug.
+ StaticFunctionEntry* entry = new StaticFunctionEntry(staticFunction->callAsFunction, staticFunction->attributes);
+ m_staticFunctions->add(functionName.rep()->ref(), entry);
+ }
++staticFunction;
}
}
@@ -118,7 +140,7 @@ static void clearReferenceToPrototype(JSObjectRef prototype)
{
OpaqueJSClassContextData* jsClassData = static_cast<OpaqueJSClassContextData*>(JSObjectGetPrivate(prototype));
ASSERT(jsClassData);
- jsClassData->cachedPrototype = 0;
+ jsClassData->cachedPrototype.clear(toJS(prototype));
}
PassRefPtr<OpaqueJSClass> OpaqueJSClass::create(const JSClassDefinition* clientDefinition)
@@ -146,12 +168,9 @@ OpaqueJSClassContextData::OpaqueJSClassContextData(OpaqueJSClass* jsClass)
// Use a local variable here to sidestep an RVCT compiler bug.
StaticValueEntry* entry = new StaticValueEntry(it->second->getProperty, it->second->setProperty, it->second->attributes);
staticValues->add(UString::Rep::create(it->first->data(), it->first->size()), entry);
-
}
-
} else
staticValues = 0;
-
if (jsClass->m_staticFunctions) {
staticFunctions = new OpaqueJSClassStaticFunctionsTable;
diff --git a/JavaScriptCore/API/JSStringRef.h b/JavaScriptCore/API/JSStringRef.h
index c58b958..92135b1 100644
--- a/JavaScriptCore/API/JSStringRef.h
+++ b/JavaScriptCore/API/JSStringRef.h
@@ -37,7 +37,8 @@
extern "C" {
#endif
-#if !defined(WIN32) && !defined(_WIN32) && !defined(__WINSCW__)
+#if !defined(WIN32) && !defined(_WIN32) && !defined(__WINSCW__) \
+ && !(defined(__CC_ARM) || defined(__ARMCC__)) /* RVCT */
/*!
@typedef JSChar
@abstract A Unicode character.
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 578e282..4257344 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,809 @@
+2010-02-12 Janne Koskinen <janne.p.koskinen@digia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Additional refptr/passrefptr workarounds for WINSCW compiler
+ https://bugs.webkit.org/show_bug.cgi?id=28054
+
+ * wtf/PassRefPtr.h:
+ (WTF::refIfNotNull):
+ (WTF::PassRefPtr::PassRefPtr):
+ (WTF::PassRefPtr::~PassRefPtr):
+ (WTF::PassRefPtr::clear):
+ (WTF::::operator):
+ * wtf/RefPtr.h:
+ (WTF::RefPtr::RefPtr):
+ (WTF::::operator):
+
+2010-02-12 Janne Koskinen <janne.p.koskinen@digia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Don't import the cmath functions from std:: for WINSCW.
+
+ * wtf/MathExtras.h:
+
+2010-02-12 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Adam Barth.
+
+ Typedef both JSChar and UChar to wchar_t in RVCT.
+ https://bugs.webkit.org/show_bug.cgi?id=34560
+
+ Define both JSChar and UChar to wchar_t as the size
+ of wchar_t is 2 bytes in RVCT.
+
+ * API/JSStringRef.h:
+ * wtf/unicode/qt4/UnicodeQt4.h:
+
+2010-02-11 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt and Darin Adler.
+
+ The rest of the fix for
+ https://bugs.webkit.org/show_bug.cgi?id=34864 | <rdar://problem/7594198>
+ Many objects left uncollected after visiting mail.google.com and closing
+ window
+
+ Don't unconditionally hang onto small strings. Instead, hang onto all
+ small strings as long as any small string is still referenced.
+
+ SunSpider reports no change.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::markRoots): Mark the small strings cache last, so it can
+ check if anything else has kept any strings alive.
+
+ * runtime/SmallStrings.cpp:
+ (JSC::isMarked):
+ (JSC::SmallStrings::markChildren): Only keep our strings alive if some
+ other reference to at least one of them exists, too.
+
+2010-02-11 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Some progress toward fixing
+ https://bugs.webkit.org/show_bug.cgi?id=34864 | <rdar://problem/7594198>
+ Many objects left uncollected after visiting mail.google.com and closing
+ window
+
+ SunSpider reports no change.
+
+ Keep weak references, rather than protected references, to cached for-in
+ property name enumerators.
+
+ One problem with protected references is that a chain like
+ [ gc object 1 ] => [ non-gc object ] => [ gc object 2 ]
+ takes two GC passes to break, since the first pass collects [ gc object 1 ],
+ releasing [ non-gc object ] and unprotecting [ gc object 2 ], and only
+ then can a second pass collect [ gc object 2 ].
+
+ Another problem with protected references is that they can keep a bunch
+ of strings alive long after they're useful. In SunSpider and a few popular
+ websites, the size-speed tradeoff seems to favor weak references.
+
+ * runtime/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::JSPropertyNameIterator): Moved this constructor
+ into the .cpp file, since it's not used elsewhere.
+
+ (JSC::JSPropertyNameIterator::~JSPropertyNameIterator): Added a destructor
+ to support our weak reference.
+
+ * runtime/JSPropertyNameIterator.h:
+ (JSC::Structure::setEnumerationCache):
+ (JSC::Structure::clearEnumerationCache):
+ (JSC::Structure::enumerationCache): Added a function for clearing a
+ Structure's enumeration cache, used by our new destructor. Also fixed
+ indentation to match the rest of the file.
+
+ * runtime/Structure.h: Changed from protected pointer to weak pointer.
+
+2010-02-11 Chris Rogers <crogers@google.com>
+
+ Reviewed by David Levin.
+
+ audio engine: add Complex number class
+ https://bugs.webkit.org/show_bug.cgi?id=34538
+
+ * wtf/Complex.h: Added.
+ (WebCore::complexFromMagnitudePhase):
+
+2010-02-10 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Added an SPI for asking about all the different live objects on the heap.
+ Useful for memory debugging.
+
+ * JavaScriptCore.exp: Export the new SPI.
+
+ * runtime/Collector.cpp:
+ (JSC::typeName): Use a little capitalization. Don't crash in the case of
+ a non-object cell, since it might just be an uninitialized cell.
+
+ (JSC::Heap::objectTypeCounts): The new SPI.
+
+ * runtime/Collector.h:
+ * runtime/CollectorHeapIterator.h:
+ (JSC::CollectorHeapIterator::advance):
+ (JSC::LiveObjectIterator::operator++):
+ (JSC::DeadObjectIterator::operator++):
+ (JSC::ObjectIterator::operator++): Made 2 tweaks to these iterators:
+ (1) Skip the last cell in the block, since it's a dummy sentinel, and
+ we don't want it to confuse the object count; (2) Fixed a logic error
+ in LiveObjectIterator that could cause it to iterate dead objects if
+ m_block were equal to m_heap.nextBlock and m_cell were less than
+ m_heap.nextCell. No test for this since I can't think of a way that this
+ could make WebKit behave badly.
+
+2010-02-11 Steve Block <steveblock@google.com>
+
+ Reviewed by Darin Adler.
+
+ Guard cmath using declarations in MathExtras.h on Android
+ https://bugs.webkit.org/show_bug.cgi?id=34840
+
+ Android does not provide these functions.
+
+ * wtf/MathExtras.h:
+
+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:
+
+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
+
+ * wscript:
+
+2010-02-10 Alexey Proskuryakov <ap@apple.com>
+
+ Addressing issues found by style bot.
+
+ * wtf/ValueCheck.h: Renamed header guard to match final file name.
+
+ * wtf/Vector.h: (WTF::::checkConsistency): Remove braces around a one-line clause.
+
+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
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ Added ValueCheck.h.
+
+ * wtf/ValueCheck.h: Added. Moved code out of HashTraits, since it would be awkward to
+ include that from Vector.h.
+ (WTF::ValueCheck::checkConsistency): Allow null pointers, those are pretty consistent.
+
+ * wtf/HashTraits.h: Moved value checking code out of here.
+
+ * wtf/HashTable.h: (WTF::::checkTableConsistencyExceptSize): Updated for the above changes.
+
+ * wtf/Vector.h:
+ (WTF::::checkConsistency): Check all vector elements.
+ (WTF::ValueCheck): Support checking a Vector as an element in other containers. Currently
+ unused.
+
+2010-02-10 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix QScriptValue::toBool.
+
+ Fix ECMA compliance in the QScriptValue for values like 0, NaN and
+ empty strings.
+
+ [Qt] QScriptValue::toBool problem
+ https://bugs.webkit.org/show_bug.cgi?id=34793
+
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::toBool):
+ * qt/tests/qscriptvalue/tst_qscriptvalue.h:
+ * qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp:
+ (tst_QScriptValue::toBool_initData):
+ (tst_QScriptValue::toBool_makeData):
+ (tst_QScriptValue::toBool_test):
+ (tst_QScriptValue::toBoolean_initData):
+ (tst_QScriptValue::toBoolean_makeData):
+ (tst_QScriptValue::toBoolean_test):
+
+2009-10-06 Yongjun Zhang <yongjun.zhang@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Use derefIfNotNull() to work around WINSCW compiler forward declaration bug
+
+ The compiler bug is reported at
+ https://xdabug001.ext.nokia.com/bugzilla/show_bug.cgi?id=9812.
+
+ The change should be reverted when the above bug is fixed in WINSCW compiler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=28054
+
+2009-10-06 Yongjun Zhang <yongjun.zhang@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Get rid of WINSCW hack for UnSpecifiedBoolType
+
+ Add parenthesis around (RefPtr::*UnspecifiedBoolType) to make the WINSCW
+ compiler work with the default UnSpecifiedBoolType() operator.
+
+ https://bugs.webkit.org/show_bug.cgi?id=28054
+
+ * wtf/RefPtr.h:
+
+2010-02-09 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ New functions nullValue() and undefinedValue().
+
+ [Qt] QScriptEngine should contain nullValue and undefinedValue methods
+ https://bugs.webkit.org/show_bug.cgi?id=34749
+
+ * qt/api/qscriptengine.cpp:
+ (QScriptEngine::nullValue):
+ (QScriptEngine::undefinedValue):
+ * qt/api/qscriptengine.h:
+ * qt/tests/qscriptengine/tst_qscriptengine.cpp:
+ (tst_QScriptEngine::nullValue):
+ (tst_QScriptEngine::undefinedValue):
+
+2010-02-09 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fixes for QScriptValue::toNumber().
+
+ Fix ECMA compliance in QScriptValue for values unbound
+ to a QScriptEngine.
+
+ [Qt] QScriptValue::toNumber() is broken
+ https://bugs.webkit.org/show_bug.cgi?id=34592
+
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::toNumber):
+ * qt/tests/qscriptvalue/tst_qscriptvalue.h:
+ * qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp:
+ (tst_QScriptValue::toNumber_initData):
+ (tst_QScriptValue::toNumber_makeData):
+ (tst_QScriptValue::toNumber_test):
+
+2010-02-09 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix QScriptValue::isNumber().
+
+ The isNumber() should return 'true' if the value is in the CNumber
+ state.
+
+ [Qt] QScriptValue::isNumber() returns an incorrect value
+ https://bugs.webkit.org/show_bug.cgi?id=34575
+
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::isNumber):
+ * qt/tests/qscriptvalue/tst_qscriptvalue.h:
+ * qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp:
+ (tst_QScriptValue::isNumber_initData):
+ (tst_QScriptValue::isNumber_makeData):
+ (tst_QScriptValue::isNumber_test):
+
+2010-02-09 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Small refactoring to the small strings cache to allow it to be cleared
+ dynamically.
+
+ * runtime/SmallStrings.cpp:
+ (JSC::SmallStrings::SmallStrings):
+ (JSC::SmallStrings::clear):
+ * runtime/SmallStrings.h: Moved initialization code into a shared function,
+ and changed the constructor to call it.
+
+2010-02-09 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber Stamped by Geoff Garen.
+
+ Rename StringBuilder::release && JSStringBuilder::releaseJSString
+ to 'build()'.
+
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToLocaleString):
+ (JSC::arrayProtoFuncJoin):
+ * runtime/Executable.cpp:
+ (JSC::FunctionExecutable::paramString):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::constructFunction):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::encode):
+ (JSC::decode):
+ (JSC::globalFuncEscape):
+ (JSC::globalFuncUnescape):
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::stringify):
+ * runtime/JSStringBuilder.h:
+ (JSC::JSStringBuilder::build):
+ * runtime/LiteralParser.cpp:
+ (JSC::LiteralParser::Lexer::lexString):
+ * runtime/NumberPrototype.cpp:
+ (JSC::integerPartNoExp):
+ (JSC::numberProtoFuncToFixed):
+ * runtime/StringBuilder.h:
+ (JSC::StringBuilder::build):
+
+2010-02-09 John Sullivan <sullivan@apple.com>
+
+ https://bugs.webkit.org/show_bug.cgi?id=34772
+ Overzealous new assertion in URStringImpl::adopt()
+
+ Reviewed by Adam Barth.
+
+ * runtime/UStringImpl.h:
+ (JSC::UStringImpl::adopt):
+ Only assert that vector.data() is non-zero if vector.size() is non-zero.
+
+2010-02-09 Nikolas Zimmermann <nzimmermann@rim.com>
+
+ Not reviewed. Try to fix build problem on SnowLeopard slaves to bring them back.
+
+ * API/JSClassRef.cpp:
+ (tryCreateStringFromUTF8): Mark method as 'static inline' to suppress "warning: no previous prototype for ..."
+
+2010-02-09 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Three small string fixes:
+ (1) StringBuilder::release should CRASH if the buffer allocation failed.
+ (2) Remove weird, dead code from JSString::tryGetValue, replace with an ASSERT.
+ (3) Move UString::createFromUTF8 out to the API, as tryCreateStringFromUTF8.
+ This is only used from the API, and (now) unlike other UString::create
+ methods may return UString::null() to indicate failure cases. Better
+ handle these in the API.
+
+ * API/JSClassRef.cpp:
+ (tryCreateStringFromUTF8):
+ (OpaqueJSClass::OpaqueJSClass):
+ (OpaqueJSClassContextData::OpaqueJSClassContextData):
+ * runtime/JSString.h:
+ (JSC::Fiber::tryGetValue):
+ * runtime/StringBuilder.h:
+ (JSC::StringBuilder::release):
+ * runtime/UString.cpp:
+ (JSC::UString::UString):
+ (JSC::UString::from):
+ (JSC::UString::find):
+ * runtime/UString.h:
+
+2010-02-09 Janne Koskinen <janne.p.koskinen@digia.com>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt] use nanval() for Symbian as nonInlineNaN
+ https://bugs.webkit.org/show_bug.cgi?id=34170
+
+ numeric_limits<double>::quiet_NaN is broken in Symbian
+ causing NaN to be evaluated as a number.
+
+ * runtime/JSValue.cpp:
+ (JSC::nonInlineNaN):
+
+2010-02-09 Tamas Szirbucz <szirbucz@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Add a soft modulo operation to ARM JIT using a trampoline function.
+ The performance progression is about ~1.8% on ARMv7
+ https://bugs.webkit.org/show_bug.cgi?id=34424
+
+ Developed in cooperation with Gabor Loki.
+
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_mod):
+ (JSC::JIT::emitSlow_op_mod):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::softModulo):
+ * jit/JITStubs.h:
+ (JSC::JITThunks::ctiSoftModulo):
+ * wtf/Platform.h:
+
+2010-02-08 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (SL/win build fixes).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * runtime/StringPrototype.cpp:
+
+2010-02-08 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt
+
+ Make String.replace throw an exception on out-of-memory, rather than
+ returning a null (err, empty-ish) string. Move String::replaceRange
+ and String::spliceSubstringsWithSeparators out to StringPrototype -
+ these were fairly specific use anyway, and we can better integrate
+ throwing the JS expcetion this way.
+
+ Also removes redundant assignment operator from UString.
+
+ * JavaScriptCore.exp:
+ * runtime/StringPrototype.cpp:
+ (JSC::StringRange::StringRange):
+ (JSC::jsSpliceSubstringsWithSeparators):
+ (JSC::jsReplaceRange):
+ (JSC::stringProtoFuncReplace):
+ * runtime/UString.cpp:
+ * runtime/UString.h:
+
+2010-02-08 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Undefine WTF_OS_WINDOWS and WTF_PLATFORM_WIN
+ https://bugs.webkit.org/show_bug.cgi?id=34561
+
+ As the binary for simulator is built with MSVC 2005,
+ WTF_OS_WINDOWS and WTF_PLATFORM_WIN are defined.
+ Undefine them as we don't target Windows.
+
+ * wtf/Platform.h:
+
+2010-02-08 Chris Rogers <crogers@google.com>
+
+ Reviewed by Darin Adler.
+
+ audio engine: add Vector3 class
+ https://bugs.webkit.org/show_bug.cgi?id=34548
+
+ * wtf/Vector3.h: Added.
+ (WebCore::Vector3::Vector3):
+ (WebCore::Vector3::abs):
+ (WebCore::Vector3::isZero):
+ (WebCore::Vector3::normalize):
+ (WebCore::Vector3::x):
+ (WebCore::Vector3::y):
+ (WebCore::Vector3::z):
+ (WebCore::operator+):
+ (WebCore::operator-):
+ (WebCore::operator*):
+ (WebCore::dot):
+ (WebCore::cross):
+ (WebCore::distance):
+
+2010-02-08 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Fix warning in clang++
+
+ * runtime/Structure.h:
+ (JSC::Structure::propertyStorageSize):
+
+2010-02-08 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Make makeString CRASH if we fail to allocate a string.
+
+ (tryMakeString or jsMakeNontrivialString can be used where we
+ expect allocation may fail and want to handle the error).
+
+ * runtime/JSStringBuilder.h:
+ (JSC::jsMakeNontrivialString):
+ * runtime/UString.h:
+ (JSC::tryMakeString):
+ (JSC::makeString):
+
+2010-02-08 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber Stamped by Oliver Hunt.
+
+ Remove a couple of unnecesary C-style casts spotted by Darin.
+
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::encode):
+ (JSC::globalFuncEscape):
+
+2010-02-08 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Switch some more StringBuilder/jsNontrivialString code to use
+ JSStringBuilder/jsMakeNontrivialString - these methods will
+ throw an exception if we hit out-of-memory, rather than just
+ CRASHing.
+
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncToString):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::encode):
+ (JSC::decode):
+ (JSC::globalFuncEscape):
+
+2010-02-08 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Use an empty identifier instead of a null identifier for parse
+ tokens without an identifier.
+
+ This helps encapsulate the null UStringImpl within UString.
+
+ * parser/Grammar.y:
+ * parser/NodeConstructors.h:
+ (JSC::ContinueNode::ContinueNode):
+ (JSC::BreakNode::BreakNode):
+ (JSC::ForInNode::ForInNode):
+ * runtime/CommonIdentifiers.cpp:
+ (JSC::CommonIdentifiers::CommonIdentifiers):
+ * runtime/CommonIdentifiers.h:
+ * runtime/FunctionPrototype.cpp:
+ (JSC::FunctionPrototype::FunctionPrototype):
+
+2010-02-08 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Build fix for make distcheck.
+
+ * GNUmakefile.am:
+
+2010-02-08 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Unreviewed RVCT build fix.
+
+ Similar to r54391, don't import the cmath functions from std:: for RVCT.
+
+ * wtf/MathExtras.h:
+
+2010-02-05 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Change UStringImpl::create to CRASH if the string cannot be allocated,
+ rather than returning a null string (which will behave like a zero-length
+ string if used).
+
+ Also move createRep function from UString to become new overloaded
+ UStringImpl::create methods. In doing so, bring their behaviour closer to
+ being in line with WebCore::StringImpl, in removing the behaviour that they
+ can be used to produce null UStrings (ASSERT the char* provided is non-null).
+ This behaviour of converting null C-strings to null UStrings is inefficient
+ (cmompared to just using UString::null()), incompatible with WebCore::StringImpl's
+ behaviour, and may generate unexpected behaviour, since in many cases a null
+ UString can be used like an empty string.
+
+ With these changes UStringImpl need not have a concept of null impls, we can
+ start transitioning this to become an implementation detail of UString, that
+ internally it chooses to use a null-object rather than an actually zero impl
+ pointer.
+
+ * JavaScriptCore.exp:
+ * debugger/Debugger.cpp:
+ (JSC::Debugger::recompileAllJSFunctions):
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::calculatedFunctionName):
+ * parser/Parser.cpp:
+ (JSC::Parser::parse):
+ * profiler/Profile.cpp:
+ (JSC::Profile::Profile):
+ * profiler/ProfileGenerator.cpp:
+ (JSC::ProfileGenerator::stopProfiling):
+ * runtime/Error.cpp:
+ (JSC::Error::create):
+ (JSC::throwError):
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::createError):
+ * runtime/Identifier.cpp:
+ (JSC::Identifier::add):
+ * runtime/PropertyNameArray.cpp:
+ (JSC::PropertyNameArray::add):
+ * runtime/UString.cpp:
+ (JSC::initializeUString):
+ (JSC::UString::UString):
+ (JSC::UString::operator=):
+ * runtime/UString.h:
+ (JSC::UString::isNull):
+ (JSC::UString::null):
+ (JSC::UString::rep):
+ (JSC::UString::UString):
+ * runtime/UStringImpl.cpp:
+ (JSC::UStringImpl::create):
+ * runtime/UStringImpl.h:
+
+2010-02-05 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Define SYSTEM_MALLOC 1
+ https://bugs.webkit.org/show_bug.cgi?id=34640
+
+ Make BREWMP use system malloc because FastMalloc is not ported.
+
+ * wtf/Platform.h:
+
+2010-02-05 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Don't call CRASH() in fastMalloc and fastCalloc when the requested memory size is 0
+ https://bugs.webkit.org/show_bug.cgi?id=34569
+
+ With USE_SYSTEM_MALLOC=1, fastMalloc and fastCalloc call CRASH()
+ if the return value of malloc and calloc is 0.
+
+ However, these functions can return 0 when the request size is 0.
+ Libc manual says, "If size is 0, then malloc() returns either NULL,
+ or a unique pointer value that can later be successfully passed to free()."
+ Though malloc returns a unique pointer in most systems,
+ 0 can be returned in some systems. For instance, BREW's MALLOC returns 0
+ when size is 0.
+
+ If malloc or calloc returns 0 due to allocation size, increase the size
+ to 1 and try again.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::fastMalloc):
+ (WTF::fastCalloc):
+
+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.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Accommodate rename of script.
+
+2010-02-04 Daniel Bates <dbates@webkit.org>
+
+ [Qt] Unreviewed, build fix for Qt bot.
+
+ * runtime/JSStringBuilder.h: Changed #include <X.h> notation #include "X.h".
+
+2010-02-04 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Clearing a WeakGCPtr is weird
+ https://bugs.webkit.org/show_bug.cgi?id=34627
+
+ Added a WeakGCPtr::clear interface.
+
+ As discussed in https://bugs.webkit.org/show_bug.cgi?id=33383, the old
+ interface made it pretty weird for a client to conditionally clear a
+ WeakGCPtr, which is exactly what clients want to do when objects are
+ finalized.
+
+ * API/JSClassRef.cpp:
+ (clearReferenceToPrototype): Use the new WeakGCPtr::clear() interface.
+
+ * runtime/WeakGCPtr.h:
+ (JSC::WeakGCPtr::clear): Added an interface for clearing a WeakGCPtr,
+ iff its current value is the value passed in. It's cumbersome for the
+ client to do this test, since WeakGCPtr sometimes pretends to be null.
+
+2010-02-04 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: export a header.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2010-02-04 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Add a JSStringBuilder class (similar-to, and derived-from StringBuilder) to
+ construct JSStrings, throwing a JS exception should we run out of memory whilst
+ allocating storage for the string.
+
+ Similarly, add jsMakeNontrivialString methods to use in cases where previously
+ we were calling makeString & passing the result to jsNontrivialString. Again,
+ these new methods throw if we hit an out of memory condition.
+
+ Move throwOutOfMemoryError into ExceptionHelpers, to make it more widely available.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToString):
+ (JSC::arrayProtoFuncToLocaleString):
+ (JSC::arrayProtoFuncJoin):
+ * runtime/DateConstructor.cpp:
+ (JSC::callDate):
+ * runtime/DatePrototype.cpp:
+ (JSC::dateProtoFuncToString):
+ (JSC::dateProtoFuncToUTCString):
+ (JSC::dateProtoFuncToGMTString):
+ * runtime/ErrorPrototype.cpp:
+ (JSC::errorProtoFuncToString):
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::throwOutOfMemoryError):
+ * runtime/ExceptionHelpers.h:
+ * runtime/JSStringBuilder.h: Added.
+ (JSC::JSStringBuilder::releaseJSString):
+ (JSC::jsMakeNontrivialString):
+ * runtime/NumberPrototype.cpp:
+ (JSC::numberProtoFuncToPrecision):
+ * runtime/ObjectPrototype.cpp:
+ (JSC::objectProtoFuncToString):
+ * runtime/Operations.cpp:
+ * runtime/Operations.h:
+ * runtime/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncToString):
+ * runtime/StringBuilder.h:
+ (JSC::StringBuilder::append):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncBig):
+ (JSC::stringProtoFuncSmall):
+ (JSC::stringProtoFuncBlink):
+ (JSC::stringProtoFuncBold):
+ (JSC::stringProtoFuncFixed):
+ (JSC::stringProtoFuncItalics):
+ (JSC::stringProtoFuncStrike):
+ (JSC::stringProtoFuncSub):
+ (JSC::stringProtoFuncSup):
+ (JSC::stringProtoFuncFontcolor):
+ (JSC::stringProtoFuncFontsize):
+ (JSC::stringProtoFuncAnchor):
+
+2010-02-04 Steve Falkenburg <sfalken@apple.com>
+
+ Windows build fix.
+
+ * wtf/MathExtras.h:
+
+2010-02-04 Darin Adler <darin@apple.com>
+
+ Reviewed by David Levin.
+
+ Make MathExtras.h compatible with <cmath>
+ https://bugs.webkit.org/show_bug.cgi?id=34618
+
+ * wtf/MathExtras.h: Include <cmath> instead of <math.h>.
+ Use "using" as we do elsewhere in WTF for the four functions from <cmath>
+ we want to use without the prefix. Later we could consider making the std
+ explicit at call sites instead.
+
+2010-02-04 Tamas Szirbucz <szirbucz@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Use an easily appendable structure for trampolines instead of pointer parameters.
+ https://bugs.webkit.org/show_bug.cgi?id=34424
+
+ * assembler/ARMAssembler.cpp:
+ (JSC::ARMAssembler::executableCopy):
+ * jit/JIT.h:
+ (JSC::JIT::compileCTIMachineTrampolines):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::JITThunks):
+ * jit/JITStubs.h:
+ (JSC::JITThunks::ctiStringLengthTrampoline):
+ (JSC::JITThunks::ctiVirtualCallLink):
+ (JSC::JITThunks::ctiVirtualCall):
+ (JSC::JITThunks::ctiNativeCallThunk):
+
2010-02-04 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed by Simon Hausmann.
diff --git a/JavaScriptCore/Configurations/FeatureDefines.xcconfig b/JavaScriptCore/Configurations/FeatureDefines.xcconfig
index 24589c7..8343ce7 100644
--- a/JavaScriptCore/Configurations/FeatureDefines.xcconfig
+++ b/JavaScriptCore/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/JavaScriptCore/Configurations/Version.xcconfig b/JavaScriptCore/Configurations/Version.xcconfig
index 75f9bd4..0e289b1 100644
--- a/JavaScriptCore/Configurations/Version.xcconfig
+++ b/JavaScriptCore/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/JavaScriptCore/GNUmakefile.am b/JavaScriptCore/GNUmakefile.am
index 7ac6a8c..4ac89d9 100644
--- a/JavaScriptCore/GNUmakefile.am
+++ b/JavaScriptCore/GNUmakefile.am
@@ -192,6 +192,7 @@ javascriptcore_sources += \
JavaScriptCore/runtime/JSONObject.h \
JavaScriptCore/runtime/JSPropertyNameIterator.cpp \
JavaScriptCore/runtime/JSPropertyNameIterator.h \
+ JavaScriptCore/runtime/JSStringBuilder.h \
JavaScriptCore/runtime/JSZombie.h \
JavaScriptCore/runtime/LiteralParser.cpp \
JavaScriptCore/runtime/LiteralParser.h \
@@ -288,6 +289,7 @@ javascriptcore_sources += \
JavaScriptCore/wtf/TypeTraits.cpp \
JavaScriptCore/wtf/TypeTraits.h \
JavaScriptCore/wtf/UnusedParam.h \
+ JavaScriptCore/wtf/ValueCheck.h \
JavaScriptCore/wtf/Vector.h \
JavaScriptCore/wtf/VectorTraits.h \
JavaScriptCore/wtf/gtk/GOwnPtr.cpp \
diff --git a/JavaScriptCore/JavaScriptCore.exp b/JavaScriptCore/JavaScriptCore.exp
index 01d3144..f562b52 100644
--- a/JavaScriptCore/JavaScriptCore.exp
+++ b/JavaScriptCore/JavaScriptCore.exp
@@ -104,7 +104,6 @@ __ZN3JSC11JSByteArray15createStructureENS_7JSValueE
__ZN3JSC11JSByteArrayC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPNS3_9ByteArrayEPKNS_9ClassInfoE
__ZN3JSC11ParserArena5resetEv
__ZN3JSC11UStringImpl12sharedBufferEv
-__ZN3JSC11UStringImpl6s_nullE
__ZN3JSC11UStringImpl7s_emptyE
__ZN3JSC11UStringImplD1Ev
__ZN3JSC11checkSyntaxEPNS_9ExecStateERKNS_10SourceCodeE
@@ -191,6 +190,7 @@ __ZN3JSC35createInterruptedExecutionExceptionEPNS_12JSGlobalDataE
__ZN3JSC3NaNE
__ZN3JSC4Heap14primaryHeapEndEv
__ZN3JSC4Heap15recordExtraCostEm
+__ZN3JSC4Heap16objectTypeCountsEv
__ZN3JSC4Heap16primaryHeapBeginEv
__ZN3JSC4Heap17collectAllGarbageEv
__ZN3JSC4Heap17globalObjectCountEv
@@ -238,9 +238,9 @@ __ZN3JSC7UString4fromEd
__ZN3JSC7UString4fromEi
__ZN3JSC7UString4fromEj
__ZN3JSC7UString4fromEl
+__ZN3JSC7UString9s_nullRepE
__ZN3JSC7UStringC1EPKc
__ZN3JSC7UStringC1EPKti
-__ZN3JSC7UStringaSEPKc
__ZN3JSC8Debugger23recompileAllJSFunctionsEPNS_12JSGlobalDataE
__ZN3JSC8Debugger6attachEPNS_14JSGlobalObjectE
__ZN3JSC8Debugger6detachEPNS_14JSGlobalObjectE
@@ -300,6 +300,7 @@ __ZN3JSCgtERKNS_7UStringES2_
__ZN3JSCltERKNS_7UStringES2_
__ZN3WTF10fastCallocEmm
__ZN3WTF10fastMallocEm
+__ZN3WTF10fastStrDupEPKc
__ZN3WTF11currentTimeEv
__ZN3WTF11fastReallocEPvm
__ZN3WTF12createThreadEPFPvS0_ES0_
@@ -348,10 +349,9 @@ __ZN3WTF8Collator18setOrderLowerFirstEb
__ZN3WTF8CollatorC1EPKc
__ZN3WTF8CollatorD1Ev
__ZN3WTF8fastFreeEPv
-__ZN3WTF10fastStrDupEPKc
__ZN3WTF8msToYearEd
-__ZN3WTF9dayInYearEdi
__ZN3WTF9ByteArray6createEm
+__ZN3WTF9dayInYearEdi
__ZNK3JSC10JSFunction23isHostFunctionNonInlineEv
__ZNK3JSC11Interpreter14retrieveCallerEPNS_9ExecStateEPNS_16InternalFunctionE
__ZNK3JSC11Interpreter18retrieveLastCallerEPNS_9ExecStateERiRlRNS_7UStringERNS_7JSValueE
diff --git a/JavaScriptCore/JavaScriptCore.gypi b/JavaScriptCore/JavaScriptCore.gypi
index 24577da..c67b6a8 100644
--- a/JavaScriptCore/JavaScriptCore.gypi
+++ b/JavaScriptCore/JavaScriptCore.gypi
@@ -441,6 +441,7 @@
'wtf/unicode/UTF8.cpp',
'wtf/unicode/UTF8.h',
'wtf/UnusedParam.h',
+ 'wtf/ValueCheck.h',
'wtf/Vector.h',
'wtf/VectorTraits.h',
'wtf/VMTags.h',
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
index 6a0f1d8..6afef77 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
+++ b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
@@ -32,7 +32,6 @@ EXPORTS
??1ThreadCondition@WTF@@QAE@XZ
??1UStringImpl@JSC@@AAE@XZ
??2JSGlobalObject@JSC@@SAPAXIPAVJSGlobalData@1@@Z
- ??4UString@JSC@@QAEAAV01@PBD@Z
??8JSC@@YA_NABVUString@0@0@Z
?NaN@JSC@@3NB
?UTF8String@UString@JSC@@QBE?AVCString@2@_N@Z
@@ -126,6 +125,7 @@ EXPORTS
?fastFree@WTF@@YAXPAX@Z
?fastMalloc@WTF@@YAPAXI@Z
?fastRealloc@WTF@@YAPAXPAXI@Z
+ ?fastStrDup@WTF@@YAPADPBD@Z
?fastZeroedMalloc@WTF@@YAPAXI@Z
?fillGetterPropertySlot@JSObject@JSC@@QAEXAAVPropertySlot@2@PAVJSValue@2@@Z
?focus@Profile@JSC@@QAEXPBVProfileNode@2@@Z
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj b/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj
index 7a93632..c5b826c 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj
+++ b/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj
@@ -545,6 +545,10 @@
>
</File>
<File
+ RelativePath="..\..\wtf\ValueCheck.h"
+ >
+ </File>
+ <File
RelativePath="..\..\wtf\Vector.h"
>
</File>
diff --git a/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
index 58016d0..5f904ce 100644
--- a/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
+++ b/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
@@ -44,7 +44,7 @@
0B4D7E630F319AC800AD7E58 /* TypeTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = 0B4D7E620F319AC800AD7E58 /* TypeTraits.h */; settings = {ATTRIBUTES = (Private, ); }; };
0BDFFAE00FC6192900D69EF4 /* CrossThreadRefCounted.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BDFFAD40FC6171000D69EF4 /* CrossThreadRefCounted.h */; settings = {ATTRIBUTES = (Private, ); }; };
0BDFFAE10FC6193100D69EF4 /* OwnFastMallocPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BDFFAD10FC616EC00D69EF4 /* OwnFastMallocPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 14035DB110DBFB2A00FFFFE7 /* WeakGCPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 14035DB010DBFB2A00FFFFE7 /* WeakGCPtr.h */; };
+ 14035DB110DBFB2A00FFFFE7 /* WeakGCPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 14035DB010DBFB2A00FFFFE7 /* WeakGCPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
140566C4107EC255005DBC8D /* JSAPIValueWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC0894D50FAFBA2D00001865 /* JSAPIValueWrapper.cpp */; };
140566D1107EC267005DBC8D /* JSStaticScopeObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E42C190E3938830065A544 /* JSStaticScopeObject.cpp */; };
140566D6107EC271005DBC8D /* JSFunction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A85E0255597D01FF60F7 /* JSFunction.cpp */; };
@@ -232,6 +232,7 @@
86D3B3C410159D7F002865E7 /* RepatchBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D3B3C210159D7F002865E7 /* RepatchBuffer.h */; };
86DB64640F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86DB64630F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp */; };
86E116B10FE75AC800B512BC /* CodeLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = 86E116B00FE75AC800B512BC /* CodeLocation.h */; };
+ 86E85539111B9968001AF51E /* JSStringBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 86E85538111B9968001AF51E /* JSStringBuilder.h */; };
86EAC4950F93E8D1008EC948 /* RegexCompiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86EAC48D0F93E8D1008EC948 /* RegexCompiler.cpp */; };
86EAC4960F93E8D1008EC948 /* RegexCompiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 86EAC48E0F93E8D1008EC948 /* RegexCompiler.h */; };
86EAC4970F93E8D1008EC948 /* RegexInterpreter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86EAC48F0F93E8D1008EC948 /* RegexInterpreter.cpp */; };
@@ -474,6 +475,7 @@
E124A8F70E555775003091F1 /* OpaqueJSString.h in Headers */ = {isa = PBXBuildFile; fileRef = E124A8F50E555775003091F1 /* OpaqueJSString.h */; settings = {ATTRIBUTES = (Private, ); }; };
E124A8F80E555775003091F1 /* OpaqueJSString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E124A8F60E555775003091F1 /* OpaqueJSString.cpp */; };
E178636D0D9BEEC300D74E75 /* InitializeThreading.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E178636C0D9BEEC300D74E75 /* InitializeThreading.cpp */; };
+ E17FF771112131D200076A19 /* ValueCheck.h in Headers */ = {isa = PBXBuildFile; fileRef = E17FF770112131D200076A19 /* ValueCheck.h */; settings = {ATTRIBUTES = (Private, ); }; };
E18E3A590DF9278C00D90B34 /* JSGlobalData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E18E3A570DF9278C00D90B34 /* JSGlobalData.cpp */; };
E1A862A90D7EBB76001EC6AA /* CollatorICU.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1A862A80D7EBB76001EC6AA /* CollatorICU.cpp */; settings = {COMPILER_FLAGS = "-fno-strict-aliasing"; }; };
E1A862D60D7F2B5C001EC6AA /* CollatorDefault.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1A862D50D7F2B5C001EC6AA /* CollatorDefault.cpp */; };
@@ -766,6 +768,7 @@
86DB645F0F954E9100D7D921 /* ExecutableAllocatorWin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExecutableAllocatorWin.cpp; sourceTree = "<group>"; };
86DB64630F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExecutableAllocatorFixedVMPool.cpp; sourceTree = "<group>"; };
86E116B00FE75AC800B512BC /* CodeLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodeLocation.h; sourceTree = "<group>"; };
+ 86E85538111B9968001AF51E /* JSStringBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStringBuilder.h; sourceTree = "<group>"; };
86EAC48D0F93E8D1008EC948 /* RegexCompiler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegexCompiler.cpp; path = yarr/RegexCompiler.cpp; sourceTree = "<group>"; };
86EAC48E0F93E8D1008EC948 /* RegexCompiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegexCompiler.h; path = yarr/RegexCompiler.h; sourceTree = "<group>"; };
86EAC48F0F93E8D1008EC948 /* RegexInterpreter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegexInterpreter.cpp; path = yarr/RegexInterpreter.cpp; sourceTree = "<group>"; };
@@ -977,6 +980,7 @@
E124A8F60E555775003091F1 /* OpaqueJSString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OpaqueJSString.cpp; sourceTree = "<group>"; };
E178633F0D9BEC0000D74E75 /* InitializeThreading.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InitializeThreading.h; sourceTree = "<group>"; };
E178636C0D9BEEC300D74E75 /* InitializeThreading.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InitializeThreading.cpp; sourceTree = "<group>"; };
+ E17FF770112131D200076A19 /* ValueCheck.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ValueCheck.h; sourceTree = "<group>"; };
E18E3A560DF9278C00D90B34 /* JSGlobalData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalData.h; sourceTree = "<group>"; };
E18E3A570DF9278C00D90B34 /* JSGlobalData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGlobalData.cpp; sourceTree = "<group>"; };
E195678F09E7CF1200B89D13 /* UnicodeIcu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnicodeIcu.h; sourceTree = "<group>"; };
@@ -1384,6 +1388,7 @@
0B330C260F38C62300692DE3 /* TypeTraits.cpp */,
0B4D7E620F319AC800AD7E58 /* TypeTraits.h */,
935AF46B09E9D9DB00ACD1D8 /* UnusedParam.h */,
+ E17FF770112131D200076A19 /* ValueCheck.h */,
6592C316098B7DE10003D4F6 /* Vector.h */,
6592C317098B7DE10003D4F6 /* VectorTraits.h */,
96DD73780F9DA3100027FBCC /* VMTags.h */,
@@ -1544,6 +1549,7 @@
A7E42C180E3938830065A544 /* JSStaticScopeObject.h */,
BC02E9B60E1842FA000F9297 /* JSString.cpp */,
F692A8620255597D01FF60F7 /* JSString.h */,
+ 86E85538111B9968001AF51E /* JSStringBuilder.h */,
14ABB454099C2A0F00E2A24F /* JSType.h */,
6507D2970E871E4A00D7D896 /* JSTypeInfo.h */,
F692A8870255597D01FF60F7 /* JSValue.cpp */,
@@ -2050,6 +2056,8 @@
1429DAE00ED2645B00B89619 /* WRECGenerator.h in Headers */,
1429DABF0ED263E700B89619 /* WRECParser.h in Headers */,
9688CB160ED12B4E001D649F /* X86Assembler.h in Headers */,
+ 86E85539111B9968001AF51E /* JSStringBuilder.h in Headers */,
+ E17FF771112131D200076A19 /* ValueCheck.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2104,7 +2112,7 @@
932F5BD20822A1C700736975 /* Frameworks */,
9319586B09D9F91A00A56FD4 /* Check For Global Initializers */,
933457200EBFDC3F00B80894 /* Check For Exit Time Destructors */,
- 5D29D8BE0E9860B400C3D2D0 /* Check For Weak VTables */,
+ 5D29D8BE0E9860B400C3D2D0 /* Check For Weak VTables and Externals */,
);
buildRules = (
);
@@ -2203,7 +2211,7 @@
shellPath = /bin/sh;
shellScript = "# exclude NPN functions on 64-bit\nsed -e s/^.\\*NPN.\\*$// \"${SRCROOT}/JavaScriptCore.exp\" > \"${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore/JavaScriptCore.LP64.exp\"\n";
};
- 5D29D8BE0E9860B400C3D2D0 /* Check For Weak VTables */ = {
+ 5D29D8BE0E9860B400C3D2D0 /* Check For Weak VTables and Externals */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
@@ -2211,12 +2219,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 [ -f ../WebKitTools/Scripts/check-for-weak-vtables ]; then\n ../WebKitTools/Scripts/check-for-weak-vtables || exit $?\nfi";
+ shellScript = "if [ -f ../WebKitTools/Scripts/check-for-weak-vtables-and-externals ]; then\n ../WebKitTools/Scripts/check-for-weak-vtables-and-externals || exit $?\nfi";
};
5D2F7CF90C6875BB00B5B72B /* Update Info.plist with version information */ = {
isa = PBXShellScriptBuildPhase;
diff --git a/JavaScriptCore/debugger/Debugger.cpp b/JavaScriptCore/debugger/Debugger.cpp
index 1d2e4fb..cbcbd21 100644
--- a/JavaScriptCore/debugger/Debugger.cpp
+++ b/JavaScriptCore/debugger/Debugger.cpp
@@ -94,7 +94,7 @@ void Debugger::recompileAllJSFunctions(JSGlobalData* globalData)
// JavaScript in the inspector.
SourceProviderMap::const_iterator end = sourceProviders.end();
for (SourceProviderMap::const_iterator iter = sourceProviders.begin(); iter != end; ++iter)
- sourceParsed(iter->second, SourceCode(iter->first), -1, 0);
+ sourceParsed(iter->second, SourceCode(iter->first), -1, UString());
}
JSValue evaluateInGlobalCallFrame(const UString& script, JSValue& exception, JSGlobalObject* globalObject)
diff --git a/JavaScriptCore/debugger/DebuggerCallFrame.cpp b/JavaScriptCore/debugger/DebuggerCallFrame.cpp
index c6b4223..05a385d 100644
--- a/JavaScriptCore/debugger/DebuggerCallFrame.cpp
+++ b/JavaScriptCore/debugger/DebuggerCallFrame.cpp
@@ -50,11 +50,11 @@ const UString* DebuggerCallFrame::functionName() const
UString DebuggerCallFrame::calculatedFunctionName() const
{
if (!m_callFrame->codeBlock())
- return 0;
+ return UString();
JSFunction* function = asFunction(m_callFrame->callee());
if (!function)
- return 0;
+ return UString();
return function->calculatedDisplayName(m_callFrame);
}
diff --git a/JavaScriptCore/jit/JIT.h b/JavaScriptCore/jit/JIT.h
index 8e0c9ac..bfbb1ee 100644
--- a/JavaScriptCore/jit/JIT.h
+++ b/JavaScriptCore/jit/JIT.h
@@ -317,10 +317,10 @@ namespace JSC {
jit.privateCompilePutByIdTransition(stubInfo, oldStructure, newStructure, cachedOffset, chain, returnAddress);
}
- static void compileCTIMachineTrampolines(JSGlobalData* globalData, RefPtr<ExecutablePool>* executablePool, CodePtr* ctiStringLengthTrampoline, CodePtr* ctiVirtualCallLink, CodePtr* ctiVirtualCall, CodePtr* ctiNativeCallThunk)
+ static void compileCTIMachineTrampolines(JSGlobalData* globalData, RefPtr<ExecutablePool>* executablePool, TrampolineStructure *trampolines)
{
JIT jit(globalData);
- jit.privateCompileCTIMachineTrampolines(executablePool, globalData, ctiStringLengthTrampoline, ctiVirtualCallLink, ctiVirtualCall, ctiNativeCallThunk);
+ jit.privateCompileCTIMachineTrampolines(executablePool, globalData, trampolines);
}
static void patchGetByIdSelf(CodeBlock* codeblock, StructureStubInfo*, Structure*, size_t cachedOffset, ReturnAddressPtr returnAddress);
@@ -361,7 +361,7 @@ namespace JSC {
void privateCompileGetByIdChain(StructureStubInfo*, Structure*, StructureChain*, size_t count, size_t cachedOffset, ReturnAddressPtr returnAddress, CallFrame* callFrame);
void privateCompilePutByIdTransition(StructureStubInfo*, Structure*, Structure*, size_t cachedOffset, StructureChain*, ReturnAddressPtr returnAddress);
- void privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executablePool, JSGlobalData* data, CodePtr* ctiStringLengthTrampoline, CodePtr* ctiVirtualCallLink, CodePtr* ctiVirtualCall, CodePtr* ctiNativeCallThunk);
+ void privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executablePool, JSGlobalData* data, TrampolineStructure *trampolines);
void privateCompilePatchGetArrayLength(ReturnAddressPtr returnAddress);
void addSlowCase(Jump);
@@ -800,6 +800,9 @@ namespace JSC {
void emit_op_to_jsnumber(Instruction*);
void emit_op_to_primitive(Instruction*);
void emit_op_unexpected_load(Instruction*);
+#if ENABLE(JIT_OPTIMIZE_MOD)
+ void softModulo();
+#endif
void emitSlow_op_add(Instruction*, Vector<SlowCaseEntry>::iterator&);
void emitSlow_op_bitand(Instruction*, Vector<SlowCaseEntry>::iterator&);
diff --git a/JavaScriptCore/jit/JITArithmetic.cpp b/JavaScriptCore/jit/JITArithmetic.cpp
index feee8d2..2f2ffe3 100644
--- a/JavaScriptCore/jit/JITArithmetic.cpp
+++ b/JavaScriptCore/jit/JITArithmetic.cpp
@@ -31,6 +31,7 @@
#include "CodeBlock.h"
#include "JITInlineMethods.h"
#include "JITStubCall.h"
+#include "JITStubs.h"
#include "JSArray.h"
#include "JSFunction.h"
#include "Interpreter.h"
@@ -1186,14 +1187,40 @@ void JIT::emit_op_mod(Instruction* currentInstruction)
unsigned op1 = currentInstruction[2].u.operand;
unsigned op2 = currentInstruction[3].u.operand;
+#if ENABLE(JIT_OPTIMIZE_MOD)
+ emitLoad2(op1, regT1, regT0, op2, regT3, regT2);
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ addSlowCase(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag)));
+
+ addSlowCase(branch32(Equal, regT2, Imm32(0)));
+
+ emitNakedCall(m_globalData->jitStubs.ctiSoftModulo());
+
+ emitStoreInt32(dst, regT0, (op1 == dst || op2 == dst));
+#else
JITStubCall stubCall(this, cti_op_mod);
stubCall.addArgument(op1);
stubCall.addArgument(op2);
stubCall.call(dst);
+#endif
}
-void JIT::emitSlow_op_mod(Instruction*, Vector<SlowCaseEntry>::iterator&)
+void JIT::emitSlow_op_mod(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
{
+#if ENABLE(JIT_OPTIMIZE_MOD)
+ unsigned result = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_mod);
+ stubCall.addArgument(op1);
+ stubCall.addArgument(op2);
+ stubCall.call(result);
+#else
+ ASSERT_NOT_REACHED();
+#endif
}
#endif // CPU(X86) || CPU(X86_64)
@@ -2138,15 +2165,40 @@ void JIT::emit_op_mod(Instruction* currentInstruction)
unsigned op1 = currentInstruction[2].u.operand;
unsigned op2 = currentInstruction[3].u.operand;
+#if ENABLE(JIT_OPTIMIZE_MOD)
+ emitGetVirtualRegisters(op1, regT0, op2, regT2);
+ emitJumpSlowCaseIfNotImmediateInteger(regT0);
+ emitJumpSlowCaseIfNotImmediateInteger(regT2);
+
+ addSlowCase(branch32(Equal, regT2, Imm32(1)));
+
+ emitNakedCall(m_globalData->jitStubs.ctiSoftModulo());
+
+ emitPutVirtualRegister(result, regT0);
+#else
JITStubCall stubCall(this, cti_op_mod);
stubCall.addArgument(op1, regT2);
stubCall.addArgument(op2, regT2);
stubCall.call(result);
+#endif
}
-void JIT::emitSlow_op_mod(Instruction*, Vector<SlowCaseEntry>::iterator&)
+void JIT::emitSlow_op_mod(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
{
+#if ENABLE(JIT_OPTIMIZE_MOD)
+ unsigned result = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_mod);
+ stubCall.addArgument(op1, regT2);
+ stubCall.addArgument(op2, regT2);
+ stubCall.call(result);
+#else
ASSERT_NOT_REACHED();
+#endif
}
#endif // CPU(X86) || CPU(X86_64)
diff --git a/JavaScriptCore/jit/JITOpcodes.cpp b/JavaScriptCore/jit/JITOpcodes.cpp
index d9a32d9..c3f20f1 100644
--- a/JavaScriptCore/jit/JITOpcodes.cpp
+++ b/JavaScriptCore/jit/JITOpcodes.cpp
@@ -40,8 +40,12 @@ namespace JSC {
#if USE(JSVALUE32_64)
-void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executablePool, JSGlobalData* globalData, CodePtr* ctiStringLengthTrampoline, CodePtr* ctiVirtualCallLink, CodePtr* ctiVirtualCall, CodePtr* ctiNativeCallThunk)
+void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executablePool, JSGlobalData* globalData, TrampolineStructure *trampolines)
{
+#if ENABLE(JIT_OPTIMIZE_MOD)
+ Label softModBegin = align();
+ softModulo();
+#endif
#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
// (1) This function provides fast property access for string length
Label stringLengthBegin = align();
@@ -365,18 +369,21 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
CodeRef finalCode = patchBuffer.finalizeCode();
*executablePool = finalCode.m_executablePool;
- *ctiVirtualCall = trampolineAt(finalCode, virtualCallBegin);
- *ctiNativeCallThunk = trampolineAt(finalCode, nativeCallThunk);
+ trampolines->ctiVirtualCall = trampolineAt(finalCode, virtualCallBegin);
+ trampolines->ctiNativeCallThunk = trampolineAt(finalCode, nativeCallThunk);
#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
- *ctiStringLengthTrampoline = trampolineAt(finalCode, stringLengthBegin);
+ trampolines->ctiStringLengthTrampoline = trampolineAt(finalCode, stringLengthBegin);
#else
UNUSED_PARAM(ctiStringLengthTrampoline);
#endif
#if ENABLE(JIT_OPTIMIZE_CALL)
- *ctiVirtualCallLink = trampolineAt(finalCode, virtualCallLinkBegin);
+ trampolines->ctiVirtualCallLink = trampolineAt(finalCode, virtualCallLinkBegin);
#else
UNUSED_PARAM(ctiVirtualCallLink);
#endif
+#if ENABLE(JIT_OPTIMIZE_MOD)
+ trampolines->ctiSoftModulo = trampolineAt(finalCode, softModBegin);
+#endif
}
void JIT::emit_op_mov(Instruction* currentInstruction)
@@ -1495,8 +1502,12 @@ void JIT::emit_op_profile_did_call(Instruction* currentInstruction)
#define RECORD_JUMP_TARGET(targetOffset) \
do { m_labels[m_bytecodeIndex + (targetOffset)].used(); } while (false)
-void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executablePool, JSGlobalData* globalData, CodePtr* ctiStringLengthTrampoline, CodePtr* ctiVirtualCallLink, CodePtr* ctiVirtualCall, CodePtr* ctiNativeCallThunk)
+void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executablePool, JSGlobalData* globalData, TrampolineStructure *trampolines)
{
+#if ENABLE(JIT_OPTIMIZE_MOD)
+ Label softModBegin = align();
+ softModulo();
+#endif
#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
// (2) The second function provides fast property access for string length
Label stringLengthBegin = align();
@@ -1827,11 +1838,14 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
CodeRef finalCode = patchBuffer.finalizeCode();
*executablePool = finalCode.m_executablePool;
- *ctiVirtualCallLink = trampolineAt(finalCode, virtualCallLinkBegin);
- *ctiVirtualCall = trampolineAt(finalCode, virtualCallBegin);
- *ctiNativeCallThunk = trampolineAt(finalCode, nativeCallThunk);
+ trampolines->ctiVirtualCallLink = trampolineAt(finalCode, virtualCallLinkBegin);
+ trampolines->ctiVirtualCall = trampolineAt(finalCode, virtualCallBegin);
+ trampolines->ctiNativeCallThunk = trampolineAt(finalCode, nativeCallThunk);
+#if ENABLE(JIT_OPTIMIZE_MOD)
+ trampolines->ctiSoftModulo = trampolineAt(finalCode, softModBegin);
+#endif
#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
- *ctiStringLengthTrampoline = trampolineAt(finalCode, stringLengthBegin);
+ trampolines->ctiStringLengthTrampoline = trampolineAt(finalCode, stringLengthBegin);
#else
UNUSED_PARAM(ctiStringLengthTrampoline);
#endif
@@ -2978,6 +2992,81 @@ void JIT::emitSlow_op_to_jsnumber(Instruction* currentInstruction, Vector<SlowCa
#endif // USE(JSVALUE32_64)
+// For both JSValue32_64 and JSValue32
+#if ENABLE(JIT_OPTIMIZE_MOD)
+#if CPU(ARM_TRADITIONAL)
+void JIT::softModulo()
+{
+ push(regS0);
+ push(regS1);
+ push(regT1);
+ push(regT3);
+#if USE(JSVALUE32_64)
+ m_assembler.mov_r(regT3, regT2);
+ m_assembler.mov_r(regT2, regT0);
+#else
+ m_assembler.mov_r(regT3, m_assembler.asr(regT2, 1));
+ m_assembler.mov_r(regT2, m_assembler.asr(regT0, 1));
+#endif
+ m_assembler.mov_r(regT1, ARMAssembler::getOp2(0));
+
+ m_assembler.teq_r(regT3, ARMAssembler::getOp2(0));
+ m_assembler.rsb_r(regT3, regT3, ARMAssembler::getOp2(0), ARMAssembler::MI);
+ m_assembler.eor_r(regT1, regT1, ARMAssembler::getOp2(1), ARMAssembler::MI);
+
+ m_assembler.teq_r(regT2, ARMAssembler::getOp2(0));
+ m_assembler.rsb_r(regT2, regT2, ARMAssembler::getOp2(0), ARMAssembler::MI);
+ m_assembler.eor_r(regT1, regT1, ARMAssembler::getOp2(2), ARMAssembler::MI);
+
+ Jump exitBranch = branch32(LessThan, regT2, regT3);
+
+ m_assembler.sub_r(regS1, regT3, ARMAssembler::getOp2(1));
+ m_assembler.tst_r(regS1, regT3);
+ m_assembler.and_r(regT2, regT2, regS1, ARMAssembler::EQ);
+ m_assembler.and_r(regT0, regS1, regT3);
+ Jump exitBranch2 = branchTest32(Zero, regT0);
+
+ m_assembler.clz_r(regS1, regT2);
+ m_assembler.clz_r(regS0, regT3);
+ m_assembler.sub_r(regS0, regS0, regS1);
+
+ m_assembler.rsbs_r(regS0, regS0, ARMAssembler::getOp2(31));
+
+ m_assembler.mov_r(regS0, m_assembler.lsl(regS0, 1), ARMAssembler::NE);
+
+ m_assembler.add_r(ARMRegisters::pc, ARMRegisters::pc, m_assembler.lsl(regS0, 2), ARMAssembler::NE);
+ m_assembler.mov_r(regT0, regT0);
+
+ for (int i = 31; i > 0; --i) {
+ m_assembler.cmp_r(regT2, m_assembler.lsl(regT3, i));
+ m_assembler.sub_r(regT2, regT2, m_assembler.lsl(regT3, i), ARMAssembler::CS);
+ }
+
+ m_assembler.cmp_r(regT2, regT3);
+ m_assembler.sub_r(regT2, regT2, regT3, ARMAssembler::CS);
+
+ exitBranch.link(this);
+ exitBranch2.link(this);
+
+ m_assembler.teq_r(regT1, ARMAssembler::getOp2(0));
+ m_assembler.rsb_r(regT2, regT2, ARMAssembler::getOp2(0), ARMAssembler::GT);
+
+#if USE(JSVALUE32_64)
+ m_assembler.mov_r(regT0, regT2);
+#else
+ m_assembler.mov_r(regT0, m_assembler.lsl(regT2, 1));
+ m_assembler.eor_r(regT0, regT0, ARMAssembler::getOp2(1));
+#endif
+ pop(regT3);
+ pop(regT1);
+ pop(regS1);
+ pop(regS0);
+ ret();
+}
+#else
+#error "JIT_OPTIMIZE_MOD not yet supported on this platform."
+#endif // CPU(ARM_TRADITIONAL)
+#endif
} // namespace JSC
#endif // ENABLE(JIT)
diff --git a/JavaScriptCore/jit/JITStubs.cpp b/JavaScriptCore/jit/JITStubs.cpp
index bf5168b..85471de 100644
--- a/JavaScriptCore/jit/JITStubs.cpp
+++ b/JavaScriptCore/jit/JITStubs.cpp
@@ -757,7 +757,7 @@ extern "C" {
JITThunks::JITThunks(JSGlobalData* globalData)
{
- JIT::compileCTIMachineTrampolines(globalData, &m_executablePool, &m_ctiStringLengthTrampoline, &m_ctiVirtualCallLink, &m_ctiVirtualCall, &m_ctiNativeCallThunk);
+ JIT::compileCTIMachineTrampolines(globalData, &m_executablePool, &m_trampolineStructure);
#if CPU(ARM_THUMB2)
// Unfortunate the arm compiler does not like the use of offsetof on JITStackFrame (since it contains non POD types),
diff --git a/JavaScriptCore/jit/JITStubs.h b/JavaScriptCore/jit/JITStubs.h
index 99c2dd2..17fd0d9 100644
--- a/JavaScriptCore/jit/JITStubs.h
+++ b/JavaScriptCore/jit/JITStubs.h
@@ -74,6 +74,14 @@ namespace JSC {
JSString* jsString() { return static_cast<JSString*>(asPointer); }
ReturnAddressPtr returnAddress() { return ReturnAddressPtr(asPointer); }
};
+
+ struct TrampolineStructure {
+ MacroAssemblerCodePtr ctiStringLengthTrampoline;
+ MacroAssemblerCodePtr ctiVirtualCallLink;
+ MacroAssemblerCodePtr ctiVirtualCall;
+ MacroAssemblerCodePtr ctiNativeCallThunk;
+ MacroAssemblerCodePtr ctiSoftModulo;
+ };
#if CPU(X86_64)
struct JITStackFrame {
@@ -239,18 +247,16 @@ namespace JSC {
static void tryCacheGetByID(CallFrame*, CodeBlock*, ReturnAddressPtr returnAddress, JSValue baseValue, const Identifier& propertyName, const PropertySlot&, StructureStubInfo* stubInfo);
static void tryCachePutByID(CallFrame*, CodeBlock*, ReturnAddressPtr returnAddress, JSValue baseValue, const PutPropertySlot&, StructureStubInfo* stubInfo);
- MacroAssemblerCodePtr ctiStringLengthTrampoline() { return m_ctiStringLengthTrampoline; }
- MacroAssemblerCodePtr ctiVirtualCallLink() { return m_ctiVirtualCallLink; }
- MacroAssemblerCodePtr ctiVirtualCall() { return m_ctiVirtualCall; }
- MacroAssemblerCodePtr ctiNativeCallThunk() { return m_ctiNativeCallThunk; }
+ MacroAssemblerCodePtr ctiStringLengthTrampoline() { return m_trampolineStructure.ctiStringLengthTrampoline; }
+ MacroAssemblerCodePtr ctiVirtualCallLink() { return m_trampolineStructure.ctiVirtualCallLink; }
+ MacroAssemblerCodePtr ctiVirtualCall() { return m_trampolineStructure.ctiVirtualCall; }
+ MacroAssemblerCodePtr ctiNativeCallThunk() { return m_trampolineStructure.ctiNativeCallThunk; }
+ MacroAssemblerCodePtr ctiSoftModulo() { return m_trampolineStructure.ctiSoftModulo; }
private:
RefPtr<ExecutablePool> m_executablePool;
- MacroAssemblerCodePtr m_ctiStringLengthTrampoline;
- MacroAssemblerCodePtr m_ctiVirtualCallLink;
- MacroAssemblerCodePtr m_ctiVirtualCall;
- MacroAssemblerCodePtr m_ctiNativeCallThunk;
+ TrampolineStructure m_trampolineStructure;
};
extern "C" {
diff --git a/JavaScriptCore/parser/Grammar.y b/JavaScriptCore/parser/Grammar.y
index 717a266..a017cff 100644
--- a/JavaScriptCore/parser/Grammar.y
+++ b/JavaScriptCore/parser/Grammar.y
@@ -1147,7 +1147,7 @@ ThrowStatement:
;
TryStatement:
- TRY Block FINALLY Block { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, $2.m_node, GLOBAL_DATA->propertyNames->nullIdentifier, false, 0, $4.m_node),
+ TRY Block FINALLY Block { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, $2.m_node, GLOBAL_DATA->propertyNames->emptyIdentifier, false, 0, $4.m_node),
mergeDeclarationLists($2.m_varDeclarations, $4.m_varDeclarations),
mergeDeclarationLists($2.m_funcDeclarations, $4.m_funcDeclarations),
$2.m_features | $4.m_features,
@@ -1188,10 +1188,10 @@ FunctionDeclaration:
;
FunctionExpr:
- FUNCTION '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, $5, GLOBAL_DATA->lexer->sourceCode($4, $6, @4.first_line)), ClosureFeature, 0); setStatementLocation($5, @4, @6); }
+ FUNCTION '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->emptyIdentifier, $5, GLOBAL_DATA->lexer->sourceCode($4, $6, @4.first_line)), ClosureFeature, 0); setStatementLocation($5, @4, @6); }
| FUNCTION '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
{
- $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, $6, GLOBAL_DATA->lexer->sourceCode($5, $7, @5.first_line), $3.m_node.head), $3.m_features | ClosureFeature, 0);
+ $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->emptyIdentifier, $6, GLOBAL_DATA->lexer->sourceCode($5, $7, @5.first_line), $3.m_node.head), $3.m_features | ClosureFeature, 0);
if ($3.m_features & ArgumentsFeature)
$6->setUsesArguments();
setStatementLocation($6, @5, @7);
@@ -1981,7 +1981,7 @@ static PropertyNode* makeGetterOrSetterPropertyNode(JSGlobalData* globalData, co
type = PropertyNode::Setter;
else
return 0;
- return new (globalData) PropertyNode(globalData, name, new (globalData) FuncExprNode(globalData, globalData->propertyNames->nullIdentifier, body, source, params), type);
+ return new (globalData) PropertyNode(globalData, name, new (globalData) FuncExprNode(globalData, globalData->propertyNames->emptyIdentifier, body, source, params), type);
}
static ExpressionNode* makeNegateNode(JSGlobalData* globalData, ExpressionNode* n)
diff --git a/JavaScriptCore/parser/NodeConstructors.h b/JavaScriptCore/parser/NodeConstructors.h
index dd3b981..fa8dd4b 100644
--- a/JavaScriptCore/parser/NodeConstructors.h
+++ b/JavaScriptCore/parser/NodeConstructors.h
@@ -741,7 +741,7 @@ namespace JSC {
inline ContinueNode::ContinueNode(JSGlobalData* globalData)
: StatementNode(globalData)
- , m_ident(globalData->propertyNames->nullIdentifier)
+ , m_ident(globalData->propertyNames->emptyIdentifier)
{
}
@@ -753,7 +753,7 @@ namespace JSC {
inline BreakNode::BreakNode(JSGlobalData* globalData)
: StatementNode(globalData)
- , m_ident(globalData->propertyNames->nullIdentifier)
+ , m_ident(globalData->propertyNames->emptyIdentifier)
{
}
@@ -877,7 +877,7 @@ namespace JSC {
inline ForInNode::ForInNode(JSGlobalData* globalData, ExpressionNode* l, ExpressionNode* expr, StatementNode* statement)
: StatementNode(globalData)
- , m_ident(globalData->propertyNames->nullIdentifier)
+ , m_ident(globalData->propertyNames->emptyIdentifier)
, m_init(0)
, m_lexpr(l)
, m_expr(expr)
diff --git a/JavaScriptCore/parser/Parser.cpp b/JavaScriptCore/parser/Parser.cpp
index 003ca0b..56c96b4 100644
--- a/JavaScriptCore/parser/Parser.cpp
+++ b/JavaScriptCore/parser/Parser.cpp
@@ -57,7 +57,7 @@ void Parser::parse(JSGlobalData* globalData, int* errLine, UString* errMsg)
errMsg = &defaultErrMsg;
*errLine = -1;
- *errMsg = 0;
+ *errMsg = UString();
Lexer& lexer = *globalData->lexer;
lexer.setCode(*m_source, m_arena);
diff --git a/JavaScriptCore/profiler/Profile.cpp b/JavaScriptCore/profiler/Profile.cpp
index de75e71..c90f9b0 100644
--- a/JavaScriptCore/profiler/Profile.cpp
+++ b/JavaScriptCore/profiler/Profile.cpp
@@ -42,7 +42,7 @@ Profile::Profile(const UString& title, unsigned uid)
{
// FIXME: When multi-threading is supported this will be a vector and calls
// into the profiler will need to know which thread it is executing on.
- m_head = ProfileNode::create(CallIdentifier("Thread_1", 0, 0), 0, 0);
+ m_head = ProfileNode::create(CallIdentifier("Thread_1", UString(), 0), 0, 0);
}
Profile::~Profile()
diff --git a/JavaScriptCore/profiler/ProfileGenerator.cpp b/JavaScriptCore/profiler/ProfileGenerator.cpp
index 17d37d7..f367033 100644
--- a/JavaScriptCore/profiler/ProfileGenerator.cpp
+++ b/JavaScriptCore/profiler/ProfileGenerator.cpp
@@ -124,7 +124,7 @@ void ProfileGenerator::stopProfiling()
m_currentNode = m_currentNode->parent();
if (double headSelfTime = m_head->selfTime()) {
- RefPtr<ProfileNode> idleNode = ProfileNode::create(CallIdentifier(NonJSExecution, 0, 0), m_head.get(), m_head.get());
+ RefPtr<ProfileNode> idleNode = ProfileNode::create(CallIdentifier(NonJSExecution, UString(), 0), m_head.get(), m_head.get());
idleNode->setTotalTime(headSelfTime);
idleNode->setSelfTime(headSelfTime);
diff --git a/JavaScriptCore/qt/api/qscriptengine.cpp b/JavaScriptCore/qt/api/qscriptengine.cpp
index f12f410..fbeb902 100644
--- a/JavaScriptCore/qt/api/qscriptengine.cpp
+++ b/JavaScriptCore/qt/api/qscriptengine.cpp
@@ -86,3 +86,23 @@ void QScriptEngine::collectGarbage()
{
d_ptr->collectGarbage();
}
+
+/*!
+ Returns a QScriptValue of the primitive type Null.
+
+ \sa undefinedValue()
+*/
+QScriptValue QScriptEngine::nullValue()
+{
+ return QScriptValue(this, QScriptValue::NullValue);
+}
+
+/*!
+ Returns a QScriptValue of the primitive type Undefined.
+
+ \sa nullValue()
+*/
+QScriptValue QScriptEngine::undefinedValue()
+{
+ return QScriptValue(this, QScriptValue::UndefinedValue);
+}
diff --git a/JavaScriptCore/qt/api/qscriptengine.h b/JavaScriptCore/qt/api/qscriptengine.h
index cf61d35..b8bd5e6 100644
--- a/JavaScriptCore/qt/api/qscriptengine.h
+++ b/JavaScriptCore/qt/api/qscriptengine.h
@@ -38,6 +38,8 @@ public:
QScriptValue evaluate(const QString& program, const QString& fileName = QString(), int lineNumber = 1);
void collectGarbage();
+ QScriptValue nullValue();
+ QScriptValue undefinedValue();
private:
friend class QScriptEnginePrivate;
diff --git a/JavaScriptCore/qt/api/qscriptvalue_p.h b/JavaScriptCore/qt/api/qscriptvalue_p.h
index 6a5b388..dea2298 100644
--- a/JavaScriptCore/qt/api/qscriptvalue_p.h
+++ b/JavaScriptCore/qt/api/qscriptvalue_p.h
@@ -24,6 +24,8 @@
#include "qscriptengine_p.h"
#include "qscriptvalue.h"
#include <JavaScriptCore/JavaScript.h>
+#include <QtCore/qmath.h>
+#include <QtCore/qnumeric.h>
#include <QtCore/qshareddata.h>
#include <QtCore/qvarlengtharray.h>
@@ -337,7 +339,7 @@ bool QScriptValuePrivate::isNumber()
{
switch (m_state) {
case CNumber:
- return m_number;
+ return true;
case JSValue:
if (isObject())
return false;
@@ -468,20 +470,30 @@ QString QScriptValuePrivate::toString() const
qsreal QScriptValuePrivate::toNumber() const
{
- // TODO Check it.
switch (m_state) {
case JSValue:
case JSNative:
case JSObject:
return JSValueToNumber(context(), value(), /* exception */ 0);
case CNumber:
- case CBool:
return m_number;
+ case CBool:
+ return m_number ? 1 : 0;
case Invalid:
+ return 0;
case CSpecial:
- return false;
+ return m_number == QScriptValue::NullValue ? 0 : qQNaN();
case CString:
- return m_string.isEmpty();
+ bool ok;
+ qsreal result = m_string.toDouble(&ok);
+ if (ok)
+ return result;
+ result = m_string.toInt(&ok, 0); // Try other bases.
+ if (ok)
+ return result;
+ if (m_string == "Infinity" || m_string == "-Infinity")
+ return qInf();
+ return m_string.length() ? qQNaN() : 0;
}
Q_ASSERT_X(false, "toNumber()", "Not all states are included in the previous switch statement.");
@@ -493,16 +505,18 @@ bool QScriptValuePrivate::toBool() const
switch (m_state) {
case JSValue:
case JSNative:
- case JSObject:
return JSValueToBoolean(context(), value());
+ case JSObject:
+ return true;
case CNumber:
+ return !(qIsNaN(m_number) || !m_number);
case CBool:
return m_number;
case Invalid:
case CSpecial:
return false;
case CString:
- return m_string.isEmpty();
+ return m_string.length();
}
Q_ASSERT_X(false, "toBool()", "Not all states are included in the previous switch statement.");
diff --git a/JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp b/JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp
index 37f3d11..b36e364 100644
--- a/JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp
+++ b/JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp
@@ -35,6 +35,8 @@ public slots:
private slots:
void evaluate();
void collectGarbage();
+ void nullValue();
+ void undefinedValue();
};
/* Evaluating a script that throw an unhandled exception should return an invalid value. */
@@ -54,5 +56,22 @@ void tst_QScriptEngine::collectGarbage()
engine.collectGarbage();
QCOMPARE(foo.call().toString(), QString::fromAscii("pong"));
}
+
+void tst_QScriptEngine::nullValue()
+{
+ QScriptEngine engine;
+ QScriptValue value = engine.nullValue();
+ QVERIFY(value.isValid());
+ QVERIFY(value.isNull());
+}
+
+void tst_QScriptEngine::undefinedValue()
+{
+ QScriptEngine engine;
+ QScriptValue value = engine.undefinedValue();
+ QVERIFY(value.isValid());
+ QVERIFY(value.isUndefined());
+}
+
QTEST_MAIN(tst_QScriptEngine)
#include "tst_qscriptengine.moc"
diff --git a/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h b/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h
index ae81c49..828ef96 100644
--- a/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h
+++ b/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h
@@ -55,6 +55,9 @@ private slots:
void isBoolean_data();
void isBoolean();
+ void isNumber_data();
+ void isNumber();
+
void isFunction_data();
void isFunction();
@@ -73,6 +76,15 @@ private slots:
void isValid_data();
void isValid();
+ void toNumber_data();
+ void toNumber();
+
+ void toBool_data();
+ void toBool();
+
+ void toBoolean_data();
+ void toBoolean();
+
private:
typedef void (tst_QScriptValue::*InitDataFunction)();
typedef void (tst_QScriptValue::*DefineDataFunction)(const char*);
@@ -94,6 +106,10 @@ private:
void isBoolean_makeData(const char* expr);
void isBoolean_test(const char* expr, const QScriptValue& value);
+ void isNumber_initData();
+ void isNumber_makeData(const char* expr);
+ void isNumber_test(const char* expr, const QScriptValue&);
+
void isFunction_initData();
void isFunction_makeData(const char* expr);
void isFunction_test(const char* expr, const QScriptValue& value);
@@ -118,6 +134,18 @@ private:
void isValid_makeData(const char* expr);
void isValid_test(const char* expr, const QScriptValue& value);
+ void toNumber_initData();
+ void toNumber_makeData(const char*);
+ void toNumber_test(const char*, const QScriptValue&);
+
+ void toBool_initData();
+ void toBool_makeData(const char*);
+ void toBool_test(const char*, const QScriptValue&);
+
+ void toBoolean_initData();
+ void toBoolean_makeData(const char*);
+ void toBoolean_test(const char*, const QScriptValue&);
+
private:
QScriptEngine* engine;
QHash<QString, QScriptValue> m_values;
diff --git a/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp b/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp
index 6d8ef48..f9891a6 100644
--- a/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp
+++ b/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp
@@ -315,6 +315,70 @@ void tst_QScriptValue::isBoolean_test(const char*, const QScriptValue& value)
DEFINE_TEST_FUNCTION(isBoolean)
+void tst_QScriptValue::isNumber_initData()
+{
+ QTest::addColumn<bool>("expected");
+ initScriptValues();
+}
+
+void tst_QScriptValue::isNumber_makeData(const char* expr)
+{
+ static QSet<QString> isNumber;
+ if (isNumber.isEmpty()) {
+ isNumber << "QScriptValue(int(122))"
+ << "QScriptValue(uint(124))"
+ << "QScriptValue(0)"
+ << "QScriptValue(0.0)"
+ << "QScriptValue(123.0)"
+ << "QScriptValue(6.37e-8)"
+ << "QScriptValue(-6.37e-8)"
+ << "QScriptValue(0x43211234)"
+ << "QScriptValue(0x10000)"
+ << "QScriptValue(0x10001)"
+ << "QScriptValue(qSNaN())"
+ << "QScriptValue(qQNaN())"
+ << "QScriptValue(qInf())"
+ << "QScriptValue(-qInf())"
+ << "QScriptValue(0, int(122))"
+ << "QScriptValue(0, uint(124))"
+ << "QScriptValue(0, 0)"
+ << "QScriptValue(0, 0.0)"
+ << "QScriptValue(0, 123.0)"
+ << "QScriptValue(0, 6.37e-8)"
+ << "QScriptValue(0, -6.37e-8)"
+ << "QScriptValue(0, 0x43211234)"
+ << "QScriptValue(0, 0x10000)"
+ << "QScriptValue(0, 0x10001)"
+ << "QScriptValue(0, qSNaN())"
+ << "QScriptValue(0, qQNaN())"
+ << "QScriptValue(0, qInf())"
+ << "QScriptValue(0, -qInf())"
+ << "QScriptValue(engine, int(122))"
+ << "QScriptValue(engine, uint(124))"
+ << "QScriptValue(engine, 0)"
+ << "QScriptValue(engine, 0.0)"
+ << "QScriptValue(engine, 123.0)"
+ << "QScriptValue(engine, 6.37e-8)"
+ << "QScriptValue(engine, -6.37e-8)"
+ << "QScriptValue(engine, 0x43211234)"
+ << "QScriptValue(engine, 0x10000)"
+ << "QScriptValue(engine, 0x10001)"
+ << "QScriptValue(engine, qSNaN())"
+ << "QScriptValue(engine, qQNaN())"
+ << "QScriptValue(engine, qInf())"
+ << "QScriptValue(engine, -qInf())";
+ }
+ newRow(expr) << isNumber.contains(expr);
+}
+
+void tst_QScriptValue::isNumber_test(const char*, const QScriptValue& value)
+{
+ QFETCH(bool, expected);
+ QCOMPARE(value.isNumber(), expected);
+}
+
+DEFINE_TEST_FUNCTION(isNumber)
+
void tst_QScriptValue::isFunction_initData()
{
@@ -492,4 +556,387 @@ void tst_QScriptValue::isObject_test(const char*, const QScriptValue& value)
DEFINE_TEST_FUNCTION(isObject)
+void tst_QScriptValue::toNumber_initData()
+{
+ QTest::addColumn<qsreal>("expected");
+ initScriptValues();
+}
+
+void tst_QScriptValue::toNumber_makeData(const char* expr)
+{
+ static QHash<QString, qsreal> toNumber;
+ if (toNumber.isEmpty()) {
+ toNumber.insert("QScriptValue()", 0);
+ toNumber.insert("QScriptValue(QScriptValue::UndefinedValue)", qQNaN());
+ toNumber.insert("QScriptValue(QScriptValue::NullValue)", 0);
+ toNumber.insert("QScriptValue(true)", 1);
+ toNumber.insert("QScriptValue(false)", 0);
+ toNumber.insert("QScriptValue(int(122))", 122);
+ toNumber.insert("QScriptValue(uint(124))", 124);
+ toNumber.insert("QScriptValue(0)", 0);
+ toNumber.insert("QScriptValue(0.0)", 0);
+ toNumber.insert("QScriptValue(123.0)", 123);
+ toNumber.insert("QScriptValue(6.37e-8)", 6.369999999999999e-08);
+ toNumber.insert("QScriptValue(-6.37e-8)", -6.369999999999999e-08);
+ toNumber.insert("QScriptValue(0x43211234)", 1126240820);
+ toNumber.insert("QScriptValue(0x10000)", 65536);
+ toNumber.insert("QScriptValue(0x10001)", 65537);
+ toNumber.insert("QScriptValue(qSNaN())", qQNaN());
+ toNumber.insert("QScriptValue(qQNaN())", qQNaN());
+ toNumber.insert("QScriptValue(qInf())", qInf());
+ toNumber.insert("QScriptValue(-qInf())", qInf());
+ toNumber.insert("QScriptValue(\"NaN\")", qQNaN());
+ toNumber.insert("QScriptValue(\"Infinity\")", qInf());
+ toNumber.insert("QScriptValue(\"-Infinity\")", qInf());
+ toNumber.insert("QScriptValue(\"ciao\")", qQNaN());
+ toNumber.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", qQNaN());
+ toNumber.insert("QScriptValue(QString(\"\"))", 0);
+ toNumber.insert("QScriptValue(QString())", 0);
+ toNumber.insert("QScriptValue(QString(\"0\"))", 0);
+ toNumber.insert("QScriptValue(QString(\"123\"))", 123);
+ toNumber.insert("QScriptValue(QString(\"12.4\"))", 12.4);
+ toNumber.insert("QScriptValue(0, QScriptValue::UndefinedValue)", qQNaN());
+ toNumber.insert("QScriptValue(0, QScriptValue::NullValue)", 0);
+ toNumber.insert("QScriptValue(0, true)", 1);
+ toNumber.insert("QScriptValue(0, false)", 0);
+ toNumber.insert("QScriptValue(0, int(122))", 122);
+ toNumber.insert("QScriptValue(0, uint(124))", 124);
+ toNumber.insert("QScriptValue(0, 0)", 0);
+ toNumber.insert("QScriptValue(0, 0.0)", 0);
+ toNumber.insert("QScriptValue(0, 123.0)", 123);
+ toNumber.insert("QScriptValue(0, 6.37e-8)", 6.369999999999999e-08);
+ toNumber.insert("QScriptValue(0, -6.37e-8)", -6.369999999999999e-08);
+ toNumber.insert("QScriptValue(0, 0x43211234)", 1126240820);
+ toNumber.insert("QScriptValue(0, 0x10000)", 65536);
+ toNumber.insert("QScriptValue(0, 0x10001)", 65537);
+ toNumber.insert("QScriptValue(0, qSNaN())", qQNaN());
+ toNumber.insert("QScriptValue(0, qQNaN())", qQNaN());
+ toNumber.insert("QScriptValue(0, qInf())", qInf());
+ toNumber.insert("QScriptValue(0, -qInf())", qInf());
+ toNumber.insert("QScriptValue(0, \"NaN\")", qQNaN());
+ toNumber.insert("QScriptValue(0, \"Infinity\")", qInf());
+ toNumber.insert("QScriptValue(0, \"-Infinity\")", qInf());
+ toNumber.insert("QScriptValue(0, \"ciao\")", qQNaN());
+ toNumber.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", qQNaN());
+ toNumber.insert("QScriptValue(0, QString(\"\"))", 0);
+ toNumber.insert("QScriptValue(0, QString())", 0);
+ toNumber.insert("QScriptValue(0, QString(\"0\"))", 0);
+ toNumber.insert("QScriptValue(0, QString(\"123\"))", 123);
+ toNumber.insert("QScriptValue(0, QString(\"12.3\"))", 12.3);
+ toNumber.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", qQNaN());
+ toNumber.insert("QScriptValue(engine, QScriptValue::NullValue)", 0);
+ toNumber.insert("QScriptValue(engine, true)", 1);
+ toNumber.insert("QScriptValue(engine, false)", 0);
+ toNumber.insert("QScriptValue(engine, int(122))", 122);
+ toNumber.insert("QScriptValue(engine, uint(124))", 124);
+ toNumber.insert("QScriptValue(engine, 0)", 0);
+ toNumber.insert("QScriptValue(engine, 0.0)", 0);
+ toNumber.insert("QScriptValue(engine, 123.0)", 123);
+ toNumber.insert("QScriptValue(engine, 6.37e-8)", 6.369999999999999e-08);
+ toNumber.insert("QScriptValue(engine, -6.37e-8)", -6.369999999999999e-08);
+ toNumber.insert("QScriptValue(engine, 0x43211234)", 1126240820);
+ toNumber.insert("QScriptValue(engine, 0x10000)", 65536);
+ toNumber.insert("QScriptValue(engine, 0x10001)", 65537);
+ toNumber.insert("QScriptValue(engine, qSNaN())", qQNaN());
+ toNumber.insert("QScriptValue(engine, qQNaN())", qQNaN());
+ toNumber.insert("QScriptValue(engine, qInf())", qInf());
+ toNumber.insert("QScriptValue(engine, -qInf())", qInf());
+ toNumber.insert("QScriptValue(engine, \"NaN\")", qQNaN());
+ toNumber.insert("QScriptValue(engine, \"Infinity\")", qInf());
+ toNumber.insert("QScriptValue(engine, \"-Infinity\")", qInf());
+ toNumber.insert("QScriptValue(engine, \"ciao\")", qQNaN());
+ toNumber.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", qQNaN());
+ toNumber.insert("QScriptValue(engine, QString(\"\"))", 0);
+ toNumber.insert("QScriptValue(engine, QString())", 0);
+ toNumber.insert("QScriptValue(engine, QString(\"0\"))", 0);
+ toNumber.insert("QScriptValue(engine, QString(\"123\"))", 123);
+ toNumber.insert("QScriptValue(engine, QString(\"1.23\"))", 1.23);
+ toNumber.insert("engine->evaluate(\"[]\")", 0);
+ toNumber.insert("engine->evaluate(\"{}\")", qQNaN());
+ toNumber.insert("engine->evaluate(\"Object.prototype\")", qQNaN());
+ toNumber.insert("engine->evaluate(\"Date.prototype\")", qQNaN());
+ toNumber.insert("engine->evaluate(\"Array.prototype\")", 0);
+ toNumber.insert("engine->evaluate(\"Function.prototype\")", qQNaN());
+ toNumber.insert("engine->evaluate(\"Error.prototype\")", qQNaN());
+ toNumber.insert("engine->evaluate(\"Object\")", qQNaN());
+ toNumber.insert("engine->evaluate(\"Array\")", qQNaN());
+ toNumber.insert("engine->evaluate(\"Number\")", qQNaN());
+ toNumber.insert("engine->evaluate(\"Function\")", qQNaN());
+ toNumber.insert("engine->evaluate(\"(function() { return 1; })\")", qQNaN());
+ toNumber.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", qQNaN());
+ toNumber.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", qQNaN());
+ toNumber.insert("engine->evaluate(\"/foo/\")", qQNaN());
+ toNumber.insert("engine->evaluate(\"new Object()\")", qQNaN());
+ toNumber.insert("engine->evaluate(\"new Array()\")", 0);
+ toNumber.insert("engine->evaluate(\"new Error()\")", qQNaN());
+ }
+ newRow(expr) << toNumber.value(expr);
+}
+
+void tst_QScriptValue::toNumber_test(const char*, const QScriptValue& value)
+{
+ QFETCH(qsreal, expected);
+ if (qIsNaN(expected)) {
+ QVERIFY(qIsNaN(value.toNumber()));
+ return;
+ }
+ if (qIsInf(expected)) {
+ QVERIFY(qIsInf(value.toNumber()));
+ return;
+ }
+ QCOMPARE(value.toNumber(), expected);
+}
+
+DEFINE_TEST_FUNCTION(toNumber)
+
+
+void tst_QScriptValue::toBool_initData()
+{
+ QTest::addColumn<bool>("expected");
+ initScriptValues();
+}
+
+void tst_QScriptValue::toBool_makeData(const char* expr)
+{
+ static QHash<QString, bool> toBool;
+ if (toBool.isEmpty()) {
+ toBool.insert("QScriptValue()", false);
+ toBool.insert("QScriptValue(QScriptValue::UndefinedValue)", false);
+ toBool.insert("QScriptValue(QScriptValue::NullValue)", false);
+ toBool.insert("QScriptValue(true)", true);
+ toBool.insert("QScriptValue(false)", false);
+ toBool.insert("QScriptValue(int(122))", true);
+ toBool.insert("QScriptValue(uint(124))", true);
+ toBool.insert("QScriptValue(0)", false);
+ toBool.insert("QScriptValue(0.0)", false);
+ toBool.insert("QScriptValue(123.0)", true);
+ toBool.insert("QScriptValue(6.37e-8)", true);
+ toBool.insert("QScriptValue(-6.37e-8)", true);
+ toBool.insert("QScriptValue(0x43211234)", true);
+ toBool.insert("QScriptValue(0x10000)", true);
+ toBool.insert("QScriptValue(0x10001)", true);
+ toBool.insert("QScriptValue(qSNaN())", false);
+ toBool.insert("QScriptValue(qQNaN())", false);
+ toBool.insert("QScriptValue(qInf())", true);
+ toBool.insert("QScriptValue(-qInf())", true);
+ toBool.insert("QScriptValue(\"NaN\")", true);
+ toBool.insert("QScriptValue(\"Infinity\")", true);
+ toBool.insert("QScriptValue(\"-Infinity\")", true);
+ toBool.insert("QScriptValue(\"ciao\")", true);
+ toBool.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", true);
+ toBool.insert("QScriptValue(QString(\"\"))", false);
+ toBool.insert("QScriptValue(QString())", false);
+ toBool.insert("QScriptValue(QString(\"0\"))", true);
+ toBool.insert("QScriptValue(QString(\"123\"))", true);
+ toBool.insert("QScriptValue(QString(\"12.4\"))", true);
+ toBool.insert("QScriptValue(0, QScriptValue::UndefinedValue)", false);
+ toBool.insert("QScriptValue(0, QScriptValue::NullValue)", false);
+ toBool.insert("QScriptValue(0, true)", true);
+ toBool.insert("QScriptValue(0, false)", false);
+ toBool.insert("QScriptValue(0, int(122))", true);
+ toBool.insert("QScriptValue(0, uint(124))", true);
+ toBool.insert("QScriptValue(0, 0)", false);
+ toBool.insert("QScriptValue(0, 0.0)", false);
+ toBool.insert("QScriptValue(0, 123.0)", true);
+ toBool.insert("QScriptValue(0, 6.37e-8)", true);
+ toBool.insert("QScriptValue(0, -6.37e-8)", true);
+ toBool.insert("QScriptValue(0, 0x43211234)", true);
+ toBool.insert("QScriptValue(0, 0x10000)", true);
+ toBool.insert("QScriptValue(0, 0x10001)", true);
+ toBool.insert("QScriptValue(0, qSNaN())", false);
+ toBool.insert("QScriptValue(0, qQNaN())", false);
+ toBool.insert("QScriptValue(0, qInf())", true);
+ toBool.insert("QScriptValue(0, -qInf())", true);
+ toBool.insert("QScriptValue(0, \"NaN\")", true);
+ toBool.insert("QScriptValue(0, \"Infinity\")", true);
+ toBool.insert("QScriptValue(0, \"-Infinity\")", true);
+ toBool.insert("QScriptValue(0, \"ciao\")", true);
+ toBool.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", true);
+ toBool.insert("QScriptValue(0, QString(\"\"))", false);
+ toBool.insert("QScriptValue(0, QString())", false);
+ toBool.insert("QScriptValue(0, QString(\"0\"))", true);
+ toBool.insert("QScriptValue(0, QString(\"123\"))", true);
+ toBool.insert("QScriptValue(0, QString(\"12.3\"))", true);
+ toBool.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", false);
+ toBool.insert("QScriptValue(engine, QScriptValue::NullValue)", false);
+ toBool.insert("QScriptValue(engine, true)", true);
+ toBool.insert("QScriptValue(engine, false)", false);
+ toBool.insert("QScriptValue(engine, int(122))", true);
+ toBool.insert("QScriptValue(engine, uint(124))", true);
+ toBool.insert("QScriptValue(engine, 0)", false);
+ toBool.insert("QScriptValue(engine, 0.0)", false);
+ toBool.insert("QScriptValue(engine, 123.0)", true);
+ toBool.insert("QScriptValue(engine, 6.37e-8)", true);
+ toBool.insert("QScriptValue(engine, -6.37e-8)", true);
+ toBool.insert("QScriptValue(engine, 0x43211234)", true);
+ toBool.insert("QScriptValue(engine, 0x10000)", true);
+ toBool.insert("QScriptValue(engine, 0x10001)", true);
+ toBool.insert("QScriptValue(engine, qSNaN())", false);
+ toBool.insert("QScriptValue(engine, qQNaN())", false);
+ toBool.insert("QScriptValue(engine, qInf())", true);
+ toBool.insert("QScriptValue(engine, -qInf())", true);
+ toBool.insert("QScriptValue(engine, \"NaN\")", true);
+ toBool.insert("QScriptValue(engine, \"Infinity\")", true);
+ toBool.insert("QScriptValue(engine, \"-Infinity\")", true);
+ toBool.insert("QScriptValue(engine, \"ciao\")", true);
+ toBool.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", true);
+ toBool.insert("QScriptValue(engine, QString(\"\"))", false);
+ toBool.insert("QScriptValue(engine, QString())", false);
+ toBool.insert("QScriptValue(engine, QString(\"0\"))", true);
+ toBool.insert("QScriptValue(engine, QString(\"123\"))", true);
+ toBool.insert("QScriptValue(engine, QString(\"1.23\"))", true);
+ toBool.insert("engine->evaluate(\"[]\")", true);
+ toBool.insert("engine->evaluate(\"{}\")", false);
+ toBool.insert("engine->evaluate(\"Object.prototype\")", true);
+ toBool.insert("engine->evaluate(\"Date.prototype\")", true);
+ toBool.insert("engine->evaluate(\"Array.prototype\")", true);
+ toBool.insert("engine->evaluate(\"Function.prototype\")", true);
+ toBool.insert("engine->evaluate(\"Error.prototype\")", true);
+ toBool.insert("engine->evaluate(\"Object\")", true);
+ toBool.insert("engine->evaluate(\"Array\")", true);
+ toBool.insert("engine->evaluate(\"Number\")", true);
+ toBool.insert("engine->evaluate(\"Function\")", true);
+ toBool.insert("engine->evaluate(\"(function() { return 1; })\")", true);
+ toBool.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", true);
+ toBool.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", true);
+ toBool.insert("engine->evaluate(\"/foo/\")", true);
+ toBool.insert("engine->evaluate(\"new Object()\")", true);
+ toBool.insert("engine->evaluate(\"new Array()\")", true);
+ toBool.insert("engine->evaluate(\"new Error()\")", true);
+ }
+ newRow(expr) << toBool.value(expr);
+}
+
+void tst_QScriptValue::toBool_test(const char*, const QScriptValue& value)
+{
+ QFETCH(bool, expected);
+ QCOMPARE(value.toBool(), expected);
+}
+
+DEFINE_TEST_FUNCTION(toBool)
+
+
+void tst_QScriptValue::toBoolean_initData()
+{
+ QTest::addColumn<bool>("expected");
+ initScriptValues();
+}
+
+void tst_QScriptValue::toBoolean_makeData(const char* expr)
+{
+ static QHash<QString, bool> toBoolean;
+ if (toBoolean.isEmpty()) {
+ toBoolean.insert("QScriptValue()", false);
+ toBoolean.insert("QScriptValue(QScriptValue::UndefinedValue)", false);
+ toBoolean.insert("QScriptValue(QScriptValue::NullValue)", false);
+ toBoolean.insert("QScriptValue(true)", true);
+ toBoolean.insert("QScriptValue(false)", false);
+ toBoolean.insert("QScriptValue(int(122))", true);
+ toBoolean.insert("QScriptValue(uint(124))", true);
+ toBoolean.insert("QScriptValue(0)", false);
+ toBoolean.insert("QScriptValue(0.0)", false);
+ toBoolean.insert("QScriptValue(123.0)", true);
+ toBoolean.insert("QScriptValue(6.37e-8)", true);
+ toBoolean.insert("QScriptValue(-6.37e-8)", true);
+ toBoolean.insert("QScriptValue(0x43211234)", true);
+ toBoolean.insert("QScriptValue(0x10000)", true);
+ toBoolean.insert("QScriptValue(0x10001)", true);
+ toBoolean.insert("QScriptValue(qSNaN())", false);
+ toBoolean.insert("QScriptValue(qQNaN())", false);
+ toBoolean.insert("QScriptValue(qInf())", true);
+ toBoolean.insert("QScriptValue(-qInf())", true);
+ toBoolean.insert("QScriptValue(\"NaN\")", true);
+ toBoolean.insert("QScriptValue(\"Infinity\")", true);
+ toBoolean.insert("QScriptValue(\"-Infinity\")", true);
+ toBoolean.insert("QScriptValue(\"ciao\")", true);
+ toBoolean.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", true);
+ toBoolean.insert("QScriptValue(QString(\"\"))", false);
+ toBoolean.insert("QScriptValue(QString())", false);
+ toBoolean.insert("QScriptValue(QString(\"0\"))", true);
+ toBoolean.insert("QScriptValue(QString(\"123\"))", true);
+ toBoolean.insert("QScriptValue(QString(\"12.4\"))", true);
+ toBoolean.insert("QScriptValue(0, QScriptValue::UndefinedValue)", false);
+ toBoolean.insert("QScriptValue(0, QScriptValue::NullValue)", false);
+ toBoolean.insert("QScriptValue(0, true)", true);
+ toBoolean.insert("QScriptValue(0, false)", false);
+ toBoolean.insert("QScriptValue(0, int(122))", true);
+ toBoolean.insert("QScriptValue(0, uint(124))", true);
+ toBoolean.insert("QScriptValue(0, 0)", false);
+ toBoolean.insert("QScriptValue(0, 0.0)", false);
+ toBoolean.insert("QScriptValue(0, 123.0)", true);
+ toBoolean.insert("QScriptValue(0, 6.37e-8)", true);
+ toBoolean.insert("QScriptValue(0, -6.37e-8)", true);
+ toBoolean.insert("QScriptValue(0, 0x43211234)", true);
+ toBoolean.insert("QScriptValue(0, 0x10000)", true);
+ toBoolean.insert("QScriptValue(0, 0x10001)", true);
+ toBoolean.insert("QScriptValue(0, qSNaN())", false);
+ toBoolean.insert("QScriptValue(0, qQNaN())", false);
+ toBoolean.insert("QScriptValue(0, qInf())", true);
+ toBoolean.insert("QScriptValue(0, -qInf())", true);
+ toBoolean.insert("QScriptValue(0, \"NaN\")", true);
+ toBoolean.insert("QScriptValue(0, \"Infinity\")", true);
+ toBoolean.insert("QScriptValue(0, \"-Infinity\")", true);
+ toBoolean.insert("QScriptValue(0, \"ciao\")", true);
+ toBoolean.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", true);
+ toBoolean.insert("QScriptValue(0, QString(\"\"))", false);
+ toBoolean.insert("QScriptValue(0, QString())", false);
+ toBoolean.insert("QScriptValue(0, QString(\"0\"))", true);
+ toBoolean.insert("QScriptValue(0, QString(\"123\"))", true);
+ toBoolean.insert("QScriptValue(0, QString(\"12.3\"))", true);
+ toBoolean.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", false);
+ toBoolean.insert("QScriptValue(engine, QScriptValue::NullValue)", false);
+ toBoolean.insert("QScriptValue(engine, true)", true);
+ toBoolean.insert("QScriptValue(engine, false)", false);
+ toBoolean.insert("QScriptValue(engine, int(122))", true);
+ toBoolean.insert("QScriptValue(engine, uint(124))", true);
+ toBoolean.insert("QScriptValue(engine, 0)", false);
+ toBoolean.insert("QScriptValue(engine, 0.0)", false);
+ toBoolean.insert("QScriptValue(engine, 123.0)", true);
+ toBoolean.insert("QScriptValue(engine, 6.37e-8)", true);
+ toBoolean.insert("QScriptValue(engine, -6.37e-8)", true);
+ toBoolean.insert("QScriptValue(engine, 0x43211234)", true);
+ toBoolean.insert("QScriptValue(engine, 0x10000)", true);
+ toBoolean.insert("QScriptValue(engine, 0x10001)", true);
+ toBoolean.insert("QScriptValue(engine, qSNaN())", false);
+ toBoolean.insert("QScriptValue(engine, qQNaN())", false);
+ toBoolean.insert("QScriptValue(engine, qInf())", true);
+ toBoolean.insert("QScriptValue(engine, -qInf())", true);
+ toBoolean.insert("QScriptValue(engine, \"NaN\")", true);
+ toBoolean.insert("QScriptValue(engine, \"Infinity\")", true);
+ toBoolean.insert("QScriptValue(engine, \"-Infinity\")", true);
+ toBoolean.insert("QScriptValue(engine, \"ciao\")", true);
+ toBoolean.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", true);
+ toBoolean.insert("QScriptValue(engine, QString(\"\"))", false);
+ toBoolean.insert("QScriptValue(engine, QString())", false);
+ toBoolean.insert("QScriptValue(engine, QString(\"0\"))", true);
+ toBoolean.insert("QScriptValue(engine, QString(\"123\"))", true);
+ toBoolean.insert("QScriptValue(engine, QString(\"1.23\"))", true);
+ toBoolean.insert("engine->evaluate(\"[]\")", true);
+ toBoolean.insert("engine->evaluate(\"{}\")", false);
+ toBoolean.insert("engine->evaluate(\"Object.prototype\")", true);
+ toBoolean.insert("engine->evaluate(\"Date.prototype\")", true);
+ toBoolean.insert("engine->evaluate(\"Array.prototype\")", true);
+ toBoolean.insert("engine->evaluate(\"Function.prototype\")", true);
+ toBoolean.insert("engine->evaluate(\"Error.prototype\")", true);
+ toBoolean.insert("engine->evaluate(\"Object\")", true);
+ toBoolean.insert("engine->evaluate(\"Array\")", true);
+ toBoolean.insert("engine->evaluate(\"Number\")", true);
+ toBoolean.insert("engine->evaluate(\"Function\")", true);
+ toBoolean.insert("engine->evaluate(\"(function() { return 1; })\")", true);
+ toBoolean.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", true);
+ toBoolean.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", true);
+ toBoolean.insert("engine->evaluate(\"/foo/\")", true);
+ toBoolean.insert("engine->evaluate(\"new Object()\")", true);
+ toBoolean.insert("engine->evaluate(\"new Array()\")", true);
+ toBoolean.insert("engine->evaluate(\"new Error()\")", true);
+ }
+ newRow(expr) << toBoolean.value(expr);
+}
+
+void tst_QScriptValue::toBoolean_test(const char*, const QScriptValue& value)
+{
+ QFETCH(bool, expected);
+ QCOMPARE(value.toBoolean(), expected);
+}
+DEFINE_TEST_FUNCTION(toBoolean)
diff --git a/JavaScriptCore/runtime/ArrayPrototype.cpp b/JavaScriptCore/runtime/ArrayPrototype.cpp
index ce814b2..b64abad 100644
--- a/JavaScriptCore/runtime/ArrayPrototype.cpp
+++ b/JavaScriptCore/runtime/ArrayPrototype.cpp
@@ -28,6 +28,7 @@
#include "CachedCall.h"
#include "Interpreter.h"
#include "JIT.h"
+#include "JSStringBuilder.h"
#include "ObjectPrototype.h"
#include "Lookup.h"
#include "Operations.h"
@@ -182,8 +183,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec, JSObject*, JSValue
totalSize += str.size();
if (!strBuffer.data()) {
- JSObject* error = Error::create(exec, GeneralError, "Out of memory");
- exec->setException(error);
+ throwOutOfMemoryError(exec);
}
if (exec->hadException())
@@ -195,7 +195,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec, JSObject*, JSValue
Vector<UChar> buffer;
buffer.reserveCapacity(totalSize);
if (!buffer.data())
- return throwError(exec, GeneralError, "Out of memory");
+ return throwOutOfMemoryError(exec);
for (unsigned i = 0; i < length; i++) {
if (i)
@@ -223,42 +223,28 @@ JSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState* exec, JSObject*, J
if (alreadyVisited)
return jsEmptyString(exec); // return an empty string, avoding infinite recursion.
- Vector<UChar, 256> strBuffer;
+ JSStringBuilder strBuffer;
unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
for (unsigned k = 0; k < length; k++) {
if (k >= 1)
strBuffer.append(',');
- if (!strBuffer.data()) {
- JSObject* error = Error::create(exec, GeneralError, "Out of memory");
- exec->setException(error);
- break;
- }
JSValue element = thisObj->get(exec, k);
- if (element.isUndefinedOrNull())
- continue;
-
- JSObject* o = element.toObject(exec);
- JSValue conversionFunction = o->get(exec, exec->propertyNames().toLocaleString);
- UString str;
- CallData callData;
- CallType callType = conversionFunction.getCallData(callData);
- if (callType != CallTypeNone)
- str = call(exec, conversionFunction, callType, callData, element, exec->emptyList()).toString(exec);
- else
- str = element.toString(exec);
- strBuffer.append(str.data(), str.size());
-
- if (!strBuffer.data()) {
- JSObject* error = Error::create(exec, GeneralError, "Out of memory");
- exec->setException(error);
+ if (!element.isUndefinedOrNull()) {
+ JSObject* o = element.toObject(exec);
+ JSValue conversionFunction = o->get(exec, exec->propertyNames().toLocaleString);
+ UString str;
+ CallData callData;
+ CallType callType = conversionFunction.getCallData(callData);
+ if (callType != CallTypeNone)
+ str = call(exec, conversionFunction, callType, callData, element, exec->emptyList()).toString(exec);
+ else
+ str = element.toString(exec);
+ strBuffer.append(str);
}
-
- if (exec->hadException())
- break;
}
arrayVisitedElements.remove(thisObj);
- return jsString(exec, UString(strBuffer.data(), strBuffer.data() ? strBuffer.size() : 0));
+ return strBuffer.build(exec);
}
JSValue JSC_HOST_CALL arrayProtoFuncJoin(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
@@ -275,38 +261,27 @@ JSValue JSC_HOST_CALL arrayProtoFuncJoin(ExecState* exec, JSObject*, JSValue thi
if (alreadyVisited)
return jsEmptyString(exec); // return an empty string, avoding infinite recursion.
- Vector<UChar, 256> strBuffer;
+ JSStringBuilder strBuffer;
- UChar comma = ',';
- UString separator = args.at(0).isUndefined() ? UString(&comma, 1) : args.at(0).toString(exec);
+ UString separator;
+ if (!args.at(0).isUndefined())
+ separator = args.at(0).toString(exec);
unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
for (unsigned k = 0; k < length; k++) {
- if (k >= 1)
- strBuffer.append(separator.data(), separator.size());
- if (!strBuffer.data()) {
- JSObject* error = Error::create(exec, GeneralError, "Out of memory");
- exec->setException(error);
- break;
+ if (k >= 1) {
+ if (separator.isNull())
+ strBuffer.append(',');
+ else
+ strBuffer.append(separator);
}
JSValue element = thisObj->get(exec, k);
- if (element.isUndefinedOrNull())
- continue;
-
- UString str = element.toString(exec);
- strBuffer.append(str.data(), str.size());
-
- if (!strBuffer.data()) {
- JSObject* error = Error::create(exec, GeneralError, "Out of memory");
- exec->setException(error);
- }
-
- if (exec->hadException())
- break;
+ if (!element.isUndefinedOrNull())
+ strBuffer.append(element.toString(exec));
}
arrayVisitedElements.remove(thisObj);
- return jsString(exec, UString(strBuffer.data(), strBuffer.data() ? strBuffer.size() : 0));
+ return strBuffer.build(exec);
}
JSValue JSC_HOST_CALL arrayProtoFuncConcat(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
diff --git a/JavaScriptCore/runtime/Collector.cpp b/JavaScriptCore/runtime/Collector.cpp
index 63139a2..2873e0b 100644
--- a/JavaScriptCore/runtime/Collector.cpp
+++ b/JavaScriptCore/runtime/Collector.cpp
@@ -1122,12 +1122,15 @@ void Heap::markRoots()
MarkedArgumentBuffer::markLists(markStack, *m_markListSet);
if (m_globalData->exception)
markStack.append(m_globalData->exception);
- m_globalData->smallStrings.markChildren(markStack);
if (m_globalData->functionCodeBlockBeingReparsed)
m_globalData->functionCodeBlockBeingReparsed->markAggregate(markStack);
if (m_globalData->firstStringifierToMark)
JSONObject::markStringifiers(markStack, m_globalData->firstStringifierToMark);
+ // Mark the small strings cache last, since it will clear itself if nothing
+ // else has marked it.
+ m_globalData->smallStrings.markChildren(markStack);
+
markStack.drain();
markStack.compact();
@@ -1197,12 +1200,13 @@ static const char* typeName(JSCell* cell)
return "number";
#endif
if (cell->isGetterSetter())
- return "gettersetter";
+ return "Getter-Setter";
if (cell->isAPIValueWrapper())
- return "value wrapper";
+ return "API wrapper";
if (cell->isPropertyNameIterator())
- return "for-in iterator";
- ASSERT(cell->isObject());
+ return "For-in iterator";
+ if (!cell->isObject())
+ return "[empty cell]";
const ClassInfo* info = cell->classInfo();
return info ? info->className : "Object";
}
@@ -1218,6 +1222,18 @@ HashCountedSet<const char*>* Heap::protectedObjectTypeCounts()
return counts;
}
+HashCountedSet<const char*>* Heap::objectTypeCounts()
+{
+ HashCountedSet<const char*>* counts = new HashCountedSet<const char*>;
+
+ LiveObjectIterator it = primaryHeapBegin();
+ LiveObjectIterator heapEnd = primaryHeapEnd();
+ for ( ; it != heapEnd; ++it)
+ counts->add(typeName(*it));
+
+ return counts;
+}
+
bool Heap::isBusy()
{
return m_heap.operationInProgress != NoOperation;
diff --git a/JavaScriptCore/runtime/Collector.h b/JavaScriptCore/runtime/Collector.h
index 7f7a679..82aa8a1 100644
--- a/JavaScriptCore/runtime/Collector.h
+++ b/JavaScriptCore/runtime/Collector.h
@@ -100,6 +100,7 @@ namespace JSC {
size_t protectedObjectCount();
size_t protectedGlobalObjectCount();
HashCountedSet<const char*>* protectedObjectTypeCounts();
+ HashCountedSet<const char*>* objectTypeCounts();
void registerThread(); // Only needs to be called by clients that can use the same heap from multiple threads.
diff --git a/JavaScriptCore/runtime/CollectorHeapIterator.h b/JavaScriptCore/runtime/CollectorHeapIterator.h
index e4f2f91..be6f3c9 100644
--- a/JavaScriptCore/runtime/CollectorHeapIterator.h
+++ b/JavaScriptCore/runtime/CollectorHeapIterator.h
@@ -38,7 +38,7 @@ namespace JSC {
protected:
CollectorHeapIterator(CollectorHeap&, size_t startBlock, size_t startCell);
- void advance(size_t cellsPerBlock);
+ void advance(size_t max);
CollectorHeap& m_heap;
size_t m_block;
@@ -80,10 +80,12 @@ namespace JSC {
return reinterpret_cast<JSCell*>(m_heap.blocks[m_block]->cells + m_cell);
}
- inline void CollectorHeapIterator::advance(size_t cellsPerBlock)
+ // Iterators advance up to the next-to-last -- and not the last -- cell in a
+ // block, since the last cell is a dummy sentinel.
+ inline void CollectorHeapIterator::advance(size_t max)
{
++m_cell;
- if (m_cell == cellsPerBlock) {
+ if (m_cell == max) {
m_cell = 0;
++m_block;
}
@@ -97,14 +99,12 @@ namespace JSC {
inline LiveObjectIterator& LiveObjectIterator::operator++()
{
- if (m_block < m_heap.nextBlock || m_cell < m_heap.nextCell) {
- advance(HeapConstants::cellsPerBlock);
+ advance(HeapConstants::cellsPerBlock - 1);
+ if (m_block < m_heap.nextBlock || (m_block == m_heap.nextBlock && m_cell < m_heap.nextCell))
return *this;
- }
- do {
- advance(HeapConstants::cellsPerBlock);
- } while (m_block < m_heap.usedBlocks && !m_heap.blocks[m_block]->marked.get(m_cell));
+ while (m_block < m_heap.usedBlocks && !m_heap.blocks[m_block]->marked.get(m_cell))
+ advance(HeapConstants::cellsPerBlock - 1);
return *this;
}
@@ -117,7 +117,7 @@ namespace JSC {
inline DeadObjectIterator& DeadObjectIterator::operator++()
{
do {
- advance(HeapConstants::cellsPerBlock);
+ advance(HeapConstants::cellsPerBlock - 1);
ASSERT(m_block > m_heap.nextBlock || (m_block == m_heap.nextBlock && m_cell >= m_heap.nextCell));
} while (m_block < m_heap.usedBlocks && m_heap.blocks[m_block]->marked.get(m_cell));
return *this;
@@ -131,7 +131,7 @@ namespace JSC {
inline ObjectIterator& ObjectIterator::operator++()
{
- advance(HeapConstants::cellsPerBlock);
+ advance(HeapConstants::cellsPerBlock - 1);
return *this;
}
diff --git a/JavaScriptCore/runtime/CommonIdentifiers.cpp b/JavaScriptCore/runtime/CommonIdentifiers.cpp
index 3837817..ed5e304 100644
--- a/JavaScriptCore/runtime/CommonIdentifiers.cpp
+++ b/JavaScriptCore/runtime/CommonIdentifiers.cpp
@@ -28,8 +28,7 @@ static const char* const nullCString = 0;
#define INITIALIZE_PROPERTY_NAME(name) , name(globalData, #name)
CommonIdentifiers::CommonIdentifiers(JSGlobalData* globalData)
- : nullIdentifier(globalData, nullCString)
- , emptyIdentifier(globalData, "")
+ : emptyIdentifier(globalData, "")
, underscoreProto(globalData, "__proto__")
, thisIdentifier(globalData, "this")
JSC_COMMON_IDENTIFIERS_EACH_PROPERTY_NAME(INITIALIZE_PROPERTY_NAME)
diff --git a/JavaScriptCore/runtime/CommonIdentifiers.h b/JavaScriptCore/runtime/CommonIdentifiers.h
index de24f4a..0a3d774 100644
--- a/JavaScriptCore/runtime/CommonIdentifiers.h
+++ b/JavaScriptCore/runtime/CommonIdentifiers.h
@@ -90,7 +90,6 @@ namespace JSC {
friend class JSGlobalData;
public:
- const Identifier nullIdentifier;
const Identifier emptyIdentifier;
const Identifier underscoreProto;
const Identifier thisIdentifier;
diff --git a/JavaScriptCore/runtime/DateConstructor.cpp b/JavaScriptCore/runtime/DateConstructor.cpp
index e9a5c29..ab95d06 100644
--- a/JavaScriptCore/runtime/DateConstructor.cpp
+++ b/JavaScriptCore/runtime/DateConstructor.cpp
@@ -28,6 +28,7 @@
#include "JSFunction.h"
#include "JSGlobalObject.h"
#include "JSString.h"
+#include "JSStringBuilder.h"
#include "ObjectPrototype.h"
#include "PrototypeFunction.h"
#include <math.h>
@@ -137,7 +138,7 @@ static JSValue JSC_HOST_CALL callDate(ExecState* exec, JSObject*, JSValue, const
DateConversionBuffer time;
formatDate(ts, date);
formatTime(ts, time);
- return jsNontrivialString(exec, makeString(date, " ", time));
+ return jsMakeNontrivialString(exec, date, " ", time);
}
CallType DateConstructor::getCallData(CallData& callData)
diff --git a/JavaScriptCore/runtime/DatePrototype.cpp b/JavaScriptCore/runtime/DatePrototype.cpp
index ca9d4ea..25b0ac4 100644
--- a/JavaScriptCore/runtime/DatePrototype.cpp
+++ b/JavaScriptCore/runtime/DatePrototype.cpp
@@ -26,6 +26,7 @@
#include "DateConversion.h"
#include "Error.h"
#include "JSString.h"
+#include "JSStringBuilder.h"
#include "ObjectPrototype.h"
#include "DateInstance.h"
@@ -427,7 +428,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToString(ExecState* exec, JSObject*, JSValue
DateConversionBuffer time;
formatDate(*gregorianDateTime, date);
formatTime(*gregorianDateTime, time);
- return jsNontrivialString(exec, makeString(date, " ", time));
+ return jsMakeNontrivialString(exec, date, " ", time);
}
JSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
@@ -444,7 +445,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState* exec, JSObject*, JSVal
DateConversionBuffer time;
formatDateUTCVariant(*gregorianDateTime, date);
formatTimeUTC(*gregorianDateTime, time);
- return jsNontrivialString(exec, makeString(date, " ", time));
+ return jsMakeNontrivialString(exec, date, " ", time);
}
JSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
@@ -570,7 +571,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState* exec, JSObject*, JSVal
DateConversionBuffer time;
formatDateUTCVariant(*gregorianDateTime, date);
formatTimeUTC(*gregorianDateTime, time);
- return jsNontrivialString(exec, makeString(date, " ", time));
+ return jsMakeNontrivialString(exec, date, " ", time);
}
JSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
diff --git a/JavaScriptCore/runtime/Error.cpp b/JavaScriptCore/runtime/Error.cpp
index ddd4bc4..69464b7 100644
--- a/JavaScriptCore/runtime/Error.cpp
+++ b/JavaScriptCore/runtime/Error.cpp
@@ -94,7 +94,7 @@ JSObject* Error::create(ExecState* exec, ErrorType type, const UString& message,
JSObject* Error::create(ExecState* exec, ErrorType type, const char* message)
{
- return create(exec, type, message, -1, -1, NULL);
+ return create(exec, type, message, -1, -1, UString());
}
JSObject* throwError(ExecState* exec, JSObject* error)
@@ -105,21 +105,21 @@ JSObject* throwError(ExecState* exec, JSObject* error)
JSObject* throwError(ExecState* exec, ErrorType type)
{
- JSObject* error = Error::create(exec, type, UString(), -1, -1, NULL);
+ JSObject* error = Error::create(exec, type, UString(), -1, -1, UString());
exec->setException(error);
return error;
}
JSObject* throwError(ExecState* exec, ErrorType type, const UString& message)
{
- JSObject* error = Error::create(exec, type, message, -1, -1, NULL);
+ JSObject* error = Error::create(exec, type, message, -1, -1, UString());
exec->setException(error);
return error;
}
JSObject* throwError(ExecState* exec, ErrorType type, const char* message)
{
- JSObject* error = Error::create(exec, type, message, -1, -1, NULL);
+ JSObject* error = Error::create(exec, type, message, -1, -1, UString());
exec->setException(error);
return error;
}
diff --git a/JavaScriptCore/runtime/ErrorPrototype.cpp b/JavaScriptCore/runtime/ErrorPrototype.cpp
index be9e4b8..eb35733 100644
--- a/JavaScriptCore/runtime/ErrorPrototype.cpp
+++ b/JavaScriptCore/runtime/ErrorPrototype.cpp
@@ -23,6 +23,7 @@
#include "JSFunction.h"
#include "JSString.h"
+#include "JSStringBuilder.h"
#include "ObjectPrototype.h"
#include "PrototypeFunction.h"
#include "UString.h"
@@ -55,11 +56,11 @@ JSValue JSC_HOST_CALL errorProtoFuncToString(ExecState* exec, JSObject*, JSValue
if (!name.isUndefined()) {
if (!message.isUndefined())
- return jsNontrivialString(exec, makeString(name.toString(exec), ": ", message.toString(exec)));
+ return jsMakeNontrivialString(exec, name.toString(exec), ": ", message.toString(exec));
return jsNontrivialString(exec, name.toString(exec));
}
if (!message.isUndefined())
- return jsNontrivialString(exec, makeString("Error: ", message.toString(exec)));
+ return jsMakeNontrivialString(exec, "Error: ", message.toString(exec));
return jsNontrivialString(exec, "Error");
}
diff --git a/JavaScriptCore/runtime/ExceptionHelpers.cpp b/JavaScriptCore/runtime/ExceptionHelpers.cpp
index 9bb740e..b9c6319 100644
--- a/JavaScriptCore/runtime/ExceptionHelpers.cpp
+++ b/JavaScriptCore/runtime/ExceptionHelpers.cpp
@@ -58,7 +58,7 @@ JSValue createInterruptedExecutionException(JSGlobalData* globalData)
static JSValue createError(ExecState* exec, ErrorType e, const char* msg)
{
- return Error::create(exec, e, msg, -1, -1, 0);
+ return Error::create(exec, e, msg, -1, -1, UString());
}
JSValue createStackOverflowError(ExecState* exec)
@@ -188,4 +188,9 @@ JSObject* createNotAnObjectError(ExecState* exec, JSNotAnObjectErrorStub* error,
return exception;
}
+JSValue throwOutOfMemoryError(ExecState* exec)
+{
+ return throwError(exec, GeneralError, "Out of memory");
+}
+
} // namespace JSC
diff --git a/JavaScriptCore/runtime/ExceptionHelpers.h b/JavaScriptCore/runtime/ExceptionHelpers.h
index e739d09..b6e7373 100644
--- a/JavaScriptCore/runtime/ExceptionHelpers.h
+++ b/JavaScriptCore/runtime/ExceptionHelpers.h
@@ -51,6 +51,7 @@ namespace JSC {
JSObject* createNotAConstructorError(ExecState*, JSValue, unsigned bytecodeOffset, CodeBlock*);
JSValue createNotAFunctionError(ExecState*, JSValue, unsigned bytecodeOffset, CodeBlock*);
JSObject* createNotAnObjectError(ExecState*, JSNotAnObjectErrorStub*, unsigned bytecodeOffset, CodeBlock*);
+ JSValue throwOutOfMemoryError(ExecState*);
} // namespace JSC
diff --git a/JavaScriptCore/runtime/Executable.cpp b/JavaScriptCore/runtime/Executable.cpp
index bc18cc9..79900dc 100644
--- a/JavaScriptCore/runtime/Executable.cpp
+++ b/JavaScriptCore/runtime/Executable.cpp
@@ -272,7 +272,7 @@ UString FunctionExecutable::paramString() const
builder.append(", ");
builder.append(parameters[pos].ustring());
}
- return builder.release();
+ return builder.build();
}
};
diff --git a/JavaScriptCore/runtime/FunctionConstructor.cpp b/JavaScriptCore/runtime/FunctionConstructor.cpp
index 9d55dd1..9b0b1bb 100644
--- a/JavaScriptCore/runtime/FunctionConstructor.cpp
+++ b/JavaScriptCore/runtime/FunctionConstructor.cpp
@@ -89,7 +89,7 @@ JSObject* constructFunction(ExecState* exec, const ArgList& args, const Identifi
builder.append(") { ");
builder.append(args.at(args.size() - 1).toString(exec));
builder.append("\n})");
- program = builder.release();
+ program = builder.build();
}
int errLine;
diff --git a/JavaScriptCore/runtime/FunctionPrototype.cpp b/JavaScriptCore/runtime/FunctionPrototype.cpp
index f08bd5e..3475f08 100644
--- a/JavaScriptCore/runtime/FunctionPrototype.cpp
+++ b/JavaScriptCore/runtime/FunctionPrototype.cpp
@@ -25,6 +25,7 @@
#include "JSArray.h"
#include "JSFunction.h"
#include "JSString.h"
+#include "JSStringBuilder.h"
#include "Interpreter.h"
#include "Lexer.h"
#include "PrototypeFunction.h"
@@ -38,7 +39,7 @@ static JSValue JSC_HOST_CALL functionProtoFuncApply(ExecState*, JSObject*, JSVal
static JSValue JSC_HOST_CALL functionProtoFuncCall(ExecState*, JSObject*, JSValue, const ArgList&);
FunctionPrototype::FunctionPrototype(ExecState* exec, NonNullPassRefPtr<Structure> structure)
- : InternalFunction(&exec->globalData(), structure, exec->propertyNames().nullIdentifier)
+ : InternalFunction(&exec->globalData(), structure, exec->propertyNames().emptyIdentifier)
{
putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 0), DontDelete | ReadOnly | DontEnum);
}
@@ -90,13 +91,13 @@ JSValue JSC_HOST_CALL functionProtoFuncToString(ExecState* exec, JSObject*, JSVa
FunctionExecutable* executable = function->jsExecutable();
UString sourceString = executable->source().toString();
insertSemicolonIfNeeded(sourceString);
- return jsString(exec, makeString("function ", function->name(exec), "(", executable->paramString(), ") ", sourceString));
+ return jsMakeNontrivialString(exec, "function ", function->name(exec), "(", executable->paramString(), ") ", sourceString);
}
}
if (thisValue.inherits(&InternalFunction::info)) {
InternalFunction* function = asInternalFunction(thisValue);
- return jsString(exec, makeString("function ", function->name(exec), "() {\n [native code]\n}"));
+ return jsMakeNontrivialString(exec, "function ", function->name(exec), "() {\n [native code]\n}");
}
return throwError(exec, TypeError);
diff --git a/JavaScriptCore/runtime/Identifier.cpp b/JavaScriptCore/runtime/Identifier.cpp
index 747c4ac..97929e2 100644
--- a/JavaScriptCore/runtime/Identifier.cpp
+++ b/JavaScriptCore/runtime/Identifier.cpp
@@ -123,10 +123,8 @@ struct CStringTranslator {
PassRefPtr<UString::Rep> Identifier::add(JSGlobalData* globalData, const char* c)
{
- if (!c) {
- UString::Rep::null().hash();
- return &UString::Rep::null();
- }
+ ASSERT(c);
+
if (!c[0]) {
UString::Rep::empty().hash();
return &UString::Rep::empty();
diff --git a/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp b/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
index 0bc1274..3ddac7c 100644
--- a/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
+++ b/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
@@ -30,11 +30,11 @@
#include "Interpreter.h"
#include "JSGlobalObject.h"
#include "JSString.h"
+#include "JSStringBuilder.h"
#include "Lexer.h"
#include "LiteralParser.h"
#include "Nodes.h"
#include "Parser.h"
-#include "StringBuilder.h"
#include "StringExtras.h"
#include "dtoa.h"
#include <stdio.h>
@@ -57,7 +57,7 @@ static JSValue encode(ExecState* exec, const ArgList& args, const char* doNotEsc
if (!cstr.c_str())
return throwError(exec, URIError, "String contained an illegal UTF-16 sequence.");
- StringBuilder builder;
+ JSStringBuilder builder;
const char* p = cstr.c_str();
for (size_t k = 0; k < cstr.size(); k++, p++) {
char c = *p;
@@ -66,15 +66,15 @@ static JSValue encode(ExecState* exec, const ArgList& args, const char* doNotEsc
else {
char tmp[4];
snprintf(tmp, 4, "%%%02X", static_cast<unsigned char>(c));
- builder.append((const char*)tmp);
+ builder.append(tmp);
}
}
- return jsString(exec, builder.release());
+ return builder.build(exec);
}
static JSValue decode(ExecState* exec, const ArgList& args, const char* doNotUnescape, bool strict)
{
- StringBuilder builder;
+ JSStringBuilder builder;
UString str = args.at(0).toString(exec);
int k = 0;
int len = str.size();
@@ -135,7 +135,7 @@ static JSValue decode(ExecState* exec, const ArgList& args, const char* doNotUne
k++;
builder.append(c);
}
- return jsString(exec, builder.release());
+ return builder.build(exec);
}
bool isStrWhiteSpace(UChar c)
@@ -378,8 +378,7 @@ JSValue JSC_HOST_CALL globalFuncEscape(ExecState* exec, JSObject*, JSValue, cons
"0123456789"
"*+-./@_";
- StringBuilder builder;
- UString s;
+ JSStringBuilder builder;
UString str = args.at(0).toString(exec);
const UChar* c = str.data();
for (int k = 0; k < str.size(); k++, c++) {
@@ -387,18 +386,17 @@ JSValue JSC_HOST_CALL globalFuncEscape(ExecState* exec, JSObject*, JSValue, cons
if (u > 255) {
char tmp[7];
sprintf(tmp, "%%u%04X", u);
- s = UString(tmp);
+ builder.append(tmp);
} else if (u != 0 && strchr(do_not_escape, static_cast<char>(u)))
- s = UString(c, 1);
+ builder.append(c, 1);
else {
char tmp[4];
sprintf(tmp, "%%%02X", u);
- s = UString(tmp);
+ builder.append(tmp);
}
- builder.append(s);
}
- return jsString(exec, builder.release());
+ return builder.build(exec);
}
JSValue JSC_HOST_CALL globalFuncUnescape(ExecState* exec, JSObject*, JSValue, const ArgList& args)
@@ -425,7 +423,7 @@ JSValue JSC_HOST_CALL globalFuncUnescape(ExecState* exec, JSObject*, JSValue, co
builder.append(*c);
}
- return jsString(exec, builder.release());
+ return jsString(exec, builder.build());
}
#ifndef NDEBUG
diff --git a/JavaScriptCore/runtime/JSONObject.cpp b/JavaScriptCore/runtime/JSONObject.cpp
index ce0dcff..acd9280 100644
--- a/JavaScriptCore/runtime/JSONObject.cpp
+++ b/JavaScriptCore/runtime/JSONObject.cpp
@@ -268,7 +268,7 @@ JSValue Stringifier::stringify(JSValue value)
if (m_exec->hadException())
return jsNull();
- return jsString(m_exec, result.release());
+ return jsString(m_exec, result.build());
}
void Stringifier::appendQuotedString(StringBuilder& builder, const UString& value)
diff --git a/JavaScriptCore/runtime/JSPropertyNameIterator.cpp b/JavaScriptCore/runtime/JSPropertyNameIterator.cpp
index d3dcb83..a5d4da0 100644
--- a/JavaScriptCore/runtime/JSPropertyNameIterator.cpp
+++ b/JavaScriptCore/runtime/JSPropertyNameIterator.cpp
@@ -35,6 +35,24 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(JSPropertyNameIterator);
+inline JSPropertyNameIterator::JSPropertyNameIterator(ExecState* exec, PropertyNameArrayData* propertyNameArrayData, size_t numCacheableSlots)
+ : JSCell(exec->globalData().propertyNameIteratorStructure.get())
+ , m_cachedStructure(0)
+ , m_numCacheableSlots(numCacheableSlots)
+ , m_jsStringsSize(propertyNameArrayData->propertyNameVector().size())
+ , m_jsStrings(new JSValue[m_jsStringsSize])
+{
+ PropertyNameArrayData::PropertyNameVector& propertyNameVector = propertyNameArrayData->propertyNameVector();
+ for (size_t i = 0; i < m_jsStringsSize; ++i)
+ m_jsStrings[i] = jsOwnedString(exec, propertyNameVector[i].ustring());
+}
+
+JSPropertyNameIterator::~JSPropertyNameIterator()
+{
+ if (m_cachedStructure)
+ m_cachedStructure->clearEnumerationCache(this);
+}
+
JSPropertyNameIterator* JSPropertyNameIterator::create(ExecState* exec, JSObject* o)
{
ASSERT(!o->structure()->enumerationCache() ||
diff --git a/JavaScriptCore/runtime/JSPropertyNameIterator.h b/JavaScriptCore/runtime/JSPropertyNameIterator.h
index d18c2c5..3f533a0 100644
--- a/JavaScriptCore/runtime/JSPropertyNameIterator.h
+++ b/JavaScriptCore/runtime/JSPropertyNameIterator.h
@@ -49,6 +49,8 @@ namespace JSC {
{
return Structure::create(prototype, TypeInfo(CompoundType, OverridesMarkChildren), AnonymousSlotCount);
}
+
+ virtual ~JSPropertyNameIterator();
virtual bool isPropertyNameIterator() const { return true; }
@@ -81,23 +83,21 @@ namespace JSC {
OwnArrayPtr<JSValue> m_jsStrings;
};
-inline JSPropertyNameIterator::JSPropertyNameIterator(ExecState* exec, PropertyNameArrayData* propertyNameArrayData, size_t numCacheableSlots)
- : JSCell(exec->globalData().propertyNameIteratorStructure.get())
- , m_cachedStructure(0)
- , m_numCacheableSlots(numCacheableSlots)
- , m_jsStringsSize(propertyNameArrayData->propertyNameVector().size())
- , m_jsStrings(new JSValue[m_jsStringsSize])
-{
- PropertyNameArrayData::PropertyNameVector& propertyNameVector = propertyNameArrayData->propertyNameVector();
- for (size_t i = 0; i < m_jsStringsSize; ++i)
- m_jsStrings[i] = jsOwnedString(exec, propertyNameVector[i].ustring());
-}
-
-inline void Structure::setEnumerationCache(JSPropertyNameIterator* enumerationCache)
-{
- ASSERT(!isDictionary());
- m_enumerationCache = enumerationCache;
-}
+ inline void Structure::setEnumerationCache(JSPropertyNameIterator* enumerationCache)
+ {
+ ASSERT(!isDictionary());
+ m_enumerationCache = enumerationCache;
+ }
+
+ inline void Structure::clearEnumerationCache(JSPropertyNameIterator* enumerationCache)
+ {
+ m_enumerationCache.clear(enumerationCache);
+ }
+
+ inline JSPropertyNameIterator* Structure::enumerationCache()
+ {
+ return m_enumerationCache.get();
+ }
} // namespace JSC
diff --git a/JavaScriptCore/runtime/JSString.h b/JavaScriptCore/runtime/JSString.h
index af03025..cff8e3a 100644
--- a/JavaScriptCore/runtime/JSString.h
+++ b/JavaScriptCore/runtime/JSString.h
@@ -283,8 +283,9 @@ namespace JSC {
}
const UString tryGetValue() const
{
- if (isRope())
- UString();
+ // If this is a rope, m_value should be null -
+ // if this is not a rope, m_value should be non-null.
+ ASSERT(isRope() == m_value.isNull());
return m_value;
}
unsigned length() { return m_stringLength; }
diff --git a/JavaScriptCore/runtime/JSStringBuilder.h b/JavaScriptCore/runtime/JSStringBuilder.h
new file mode 100644
index 0000000..2b11736
--- /dev/null
+++ b/JavaScriptCore/runtime/JSStringBuilder.h
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSStringBuilder_h
+#define JSStringBuilder_h
+
+#include "ExceptionHelpers.h"
+#include "JSString.h"
+#include "StringBuilder.h"
+
+namespace JSC {
+
+class JSStringBuilder : public StringBuilder {
+public:
+ JSValue build(ExecState* exec)
+ {
+ buffer.shrinkToFit();
+ if (!buffer.data())
+ return throwOutOfMemoryError(exec);
+ return jsString(exec, UString::adopt(buffer));
+ }
+
+private:
+ // Make attempts to call this compile error - if you only wanted a UString,
+ // Why didn't you just use a StringBuilder?! (This may change, maybe at some
+ // point in the future we'll need to start building a string not knowing whether
+ // we'll want a UString or a JSValue - but until we have this requirement,
+ // block this).
+ UString build()
+ {
+ ASSERT_NOT_REACHED();
+ return StringBuilder::build();
+ }
+};
+
+template<typename StringType1, typename StringType2>
+inline JSValue jsMakeNontrivialString(ExecState* exec, StringType1 string1, StringType2 string2)
+{
+ PassRefPtr<UStringImpl> result = tryMakeString(string1, string2);
+ if (!result)
+ return throwOutOfMemoryError(exec);
+ return jsNontrivialString(exec, result);
+}
+
+template<typename StringType1, typename StringType2, typename StringType3>
+inline JSValue jsMakeNontrivialString(ExecState* exec, StringType1 string1, StringType2 string2, StringType3 string3)
+{
+ PassRefPtr<UStringImpl> result = tryMakeString(string1, string2, string3);
+ if (!result)
+ return throwOutOfMemoryError(exec);
+ return jsNontrivialString(exec, result);
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4>
+inline JSValue jsMakeNontrivialString(ExecState* exec, StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4)
+{
+ PassRefPtr<UStringImpl> result = tryMakeString(string1, string2, string3, string4);
+ if (!result)
+ return throwOutOfMemoryError(exec);
+ return jsNontrivialString(exec, result);
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5>
+inline JSValue jsMakeNontrivialString(ExecState* exec, StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5)
+{
+ PassRefPtr<UStringImpl> result = tryMakeString(string1, string2, string3, string4, string5);
+ if (!result)
+ return throwOutOfMemoryError(exec);
+ return jsNontrivialString(exec, result);
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6>
+inline JSValue jsMakeNontrivialString(ExecState* exec, StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6)
+{
+ PassRefPtr<UStringImpl> result = tryMakeString(string1, string2, string3, string4, string5, string6);
+ if (!result)
+ return throwOutOfMemoryError(exec);
+ return jsNontrivialString(exec, result);
+}
+
+}
+
+#endif
diff --git a/JavaScriptCore/runtime/JSValue.cpp b/JavaScriptCore/runtime/JSValue.cpp
index 699c1cd..502312c 100644
--- a/JavaScriptCore/runtime/JSValue.cpp
+++ b/JavaScriptCore/runtime/JSValue.cpp
@@ -174,7 +174,11 @@ uint32_t toUInt32SlowCase(double d, bool& ok)
NEVER_INLINE double nonInlineNaN()
{
+#if OS(SYMBIAN)
+ return nanval();
+#else
return std::numeric_limits<double>::quiet_NaN();
+#endif
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/LiteralParser.cpp b/JavaScriptCore/runtime/LiteralParser.cpp
index aa1e5ed..cc33bae 100644
--- a/JavaScriptCore/runtime/LiteralParser.cpp
+++ b/JavaScriptCore/runtime/LiteralParser.cpp
@@ -200,7 +200,7 @@ template <LiteralParser::ParserMode mode> inline LiteralParser::TokenType Litera
if (m_ptr >= m_end || *m_ptr != '"')
return TokError;
- token.stringToken = builder.release();
+ token.stringToken = builder.build();
token.type = TokString;
token.end = ++m_ptr;
return TokString;
diff --git a/JavaScriptCore/runtime/NumberPrototype.cpp b/JavaScriptCore/runtime/NumberPrototype.cpp
index 67210fa..fa32b86 100644
--- a/JavaScriptCore/runtime/NumberPrototype.cpp
+++ b/JavaScriptCore/runtime/NumberPrototype.cpp
@@ -25,6 +25,7 @@
#include "Error.h"
#include "JSFunction.h"
#include "JSString.h"
+#include "JSStringBuilder.h"
#include "Operations.h"
#include "PrototypeFunction.h"
#include "StringBuilder.h"
@@ -94,7 +95,7 @@ static UString integerPartNoExp(double d)
builder.append((const char*)(buf.data()));
}
- return builder.release();
+ return builder.build();
}
static UString charSequence(char c, int count)
@@ -262,7 +263,7 @@ JSValue JSC_HOST_CALL numberProtoFuncToFixed(ExecState* exec, JSObject*, JSValue
for (int i = 0; i < f + 1 - k; i++)
z.append('0');
z.append(m);
- m = z.release();
+ m = z.build();
k = f + 1;
ASSERT(k == m.size());
}
@@ -432,8 +433,8 @@ JSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState* exec, JSObject*, JSV
if (m.size() > 1)
m = makeString(m.substr(0, 1), ".", m.substr(1));
if (e >= 0)
- return jsNontrivialString(exec, makeString(s, m, "e+", UString::from(e)));
- return jsNontrivialString(exec, makeString(s, m, "e-", UString::from(-e)));
+ return jsMakeNontrivialString(exec, s, m, "e+", UString::from(e));
+ return jsMakeNontrivialString(exec, s, m, "e-", UString::from(-e));
}
} else {
m = charSequence('0', precision);
@@ -447,7 +448,7 @@ JSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState* exec, JSObject*, JSV
return jsString(exec, makeString(s, m.substr(0, e + 1), ".", m.substr(e + 1)));
return jsString(exec, makeString(s, m));
}
- return jsNontrivialString(exec, makeString(s, "0.", charSequence('0', -(e + 1)), m));
+ return jsMakeNontrivialString(exec, s, "0.", charSequence('0', -(e + 1)), m);
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/ObjectPrototype.cpp b/JavaScriptCore/runtime/ObjectPrototype.cpp
index 3065c6d..c32a007 100644
--- a/JavaScriptCore/runtime/ObjectPrototype.cpp
+++ b/JavaScriptCore/runtime/ObjectPrototype.cpp
@@ -24,6 +24,7 @@
#include "Error.h"
#include "JSFunction.h"
#include "JSString.h"
+#include "JSStringBuilder.h"
#include "PrototypeFunction.h"
namespace JSC {
@@ -148,7 +149,7 @@ JSValue JSC_HOST_CALL objectProtoFuncToLocaleString(ExecState* exec, JSObject*,
JSValue JSC_HOST_CALL objectProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
- return jsNontrivialString(exec, makeString("[object ", thisValue.toThisObject(exec)->className(), "]"));
+ return jsMakeNontrivialString(exec, "[object ", thisValue.toThisObject(exec)->className(), "]");
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/Operations.cpp b/JavaScriptCore/runtime/Operations.cpp
index 0e1887c..cf236bf 100644
--- a/JavaScriptCore/runtime/Operations.cpp
+++ b/JavaScriptCore/runtime/Operations.cpp
@@ -41,13 +41,6 @@ bool JSValue::strictEqualSlowCase(ExecState* exec, JSValue v1, JSValue v2)
return strictEqualSlowCaseInline(exec, v1, v2);
}
-NEVER_INLINE JSValue throwOutOfMemoryError(ExecState* exec)
-{
- JSObject* error = Error::create(exec, GeneralError, "Out of memory");
- exec->setException(error);
- return error;
-}
-
NEVER_INLINE JSValue jsAddSlowCase(CallFrame* callFrame, JSValue v1, JSValue v2)
{
// exception for the Date exception in defaultValue()
diff --git a/JavaScriptCore/runtime/Operations.h b/JavaScriptCore/runtime/Operations.h
index c3aa0fa..9b27074 100644
--- a/JavaScriptCore/runtime/Operations.h
+++ b/JavaScriptCore/runtime/Operations.h
@@ -22,6 +22,7 @@
#ifndef Operations_h
#define Operations_h
+#include "ExceptionHelpers.h"
#include "Interpreter.h"
#include "JSImmediate.h"
#include "JSNumberCell.h"
@@ -29,7 +30,6 @@
namespace JSC {
- NEVER_INLINE JSValue throwOutOfMemoryError(ExecState*);
NEVER_INLINE JSValue jsAddSlowCase(CallFrame*, JSValue, JSValue);
JSValue jsTypeStringForValue(CallFrame*, JSValue);
bool jsIsObjectType(JSValue);
diff --git a/JavaScriptCore/runtime/PropertyNameArray.cpp b/JavaScriptCore/runtime/PropertyNameArray.cpp
index 5108272..4937b7c 100644
--- a/JavaScriptCore/runtime/PropertyNameArray.cpp
+++ b/JavaScriptCore/runtime/PropertyNameArray.cpp
@@ -30,7 +30,7 @@ static const size_t setThreshold = 20;
void PropertyNameArray::add(UString::Rep* identifier)
{
- ASSERT(identifier == &UString::Rep::null() || identifier == &UString::Rep::empty() || identifier->isIdentifier());
+ ASSERT(identifier == &UString::Rep::empty() || identifier->isIdentifier());
size_t size = m_data->propertyNameVector().size();
if (size < setThreshold) {
diff --git a/JavaScriptCore/runtime/RegExpPrototype.cpp b/JavaScriptCore/runtime/RegExpPrototype.cpp
index 5f9d357..dd5fe02 100644
--- a/JavaScriptCore/runtime/RegExpPrototype.cpp
+++ b/JavaScriptCore/runtime/RegExpPrototype.cpp
@@ -27,6 +27,7 @@
#include "JSFunction.h"
#include "JSObject.h"
#include "JSString.h"
+#include "JSStringBuilder.h"
#include "JSValue.h"
#include "ObjectPrototype.h"
#include "PrototypeFunction.h"
@@ -116,7 +117,7 @@ JSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState* exec, JSObject*, JSValu
postfix[index] = 'm';
UString source = asRegExpObject(thisValue)->get(exec, exec->propertyNames().source).toString(exec);
// If source is empty, use "/(?:)/" to avoid colliding with comment syntax
- return jsNontrivialString(exec, makeString("/", source.size() ? source : UString("(?:)"), postfix));
+ return jsMakeNontrivialString(exec, "/", source.size() ? source : UString("(?:)"), postfix);
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/SmallStrings.cpp b/JavaScriptCore/runtime/SmallStrings.cpp
index ac71735..d9d4377 100644
--- a/JavaScriptCore/runtime/SmallStrings.cpp
+++ b/JavaScriptCore/runtime/SmallStrings.cpp
@@ -34,6 +34,11 @@
namespace JSC {
static const unsigned numCharactersToStore = 0x100;
+static inline bool isMarked(JSString* string)
+{
+ return string && Heap::isCellMarked(string);
+}
+
class SmallStringsStorage : public Noncopyable {
public:
SmallStringsStorage();
@@ -55,13 +60,9 @@ SmallStringsStorage::SmallStringsStorage()
}
SmallStrings::SmallStrings()
- : m_emptyString(0)
- , m_storage(0)
{
COMPILE_ASSERT(numCharactersToStore == sizeof(m_singleCharacterStrings) / sizeof(m_singleCharacterStrings[0]), IsNumCharactersConstInSyncWithClassUsage);
-
- for (unsigned i = 0; i < numCharactersToStore; ++i)
- m_singleCharacterStrings[i] = 0;
+ clear();
}
SmallStrings::~SmallStrings()
@@ -70,6 +71,25 @@ SmallStrings::~SmallStrings()
void SmallStrings::markChildren(MarkStack& markStack)
{
+ /*
+ Our hypothesis is that small strings are very common. So, we cache them
+ to avoid GC churn. However, in cases where this hypothesis turns out to
+ be false -- including the degenerate case where all JavaScript execution
+ has terminated -- we don't want to waste memory.
+
+ To test our hypothesis, we check if any small string has been marked. If
+ so, it's probably reasonable to mark the rest. If not, we clear the cache.
+ */
+
+ bool isAnyStringMarked = isMarked(m_emptyString);
+ for (unsigned i = 0; i < numCharactersToStore && !isAnyStringMarked; ++i)
+ isAnyStringMarked |= isMarked(m_singleCharacterStrings[i]);
+
+ if (!isAnyStringMarked) {
+ clear();
+ return;
+ }
+
if (m_emptyString)
markStack.append(m_emptyString);
for (unsigned i = 0; i < numCharactersToStore; ++i) {
@@ -78,6 +98,13 @@ void SmallStrings::markChildren(MarkStack& markStack)
}
}
+void SmallStrings::clear()
+{
+ m_emptyString = 0;
+ for (unsigned i = 0; i < numCharactersToStore; ++i)
+ m_singleCharacterStrings[i] = 0;
+}
+
unsigned SmallStrings::count() const
{
unsigned count = 0;
diff --git a/JavaScriptCore/runtime/SmallStrings.h b/JavaScriptCore/runtime/SmallStrings.h
index efecbb0..cc11d0a 100644
--- a/JavaScriptCore/runtime/SmallStrings.h
+++ b/JavaScriptCore/runtime/SmallStrings.h
@@ -57,6 +57,7 @@ namespace JSC {
UString::Rep* singleCharacterStringRep(unsigned char character);
void markChildren(MarkStack&);
+ void clear();
unsigned count() const;
diff --git a/JavaScriptCore/runtime/StringBuilder.h b/JavaScriptCore/runtime/StringBuilder.h
index 8e18d37..27dbbd7 100644
--- a/JavaScriptCore/runtime/StringBuilder.h
+++ b/JavaScriptCore/runtime/StringBuilder.h
@@ -39,7 +39,7 @@ public:
void append(const char* str)
{
- buffer.append(str, strlen(str));
+ append(str, strlen(str));
}
void append(const char* str, size_t len)
@@ -66,13 +66,15 @@ public:
UChar operator[](size_t i) const { return buffer.at(i); }
- UString release()
+ UString build()
{
buffer.shrinkToFit();
+ if (buffer.size() && !buffer.data())
+ CRASH();
return UString::adopt(buffer);
}
-private:
+protected:
Vector<UChar, 64> buffer;
};
diff --git a/JavaScriptCore/runtime/StringPrototype.cpp b/JavaScriptCore/runtime/StringPrototype.cpp
index d002e07..8c014ec 100644
--- a/JavaScriptCore/runtime/StringPrototype.cpp
+++ b/JavaScriptCore/runtime/StringPrototype.cpp
@@ -28,6 +28,7 @@
#include "JSGlobalObjectFunctions.h"
#include "JSArray.h"
#include "JSFunction.h"
+#include "JSStringBuilder.h"
#include "ObjectPrototype.h"
#include "Operations.h"
#include "PropertyNameArray.h"
@@ -227,6 +228,86 @@ static inline int localeCompare(const UString& a, const UString& b)
return Collator::userDefault()->collate(reinterpret_cast<const ::UChar*>(a.data()), a.size(), reinterpret_cast<const ::UChar*>(b.data()), b.size());
}
+struct StringRange {
+public:
+ StringRange(int pos, int len)
+ : position(pos)
+ , length(len)
+ {
+ }
+
+ StringRange()
+ {
+ }
+
+ int position;
+ int length;
+};
+
+JSValue jsSpliceSubstringsWithSeparators(ExecState* exec, JSString* sourceVal, const UString& source, const StringRange* substringRanges, int rangeCount, const UString* separators, int separatorCount);
+JSValue jsSpliceSubstringsWithSeparators(ExecState* exec, JSString* sourceVal, const UString& source, const StringRange* substringRanges, int rangeCount, const UString* separators, int separatorCount)
+{
+ if (rangeCount == 1 && separatorCount == 0) {
+ int sourceSize = source.size();
+ int position = substringRanges[0].position;
+ int length = substringRanges[0].length;
+ if (position <= 0 && length >= sourceSize)
+ return sourceVal;
+ // We could call UString::substr, but this would result in redundant checks
+ return jsString(exec, UStringImpl::create(source.rep(), max(0, position), min(sourceSize, length)));
+ }
+
+ int totalLength = 0;
+ for (int i = 0; i < rangeCount; i++)
+ totalLength += substringRanges[i].length;
+ for (int i = 0; i < separatorCount; i++)
+ totalLength += separators[i].size();
+
+ if (totalLength == 0)
+ return jsString(exec, "");
+
+ UChar* buffer;
+ PassRefPtr<UStringImpl> impl = UStringImpl::tryCreateUninitialized(totalLength, buffer);
+ if (!impl)
+ return throwOutOfMemoryError(exec);
+
+ int maxCount = max(rangeCount, separatorCount);
+ int bufferPos = 0;
+ for (int i = 0; i < maxCount; i++) {
+ if (i < rangeCount) {
+ UStringImpl::copyChars(buffer + bufferPos, source.data() + substringRanges[i].position, substringRanges[i].length);
+ bufferPos += substringRanges[i].length;
+ }
+ if (i < separatorCount) {
+ UStringImpl::copyChars(buffer + bufferPos, separators[i].data(), separators[i].size());
+ bufferPos += separators[i].size();
+ }
+ }
+
+ return jsString(exec, impl);
+}
+
+JSValue jsReplaceRange(ExecState* exec, const UString& source, int rangeStart, int rangeLength, const UString& replacement);
+JSValue jsReplaceRange(ExecState* exec, const UString& source, int rangeStart, int rangeLength, const UString& replacement)
+{
+ int replacementLength = replacement.size();
+ int totalLength = source.size() - rangeLength + replacementLength;
+ if (totalLength == 0)
+ return jsString(exec, "");
+
+ UChar* buffer;
+ PassRefPtr<UStringImpl> impl = UStringImpl::tryCreateUninitialized(totalLength, buffer);
+ if (!impl)
+ return throwOutOfMemoryError(exec);
+
+ UStringImpl::copyChars(buffer, source.data(), rangeStart);
+ UStringImpl::copyChars(buffer + rangeStart, replacement.data(), replacementLength);
+ int rangeEnd = rangeStart + rangeLength;
+ UStringImpl::copyChars(buffer + rangeStart + replacementLength, source.data() + rangeEnd, source.size() - rangeEnd);
+
+ return jsString(exec, impl);
+}
+
JSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
JSString* sourceVal = thisValue.toThisJSString(exec);
@@ -250,7 +331,7 @@ JSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec, JSObject*, JSValue
int lastIndex = 0;
int startPosition = 0;
- Vector<UString::Range, 16> sourceRanges;
+ Vector<StringRange, 16> sourceRanges;
Vector<UString, 16> replacements;
// This is either a loop (if global is set) or a one-way (if not).
@@ -269,7 +350,7 @@ JSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec, JSObject*, JSValue
if (matchIndex < 0)
break;
- sourceRanges.append(UString::Range(lastIndex, matchIndex - lastIndex));
+ sourceRanges.append(StringRange(lastIndex, matchIndex - lastIndex));
int completeMatchStart = ovector[0];
unsigned i = 0;
@@ -311,7 +392,7 @@ JSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec, JSObject*, JSValue
if (matchIndex < 0)
break;
- sourceRanges.append(UString::Range(lastIndex, matchIndex - lastIndex));
+ sourceRanges.append(StringRange(lastIndex, matchIndex - lastIndex));
if (callType != CallTypeNone) {
int completeMatchStart = ovector[0];
@@ -352,10 +433,9 @@ JSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec, JSObject*, JSValue
return sourceVal;
if (lastIndex < source.size())
- sourceRanges.append(UString::Range(lastIndex, source.size() - lastIndex));
+ sourceRanges.append(StringRange(lastIndex, source.size() - lastIndex));
- return jsString(exec, source.spliceSubstringsWithSeparators(sourceRanges.data(), sourceRanges.size(),
- replacements.data(), replacements.size()));
+ return jsSpliceSubstringsWithSeparators(exec, sourceVal, source, sourceRanges.data(), sourceRanges.size(), replacements.data(), replacements.size());
}
// Not a regular expression, so treat the pattern as a string.
@@ -377,7 +457,7 @@ JSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec, JSObject*, JSValue
}
int ovector[2] = { matchPos, matchPos + matchLen };
- return jsString(exec, source.replaceRange(matchPos, matchLen, substituteBackreferences(replacementString, source, ovector, 0)));
+ return jsReplaceRange(exec, source, matchPos, matchLen, substituteBackreferences(replacementString, source, ovector, 0));
}
JSValue JSC_HOST_CALL stringProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
@@ -789,62 +869,62 @@ JSValue JSC_HOST_CALL stringProtoFuncLocaleCompare(ExecState* exec, JSObject*, J
JSValue JSC_HOST_CALL stringProtoFuncBig(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
UString s = thisValue.toThisString(exec);
- return jsNontrivialString(exec, makeString("<big>", s, "</big>"));
+ return jsMakeNontrivialString(exec, "<big>", s, "</big>");
}
JSValue JSC_HOST_CALL stringProtoFuncSmall(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
UString s = thisValue.toThisString(exec);
- return jsNontrivialString(exec, makeString("<small>", s, "</small>"));
+ return jsMakeNontrivialString(exec, "<small>", s, "</small>");
}
JSValue JSC_HOST_CALL stringProtoFuncBlink(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
UString s = thisValue.toThisString(exec);
- return jsNontrivialString(exec, makeString("<blink>", s, "</blink>"));
+ return jsMakeNontrivialString(exec, "<blink>", s, "</blink>");
}
JSValue JSC_HOST_CALL stringProtoFuncBold(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
UString s = thisValue.toThisString(exec);
- return jsNontrivialString(exec, makeString("<b>", s, "</b>"));
+ return jsMakeNontrivialString(exec, "<b>", s, "</b>");
}
JSValue JSC_HOST_CALL stringProtoFuncFixed(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
UString s = thisValue.toThisString(exec);
- return jsString(exec, makeString("<tt>", s, "</tt>"));
+ return jsMakeNontrivialString(exec, "<tt>", s, "</tt>");
}
JSValue JSC_HOST_CALL stringProtoFuncItalics(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
UString s = thisValue.toThisString(exec);
- return jsNontrivialString(exec, makeString("<i>", s, "</i>"));
+ return jsMakeNontrivialString(exec, "<i>", s, "</i>");
}
JSValue JSC_HOST_CALL stringProtoFuncStrike(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
UString s = thisValue.toThisString(exec);
- return jsNontrivialString(exec, makeString("<strike>", s, "</strike>"));
+ return jsMakeNontrivialString(exec, "<strike>", s, "</strike>");
}
JSValue JSC_HOST_CALL stringProtoFuncSub(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
UString s = thisValue.toThisString(exec);
- return jsNontrivialString(exec, makeString("<sub>", s, "</sub>"));
+ return jsMakeNontrivialString(exec, "<sub>", s, "</sub>");
}
JSValue JSC_HOST_CALL stringProtoFuncSup(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
UString s = thisValue.toThisString(exec);
- return jsNontrivialString(exec, makeString("<sup>", s, "</sup>"));
+ return jsMakeNontrivialString(exec, "<sup>", s, "</sup>");
}
JSValue JSC_HOST_CALL stringProtoFuncFontcolor(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UString s = thisValue.toThisString(exec);
JSValue a0 = args.at(0);
- return jsNontrivialString(exec, makeString("<font color=\"", a0.toString(exec), "\">", s, "</font>"));
+ return jsMakeNontrivialString(exec, "<font color=\"", a0.toString(exec), "\">", s, "</font>");
}
JSValue JSC_HOST_CALL stringProtoFuncFontsize(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
@@ -886,14 +966,14 @@ JSValue JSC_HOST_CALL stringProtoFuncFontsize(ExecState* exec, JSObject*, JSValu
return jsNontrivialString(exec, impl);
}
- return jsNontrivialString(exec, makeString("<font size=\"", a0.toString(exec), "\">", s, "</font>"));
+ return jsMakeNontrivialString(exec, "<font size=\"", a0.toString(exec), "\">", s, "</font>");
}
JSValue JSC_HOST_CALL stringProtoFuncAnchor(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UString s = thisValue.toThisString(exec);
JSValue a0 = args.at(0);
- return jsNontrivialString(exec, makeString("<a name=\"", a0.toString(exec), "\">", s, "</a>"));
+ return jsMakeNontrivialString(exec, "<a name=\"", a0.toString(exec), "\">", s, "</a>");
}
JSValue JSC_HOST_CALL stringProtoFuncLink(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
diff --git a/JavaScriptCore/runtime/Structure.h b/JavaScriptCore/runtime/Structure.h
index 1353a5a..95cf94c 100644
--- a/JavaScriptCore/runtime/Structure.h
+++ b/JavaScriptCore/runtime/Structure.h
@@ -36,6 +36,7 @@
#include "StructureTransitionTable.h"
#include "JSTypeInfo.h"
#include "UString.h"
+#include "WeakGCPtr.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
@@ -101,7 +102,7 @@ namespace JSC {
void growPropertyStorageCapacity();
unsigned propertyStorageCapacity() const { return m_propertyStorageCapacity; }
- unsigned propertyStorageSize() const { return m_anonymousSlotCount + (m_propertyTable ? m_propertyTable->keyCount + (m_propertyTable->deletedOffsets ? m_propertyTable->deletedOffsets->size() : 0) : m_offset + 1); }
+ unsigned propertyStorageSize() const { return m_anonymousSlotCount + (m_propertyTable ? m_propertyTable->keyCount + (m_propertyTable->deletedOffsets ? m_propertyTable->deletedOffsets->size() : 0) : static_cast<unsigned>(m_offset + 1)); }
bool isUsingInlineStorage() const;
size_t get(const Identifier& propertyName);
@@ -135,7 +136,8 @@ namespace JSC {
void disableSpecificFunctionTracking() { m_specificFunctionThrashCount = maxSpecificFunctionThrashCount; }
void setEnumerationCache(JSPropertyNameIterator* enumerationCache); // Defined in JSPropertyNameIterator.h.
- JSPropertyNameIterator* enumerationCache() { return m_enumerationCache.get(); }
+ void clearEnumerationCache(JSPropertyNameIterator* enumerationCache); // Defined in JSPropertyNameIterator.h.
+ JSPropertyNameIterator* enumerationCache(); // Defined in JSPropertyNameIterator.h.
void getPropertyNames(PropertyNameArray&, EnumerationMode mode);
private:
@@ -199,7 +201,7 @@ namespace JSC {
StructureTransitionTable table;
- ProtectedPtr<JSPropertyNameIterator> m_enumerationCache;
+ WeakGCPtr<JSPropertyNameIterator> m_enumerationCache;
PropertyMapHashTable* m_propertyTable;
diff --git a/JavaScriptCore/runtime/UString.cpp b/JavaScriptCore/runtime/UString.cpp
index e75a05c..4a89a23 100644
--- a/JavaScriptCore/runtime/UString.cpp
+++ b/JavaScriptCore/runtime/UString.cpp
@@ -53,7 +53,7 @@ using namespace WTF::Unicode;
using namespace std;
namespace JSC {
-
+
extern const double NaN;
extern const double Inf;
@@ -146,95 +146,46 @@ bool operator==(const CString& c1, const CString& c2)
return len == c2.size() && (len == 0 || memcmp(c1.c_str(), c2.c_str(), len) == 0);
}
-// These static strings are immutable, except for rc, whose initial value is chosen to
+// These static strings are immutable, except for rc, whose initial value is chosen to
// reduce the possibility of it becoming zero due to ref/deref not being thread-safe.
static UChar sharedEmptyChar;
-UStringImpl* UStringImpl::s_null;
UStringImpl* UStringImpl::s_empty;
-UString* UString::nullUString;
+
+UString::Rep* UString::s_nullRep;
+UString* UString::s_nullUString;
void initializeUString()
{
- UStringImpl::s_null = new UStringImpl(0, 0, UStringImpl::ConstructStaticString);
UStringImpl::s_empty = new UStringImpl(&sharedEmptyChar, 0, UStringImpl::ConstructStaticString);
- UString::nullUString = new UString;
-}
-
-static PassRefPtr<UString::Rep> createRep(const char* c)
-{
- if (!c)
- return &UString::Rep::null();
-
- if (!c[0])
- return &UString::Rep::empty();
- size_t length = strlen(c);
- UChar* d;
- PassRefPtr<UStringImpl> result = UStringImpl::tryCreateUninitialized(length, d);
- if (!result)
- return &UString::Rep::null();
-
- for (size_t i = 0; i < length; i++)
- d[i] = static_cast<unsigned char>(c[i]); // use unsigned char to zero-extend instead of sign-extend
- return result;
-}
-
-static inline PassRefPtr<UString::Rep> createRep(const char* c, int length)
-{
- if (!c)
- return &UString::Rep::null();
-
- if (!length)
- return &UString::Rep::empty();
-
- UChar* d;
- PassRefPtr<UStringImpl> result = UStringImpl::tryCreateUninitialized(length, d);
- if (!result)
- return &UString::Rep::null();
-
- for (int i = 0; i < length; i++)
- d[i] = static_cast<unsigned char>(c[i]); // use unsigned char to zero-extend instead of sign-extend
- return result;
+ UString::s_nullRep = new UStringImpl(0, 0, UStringImpl::ConstructStaticString);
+ UString::s_nullUString = new UString;
}
UString::UString(const char* c)
- : m_rep(createRep(c))
+ : m_rep(Rep::create(c))
{
}
UString::UString(const char* c, int length)
- : m_rep(createRep(c, length))
+ : m_rep(Rep::create(c, length))
{
}
UString::UString(const UChar* c, int length)
{
- if (length == 0)
+ if (length == 0)
m_rep = &Rep::empty();
else
m_rep = Rep::create(c, length);
}
-UString UString::createFromUTF8(const char* string)
-{
- if (!string)
- return null();
-
- size_t length = strlen(string);
- Vector<UChar, 1024> buffer(length);
- UChar* p = buffer.data();
- if (conversionOK != convertUTF8ToUTF16(&string, string + length, &p, p + length))
- return null();
-
- return UString(buffer.data(), p - buffer.data());
-}
-
UString UString::from(int i)
{
UChar buf[1 + sizeof(i) * 3];
UChar* end = buf + sizeof(buf) / sizeof(UChar);
UChar* p = end;
-
+
if (i == 0)
*--p = '0';
else if (i == INT_MIN) {
@@ -296,7 +247,7 @@ UString UString::from(unsigned int u)
UChar buf[sizeof(u) * 3];
UChar* end = buf + sizeof(buf) / sizeof(UChar);
UChar* p = end;
-
+
if (u == 0)
*--p = '0';
else {
@@ -305,7 +256,7 @@ UString UString::from(unsigned int u)
u /= 10;
}
}
-
+
return UString(p, static_cast<int>(end - p));
}
@@ -346,71 +297,6 @@ UString UString::from(double d)
return UString(buffer, length);
}
-UString UString::spliceSubstringsWithSeparators(const Range* substringRanges, int rangeCount, const UString* separators, int separatorCount) const
-{
- m_rep->checkConsistency();
-
- if (rangeCount == 1 && separatorCount == 0) {
- int thisSize = size();
- int position = substringRanges[0].position;
- int length = substringRanges[0].length;
- if (position <= 0 && length >= thisSize)
- return *this;
- return UString::Rep::create(m_rep, max(0, position), min(thisSize, length));
- }
-
- int totalLength = 0;
- for (int i = 0; i < rangeCount; i++)
- totalLength += substringRanges[i].length;
- for (int i = 0; i < separatorCount; i++)
- totalLength += separators[i].size();
-
- if (totalLength == 0)
- return "";
-
- UChar* buffer;
- PassRefPtr<Rep> rep = Rep::tryCreateUninitialized(totalLength, buffer);
- if (!rep)
- return null();
-
- int maxCount = max(rangeCount, separatorCount);
- int bufferPos = 0;
- for (int i = 0; i < maxCount; i++) {
- if (i < rangeCount) {
- UStringImpl::copyChars(buffer + bufferPos, data() + substringRanges[i].position, substringRanges[i].length);
- bufferPos += substringRanges[i].length;
- }
- if (i < separatorCount) {
- UStringImpl::copyChars(buffer + bufferPos, separators[i].data(), separators[i].size());
- bufferPos += separators[i].size();
- }
- }
-
- return rep;
-}
-
-UString UString::replaceRange(int rangeStart, int rangeLength, const UString& replacement) const
-{
- m_rep->checkConsistency();
-
- int replacementLength = replacement.size();
- int totalLength = size() - rangeLength + replacementLength;
- if (totalLength == 0)
- return "";
-
- UChar* buffer;
- PassRefPtr<Rep> rep = Rep::tryCreateUninitialized(totalLength, buffer);
- if (!rep)
- return null();
-
- UStringImpl::copyChars(buffer, data(), rangeStart);
- UStringImpl::copyChars(buffer + rangeStart, replacement.data(), replacementLength);
- int rangeEnd = rangeStart + rangeLength;
- UStringImpl::copyChars(buffer + rangeStart + replacementLength, data() + rangeEnd, size() - rangeEnd);
-
- return rep;
-}
-
bool UString::getCString(CStringBuffer& buffer) const
{
int length = size();
@@ -456,30 +342,6 @@ char* UString::ascii() const
return asciiBuffer;
}
-UString& UString::operator=(const char* c)
-{
- if (!c) {
- m_rep = &Rep::null();
- return *this;
- }
-
- if (!c[0]) {
- m_rep = &Rep::empty();
- return *this;
- }
-
- int l = static_cast<int>(strlen(c));
- UChar* d = 0;
- m_rep = Rep::tryCreateUninitialized(l, d);
- if (m_rep) {
- for (int i = 0; i < l; i++)
- d[i] = static_cast<unsigned char>(c[i]); // use unsigned char to zero-extend instead of sign-extend
- } else
- makeNull();
-
- return *this;
-}
-
bool UString::is8Bit() const
{
const UChar* u = data();
@@ -721,7 +583,7 @@ int UString::find(UChar ch, int pos) const
if (*c == ch)
return static_cast<int>(c - data());
}
-
+
return -1;
}
@@ -888,16 +750,4 @@ CString UString::UTF8String(bool strict) const
return CString(buffer.data(), p - buffer.data());
}
-// For use in error handling code paths -- having this not be inlined helps avoid PIC branches to fetch the global on Mac OS X.
-NEVER_INLINE void UString::makeNull()
-{
- m_rep = &Rep::null();
-}
-
-// For use in error handling code paths -- having this not be inlined helps avoid PIC branches to fetch the global on Mac OS X.
-NEVER_INLINE UString::Rep* UString::nullRep()
-{
- return &Rep::null();
-}
-
} // namespace JSC
diff --git a/JavaScriptCore/runtime/UString.h b/JavaScriptCore/runtime/UString.h
index 0c13689..7d9ec49 100644
--- a/JavaScriptCore/runtime/UString.h
+++ b/JavaScriptCore/runtime/UString.h
@@ -81,7 +81,6 @@ namespace JSC {
typedef UStringImpl Rep;
public:
- // UString constructors passed char*s assume ISO Latin-1 encoding; for UTF8 use 'createFromUTF8', below.
UString();
UString(const char*); // Constructor for null-terminated string.
UString(const char*, int length);
@@ -109,34 +108,12 @@ namespace JSC {
return Rep::adopt(vector);
}
- static UString createFromUTF8(const char*);
-
static UString from(int);
static UString from(long long);
static UString from(unsigned int);
static UString from(long);
static UString from(double);
- struct Range {
- public:
- Range(int pos, int len)
- : position(pos)
- , length(len)
- {
- }
-
- Range()
- {
- }
-
- int position;
- int length;
- };
-
- UString spliceSubstringsWithSeparators(const Range* substringRanges, int rangeCount, const UString* separators, int separatorCount) const;
-
- UString replaceRange(int rangeStart, int RangeEnd, const UString& replacement) const;
-
bool getCString(CStringBuffer&) const;
// NOTE: This method should only be used for *debugging* purposes as it
@@ -153,11 +130,9 @@ namespace JSC {
*/
CString UTF8String(bool strict = false) const;
- UString& operator=(const char*c);
-
const UChar* data() const { return m_rep->data(); }
- bool isNull() const { return m_rep == &Rep::null(); }
+ bool isNull() const { return m_rep == s_nullRep; }
bool isEmpty() const { return !m_rep->size(); }
bool is8Bit() const;
@@ -183,10 +158,9 @@ namespace JSC {
UString substr(int pos = 0, int len = -1) const;
- static const UString& null() { return *nullUString; }
+ static const UString& null() { return *s_nullUString; }
Rep* rep() const { return m_rep.get(); }
- static Rep* nullRep();
UString(PassRefPtr<Rep> r)
: m_rep(r)
@@ -197,10 +171,10 @@ namespace JSC {
size_t cost() const { return m_rep->cost(); }
private:
- void makeNull();
-
RefPtr<Rep> m_rep;
- static UString* nullUString;
+
+ JS_EXPORTDATA static Rep* s_nullRep;
+ static UString* s_nullUString;
friend void initializeUString();
friend bool operator==(const UString&, const UString&);
@@ -255,7 +229,7 @@ namespace JSC {
int compare(const UString&, const UString&);
inline UString::UString()
- : m_rep(&Rep::null())
+ : m_rep(s_nullRep)
{
}
@@ -354,7 +328,7 @@ namespace JSC {
};
template<typename StringType1, typename StringType2>
- UString makeString(StringType1 string1, StringType2 string2)
+ PassRefPtr<UStringImpl> tryMakeString(StringType1 string1, StringType2 string2)
{
StringTypeAdapter<StringType1> adapter1(string1);
StringTypeAdapter<StringType2> adapter2(string2);
@@ -363,7 +337,7 @@ namespace JSC {
unsigned length = adapter1.length() + adapter2.length();
PassRefPtr<UStringImpl> resultImpl = UStringImpl::tryCreateUninitialized(length, buffer);
if (!resultImpl)
- return UString();
+ return 0;
UChar* result = buffer;
adapter1.writeTo(result);
@@ -374,7 +348,7 @@ namespace JSC {
}
template<typename StringType1, typename StringType2, typename StringType3>
- UString makeString(StringType1 string1, StringType2 string2, StringType3 string3)
+ PassRefPtr<UStringImpl> tryMakeString(StringType1 string1, StringType2 string2, StringType3 string3)
{
StringTypeAdapter<StringType1> adapter1(string1);
StringTypeAdapter<StringType2> adapter2(string2);
@@ -384,7 +358,7 @@ namespace JSC {
unsigned length = adapter1.length() + adapter2.length() + adapter3.length();
PassRefPtr<UStringImpl> resultImpl = UStringImpl::tryCreateUninitialized(length, buffer);
if (!resultImpl)
- return UString();
+ return 0;
UChar* result = buffer;
adapter1.writeTo(result);
@@ -397,7 +371,7 @@ namespace JSC {
}
template<typename StringType1, typename StringType2, typename StringType3, typename StringType4>
- UString makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4)
+ PassRefPtr<UStringImpl> tryMakeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4)
{
StringTypeAdapter<StringType1> adapter1(string1);
StringTypeAdapter<StringType2> adapter2(string2);
@@ -408,7 +382,7 @@ namespace JSC {
unsigned length = adapter1.length() + adapter2.length() + adapter3.length() + adapter4.length();
PassRefPtr<UStringImpl> resultImpl = UStringImpl::tryCreateUninitialized(length, buffer);
if (!resultImpl)
- return UString();
+ return 0;
UChar* result = buffer;
adapter1.writeTo(result);
@@ -423,7 +397,7 @@ namespace JSC {
}
template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5>
- UString makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5)
+ PassRefPtr<UStringImpl> tryMakeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5)
{
StringTypeAdapter<StringType1> adapter1(string1);
StringTypeAdapter<StringType2> adapter2(string2);
@@ -435,7 +409,7 @@ namespace JSC {
unsigned length = adapter1.length() + adapter2.length() + adapter3.length() + adapter4.length() + adapter5.length();
PassRefPtr<UStringImpl> resultImpl = UStringImpl::tryCreateUninitialized(length, buffer);
if (!resultImpl)
- return UString();
+ return 0;
UChar* result = buffer;
adapter1.writeTo(result);
@@ -452,7 +426,7 @@ namespace JSC {
}
template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6>
- UString makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6)
+ PassRefPtr<UStringImpl> tryMakeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6)
{
StringTypeAdapter<StringType1> adapter1(string1);
StringTypeAdapter<StringType2> adapter2(string2);
@@ -465,7 +439,7 @@ namespace JSC {
unsigned length = adapter1.length() + adapter2.length() + adapter3.length() + adapter4.length() + adapter5.length() + adapter6.length();
PassRefPtr<UStringImpl> resultImpl = UStringImpl::tryCreateUninitialized(length, buffer);
if (!resultImpl)
- return UString();
+ return 0;
UChar* result = buffer;
adapter1.writeTo(result);
@@ -484,7 +458,7 @@ namespace JSC {
}
template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6, typename StringType7>
- UString makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7)
+ PassRefPtr<UStringImpl> tryMakeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7)
{
StringTypeAdapter<StringType1> adapter1(string1);
StringTypeAdapter<StringType2> adapter2(string2);
@@ -498,7 +472,7 @@ namespace JSC {
unsigned length = adapter1.length() + adapter2.length() + adapter3.length() + adapter4.length() + adapter5.length() + adapter6.length() + adapter7.length();
PassRefPtr<UStringImpl> resultImpl = UStringImpl::tryCreateUninitialized(length, buffer);
if (!resultImpl)
- return UString();
+ return 0;
UChar* result = buffer;
adapter1.writeTo(result);
@@ -519,7 +493,7 @@ namespace JSC {
}
template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6, typename StringType7, typename StringType8>
- UString makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7, StringType8 string8)
+ PassRefPtr<UStringImpl> tryMakeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7, StringType8 string8)
{
StringTypeAdapter<StringType1> adapter1(string1);
StringTypeAdapter<StringType2> adapter2(string2);
@@ -534,7 +508,7 @@ namespace JSC {
unsigned length = adapter1.length() + adapter2.length() + adapter3.length() + adapter4.length() + adapter5.length() + adapter6.length() + adapter7.length() + adapter8.length();
PassRefPtr<UStringImpl> resultImpl = UStringImpl::tryCreateUninitialized(length, buffer);
if (!resultImpl)
- return UString();
+ return 0;
UChar* result = buffer;
adapter1.writeTo(result);
@@ -556,6 +530,69 @@ namespace JSC {
return resultImpl;
}
+ template<typename StringType1, typename StringType2>
+ UString makeString(StringType1 string1, StringType2 string2)
+ {
+ PassRefPtr<UStringImpl> resultImpl = tryMakeString(string1, string2);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl;
+ }
+
+ template<typename StringType1, typename StringType2, typename StringType3>
+ UString makeString(StringType1 string1, StringType2 string2, StringType3 string3)
+ {
+ PassRefPtr<UStringImpl> resultImpl = tryMakeString(string1, string2, string3);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl;
+ }
+
+ template<typename StringType1, typename StringType2, typename StringType3, typename StringType4>
+ UString makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4)
+ {
+ PassRefPtr<UStringImpl> resultImpl = tryMakeString(string1, string2, string3, string4);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl;
+ }
+
+ template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5>
+ UString makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5)
+ {
+ PassRefPtr<UStringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl;
+ }
+
+ template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6>
+ UString makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6)
+ {
+ PassRefPtr<UStringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl;
+ }
+
+ template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6, typename StringType7>
+ UString makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7)
+ {
+ PassRefPtr<UStringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6, string7);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl;
+ }
+
+ template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6, typename StringType7, typename StringType8>
+ UString makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7, StringType8 string8)
+ {
+ PassRefPtr<UStringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6, string7, string8);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl;
+ }
+
} // namespace JSC
namespace WTF {
diff --git a/JavaScriptCore/runtime/UStringImpl.cpp b/JavaScriptCore/runtime/UStringImpl.cpp
index 4b0d1c9..9882007 100644
--- a/JavaScriptCore/runtime/UStringImpl.cpp
+++ b/JavaScriptCore/runtime/UStringImpl.cpp
@@ -34,7 +34,44 @@ using namespace WTF::Unicode;
using namespace std;
namespace JSC {
-
+
+PassRefPtr<UStringImpl> UStringImpl::create(const char* c)
+{
+ ASSERT(c);
+
+ if (!c[0])
+ return &UStringImpl::empty();
+
+ size_t length = strlen(c);
+ UChar* d;
+ PassRefPtr<UStringImpl> result = UStringImpl::createUninitialized(length, d);
+ for (size_t i = 0; i < length; i++)
+ d[i] = static_cast<unsigned char>(c[i]); // use unsigned char to zero-extend instead of sign-extend
+ return result;
+}
+
+PassRefPtr<UStringImpl> UStringImpl::create(const char* c, int length)
+{
+ ASSERT(c);
+
+ if (!length)
+ return &UStringImpl::empty();
+
+ UChar* d;
+ PassRefPtr<UStringImpl> result = UStringImpl::createUninitialized(length, d);
+ for (int i = 0; i < length; i++)
+ d[i] = static_cast<unsigned char>(c[i]); // use unsigned char to zero-extend instead of sign-extend
+ return result;
+}
+
+PassRefPtr<UStringImpl> UStringImpl::create(const UChar* buffer, int length)
+{
+ UChar* newBuffer;
+ PassRefPtr<UStringImpl> impl = createUninitialized(length, newBuffer);
+ copyChars(newBuffer, buffer, length);
+ return impl;
+}
+
SharedUChar* UStringImpl::baseSharedBuffer()
{
ASSERT((bufferOwnership() == BufferShared)
diff --git a/JavaScriptCore/runtime/UStringImpl.h b/JavaScriptCore/runtime/UStringImpl.h
index abed637..bbea0aa 100644
--- a/JavaScriptCore/runtime/UStringImpl.h
+++ b/JavaScriptCore/runtime/UStringImpl.h
@@ -87,20 +87,16 @@ public:
template<size_t inlineCapacity>
static PassRefPtr<UStringImpl> adopt(Vector<UChar, inlineCapacity>& vector)
{
- if (unsigned length = vector.size())
+ if (unsigned length = vector.size()) {
+ ASSERT(vector.data());
return adoptRef(new UStringImpl(vector.releaseBuffer(), length, BufferOwned));
+ }
return &empty();
}
- static PassRefPtr<UStringImpl> create(const UChar* buffer, int length)
- {
- UChar* newBuffer;
- if (PassRefPtr<UStringImpl> impl = tryCreateUninitialized(length, newBuffer)) {
- copyChars(newBuffer, buffer, length);
- return impl;
- }
- return &null();
- }
+ static PassRefPtr<UStringImpl> create(const char* c);
+ static PassRefPtr<UStringImpl> create(const char* c, int length);
+ static PassRefPtr<UStringImpl> create(const UChar* buffer, int length);
static PassRefPtr<UStringImpl> create(PassRefPtr<UStringImpl> rep, int offset, int length)
{
@@ -180,7 +176,6 @@ public:
static unsigned computeHash(const char* s, int length) { ASSERT(length >= 0); return WTF::stringHash(s, length); }
static unsigned computeHash(const char* s) { return WTF::stringHash(s); }
- static UStringImpl& null() { return *s_null; }
static UStringImpl& empty() { return *s_empty; }
ALWAYS_INLINE void checkConsistency() const
@@ -288,7 +283,6 @@ private:
mutable unsigned m_isIdentifier : 1;
UntypedPtrAndBitfield m_dataBuffer;
- JS_EXPORTDATA static UStringImpl* s_null;
JS_EXPORTDATA static UStringImpl* s_empty;
friend class JIT;
diff --git a/JavaScriptCore/runtime/WeakGCPtr.h b/JavaScriptCore/runtime/WeakGCPtr.h
index 8653721..3ed4645 100644
--- a/JavaScriptCore/runtime/WeakGCPtr.h
+++ b/JavaScriptCore/runtime/WeakGCPtr.h
@@ -44,7 +44,11 @@ public:
return m_ptr;
}
- void clear() { m_ptr = 0; }
+ void clear(JSCell* ptr)
+ {
+ if (ptr == m_ptr)
+ m_ptr = 0;
+ }
T& operator*() const { return *get(); }
T* operator->() const { return get(); }
diff --git a/JavaScriptCore/wscript b/JavaScriptCore/wscript
index f5a041f..7caf8b4 100644
--- a/JavaScriptCore/wscript
+++ b/JavaScriptCore/wscript
@@ -72,6 +72,8 @@ def build(bld):
full_dirs = get_dirs_for_features(jscore_dir, features=[build_port], dirs=jscore_dirs)
includes = common_includes + full_dirs
+ if sys.platform.startswith('darwin'):
+ includes.append(os.path.join(jscore_dir, 'icu'))
# 1. A simple program
jscore = bld.new_task_gen(
diff --git a/JavaScriptCore/wtf/Complex.h b/JavaScriptCore/wtf/Complex.h
new file mode 100644
index 0000000..cfd1d20
--- /dev/null
+++ b/JavaScriptCore/wtf/Complex.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:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Complex_h
+#define Complex_h
+
+#include <complex>
+#include <wtf/MathExtras.h>
+
+namespace WebCore {
+
+typedef std::complex<double> Complex;
+
+inline Complex complexFromMagnitudePhase(double magnitude, double phase)
+{
+ return Complex(magnitude * cos(phase), magnitude * sin(phase));
+}
+
+} // namespace WebCore
+
+#endif // Complex_h
diff --git a/JavaScriptCore/wtf/FastMalloc.cpp b/JavaScriptCore/wtf/FastMalloc.cpp
index 7b14809..79d2bfb 100644
--- a/JavaScriptCore/wtf/FastMalloc.cpp
+++ b/JavaScriptCore/wtf/FastMalloc.cpp
@@ -239,8 +239,16 @@ void* fastMalloc(size_t n)
void* result = malloc(n);
#endif
- if (!result)
+ if (!result) {
+#if PLATFORM(BREWMP)
+ // The behavior of malloc(0) is implementation defined.
+ // To make sure that fastMalloc never returns 0, retry with fastMalloc(1).
+ if (!n)
+ return fastMalloc(1);
+#endif
CRASH();
+ }
+
return result;
}
@@ -279,8 +287,16 @@ void* fastCalloc(size_t n_elements, size_t element_size)
void* result = calloc(n_elements, element_size);
#endif
- if (!result)
+ if (!result) {
+#if PLATFORM(BREWMP)
+ // If either n_elements or element_size is 0, the behavior of calloc is implementation defined.
+ // To make sure that fastCalloc never returns 0, retry with fastCalloc(1, 1).
+ if (!n_elements || !element_size)
+ return fastCalloc(1, 1);
+#endif
CRASH();
+ }
+
return result;
}
diff --git a/JavaScriptCore/wtf/HashTable.h b/JavaScriptCore/wtf/HashTable.h
index f1473e3..ceb8963 100644
--- a/JavaScriptCore/wtf/HashTable.h
+++ b/JavaScriptCore/wtf/HashTable.h
@@ -24,6 +24,7 @@
#include "FastMalloc.h"
#include "HashTraits.h"
+#include "ValueCheck.h"
#include <wtf/Assertions.h>
#include <wtf/Threading.h>
@@ -1021,7 +1022,7 @@ namespace WTF {
ASSERT(entry == it.m_position);
++count;
- KeyTraits::checkValueConsistency(it->first);
+ ValueCheck<Key>::checkConsistency(it->first);
}
ASSERT(count == m_keyCount);
diff --git a/JavaScriptCore/wtf/HashTraits.h b/JavaScriptCore/wtf/HashTraits.h
index 96ecac9..c8d40f7 100644
--- a/JavaScriptCore/wtf/HashTraits.h
+++ b/JavaScriptCore/wtf/HashTraits.h
@@ -26,13 +26,6 @@
#include <utility>
#include <limits>
-// For malloc_size and _msize.
-#if OS(DARWIN)
-#include <malloc/malloc.h>
-#elif COMPILER(MSVC)
-#include <malloc.h>
-#endif
-
namespace WTF {
using std::pair;
@@ -58,7 +51,6 @@ namespace WTF {
template<typename T> struct GenericHashTraits : GenericHashTraitsBase<IsInteger<T>::value, T> {
typedef T TraitType;
static T emptyValue() { return T(); }
- static void checkValueConsistency(const T&) { }
};
template<typename T> struct HashTraits : GenericHashTraits<T> { };
@@ -87,19 +79,6 @@ namespace WTF {
static const bool needsDestruction = false;
static void constructDeletedValue(P*& slot) { slot = reinterpret_cast<P*>(-1); }
static bool isDeletedValue(P* value) { return value == reinterpret_cast<P*>(-1); }
-#if !ASSERT_DISABLED
- static void checkValueConsistency(const P* p)
- {
-#if (defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC) || !defined(NDEBUG)
-#if OS(DARWIN)
- ASSERT(malloc_size(p));
-#elif COMPILER(MSVC)
- ASSERT(_msize(const_cast<P*>(p)));
-#endif
-#endif
- HashTraits<P>::checkValueConsistency(*p);
- }
-#endif
};
template<typename P> struct HashTraits<RefPtr<P> > : GenericHashTraits<RefPtr<P> > {
diff --git a/JavaScriptCore/wtf/MathExtras.h b/JavaScriptCore/wtf/MathExtras.h
index a18949e..8666724 100644
--- a/JavaScriptCore/wtf/MathExtras.h
+++ b/JavaScriptCore/wtf/MathExtras.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,8 +26,8 @@
#ifndef WTF_MathExtras_h
#define WTF_MathExtras_h
+#include <cmath>
#include <float.h>
-#include <math.h>
#include <stdlib.h>
#if OS(SOLARIS)
@@ -186,4 +186,11 @@ inline float deg2turn(float d) { return d / 360.0f; }
inline float rad2grad(float r) { return r * 200.0f / piFloat; }
inline float grad2rad(float g) { return g * piFloat / 200.0f; }
+#if !COMPILER(MSVC) && !COMPILER(RVCT) && !OS(ANDROID) && !COMPILER(WINSCW)
+using std::isfinite;
+using std::isinf;
+using std::isnan;
+using std::signbit;
+#endif
+
#endif // #ifndef WTF_MathExtras_h
diff --git a/JavaScriptCore/wtf/PassRefPtr.h b/JavaScriptCore/wtf/PassRefPtr.h
index 36ba78e..9c6e44f 100644
--- a/JavaScriptCore/wtf/PassRefPtr.h
+++ b/JavaScriptCore/wtf/PassRefPtr.h
@@ -28,10 +28,21 @@ namespace WTF {
template<typename T> class RefPtr;
template<typename T> class PassRefPtr;
template <typename T> PassRefPtr<T> adoptRef(T*);
-
- // Remove inline for winscw compiler to prevent the compiler agressively resolving
- // T::deref(), which will fail compiling when PassRefPtr<T> is used as class member
- // or function arguments before T is defined.
+
+
+ // Remove inline for WINSCW compiler to prevent the compiler agressively resolving
+ // T::ref() and T::deref(), which will fail compiling when PassRefPtr<T> is used as
+ // a class member or function arguments before T is defined.
+ template<typename T>
+#if !COMPILER(WINSCW)
+ inline
+#endif
+ void refIfNotNull(T* ptr)
+ {
+ if (UNLIKELY(ptr != 0))
+ ptr->ref();
+ }
+
template<typename T>
#if !COMPILER(WINSCW)
inline
@@ -45,7 +56,7 @@ namespace WTF {
template<typename T> class PassRefPtr {
public:
PassRefPtr() : m_ptr(0) {}
- PassRefPtr(T* ptr) : m_ptr(ptr) { if (ptr) ptr->ref(); }
+ PassRefPtr(T* ptr) : m_ptr(ptr) { refIfNotNull(ptr); }
// It somewhat breaks the type system to allow transfer of ownership out of
// a const PassRefPtr. However, it makes it much easier to work with PassRefPtr
// temporaries, and we don't really have a need to use real const PassRefPtrs
@@ -53,14 +64,14 @@ namespace WTF {
PassRefPtr(const PassRefPtr& o) : m_ptr(o.releaseRef()) {}
template <typename U> PassRefPtr(const PassRefPtr<U>& o) : m_ptr(o.releaseRef()) { }
- ALWAYS_INLINE ~PassRefPtr() { derefIfNotNull<T>(m_ptr); }
+ ALWAYS_INLINE ~PassRefPtr() { derefIfNotNull(m_ptr); }
template <class U>
- PassRefPtr(const RefPtr<U>& o) : m_ptr(o.get()) { if (T* ptr = m_ptr) ptr->ref(); }
+ PassRefPtr(const RefPtr<U>& o) : m_ptr(o.get()) { T* ptr = m_ptr; refIfNotNull(ptr); }
T* get() const { return m_ptr; }
- void clear() { if (T* ptr = m_ptr) ptr->deref(); m_ptr = 0; }
+ void clear() { T* ptr = m_ptr; derefIfNotNull(ptr); m_ptr = 0; }
T* releaseRef() const { T* tmp = m_ptr; m_ptr = 0; return tmp; }
T& operator*() const { return *m_ptr; }
@@ -143,23 +154,19 @@ namespace WTF {
template <typename T> template <typename U> inline PassRefPtr<T>& PassRefPtr<T>::operator=(const RefPtr<U>& o)
{
T* optr = o.get();
- if (optr)
- optr->ref();
+ refIfNotNull(optr);
T* ptr = m_ptr;
m_ptr = optr;
- if (ptr)
- ptr->deref();
+ derefIfNotNull(ptr);
return *this;
}
template <typename T> inline PassRefPtr<T>& PassRefPtr<T>::operator=(T* optr)
{
- if (optr)
- optr->ref();
+ refIfNotNull(optr);
T* ptr = m_ptr;
m_ptr = optr;
- if (ptr)
- ptr->deref();
+ derefIfNotNull(ptr);
return *this;
}
@@ -167,8 +174,7 @@ namespace WTF {
{
T* ptr = m_ptr;
m_ptr = ref.releaseRef();
- if (ptr)
- ptr->deref();
+ derefIfNotNull(ptr);
return *this;
}
@@ -176,8 +182,7 @@ namespace WTF {
{
T* ptr = m_ptr;
m_ptr = ref.releaseRef();
- if (ptr)
- ptr->deref();
+ derefIfNotNull(ptr);
return *this;
}
diff --git a/JavaScriptCore/wtf/Platform.h b/JavaScriptCore/wtf/Platform.h
index d61d596..b113e79 100644
--- a/JavaScriptCore/wtf/Platform.h
+++ b/JavaScriptCore/wtf/Platform.h
@@ -422,6 +422,8 @@
#else
#define WTF_PLATFORM_BREWMP_SIMULATOR 0
#endif
+#undef WTF_OS_WINDOWS
+#undef WTF_PLATFORM_WIN
#elif OS(DARWIN)
#define WTF_PLATFORM_MAC 1
#elif OS(WINDOWS)
@@ -627,6 +629,10 @@
#define ENABLE_NETSCAPE_PLUGIN_API 0
#endif
+#if PLATFORM(BREWMP)
+#define USE_SYSTEM_MALLOC 1
+#endif
+
#if !defined(HAVE_ACCESSIBILITY)
#if PLATFORM(IPHONE) || PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(CHROMIUM)
#define HAVE_ACCESSIBILITY 1
@@ -889,6 +895,13 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */
#endif /* !defined(ENABLE_JIT) */
+/* CPU architecture specific optimizations */
+#if CPU(ARM_TRADITIONAL)
+#if ENABLE(JIT) && !defined(ENABLE_JIT_OPTIMIZE_MOD) && WTF_ARM_ARCH_AT_LEAST(5)
+#define ENABLE_JIT_OPTIMIZE_MOD 1
+#endif
+#endif
+
#if ENABLE(JIT)
#ifndef ENABLE_JIT_OPTIMIZE_CALL
#define ENABLE_JIT_OPTIMIZE_CALL 1
@@ -902,6 +915,9 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */
#ifndef ENABLE_JIT_OPTIMIZE_METHOD_CALLS
#define ENABLE_JIT_OPTIMIZE_METHOD_CALLS 1
#endif
+#ifndef ENABLE_JIT_OPTIMIZE_MOD
+#define ENABLE_JIT_OPTIMIZE_MOD 0
+#endif
#endif
#if CPU(X86) && COMPILER(MSVC)
diff --git a/JavaScriptCore/wtf/RefPtr.h b/JavaScriptCore/wtf/RefPtr.h
index e6d1047..84e841c 100644
--- a/JavaScriptCore/wtf/RefPtr.h
+++ b/JavaScriptCore/wtf/RefPtr.h
@@ -24,6 +24,7 @@
#include <algorithm>
#include "AlwaysInline.h"
#include "FastAllocBase.h"
+#include "PassRefPtr.h"
namespace WTF {
@@ -37,8 +38,8 @@ namespace WTF {
template <typename T> class RefPtr : public FastAllocBase {
public:
RefPtr() : m_ptr(0) { }
- RefPtr(T* ptr) : m_ptr(ptr) { if (ptr) ptr->ref(); }
- RefPtr(const RefPtr& o) : m_ptr(o.m_ptr) { if (T* ptr = m_ptr) ptr->ref(); }
+ RefPtr(T* ptr) : m_ptr(ptr) { refIfNotNull(ptr); }
+ RefPtr(const RefPtr& o) : m_ptr(o.m_ptr) { T* ptr = m_ptr; refIfNotNull(ptr); }
// see comment in PassRefPtr.h for why this takes const reference
template <typename U> RefPtr(const PassRefPtr<U>&);
template <typename U> RefPtr(const NonNullPassRefPtr<U>&);
@@ -50,13 +51,13 @@ namespace WTF {
RefPtr(HashTableDeletedValueType) : m_ptr(hashTableDeletedValue()) { }
bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); }
- ~RefPtr() { if (T* ptr = m_ptr) ptr->deref(); }
+ ~RefPtr() { derefIfNotNull(m_ptr); }
- template <typename U> RefPtr(const RefPtr<U>& o) : m_ptr(o.get()) { if (T* ptr = m_ptr) ptr->ref(); }
+ template <typename U> RefPtr(const RefPtr<U>& o) : m_ptr(o.get()) { T* ptr = m_ptr; refIfNotNull(ptr); }
T* get() const { return m_ptr; }
- void clear() { if (T* ptr = m_ptr) ptr->deref(); m_ptr = 0; }
+ void clear() { derefIfNotNull(m_ptr); m_ptr = 0; }
PassRefPtr<T> release() { PassRefPtr<T> tmp = adoptRef(m_ptr); m_ptr = 0; return tmp; }
T& operator*() const { return *m_ptr; }
@@ -65,12 +66,8 @@ namespace WTF {
bool operator!() const { return !m_ptr; }
// This conversion operator allows implicit conversion to bool but not to other integer types.
-#if COMPILER(WINSCW)
- operator bool() const { return m_ptr; }
-#else
- typedef T* RefPtr::*UnspecifiedBoolType;
+ typedef T* (RefPtr::*UnspecifiedBoolType);
operator UnspecifiedBoolType() const { return m_ptr ? &RefPtr::m_ptr : 0; }
-#endif
RefPtr& operator=(const RefPtr&);
RefPtr& operator=(T*);
@@ -101,35 +98,29 @@ namespace WTF {
template <typename T> inline RefPtr<T>& RefPtr<T>::operator=(const RefPtr<T>& o)
{
T* optr = o.get();
- if (optr)
- optr->ref();
+ refIfNotNull(optr);
T* ptr = m_ptr;
m_ptr = optr;
- if (ptr)
- ptr->deref();
+ derefIfNotNull(ptr);
return *this;
}
template <typename T> template <typename U> inline RefPtr<T>& RefPtr<T>::operator=(const RefPtr<U>& o)
{
T* optr = o.get();
- if (optr)
- optr->ref();
+ refIfNotNull(optr);
T* ptr = m_ptr;
m_ptr = optr;
- if (ptr)
- ptr->deref();
+ derefIfNotNull(ptr);
return *this;
}
template <typename T> inline RefPtr<T>& RefPtr<T>::operator=(T* optr)
{
- if (optr)
- optr->ref();
+ refIfNotNull(optr);
T* ptr = m_ptr;
m_ptr = optr;
- if (ptr)
- ptr->deref();
+ derefIfNotNull(ptr);
return *this;
}
@@ -137,8 +128,7 @@ namespace WTF {
{
T* ptr = m_ptr;
m_ptr = o.releaseRef();
- if (ptr)
- ptr->deref();
+ derefIfNotNull(ptr);
return *this;
}
@@ -146,8 +136,7 @@ namespace WTF {
{
T* ptr = m_ptr;
m_ptr = o.releaseRef();
- if (ptr)
- ptr->deref();
+ derefIfNotNull(ptr);
return *this;
}
@@ -155,8 +144,7 @@ namespace WTF {
{
T* ptr = m_ptr;
m_ptr = o.releaseRef();
- if (ptr)
- ptr->deref();
+ derefIfNotNull(ptr);
return *this;
}
@@ -164,8 +152,7 @@ namespace WTF {
{
T* ptr = m_ptr;
m_ptr = o.releaseRef();
- if (ptr)
- ptr->deref();
+ derefIfNotNull(ptr);
return *this;
}
diff --git a/WebKitTools/DrawTest/DrawTestInspectorController.m b/JavaScriptCore/wtf/ValueCheck.h
index 604bf03..cd321b8 100644
--- a/WebKitTools/DrawTest/DrawTestInspectorController.m
+++ b/JavaScriptCore/wtf/ValueCheck.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* 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
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -23,26 +23,42 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import "DrawTestInspectorController.h"
+#ifndef ValueCheck_h
+#define ValueCheck_h
-@implementation DrawTestInspectorController
+// For malloc_size and _msize.
+#if OS(DARWIN)
+#include <malloc/malloc.h>
+#elif COMPILER(MSVC)
+#include <malloc.h>
+#endif
-+ (id)sharedInstance
-{
- static DrawTestInspectorController *__sharedController = nil;
- if (!__sharedController) {
- __sharedController = [[self alloc] init];
- }
- return __sharedController;
-}
+namespace WTF {
+
+template<typename T> struct ValueCheck {
+ typedef T TraitType;
+ static void checkConsistency(const T&) { }
+};
-- (IBAction)showInspectorPanel:(id)sender
-{
- if (!_inspectorPanel) {
- [NSBundle loadNibNamed:@"Inspector" owner:self];
+#if !ASSERT_DISABLED
+template<typename P> struct ValueCheck<P*> {
+ typedef P* TraitType;
+ static void checkConsistency(const P* p)
+ {
+ if (!p)
+ return;
+#if (defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC) || !defined(NDEBUG)
+#if OS(DARWIN)
+ ASSERT(malloc_size(p));
+#elif COMPILER(MSVC)
+ ASSERT(_msize(const_cast<P*>(p)));
+#endif
+#endif
+ ValueCheck<P>::checkConsistency(*p);
}
- [_inspectorPanel makeKeyAndOrderFront:self];
-}
+};
+#endif
+}
-@end
+#endif // ValueCheck_h
diff --git a/JavaScriptCore/wtf/Vector.h b/JavaScriptCore/wtf/Vector.h
index decc9c9..81ea321 100644
--- a/JavaScriptCore/wtf/Vector.h
+++ b/JavaScriptCore/wtf/Vector.h
@@ -24,6 +24,7 @@
#include "FastAllocBase.h"
#include "Noncopyable.h"
#include "NotFound.h"
+#include "ValueCheck.h"
#include "VectorTraits.h"
#include <limits>
#include <utility>
@@ -586,6 +587,8 @@ namespace WTF {
m_buffer.swap(other.m_buffer);
}
+ void checkConsistency();
+
private:
void expandCapacity(size_t newMinCapacity);
const T* expandCapacity(size_t newMinCapacity, const T*);
@@ -987,6 +990,15 @@ namespace WTF {
}
template<typename T, size_t inlineCapacity>
+ inline void Vector<T, inlineCapacity>::checkConsistency()
+ {
+#if !ASSERT_DISABLED
+ for (size_t i = 0; i < size(); ++i)
+ ValueCheck<T>::checkConsistency(at(i));
+#endif
+ }
+
+ template<typename T, size_t inlineCapacity>
void deleteAllValues(const Vector<T, inlineCapacity>& collection)
{
typedef typename Vector<T, inlineCapacity>::const_iterator iterator;
@@ -1016,6 +1028,15 @@ namespace WTF {
return !(a == b);
}
+#if !ASSERT_DISABLED
+ template<typename T> struct ValueCheck<Vector<T> > {
+ typedef Vector<T> TraitType;
+ static void checkConsistency(const Vector<T>& v)
+ {
+ v.checkConsistency();
+ }
+ };
+#endif
} // namespace WTF
diff --git a/JavaScriptCore/wtf/Vector3.h b/JavaScriptCore/wtf/Vector3.h
new file mode 100644
index 0000000..3c40b61
--- /dev/null
+++ b/JavaScriptCore/wtf/Vector3.h
@@ -0,0 +1,138 @@
+/*
+ * 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Vector3_h
+#define Vector3_h
+
+#include <math.h>
+
+namespace WebCore {
+
+class Vector3 {
+public:
+ Vector3()
+ : m_x(0.0)
+ , m_y(0.0)
+ , m_z(0.0)
+ {
+ }
+
+ Vector3(double x, double y, double z)
+ : m_x(x)
+ , m_y(y)
+ , m_z(z)
+ {
+ }
+
+ Vector3(const float p[3])
+ : m_x(p[0])
+ , m_y(p[1])
+ , m_z(p[2])
+ {
+ }
+
+ Vector3(const double p[3])
+ : m_x(p[0])
+ , m_y(p[1])
+ , m_z(p[2])
+ {
+ }
+
+ double abs() const
+ {
+ return sqrt(m_x * m_x + m_y * m_y + m_z * m_z);
+ }
+
+ bool isZero() const
+ {
+ return !m_x && !m_y && !m_z;
+ }
+
+ void normalize()
+ {
+ double absValue = abs();
+ if (!absValue)
+ return;
+
+ double k = 1.0 / absValue;
+ m_x *= k;
+ m_y *= k;
+ m_z *= k;
+ }
+
+ double x() const { return m_x; }
+ double y() const { return m_y; }
+ double z() const { return m_z; }
+
+private:
+ double m_x;
+ double m_y;
+ double m_z;
+};
+
+inline Vector3 operator+(const Vector3& v1, const Vector3& v2)
+{
+ return Vector3(v1.x() + v2.x(), v1.y() + v2.y(), v1.z() + v2.z());
+}
+
+inline Vector3 operator-(const Vector3& v1, const Vector3& v2)
+{
+ return Vector3(v1.x() - v2.x(), v1.y() - v2.y(), v1.z() - v2.z());
+}
+
+inline Vector3 operator*(double k, const Vector3& v)
+{
+ return Vector3(k * v.x(), k * v.y(), k * v.z());
+}
+
+inline Vector3 operator*(const Vector3& v, double k)
+{
+ return Vector3(k * v.x(), k * v.y(), k * v.z());
+}
+
+inline double dot(const Vector3& v1, const Vector3& v2)
+{
+ return v1.x() * v2.x() + v1.y() * v2.y() + v1.z() * v2.z();
+}
+
+inline Vector3 cross(const Vector3& v1, const Vector3& v2)
+{
+ double x3 = v1.y() * v2.z() - v1.z() * v2.y();
+ double y3 = v1.z() * v2.x() - v1.x() * v2.z();
+ double z3 = v1.x() * v2.y() - v1.y() * v2.x();
+ return Vector3(x3, y3, z3);
+}
+
+inline double distance(const Vector3& v1, const Vector3& v2)
+{
+ return (v1 - v2).abs();
+}
+
+} // WebCore
+
+#endif // Vector3_h
diff --git a/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h b/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h
index cfd482d..9b1754a 100644
--- a/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h
+++ b/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h
@@ -56,7 +56,7 @@ namespace QUnicodeTables {
QT_END_NAMESPACE
// ugly hack to make UChar compatible with JSChar in API/JSStringRef.h
-#if defined(Q_OS_WIN) || COMPILER(WINSCW)
+#if defined(Q_OS_WIN) || COMPILER(WINSCW) || COMPILER(RVCT)
typedef wchar_t UChar;
#else
typedef uint16_t UChar;
diff --git a/JavaScriptGlue/ChangeLog b/JavaScriptGlue/ChangeLog
index dc4ede9..df8b3ec 100644
--- a/JavaScriptGlue/ChangeLog
+++ b/JavaScriptGlue/ChangeLog
@@ -1,3 +1,21 @@
+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
+
+ * ForwardingHeaders/wtf/ValueCheck.h: Added.
+
+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.
+
+ * JavaScriptGlue.xcodeproj/project.pbxproj: Accommodate rename of script.
+
2010-01-28 Oliver Hunt <oliver@apple.com>
Reviewed by Gavin Barraclough.
diff --git a/JavaScriptGlue/Configurations/Version.xcconfig b/JavaScriptGlue/Configurations/Version.xcconfig
index 75f9bd4..0e289b1 100644
--- a/JavaScriptGlue/Configurations/Version.xcconfig
+++ b/JavaScriptGlue/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/JavaScriptGlue/ForwardingHeaders/wtf/ValueCheck.h b/JavaScriptGlue/ForwardingHeaders/wtf/ValueCheck.h
new file mode 100644
index 0000000..904b15d
--- /dev/null
+++ b/JavaScriptGlue/ForwardingHeaders/wtf/ValueCheck.h
@@ -0,0 +1 @@
+#include <JavaScriptCore/ValueCheck.h>
diff --git a/JavaScriptGlue/JavaScriptGlue.xcodeproj/project.pbxproj b/JavaScriptGlue/JavaScriptGlue.xcodeproj/project.pbxproj
index 677cf6f..36bde4a 100644
--- a/JavaScriptGlue/JavaScriptGlue.xcodeproj/project.pbxproj
+++ b/JavaScriptGlue/JavaScriptGlue.xcodeproj/project.pbxproj
@@ -267,7 +267,7 @@
DD66F3C408F73ED700C75FD7 /* Sources */,
DD66F3CD08F73ED700C75FD7 /* Frameworks */,
939D055E09DA033400984996 /* Check For Global Initializers */,
- 5D0D53490E9862A70029E223 /* Check For Weak VTables */,
+ 5D0D53490E9862A70029E223 /* Check For Weak VTables and Externals */,
5DA0F0C00DC2B48900EA22B4 /* Remove Headers If Needed */,
);
buildRules = (
@@ -312,7 +312,7 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
- 5D0D53490E9862A70029E223 /* Check For Weak VTables */ = {
+ 5D0D53490E9862A70029E223 /* Check For Weak VTables and Externals */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
@@ -320,12 +320,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 [ -f ../WebKitTools/Scripts/check-for-weak-vtables ]; then\n ../WebKitTools/Scripts/check-for-weak-vtables || exit $?\nfi";
+ shellScript = "if [ -f ../WebKitTools/Scripts/check-for-weak-vtables-and-externals ]; then\n ../WebKitTools/Scripts/check-for-weak-vtables-and-externals || exit $?\nfi";
};
5D2F7D0A0C6878E000B5B72B /* Update Info.plist with version information */ = {
isa = PBXShellScriptBuildPhase;
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/WebKitTools/DrawTest/DrawTestView.m b/WebCore/bindings/js/ScriptDebugServer.cpp
index c865f99..9869775 100644
--- a/WebKitTools/DrawTest/DrawTestView.m
+++ b/WebCore/bindings/js/ScriptDebugServer.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
- * Copyright (C) 2006 Nefaur Khandker <nefaurk@gmail.com> All rights reserved.
+ * 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
@@ -21,23 +21,29 @@
* 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.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import <WebKit/WebFrame.h>
+#include "config.h"
-#import "DrawTestView.h"
+#if ENABLE(JAVASCRIPT_DEBUGGER)
-@implementation DrawTestView
+#include "ScriptDebugServer.h"
-- (void)setDocument:(NSURL *)documentURL
+#include "JavaScriptDebugServer.h"
+
+namespace WebCore {
+
+void ScriptDebugServer::recompileAllJSFunctions()
{
- [[self mainFrame] loadRequest:[NSURLRequest requestWithURL:documentURL]];
+ JavaScriptDebugServer::shared().recompileAllJSFunctions();
}
-- (BOOL)acceptsFirstResponder
+void ScriptDebugServer::recompileAllJSFunctionsSoon()
{
- return YES;
+ JavaScriptDebugServer::shared().recompileAllJSFunctionsSoon();
}
-@end
+} // namespace WebCore
+
+#endif // ENABLE(JAVASCRIPT_DEBUGGER)
diff --git a/WebKitTools/DrawTest/DrawTestToolbarController.h b/WebCore/bindings/js/ScriptDebugServer.h
index a69fb57..027ffa5 100644
--- a/WebKitTools/DrawTest/DrawTestToolbarController.h
+++ b/WebCore/bindings/js/ScriptDebugServer.h
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
+ * 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
@@ -20,18 +21,26 @@
* 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.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import <Cocoa/Cocoa.h>
+#ifndef ScriptDebugServer_h
+#define ScriptDebugServer_h
-@class WebView;
+#if ENABLE(JAVASCRIPT_DEBUGGER)
-@interface DrawTestToolbarController : NSObject {
- WebView *_drawView;
- NSMutableDictionary *_toolbarItems;
-}
+#include <wtf/Noncopyable.h>
-- (id)initWithDrawView:(WebView *)drawView;
+namespace WebCore {
-@end
+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/WebKitTools/DrawTest/ScalingImageView.h b/WebCore/page/brew/FrameBrew.cpp
index 4370ff5..a590544 100644
--- a/WebKitTools/DrawTest/ScalingImageView.h
+++ b/WebCore/page/brew/FrameBrew.cpp
@@ -1,6 +1,5 @@
/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
- *
+ * 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:
@@ -20,14 +19,20 @@
* 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.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import <Cocoa/Cocoa.h>
+#include "config.h"
+#include "Frame.h"
+#include "NotImplemented.h"
-@interface ScalingImageView : NSImageView {
+namespace WebCore {
+DragImageRef Frame::dragImageForSelection()
+{
+ notImplemented();
+ return 0;
}
-@end
+}
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/WebKitTools/DrawTest/ScalingImageView.m b/WebCore/platform/graphics/haiku/GlyphPageTreeNodeHaiku.cpp
index 605397a..3ae9aeb 100644
--- a/WebKitTools/DrawTest/ScalingImageView.m
+++ b/WebCore/platform/graphics/haiku/GlyphPageTreeNodeHaiku.cpp
@@ -1,5 +1,10 @@
/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
+ * 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
@@ -20,38 +25,44 @@
* 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.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
+#include "GlyphPageTreeNode.h"
-#import "ScalingImageView.h"
+#include "SimpleFontData.h"
+#include <wtf/Assertions.h>
+#include <wtf/unicode/Unicode.h>
-@implementation ScalingImageView
-/*
- This class offers two behaviors different from the standard NSImageView
- (and which were not available w/o subclassing)
- 1. Scale an image proportionally up to fit a larger view (NSImageView refuses)
- 2. Draw a background color w/o needing to show a bezel.
-*/
+namespace WebCore {
-- (void)drawRect:(NSRect)dirtyRect
+bool GlyphPage::fill(unsigned offset, unsigned length, UChar* characterBuffer, unsigned bufferLength, const SimpleFontData* fontData)
{
- [[NSColor whiteColor] set];
- NSRectFill(dirtyRect);
-
- NSSize imageSize = [[self image] size];
- float scale = 1.0f;
- if ([self imageScaling] == NSScaleProportionally && imageSize.width && imageSize.height) {
- float widthScale = [self bounds].size.width / imageSize.width;
- float heightScale = [self bounds].size.height / imageSize.height;
- scale = MIN(widthScale, heightScale);
+ 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);
+ }
}
- float scaledHeight = imageSize.height * scale;
- NSRect destRect = NSMakeRect(0,[self bounds].size.height - scaledHeight,imageSize.width * scale, scaledHeight);
- [[self image] drawInRect:destRect
- fromRect:NSMakeRect(0,0,imageSize.width, imageSize.height) operation:NSCompositeSourceOver fraction:1.0];
+ return haveGlyphs;
}
-@end
+} // 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);
}
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 1b7118f..134a252 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,22 @@
+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.
+
+ * WebKit.xcodeproj/project.pbxproj: Accommodate rename of script.
+
+2010-02-04 John Sullivan <sullivan@apple.com>
+
+ https://bugs.webkit.org/show_bug.cgi?id=34611
+ WebLocalizedString() could use an assertion that it is being called on the main thread
+
+ Reviewed by Tim Hatcher.
+
+ * WebKit.xcodeproj/project.pbxproj:
+ Updated for renamed file (WebLocalizableStrings.m -> WebLocalizableStrings.mm)
+
2010-01-29 Mark Rowe <mrowe@apple.com>
Sort Xcode projects.
diff --git a/WebKit/WebKit.xcodeproj/project.pbxproj b/WebKit/WebKit.xcodeproj/project.pbxproj
index f6f4a9e..dda5966 100644
--- a/WebKit/WebKit.xcodeproj/project.pbxproj
+++ b/WebKit/WebKit.xcodeproj/project.pbxproj
@@ -295,7 +295,6 @@
939811070824BF01008DF038 /* WebView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51A8B57A042834F700CA2D3A /* WebView.mm */; };
939811080824BF01008DF038 /* WebPolicyDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51443F9B0429392B00CA2D3A /* WebPolicyDelegate.mm */; };
9398110A0824BF01008DF038 /* WebDefaultUIDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 515E27D00458CA4B00CA2D3A /* WebDefaultUIDelegate.m */; };
- 9398110D0824BF01008DF038 /* WebLocalizableStrings.m in Sources */ = {isa = PBXBuildFile; fileRef = BEE18F9A0472B73200CA289C /* WebLocalizableStrings.m */; };
9398110E0824BF01008DF038 /* WebKitSystemBits.m in Sources */ = {isa = PBXBuildFile; fileRef = BEE52D4B0473032500CA289C /* WebKitSystemBits.m */; };
939811120824BF01008DF038 /* WebNSURLExtras.mm in Sources */ = {isa = PBXBuildFile; fileRef = BE6DC39A04C62C4E004D0EF6 /* WebNSURLExtras.mm */; };
939811130824BF01008DF038 /* WebHistory.mm in Sources */ = {isa = PBXBuildFile; fileRef = 65DA2608052CC18700A97B31 /* WebHistory.mm */; };
@@ -349,6 +348,7 @@
DD89682009AA87240097E7F0 /* WebElementDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = DD89681E09AA87240097E7F0 /* WebElementDictionary.h */; };
DD89682109AA87240097E7F0 /* WebElementDictionary.mm in Sources */ = {isa = PBXBuildFile; fileRef = DD89681F09AA87240097E7F0 /* WebElementDictionary.mm */; };
E15663190FB61C1F00C199CA /* WebDownload.mm in Sources */ = {isa = PBXBuildFile; fileRef = E15663180FB61C1F00C199CA /* WebDownload.mm */; };
+ ED5B9524111B725A00472298 /* WebLocalizableStrings.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED5B9523111B725A00472298 /* WebLocalizableStrings.mm */; };
ED6BE2E7088C32B50044DEDC /* WebNSAttributedStringExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = ED6BE2E5088C32B50044DEDC /* WebNSAttributedStringExtras.h */; };
ED6BE2E8088C32B50044DEDC /* WebNSAttributedStringExtras.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED6BE2E6088C32B50044DEDC /* WebNSAttributedStringExtras.mm */; };
ED7F6D8B0980683500C235ED /* WebNSDataExtrasPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = ED7F6D8A0980683500C235ED /* WebNSDataExtrasPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -633,7 +633,6 @@
BECD14290565830A005BB09C /* WebNSDataExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebNSDataExtras.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
BECD142A0565830A005BB09C /* WebNSDataExtras.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebNSDataExtras.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
BEE18F990472B73200CA289C /* WebLocalizableStrings.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebLocalizableStrings.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
- BEE18F9A0472B73200CA289C /* WebLocalizableStrings.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebLocalizableStrings.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
BEE52D4A0473032500CA289C /* WebKitSystemBits.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebKitSystemBits.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
BEE52D4B0473032500CA289C /* WebKitSystemBits.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebKitSystemBits.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
C0167BF60D7F5DD00028696E /* WebScriptDebugger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebScriptDebugger.h; sourceTree = "<group>"; };
@@ -650,6 +649,7 @@
ED2B2474033A2DA800C1A526 /* WebNSPasteboardExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebNSPasteboardExtras.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
ED2B2475033A2DA800C1A526 /* WebNSPasteboardExtras.mm */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebNSPasteboardExtras.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
ED3B48DE0CC51F7E00DFF1EB /* StringsNotToBeLocalized.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = StringsNotToBeLocalized.txt; sourceTree = SOURCE_ROOT; };
+ ED5B9523111B725A00472298 /* WebLocalizableStrings.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebLocalizableStrings.mm; sourceTree = "<group>"; };
ED6BE2E5088C32B50044DEDC /* WebNSAttributedStringExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebNSAttributedStringExtras.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
ED6BE2E6088C32B50044DEDC /* WebNSAttributedStringExtras.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebNSAttributedStringExtras.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
ED7F6D8A0980683500C235ED /* WebNSDataExtrasPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebNSDataExtrasPrivate.h; sourceTree = "<group>"; };
@@ -917,7 +917,7 @@
1C0D40850AC1C8F40009C113 /* WebKitVersionChecks.h */,
1C0D40860AC1C8F40009C113 /* WebKitVersionChecks.m */,
BEE18F990472B73200CA289C /* WebLocalizableStrings.h */,
- BEE18F9A0472B73200CA289C /* WebLocalizableStrings.m */,
+ ED5B9523111B725A00472298 /* WebLocalizableStrings.mm */,
EDE9837E0BCDF5FE00FDAE28 /* WebNSArrayExtras.h */,
EDE9837F0BCDF5FE00FDAE28 /* WebNSArrayExtras.m */,
ED6BE2E5088C32B50044DEDC /* WebNSAttributedStringExtras.h */,
@@ -1566,7 +1566,7 @@
939811270824BF01008DF038 /* Frameworks */,
939D054F09DA02D500984996 /* Check For Global Initializers */,
9337D6540EBFE54D00DA3CB5 /* Check For Exit Time Destructors */,
- 5D0D54210E98631D0029E223 /* Check For Weak VTables */,
+ 5D0D54210E98631D0029E223 /* Check For Weak VTables and Externals */,
5DE6D18C0FCF231B002DE28C /* Symlink WebKitPluginHost in to place */,
);
buildRules = (
@@ -1654,7 +1654,7 @@
shellPath = /bin/sh;
shellScript = "mkdir -p \"${TARGET_BUILD_DIR}/${PRIVATE_HEADERS_FOLDER_PATH}\"\nmkdir -p \"${TARGET_BUILD_DIR}/${PUBLIC_HEADERS_FOLDER_PATH}\"\nmkdir -p \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit\"\n\nif [ \"${ACTION}\" = \"build\" -o \"${ACTION}\" = \"install\" -o \"${ACTION}\" = \"installhdrs\" ]; then\n make -C mac -f \"MigrateHeaders.make\" -j `/usr/sbin/sysctl -n hw.availcpu`\nfi\n";
};
- 5D0D54210E98631D0029E223 /* Check For Weak VTables */ = {
+ 5D0D54210E98631D0029E223 /* Check For Weak VTables and Externals */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
@@ -1662,12 +1662,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";
};
5D2F7DB70C687A5A00B5B72B /* Update Info.plist with version information */ = {
isa = PBXShellScriptBuildPhase;
@@ -1824,7 +1824,6 @@
939810C50824BF01008DF038 /* WebKitStatistics.m in Sources */,
9398110E0824BF01008DF038 /* WebKitSystemBits.m in Sources */,
1C0D40880AC1C8F40009C113 /* WebKitVersionChecks.m in Sources */,
- 9398110D0824BF01008DF038 /* WebLocalizableStrings.m in Sources */,
5185F62810712B97007AA393 /* WebNavigationData.mm in Sources */,
0AB752380FA2E4DB00D7CBB1 /* WebNetscapeContainerCheckContextInfo.mm in Sources */,
0AEBFF640F9FA8BE000D486B /* WebNetscapeContainerCheckPrivate.mm in Sources */,
@@ -1889,6 +1888,7 @@
939810E80824BF01008DF038 /* WebViewFactory.mm in Sources */,
0FD3B0F91076C3F700039B96 /* WebWindowAnimation.m in Sources */,
41F4485010338E8C0030E55E /* WebWorkersPrivate.mm in Sources */,
+ ED5B9524111B725A00472298 /* WebLocalizableStrings.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 58c37a8..9cd3644 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,1274 @@
+2010-02-12 Jeremy Orlow <jorlow@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ [Chromium] Add a blockedByPolicy output to WebStorageArea::setItem.
+ https://bugs.webkit.org/show_bug.cgi?id=34897
+
+ * public/WebStorageArea.h:
+ (WebKit::WebStorageArea::setItem):
+ * src/WebStorageAreaImpl.cpp:
+ (WebKit::WebStorageAreaImpl::setItem):
+ * src/WebStorageAreaImpl.h:
+
+2010-02-11 Jeremy Orlow <jorlow@chromium.org>
+
+ Reviewed by David Levin.
+
+ [Chromium] Add ENABLE_RUBY to the feature defines gypi
+ https://bugs.webkit.org/show_bug.cgi?id=34841
+
+ * features.gypi:
+
+2010-02-12 Yury Semikhatsky <yurys@chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ Chromium: Web Inspector on an element in a page where JS is blocked crashes the renderer
+
+ https://bugs.webkit.org/show_bug.cgi?id=34890
+
+ * src/DebuggerAgentImpl.cpp:
+ (WebKit::DebuggerAgentImpl::createUtilityContext):
+
+2010-02-11 Mikhail Naganov <mnaganov@chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ [Chromium] Ignore subsequent requests of the same profiler log
+ chunks. This eliminates emission of several instances for the same
+ heap snapshot.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34833
+
+ * src/js/ProfilerAgent.js:
+ (devtools.ProfilerAgent):
+ (devtools.ProfilerAgent.prototype.initializeProfiling):
+ (devtools.ProfilerAgent.prototype._getNextLogLines):
+ (devtools.ProfilerAgent.prototype.startProfiling):
+ (devtools.ProfilerAgent.prototype._didGetActiveProfilerModules):
+ (devtools.ProfilerAgent.prototype._didGetLogLines):
+
+2010-02-10 James Hawkins <jhawkins@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ [Chromium] Remove code from SuggestionsPopup that was removed in a
+ previous revision of AutocompletePopup and accidentally added back in
+ the refactoring.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34818
+
+ * src/AutoFillPopupMenuClient.cpp:
+ * src/AutoFillPopupMenuClient.h: Added property svn:eol-style.
+ * src/SuggestionsPopupMenuClient.cpp:
+ (WebKit::SuggestionsPopupMenuClient::popupDidHide):
+ (WebKit::SuggestionsPopupMenuClient::setTextFromItem):
+ (WebKit::SuggestionsPopupMenuClient::initialize):
+ * src/SuggestionsPopupMenuClient.h:
+
+2010-02-10 Nate Chapin <japhet@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Update call to V8DOMWrapper::lookupDOMWrapper() to match new parameters.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34768
+
+ * src/DebuggerAgentImpl.cpp:
+ (WebKit::DebuggerAgentImpl::createUtilityContext):
+
+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.
+
+ * src/GraphicsContext3D.cpp:
+ (WebCore::GraphicsContext3DInternal::reshape):
+
+2010-02-10 Yury Semikhatsky <yurys@chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ Chromium Win build fix. Add third_party/nss to the dependencies list on Windows.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34789
+
+ * DEPS:
+
+2010-02-10 Yury Semikhatsky <yurys@chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ Rolling Chromium dependencies to match Chromium revision 38580.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34789
+
+ * DEPS:
+
+2010-02-10 Yury Semikhatsky <yurys@chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ Use v8::Debug::ProcessDebugMessages instead of executing an empty function
+
+ https://bugs.webkit.org/show_bug.cgi?id=34704
+
+ * src/DebuggerAgent.h:
+ * src/DebuggerAgentImpl.cpp:
+ (WebKit::DebuggerAgentImpl::processDebugCommands):
+ * src/DebuggerAgentImpl.h:
+ * src/ToolsAgent.h:
+ * src/WebDevToolsAgentImpl.cpp:
+ * src/WebDevToolsAgentImpl.h:
+ * src/js/DebuggerAgent.js:
+ (devtools.DebuggerAgent.prototype.addBreakpoint):
+ * src/js/DevToolsHostStub.js:
+ (.RemoteDebuggerAgentStub.prototype.processDebugCommands):
+ * src/js/InjectDispatch.js:
+ (dispatch):
+ * src/js/ProfilerAgent.js:
+ (devtools.ProfilerAgent.prototype.startProfiling):
+ (devtools.ProfilerAgent.prototype.stopProfiling):
+ * src/js/Tests.js:
+
+2010-02-10 Tony Chang <tony@chromium.org>
+
+ Unreviewed, build fix for Chromium Mac take 2.
+
+ * src/AutoFillPopupMenuClient.cpp:
+ (WebKit::AutoFillPopupMenuClient::removeSuggestionAtIndex):
+
+2010-02-10 Tony Chang <tony@chromium.org>
+
+ Unreviewed, build fix for Chromium Mac.
+
+ * src/AutoFillPopupMenuClient.cpp:
+ (WebKit::AutoFillPopupMenuClient::removeSuggestionAtIndex):
+
+2010-02-09 James Hawkins <jhawkins@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ [Chromium] Refactor AutocompletePopupMenuClient into a base class,
+ SuggestionsPopupMenuClient, and two derived classes,
+ AutocompletePopupMenuClient and AutoFillPopupMenuClient. Currently
+ the behavior of suggestions popups has not changed.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34721
+
+ * WebKit.gyp:
+ * public/WebView.h:
+ * src/AutoFillPopupMenuClient.cpp: Added.
+ * src/AutoFillPopupMenuClient.h: Added.
+ * src/AutocompletePopupMenuClient.cpp:
+ (WebKit::AutocompletePopupMenuClient::getSuggestionsCount):
+ (WebKit::AutocompletePopupMenuClient::getSuggestion):
+ (WebKit::AutocompletePopupMenuClient::removeSuggestionAtIndex):
+ (WebKit::AutocompletePopupMenuClient::initialize):
+ (WebKit::AutocompletePopupMenuClient::setSuggestions):
+ * src/AutocompletePopupMenuClient.h:
+ * src/SuggestionsPopupMenuClient.cpp: Added.
+ * src/SuggestionsPopupMenuClient.h: Added.
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+ (WebKit::WebViewImpl::keyEvent):
+ (WebKit::WebViewImpl::autocompleteHandleKeyEvent):
+ (WebKit::WebViewImpl::applyAutofillSuggestions):
+ (WebKit::WebViewImpl::applyAutoFillSuggestions):
+ (WebKit::WebViewImpl::applyAutocompleteSuggestions):
+ * src/WebViewImpl.h:
+
+2010-02-09 Chris Guillory <ctguil@google.com>
+
+ Reviewed by Darin Fisher.
+
+ [Chromium] Add function for accessibility object state change notifications.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34464
+
+ * gyp_webkit:
+ * public/WebViewClient.h:
+ (WebKit::WebViewClient::didChangeAccessibilityObjectState):
+ * src/ChromeClientImpl.cpp:
+ (WebKit::ChromeClientImpl::didChangeAccessibilityObjectState):
+ * src/ChromeClientImpl.h:
+
+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
+
+ * features.gypi:
+
+2010-02-09 Jian Li <jianli@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ [chromium] Add the chromium interface to support Blob.slice.
+ https://bugs.webkit.org/show_bug.cgi?id=34652
+
+ * WebKit.gyp:
+ * public/WebFileInfo.h: Added.
+ * public/WebHTTPBody.h:
+ * src/WebHTTPBody.cpp:
+ (WebKit::WebHTTPBody::elementAt):
+ (WebKit::WebHTTPBody::appendFile):
+
+2010-02-09 Yury Semikhatsky <yurys@chromium.org>
+
+ Unreviewed. Follow-up fix.
+
+ Add missing devTools.css file.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34756
+
+ * src/js/devTools.css: Added.
+
+2010-02-09 Yury Semikhatsky <yurys@chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ Upstream DevTools Images and .css files.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34756
+
+ * WebKit.gypi:
+ * src/js/DevTools.css: Added.
+ * src/js/Images/segmentChromium.png: Added.
+ * src/js/Images/segmentHoverChromium.png: Added.
+ * src/js/Images/segmentHoverEndChromium.png: Added.
+ * src/js/Images/segmentSelectedChromium.png: Added.
+ * src/js/Images/segmentSelectedEndChromium.png: Added.
+ * src/js/Images/statusbarBackgroundChromium.png: Added.
+ * src/js/Images/statusbarBottomBackgroundChromium.png: Added.
+ * src/js/Images/statusbarButtonsChromium.png: Added.
+ * src/js/Images/statusbarMenuButtonChromium.png: Added.
+ * src/js/Images/statusbarMenuButtonSelectedChromium.png: Added.
+
+2010-02-09 Yury Semikhatsky <yurys@chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ Upstream JavaScript part of DevTools WebKit API implementation(now
+ with the added files).
+
+ https://bugs.webkit.org/show_bug.cgi?id=34744
+
+ * WebKit.gypi: Added.
+ * src/js/DebuggerAgent.js: Added.
+ (devtools.DebuggerAgent):
+ (devtools.DebuggerAgent.prototype.reset):
+ (devtools.DebuggerAgent.prototype.initUI):
+ (devtools.DebuggerAgent.prototype.resolveScriptSource.this.requestSeqToCallback_.cmd.getSequenceNumber):
+ (devtools.DebuggerAgent.prototype.resolveScriptSource):
+ (devtools.DebuggerAgent.prototype.pauseExecution):
+ (devtools.DebuggerAgent.prototype.addBreakpoint):
+ (devtools.DebuggerAgent.prototype.removeBreakpoint):
+ (devtools.DebuggerAgent.prototype.updateBreakpoint):
+ (devtools.DebuggerAgent.prototype.stepIntoStatement):
+ (devtools.DebuggerAgent.prototype.stepOutOfFunction):
+ (devtools.DebuggerAgent.prototype.stepOverStatement):
+ (devtools.DebuggerAgent.prototype.resumeExecution):
+ (devtools.DebuggerAgent.prototype.createExceptionMessage_):
+ (devtools.DebuggerAgent.prototype.showPendingExceptionMessage_):
+ (devtools.DebuggerAgent.prototype.clearExceptionMessage_):
+ (devtools.DebuggerAgent.prototype.pauseOnExceptions):
+ (devtools.DebuggerAgent.prototype.setPauseOnExceptions):
+ (devtools.DebuggerAgent.prototype.requestEvaluate):
+ (devtools.DebuggerAgent.prototype.resolveChildren):
+ (devtools.DebuggerAgent.prototype.resolveScope.this.requestSeqToCallback_.cmd.getSequenceNumber):
+ (devtools.DebuggerAgent.prototype.resolveScope):
+ (devtools.DebuggerAgent.prototype.resolveFrameVariables_.scopeResponseHandler):
+ (devtools.DebuggerAgent.prototype.resolveFrameVariables_):
+ (devtools.DebuggerAgent.prototype.resolveCompletionsOnFrame):
+ (devtools.DebuggerAgent.prototype.getScriptContextType):
+ (devtools.DebuggerAgent.prototype.requestClearBreakpoint_):
+ (devtools.DebuggerAgent.prototype.requestChangeBreakpoint_):
+ (devtools.DebuggerAgent.prototype.requestBacktrace_):
+ (devtools.DebuggerAgent.sendCommand_):
+ (devtools.DebuggerAgent.prototype.stepCommand_):
+ (devtools.DebuggerAgent.prototype.requestLookup_):
+ (devtools.DebuggerAgent.prototype.setContextId_.this.requestSeqToCallback_.cmd.getSequenceNumber):
+ (devtools.DebuggerAgent.prototype.setContextId_):
+ (devtools.DebuggerAgent.prototype.handleDebuggerOutput_):
+ (devtools.DebuggerAgent.prototype.handleBreakEvent_):
+ (devtools.DebuggerAgent.prototype.handleExceptionEvent_):
+ (devtools.DebuggerAgent.prototype.handleScriptsResponse_):
+ (devtools.DebuggerAgent.prototype.isScriptFromInspectedContext_):
+ (devtools.DebuggerAgent.prototype.handleSetBreakpointResponse_):
+ (devtools.DebuggerAgent.prototype.handleAfterCompileEvent_):
+ (devtools.DebuggerAgent.prototype.addScriptInfo_):
+ (devtools.DebuggerAgent.prototype.handleClearBreakpointResponse_):
+ (devtools.DebuggerAgent.prototype.handleBacktraceResponse_):
+ (devtools.DebuggerAgent.prototype.doHandleBacktraceResponse_):
+ (devtools.DebuggerAgent.prototype.evaluateInCallFrame):
+ (devtools.DebuggerAgent.prototype.invokeCallbackForResponse_):
+ (devtools.DebuggerAgent.prototype.formatCallFrame_):
+ (devtools.DebuggerAgent.formatObjectProperties_):
+ (devtools.DebuggerAgent.propertiesToProxies_):
+ (devtools.DebuggerAgent.formatObjectProxy_):
+ (devtools.DebuggerAgent.webkitToV8LineNumber_):
+ (devtools.DebuggerAgent.v8ToWwebkitLineNumber_):
+ (devtools.ScriptInfo):
+ (devtools.ScriptInfo.prototype.getLineOffset):
+ (devtools.ScriptInfo.prototype.getContextType):
+ (devtools.ScriptInfo.prototype.getUrl):
+ (devtools.ScriptInfo.prototype.isUnresolved):
+ (devtools.ScriptInfo.prototype.getBreakpointInfo):
+ (devtools.ScriptInfo.prototype.addBreakpointInfo):
+ (devtools.ScriptInfo.prototype.removeBreakpointInfo):
+ (devtools.BreakpointInfo):
+ (devtools.BreakpointInfo.prototype.getLine):
+ (devtools.BreakpointInfo.prototype.getV8Id):
+ (devtools.BreakpointInfo.prototype.setV8Id):
+ (devtools.BreakpointInfo.prototype.markAsRemoved):
+ (devtools.BreakpointInfo.prototype.isRemoved):
+ (devtools.CallFrame):
+ (devtools.CallFrame.prototype.evaluate_):
+ (devtools.DebugCommand):
+ (devtools.DebugCommand.prototype.getSequenceNumber):
+ (devtools.DebugCommand.prototype.toJSONProtocol):
+ (devtools.DebuggerMessage):
+ (devtools.DebuggerMessage.prototype.getType):
+ (devtools.DebuggerMessage.prototype.getEvent):
+ (devtools.DebuggerMessage.prototype.getCommand):
+ (devtools.DebuggerMessage.prototype.getRequestSeq):
+ (devtools.DebuggerMessage.prototype.isRunning):
+ (devtools.DebuggerMessage.prototype.isSuccess):
+ (devtools.DebuggerMessage.prototype.getMessage):
+ (devtools.DebuggerMessage.prototype.getBody):
+ (devtools.DebuggerMessage.prototype.lookup):
+ * src/js/DevTools.js: Added.
+ (devtools.dispatch):
+ (devtools.ToolsAgent):
+ (devtools.ToolsAgent.prototype.reset):
+ (devtools.ToolsAgent.prototype.evaluateJavaScript):
+ (devtools.ToolsAgent.prototype.getDebuggerAgent):
+ (devtools.ToolsAgent.prototype.getProfilerAgent):
+ (devtools.ToolsAgent.prototype.frameNavigate_):
+ (devtools.ToolsAgent.prototype.dispatchOnClient_):
+ (devtools.ToolsAgent.prototype.evaluate):
+ (WebInspector.setResourcesPanelEnabled):
+ (debugPrint):
+ (devtools):
+ (WebInspector.loaded):
+ ():
+ (WebInspector.ScriptView.prototype.setupSourceFrameIfNeeded):
+ (WebInspector.ScriptView.prototype.didResolveScriptSource_):
+ (WebInspector.UnresolvedPropertyValue):
+ (WebInspector.UIString):
+ (WebInspector.resourceTrackingWasEnabled):
+ (WebInspector.resourceTrackingWasDisabled):
+ (WebInspector.TestController.prototype.runAfterPendingDispatches):
+ (WebInspector.queuesAreEmpty):
+ (WebInspector.pausedScript):
+ * src/js/DevToolsHostStub.js: Added.
+ (.RemoteDebuggerAgentStub):
+ (.RemoteDebuggerAgentStub.prototype.getContextId):
+ (.RemoteProfilerAgentStub):
+ (.RemoteProfilerAgentStub.prototype.getActiveProfilerModules):
+ (.RemoteProfilerAgentStub.prototype.getLogLines):
+ (.RemoteToolsAgentStub):
+ (.RemoteToolsAgentStub.prototype.dispatchOnInjectedScript):
+ (.RemoteToolsAgentStub.prototype.dispatchOnInspectorController):
+ (.RemoteToolsAgentStub.prototype.executeVoidJavaScript):
+ (.ProfilerStubHelper):
+ (.ProfilerStubHelper.GetInstance):
+ (.ProfilerStubHelper.prototype.StopProfiling):
+ (.ProfilerStubHelper.prototype.StartProfiling):
+ (.ProfilerStubHelper.prototype.getActiveProfilerModules):
+ (.ProfilerStubHelper.prototype.getLogLines):
+ (.RemoteDebuggerCommandExecutorStub):
+ (.RemoteDebuggerCommandExecutorStub.prototype.DebuggerCommand):
+ (.RemoteDebuggerCommandExecutorStub.prototype.DebuggerPauseScript):
+ (.RemoteDebuggerCommandExecutorStub.prototype.sendResponse_):
+ (.DevToolsHostStub):
+ (.DevToolsHostStub.prototype.reset):
+ (.DevToolsHostStub.prototype.setting):
+ (.DevToolsHostStub.prototype.setSetting):
+ * src/js/HeapProfilerPanel.js: Added.
+ (WebInspector.ProfilesPanel.prototype.addSnapshot):
+ (WebInspector.HeapSnapshotView):
+ (WebInspector.HeapSnapshotView.prototype.get statusBarItems):
+ (WebInspector.HeapSnapshotView.prototype.get profile):
+ (WebInspector.HeapSnapshotView.prototype.set profile):
+ (WebInspector.HeapSnapshotView.prototype.show):
+ (WebInspector.HeapSnapshotView.prototype.hide):
+ (WebInspector.HeapSnapshotView.prototype.resize):
+ (WebInspector.HeapSnapshotView.prototype.refresh):
+ (WebInspector.HeapSnapshotView.prototype.refreshShowAsPercents):
+ (WebInspector.HeapSnapshotView.prototype._deleteSearchMatchedFlags):
+ (WebInspector.HeapSnapshotView.prototype.searchCanceled):
+ (WebInspector.HeapSnapshotView.prototype.performSearch):
+ (WebInspector.HeapSnapshotView.prototype.jumpToFirstSearchResult.WebInspector.CPUProfileView.prototype.jumpToFirstSearchResult.jumpToLastSearchResult.WebInspector.CPUProfileView.prototype.jumpToLastSearchResult.jumpToNextSearchResult.WebInspector.CPUProfileView.prototype.jumpToNextSearchResult.jumpToPreviousSearchResult.WebInspector.CPUProfileView.prototype.jumpToPreviousSearchResult.showingFirstSearchResult.WebInspector.CPUProfileView.prototype.showingFirstSearchResult.showingLastSearchResult.WebInspector.CPUProfileView.prototype.showingLastSearchResult._jumpToSearchResult.WebInspector.CPUProfileView.prototype._jumpToSearchResult.refreshVisibleData):
+ (WebInspector.HeapSnapshotView.prototype._changeBase):
+ (WebInspector.HeapSnapshotView.prototype._createSnapshotDataGridList):
+ (WebInspector.HeapSnapshotView.prototype._mouseDownInDataGrid):
+ (WebInspector.HeapSnapshotView.prototype.get _isShowingAsPercent):
+ (WebInspector.HeapSnapshotView.prototype._percentClicked):
+ (WebInspector.HeapSnapshotView.prototype._resetDataGridList):
+ (WebInspector.HeapSnapshotView.prototype._sortData):
+ (WebInspector.HeapSnapshotView.prototype._updateBaseOptions):
+ (WebInspector.HeapSnapshotView.prototype._updatePercentButton):
+ (WebInspector.HeapSnapshotView.prototype._updateSummaryGraph):
+ (WebInspector.HeapSnapshotView.SearchHelper.operations.LESS):
+ (WebInspector.HeapSnapshotView.SearchHelper.operations.LESS_OR_EQUAL):
+ (WebInspector.HeapSnapshotView.SearchHelper.operations.EQUAL):
+ (WebInspector.HeapSnapshotView.SearchHelper.operations.GREATER_OR_EQUAL):
+ (WebInspector.HeapSnapshotView.SearchHelper.operations.GREATER):
+ (WebInspector.HeapSnapshotView.SearchHelper.parseOperationAndNumber):
+ (WebInspector.HeapSummaryCalculator):
+ (WebInspector.HeapSummaryCalculator.prototype.computeSummaryValues):
+ (WebInspector.HeapSummaryCalculator.prototype.formatValue):
+ (WebInspector.HeapSummaryCalculator.prototype.get showAsPercent):
+ (WebInspector.HeapSummaryCalculator.prototype.set showAsPercent):
+ (WebInspector.HeapSummaryCountCalculator):
+ (WebInspector.HeapSummaryCountCalculator.prototype._highFromLow):
+ (WebInspector.HeapSummaryCountCalculator.prototype._valueToString):
+ (WebInspector.HeapSummarySizeCalculator):
+ (WebInspector.HeapSummarySizeCalculator.prototype._highFromLow):
+ (WebInspector.HeapSnapshotSidebarTreeElement):
+ (WebInspector.HeapSnapshotSidebarTreeElement.prototype.get mainTitle):
+ (WebInspector.HeapSnapshotSidebarTreeElement.prototype.set mainTitle):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.get _hasRetainers):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.get _parent):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype._populate.if):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype._populate):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.produceDiff):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.sort):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.signForDelta):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.showDeltaAsPercent):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.getTotalCount):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.getTotalSize):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.get countPercent):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.get sizePercent):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.get countDeltaPercent):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.get sizeDeltaPercent):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.get data):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.createCell):
+ (WebInspector.HeapSnapshotDataGridNode):
+ (WebInspector.HeapSnapshotDataGridList):
+ (WebInspector.HeapSnapshotDataGridList.prototype.appendChild):
+ (WebInspector.HeapSnapshotDataGridList.prototype.insertChild):
+ (WebInspector.HeapSnapshotDataGridList.prototype.removeChildren):
+ (WebInspector.HeapSnapshotDataGridList.prototype.populateChildren):
+ (WebInspector.HeapSnapshotDataGridList.propertyComparator.comparator):
+ (WebInspector.HeapSnapshotDataGridList.propertyComparator):
+ (WebInspector.HeapSnapshotDataGridRetainerNode):
+ (WebInspector.HeapSnapshotDataGridRetainerNode.prototype.get sizePercent):
+ (WebInspector.HeapSnapshotDataGridRetainerNode.prototype.get sizeDeltaPercent):
+ (WebInspector.HeapSnapshotDataGridRetainerNode.prototype._calculateRetainers):
+ (WebInspector.HeapSnapshotProfileType):
+ (WebInspector.HeapSnapshotProfileType.prototype.get buttonTooltip):
+ (WebInspector.HeapSnapshotProfileType.prototype.get buttonStyle):
+ (WebInspector.HeapSnapshotProfileType.prototype.buttonClicked):
+ (WebInspector.HeapSnapshotProfileType.prototype.get welcomeMessage):
+ (WebInspector.HeapSnapshotProfileType.prototype.createSidebarTreeElementForProfile):
+ (WebInspector.HeapSnapshotProfileType.prototype.createView):
+ ():
+ * src/js/InjectDispatch.js: Added.
+ (InspectorControllerDispatcher.dispatch):
+ (ApuAgentDispatcher.dispatchToApu):
+ (dispatch):
+ (devtools):
+ * src/js/InspectorControllerImpl.js: Added.
+ (devtools.InspectorBackendImpl):
+ (devtools.InspectorBackendImpl.prototype.toggleNodeSearch):
+ (devtools.InspectorBackendImpl.prototype.debuggerEnabled):
+ (devtools.InspectorBackendImpl.prototype.profilerEnabled):
+ (devtools.InspectorBackendImpl.prototype.addBreakpoint):
+ (devtools.InspectorBackendImpl.prototype.removeBreakpoint):
+ (devtools.InspectorBackendImpl.prototype.updateBreakpoint):
+ (devtools.InspectorBackendImpl.prototype.pauseInDebugger):
+ (devtools.InspectorBackendImpl.prototype.resumeDebugger):
+ (devtools.InspectorBackendImpl.prototype.stepIntoStatementInDebugger):
+ (devtools.InspectorBackendImpl.prototype.stepOutOfFunctionInDebugger):
+ (devtools.InspectorBackendImpl.prototype.stepOverStatementInDebugger):
+ (devtools.InspectorBackendImpl.prototype.setPauseOnExceptionsState):
+ (devtools.InspectorBackendImpl.prototype.pauseOnExceptionsState):
+ (devtools.InspectorBackendImpl.prototype.pauseOnExceptions):
+ (devtools.InspectorBackendImpl.prototype.setPauseOnExceptions):
+ (devtools.InspectorBackendImpl.prototype.startProfiling):
+ (devtools.InspectorBackendImpl.prototype.stopProfiling):
+ (devtools.InspectorBackendImpl.prototype.getProfileHeaders):
+ (devtools.InspectorBackendImpl.prototype.addFullProfile):
+ (devtools.InspectorBackendImpl.prototype.getProfile):
+ (devtools.InspectorBackendImpl.prototype.takeHeapSnapshot):
+ (devtools.InspectorBackendImpl.prototype.dispatchOnInjectedScript):
+ (devtools.InspectorBackendImpl.prototype.installInspectorControllerDelegate_):
+ (devtools.InspectorBackendImpl.prototype.callInspectorController_):
+ * src/js/ProfilerAgent.js: Added.
+ (devtools.ProfilerAgent):
+ (devtools.ProfilerAgent.prototype.setupProfilerProcessorCallbacks):
+ (devtools.ProfilerAgent.prototype.initializeProfiling):
+ (devtools.ProfilerAgent.prototype.startProfiling):
+ (devtools.ProfilerAgent.prototype.stopProfiling):
+ (devtools.ProfilerAgent.prototype.didGetActiveProfilerModules_):
+ (devtools.ProfilerAgent.prototype.didGetLogLines_):
+ * src/js/ProfilerProcessor.js: Added.
+ (devtools.profiler.WebKitViewBuilder):
+ (devtools.profiler.WebKitViewBuilder.prototype.createViewNode):
+ (devtools.profiler.WebKitViewNode):
+ (set get devtools.profiler.WebKitViewNode.prototype.initFuncInfo_):
+ (devtools.profiler.JsProfile):
+ (devtools.profiler.JsProfile.prototype.skipThisFunction):
+ (devtools.profiler.Processor):
+ (devtools.profiler.Processor.prototype.printError):
+ (devtools.profiler.Processor.prototype.skipDispatch):
+ (devtools.profiler.Processor.prototype.setCallbacks):
+ (devtools.profiler.Processor.prototype.setNewProfileCallback):
+ (devtools.profiler.Processor.prototype.processProfiler_.switch.break):
+ (devtools.profiler.Processor.prototype.processProfiler_):
+ (devtools.profiler.Processor.prototype.processCodeCreation_):
+ (devtools.profiler.Processor.prototype.processCodeMove_):
+ (devtools.profiler.Processor.prototype.processCodeDelete_):
+ (devtools.profiler.Processor.prototype.processFunctionCreation_):
+ (devtools.profiler.Processor.prototype.processFunctionMove_):
+ (devtools.profiler.Processor.prototype.processFunctionDelete_):
+ (devtools.profiler.Processor.prototype.processTick_):
+ (devtools.profiler.Processor.prototype.processTickV2_):
+ (devtools.profiler.Processor.prototype.processHeapSampleBegin_):
+ (devtools.profiler.Processor.prototype.processHeapSampleStats_):
+ (devtools.profiler.Processor.prototype.processHeapSampleItem_):
+ (devtools.profiler.Processor.prototype.processHeapJsConsItem_):
+ (devtools.profiler.Processor.prototype.processHeapJsRetItem_.mergeRetainers):
+ (devtools.profiler.Processor.prototype.processHeapJsRetItem_):
+ (devtools.profiler.Processor.prototype.processHeapSampleEnd_):
+ (devtools.profiler.Processor.prototype.createProfileForView):
+ * src/js/Tests.js: Added.
+ (.TestSuite):
+ (.TestSuite.prototype.fail):
+ (.TestSuite.prototype.assertEquals):
+ (.TestSuite.prototype.assertTrue):
+ (.TestSuite.prototype.assertContains):
+ (.TestSuite.prototype.takeControl):
+ (.TestSuite.prototype.releaseControl):
+ (.TestSuite.prototype.reportOk_):
+ (.TestSuite.prototype.reportFailure_):
+ (.TestSuite.prototype.runTest):
+ (.TestSuite.prototype.showPanel):
+ (.TestSuite.prototype.addSniffer.receiver.methodName):
+ (.TestSuite.prototype.addSniffer):
+ (.TestSuite.prototype.testHostIsPresent):
+ (.TestSuite.prototype.testElementsTreeRoot):
+ (.TestSuite.prototype.testMainResource):
+ (.TestSuite.prototype.testResourceContentLength.this.addSniffer.):
+ (.TestSuite.prototype.testResourceHeaders):
+ (.TestSuite.prototype.testCachedResourceMimeType.this.addSniffer.):
+ (.TestSuite.prototype.testCachedResourceMimeType):
+ (.TestSuite.prototype.testProfilerTab):
+ (.TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh.waitUntilScriptIsParsed):
+ (.TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh.checkScriptsPanel):
+ (.TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh):
+ (.TestSuite.prototype.testNoScriptDuplicatesOnPanelSwitch.switchToElementsTab):
+ (.TestSuite.prototype.testNoScriptDuplicatesOnPanelSwitch.switchToScriptsTab):
+ (.TestSuite.prototype.testNoScriptDuplicatesOnPanelSwitch.checkScriptsPanel):
+ (.TestSuite.prototype.testNoScriptDuplicatesOnPanelSwitch.checkNoDuplicates):
+ (.TestSuite.prototype.testPauseOnException):
+ (.TestSuite.prototype.testPauseWhenLoadingDevTools):
+ (.TestSuite.prototype.testPauseWhenScriptIsRunning.testScriptPauseAfterDelay):
+ (.TestSuite.prototype.testPauseWhenScriptIsRunning.testScriptPause):
+ (.TestSuite.prototype.testPauseWhenScriptIsRunning):
+ (.TestSuite.prototype.optionsToString_):
+ (.TestSuite.prototype.evaluateInConsole_):
+ (.TestSuite.prototype.waitForSetBreakpointResponse_):
+ (.TestSuite.prototype.testEvalOnCallFrame.setBreakpointCallback):
+ (.TestSuite.prototype.testEvalOnCallFrame.waitForBreakpointHit):
+ (.TestSuite.prototype.testCompletionOnPause):
+ (.TestSuite.prototype.testCompletionOnPause.testLocalsCompletion):
+ (.TestSuite.prototype.testCompletionOnPause.testThisCompletion):
+ (.TestSuite.prototype.testCompletionOnPause.testFieldCompletion):
+ (.TestSuite.prototype.testCompletionOnPause.checkCompletions):
+ (.TestSuite.prototype.testAutoContinueOnSyntaxError.checkScriptsList):
+ (.TestSuite.prototype.testAutoContinueOnSyntaxError.waitForExceptionEvent.test):
+ (.TestSuite.prototype.testAutoContinueOnSyntaxError.waitForExceptionEvent):
+ (.TestSuite.prototype._checkExecutionLine):
+ (.TestSuite.prototype._scriptsAreParsed):
+ (.TestSuite.prototype._waitForScriptPause):
+ (.TestSuite.prototype._checkSourceFrameWhenLoaded.checkExecLine):
+ (.TestSuite.prototype._checkSourceFrameWhenLoaded):
+ (.TestSuite.prototype._performSteps.doNextAction):
+ (.TestSuite.prototype._performSteps):
+ (.TestSuite.prototype._executeCodeWhenScriptsAreParsed.executeFunctionInInspectedPage):
+ (.TestSuite.prototype._waitUntilScriptsAreParsed.waitForAllScripts):
+ (.TestSuite.prototype._waitUntilScriptsAreParsed):
+ (.TestSuite.prototype._executeFunctionForStepTest):
+ (.TestSuite.prototype.testStepOver):
+ (.TestSuite.prototype.testStepOut):
+ (.TestSuite.prototype.testStepIn):
+ (.TestSuite.prototype._evaluateXpath):
+ (.TestSuite.prototype._findNode):
+ (.TestSuite.prototype._findText):
+ (.TestSuite.prototype._nodeIterator):
+ (.TestSuite.prototype._checkScopeSectionDiv):
+ (.TestSuite.prototype._expandScopeSections.updateListener):
+ (.TestSuite.prototype._expandScopeSections):
+ (.TestSuite.prototype.testExpandScope):
+ (.TestSuite.prototype.testExpandScope.examineScopes):
+ (.TestSuite.prototype._findChildProperty):
+ (.TestSuite.prototype._hookGetPropertiesCallback.accessor.getProperties):
+ (.TestSuite.prototype._hookGetPropertiesCallback.try):
+ (.TestSuite.prototype._hookGetPropertiesCallback):
+ (.TestSuite.prototype.testDebugIntrinsicProperties.expandLocalScope):
+ (.TestSuite.prototype.testDebugIntrinsicProperties):
+ (.TestSuite.prototype.testDebugIntrinsicProperties.expandAndCheckNextProperty):
+ (.TestSuite.prototype.testDebugIntrinsicProperties.checkProperty):
+ (.TestSuite.createKeyEvent):
+ (.TestSuite.prototype.testConsoleLog.assertNext):
+ (.TestSuite.prototype.testConsoleLog):
+ (.TestSuite.prototype.testEvalGlobal.initEval):
+ (.TestSuite.prototype.testEvalGlobal):
+ (.TestSuite.prototype.testShowStoragePanel.this.addSniffer.):
+ (.TestSuite.prototype.testShowStoragePanel.this.addSniffer):
+ (.uiTests.runAllTests):
+ (.uiTests.runTest):
+
+2010-02-09 Yury Semikhatsky <yurys@chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ Upstream JavaScript part of DevTools WebKit API implementation
+
+ https://bugs.webkit.org/show_bug.cgi?id=34744
+
+ * WebKit.gypi: Added.
+ * src/js/DebuggerAgent.js: Added.
+ (devtools.DebuggerAgent):
+ (devtools.DebuggerAgent.prototype.reset):
+ (devtools.DebuggerAgent.prototype.initUI):
+ (devtools.DebuggerAgent.prototype.resolveScriptSource.this.requestSeqToCallback_.cmd.getSequenceNumber):
+ (devtools.DebuggerAgent.prototype.resolveScriptSource):
+ (devtools.DebuggerAgent.prototype.pauseExecution):
+ (devtools.DebuggerAgent.prototype.addBreakpoint):
+ (devtools.DebuggerAgent.prototype.removeBreakpoint):
+ (devtools.DebuggerAgent.prototype.updateBreakpoint):
+ (devtools.DebuggerAgent.prototype.stepIntoStatement):
+ (devtools.DebuggerAgent.prototype.stepOutOfFunction):
+ (devtools.DebuggerAgent.prototype.stepOverStatement):
+ (devtools.DebuggerAgent.prototype.resumeExecution):
+ (devtools.DebuggerAgent.prototype.createExceptionMessage_):
+ (devtools.DebuggerAgent.prototype.showPendingExceptionMessage_):
+ (devtools.DebuggerAgent.prototype.clearExceptionMessage_):
+ (devtools.DebuggerAgent.prototype.pauseOnExceptions):
+ (devtools.DebuggerAgent.prototype.setPauseOnExceptions):
+ (devtools.DebuggerAgent.prototype.requestEvaluate):
+ (devtools.DebuggerAgent.prototype.resolveChildren):
+ (devtools.DebuggerAgent.prototype.resolveScope.this.requestSeqToCallback_.cmd.getSequenceNumber):
+ (devtools.DebuggerAgent.prototype.resolveScope):
+ (devtools.DebuggerAgent.prototype.resolveFrameVariables_.scopeResponseHandler):
+ (devtools.DebuggerAgent.prototype.resolveFrameVariables_):
+ (devtools.DebuggerAgent.prototype.resolveCompletionsOnFrame):
+ (devtools.DebuggerAgent.prototype.getScriptContextType):
+ (devtools.DebuggerAgent.prototype.requestClearBreakpoint_):
+ (devtools.DebuggerAgent.prototype.requestChangeBreakpoint_):
+ (devtools.DebuggerAgent.prototype.requestBacktrace_):
+ (devtools.DebuggerAgent.sendCommand_):
+ (devtools.DebuggerAgent.prototype.stepCommand_):
+ (devtools.DebuggerAgent.prototype.requestLookup_):
+ (devtools.DebuggerAgent.prototype.setContextId_.this.requestSeqToCallback_.cmd.getSequenceNumber):
+ (devtools.DebuggerAgent.prototype.setContextId_):
+ (devtools.DebuggerAgent.prototype.handleDebuggerOutput_):
+ (devtools.DebuggerAgent.prototype.handleBreakEvent_):
+ (devtools.DebuggerAgent.prototype.handleExceptionEvent_):
+ (devtools.DebuggerAgent.prototype.handleScriptsResponse_):
+ (devtools.DebuggerAgent.prototype.isScriptFromInspectedContext_):
+ (devtools.DebuggerAgent.prototype.handleSetBreakpointResponse_):
+ (devtools.DebuggerAgent.prototype.handleAfterCompileEvent_):
+ (devtools.DebuggerAgent.prototype.addScriptInfo_):
+ (devtools.DebuggerAgent.prototype.handleClearBreakpointResponse_):
+ (devtools.DebuggerAgent.prototype.handleBacktraceResponse_):
+ (devtools.DebuggerAgent.prototype.doHandleBacktraceResponse_):
+ (devtools.DebuggerAgent.prototype.evaluateInCallFrame):
+ (devtools.DebuggerAgent.prototype.invokeCallbackForResponse_):
+ (devtools.DebuggerAgent.prototype.formatCallFrame_):
+ (devtools.DebuggerAgent.formatObjectProperties_):
+ (devtools.DebuggerAgent.propertiesToProxies_):
+ (devtools.DebuggerAgent.formatObjectProxy_):
+ (devtools.DebuggerAgent.webkitToV8LineNumber_):
+ (devtools.DebuggerAgent.v8ToWwebkitLineNumber_):
+ (devtools.ScriptInfo):
+ (devtools.ScriptInfo.prototype.getLineOffset):
+ (devtools.ScriptInfo.prototype.getContextType):
+ (devtools.ScriptInfo.prototype.getUrl):
+ (devtools.ScriptInfo.prototype.isUnresolved):
+ (devtools.ScriptInfo.prototype.getBreakpointInfo):
+ (devtools.ScriptInfo.prototype.addBreakpointInfo):
+ (devtools.ScriptInfo.prototype.removeBreakpointInfo):
+ (devtools.BreakpointInfo):
+ (devtools.BreakpointInfo.prototype.getLine):
+ (devtools.BreakpointInfo.prototype.getV8Id):
+ (devtools.BreakpointInfo.prototype.setV8Id):
+ (devtools.BreakpointInfo.prototype.markAsRemoved):
+ (devtools.BreakpointInfo.prototype.isRemoved):
+ (devtools.CallFrame):
+ (devtools.CallFrame.prototype.evaluate_):
+ (devtools.DebugCommand):
+ (devtools.DebugCommand.prototype.getSequenceNumber):
+ (devtools.DebugCommand.prototype.toJSONProtocol):
+ (devtools.DebuggerMessage):
+ (devtools.DebuggerMessage.prototype.getType):
+ (devtools.DebuggerMessage.prototype.getEvent):
+ (devtools.DebuggerMessage.prototype.getCommand):
+ (devtools.DebuggerMessage.prototype.getRequestSeq):
+ (devtools.DebuggerMessage.prototype.isRunning):
+ (devtools.DebuggerMessage.prototype.isSuccess):
+ (devtools.DebuggerMessage.prototype.getMessage):
+ (devtools.DebuggerMessage.prototype.getBody):
+ (devtools.DebuggerMessage.prototype.lookup):
+ * src/js/DevTools.js: Added.
+ (devtools.dispatch):
+ (devtools.ToolsAgent):
+ (devtools.ToolsAgent.prototype.reset):
+ (devtools.ToolsAgent.prototype.evaluateJavaScript):
+ (devtools.ToolsAgent.prototype.getDebuggerAgent):
+ (devtools.ToolsAgent.prototype.getProfilerAgent):
+ (devtools.ToolsAgent.prototype.frameNavigate_):
+ (devtools.ToolsAgent.prototype.dispatchOnClient_):
+ (devtools.ToolsAgent.prototype.evaluate):
+ (WebInspector.setResourcesPanelEnabled):
+ (debugPrint):
+ (devtools):
+ (WebInspector.loaded):
+ ():
+ (WebInspector.ScriptView.prototype.setupSourceFrameIfNeeded):
+ (WebInspector.ScriptView.prototype.didResolveScriptSource_):
+ (WebInspector.UnresolvedPropertyValue):
+ (WebInspector.UIString):
+ (WebInspector.resourceTrackingWasEnabled):
+ (WebInspector.resourceTrackingWasDisabled):
+ (WebInspector.TestController.prototype.runAfterPendingDispatches):
+ (WebInspector.queuesAreEmpty):
+ (WebInspector.pausedScript):
+ * src/js/DevToolsHostStub.js: Added.
+ (.RemoteDebuggerAgentStub):
+ (.RemoteDebuggerAgentStub.prototype.getContextId):
+ (.RemoteProfilerAgentStub):
+ (.RemoteProfilerAgentStub.prototype.getActiveProfilerModules):
+ (.RemoteProfilerAgentStub.prototype.getLogLines):
+ (.RemoteToolsAgentStub):
+ (.RemoteToolsAgentStub.prototype.dispatchOnInjectedScript):
+ (.RemoteToolsAgentStub.prototype.dispatchOnInspectorController):
+ (.RemoteToolsAgentStub.prototype.executeVoidJavaScript):
+ (.ProfilerStubHelper):
+ (.ProfilerStubHelper.GetInstance):
+ (.ProfilerStubHelper.prototype.StopProfiling):
+ (.ProfilerStubHelper.prototype.StartProfiling):
+ (.ProfilerStubHelper.prototype.getActiveProfilerModules):
+ (.ProfilerStubHelper.prototype.getLogLines):
+ (.RemoteDebuggerCommandExecutorStub):
+ (.RemoteDebuggerCommandExecutorStub.prototype.DebuggerCommand):
+ (.RemoteDebuggerCommandExecutorStub.prototype.DebuggerPauseScript):
+ (.RemoteDebuggerCommandExecutorStub.prototype.sendResponse_):
+ (.DevToolsHostStub):
+ (.DevToolsHostStub.prototype.reset):
+ (.DevToolsHostStub.prototype.setting):
+ (.DevToolsHostStub.prototype.setSetting):
+ * src/js/HeapProfilerPanel.js: Added.
+ (WebInspector.ProfilesPanel.prototype.addSnapshot):
+ (WebInspector.HeapSnapshotView):
+ (WebInspector.HeapSnapshotView.prototype.get statusBarItems):
+ (WebInspector.HeapSnapshotView.prototype.get profile):
+ (WebInspector.HeapSnapshotView.prototype.set profile):
+ (WebInspector.HeapSnapshotView.prototype.show):
+ (WebInspector.HeapSnapshotView.prototype.hide):
+ (WebInspector.HeapSnapshotView.prototype.resize):
+ (WebInspector.HeapSnapshotView.prototype.refresh):
+ (WebInspector.HeapSnapshotView.prototype.refreshShowAsPercents):
+ (WebInspector.HeapSnapshotView.prototype._deleteSearchMatchedFlags):
+ (WebInspector.HeapSnapshotView.prototype.searchCanceled):
+ (WebInspector.HeapSnapshotView.prototype.performSearch):
+ (WebInspector.HeapSnapshotView.prototype.jumpToFirstSearchResult.WebInspector.CPUProfileView.prototype.jumpToFirstSearchResult.jumpToLastSearchResult.WebInspector.CPUProfileView.prototype.jumpToLastSearchResult.jumpToNextSearchResult.WebInspector.CPUProfileView.prototype.jumpToNextSearchResult.jumpToPreviousSearchResult.WebInspector.CPUProfileView.prototype.jumpToPreviousSearchResult.showingFirstSearchResult.WebInspector.CPUProfileView.prototype.showingFirstSearchResult.showingLastSearchResult.WebInspector.CPUProfileView.prototype.showingLastSearchResult._jumpToSearchResult.WebInspector.CPUProfileView.prototype._jumpToSearchResult.refreshVisibleData):
+ (WebInspector.HeapSnapshotView.prototype._changeBase):
+ (WebInspector.HeapSnapshotView.prototype._createSnapshotDataGridList):
+ (WebInspector.HeapSnapshotView.prototype._mouseDownInDataGrid):
+ (WebInspector.HeapSnapshotView.prototype.get _isShowingAsPercent):
+ (WebInspector.HeapSnapshotView.prototype._percentClicked):
+ (WebInspector.HeapSnapshotView.prototype._resetDataGridList):
+ (WebInspector.HeapSnapshotView.prototype._sortData):
+ (WebInspector.HeapSnapshotView.prototype._updateBaseOptions):
+ (WebInspector.HeapSnapshotView.prototype._updatePercentButton):
+ (WebInspector.HeapSnapshotView.prototype._updateSummaryGraph):
+ (WebInspector.HeapSnapshotView.SearchHelper.operations.LESS):
+ (WebInspector.HeapSnapshotView.SearchHelper.operations.LESS_OR_EQUAL):
+ (WebInspector.HeapSnapshotView.SearchHelper.operations.EQUAL):
+ (WebInspector.HeapSnapshotView.SearchHelper.operations.GREATER_OR_EQUAL):
+ (WebInspector.HeapSnapshotView.SearchHelper.operations.GREATER):
+ (WebInspector.HeapSnapshotView.SearchHelper.parseOperationAndNumber):
+ (WebInspector.HeapSummaryCalculator):
+ (WebInspector.HeapSummaryCalculator.prototype.computeSummaryValues):
+ (WebInspector.HeapSummaryCalculator.prototype.formatValue):
+ (WebInspector.HeapSummaryCalculator.prototype.get showAsPercent):
+ (WebInspector.HeapSummaryCalculator.prototype.set showAsPercent):
+ (WebInspector.HeapSummaryCountCalculator):
+ (WebInspector.HeapSummaryCountCalculator.prototype._highFromLow):
+ (WebInspector.HeapSummaryCountCalculator.prototype._valueToString):
+ (WebInspector.HeapSummarySizeCalculator):
+ (WebInspector.HeapSummarySizeCalculator.prototype._highFromLow):
+ (WebInspector.HeapSnapshotSidebarTreeElement):
+ (WebInspector.HeapSnapshotSidebarTreeElement.prototype.get mainTitle):
+ (WebInspector.HeapSnapshotSidebarTreeElement.prototype.set mainTitle):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.get _hasRetainers):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.get _parent):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype._populate.if):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype._populate):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.produceDiff):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.sort):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.signForDelta):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.showDeltaAsPercent):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.getTotalCount):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.getTotalSize):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.get countPercent):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.get sizePercent):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.get countDeltaPercent):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.get sizeDeltaPercent):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.get data):
+ (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.createCell):
+ (WebInspector.HeapSnapshotDataGridNode):
+ (WebInspector.HeapSnapshotDataGridList):
+ (WebInspector.HeapSnapshotDataGridList.prototype.appendChild):
+ (WebInspector.HeapSnapshotDataGridList.prototype.insertChild):
+ (WebInspector.HeapSnapshotDataGridList.prototype.removeChildren):
+ (WebInspector.HeapSnapshotDataGridList.prototype.populateChildren):
+ (WebInspector.HeapSnapshotDataGridList.propertyComparator.comparator):
+ (WebInspector.HeapSnapshotDataGridList.propertyComparator):
+ (WebInspector.HeapSnapshotDataGridRetainerNode):
+ (WebInspector.HeapSnapshotDataGridRetainerNode.prototype.get sizePercent):
+ (WebInspector.HeapSnapshotDataGridRetainerNode.prototype.get sizeDeltaPercent):
+ (WebInspector.HeapSnapshotDataGridRetainerNode.prototype._calculateRetainers):
+ (WebInspector.HeapSnapshotProfileType):
+ (WebInspector.HeapSnapshotProfileType.prototype.get buttonTooltip):
+ (WebInspector.HeapSnapshotProfileType.prototype.get buttonStyle):
+ (WebInspector.HeapSnapshotProfileType.prototype.buttonClicked):
+ (WebInspector.HeapSnapshotProfileType.prototype.get welcomeMessage):
+ (WebInspector.HeapSnapshotProfileType.prototype.createSidebarTreeElementForProfile):
+ (WebInspector.HeapSnapshotProfileType.prototype.createView):
+ ():
+ * src/js/InjectDispatch.js: Added.
+ (InspectorControllerDispatcher.dispatch):
+ (ApuAgentDispatcher.dispatchToApu):
+ (dispatch):
+ (devtools):
+ * src/js/InspectorControllerImpl.js: Added.
+ (devtools.InspectorBackendImpl):
+ (devtools.InspectorBackendImpl.prototype.toggleNodeSearch):
+ (devtools.InspectorBackendImpl.prototype.debuggerEnabled):
+ (devtools.InspectorBackendImpl.prototype.profilerEnabled):
+ (devtools.InspectorBackendImpl.prototype.addBreakpoint):
+ (devtools.InspectorBackendImpl.prototype.removeBreakpoint):
+ (devtools.InspectorBackendImpl.prototype.updateBreakpoint):
+ (devtools.InspectorBackendImpl.prototype.pauseInDebugger):
+ (devtools.InspectorBackendImpl.prototype.resumeDebugger):
+ (devtools.InspectorBackendImpl.prototype.stepIntoStatementInDebugger):
+ (devtools.InspectorBackendImpl.prototype.stepOutOfFunctionInDebugger):
+ (devtools.InspectorBackendImpl.prototype.stepOverStatementInDebugger):
+ (devtools.InspectorBackendImpl.prototype.setPauseOnExceptionsState):
+ (devtools.InspectorBackendImpl.prototype.pauseOnExceptionsState):
+ (devtools.InspectorBackendImpl.prototype.pauseOnExceptions):
+ (devtools.InspectorBackendImpl.prototype.setPauseOnExceptions):
+ (devtools.InspectorBackendImpl.prototype.startProfiling):
+ (devtools.InspectorBackendImpl.prototype.stopProfiling):
+ (devtools.InspectorBackendImpl.prototype.getProfileHeaders):
+ (devtools.InspectorBackendImpl.prototype.addFullProfile):
+ (devtools.InspectorBackendImpl.prototype.getProfile):
+ (devtools.InspectorBackendImpl.prototype.takeHeapSnapshot):
+ (devtools.InspectorBackendImpl.prototype.dispatchOnInjectedScript):
+ (devtools.InspectorBackendImpl.prototype.installInspectorControllerDelegate_):
+ (devtools.InspectorBackendImpl.prototype.callInspectorController_):
+ * src/js/ProfilerAgent.js: Added.
+ (devtools.ProfilerAgent):
+ (devtools.ProfilerAgent.prototype.setupProfilerProcessorCallbacks):
+ (devtools.ProfilerAgent.prototype.initializeProfiling):
+ (devtools.ProfilerAgent.prototype.startProfiling):
+ (devtools.ProfilerAgent.prototype.stopProfiling):
+ (devtools.ProfilerAgent.prototype.didGetActiveProfilerModules_):
+ (devtools.ProfilerAgent.prototype.didGetLogLines_):
+ * src/js/ProfilerProcessor.js: Added.
+ (devtools.profiler.WebKitViewBuilder):
+ (devtools.profiler.WebKitViewBuilder.prototype.createViewNode):
+ (devtools.profiler.WebKitViewNode):
+ (set get devtools.profiler.WebKitViewNode.prototype.initFuncInfo_):
+ (devtools.profiler.JsProfile):
+ (devtools.profiler.JsProfile.prototype.skipThisFunction):
+ (devtools.profiler.Processor):
+ (devtools.profiler.Processor.prototype.printError):
+ (devtools.profiler.Processor.prototype.skipDispatch):
+ (devtools.profiler.Processor.prototype.setCallbacks):
+ (devtools.profiler.Processor.prototype.setNewProfileCallback):
+ (devtools.profiler.Processor.prototype.processProfiler_.switch.break):
+ (devtools.profiler.Processor.prototype.processProfiler_):
+ (devtools.profiler.Processor.prototype.processCodeCreation_):
+ (devtools.profiler.Processor.prototype.processCodeMove_):
+ (devtools.profiler.Processor.prototype.processCodeDelete_):
+ (devtools.profiler.Processor.prototype.processFunctionCreation_):
+ (devtools.profiler.Processor.prototype.processFunctionMove_):
+ (devtools.profiler.Processor.prototype.processFunctionDelete_):
+ (devtools.profiler.Processor.prototype.processTick_):
+ (devtools.profiler.Processor.prototype.processTickV2_):
+ (devtools.profiler.Processor.prototype.processHeapSampleBegin_):
+ (devtools.profiler.Processor.prototype.processHeapSampleStats_):
+ (devtools.profiler.Processor.prototype.processHeapSampleItem_):
+ (devtools.profiler.Processor.prototype.processHeapJsConsItem_):
+ (devtools.profiler.Processor.prototype.processHeapJsRetItem_.mergeRetainers):
+ (devtools.profiler.Processor.prototype.processHeapJsRetItem_):
+ (devtools.profiler.Processor.prototype.processHeapSampleEnd_):
+ (devtools.profiler.Processor.prototype.createProfileForView):
+ * src/js/Tests.js: Added.
+ (.TestSuite):
+ (.TestSuite.prototype.fail):
+ (.TestSuite.prototype.assertEquals):
+ (.TestSuite.prototype.assertTrue):
+ (.TestSuite.prototype.assertContains):
+ (.TestSuite.prototype.takeControl):
+ (.TestSuite.prototype.releaseControl):
+ (.TestSuite.prototype.reportOk_):
+ (.TestSuite.prototype.reportFailure_):
+ (.TestSuite.prototype.runTest):
+ (.TestSuite.prototype.showPanel):
+ (.TestSuite.prototype.addSniffer.receiver.methodName):
+ (.TestSuite.prototype.addSniffer):
+ (.TestSuite.prototype.testHostIsPresent):
+ (.TestSuite.prototype.testElementsTreeRoot):
+ (.TestSuite.prototype.testMainResource):
+ (.TestSuite.prototype.testResourceContentLength.this.addSniffer.):
+ (.TestSuite.prototype.testResourceHeaders):
+ (.TestSuite.prototype.testCachedResourceMimeType.this.addSniffer.):
+ (.TestSuite.prototype.testCachedResourceMimeType):
+ (.TestSuite.prototype.testProfilerTab):
+ (.TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh.waitUntilScriptIsParsed):
+ (.TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh.checkScriptsPanel):
+ (.TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh):
+ (.TestSuite.prototype.testNoScriptDuplicatesOnPanelSwitch.switchToElementsTab):
+ (.TestSuite.prototype.testNoScriptDuplicatesOnPanelSwitch.switchToScriptsTab):
+ (.TestSuite.prototype.testNoScriptDuplicatesOnPanelSwitch.checkScriptsPanel):
+ (.TestSuite.prototype.testNoScriptDuplicatesOnPanelSwitch.checkNoDuplicates):
+ (.TestSuite.prototype.testPauseOnException):
+ (.TestSuite.prototype.testPauseWhenLoadingDevTools):
+ (.TestSuite.prototype.testPauseWhenScriptIsRunning.testScriptPauseAfterDelay):
+ (.TestSuite.prototype.testPauseWhenScriptIsRunning.testScriptPause):
+ (.TestSuite.prototype.testPauseWhenScriptIsRunning):
+ (.TestSuite.prototype.optionsToString_):
+ (.TestSuite.prototype.evaluateInConsole_):
+ (.TestSuite.prototype.waitForSetBreakpointResponse_):
+ (.TestSuite.prototype.testEvalOnCallFrame.setBreakpointCallback):
+ (.TestSuite.prototype.testEvalOnCallFrame.waitForBreakpointHit):
+ (.TestSuite.prototype.testCompletionOnPause):
+ (.TestSuite.prototype.testCompletionOnPause.testLocalsCompletion):
+ (.TestSuite.prototype.testCompletionOnPause.testThisCompletion):
+ (.TestSuite.prototype.testCompletionOnPause.testFieldCompletion):
+ (.TestSuite.prototype.testCompletionOnPause.checkCompletions):
+ (.TestSuite.prototype.testAutoContinueOnSyntaxError.checkScriptsList):
+ (.TestSuite.prototype.testAutoContinueOnSyntaxError.waitForExceptionEvent.test):
+ (.TestSuite.prototype.testAutoContinueOnSyntaxError.waitForExceptionEvent):
+ (.TestSuite.prototype._checkExecutionLine):
+ (.TestSuite.prototype._scriptsAreParsed):
+ (.TestSuite.prototype._waitForScriptPause):
+ (.TestSuite.prototype._checkSourceFrameWhenLoaded.checkExecLine):
+ (.TestSuite.prototype._checkSourceFrameWhenLoaded):
+ (.TestSuite.prototype._performSteps.doNextAction):
+ (.TestSuite.prototype._performSteps):
+ (.TestSuite.prototype._executeCodeWhenScriptsAreParsed.executeFunctionInInspectedPage):
+ (.TestSuite.prototype._waitUntilScriptsAreParsed.waitForAllScripts):
+ (.TestSuite.prototype._waitUntilScriptsAreParsed):
+ (.TestSuite.prototype._executeFunctionForStepTest):
+ (.TestSuite.prototype.testStepOver):
+ (.TestSuite.prototype.testStepOut):
+ (.TestSuite.prototype.testStepIn):
+ (.TestSuite.prototype._evaluateXpath):
+ (.TestSuite.prototype._findNode):
+ (.TestSuite.prototype._findText):
+ (.TestSuite.prototype._nodeIterator):
+ (.TestSuite.prototype._checkScopeSectionDiv):
+ (.TestSuite.prototype._expandScopeSections.updateListener):
+ (.TestSuite.prototype._expandScopeSections):
+ (.TestSuite.prototype.testExpandScope):
+ (.TestSuite.prototype.testExpandScope.examineScopes):
+ (.TestSuite.prototype._findChildProperty):
+ (.TestSuite.prototype._hookGetPropertiesCallback.accessor.getProperties):
+ (.TestSuite.prototype._hookGetPropertiesCallback.try):
+ (.TestSuite.prototype._hookGetPropertiesCallback):
+ (.TestSuite.prototype.testDebugIntrinsicProperties.expandLocalScope):
+ (.TestSuite.prototype.testDebugIntrinsicProperties):
+ (.TestSuite.prototype.testDebugIntrinsicProperties.expandAndCheckNextProperty):
+ (.TestSuite.prototype.testDebugIntrinsicProperties.checkProperty):
+ (.TestSuite.createKeyEvent):
+ (.TestSuite.prototype.testConsoleLog.assertNext):
+ (.TestSuite.prototype.testConsoleLog):
+ (.TestSuite.prototype.testEvalGlobal.initEval):
+ (.TestSuite.prototype.testEvalGlobal):
+ (.TestSuite.prototype.testShowStoragePanel.this.addSniffer.):
+ (.TestSuite.prototype.testShowStoragePanel.this.addSniffer):
+ (.uiTests.runAllTests):
+ (.uiTests.runTest):
+
+2010-02-09 Avi Drissman <avi@chromium.org>
+
+ Reviewed by David Levin.
+
+ Chromium Mac: Control-A shouldn't select all/Control-C shouldn't copy
+ https://bugs.webkit.org/show_bug.cgi?id=34615
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::keyEventDefault):
+
+2010-02-08 Evan Martin <evan@chromium.org>
+
+ dlopen() knows how to search the library search path, so just rely on
+ it. While I'm at it, print out the dlerror() error message on failure.
+
+ [chromium] webgl shouldn't hard code library search path
+ https://bugs.webkit.org/show_bug.cgi?id=34659
+
+ * src/GraphicsContext3D.cpp:
+ (WebCore::GraphicsContext3DInternal::GLConnection::GLConnection):
+ (WebCore::GraphicsContext3DInternal::GLConnection::create):
+
+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
+ http://code.google.com/p/chromium/issues/detail?id=32615
+ http://code.google.com/p/chromium/issues/detail?id=17157
+
+ 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.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::dispatchBeforeUnloadEvent):
+
+2010-02-08 Pavel Feldman <pfeldman@chromium.org>
+
+ Reviewed by David Levin.
+
+ WebKit/chromium: Custom context menu does not work in inspector.
+ https://bugs.webkit.org/show_bug.cgi?id=34711
+
+ * src/WebDevToolsFrontendImpl.cpp:
+ (WebKit::WebDevToolsFrontendImpl::jsShowContextMenu):
+
+2010-02-08 Nate Chapin <japhet@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Check that the index passed into BackForwardListClientImpl::itemAtIndex()
+ is valid, and return null if it isn't.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34722
+
+ * src/BackForwardListClientImpl.cpp:
+ (WebKit::BackForwardListClientImpl::itemAtIndex):
+
+2010-02-05 Dumitru Daniliuc <dumi@chromium.org>
+
+ Reviewed by Jeremy Orlow.
+
+ Adding a way to close all database handles pointing to a certain
+ database as soon as possible.
+ https://bugs.webkit.org/show_bug.cgi?id=34619
+
+ * public/WebDatabase.h:
+ * src/WebDatabase.cpp:
+ (WebKit::WebDatabase::closeDatabaseImmediately):
+
+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
+
+ Use AffineTransform instead of TransformationMatrix here.
+
+ * tests/TransparencyWinTest.cpp:
+ (WebCore::TEST):
+
+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
+
+ * public/WebDragData.h:
+ * src/WebDragData.cpp:
+ (WebKit::WebDragData::downloadMetadata):
+ (WebKit::WebDragData::setDownloadMetadata):
+
+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.
+
+ * public/WebViewClient.h:
+ * src/ChromeClientImpl.cpp:
+ * src/ChromeClientImpl.h:
+
+2010-02-05 James Hawkins <jhawkins@chromium.org>
+
+ Reviewed by David Levin.
+
+ [Chromium] Rename autocomplete* to suggestions* to prepare for the
+ refactoring of AutocompletePopupMenuClient.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34664
+
+ * public/WebView.h:
+ * src/AutocompletePopupMenuClient.cpp:
+ (WebKit::AutocompletePopupMenuClient::popupDidHide):
+ * src/EditorClientImpl.cpp:
+ (WebKit::EditorClientImpl::textFieldDidEndEditing):
+ (WebKit::EditorClientImpl::doAutofill):
+ * src/WebViewImpl.cpp:
+ (WebKit::):
+ (WebKit::WebViewImpl::WebViewImpl):
+ (WebKit::WebViewImpl::mouseDown):
+ (WebKit::WebViewImpl::autocompleteHandleKeyEvent):
+ (WebKit::WebViewImpl::setFocus):
+ (WebKit::WebViewImpl::applyAutofillSuggestions):
+ (WebKit::WebViewImpl::hideAutofillPopup):
+ (WebKit::WebViewImpl::hideSuggestionsPopup):
+ (WebKit::WebViewImpl::refreshSuggestionsPopup):
+ * src/WebViewImpl.h:
+ (WebKit::WebViewImpl::suggestionsPopupDidHide):
+
+2010-02-05 James Hawkins <jhawkins@chromium.org>
+
+ Reviewed by David Levin.
+
+ [Chromium] Remove an unused forward declaration in WebKitClient.h.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34622
+
+ * public/WebKitClient.h:
+
+2010-02-05 James Hawkins <jhawkins@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Implement WebInputElement::isActivatedSubmit().
+
+ https://bugs.webkit.org/show_bug.cgi?id=34623
+
+ * public/WebInputElement.h:
+ * src/WebInputElement.cpp:
+ (WebKit::WebInputElement::isActivatedSubmit):
+
+2010-02-05 Nate Chapin <japhet@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Update code for getting a v8::FunctionTemplate.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34606
+
+ * src/WebDevToolsAgentImpl.cpp:
+ (WebKit::WebDevToolsAgentImpl::createInspectorBackendV8Wrapper):
+
+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
+
+ * features.gypi:
+
+2010-02-04 Yaar Schnitman <yaar@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Upstreaming gtests from chromium: UniscribeHelper and TransparencyWin
+ https://bugs.webkit.org/show_bug.cgi?id=34509
+
+ Resubmit: The previous commit (r54333) was rolled back.
+
+ * WebKit.gyp:
+ * tests/TransparencyWinTest.cpp: Added.
+ (WebCore::RECTToFloatRect):
+ (WebCore::drawNativeRect):
+ (WebCore::getPixelAt):
+ (WebCore::clearTopLayerAlphaChannel):
+ (WebCore::clearTopLayerAlphaPixel):
+ (WebCore::operator<<):
+ (WebCore::TEST):
+ * tests/UniscribeHelperTest.cpp: Added.
+ (WebCore::UniscribeTest::UniscribeTest):
+ (WebCore::UniscribeTest::MakeFont):
+ (WebCore::UniscribeTest::SetUp):
+ (WebCore::UniscribeTest::TearDown):
+ (TEST_F):
+
+2010-02-04 Drew Wilson <atwilson@chromium.org>
+
+ Reviewed by David Levin.
+
+ WorkerContext.close() does not work in the chromium port
+ https://bugs.webkit.org/show_bug.cgi?id=34551
+
+ Test: Adding new downstream test.
+
+ * src/WebWorkerBase.cpp:
+ (WebKit::WebWorkerBase::workerContextClosedTask):
+ Now shuts down the worker thread when WorkerContext::close() is invoked.
+
+2010-02-04 Chris Guillory <chris.guillory@google.com>
+
+ Reviewed by Darin Fisher.
+
+ [Chromium] Add function for AccessibilityObject state change notifications.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34464
+
+ * public/WebViewClient.h:
+ (WebKit::WebViewClient::didChangeAccessibilityObjectState):
+ * src/ChromeClientImpl.cpp:
+ (WebKit::ChromeClientImpl::didChangeAccessibilityObjectState):
+ * src/ChromeClientImpl.h:
+
+2010-02-04 Jeremy Moskovich <jeremy@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Update comments to better document the possible values of the
+ writing direction menu state variables.
+
+ * public/WebContextMenuData.h:
+
+2010-02-04 Nate Chapin <japhet@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Remove references to V8Custom.
+
+ https://bugs.webkit.org/show_bug.cgi?id=32638
+
+ * src/DebuggerAgentImpl.cpp:
+ * src/WebDevToolsFrontendImpl.cpp:
+
2010-02-04 Yury Semikhatsky <yurys@chromium.org>
Unreviewed. Revert 54333 which broke Chromium build.
diff --git a/WebKit/chromium/DEPS b/WebKit/chromium/DEPS
index fc90187..9c45b83 100644
--- a/WebKit/chromium/DEPS
+++ b/WebKit/chromium/DEPS
@@ -35,21 +35,22 @@ vars = {
'chromium_deps_svn': 'http://src.chromium.org/svn/trunk/deps/third_party',
# Dependencies' revisions to use:
- 'chromium_rev': '31834',
- 'google-url_rev': '120',
- 'gtest_rev': '336',
- 'gyp_rev': '751',
- 'icu_rev': '31724',
+ 'chromium_rev': '38580',
+ 'google-url_rev': '121',
+ 'gtest_rev': '359',
+ 'gyp_rev': '781',
+ 'icu_rev': '37341',
'openvcdiff_rev': '28',
- 'ots_rev': '19',
- 'skia_rev': '424',
- 'v8_rev': '3276',
+ 'ots_rev': '26',
+ 'skia_rev': '490',
+ 'v8_rev': '3781',
# Windows:
'cygwin_rev': '11984',
- 'ffmpeg_ia32_rev': '30374',
+ 'ffmpeg_ia32_rev': '34297',
'pthreads-win32_rev': '26716',
'python_24_rev': '22967',
+ 'nss_rev': '36871',
}
deps = {
@@ -142,6 +143,10 @@ deps_os = {
'third_party/pthreads-win32':
Var('chromium_deps_svn')+'/pthreads-win32@'+Var('pthreads-win32_rev'),
+
+ # base.gypi depends on nss on Windows
+ 'third_party/nss':
+ Var('chromium_deps_svn')+'/nss@'+Var('nss_rev'),
},
'unix': {
# Linux, actually.
diff --git a/WebKit/chromium/WebKit.gyp b/WebKit/chromium/WebKit.gyp
index 4f6d3f6..4b0ad2b 100644
--- a/WebKit/chromium/WebKit.gyp
+++ b/WebKit/chromium/WebKit.gyp
@@ -112,6 +112,7 @@
'public/WebEventListener.h',
'public/WebFileChooserCompletion.h',
'public/WebFileChooserParams.h',
+ 'public/WebFileInfo.h',
'public/WebFindOptions.h',
'public/WebFrame.h',
'public/WebFrameClient.h',
@@ -199,6 +200,8 @@
'src/AssertMatchingEnums.cpp',
'src/AutocompletePopupMenuClient.cpp',
'src/AutocompletePopupMenuClient.h',
+ 'src/AutoFillPopupMenuClient.cpp',
+ 'src/AutoFillPopupMenuClient.h',
'src/BackForwardListClientImpl.cpp',
'src/BackForwardListClientImpl.h',
'src/BoundObject.cpp',
@@ -257,6 +260,8 @@
'src/StorageEventDispatcherImpl.h',
'src/StorageNamespaceProxy.cpp',
'src/StorageNamespaceProxy.h',
+ 'src/SuggestionsPopupMenuClient.cpp',
+ 'src/SuggestionsPopupMenuClient.h',
'src/TemporaryGlue.h',
'src/ToolsAgent.h',
'src/WebAccessibilityCache.cpp',
@@ -453,6 +458,14 @@
'tests/KURLTest.cpp',
'tests/RunAllTests.cpp',
],
+ 'conditions': [
+ ['OS=="win"', {
+ 'sources': [
+ 'tests/TransparencyWinTest.cpp',
+ 'tests/UniscribeHelperTest.cpp',
+ ],
+ }],
+ ],
},
], # targets
}
diff --git a/WebKit/chromium/WebKit.gypi b/WebKit/chromium/WebKit.gypi
new file mode 100644
index 0000000..69b1479
--- /dev/null
+++ b/WebKit/chromium/WebKit.gypi
@@ -0,0 +1,67 @@
+#
+# 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.
+#
+
+{
+ 'variables': {
+ # List of DevTools source files, ordered by dependencies. It is used both
+ # for copying them to resource dir, and for generating 'devtools.html' file.
+ 'devtools_js_files': [
+ 'src/js/InspectorControllerImpl.js',
+ 'src/js/DebuggerAgent.js',
+ 'src/js/ProfilerAgent.js',
+ 'src/js/ProfilerProcessor.js',
+ 'src/js/HeapProfilerPanel.js',
+ 'src/js/DevTools.js',
+ 'src/js/DevToolsHostStub.js',
+ 'src/js/Tests.js',
+ ],
+ 'devtools_css_files': [
+ 'src/js/devTools.css',
+ ],
+ 'devtools_image_files': [
+ 'src/js/Images/segmentChromium.png',
+ 'src/js/Images/segmentHoverChromium.png',
+ 'src/js/Images/segmentHoverEndChromium.png',
+ 'src/js/Images/segmentSelectedChromium.png',
+ 'src/js/Images/segmentSelectedEndChromium.png',
+ 'src/js/Images/statusbarBackgroundChromium.png',
+ 'src/js/Images/statusbarBottomBackgroundChromium.png',
+ 'src/js/Images/statusbarButtonsChromium.png',
+ 'src/js/Images/statusbarMenuButtonChromium.png',
+ 'src/js/Images/statusbarMenuButtonSelectedChromium.png',
+ ],
+ },
+}
+
+# Local Variables:
+# tab-width:2
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=2 shiftwidth=2:
diff --git a/WebKit/chromium/features.gypi b/WebKit/chromium/features.gypi
index da2386b..6091b8f 100644
--- a/WebKit/chromium/features.gypi
+++ b/WebKit/chromium/features.gypi
@@ -47,13 +47,14 @@
'ENABLE_DASHBOARD_SUPPORT=0',
'ENABLE_DOM_STORAGE=1',
'ENABLE_GEOLOCATION=1',
- 'ENABLE_JAVASCRIPT_DEBUGGER=0',
+ 'ENABLE_JAVASCRIPT_DEBUGGER=1',
'ENABLE_JSC_MULTIPLE_THREADS=0',
'ENABLE_ICONDATABASE=0',
'ENABLE_INDEXED_DATABASE=1',
'ENABLE_NOTIFICATIONS=1',
'ENABLE_OPENTYPE_SANITIZER=1',
'ENABLE_ORIENTATION_EVENTS=0',
+ 'ENABLE_RUBY=1',
'ENABLE_XHTMLMP=0',
'ENABLE_XSLT=1',
'ENABLE_XPATH=1',
diff --git a/WebKit/chromium/public/WebContextMenuData.h b/WebKit/chromium/public/WebContextMenuData.h
index 049da9c..5d67046 100644
--- a/WebKit/chromium/public/WebContextMenuData.h
+++ b/WebKit/chromium/public/WebContextMenuData.h
@@ -103,7 +103,8 @@ struct WebContextMenuData {
CheckableMenuItemChecked = 0x2,
};
- // Writing direction menu items.
+ // Writing direction menu items - values are unions of
+ // CheckableMenuItemFlags.
// Currently only used on OS X.
int writingDirectionDefault;
int writingDirectionLeftToRight;
diff --git a/WebKit/chromium/public/WebDatabase.h b/WebKit/chromium/public/WebDatabase.h
index 179e828..108201d 100644
--- a/WebKit/chromium/public/WebDatabase.h
+++ b/WebKit/chromium/public/WebDatabase.h
@@ -72,6 +72,8 @@ public:
WEBKIT_API static void updateDatabaseSize(
const WebString& originIdentifier, const WebString& databaseName,
unsigned long long databaseSize, unsigned long long spaceAvailable);
+ WEBKIT_API static void closeDatabaseImmediately(
+ const WebString& originIdentifier, const WebString& databaseName);
#if WEBKIT_IMPLEMENTATION
WebDatabase(const WTF::PassRefPtr<WebCore::Database>&);
diff --git a/WebKit/chromium/public/WebDragData.h b/WebKit/chromium/public/WebDragData.h
index 01582a9..0b861c8 100644
--- a/WebKit/chromium/public/WebDragData.h
+++ b/WebKit/chromium/public/WebDragData.h
@@ -74,6 +74,8 @@ public:
WEBKIT_API WebURL downloadURL() const;
WEBKIT_API void setDownloadURL(const WebURL&);
+ WEBKIT_API WebString downloadMetadata() const;
+ WEBKIT_API void setDownloadMetadata(const WebString&);
WEBKIT_API WebString fileExtension() const;
WEBKIT_API void setFileExtension(const WebString&);
diff --git a/WebKit/chromium/public/WebFileInfo.h b/WebKit/chromium/public/WebFileInfo.h
new file mode 100644
index 0000000..4590a30
--- /dev/null
+++ b/WebKit/chromium/public/WebFileInfo.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 WebFileInfo_h
+#define WebFileInfo_h
+
+namespace WebKit {
+
+struct WebFileInfo {
+ // The last modification time of the file, in seconds.
+ // The value 0.0 means that the time is not set.
+ double modificationTime;
+
+ WebFileInfo() : modificationTime(0.0) { }
+};
+
+} // namespace WebKit
+
+#endif
diff --git a/WebKit/chromium/public/WebHTTPBody.h b/WebKit/chromium/public/WebHTTPBody.h
index 43f51a6..fcc44ff 100644
--- a/WebKit/chromium/public/WebHTTPBody.h
+++ b/WebKit/chromium/public/WebHTTPBody.h
@@ -32,6 +32,7 @@
#define WebHTTPBody_h
#include "WebData.h"
+#include "WebFileInfo.h"
#include "WebNonCopyable.h"
#include "WebString.h"
@@ -50,6 +51,9 @@ public:
enum { TypeData, TypeFile } type;
WebData data;
WebString filePath;
+ long long fileStart;
+ long long fileLength; // -1 means to the end of the file.
+ WebFileInfo fileInfo;
};
~WebHTTPBody() { reset(); }
@@ -77,7 +81,9 @@ public:
// Append to the list of elements.
WEBKIT_API void appendData(const WebData&);
- WEBKIT_API void appendFile(const WebString&);
+ WEBKIT_API void appendFile(const WebString&); // FIXME: to be removed.
+ // Passing -1 to fileLength means to the end of the file.
+ WEBKIT_API void appendFile(const WebString&, long long fileStart, long long fileLength, const WebFileInfo&);
// Identifies a particular form submission instance. A value of 0 is
// used to indicate an unspecified identifier.
diff --git a/WebKit/chromium/public/WebInputElement.h b/WebKit/chromium/public/WebInputElement.h
index 226624a..59643d1 100644
--- a/WebKit/chromium/public/WebInputElement.h
+++ b/WebKit/chromium/public/WebInputElement.h
@@ -81,11 +81,12 @@ namespace WebKit {
Time,
Week
};
-
+
WEBKIT_API bool autoComplete() const;
WEBKIT_API bool isEnabledFormControl() const;
WEBKIT_API InputType inputType() const;
WEBKIT_API WebString formControlType() const;
+ WEBKIT_API bool isActivatedSubmit() const;
WEBKIT_API void setActivatedSubmit(bool);
WEBKIT_API void setValue(const WebString& value);
WEBKIT_API WebString value() const;
@@ -97,7 +98,6 @@ namespace WebKit {
// storing autofill data. This is either the field name or its id, an empty
// string if it has no name and no id.
WEBKIT_API WebString nameForAutofill() const;
-
};
} // namespace WebKit
diff --git a/WebKit/chromium/public/WebKitClient.h b/WebKit/chromium/public/WebKitClient.h
index fe6c801..fbaa218 100644
--- a/WebKit/chromium/public/WebKitClient.h
+++ b/WebKit/chromium/public/WebKitClient.h
@@ -59,7 +59,6 @@ class WebStorageNamespace;
class WebThemeEngine;
class WebURLLoader;
struct WebCookie;
-struct WebPluginInfo;
template <typename T> class WebVector;
class WebKitClient {
diff --git a/WebKit/chromium/public/WebStorageArea.h b/WebKit/chromium/public/WebStorageArea.h
index 19d98c6..5e2c11c 100644
--- a/WebKit/chromium/public/WebStorageArea.h
+++ b/WebKit/chromium/public/WebStorageArea.h
@@ -45,6 +45,12 @@ class WebStorageArea {
public:
virtual ~WebStorageArea() { }
+ enum Result {
+ ResultOK = 0,
+ ResultBlockedByQuota,
+ ResultBlockedByPolicy
+ };
+
// The number of key/value pairs in the storage area.
virtual unsigned length() = 0;
@@ -57,10 +63,22 @@ public:
// no entry for that key.
virtual WebString getItem(const WebString& key) = 0;
- // Set the value that corresponds to a specific key. QuotaException is set if
- // the StorageArea would have exceeded its quota. The value is NOT set when there's
- // an exception. url is the url that should be used if a storage event fires.
- virtual void setItem(const WebString& key, const WebString& newValue, const WebURL& url, bool& quotaException, WebString& oldValue) = 0;
+ // Set the value that corresponds to a specific key. Result will either be ResultOK
+ // or some particular error. The value is NOT set when there's an error. url is the
+ // url that should be used if a storage event fires.
+ virtual void setItem(const WebString& key, const WebString& newValue, const WebURL& url, Result& result, WebString& oldValue)
+ {
+ bool quotaException = false;
+ setItem(key, newValue, url, quotaException, oldValue);
+ result = quotaException ? ResultBlockedByQuota : ResultOK;
+ }
+ // FIXME: Remove soon (once Chrome has rolled past this revision).
+ virtual void setItem(const WebString& key, const WebString& newValue, const WebURL& url, bool& quotaException, WebString& oldValue)
+ {
+ Result result;
+ setItem(key, newValue, url, result, oldValue);
+ quotaException = result != ResultOK;
+ }
// Remove the value associated with a particular key. url is the url that should be used
// if a storage event fires.
diff --git a/WebKit/chromium/public/WebView.h b/WebKit/chromium/public/WebView.h
index 7b3294f..99125d4 100644
--- a/WebKit/chromium/public/WebView.h
+++ b/WebKit/chromium/public/WebView.h
@@ -223,17 +223,35 @@ public:
virtual WebAccessibilityObject accessibilityObject() = 0;
- // Autofill ------------------------------------------------------------
+ // AutoFill / Autocomplete ---------------------------------------------
- // Notifies the WebView that autofill suggestions are available for a node.
+ // DEPRECATED: WebView::applyAutocompleteSuggestions is the new way to
+ // access this.
virtual void applyAutofillSuggestions(
const WebNode&,
const WebVector<WebString>& suggestions,
int defaultSuggestionIndex) = 0;
- // Hides the autofill popup if any are showing.
+ // Notifies the WebView that AutoFill suggestions are available for a node.
+ virtual void applyAutoFillSuggestions(
+ const WebNode&,
+ const WebVector<WebString>& names,
+ const WebVector<WebString>& labels,
+ int defaultSuggestionIndex) = 0;
+
+ // Notifies the WebView that Autocomplete suggestions are available for a
+ // node.
+ virtual void applyAutocompleteSuggestions(
+ const WebNode&,
+ const WebVector<WebString>& suggestions,
+ int defaultSuggestionIndex) = 0;
+
+ // DEPRECATED: WebView::hideSuggestionsPopup is the new way to access this.
virtual void hideAutofillPopup() = 0;
+ // Hides the suggestions popup if any are showing.
+ virtual void hideSuggestionsPopup() = 0;
+
// Context menu --------------------------------------------------------
diff --git a/WebKit/chromium/public/WebViewClient.h b/WebKit/chromium/public/WebViewClient.h
index 964d382..4d272bb 100644
--- a/WebKit/chromium/public/WebViewClient.h
+++ b/WebKit/chromium/public/WebViewClient.h
@@ -252,6 +252,9 @@ public:
// accessibility object.
virtual void focusAccessibilityObject(const WebAccessibilityObject&) { }
+ // Notifies embedder that the state of an accessibility object has changed.
+ virtual void didChangeAccessibilityObjectState(const WebAccessibilityObject&) { }
+
// Developer tools -----------------------------------------------------
diff --git a/WebKit/chromium/src/AutoFillPopupMenuClient.cpp b/WebKit/chromium/src/AutoFillPopupMenuClient.cpp
new file mode 100644
index 0000000..8e6cab4
--- /dev/null
+++ b/WebKit/chromium/src/AutoFillPopupMenuClient.cpp
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "AutoFillPopupMenuClient.h"
+
+#include "HTMLInputElement.h"
+#include "WebString.h"
+#include "WebVector.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+unsigned AutoFillPopupMenuClient::getSuggestionsCount() const
+{
+ return m_names.size();
+}
+
+WebString AutoFillPopupMenuClient::getSuggestion(unsigned listIndex) const
+{
+ // FIXME: Modify the PopupMenu to add the label in gray right-justified.
+ ASSERT(listIndex >= 0 && listIndex < m_names.size());
+ return m_names[listIndex] + String(" (") + m_labels[listIndex] + String(")");
+}
+
+void AutoFillPopupMenuClient::removeSuggestionAtIndex(unsigned listIndex)
+{
+ // FIXME: Do we want to remove AutoFill suggestions?
+ ASSERT(listIndex >= 0 && listIndex < m_names.size());
+ m_names.remove(listIndex);
+ m_labels.remove(listIndex);
+}
+
+void AutoFillPopupMenuClient::initialize(
+ HTMLInputElement* textField,
+ const WebVector<WebString>& names,
+ const WebVector<WebString>& labels,
+ int defaultSuggestionIndex)
+{
+ ASSERT(names.size() == labels.size());
+ ASSERT(defaultSuggestionIndex < static_cast<int>(names.size()));
+
+ // The suggestions must be set before initializing the
+ // SuggestionsPopupMenuClient.
+ setSuggestions(names, labels);
+
+ SuggestionsPopupMenuClient::initialize(textField, defaultSuggestionIndex);
+}
+
+void AutoFillPopupMenuClient::setSuggestions(const WebVector<WebString>& names,
+ const WebVector<WebString>& labels)
+{
+ ASSERT(names.size() == labels.size());
+
+ m_names.clear();
+ m_labels.clear();
+ for (size_t i = 0; i < names.size(); ++i) {
+ m_names.append(names[i]);
+ m_labels.append(labels[i]);
+ }
+
+ // Try to preserve selection if possible.
+ if (getSelectedIndex() >= static_cast<int>(names.size()))
+ setSelectedIndex(-1);
+}
+
+} // namespace WebKit
diff --git a/WebKit/chromium/src/AutoFillPopupMenuClient.h b/WebKit/chromium/src/AutoFillPopupMenuClient.h
new file mode 100644
index 0000000..fe11334
--- /dev/null
+++ b/WebKit/chromium/src/AutoFillPopupMenuClient.h
@@ -0,0 +1,80 @@
+/*
+ * 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 AutoFillPopupMenuClient_h
+#define AutoFillPopupMenuClient_h
+
+#include "SuggestionsPopupMenuClient.h"
+
+namespace WebCore {
+class HTMLInputElement;
+}
+
+namespace WebKit {
+class WebString;
+template <typename T> class WebVector;
+
+// The AutoFill suggestions popup menu client, used to display name suggestions
+// with right-justified labels.
+class AutoFillPopupMenuClient : public SuggestionsPopupMenuClient {
+public:
+ // SuggestionsPopupMenuClient implementation:
+ virtual unsigned getSuggestionsCount() const;
+ virtual WebString getSuggestion(unsigned listIndex) const;
+ virtual void removeSuggestionAtIndex(unsigned listIndex);
+
+ void initialize(WebCore::HTMLInputElement*,
+ const WebVector<WebString>& names,
+ const WebVector<WebString>& labels,
+ int defaultSuggestionIndex);
+
+ void setSuggestions(const WebVector<WebString>& names,
+ const WebVector<WebString>& labels);
+
+private:
+ Vector<WebCore::String> m_names;
+ Vector<WebCore::String> m_labels;
+};
+
+<<<<<<< HEAD:WebCore/bindings/v8/RuntimeEnabledFeatures.cpp
+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;
+=======
+} // namespace WebKit
+>>>>>>> webkit.org at r54731:WebKit/chromium/src/AutoFillPopupMenuClient.h
+
+#endif
diff --git a/WebKit/chromium/src/AutocompletePopupMenuClient.cpp b/WebKit/chromium/src/AutocompletePopupMenuClient.cpp
index 62d4dff..9620ffc 100644
--- a/WebKit/chromium/src/AutocompletePopupMenuClient.cpp
+++ b/WebKit/chromium/src/AutocompletePopupMenuClient.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
@@ -31,27 +31,29 @@
#include "config.h"
#include "AutocompletePopupMenuClient.h"
-#include "CSSStyleSelector.h"
-#include "CSSValueKeywords.h"
-#include "FrameView.h"
#include "HTMLInputElement.h"
-#include "RenderTheme.h"
+#include "WebString.h"
#include "WebVector.h"
-#include "WebViewImpl.h"
using namespace WebCore;
namespace WebKit {
-AutocompletePopupMenuClient::AutocompletePopupMenuClient(WebViewImpl* webView)
- : m_textField(0)
- , m_selectedIndex(0)
- , m_webView(webView)
+unsigned AutocompletePopupMenuClient::getSuggestionsCount() const
{
+ return m_suggestions.size();
}
-AutocompletePopupMenuClient::~AutocompletePopupMenuClient()
+WebString AutocompletePopupMenuClient::getSuggestion(unsigned listIndex) const
{
+ ASSERT(listIndex >= 0 && listIndex < m_suggestions.size());
+ return m_suggestions[listIndex];
+}
+
+void AutocompletePopupMenuClient::removeSuggestionAtIndex(unsigned listIndex)
+{
+ ASSERT(listIndex >= 0 && listIndex < m_suggestions.size());
+ m_suggestions.remove(listIndex);
}
void AutocompletePopupMenuClient::initialize(
@@ -60,90 +62,12 @@ void AutocompletePopupMenuClient::initialize(
int defaultSuggestionIndex)
{
ASSERT(defaultSuggestionIndex < static_cast<int>(suggestions.size()));
- m_textField = textField;
- m_selectedIndex = defaultSuggestionIndex;
- setSuggestions(suggestions);
-
- FontDescription fontDescription;
- m_webView->theme()->systemFont(CSSValueWebkitControl, fontDescription);
- // Use a smaller font size to match IE/Firefox.
- // FIXME: http://crbug.com/7376 use the system size instead of a
- // fixed font size value.
- fontDescription.setComputedSize(12.0);
- Font font(fontDescription, 0, 0);
- font.update(textField->document()->styleSelector()->fontSelector());
- // The direction of text in popup menu is set the same as the direction of
- // the input element: textField.
- m_style.set(new PopupMenuStyle(Color::black, Color::white, font, true,
- Length(WebCore::Fixed),
- textField->renderer()->style()->direction()));
-}
-
-void AutocompletePopupMenuClient::valueChanged(unsigned listIndex, bool fireEvents)
-{
- m_textField->setValue(m_suggestions[listIndex]);
- EditorClientImpl* editor =
- static_cast<EditorClientImpl*>(m_webView->page()->editorClient());
- ASSERT(editor);
- editor->onAutofillSuggestionAccepted(
- static_cast<HTMLInputElement*>(m_textField.get()));
-}
-
-String AutocompletePopupMenuClient::itemText(unsigned listIndex) const
-{
- return m_suggestions[listIndex];
-}
-
-PopupMenuStyle AutocompletePopupMenuClient::itemStyle(unsigned listIndex) const
-{
- return *m_style;
-}
-
-PopupMenuStyle AutocompletePopupMenuClient::menuStyle() const
-{
- return *m_style;
-}
-
-int AutocompletePopupMenuClient::clientPaddingLeft() const
-{
- // Bug http://crbug.com/7708 seems to indicate the style can be 0.
- RenderStyle* style = textFieldStyle();
- return style ? m_webView->theme()->popupInternalPaddingLeft(style) : 0;
-}
-int AutocompletePopupMenuClient::clientPaddingRight() const
-{
- // Bug http://crbug.com/7708 seems to indicate the style can be 0.
- RenderStyle* style = textFieldStyle();
- return style ? m_webView->theme()->popupInternalPaddingRight(style) : 0;
-}
-
-void AutocompletePopupMenuClient::popupDidHide()
-{
- m_webView->autoCompletePopupDidHide();
-}
-
-void AutocompletePopupMenuClient::setTextFromItem(unsigned listIndex)
-{
- m_textField->setValue(m_suggestions[listIndex]);
-}
-
-FontSelector* AutocompletePopupMenuClient::fontSelector() const
-{
- return m_textField->document()->styleSelector()->fontSelector();
-}
-
-HostWindow* AutocompletePopupMenuClient::hostWindow() const
-{
- return m_textField->document()->view()->hostWindow();
-}
+ // The suggestions must be set before initializing the
+ // SuggestionsPopupMenuClient.
+ setSuggestions(suggestions);
-PassRefPtr<Scrollbar> AutocompletePopupMenuClient::createScrollbar(
- ScrollbarClient* client,
- ScrollbarOrientation orientation,
- ScrollbarControlSize size)
-{
- return Scrollbar::createNativeScrollbar(client, orientation, size);
+ SuggestionsPopupMenuClient::initialize(textField, defaultSuggestionIndex);
}
void AutocompletePopupMenuClient::setSuggestions(const WebVector<WebString>& suggestions)
@@ -151,28 +75,10 @@ void AutocompletePopupMenuClient::setSuggestions(const WebVector<WebString>& sug
m_suggestions.clear();
for (size_t i = 0; i < suggestions.size(); ++i)
m_suggestions.append(suggestions[i]);
- // Try to preserve selection if possible.
- if (m_selectedIndex >= static_cast<int>(suggestions.size()))
- m_selectedIndex = -1;
-}
-void AutocompletePopupMenuClient::removeItemAtIndex(int index)
-{
- ASSERT(index >= 0 && index < static_cast<int>(m_suggestions.size()));
- m_suggestions.remove(index);
-}
-
-RenderStyle* AutocompletePopupMenuClient::textFieldStyle() const
-{
- RenderStyle* style = m_textField->computedStyle();
- if (!style) {
- // It seems we can only have a 0 style in a TextField if the
- // node is detached, in which case we the popup shoud not be
- // showing. Please report this in http://crbug.com/7708 and
- // include the page you were visiting.
- ASSERT_NOT_REACHED();
- }
- return style;
+ // Try to preserve selection if possible.
+ if (getSelectedIndex() >= static_cast<int>(suggestions.size()))
+ setSelectedIndex(-1);
}
} // namespace WebKit
diff --git a/WebKit/chromium/src/AutocompletePopupMenuClient.h b/WebKit/chromium/src/AutocompletePopupMenuClient.h
index ad24e54..16a3771 100644
--- a/WebKit/chromium/src/AutocompletePopupMenuClient.h
+++ b/WebKit/chromium/src/AutocompletePopupMenuClient.h
@@ -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
@@ -28,69 +28,38 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "PopupMenuClient.h"
+#ifndef AutocompletePopupMenuClient_h
+#define AutocompletePopupMenuClient_h
+
+#include "SuggestionsPopupMenuClient.h"
namespace WebCore {
class HTMLInputElement;
-class PopupMenuStyle;
-class RenderStyle;
}
namespace WebKit {
class WebString;
-class WebViewImpl;
template <typename T> class WebVector;
-// AutocompletePopupMenuClient
-class AutocompletePopupMenuClient : public WebCore::PopupMenuClient {
+// The Autocomplete suggestions popup menu client, used to display a list of
+// autocomplete suggestions.
+class AutocompletePopupMenuClient : public SuggestionsPopupMenuClient {
public:
- AutocompletePopupMenuClient(WebViewImpl* webview);
- ~AutocompletePopupMenuClient();
+ // SuggestionsPopupMenuClient implementation:
+ virtual unsigned getSuggestionsCount() const;
+ virtual WebString getSuggestion(unsigned listIndex) const;
+ virtual void removeSuggestionAtIndex(unsigned listIndex);
void initialize(WebCore::HTMLInputElement*,
const WebVector<WebString>& suggestions,
int defaultSuggestionIndex);
- WebCore::HTMLInputElement* textField() const { return m_textField.get(); }
-
void setSuggestions(const WebVector<WebString>&);
- void removeItemAtIndex(int index);
-
- // WebCore::PopupMenuClient methods:
- virtual void valueChanged(unsigned listIndex, bool fireEvents = true);
- virtual WebCore::String itemText(unsigned listIndex) const;
- virtual WebCore::String itemToolTip(unsigned lastIndex) const { return WebCore::String(); }
- virtual bool itemIsEnabled(unsigned listIndex) const { return true; }
- virtual WebCore::PopupMenuStyle itemStyle(unsigned listIndex) const;
- virtual WebCore::PopupMenuStyle menuStyle() const;
- virtual int clientInsetLeft() const { return 0; }
- virtual int clientInsetRight() const { return 0; }
- virtual int clientPaddingLeft() const;
- virtual int clientPaddingRight() const;
- virtual int listSize() const { return m_suggestions.size(); }
- virtual int selectedIndex() const { return m_selectedIndex; }
- virtual void popupDidHide();
- virtual bool itemIsSeparator(unsigned listIndex) const { return false; }
- virtual bool itemIsLabel(unsigned listIndex) const { return false; }
- virtual bool itemIsSelected(unsigned listIndex) const { return false; }
- virtual bool shouldPopOver() const { return false; }
- virtual bool valueShouldChangeOnHotTrack() const { return false; }
- virtual void setTextFromItem(unsigned listIndex);
- virtual WebCore::FontSelector* fontSelector() const;
- virtual WebCore::HostWindow* hostWindow() const;
- virtual PassRefPtr<WebCore::Scrollbar> createScrollbar(
- WebCore::ScrollbarClient* client,
- WebCore::ScrollbarOrientation orientation,
- WebCore::ScrollbarControlSize size);
private:
- WebCore::RenderStyle* textFieldStyle() const;
-
- RefPtr<WebCore::HTMLInputElement> m_textField;
Vector<WebCore::String> m_suggestions;
- int m_selectedIndex;
- WebViewImpl* m_webView;
- OwnPtr<WebCore::PopupMenuStyle> m_style;
};
} // namespace WebKit
+
+#endif
diff --git a/WebKit/chromium/src/BackForwardListClientImpl.cpp b/WebKit/chromium/src/BackForwardListClientImpl.cpp
index 8feae32..f5b04ab 100644
--- a/WebKit/chromium/src/BackForwardListClientImpl.cpp
+++ b/WebKit/chromium/src/BackForwardListClientImpl.cpp
@@ -90,7 +90,7 @@ HistoryItem* BackForwardListClientImpl::currentItem()
HistoryItem* BackForwardListClientImpl::itemAtIndex(int index)
{
- if (!m_webView->client())
+ if (!m_webView->client() || index > forwardListCount() || -index > backListCount())
return 0;
// Since we don't keep the entire back/forward list, we have no way to
diff --git a/WebKit/chromium/src/ChromeClientImpl.cpp b/WebKit/chromium/src/ChromeClientImpl.cpp
index 9079094..ce2f00c 100644
--- a/WebKit/chromium/src/ChromeClientImpl.cpp
+++ b/WebKit/chromium/src/ChromeClientImpl.cpp
@@ -659,6 +659,14 @@ void ChromeClientImpl::getPopupMenuInfo(PopupContainer* popupContainer,
info->items.swap(outputItems);
}
+void ChromeClientImpl::didChangeAccessibilityObjectState(AccessibilityObject* obj)
+{
+ // Alert assistive technology about the accessibility object state change
+ if (obj)
+ m_webView->client()->didChangeAccessibilityObjectState(WebAccessibilityObject(obj));
+}
+
+
#if ENABLE(NOTIFICATIONS)
NotificationPresenter* ChromeClientImpl::notificationPresenter() const
{
diff --git a/WebKit/chromium/src/ChromeClientImpl.h b/WebKit/chromium/src/ChromeClientImpl.h
index 5a1e9cc..9e8c2e3 100644
--- a/WebKit/chromium/src/ChromeClientImpl.h
+++ b/WebKit/chromium/src/ChromeClientImpl.h
@@ -34,6 +34,7 @@
#include "ChromeClientChromium.h"
namespace WebCore {
+class AccessibilityObject;
class HTMLParserQuirks;
class PopupContainer;
class SecurityOrigin;
@@ -132,6 +133,7 @@ public:
const WebCore::IntRect& bounds,
bool activatable,
bool handleExternally);
+ virtual void didChangeAccessibilityObjectState(WebCore::AccessibilityObject*);
// ChromeClientImpl:
void setCursor(const WebCursorInfo& cursor);
diff --git a/WebKit/chromium/src/DebuggerAgent.h b/WebKit/chromium/src/DebuggerAgent.h
index cac9686..17cde11 100644
--- a/WebKit/chromium/src/DebuggerAgent.h
+++ b/WebKit/chromium/src/DebuggerAgent.h
@@ -37,7 +37,10 @@ namespace WebKit {
#define DEBUGGER_AGENT_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3, METHOD4, METHOD5) \
/* Requests global context id of the inspected tab. */ \
- METHOD0(getContextId)
+ METHOD0(getContextId) \
+ \
+ /* Request v8 to process all debug commands in the queue. */ \
+ METHOD0(processDebugCommands)
DEFINE_RPC_CLASS(DebuggerAgent, DEBUGGER_AGENT_STRUCT)
diff --git a/WebKit/chromium/src/DebuggerAgentImpl.cpp b/WebKit/chromium/src/DebuggerAgentImpl.cpp
index 0c3d1ea..d592710 100644
--- a/WebKit/chromium/src/DebuggerAgentImpl.cpp
+++ b/WebKit/chromium/src/DebuggerAgentImpl.cpp
@@ -51,7 +51,6 @@ using WebCore::Frame;
using WebCore::Page;
using WebCore::String;
using WebCore::V8ClassIndex;
-using WebCore::V8Custom;
using WebCore::V8DOMWindow;
using WebCore::V8DOMWrapper;
using WebCore::V8Proxy;
@@ -80,6 +79,12 @@ void DebuggerAgentImpl::getContextId()
m_delegate->setContextId(m_webdevtoolsAgent->hostId());
}
+void DebuggerAgentImpl::processDebugCommands()
+{
+ DebuggerAgentManager::UtilityContextScope utilityScope;
+ v8::Debug::ProcessDebugMessages();
+}
+
void DebuggerAgentImpl::debuggerOutput(const String& command)
{
m_delegate->debuggerOutput(command);
@@ -90,13 +95,21 @@ void DebuggerAgentImpl::debuggerOutput(const String& command)
void DebuggerAgentImpl::createUtilityContext(Frame* frame, v8::Persistent<v8::Context>* context)
{
v8::HandleScope scope;
+ bool canExecuteScripts = frame->script()->canExecuteScripts();
// Set up the DOM window as the prototype of the new global object.
v8::Handle<v8::Context> windowContext = V8Proxy::context(frame);
- v8::Handle<v8::Object> windowGlobal = windowContext->Global();
- v8::Handle<v8::Object> windowWrapper = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, windowGlobal);
-
- ASSERT(V8DOMWindow::toNative(windowWrapper) == frame->domWindow());
+ v8::Handle<v8::Object> windowGlobal;
+ v8::Handle<v8::Object> windowWrapper;
+ if (canExecuteScripts) {
+ // FIXME: This check prevents renderer from crashing, while providing limited capabilities for
+ // DOM inspection, Resources tracking, no scripts support, some timeline profiling. Console will
+ // result in exceptions for each evaluation. There is still some work that needs to be done in
+ // order to polish the script-less experience.
+ windowGlobal = windowContext->Global();
+ windowWrapper = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), windowGlobal);
+ ASSERT(V8DOMWindow::toNative(windowWrapper) == frame->domWindow());
+ }
v8::Handle<v8::ObjectTemplate> globalTemplate = v8::ObjectTemplate::New();
@@ -121,11 +134,13 @@ void DebuggerAgentImpl::createUtilityContext(Frame* frame, v8::Persistent<v8::Co
v8::Handle<v8::Object> global = (*context)->Global();
v8::Handle<v8::String> implicitProtoString = v8::String::New("__proto__");
- global->Set(implicitProtoString, windowWrapper);
+ if (canExecuteScripts)
+ global->Set(implicitProtoString, windowWrapper);
// Give the code running in the new context a way to get access to the
// original context.
- global->Set(v8::String::New("contentWindow"), windowGlobal);
+ if (canExecuteScripts)
+ global->Set(v8::String::New("contentWindow"), windowGlobal);
}
String DebuggerAgentImpl::executeUtilityFunction(
@@ -180,22 +195,6 @@ String DebuggerAgentImpl::executeUtilityFunction(
return WebCore::toWebCoreStringWithNullCheck(resObj);
}
-void DebuggerAgentImpl::executeVoidJavaScript(v8::Handle<v8::Context> context)
-{
- v8::HandleScope scope;
- ASSERT(!context.IsEmpty());
- v8::Context::Scope contextScope(context);
- DebuggerAgentManager::UtilityContextScope utilityScope;
-
- v8::Handle<v8::Value> function =
- context->Global()->Get(v8::String::New("devtools$$void"));
- ASSERT(function->IsFunction());
- v8::Handle<v8::Value> args[] = {
- v8::Local<v8::Value>()
- };
- v8::Handle<v8::Function>::Cast(function)->Call(context->Global(), 0, args);
-}
-
WebCore::Page* DebuggerAgentImpl::page()
{
return m_webViewImpl->page();
diff --git a/WebKit/chromium/src/DebuggerAgentImpl.h b/WebKit/chromium/src/DebuggerAgentImpl.h
index 65dc14c..6eaf576 100644
--- a/WebKit/chromium/src/DebuggerAgentImpl.h
+++ b/WebKit/chromium/src/DebuggerAgentImpl.h
@@ -62,6 +62,7 @@ public:
// DebuggerAgent implementation.
virtual void getContextId();
+ virtual void processDebugCommands();
void debuggerOutput(const WebCore::String& out);
@@ -81,10 +82,6 @@ public:
bool async,
WebCore::String* exception);
- // Executes a no-op function in the utility context. We don't use
- // executeUtilityFunction for that to avoid script evaluation leading to
- // undesirable AfterCompile events.
- void executeVoidJavaScript(v8::Handle<v8::Context> context);
WebCore::Page* page();
WebDevToolsAgentImpl* webdevtoolsAgent() { return m_webdevtoolsAgent; }
diff --git a/WebKit/chromium/src/EditorClientImpl.cpp b/WebKit/chromium/src/EditorClientImpl.cpp
index e035e6a..d5bddc5 100644
--- a/WebKit/chromium/src/EditorClientImpl.cpp
+++ b/WebKit/chromium/src/EditorClientImpl.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006, 2007 Apple, Inc. All rights reserved.
- * 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
@@ -654,7 +654,7 @@ void EditorClientImpl::textFieldDidEndEditing(Element* element)
m_autofillTimer.stop();
// Hide any showing popup.
- m_webView->hideAutoCompletePopup();
+ m_webView->hideSuggestionsPopup();
if (!m_webView->client())
return; // The page is getting closed, don't fill the password.
@@ -748,7 +748,7 @@ void EditorClientImpl::doAutofill(Timer<EditorClientImpl>* timer)
&& inputElement->selectionEnd() == static_cast<int>(value.length());
if ((!args->autofillOnEmptyValue && value.isEmpty()) || !isCaretAtEnd) {
- m_webView->hideAutoCompletePopup();
+ m_webView->hideSuggestionsPopup();
return;
}
diff --git a/WebKit/chromium/src/GraphicsContext3D.cpp b/WebKit/chromium/src/GraphicsContext3D.cpp
index 7fe31b0..83574da 100644
--- a/WebKit/chromium/src/GraphicsContext3D.cpp
+++ b/WebKit/chromium/src/GraphicsContext3D.cpp
@@ -275,14 +275,6 @@ private:
, m_glXGetCurrentContext(getCurrentContext)
{
}
-
- static void* tryLoad(const char* libName)
- {
- // We use RTLD_GLOBAL semantics so that GLEW initialization works;
- // GLEW expects to be able to open the current process's handle
- // and do dlsym's of GL entry points from there.
- return dlopen(libName, RTLD_LAZY | RTLD_GLOBAL);
- }
};
static GLConnection* s_gl;
@@ -304,22 +296,13 @@ GraphicsContext3DInternal::GLConnection* GraphicsContext3DInternal::GLConnection
return 0;
}
- void* libGL = 0;
- const char* libNames[] = {
- "/usr/lib/libGL.so.1",
- "/usr/lib32/libGL.so.1",
- "/usr/lib64/libGL.so.1",
- };
- for (int i = 0; i < sizeof(libNames) / sizeof(const char*); i++) {
- libGL = tryLoad(libNames[i]);
- if (libGL)
- break;
- }
+ // We use RTLD_GLOBAL semantics so that GLEW initialization works;
+ // GLEW expects to be able to open the current process's handle
+ // and do dlsym's of GL entry points from there.
+ void* libGL = dlopen("libGL.so.1", RTLD_LAZY | RTLD_GLOBAL);
if (!libGL) {
- printf("GraphicsContext3D: error opening libGL.so.1\n");
- printf("GraphicsContext3D: tried:\n");
- for (int i = 0; i < sizeof(libNames) / sizeof(const char*); i++)
- printf(" %s\n", libNames[i]);
+ XCloseDisplay(dpy);
+ printf("GraphicsContext3D: error opening libGL.so.1: %s\n", dlerror());
return 0;
}
@@ -726,7 +709,6 @@ void GraphicsContext3DInternal::reshape(int width, int height)
#endif // FLIP_FRAMEBUFFER_VERTICALLY
glClear(GL_COLOR_BUFFER_BIT);
- viewportImpl(0, 0, width, height);
#if PLATFORM(CG)
// Need to reallocate the client-side backing store.
diff --git a/WebKit/chromium/src/SuggestionsPopupMenuClient.cpp b/WebKit/chromium/src/SuggestionsPopupMenuClient.cpp
new file mode 100644
index 0000000..b4a77a3
--- /dev/null
+++ b/WebKit/chromium/src/SuggestionsPopupMenuClient.cpp
@@ -0,0 +1,186 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "SuggestionsPopupMenuClient.h"
+
+#include "CSSStyleSelector.h"
+#include "CSSValueKeywords.h"
+#include "Chrome.h"
+#include "FrameView.h"
+#include "HTMLInputElement.h"
+#include "RenderTheme.h"
+#include "WebViewImpl.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+SuggestionsPopupMenuClient::SuggestionsPopupMenuClient()
+ : m_textField(0)
+ , m_selectedIndex(0)
+{
+}
+
+SuggestionsPopupMenuClient::~SuggestionsPopupMenuClient()
+{
+}
+
+// FIXME: Implement this per-derived class?
+void SuggestionsPopupMenuClient::valueChanged(unsigned listIndex, bool fireEvents)
+{
+ m_textField->setValue(getSuggestion(listIndex));
+
+ WebViewImpl* webView = getWebView();
+ if (!webView)
+ return;
+
+ EditorClientImpl* editor =
+ static_cast<EditorClientImpl*>(webView->page()->editorClient());
+ ASSERT(editor);
+ editor->onAutofillSuggestionAccepted(
+ static_cast<HTMLInputElement*>(m_textField.get()));
+}
+
+String SuggestionsPopupMenuClient::itemText(unsigned listIndex) const
+{
+ return getSuggestion(listIndex);
+}
+
+PopupMenuStyle SuggestionsPopupMenuClient::itemStyle(unsigned listIndex) const
+{
+ return *m_style;
+}
+
+PopupMenuStyle SuggestionsPopupMenuClient::menuStyle() const
+{
+ return *m_style;
+}
+
+int SuggestionsPopupMenuClient::clientPaddingLeft() const
+{
+ // Bug http://crbug.com/7708 seems to indicate the style can be 0.
+ RenderStyle* style = textFieldStyle();
+ if (!style)
+ return 0;
+
+ return RenderTheme::defaultTheme()->popupInternalPaddingLeft(style);
+}
+
+int SuggestionsPopupMenuClient::clientPaddingRight() const
+{
+ // Bug http://crbug.com/7708 seems to indicate the style can be 0.
+ RenderStyle* style = textFieldStyle();
+ if (!style)
+ return 0;
+
+ return RenderTheme::defaultTheme()->popupInternalPaddingRight(style);
+}
+
+void SuggestionsPopupMenuClient::popupDidHide()
+{
+ WebViewImpl* webView = getWebView();
+ if (webView)
+ webView->suggestionsPopupDidHide();
+}
+
+void SuggestionsPopupMenuClient::setTextFromItem(unsigned listIndex)
+{
+ m_textField->setValue(getSuggestion(listIndex));
+}
+
+FontSelector* SuggestionsPopupMenuClient::fontSelector() const
+{
+ return m_textField->document()->styleSelector()->fontSelector();
+}
+
+HostWindow* SuggestionsPopupMenuClient::hostWindow() const
+{
+ return m_textField->document()->view()->hostWindow();
+}
+
+PassRefPtr<Scrollbar> SuggestionsPopupMenuClient::createScrollbar(
+ ScrollbarClient* client,
+ ScrollbarOrientation orientation,
+ ScrollbarControlSize size)
+{
+ return Scrollbar::createNativeScrollbar(client, orientation, size);
+}
+
+RenderStyle* SuggestionsPopupMenuClient::textFieldStyle() const
+{
+ RenderStyle* style = m_textField->computedStyle();
+ if (!style) {
+ // It seems we can only have a 0 style in a TextField if the
+ // node is detached, in which case we the popup shoud not be
+ // showing. Please report this in http://crbug.com/7708 and
+ // include the page you were visiting.
+ ASSERT_NOT_REACHED();
+ }
+ return style;
+}
+
+void SuggestionsPopupMenuClient::initialize(HTMLInputElement* textField,
+ int defaultSuggestionIndex)
+{
+ m_textField = textField;
+ m_selectedIndex = defaultSuggestionIndex;
+
+ FontDescription fontDescription;
+ RenderTheme::defaultTheme()->systemFont(CSSValueWebkitControl,
+ fontDescription);
+
+ // Use a smaller font size to match IE/Firefox.
+ // FIXME: http://crbug.com/7376 use the system size instead of a
+ // fixed font size value.
+ fontDescription.setComputedSize(12.0);
+ Font font(fontDescription, 0, 0);
+ font.update(textField->document()->styleSelector()->fontSelector());
+ // The direction of text in popup menu is set the same as the direction of
+ // the input element: textField.
+ m_style.set(new PopupMenuStyle(Color::black, Color::white, font, true,
+ Length(WebCore::Fixed),
+ textField->renderer()->style()->direction()));
+}
+
+WebViewImpl* SuggestionsPopupMenuClient::getWebView() const
+{
+ Frame* frame = m_textField->document()->frame();
+ if (!frame)
+ return 0;
+
+ Page* page = frame->page();
+ if (!page)
+ return 0;
+
+ return static_cast<ChromeClientImpl*>(page->chrome()->client())->webView();
+}
+
+} // namespace WebKit
diff --git a/WebKit/chromium/src/SuggestionsPopupMenuClient.h b/WebKit/chromium/src/SuggestionsPopupMenuClient.h
new file mode 100644
index 0000000..edc4c09
--- /dev/null
+++ b/WebKit/chromium/src/SuggestionsPopupMenuClient.h
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "PopupMenuClient.h"
+
+#ifndef SuggestionsPopupMenuClient_h
+#define SuggestionsPopupMenuClient_h
+
+namespace WebCore {
+class HTMLInputElement;
+class PopupMenuStyle;
+class RenderStyle;
+}
+
+namespace WebKit {
+class WebString;
+class WebViewImpl;
+template <typename T> class WebVector;
+
+// The Suggestions popup menu client, used to display a list of suggestions.
+class SuggestionsPopupMenuClient : public WebCore::PopupMenuClient {
+public:
+ SuggestionsPopupMenuClient();
+ virtual ~SuggestionsPopupMenuClient();
+
+ // Returns the number of suggestions available.
+ virtual unsigned getSuggestionsCount() const = 0;
+
+ // Returns the suggestion at |listIndex|.
+ virtual WebString getSuggestion(unsigned listIndex) const = 0;
+
+ // Removes the suggestion at |listIndex| from the list of suggestions.
+ virtual void removeSuggestionAtIndex(unsigned listIndex) = 0;
+
+ // WebCore::PopupMenuClient methods:
+ virtual void valueChanged(unsigned listIndex, bool fireEvents = true);
+ virtual WebCore::String itemText(unsigned listIndex) const;
+ virtual WebCore::String itemToolTip(unsigned lastIndex) const { return WebCore::String(); }
+ virtual bool itemIsEnabled(unsigned listIndex) const { return true; }
+ virtual WebCore::PopupMenuStyle itemStyle(unsigned listIndex) const;
+ virtual WebCore::PopupMenuStyle menuStyle() const;
+ virtual int clientInsetLeft() const { return 0; }
+ virtual int clientInsetRight() const { return 0; }
+ virtual int clientPaddingLeft() const;
+ virtual int clientPaddingRight() const;
+ virtual int listSize() const { return getSuggestionsCount(); }
+ virtual int selectedIndex() const { return m_selectedIndex; }
+ virtual void popupDidHide();
+ virtual bool itemIsSeparator(unsigned listIndex) const { return false; }
+ virtual bool itemIsLabel(unsigned listIndex) const { return false; }
+ virtual bool itemIsSelected(unsigned listIndex) const { return false; }
+ virtual bool shouldPopOver() const { return false; }
+ virtual bool valueShouldChangeOnHotTrack() const { return false; }
+ virtual void setTextFromItem(unsigned listIndex);
+ virtual WebCore::FontSelector* fontSelector() const;
+ virtual WebCore::HostWindow* hostWindow() const;
+ virtual PassRefPtr<WebCore::Scrollbar> createScrollbar(
+ WebCore::ScrollbarClient* client,
+ WebCore::ScrollbarOrientation orientation,
+ WebCore::ScrollbarControlSize size);
+
+protected:
+ void initialize(WebCore::HTMLInputElement* textField,
+ int defaultSuggestionIndex);
+
+ int getSelectedIndex() const { return m_selectedIndex; }
+ void setSelectedIndex(int index) { m_selectedIndex = index; }
+
+ WebViewImpl* getWebView() const;
+ WebCore::HTMLInputElement* getTextField() const { return m_textField.get(); }
+
+private:
+ WebCore::RenderStyle* textFieldStyle() const;
+
+ RefPtr<WebCore::HTMLInputElement> m_textField;
+ int m_selectedIndex;
+ OwnPtr<WebCore::PopupMenuStyle> m_style;
+};
+
+} // namespace WebKit
+
+#endif
diff --git a/WebKit/chromium/src/ToolsAgent.h b/WebKit/chromium/src/ToolsAgent.h
index fd1fcb7..ab48153 100644
--- a/WebKit/chromium/src/ToolsAgent.h
+++ b/WebKit/chromium/src/ToolsAgent.h
@@ -38,9 +38,6 @@ namespace WebKit {
// Tools agent provides API for enabling / disabling other agents as well as
// API for auxiliary UI functions such as dom elements highlighting.
#define TOOLS_AGENT_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3, METHOD4, METHOD5) \
- /* Request the agent to to run a no-op JavaScript function to trigger v8 execution. */ \
- METHOD0(executeVoidJavaScript) \
- \
/* Dispatches given function on the InspectorController object */ \
METHOD3(dispatchOnInspectorController, int /* call_id */, \
String /* function_name */, String /* json_args */) \
diff --git a/WebKit/chromium/src/WebDatabase.cpp b/WebKit/chromium/src/WebDatabase.cpp
index 2cd36b6..50b9220 100644
--- a/WebKit/chromium/src/WebDatabase.cpp
+++ b/WebKit/chromium/src/WebDatabase.cpp
@@ -32,7 +32,9 @@
#include "WebDatabase.h"
#include "Database.h"
+#include "DatabaseTask.h"
#include "DatabaseThread.h"
+#include "DatabaseTracker.h"
#include "Document.h"
#include "KURL.h"
#include "QuotaTracker.h"
@@ -106,6 +108,22 @@ void WebDatabase::updateDatabaseSize(
originIdentifier, databaseName, databaseSize, spaceAvailable);
}
+void WebDatabase::closeDatabaseImmediately(const WebString& originIdentifier, const WebString& databaseName)
+{
+ HashSet<RefPtr<Database> > databaseHandles;
+ PassRefPtr<SecurityOrigin> originPrp(*WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier));
+ RefPtr<SecurityOrigin> origin = originPrp;
+ DatabaseTracker::tracker().getOpenDatabases(origin.get(), databaseName, &databaseHandles);
+ for (HashSet<RefPtr<Database> >::iterator it = databaseHandles.begin(); it != databaseHandles.end(); ++it) {
+ Database* database = it->get();
+ DatabaseThread* databaseThread = database->scriptExecutionContext()->databaseThread();
+ if (databaseThread && !databaseThread->terminationRequested()) {
+ database->stop();
+ databaseThread->scheduleTask(DatabaseCloseTask::create(database, 0));
+ }
+ }
+}
+
WebDatabase::WebDatabase(const WTF::PassRefPtr<Database>& database)
: m_private(static_cast<WebDatabasePrivate*>(database.releaseRef()))
{
diff --git a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp
index 9d386f3..9ce35b4 100644
--- a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp
+++ b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp
@@ -52,6 +52,7 @@
#include "ScriptState.h"
#include "ScriptValue.h"
#include "V8Binding.h"
+#include "V8InspectorBackend.h"
#include "V8Proxy.h"
#include "V8Utilities.h"
#include "WebDataSource.h"
@@ -87,6 +88,7 @@ using WebCore::ScriptValue;
using WebCore::String;
using WebCore::V8ClassIndex;
using WebCore::V8DOMWrapper;
+using WebCore::V8InspectorBackend;
using WebCore::V8Proxy;
namespace WebKit {
@@ -263,11 +265,6 @@ void WebDevToolsAgentImpl::dispatchOnInjectedScript(int callId, int injectedScri
async);
}
-void WebDevToolsAgentImpl::executeVoidJavaScript()
-{
- m_debuggerAgentImpl->executeVoidJavaScript(m_utilityContext);
-}
-
void WebDevToolsAgentImpl::dispatchMessageFromFrontend(const WebDevToolsMessageData& data)
{
if (ToolsAgentDispatch::dispatch(this, data))
@@ -351,7 +348,7 @@ void WebDevToolsAgentImpl::initDevToolsAgentHost()
v8::Local<v8::Object> WebDevToolsAgentImpl::createInspectorBackendV8Wrapper()
{
V8ClassIndex::V8WrapperType descriptorType = V8ClassIndex::INSPECTORBACKEND;
- v8::Handle<v8::Function> function = V8DOMWrapper::getTemplate(descriptorType)->GetFunction();
+ v8::Handle<v8::Function> function = V8InspectorBackend::GetTemplate()->GetFunction();
if (function.IsEmpty()) {
// Return if allocation failed.
return v8::Local<v8::Object>();
diff --git a/WebKit/chromium/src/WebDevToolsAgentImpl.h b/WebKit/chromium/src/WebDevToolsAgentImpl.h
index 3f5928b..1f81c6d 100644
--- a/WebKit/chromium/src/WebDevToolsAgentImpl.h
+++ b/WebKit/chromium/src/WebDevToolsAgentImpl.h
@@ -70,7 +70,6 @@ public:
// ToolsAgent implementation.
virtual void dispatchOnInspectorController(int callId, const WebCore::String& functionName, const WebCore::String& jsonArgs);
virtual void dispatchOnInjectedScript(int callId, int injectedScriptId, const WebCore::String& functionName, const WebCore::String& jsonArgs, bool async);
- virtual void executeVoidJavaScript();
// WebDevToolsAgentPrivate implementation.
virtual void didClearWindowObject(WebFrameImpl* frame);
diff --git a/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp b/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp
index 0a92319..89fa6e7 100644
--- a/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp
+++ b/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp
@@ -52,7 +52,6 @@
#include "Settings.h"
#include "ToolsAgent.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8DOMWrapper.h"
#include "V8InspectorFrontendHost.h"
#include "V8Node.h"
@@ -356,7 +355,7 @@ v8::Handle<v8::Value> WebDevToolsFrontendImpl::jsShowContextMenu(const v8::Argum
return v8::Undefined();
v8::Local<v8::Object> eventWrapper = v8::Local<v8::Object>::Cast(args[0]);
- if (V8DOMWrapper::domWrapperType(eventWrapper) != V8ClassIndex::EVENT)
+ if (V8DOMWrapper::domWrapperType(eventWrapper) != V8ClassIndex::MOUSEEVENT)
return v8::Undefined();
Event* event = V8Event::toNative(eventWrapper);
diff --git a/WebKit/chromium/src/WebDragData.cpp b/WebKit/chromium/src/WebDragData.cpp
index 3bd4a02..b18ab1b 100644
--- a/WebKit/chromium/src/WebDragData.cpp
+++ b/WebKit/chromium/src/WebDragData.cpp
@@ -100,6 +100,18 @@ void WebDragData::setDownloadURL(const WebURL& downloadURL)
m_private->downloadURL = downloadURL;
}
+WebString WebDragData::downloadMetadata() const
+{
+ ASSERT(!isNull());
+ return m_private->downloadMetadata;
+}
+
+void WebDragData::setDownloadMetadata(const WebString& downloadMetadata)
+{
+ ensureMutable();
+ m_private->downloadMetadata = downloadMetadata;
+}
+
WebString WebDragData::fileExtension() const
{
ASSERT(!isNull());
diff --git a/WebKit/chromium/src/WebHTTPBody.cpp b/WebKit/chromium/src/WebHTTPBody.cpp
index 335ed5c..3d40869 100644
--- a/WebKit/chromium/src/WebHTTPBody.cpp
+++ b/WebKit/chromium/src/WebHTTPBody.cpp
@@ -32,6 +32,7 @@
#include "WebHTTPBody.h"
#include "FormData.h"
+#include "WebFileInfo.h"
using namespace WebCore;
@@ -78,11 +79,17 @@ bool WebHTTPBody::elementAt(size_t index, Element& result) const
result.type = Element::TypeData;
result.data.assign(element.m_data.data(), element.m_data.size());
result.filePath.reset();
+ result.fileStart = 0;
+ result.fileLength = 0;
+ result.fileInfo.modificationTime = 0.0;
break;
case FormDataElement::encodedFile:
result.type = Element::TypeFile;
result.data.reset();
result.filePath = element.m_filename;
+ result.fileStart = 0; // FIXME: to be set from FormData.
+ result.fileLength = -1; // FIXME: to be set from FormData.
+ result.fileInfo.modificationTime = 0.0; // FIXME: to be set from FormData.
break;
default:
ASSERT_NOT_REACHED();
@@ -106,6 +113,11 @@ void WebHTTPBody::appendFile(const WebString& filePath)
m_private->appendFile(filePath);
}
+void WebHTTPBody::appendFile(const WebString& filePath, long long fileStart, long long fileLength, const WebFileInfo& fileInfo)
+{
+ // FIXME: to be implemented.
+}
+
long long WebHTTPBody::identifier() const
{
ASSERT(!isNull());
diff --git a/WebKit/chromium/src/WebInputElement.cpp b/WebKit/chromium/src/WebInputElement.cpp
index ee799f6..9fd317f 100644
--- a/WebKit/chromium/src/WebInputElement.cpp
+++ b/WebKit/chromium/src/WebInputElement.cpp
@@ -75,7 +75,12 @@ WebString WebInputElement::formControlType() const
{
return constUnwrap<HTMLInputElement>()->formControlType();
}
-
+
+bool WebInputElement::isActivatedSubmit() const
+{
+ return constUnwrap<HTMLInputElement>()->isActivatedSubmit();
+}
+
void WebInputElement::setActivatedSubmit(bool activated)
{
unwrap<HTMLInputElement>()->setActivatedSubmit(activated);
diff --git a/WebKit/chromium/src/WebRuntimeFeatures.cpp b/WebKit/chromium/src/WebRuntimeFeatures.cpp
index 0ef8b9b..ad84764 100644
--- a/WebKit/chromium/src/WebRuntimeFeatures.cpp
+++ b/WebKit/chromium/src/WebRuntimeFeatures.cpp
@@ -123,14 +123,14 @@ bool WebRuntimeFeatures::isSocketsEnabled()
void WebRuntimeFeatures::enableNotifications(bool enable)
{
#if ENABLE(NOTIFICATIONS)
- RuntimeEnabledFeatures::setNotificationsEnabled(enable);
+ RuntimeEnabledFeatures::setWebkitNotificationsEnabled(enable);
#endif
}
bool WebRuntimeFeatures::isNotificationsEnabled()
{
#if ENABLE(NOTIFICATIONS)
- return RuntimeEnabledFeatures::notificationsEnabled();
+ return RuntimeEnabledFeatures::webkitNotificationsEnabled();
#else
return false;
#endif
@@ -171,14 +171,14 @@ bool WebRuntimeFeatures::isGeolocationEnabled()
void WebRuntimeFeatures::enableIndexedDatabase(bool enable)
{
#if ENABLE(INDEXED_DATABASE)
- RuntimeEnabledFeatures::setIndexedDatabaseEnabled(enable);
+ RuntimeEnabledFeatures::setIndexedDBEnabled(enable);
#endif
}
bool WebRuntimeFeatures::isIndexedDatabaseEnabled()
{
#if ENABLE(INDEXED_DATABASE)
- return RuntimeEnabledFeatures::indexedDatabaseEnabled();
+ return RuntimeEnabledFeatures::indexedDBEnabled();
#else
return false;
#endif
diff --git a/WebKit/chromium/src/WebStorageAreaImpl.cpp b/WebKit/chromium/src/WebStorageAreaImpl.cpp
index 92a923a..9a7fd5c 100644
--- a/WebKit/chromium/src/WebStorageAreaImpl.cpp
+++ b/WebKit/chromium/src/WebStorageAreaImpl.cpp
@@ -66,7 +66,7 @@ WebString WebStorageAreaImpl::getItem(const WebString& key)
return m_storageArea->getItem(key);
}
-void WebStorageAreaImpl::setItem(const WebString& key, const WebString& value, const WebURL& url, bool& quotaException, WebString& oldValue)
+void WebStorageAreaImpl::setItem(const WebString& key, const WebString& value, const WebURL& url, Result& result, WebString& oldValue)
{
int exceptionCode = 0;
@@ -75,9 +75,9 @@ void WebStorageAreaImpl::setItem(const WebString& key, const WebString& value, c
if (exceptionCode) {
ASSERT(exceptionCode == WebCore::QUOTA_EXCEEDED_ERR);
- quotaException = true;
+ result = ResultBlockedByQuota;
} else
- quotaException = false;
+ result = ResultOK;
}
void WebStorageAreaImpl::removeItem(const WebString& key, const WebURL& url, WebString& oldValue)
diff --git a/WebKit/chromium/src/WebStorageAreaImpl.h b/WebKit/chromium/src/WebStorageAreaImpl.h
index 7e90531..e9a11c2 100644
--- a/WebKit/chromium/src/WebStorageAreaImpl.h
+++ b/WebKit/chromium/src/WebStorageAreaImpl.h
@@ -45,7 +45,7 @@ public:
virtual unsigned length();
virtual WebString key(unsigned index);
virtual WebString getItem(const WebString& key);
- virtual void setItem(const WebString& key, const WebString& value, const WebURL& url, bool& quotaException, WebString& oldValue);
+ virtual void setItem(const WebString& key, const WebString& value, const WebURL& url, Result& result, WebString& oldValue);
virtual void removeItem(const WebString& key, const WebURL& url, WebString& oldValue);
virtual void clear(const WebURL& url, bool& somethingCleared);
diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp
index e030d72..ce03523 100644
--- a/WebKit/chromium/src/WebViewImpl.cpp
+++ b/WebKit/chromium/src/WebViewImpl.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
@@ -31,6 +31,7 @@
#include "config.h"
#include "WebViewImpl.h"
+#include "AutoFillPopupMenuClient.h"
#include "AutocompletePopupMenuClient.h"
#include "AXObjectCache.h"
#include "Chrome.h"
@@ -148,16 +149,16 @@ COMPILE_ASSERT_MATCHING_ENUM(DragOperationMove);
COMPILE_ASSERT_MATCHING_ENUM(DragOperationDelete);
COMPILE_ASSERT_MATCHING_ENUM(DragOperationEvery);
-// Note that focusOnShow is false so that the autocomplete popup is shown not
+// Note that focusOnShow is false so that the suggestions popup is shown not
// activated. We need the page to still have focus so the user can keep typing
// while the popup is showing.
-static const PopupContainerSettings autocompletePopupSettings = {
+static const PopupContainerSettings suggestionsPopupSettings = {
false, // focusOnShow
false, // setTextOnIndexChange
false, // acceptOnAbandon
true, // loopSelectionNavigation
true, // restrictWidthOfListBox. Same as other browser (Fx, IE, and safari)
- // For autocomplete, we use the direction of the input field as the direction
+ // For suggestions, we use the direction of the input field as the direction
// of the popup items. The main reason is to keep the display of items in
// drop-down the same as the items in the input field.
PopupContainerSettings::DOMElementDirection,
@@ -239,7 +240,9 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
, m_dropEffect(DropEffectDefault)
, m_operationsAllowed(WebDragOperationNone)
, m_dragOperation(WebDragOperationNone)
- , m_autocompletePopupShowing(false)
+ , m_suggestionsPopupShowing(false)
+ , m_suggestionsPopupClient(0)
+ , m_suggestionsPopup(0)
, m_isTransparent(false)
, m_tabsToLinks(false)
{
@@ -326,7 +329,7 @@ void WebViewImpl::mouseDown(const WebMouseEvent& event)
m_lastMouseDownPoint = WebPoint(event.x, event.y);
// If a text field that has focus is clicked again, we should display the
- // autocomplete popup.
+ // suggestions popup.
RefPtr<Node> clickedNode;
if (event.button == WebMouseEvent::ButtonLeft) {
RefPtr<Node> focusedNode = focusedWebCoreNode();
@@ -348,7 +351,7 @@ void WebViewImpl::mouseDown(const WebMouseEvent& event)
PlatformMouseEventBuilder(mainFrameImpl()->frameView(), event));
if (clickedNode.get() && clickedNode == focusedWebCoreNode()) {
- // Focus has not changed, show the autocomplete popup.
+ // Focus has not changed, show the suggestions popup.
static_cast<EditorClientImpl*>(m_page->editorClient())->
showFormAutofillForNode(clickedNode.get());
}
@@ -468,7 +471,7 @@ bool WebViewImpl::keyEvent(const WebKeyboardEvent& event)
// event.
m_suppressNextKeypressEvent = false;
- // Give autocomplete a chance to consume the key events it is interested in.
+ // Give Autocomplete a chance to consume the key events it is interested in.
if (autocompleteHandleKeyEvent(event))
return true;
@@ -514,7 +517,7 @@ bool WebViewImpl::keyEvent(const WebKeyboardEvent& event)
bool WebViewImpl::autocompleteHandleKeyEvent(const WebKeyboardEvent& event)
{
- if (!m_autocompletePopupShowing
+ if (!m_suggestionsPopupShowing
// Home and End should be left to the text field to process.
|| event.windowsKeyCode == VKEY_HOME
|| event.windowsKeyCode == VKEY_END)
@@ -522,7 +525,7 @@ bool WebViewImpl::autocompleteHandleKeyEvent(const WebKeyboardEvent& event)
// Pressing delete triggers the removal of the selected suggestion from the DB.
if (event.windowsKeyCode == VKEY_DELETE
- && m_autocompletePopup->selectedIndex() != -1) {
+ && m_suggestionsPopup->selectedIndex() != -1) {
Node* node = focusedWebCoreNode();
if (!node || (node->nodeType() != Node::ELEMENT_NODE)) {
ASSERT_NOT_REACHED();
@@ -534,22 +537,22 @@ bool WebViewImpl::autocompleteHandleKeyEvent(const WebKeyboardEvent& event)
return false;
}
- int selectedIndex = m_autocompletePopup->selectedIndex();
+ int selectedIndex = m_suggestionsPopup->selectedIndex();
HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(element);
WebString name = inputElement->name();
WebString value = m_autocompletePopupClient->itemText(selectedIndex);
m_client->removeAutofillSuggestions(name, value);
// Update the entries in the currently showing popup to reflect the
// deletion.
- m_autocompletePopupClient->removeItemAtIndex(selectedIndex);
- refreshAutofillPopup();
+ m_autocompletePopupClient->removeSuggestionAtIndex(selectedIndex);
+ refreshSuggestionsPopup();
return false;
}
- if (!m_autocompletePopup->isInterestedInEventForKey(event.windowsKeyCode))
+ if (!m_suggestionsPopup->isInterestedInEventForKey(event.windowsKeyCode))
return false;
- if (m_autocompletePopup->handleKeyEvent(PlatformKeyboardEventBuilder(event))) {
+ if (m_suggestionsPopup->handleKeyEvent(PlatformKeyboardEventBuilder(event))) {
// We need to ignore the next Char event after this otherwise pressing
// enter when selecting an item in the menu will go to the page.
if (WebInputEvent::RawKeyDown == event.type)
@@ -697,6 +700,7 @@ bool WebViewImpl::keyEventDefault(const WebKeyboardEvent& event)
case WebInputEvent::RawKeyDown:
if (event.modifiers == WebInputEvent::ControlKey) {
switch (event.windowsKeyCode) {
+#if !OS(DARWIN)
case 'A':
focusedFrame()->executeCommand(WebString::fromUTF8("SelectAll"));
return true;
@@ -704,6 +708,7 @@ bool WebViewImpl::keyEventDefault(const WebKeyboardEvent& event)
case 'C':
focusedFrame()->executeCommand(WebString::fromUTF8("Copy"));
return true;
+#endif
// Match FF behavior in the sense that Ctrl+home/end are the only Ctrl
// key combinations which affect scrolling. Safari is buggy in the
// sense that it scrolls the page for all Ctrl+scrolling key
@@ -976,7 +981,7 @@ void WebViewImpl::setFocus(bool enable)
}
m_imeAcceptEvents = true;
} else {
- hideAutoCompletePopup();
+ hideSuggestionsPopup();
// Clear focus on the currently focused frame if any.
if (!m_page.get())
@@ -1182,7 +1187,7 @@ bool WebViewImpl::dispatchBeforeUnloadEvent()
// FIXME: This should really cause a recursive depth-first walk of all
// frames in the tree, calling each frame's onbeforeunload. At the moment,
// we're consistent with Safari 3.1, not IE/FF.
- Frame* frame = m_page->focusController()->focusedOrMainFrame();
+ Frame* frame = m_page->mainFrame();
if (!frame)
return true;
@@ -1558,64 +1563,132 @@ void WebViewImpl::applyAutofillSuggestions(
const WebVector<WebString>& suggestions,
int defaultSuggestionIndex)
{
- if (!m_page.get() || suggestions.isEmpty()) {
- hideAutoCompletePopup();
+ applyAutocompleteSuggestions(node, suggestions, defaultSuggestionIndex);
+}
+
+void WebViewImpl::applyAutoFillSuggestions(
+ const WebNode& node,
+ const WebVector<WebString>& names,
+ const WebVector<WebString>& labels,
+ int defaultSuggestionIndex)
+{
+ ASSERT(names.size() == labels.size());
+ ASSERT(defaultSuggestionIndex < static_cast<int>(names.size()));
+
+ if (names.isEmpty()) {
+ hideSuggestionsPopup();
+ return;
+ }
+
+ RefPtr<Node> focusedNode = focusedWebCoreNode();
+ // If the node for which we queried the AutoFill suggestions is not the
+ // focused node, then we have nothing to do. FIXME: also check the
+ // caret is at the end and that the text has not changed.
+ if (!focusedNode || focusedNode != PassRefPtr<Node>(node)) {
+ hideSuggestionsPopup();
return;
}
+ HTMLInputElement* inputElem =
+ static_cast<HTMLInputElement*>(focusedNode.get());
+
+ // The first time the AutoFill popup is shown we'll create the client and
+ // the popup.
+ if (!m_autoFillPopupClient.get())
+ m_autoFillPopupClient.set(new AutoFillPopupMenuClient);
+
+ m_autoFillPopupClient->initialize(inputElem, names, labels,
+ defaultSuggestionIndex);
+
+ if (m_suggestionsPopupClient != m_autoFillPopupClient.get()) {
+ hideSuggestionsPopup();
+ m_suggestionsPopupClient = m_autoFillPopupClient.get();
+ }
+
+ if (!m_autoFillPopup.get()) {
+ m_autoFillPopup = PopupContainer::create(m_suggestionsPopupClient,
+ suggestionsPopupSettings);
+ }
+
+ if (m_suggestionsPopup != m_autoFillPopup.get())
+ m_suggestionsPopup = m_autoFillPopup.get();
+
+ if (m_suggestionsPopupShowing) {
+ m_autoFillPopupClient->setSuggestions(names, labels);
+ refreshSuggestionsPopup();
+ } else {
+ m_suggestionsPopup->show(focusedNode->getRect(),
+ focusedNode->ownerDocument()->view(), 0);
+ m_suggestionsPopupShowing = true;
+ }
+}
+
+void WebViewImpl::applyAutocompleteSuggestions(
+ const WebNode& node,
+ const WebVector<WebString>& suggestions,
+ int defaultSuggestionIndex)
+{
ASSERT(defaultSuggestionIndex < static_cast<int>(suggestions.size()));
- if (RefPtr<Frame> focused = m_page->focusController()->focusedFrame()) {
- RefPtr<Document> document = focused->document();
- if (!document.get()) {
- hideAutoCompletePopup();
- return;
- }
+ if (!m_page.get() || suggestions.isEmpty()) {
+ hideSuggestionsPopup();
+ return;
+ }
- RefPtr<Node> focusedNode = document->focusedNode();
- // If the node for which we queried the autofill suggestions is not the
- // focused node, then we have nothing to do. FIXME: also check the
- // carret is at the end and that the text has not changed.
- if (!focusedNode.get() || focusedNode != PassRefPtr<Node>(node)) {
- hideAutoCompletePopup();
- return;
- }
+ RefPtr<Node> focusedNode = focusedWebCoreNode();
+ // If the node for which we queried the Autocomplete suggestions is not the
+ // focused node, then we have nothing to do. FIXME: also check the
+ // caret is at the end and that the text has not changed.
+ if (!focusedNode || focusedNode != PassRefPtr<Node>(node)) {
+ hideSuggestionsPopup();
+ return;
+ }
- if (!focusedNode->hasTagName(HTMLNames::inputTag)) {
- ASSERT_NOT_REACHED();
- return;
- }
+ HTMLInputElement* inputElem =
+ static_cast<HTMLInputElement*>(focusedNode.get());
- HTMLInputElement* inputElem =
- static_cast<HTMLInputElement*>(focusedNode.get());
-
- // The first time the autocomplete is shown we'll create the client and the
- // popup.
- if (!m_autocompletePopupClient.get())
- m_autocompletePopupClient.set(new AutocompletePopupMenuClient(this));
- m_autocompletePopupClient->initialize(inputElem,
- suggestions,
- defaultSuggestionIndex);
- if (!m_autocompletePopup.get()) {
- m_autocompletePopup =
- PopupContainer::create(m_autocompletePopupClient.get(),
- autocompletePopupSettings);
- }
+ // The first time the Autocomplete is shown we'll create the client and the
+ // popup.
+ if (!m_autocompletePopupClient.get())
+ m_autocompletePopupClient.set(new AutocompletePopupMenuClient);
- if (m_autocompletePopupShowing) {
- m_autocompletePopupClient->setSuggestions(suggestions);
- refreshAutofillPopup();
- } else {
- m_autocompletePopup->show(focusedNode->getRect(),
- focusedNode->ownerDocument()->view(), 0);
- m_autocompletePopupShowing = true;
- }
+ m_autocompletePopupClient->initialize(inputElem, suggestions,
+ defaultSuggestionIndex);
+
+ if (m_suggestionsPopupClient != m_autocompletePopupClient.get()) {
+ hideSuggestionsPopup();
+ m_suggestionsPopupClient = m_autocompletePopupClient.get();
+ }
+
+ if (!m_autocompletePopup.get()) {
+ m_autocompletePopup = PopupContainer::create(m_suggestionsPopupClient,
+ suggestionsPopupSettings);
+ }
+
+ if (m_suggestionsPopup != m_autocompletePopup.get())
+ m_suggestionsPopup = m_autocompletePopup.get();
+
+ if (m_suggestionsPopupShowing) {
+ m_autocompletePopupClient->setSuggestions(suggestions);
+ refreshSuggestionsPopup();
+ } else {
+ m_suggestionsPopup->show(focusedNode->getRect(),
+ focusedNode->ownerDocument()->view(), 0);
+ m_suggestionsPopupShowing = true;
}
}
void WebViewImpl::hideAutofillPopup()
{
- hideAutoCompletePopup();
+ hideSuggestionsPopup();
+}
+
+void WebViewImpl::hideSuggestionsPopup()
+{
+ if (m_suggestionsPopupShowing) {
+ m_suggestionsPopup->hidePopup();
+ m_suggestionsPopupShowing = false;
+ }
}
void WebViewImpl::performCustomContextMenuAction(unsigned action)
@@ -1778,19 +1851,6 @@ void WebViewImpl::observeNewNavigation()
#endif
}
-void WebViewImpl::hideAutoCompletePopup()
-{
- if (m_autocompletePopupShowing) {
- m_autocompletePopup->hidePopup();
- autoCompletePopupDidHide();
- }
-}
-
-void WebViewImpl::autoCompletePopupDidHide()
-{
- m_autocompletePopupShowing = false;
-}
-
void WebViewImpl::setIgnoreInputEvents(bool newValue)
{
ASSERT(m_ignoreInputEvents != newValue);
@@ -1806,23 +1866,23 @@ NotificationPresenterImpl* WebViewImpl::notificationPresenterImpl()
}
#endif
-void WebViewImpl::refreshAutofillPopup()
+void WebViewImpl::refreshSuggestionsPopup()
{
- ASSERT(m_autocompletePopupShowing);
+ ASSERT(m_suggestionsPopupShowing);
// Hide the popup if it has become empty.
if (!m_autocompletePopupClient->listSize()) {
- hideAutoCompletePopup();
+ hideSuggestionsPopup();
return;
}
- IntRect oldBounds = m_autocompletePopup->boundsRect();
- m_autocompletePopup->refresh();
- IntRect newBounds = m_autocompletePopup->boundsRect();
+ IntRect oldBounds = m_suggestionsPopup->boundsRect();
+ m_suggestionsPopup->refresh();
+ IntRect newBounds = m_suggestionsPopup->boundsRect();
// Let's resize the backing window if necessary.
if (oldBounds != newBounds) {
WebPopupMenuImpl* popupMenu =
- static_cast<WebPopupMenuImpl*>(m_autocompletePopup->client());
+ static_cast<WebPopupMenuImpl*>(m_suggestionsPopup->client());
popupMenu->client()->setWindowRect(newBounds);
}
}
diff --git a/WebKit/chromium/src/WebViewImpl.h b/WebKit/chromium/src/WebViewImpl.h
index e2292f4..286ac43 100644
--- a/WebKit/chromium/src/WebViewImpl.h
+++ b/WebKit/chromium/src/WebViewImpl.h
@@ -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
@@ -58,6 +58,7 @@ class KeyboardEvent;
class Page;
class PlatformKeyboardEvent;
class PopupContainer;
+class PopupMenuClient;
class Range;
class RenderTheme;
class Widget;
@@ -65,7 +66,9 @@ class Widget;
namespace WebKit {
class AutocompletePopupMenuClient;
+class AutoFillPopupMenuClient;
class ContextMenuClientImpl;
+class SuggestionsPopupMenuClient;
class WebAccessibilityObject;
class WebDevToolsAgentPrivate;
class WebFrameImpl;
@@ -153,7 +156,17 @@ public:
const WebNode&,
const WebVector<WebString>& suggestions,
int defaultSuggestionIndex);
+ virtual void applyAutoFillSuggestions(
+ const WebNode&,
+ const WebVector<WebString>& names,
+ const WebVector<WebString>& labels,
+ int defaultSuggestionIndex);
+ virtual void applyAutocompleteSuggestions(
+ const WebNode&,
+ const WebVector<WebString>& suggestions,
+ int defaultSuggestionIndex);
virtual void hideAutofillPopup();
+ virtual void hideSuggestionsPopup();
virtual void setScrollbarColors(unsigned inactiveColor,
unsigned activeColor,
unsigned trackColor);
@@ -261,9 +274,10 @@ public:
const WebDragData& dragData,
WebDragOperationsMask dragSourceOperationMask);
- // Hides the autocomplete popup if it is showing.
- void hideAutoCompletePopup();
- void autoCompletePopupDidHide();
+ void suggestionsPopupDidHide()
+ {
+ m_suggestionsPopupShowing = false;
+ }
#if ENABLE(NOTIFICATIONS)
// Returns the provider of desktop notifications.
@@ -295,10 +309,10 @@ private:
// Returns true if the autocomple has consumed the event.
bool autocompleteHandleKeyEvent(const WebKeyboardEvent&);
- // Repaints the autofill popup. Should be called when the suggestions have
- // changed. Note that this should only be called when the autofill popup is
- // showing.
- void refreshAutofillPopup();
+ // Repaints the suggestions popup. Should be called when the suggestions
+ // have changed. Note that this should only be called when the suggestions
+ // popup is showing.
+ void refreshSuggestionsPopup();
// Returns true if the view was scrolled.
bool scrollViewWithKeyboard(int keyCode, int modifiers);
@@ -393,16 +407,29 @@ private:
// current drop target in this WebView (the drop target can accept the drop).
WebDragOperation m_dragOperation;
- // The autocomplete popup. Kept around and reused every-time new suggestions
- // should be shown.
- RefPtr<WebCore::PopupContainer> m_autocompletePopup;
+ // Whether a suggestions popup is currently showing.
+ bool m_suggestionsPopupShowing;
+
+ // A pointer to the current suggestions popup menu client. This can be
+ // either an AutoFillPopupMenuClient or an AutocompletePopupMenuClient. We
+ // do not own this pointer.
+ SuggestionsPopupMenuClient* m_suggestionsPopupClient;
- // Whether the autocomplete popup is currently showing.
- bool m_autocompletePopupShowing;
+ // The AutoFill popup client.
+ OwnPtr<AutoFillPopupMenuClient> m_autoFillPopupClient;
- // The autocomplete client.
+ // The Autocomplete popup client.
OwnPtr<AutocompletePopupMenuClient> m_autocompletePopupClient;
+ // A pointer to the current suggestions popup. We do not own this pointer.
+ WebCore::PopupContainer* m_suggestionsPopup;
+
+ // The AutoFill suggestions popup.
+ RefPtr<WebCore::PopupContainer> m_autoFillPopup;
+
+ // The AutoComplete suggestions popup.
+ RefPtr<WebCore::PopupContainer> m_autocompletePopup;
+
OwnPtr<WebDevToolsAgentPrivate> m_devToolsAgent;
// Whether the webview is rendering transparently.
diff --git a/WebKit/chromium/src/WebWorkerBase.cpp b/WebKit/chromium/src/WebWorkerBase.cpp
index 7fd3749..40019e8 100644
--- a/WebKit/chromium/src/WebWorkerBase.cpp
+++ b/WebKit/chromium/src/WebWorkerBase.cpp
@@ -271,6 +271,8 @@ void WebWorkerBase::workerContextClosedTask(ScriptExecutionContext* context,
{
if (thisPtr->commonClient())
thisPtr->commonClient()->workerContextClosed();
+
+ thisPtr->stopWorkerThread();
}
void WebWorkerBase::workerContextDestroyed()
diff --git a/WebKit/chromium/src/js/DebuggerAgent.js b/WebKit/chromium/src/js/DebuggerAgent.js
new file mode 100644
index 0000000..301620a
--- /dev/null
+++ b/WebKit/chromium/src/js/DebuggerAgent.js
@@ -0,0 +1,1528 @@
+/*
+ * 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.
+ */
+
+/**
+ * @fileoverview Provides communication interface to remote v8 debugger. See
+ * protocol decription at http://code.google.com/p/v8/wiki/DebuggerProtocol
+ */
+
+/**
+ * FIXME: change field naming style to use trailing underscore.
+ * @constructor
+ */
+devtools.DebuggerAgent = function()
+{
+ RemoteDebuggerAgent.debuggerOutput = this.handleDebuggerOutput_.bind(this);
+ RemoteDebuggerAgent.setContextId = this.setContextId_.bind(this);
+
+ /**
+ * Id of the inspected page global context. It is used for filtering scripts.
+ * @type {number}
+ */
+ this.contextId_ = null;
+
+ /**
+ * Mapping from script id to script info.
+ * @type {Object}
+ */
+ this.parsedScripts_ = null;
+
+ /**
+ * Mapping from the request id to the devtools.BreakpointInfo for the
+ * breakpoints whose v8 ids are not set yet. These breakpoints are waiting for
+ * "setbreakpoint" responses to learn their ids in the v8 debugger.
+ * @see #handleSetBreakpointResponse_
+ * @type {Object}
+ */
+ this.requestNumberToBreakpointInfo_ = null;
+
+ /**
+ * Information on current stack frames.
+ * @type {Array.<devtools.CallFrame>}
+ */
+ this.callFrames_ = [];
+
+ /**
+ * Whether to stop in the debugger on the exceptions.
+ * @type {boolean}
+ */
+ this.pauseOnExceptions_ = false;
+
+ /**
+ * Mapping: request sequence number->callback.
+ * @type {Object}
+ */
+ this.requestSeqToCallback_ = null;
+
+ /**
+ * Whether the scripts panel has been shown and initialilzed.
+ * @type {boolean}
+ */
+ this.scriptsPanelInitialized_ = false;
+
+ /**
+ * Whether the scripts list should be requested next time when context id is
+ * set.
+ * @type {boolean}
+ */
+ this.requestScriptsWhenContextIdSet_ = false;
+
+ /**
+ * Whether the agent is waiting for initial scripts response.
+ * @type {boolean}
+ */
+ this.waitingForInitialScriptsResponse_ = false;
+
+ /**
+ * If backtrace response is received when initial scripts response
+ * is not yet processed the backtrace handling will be postponed until
+ * after the scripts response processing. The handler bound to its arguments
+ * and this agent will be stored in this field then.
+ * @type {?function()}
+ */
+ this.pendingBacktraceResponseHandler_ = null;
+
+ /**
+ * Container of all breakpoints set using resource URL. These breakpoints
+ * survive page reload. Breakpoints set by script id(for scripts that don't
+ * have URLs) are stored in ScriptInfo objects.
+ * @type {Object}
+ */
+ this.urlToBreakpoints_ = {};
+
+
+ /**
+ * Exception message that is shown to user while on exception break.
+ * @type {WebInspector.ConsoleMessage}
+ */
+ this.currentExceptionMessage_ = null;
+};
+
+
+/**
+ * A copy of the scope types from v8/src/mirror-delay.js
+ * @enum {number}
+ */
+devtools.DebuggerAgent.ScopeType = {
+ Global: 0,
+ Local: 1,
+ With: 2,
+ Closure: 3,
+ Catch: 4
+};
+
+
+/**
+ * Resets debugger agent to its initial state.
+ */
+devtools.DebuggerAgent.prototype.reset = function()
+{
+ this.contextId_ = null;
+ // No need to request scripts since they all will be pushed in AfterCompile
+ // events.
+ this.requestScriptsWhenContextIdSet_ = false;
+ this.waitingForInitialScriptsResponse_ = false;
+
+ this.parsedScripts_ = {};
+ this.requestNumberToBreakpointInfo_ = {};
+ this.callFrames_ = [];
+ this.requestSeqToCallback_ = {};
+};
+
+
+/**
+ * Initializes scripts UI. This method is called every time Scripts panel
+ * is shown. It will send request for context id if it's not set yet.
+ */
+devtools.DebuggerAgent.prototype.initUI = function()
+{
+ // Initialize scripts cache when Scripts panel is shown first time.
+ if (this.scriptsPanelInitialized_)
+ return;
+ this.scriptsPanelInitialized_ = true;
+ if (this.contextId_) {
+ // We already have context id. This means that we are here from the
+ // very beginning of the page load cycle and hence will get all scripts
+ // via after-compile events. No need to request scripts for this session.
+ //
+ // There can be a number of scripts from after-compile events that are
+ // pending addition into the UI.
+ for (var scriptId in this.parsedScripts_) {
+ var script = this.parsedScripts_[scriptId];
+ WebInspector.parsedScriptSource(scriptId, script.getUrl(), undefined /* script source */, script.getLineOffset());
+ }
+ return;
+ }
+ this.waitingForInitialScriptsResponse_ = true;
+ // Script list should be requested only when current context id is known.
+ RemoteDebuggerAgent.getContextId();
+ this.requestScriptsWhenContextIdSet_ = true;
+};
+
+
+/**
+ * Asynchronously requests the debugger for the script source.
+ * @param {number} scriptId Id of the script whose source should be resolved.
+ * @param {function(source:?string):void} callback Function that will be called
+ * when the source resolution is completed. "source" parameter will be null
+ * if the resolution fails.
+ */
+devtools.DebuggerAgent.prototype.resolveScriptSource = function(scriptId, callback)
+{
+ var script = this.parsedScripts_[scriptId];
+ if (!script || script.isUnresolved()) {
+ callback(null);
+ return;
+ }
+
+ var cmd = new devtools.DebugCommand("scripts", {
+ "ids": [scriptId],
+ "includeSource": true
+ });
+ devtools.DebuggerAgent.sendCommand_(cmd);
+ // Force v8 execution so that it gets to processing the requested command.
+ RemoteDebuggerAgent.processDebugCommands();
+
+ this.requestSeqToCallback_[cmd.getSequenceNumber()] = function(msg) {
+ if (msg.isSuccess()) {
+ var scriptJson = msg.getBody()[0];
+ if (scriptJson)
+ callback(scriptJson.source);
+ else
+ callback(null);
+ } else
+ callback(null);
+ };
+};
+
+
+/**
+ * Tells the v8 debugger to stop on as soon as possible.
+ */
+devtools.DebuggerAgent.prototype.pauseExecution = function()
+{
+ RemoteDebuggerCommandExecutor.DebuggerPauseScript();
+};
+
+
+/**
+ * @param {number} sourceId Id of the script fot the breakpoint.
+ * @param {number} line Number of the line for the breakpoint.
+ * @param {?string} condition The breakpoint condition.
+ */
+devtools.DebuggerAgent.prototype.addBreakpoint = function(sourceId, line, condition)
+{
+ var script = this.parsedScripts_[sourceId];
+ if (!script)
+ return;
+
+ line = devtools.DebuggerAgent.webkitToV8LineNumber_(line);
+
+ var commandArguments;
+ if (script.getUrl()) {
+ var breakpoints = this.urlToBreakpoints_[script.getUrl()];
+ if (breakpoints && breakpoints[line])
+ return;
+ if (!breakpoints) {
+ breakpoints = {};
+ this.urlToBreakpoints_[script.getUrl()] = breakpoints;
+ }
+
+ var breakpointInfo = new devtools.BreakpointInfo(line);
+ breakpoints[line] = breakpointInfo;
+
+ commandArguments = {
+ "groupId": this.contextId_,
+ "type": "script",
+ "target": script.getUrl(),
+ "line": line,
+ "condition": condition
+ };
+ } else {
+ var breakpointInfo = script.getBreakpointInfo(line);
+ if (breakpointInfo)
+ return;
+
+ breakpointInfo = new devtools.BreakpointInfo(line);
+ script.addBreakpointInfo(breakpointInfo);
+
+ commandArguments = {
+ "groupId": this.contextId_,
+ "type": "scriptId",
+ "target": sourceId,
+ "line": line,
+ "condition": condition
+ };
+ }
+
+ var cmd = new devtools.DebugCommand("setbreakpoint", commandArguments);
+
+ this.requestNumberToBreakpointInfo_[cmd.getSequenceNumber()] = breakpointInfo;
+
+ devtools.DebuggerAgent.sendCommand_(cmd);
+ // Force v8 execution so that it gets to processing the requested command.
+ // It is necessary for being able to change a breakpoint just after it
+ // has been created (since we need an existing breakpoint id for that).
+ RemoteDebuggerAgent.processDebugCommands();
+};
+
+
+/**
+ * @param {number} sourceId Id of the script for the breakpoint.
+ * @param {number} line Number of the line for the breakpoint.
+ */
+devtools.DebuggerAgent.prototype.removeBreakpoint = function(sourceId, line)
+{
+ var script = this.parsedScripts_[sourceId];
+ if (!script)
+ return;
+
+ line = devtools.DebuggerAgent.webkitToV8LineNumber_(line);
+
+ var breakpointInfo;
+ if (script.getUrl()) {
+ var breakpoints = this.urlToBreakpoints_[script.getUrl()];
+ breakpointInfo = breakpoints[line];
+ delete breakpoints[line];
+ } else {
+ breakpointInfo = script.getBreakpointInfo(line);
+ if (breakpointInfo)
+ script.removeBreakpointInfo(breakpointInfo);
+ }
+
+ if (!breakpointInfo)
+ return;
+
+ breakpointInfo.markAsRemoved();
+
+ var id = breakpointInfo.getV8Id();
+
+ // If we don't know id of this breakpoint in the v8 debugger we cannot send
+ // "clearbreakpoint" request. In that case it will be removed in
+ // "setbreakpoint" response handler when we learn the id.
+ if (id !== -1) {
+ this.requestClearBreakpoint_(id);
+ }
+};
+
+
+/**
+ * @param {number} sourceId Id of the script for the breakpoint.
+ * @param {number} line Number of the line for the breakpoint.
+ * @param {?string} condition New breakpoint condition.
+ */
+devtools.DebuggerAgent.prototype.updateBreakpoint = function(sourceId, line, condition)
+{
+ var script = this.parsedScripts_[sourceId];
+ if (!script)
+ return;
+
+ line = devtools.DebuggerAgent.webkitToV8LineNumber_(line);
+
+ var breakpointInfo;
+ if (script.getUrl()) {
+ var breakpoints = this.urlToBreakpoints_[script.getUrl()];
+ breakpointInfo = breakpoints[line];
+ } else
+ breakpointInfo = script.getBreakpointInfo(line);
+
+ var id = breakpointInfo.getV8Id();
+
+ // If we don't know id of this breakpoint in the v8 debugger we cannot send
+ // the "changebreakpoint" request.
+ if (id !== -1) {
+ // TODO(apavlov): make use of the real values for "enabled" and
+ // "ignoreCount" when appropriate.
+ this.requestChangeBreakpoint_(id, true, condition, null);
+ }
+};
+
+
+/**
+ * Tells the v8 debugger to step into the next statement.
+ */
+devtools.DebuggerAgent.prototype.stepIntoStatement = function()
+{
+ this.stepCommand_("in");
+};
+
+
+/**
+ * Tells the v8 debugger to step out of current function.
+ */
+devtools.DebuggerAgent.prototype.stepOutOfFunction = function()
+{
+ this.stepCommand_("out");
+};
+
+
+/**
+ * Tells the v8 debugger to step over the next statement.
+ */
+devtools.DebuggerAgent.prototype.stepOverStatement = function()
+{
+ this.stepCommand_("next");
+};
+
+
+/**
+ * Tells the v8 debugger to continue execution after it has been stopped on a
+ * breakpoint or an exception.
+ */
+devtools.DebuggerAgent.prototype.resumeExecution = function()
+{
+ this.clearExceptionMessage_();
+ var cmd = new devtools.DebugCommand("continue");
+ devtools.DebuggerAgent.sendCommand_(cmd);
+};
+
+
+/**
+ * Creates exception message and schedules it for addition to the resource upon
+ * backtrace availability.
+ * @param {string} url Resource url.
+ * @param {number} line Resource line number.
+ * @param {string} message Exception text.
+ */
+devtools.DebuggerAgent.prototype.createExceptionMessage_ = function(url, line, message)
+{
+ this.currentExceptionMessage_ = new WebInspector.ConsoleMessage(
+ WebInspector.ConsoleMessage.MessageSource.JS,
+ WebInspector.ConsoleMessage.MessageType.Log,
+ WebInspector.ConsoleMessage.MessageLevel.Error,
+ line,
+ url,
+ 0 /* group level */,
+ 1 /* repeat count */,
+ "[Exception] " + message);
+};
+
+
+/**
+ * Shows pending exception message that is created with createExceptionMessage_
+ * earlier.
+ */
+devtools.DebuggerAgent.prototype.showPendingExceptionMessage_ = function()
+{
+ if (!this.currentExceptionMessage_)
+ return;
+ var msg = this.currentExceptionMessage_;
+ var resource = WebInspector.resourceURLMap[msg.url];
+ if (resource) {
+ msg.resource = resource;
+ WebInspector.panels.resources.addMessageToResource(resource, msg);
+ } else
+ this.currentExceptionMessage_ = null;
+};
+
+
+/**
+ * Clears exception message from the resource.
+ */
+devtools.DebuggerAgent.prototype.clearExceptionMessage_ = function()
+{
+ if (this.currentExceptionMessage_) {
+ var messageElement = this.currentExceptionMessage_._resourceMessageLineElement;
+ var bubble = messageElement.parentElement;
+ bubble.removeChild(messageElement);
+ if (!bubble.firstChild) {
+ // Last message in bubble removed.
+ bubble.parentElement.removeChild(bubble);
+ }
+ this.currentExceptionMessage_ = null;
+ }
+};
+
+
+/**
+ * @return {boolean} True iff the debugger will pause execution on the
+ * exceptions.
+ */
+devtools.DebuggerAgent.prototype.pauseOnExceptions = function()
+{
+ return this.pauseOnExceptions_;
+};
+
+
+/**
+ * Tells whether to pause in the debugger on the exceptions or not.
+ * @param {boolean} value True iff execution should be stopped in the debugger
+ * on the exceptions.
+ */
+devtools.DebuggerAgent.prototype.setPauseOnExceptions = function(value)
+{
+ this.pauseOnExceptions_ = value;
+};
+
+
+/**
+ * Sends "evaluate" request to the debugger.
+ * @param {Object} arguments Request arguments map.
+ * @param {function(devtools.DebuggerMessage)} callback Callback to be called
+ * when response is received.
+ */
+devtools.DebuggerAgent.prototype.requestEvaluate = function(arguments, callback)
+{
+ var cmd = new devtools.DebugCommand("evaluate", arguments);
+ devtools.DebuggerAgent.sendCommand_(cmd);
+ this.requestSeqToCallback_[cmd.getSequenceNumber()] = callback;
+};
+
+
+/**
+ * Sends "lookup" request for each unresolved property of the object. When
+ * response is received the properties will be changed with their resolved
+ * values.
+ * @param {Object} object Object whose properties should be resolved.
+ * @param {function(devtools.DebuggerMessage)} Callback to be called when all
+ * children are resolved.
+ * @param {boolean} noIntrinsic Whether intrinsic properties should be included.
+ */
+devtools.DebuggerAgent.prototype.resolveChildren = function(object, callback, noIntrinsic)
+{
+ if ("handle" in object) {
+ var result = [];
+ devtools.DebuggerAgent.formatObjectProperties_(object, result, noIntrinsic);
+ callback(result);
+ } else {
+ this.requestLookup_([object.ref], function(msg) {
+ var result = [];
+ if (msg.isSuccess()) {
+ var handleToObject = msg.getBody();
+ var resolved = handleToObject[object.ref];
+ devtools.DebuggerAgent.formatObjectProperties_(resolved, result, noIntrinsic);
+ callback(result);
+ } else
+ callback([]);
+ });
+ }
+};
+
+
+/**
+ * Sends "scope" request for the scope object to resolve its variables.
+ * @param {Object} scope Scope to be resolved.
+ * @param {function(Array.<WebInspector.ObjectPropertyProxy>)} callback
+ * Callback to be called when all scope variables are resolved.
+ */
+devtools.DebuggerAgent.prototype.resolveScope = function(scope, callback)
+{
+ var cmd = new devtools.DebugCommand("scope", {
+ "frameNumber": scope.frameNumber,
+ "number": scope.index,
+ "compactFormat": true
+ });
+ devtools.DebuggerAgent.sendCommand_(cmd);
+ this.requestSeqToCallback_[cmd.getSequenceNumber()] = function(msg) {
+ var result = [];
+ if (msg.isSuccess()) {
+ var scopeObjectJson = msg.getBody().object;
+ devtools.DebuggerAgent.formatObjectProperties_(scopeObjectJson, result, true /* no intrinsic */);
+ }
+ callback(result);
+ };
+};
+
+
+/**
+ * Sends "scopes" request for the frame object to resolve all variables
+ * available in the frame.
+ * @param {number} callFrameId Id of call frame whose variables need to
+ * be resolved.
+ * @param {function(Object)} callback Callback to be called when all frame
+ * variables are resolved.
+ */
+devtools.DebuggerAgent.prototype.resolveFrameVariables_ = function(callFrameId, callback)
+{
+ var result = {};
+
+ var frame = this.callFrames_[callFrameId];
+ if (!frame) {
+ callback(result);
+ return;
+ }
+
+ var waitingResponses = 0;
+ function scopeResponseHandler(msg) {
+ waitingResponses--;
+
+ if (msg.isSuccess()) {
+ var properties = msg.getBody().object.properties;
+ for (var j = 0; j < properties.length; j++)
+ result[properties[j].name] = true;
+ }
+
+ // When all scopes are resolved invoke the callback.
+ if (waitingResponses === 0)
+ callback(result);
+ };
+
+ for (var i = 0; i < frame.scopeChain.length; i++) {
+ var scope = frame.scopeChain[i].objectId;
+ if (scope.type === devtools.DebuggerAgent.ScopeType.Global) {
+ // Do not resolve global scope since it takes for too long.
+ // TODO(yurys): allow to send only property names in the response.
+ continue;
+ }
+ var cmd = new devtools.DebugCommand("scope", {
+ "frameNumber": scope.frameNumber,
+ "number": scope.index,
+ "compactFormat": true
+ });
+ devtools.DebuggerAgent.sendCommand_(cmd);
+ this.requestSeqToCallback_[cmd.getSequenceNumber()] = scopeResponseHandler;
+ waitingResponses++;
+ }
+};
+
+/**
+ * Evaluates the expressionString to an object in the call frame and reports
+ * all its properties.
+ * @param{string} expressionString Expression whose properties should be
+ * collected.
+ * @param{number} callFrameId The frame id.
+ * @param{function(Object result,bool isException)} reportCompletions Callback
+ * function.
+ */
+devtools.DebuggerAgent.prototype.resolveCompletionsOnFrame = function(expressionString, callFrameId, reportCompletions)
+{
+ if (expressionString) {
+ expressionString = "var obj = " + expressionString +
+ "; var names = {}; for (var n in obj) { names[n] = true; };" +
+ "names;";
+ this.evaluateInCallFrame(
+ callFrameId,
+ expressionString,
+ function(result) {
+ var names = {};
+ if (!result.isException) {
+ var props = result.value.objectId.properties;
+ // Put all object properties into the map.
+ for (var i = 0; i < props.length; i++)
+ names[props[i].name] = true;
+ }
+ reportCompletions(names, result.isException);
+ });
+ } else {
+ this.resolveFrameVariables_(callFrameId,
+ function(result) {
+ reportCompletions(result, false /* isException */);
+ });
+ }
+};
+
+
+/**
+ * @param{number} scriptId
+ * @return {string} Type of the context of the script with specified id.
+ */
+devtools.DebuggerAgent.prototype.getScriptContextType = function(scriptId)
+{
+ return this.parsedScripts_[scriptId].getContextType();
+};
+
+
+/**
+ * Removes specified breakpoint from the v8 debugger.
+ * @param {number} breakpointId Id of the breakpoint in the v8 debugger.
+ */
+devtools.DebuggerAgent.prototype.requestClearBreakpoint_ = function(breakpointId)
+{
+ var cmd = new devtools.DebugCommand("clearbreakpoint", {
+ "breakpoint": breakpointId
+ });
+ devtools.DebuggerAgent.sendCommand_(cmd);
+};
+
+
+/**
+ * Changes breakpoint parameters in the v8 debugger.
+ * @param {number} breakpointId Id of the breakpoint in the v8 debugger.
+ * @param {boolean} enabled Whether to enable the breakpoint.
+ * @param {?string} condition New breakpoint condition.
+ * @param {number} ignoreCount New ignore count for the breakpoint.
+ */
+devtools.DebuggerAgent.prototype.requestChangeBreakpoint_ = function(breakpointId, enabled, condition, ignoreCount)
+{
+ var cmd = new devtools.DebugCommand("changebreakpoint", {
+ "breakpoint": breakpointId,
+ "enabled": enabled,
+ "condition": condition,
+ "ignoreCount": ignoreCount
+ });
+ devtools.DebuggerAgent.sendCommand_(cmd);
+};
+
+
+/**
+ * Sends "backtrace" request to v8.
+ */
+devtools.DebuggerAgent.prototype.requestBacktrace_ = function()
+{
+ var cmd = new devtools.DebugCommand("backtrace", {
+ "compactFormat":true
+ });
+ devtools.DebuggerAgent.sendCommand_(cmd);
+};
+
+
+/**
+ * Sends command to v8 debugger.
+ * @param {devtools.DebugCommand} cmd Command to execute.
+ */
+devtools.DebuggerAgent.sendCommand_ = function(cmd)
+{
+ RemoteDebuggerCommandExecutor.DebuggerCommand(cmd.toJSONProtocol());
+};
+
+
+/**
+ * Tells the v8 debugger to make the next execution step.
+ * @param {string} action "in", "out" or "next" action.
+ */
+devtools.DebuggerAgent.prototype.stepCommand_ = function(action)
+{
+ this.clearExceptionMessage_();
+ var cmd = new devtools.DebugCommand("continue", {
+ "stepaction": action,
+ "stepcount": 1
+ });
+ devtools.DebuggerAgent.sendCommand_(cmd);
+};
+
+
+/**
+ * Sends "lookup" request to v8.
+ * @param {number} handle Handle to the object to lookup.
+ */
+devtools.DebuggerAgent.prototype.requestLookup_ = function(handles, callback)
+{
+ var cmd = new devtools.DebugCommand("lookup", {
+ "compactFormat":true,
+ "handles": handles
+ });
+ devtools.DebuggerAgent.sendCommand_(cmd);
+ this.requestSeqToCallback_[cmd.getSequenceNumber()] = callback;
+};
+
+
+/**
+ * Sets debugger context id for scripts filtering.
+ * @param {number} contextId Id of the inspected page global context.
+ */
+devtools.DebuggerAgent.prototype.setContextId_ = function(contextId)
+{
+ this.contextId_ = contextId;
+
+ // If it's the first time context id is set request scripts list.
+ if (this.requestScriptsWhenContextIdSet_) {
+ this.requestScriptsWhenContextIdSet_ = false;
+ var cmd = new devtools.DebugCommand("scripts", {
+ "includeSource": false
+ });
+ devtools.DebuggerAgent.sendCommand_(cmd);
+ // Force v8 execution so that it gets to processing the requested command.
+ RemoteDebuggerAgent.processDebugCommands();
+
+ var debuggerAgent = this;
+ this.requestSeqToCallback_[cmd.getSequenceNumber()] = function(msg) {
+ // Handle the response iff the context id hasn't changed since the request
+ // was issued. Otherwise if the context id did change all up-to-date
+ // scripts will be pushed in after compile events and there is no need to
+ // handle the response.
+ if (contextId === debuggerAgent.contextId_)
+ debuggerAgent.handleScriptsResponse_(msg);
+
+ // We received initial scripts response so flush the flag and
+ // see if there is an unhandled backtrace response.
+ debuggerAgent.waitingForInitialScriptsResponse_ = false;
+ if (debuggerAgent.pendingBacktraceResponseHandler_) {
+ debuggerAgent.pendingBacktraceResponseHandler_();
+ debuggerAgent.pendingBacktraceResponseHandler_ = null;
+ }
+ };
+ }
+};
+
+
+/**
+ * Handles output sent by v8 debugger. The output is either asynchronous event
+ * or response to a previously sent request. See protocol definitioun for more
+ * details on the output format.
+ * @param {string} output
+ */
+devtools.DebuggerAgent.prototype.handleDebuggerOutput_ = function(output)
+{
+ var msg;
+ try {
+ msg = new devtools.DebuggerMessage(output);
+ } catch(e) {
+ debugPrint("Failed to handle debugger response:\n" + e);
+ throw e;
+ }
+
+ if (msg.getType() === "event") {
+ if (msg.getEvent() === "break")
+ this.handleBreakEvent_(msg);
+ else if (msg.getEvent() === "exception")
+ this.handleExceptionEvent_(msg);
+ else if (msg.getEvent() === "afterCompile")
+ this.handleAfterCompileEvent_(msg);
+ } else if (msg.getType() === "response") {
+ if (msg.getCommand() === "scripts")
+ this.invokeCallbackForResponse_(msg);
+ else if (msg.getCommand() === "setbreakpoint")
+ this.handleSetBreakpointResponse_(msg);
+ else if (msg.getCommand() === "clearbreakpoint")
+ this.handleClearBreakpointResponse_(msg);
+ else if (msg.getCommand() === "backtrace")
+ this.handleBacktraceResponse_(msg);
+ else if (msg.getCommand() === "lookup")
+ this.invokeCallbackForResponse_(msg);
+ else if (msg.getCommand() === "evaluate")
+ this.invokeCallbackForResponse_(msg);
+ else if (msg.getCommand() === "scope")
+ this.invokeCallbackForResponse_(msg);
+ }
+};
+
+
+/**
+ * @param {devtools.DebuggerMessage} msg
+ */
+devtools.DebuggerAgent.prototype.handleBreakEvent_ = function(msg)
+{
+ // Force scrips panel to be shown first.
+ WebInspector.currentPanel = WebInspector.panels.scripts;
+
+ var body = msg.getBody();
+
+ var line = devtools.DebuggerAgent.v8ToWwebkitLineNumber_(body.sourceLine);
+ this.requestBacktrace_();
+};
+
+
+/**
+ * @param {devtools.DebuggerMessage} msg
+ */
+devtools.DebuggerAgent.prototype.handleExceptionEvent_ = function(msg)
+{
+ // Force scrips panel to be shown first.
+ WebInspector.currentPanel = WebInspector.panels.scripts;
+
+ var body = msg.getBody();
+ // No script field in the body means that v8 failed to parse the script. We
+ // resume execution on parser errors automatically.
+ if (this.pauseOnExceptions_ && body.script) {
+ var line = devtools.DebuggerAgent.v8ToWwebkitLineNumber_(body.sourceLine);
+ this.createExceptionMessage_(body.script.name, line, body.exception.text);
+ this.requestBacktrace_();
+ } else
+ this.resumeExecution();
+};
+
+
+/**
+ * @param {devtools.DebuggerMessage} msg
+ */
+devtools.DebuggerAgent.prototype.handleScriptsResponse_ = function(msg)
+{
+ var scripts = msg.getBody();
+ for (var i = 0; i < scripts.length; i++) {
+ var script = scripts[i];
+
+ // Skip scripts from other tabs.
+ if (!this.isScriptFromInspectedContext_(script, msg))
+ continue;
+
+ // We may already have received the info in an afterCompile event.
+ if (script.id in this.parsedScripts_)
+ continue;
+ this.addScriptInfo_(script, msg);
+ }
+};
+
+
+/**
+ * @param {Object} script Json object representing script.
+ * @param {devtools.DebuggerMessage} msg Debugger response.
+ */
+devtools.DebuggerAgent.prototype.isScriptFromInspectedContext_ = function(script, msg)
+{
+ if (!script.context) {
+ // Always ignore scripts from the utility context.
+ return false;
+ }
+ var context = msg.lookup(script.context.ref);
+ var scriptContextId = context.data;
+ if (typeof scriptContextId === "undefined")
+ return false; // Always ignore scripts from the utility context.
+ if (this.contextId_ === null)
+ return true;
+ // Find the id from context data. The context data has the format "type,id".
+ var comma = context.data.indexOf(",");
+ if (comma < 0)
+ return false;
+ return (context.data.substring(comma + 1) == this.contextId_);
+};
+
+
+/**
+ * @param {devtools.DebuggerMessage} msg
+ */
+devtools.DebuggerAgent.prototype.handleSetBreakpointResponse_ = function(msg)
+{
+ var requestSeq = msg.getRequestSeq();
+ var breakpointInfo = this.requestNumberToBreakpointInfo_[requestSeq];
+ if (!breakpointInfo) {
+ // TODO(yurys): handle this case
+ return;
+ }
+ delete this.requestNumberToBreakpointInfo_[requestSeq];
+ if (!msg.isSuccess()) {
+ // TODO(yurys): handle this case
+ return;
+ }
+ var idInV8 = msg.getBody().breakpoint;
+ breakpointInfo.setV8Id(idInV8);
+
+ if (breakpointInfo.isRemoved())
+ this.requestClearBreakpoint_(idInV8);
+};
+
+
+/**
+ * @param {devtools.DebuggerMessage} msg
+ */
+devtools.DebuggerAgent.prototype.handleAfterCompileEvent_ = function(msg)
+{
+ if (!this.contextId_) {
+ // Ignore scripts delta if main request has not been issued yet.
+ return;
+ }
+ var script = msg.getBody().script;
+
+ // Ignore scripts from other tabs.
+ if (!this.isScriptFromInspectedContext_(script, msg))
+ return;
+ this.addScriptInfo_(script, msg);
+};
+
+
+/**
+ * Adds the script info to the local cache. This method assumes that the script
+ * is not in the cache yet.
+ * @param {Object} script Script json object from the debugger message.
+ * @param {devtools.DebuggerMessage} msg Debugger message containing the script
+ * data.
+ */
+devtools.DebuggerAgent.prototype.addScriptInfo_ = function(script, msg)
+{
+ var context = msg.lookup(script.context.ref);
+ var contextType;
+ // Find the type from context data. The context data has the format
+ // "type,id".
+ var comma = context.data.indexOf(",");
+ if (comma < 0)
+ return
+ contextType = context.data.substring(0, comma);
+ this.parsedScripts_[script.id] = new devtools.ScriptInfo(script.id, script.name, script.lineOffset, contextType);
+ if (this.scriptsPanelInitialized_) {
+ // Only report script as parsed after scripts panel has been shown.
+ WebInspector.parsedScriptSource(script.id, script.name, script.source, script.lineOffset);
+ }
+};
+
+
+/**
+ * @param {devtools.DebuggerMessage} msg
+ */
+devtools.DebuggerAgent.prototype.handleClearBreakpointResponse_ = function(msg)
+{
+ // Do nothing.
+};
+
+
+/**
+ * Handles response to "backtrace" command.
+ * @param {devtools.DebuggerMessage} msg
+ */
+devtools.DebuggerAgent.prototype.handleBacktraceResponse_ = function(msg)
+{
+ if (this.waitingForInitialScriptsResponse_)
+ this.pendingBacktraceResponseHandler_ = this.doHandleBacktraceResponse_.bind(this, msg);
+ else
+ this.doHandleBacktraceResponse_(msg);
+};
+
+
+/**
+ * @param {devtools.DebuggerMessage} msg
+ */
+devtools.DebuggerAgent.prototype.doHandleBacktraceResponse_ = function(msg)
+{
+ var frames = msg.getBody().frames;
+ this.callFrames_ = [];
+ for (var i = 0; i < frames.length; ++i)
+ this.callFrames_.push(this.formatCallFrame_(frames[i]));
+ WebInspector.pausedScript(this.callFrames_);
+ this.showPendingExceptionMessage_();
+ InspectorFrontendHost.activateWindow();
+};
+
+
+/**
+ * Evaluates code on given callframe.
+ */
+devtools.DebuggerAgent.prototype.evaluateInCallFrame = function(callFrameId, code, callback)
+{
+ var callFrame = this.callFrames_[callFrameId];
+ callFrame.evaluate_(code, callback);
+};
+
+
+/**
+ * Handles response to a command by invoking its callback (if any).
+ * @param {devtools.DebuggerMessage} msg
+ * @return {boolean} Whether a callback for the given message was found and
+ * excuted.
+ */
+devtools.DebuggerAgent.prototype.invokeCallbackForResponse_ = function(msg)
+{
+ var callback = this.requestSeqToCallback_[msg.getRequestSeq()];
+ if (!callback) {
+ // It may happend if reset was called.
+ return false;
+ }
+ delete this.requestSeqToCallback_[msg.getRequestSeq()];
+ callback(msg);
+ return true;
+};
+
+
+/**
+ * @param {Object} stackFrame Frame json object from "backtrace" response.
+ * @return {!devtools.CallFrame} Object containing information related to the
+ * call frame in the format expected by ScriptsPanel and its panes.
+ */
+devtools.DebuggerAgent.prototype.formatCallFrame_ = function(stackFrame)
+{
+ var func = stackFrame.func;
+ var sourceId = func.scriptId;
+
+ // Add service script if it does not exist.
+ var existingScript = this.parsedScripts_[sourceId];
+ if (!existingScript) {
+ this.parsedScripts_[sourceId] = new devtools.ScriptInfo(sourceId, null /* name */, 0 /* line */, "unknown" /* type */, true /* unresolved */);
+ WebInspector.parsedScriptSource(sourceId, null, null, 0);
+ }
+
+ var funcName = func.name || func.inferredName || "(anonymous function)";
+ var line = devtools.DebuggerAgent.v8ToWwebkitLineNumber_(stackFrame.line);
+
+ // Add basic scope chain info with scope variables.
+ var scopeChain = [];
+ var ScopeType = devtools.DebuggerAgent.ScopeType;
+ for (var i = 0; i < stackFrame.scopes.length; i++) {
+ var scope = stackFrame.scopes[i];
+ scope.frameNumber = stackFrame.index;
+ var scopeObjectProxy = new WebInspector.ObjectProxy(0, scope, [], 0, "", true);
+ scopeObjectProxy.isScope = true;
+ switch(scope.type) {
+ case ScopeType.Global:
+ scopeObjectProxy.isDocument = true;
+ break;
+ case ScopeType.Local:
+ scopeObjectProxy.isLocal = true;
+ scopeObjectProxy.thisObject = devtools.DebuggerAgent.formatObjectProxy_(stackFrame.receiver);
+ break;
+ case ScopeType.With:
+ // Catch scope is treated as a regular with scope by WebKit so we
+ // also treat it this way.
+ case ScopeType.Catch:
+ scopeObjectProxy.isWithBlock = true;
+ break;
+ case ScopeType.Closure:
+ scopeObjectProxy.isClosure = true;
+ break;
+ }
+ scopeChain.push(scopeObjectProxy);
+ }
+ return new devtools.CallFrame(stackFrame.index, "function", funcName, sourceId, line, scopeChain);
+};
+
+
+/**
+ * Collects properties for an object from the debugger response.
+ * @param {Object} object An object from the debugger protocol response.
+ * @param {Array.<WebInspector.ObjectPropertyProxy>} result An array to put the
+ * properties into.
+ * @param {boolean} noIntrinsic Whether intrinsic properties should be
+ * included.
+ */
+devtools.DebuggerAgent.formatObjectProperties_ = function(object, result, noIntrinsic)
+{
+ devtools.DebuggerAgent.propertiesToProxies_(object.properties, result);
+ if (noIntrinsic)
+ return;
+
+ result.push(new WebInspector.ObjectPropertyProxy("__proto__", devtools.DebuggerAgent.formatObjectProxy_(object.protoObject)));
+ result.push(new WebInspector.ObjectPropertyProxy("constructor", devtools.DebuggerAgent.formatObjectProxy_(object.constructorFunction)));
+ // Don't add 'prototype' property since it is one of the regualar properties.
+};
+
+
+/**
+ * For each property in "properties" creates its proxy representative.
+ * @param {Array.<Object>} properties Receiver properties or locals array from
+ * "backtrace" response.
+ * @param {Array.<WebInspector.ObjectPropertyProxy>} Results holder.
+ */
+devtools.DebuggerAgent.propertiesToProxies_ = function(properties, result)
+{
+ var map = {};
+ for (var i = 0; i < properties.length; ++i) {
+ var property = properties[i];
+ var name = String(property.name);
+ if (name in map)
+ continue;
+ map[name] = true;
+ var value = devtools.DebuggerAgent.formatObjectProxy_(property.value);
+ var propertyProxy = new WebInspector.ObjectPropertyProxy(name, value);
+ result.push(propertyProxy);
+ }
+};
+
+
+/**
+ * @param {Object} v An object reference from the debugger response.
+ * @return {*} The value representation expected by ScriptsPanel.
+ */
+devtools.DebuggerAgent.formatObjectProxy_ = function(v)
+{
+ var description;
+ var hasChildren = false;
+ if (v.type === "object") {
+ description = v.className;
+ hasChildren = true;
+ } else if (v.type === "function") {
+ if (v.source)
+ description = v.source;
+ else
+ description = "function " + v.name + "()";
+ hasChildren = true;
+ } else if (v.type === "undefined")
+ description = "undefined";
+ else if (v.type === "null")
+ description = "null";
+ else if (typeof v.value !== "undefined") {
+ // Check for undefined and null types before checking the value, otherwise
+ // null/undefined may have blank value.
+ description = v.value;
+ } else
+ description = "<unresolved ref: " + v.ref + ", type: " + v.type + ">";
+
+ var proxy = new WebInspector.ObjectProxy(0, v, [], 0, description, hasChildren);
+ proxy.type = v.type;
+ proxy.isV8Ref = true;
+ return proxy;
+};
+
+
+/**
+ * Converts line number from Web Inspector UI(1-based) to v8(0-based).
+ * @param {number} line Resource line number in Web Inspector UI.
+ * @return {number} The line number in v8.
+ */
+devtools.DebuggerAgent.webkitToV8LineNumber_ = function(line)
+{
+ return line - 1;
+};
+
+
+/**
+ * Converts line number from v8(0-based) to Web Inspector UI(1-based).
+ * @param {number} line Resource line number in v8.
+ * @return {number} The line number in Web Inspector.
+ */
+devtools.DebuggerAgent.v8ToWwebkitLineNumber_ = function(line)
+{
+ return line + 1;
+};
+
+
+/**
+ * @param {number} scriptId Id of the script.
+ * @param {?string} url Script resource URL if any.
+ * @param {number} lineOffset First line 0-based offset in the containing
+ * document.
+ * @param {string} contextType Type of the script's context:
+ * "page" - regular script from html page
+ * "injected" - extension content script
+ * @param {bool} opt_isUnresolved If true, script will not be resolved.
+ * @constructor
+ */
+devtools.ScriptInfo = function(scriptId, url, lineOffset, contextType, opt_isUnresolved)
+{
+ this.scriptId_ = scriptId;
+ this.lineOffset_ = lineOffset;
+ this.contextType_ = contextType;
+ this.url_ = url;
+ this.isUnresolved_ = opt_isUnresolved;
+
+ this.lineToBreakpointInfo_ = {};
+};
+
+
+/**
+ * @return {number}
+ */
+devtools.ScriptInfo.prototype.getLineOffset = function()
+{
+ return this.lineOffset_;
+};
+
+
+/**
+ * @return {string}
+ */
+devtools.ScriptInfo.prototype.getContextType = function()
+{
+ return this.contextType_;
+};
+
+
+/**
+ * @return {?string}
+ */
+devtools.ScriptInfo.prototype.getUrl = function()
+{
+ return this.url_;
+};
+
+
+/**
+ * @return {?bool}
+ */
+devtools.ScriptInfo.prototype.isUnresolved = function()
+{
+ return this.isUnresolved_;
+};
+
+
+/**
+ * @param {number} line 0-based line number in the script.
+ * @return {?devtools.BreakpointInfo} Information on a breakpoint at the
+ * specified line in the script or undefined if there is no breakpoint at
+ * that line.
+ */
+devtools.ScriptInfo.prototype.getBreakpointInfo = function(line)
+{
+ return this.lineToBreakpointInfo_[line];
+};
+
+
+/**
+ * Adds breakpoint info to the script.
+ * @param {devtools.BreakpointInfo} breakpoint
+ */
+devtools.ScriptInfo.prototype.addBreakpointInfo = function(breakpoint)
+{
+ this.lineToBreakpointInfo_[breakpoint.getLine()] = breakpoint;
+};
+
+
+/**
+ * @param {devtools.BreakpointInfo} breakpoint Breakpoint info to be removed.
+ */
+devtools.ScriptInfo.prototype.removeBreakpointInfo = function(breakpoint)
+{
+ var line = breakpoint.getLine();
+ delete this.lineToBreakpointInfo_[line];
+};
+
+
+
+/**
+ * @param {number} line Breakpoint 0-based line number in the containing script.
+ * @constructor
+ */
+devtools.BreakpointInfo = function(line)
+{
+ this.line_ = line;
+ this.v8id_ = -1;
+ this.removed_ = false;
+};
+
+
+/**
+ * @return {number}
+ */
+devtools.BreakpointInfo.prototype.getLine = function(n)
+{
+ return this.line_;
+};
+
+
+/**
+ * @return {number} Unique identifier of this breakpoint in the v8 debugger.
+ */
+devtools.BreakpointInfo.prototype.getV8Id = function(n)
+{
+ return this.v8id_;
+};
+
+
+/**
+ * Sets id of this breakpoint in the v8 debugger.
+ * @param {number} id
+ */
+devtools.BreakpointInfo.prototype.setV8Id = function(id)
+{
+ this.v8id_ = id;
+};
+
+
+/**
+ * Marks this breakpoint as removed from the front-end.
+ */
+devtools.BreakpointInfo.prototype.markAsRemoved = function()
+{
+ this.removed_ = true;
+};
+
+
+/**
+ * @return {boolean} Whether this breakpoint has been removed from the
+ * front-end.
+ */
+devtools.BreakpointInfo.prototype.isRemoved = function()
+{
+ return this.removed_;
+};
+
+
+/**
+ * Call stack frame data.
+ * @param {string} id CallFrame id.
+ * @param {string} type CallFrame type.
+ * @param {string} functionName CallFrame type.
+ * @param {string} sourceID Source id.
+ * @param {number} line Source line.
+ * @param {Array.<Object>} scopeChain Array of scoped objects.
+ * @construnctor
+ */
+devtools.CallFrame = function(id, type, functionName, sourceID, line, scopeChain)
+{
+ this.id = id;
+ this.type = type;
+ this.functionName = functionName;
+ this.sourceID = sourceID;
+ this.line = line;
+ this.scopeChain = scopeChain;
+};
+
+
+/**
+ * This method issues asynchronous evaluate request, reports result to the
+ * callback.
+ * @param {string} expression An expression to be evaluated in the context of
+ * this call frame.
+ * @param {function(Object):undefined} callback Callback to report result to.
+ */
+devtools.CallFrame.prototype.evaluate_ = function(expression, callback)
+{
+ devtools.tools.getDebuggerAgent().requestEvaluate({
+ "expression": expression,
+ "frame": this.id,
+ "global": false,
+ "disable_break": false,
+ "compactFormat": true
+ },
+ function(response) {
+ var result = {};
+ if (response.isSuccess())
+ result.value = devtools.DebuggerAgent.formatObjectProxy_(response.getBody());
+ else {
+ result.value = response.getMessage();
+ result.isException = true;
+ }
+ callback(result);
+ });
+};
+
+
+/**
+ * JSON based commands sent to v8 debugger.
+ * @param {string} command Name of the command to execute.
+ * @param {Object} opt_arguments Command-specific arguments map.
+ * @constructor
+ */
+devtools.DebugCommand = function(command, opt_arguments)
+{
+ this.command_ = command;
+ this.type_ = "request";
+ this.seq_ = ++devtools.DebugCommand.nextSeq_;
+ if (opt_arguments)
+ this.arguments_ = opt_arguments;
+};
+
+
+/**
+ * Next unique number to be used as debugger request sequence number.
+ * @type {number}
+ */
+devtools.DebugCommand.nextSeq_ = 1;
+
+
+/**
+ * @return {number}
+ */
+devtools.DebugCommand.prototype.getSequenceNumber = function()
+{
+ return this.seq_;
+};
+
+
+/**
+ * @return {string}
+ */
+devtools.DebugCommand.prototype.toJSONProtocol = function()
+{
+ var json = {
+ "seq": this.seq_,
+ "type": this.type_,
+ "command": this.command_
+ }
+ if (this.arguments_)
+ json.arguments = this.arguments_;
+ return JSON.stringify(json);
+};
+
+
+/**
+ * JSON messages sent from v8 debugger. See protocol definition for more
+ * details: http://code.google.com/p/v8/wiki/DebuggerProtocol
+ * @param {string} msg Raw protocol packet as JSON string.
+ * @constructor
+ */
+devtools.DebuggerMessage = function(msg)
+{
+ this.packet_ = JSON.parse(msg);
+ this.refs_ = [];
+ if (this.packet_.refs) {
+ for (var i = 0; i < this.packet_.refs.length; i++)
+ this.refs_[this.packet_.refs[i].handle] = this.packet_.refs[i];
+ }
+};
+
+
+/**
+ * @return {string} The packet type.
+ */
+devtools.DebuggerMessage.prototype.getType = function()
+{
+ return this.packet_.type;
+};
+
+
+/**
+ * @return {?string} The packet event if the message is an event.
+ */
+devtools.DebuggerMessage.prototype.getEvent = function()
+{
+ return this.packet_.event;
+};
+
+
+/**
+ * @return {?string} The packet command if the message is a response to a
+ * command.
+ */
+devtools.DebuggerMessage.prototype.getCommand = function()
+{
+ return this.packet_.command;
+};
+
+
+/**
+ * @return {number} The packet request sequence.
+ */
+devtools.DebuggerMessage.prototype.getRequestSeq = function()
+{
+ return this.packet_.request_seq;
+};
+
+
+/**
+ * @return {number} Whether the v8 is running after processing the request.
+ */
+devtools.DebuggerMessage.prototype.isRunning = function()
+{
+ return this.packet_.running ? true : false;
+};
+
+
+/**
+ * @return {boolean} Whether the request succeeded.
+ */
+devtools.DebuggerMessage.prototype.isSuccess = function()
+{
+ return this.packet_.success ? true : false;
+};
+
+
+/**
+ * @return {string}
+ */
+devtools.DebuggerMessage.prototype.getMessage = function()
+{
+ return this.packet_.message;
+};
+
+
+/**
+ * @return {Object} Parsed message body json.
+ */
+devtools.DebuggerMessage.prototype.getBody = function()
+{
+ return this.packet_.body;
+};
+
+
+/**
+ * @param {number} handle Object handle.
+ * @return {?Object} Returns the object with the handle if it was sent in this
+ * message(some objects referenced by handles may be missing in the message).
+ */
+devtools.DebuggerMessage.prototype.lookup = function(handle)
+{
+ return this.refs_[handle];
+};
diff --git a/WebKit/chromium/src/js/DevTools.js b/WebKit/chromium/src/js/DevTools.js
new file mode 100644
index 0000000..dcb181b
--- /dev/null
+++ b/WebKit/chromium/src/js/DevTools.js
@@ -0,0 +1,504 @@
+/*
+ * 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.
+ */
+
+/**
+ * FIXME: change field naming style to use trailing underscore.
+ * @fileoverview Tools is a main class that wires all components of the
+ * DevTools frontend together. It is also responsible for overriding existing
+ * WebInspector functionality while it is getting upstreamed into WebCore.
+ */
+
+/**
+ * Dispatches raw message from the host.
+ * @param {string} remoteName
+ * @prama {string} methodName
+ * @param {string} param1, param2, param3 Arguments to dispatch.
+ */
+devtools$$dispatch = function(remoteName, methodName, param1, param2, param3)
+{
+ remoteName = "Remote" + remoteName.substring(0, remoteName.length - 8);
+ var agent = window[remoteName];
+ if (!agent) {
+ debugPrint("No remote agent '" + remoteName + "' found.");
+ return;
+ }
+ var method = agent[methodName];
+ if (!method) {
+ debugPrint("No method '" + remoteName + "." + methodName + "' found.");
+ return;
+ }
+ method.call(this, param1, param2, param3);
+};
+
+
+devtools.ToolsAgent = function()
+{
+ RemoteToolsAgent.didDispatchOn = WebInspector.Callback.processCallback;
+ RemoteToolsAgent.frameNavigate = this.frameNavigate_.bind(this);
+ RemoteToolsAgent.dispatchOnClient = this.dispatchOnClient_.bind(this);
+ this.debuggerAgent_ = new devtools.DebuggerAgent();
+ this.profilerAgent_ = new devtools.ProfilerAgent();
+};
+
+
+/**
+ * Resets tools agent to its initial state.
+ */
+devtools.ToolsAgent.prototype.reset = function()
+{
+ this.debuggerAgent_.reset();
+};
+
+
+/**
+ * @param {string} script Script exression to be evaluated in the context of the
+ * inspected page.
+ * @param {function(Object|string, boolean):undefined} opt_callback Function to
+ * call with the result.
+ */
+devtools.ToolsAgent.prototype.evaluateJavaScript = function(script, opt_callback)
+{
+ InspectorBackend.evaluate(script, opt_callback || function() {});
+};
+
+
+/**
+ * @return {devtools.DebuggerAgent} Debugger agent instance.
+ */
+devtools.ToolsAgent.prototype.getDebuggerAgent = function()
+{
+ return this.debuggerAgent_;
+};
+
+
+/**
+ * @return {devtools.ProfilerAgent} Profiler agent instance.
+ */
+devtools.ToolsAgent.prototype.getProfilerAgent = function()
+{
+ return this.profilerAgent_;
+};
+
+
+/**
+ * @param {string} url Url frame navigated to.
+ * @see tools_agent.h
+ * @private
+ */
+devtools.ToolsAgent.prototype.frameNavigate_ = function(url)
+{
+ this.reset();
+ // Do not reset Profiles panel.
+ var profiles = null;
+ if ("profiles" in WebInspector.panels) {
+ profiles = WebInspector.panels["profiles"];
+ delete WebInspector.panels["profiles"];
+ }
+ WebInspector.reset();
+ if (profiles !== null)
+ WebInspector.panels["profiles"] = profiles;
+};
+
+
+/**
+ * @param {string} message Serialized call to be dispatched on WebInspector.
+ * @private
+ */
+devtools.ToolsAgent.prototype.dispatchOnClient_ = function(message)
+{
+ var args = JSON.parse(message);
+ var methodName = args[0];
+ var parameters = args.slice(1);
+ WebInspector[methodName].apply(WebInspector, parameters);
+};
+
+
+/**
+ * Evaluates js expression.
+ * @param {string} expr
+ */
+devtools.ToolsAgent.prototype.evaluate = function(expr)
+{
+ RemoteToolsAgent.evaluate(expr);
+};
+
+
+/**
+ * Enables / disables resources panel in the ui.
+ * @param {boolean} enabled New panel status.
+ */
+WebInspector.setResourcesPanelEnabled = function(enabled)
+{
+ InspectorBackend._resourceTrackingEnabled = enabled;
+ WebInspector.panels.resources.reset();
+};
+
+
+/**
+ * Prints string to the inspector console or shows alert if the console doesn't
+ * exist.
+ * @param {string} text
+ */
+function debugPrint(text) {
+ var console = WebInspector.console;
+ if (console) {
+ console.addMessage(new WebInspector.ConsoleMessage(
+ WebInspector.ConsoleMessage.MessageSource.JS,
+ WebInspector.ConsoleMessage.MessageType.Log,
+ WebInspector.ConsoleMessage.MessageLevel.Log,
+ 1, "chrome://devtools/<internal>", undefined, -1, text));
+ } else
+ alert(text);
+}
+
+
+/**
+ * Global instance of the tools agent.
+ * @type {devtools.ToolsAgent}
+ */
+devtools.tools = null;
+
+
+var context = {}; // Used by WebCore's inspector routines.
+
+///////////////////////////////////////////////////////////////////////////////
+// Here and below are overrides to existing WebInspector methods only.
+// TODO(pfeldman): Patch WebCore and upstream changes.
+var oldLoaded = WebInspector.loaded;
+WebInspector.loaded = function()
+{
+ devtools.tools = new devtools.ToolsAgent();
+ devtools.tools.reset();
+
+ Preferences.ignoreWhitespace = false;
+ Preferences.samplingCPUProfiler = true;
+ Preferences.heapProfilerPresent = true;
+ oldLoaded.call(this);
+
+ InspectorFrontendHost.loaded();
+};
+
+
+(function()
+{
+
+ /**
+ * Handles an F3 keydown event to focus the Inspector search box.
+ * @param {KeyboardEvent} event Event to optionally handle
+ * @return {boolean} whether the event has been handled
+ */
+ function handleF3Keydown(event) {
+ if (event.keyIdentifier === "F3" && !event.altKey && !event.ctrlKey && !event.shiftKey && !event.metaKey) {
+ var searchField = document.getElementById("search");
+ searchField.focus();
+ searchField.select();
+ event.preventDefault();
+ return true;
+ }
+ return false;
+ }
+
+
+ var oldKeyDown = WebInspector.documentKeyDown;
+ /**
+ * This override allows to intercept keydown events we want to handle in a
+ * custom way. Some nested documents (iframes) delegate keydown handling to
+ * WebInspector.documentKeyDown (e.g. SourceFrame).
+ * @param {KeyboardEvent} event
+ * @override
+ */
+ WebInspector.documentKeyDown = function(event) {
+ var isHandled = handleF3Keydown(event);
+ if (!isHandled) {
+ // Mute refresh action.
+ if (event.keyIdentifier === "F5")
+ event.preventDefault();
+ else if (event.keyIdentifier === "U+0052" /* "R" */ && (event.ctrlKey || event.metaKey))
+ event.preventDefault();
+ else
+ oldKeyDown.call(this, event);
+ }
+ };
+})();
+
+
+/**
+ * This override is necessary for adding script source asynchronously.
+ * @override
+ */
+WebInspector.ScriptView.prototype.setupSourceFrameIfNeeded = function()
+{
+ if (!this._frameNeedsSetup)
+ return;
+
+ this.attach();
+
+ if (this.script.source)
+ this.didResolveScriptSource_();
+ else {
+ var self = this;
+ devtools.tools.getDebuggerAgent().resolveScriptSource(
+ this.script.sourceID,
+ function(source) {
+ self.script.source = source || WebInspector.UIString("<source is not available>");
+ self.didResolveScriptSource_();
+ });
+ }
+};
+
+
+/**
+ * Performs source frame setup when script source is aready resolved.
+ */
+WebInspector.ScriptView.prototype.didResolveScriptSource_ = function()
+{
+ this.sourceFrame.setContent("text/javascript", this.script.source);
+ this._sourceFrameSetup = true;
+ delete this._frameNeedsSetup;
+};
+
+
+/**
+ * @param {string} type Type of the the property value("object" or "function").
+ * @param {string} className Class name of the property value.
+ * @constructor
+ */
+WebInspector.UnresolvedPropertyValue = function(type, className)
+{
+ this.type = type;
+ this.className = className;
+};
+
+
+(function()
+{
+ var oldShow = WebInspector.ScriptsPanel.prototype.show;
+ WebInspector.ScriptsPanel.prototype.show = function()
+ {
+ devtools.tools.getDebuggerAgent().initUI();
+ this.enableToggleButton.visible = false;
+ oldShow.call(this);
+ };
+})();
+
+
+(function InterceptProfilesPanelEvents()
+{
+ var oldShow = WebInspector.ProfilesPanel.prototype.show;
+ WebInspector.ProfilesPanel.prototype.show = function()
+ {
+ devtools.tools.getProfilerAgent().initializeProfiling();
+ this.enableToggleButton.visible = false;
+ oldShow.call(this);
+ // Show is called on every show event of a panel, so
+ // we only need to intercept it once.
+ WebInspector.ProfilesPanel.prototype.show = oldShow;
+ };
+})();
+
+
+/*
+ * @override
+ * TODO(mnaganov): Restore l10n when it will be agreed that it is needed.
+ */
+WebInspector.UIString = function(string)
+{
+ return String.vsprintf(string, Array.prototype.slice.call(arguments, 1));
+};
+
+
+// There is no clear way of setting frame title yet. So sniffing main resource
+// load.
+(function OverrideUpdateResource() {
+ var originalUpdateResource = WebInspector.updateResource;
+ WebInspector.updateResource = function(identifier, payload)
+ {
+ originalUpdateResource.call(this, identifier, payload);
+ var resource = this.resources[identifier];
+ if (resource && resource.mainResource && resource.finished)
+ document.title = WebInspector.UIString("Developer Tools - %s", resource.url);
+ };
+})();
+
+
+// Highlight extension content scripts in the scripts list.
+(function () {
+ var original = WebInspector.ScriptsPanel.prototype._addScriptToFilesMenu;
+ WebInspector.ScriptsPanel.prototype._addScriptToFilesMenu = function(script)
+ {
+ var result = original.apply(this, arguments);
+ var debuggerAgent = devtools.tools.getDebuggerAgent();
+ var type = debuggerAgent.getScriptContextType(script.sourceID);
+ var option = script.filesSelectOption;
+ if (type === "injected" && option)
+ option.addStyleClass("injected");
+ return result;
+ };
+})();
+
+
+/** Pending WebKit upstream by apavlov). Fixes iframe vs drag problem. */
+(function()
+{
+ var originalDragStart = WebInspector.elementDragStart;
+ WebInspector.elementDragStart = function(element)
+ {
+ if (element) {
+ var glassPane = document.createElement("div");
+ glassPane.style.cssText = "position:absolute;width:100%;height:100%;opacity:0;z-index:1";
+ glassPane.id = "glass-pane-for-drag";
+ element.parentElement.appendChild(glassPane);
+ }
+
+ originalDragStart.apply(this, arguments);
+ };
+
+ var originalDragEnd = WebInspector.elementDragEnd;
+ WebInspector.elementDragEnd = function()
+ {
+ originalDragEnd.apply(this, arguments);
+
+ var glassPane = document.getElementById("glass-pane-for-drag");
+ if (glassPane)
+ glassPane.parentElement.removeChild(glassPane);
+ };
+})();
+
+
+(function () {
+var orig = InjectedScriptAccess.prototype.getProperties;
+InjectedScriptAccess.prototype.getProperties = function(objectProxy, ignoreHasOwnProperty, abbreviate, callback)
+{
+ if (objectProxy.isScope)
+ devtools.tools.getDebuggerAgent().resolveScope(objectProxy.objectId, callback);
+ else if (objectProxy.isV8Ref)
+ devtools.tools.getDebuggerAgent().resolveChildren(objectProxy.objectId, callback, false);
+ else
+ orig.apply(this, arguments);
+};
+})();
+
+
+(function()
+{
+InjectedScriptAccess.prototype.evaluateInCallFrame = function(callFrameId, code, objectGroup, callback)
+{
+ //TODO(pfeldman): remove once 49084 is rolled.
+ if (!callback)
+ callback = objectGroup;
+ devtools.tools.getDebuggerAgent().evaluateInCallFrame(callFrameId, code, callback);
+};
+})();
+
+
+WebInspector.resourceTrackingWasEnabled = function()
+{
+ InspectorBackend._resourceTrackingEnabled = true;
+ this.panels.resources.resourceTrackingWasEnabled();
+};
+
+WebInspector.resourceTrackingWasDisabled = function()
+{
+ InspectorBackend._resourceTrackingEnabled = false;
+ this.panels.resources.resourceTrackingWasDisabled();
+};
+
+(function()
+{
+var orig = WebInspector.ConsoleMessage.prototype.setMessageBody;
+WebInspector.ConsoleMessage.prototype.setMessageBody = function(args)
+{
+ for (var i = 0; i < args.length; ++i) {
+ if (typeof args[i] === "string")
+ args[i] = WebInspector.ObjectProxy.wrapPrimitiveValue(args[i]);
+ }
+ orig.call(this, args);
+};
+})();
+
+
+(function()
+{
+var orig = InjectedScriptAccess.prototype.getCompletions;
+InjectedScriptAccess.prototype.getCompletions = function(expressionString, includeInspectorCommandLineAPI, callFrameId, reportCompletions)
+{
+ if (typeof callFrameId === "number")
+ devtools.tools.getDebuggerAgent().resolveCompletionsOnFrame(expressionString, callFrameId, reportCompletions);
+ else
+ return orig.apply(this, arguments);
+};
+})();
+
+
+(function()
+{
+WebInspector.ElementsPanel.prototype._nodeSearchButtonClicked = function( event)
+{
+ InspectorBackend.toggleNodeSearch();
+ this.nodeSearchButton.toggled = !this.nodeSearchButton.toggled;
+};
+})();
+
+
+// We need to have a place for postponed tasks
+// which should be executed when all the messages between agent and frontend
+// are processed.
+
+WebInspector.runAfterPendingDispatchesQueue = [];
+
+WebInspector.TestController.prototype.runAfterPendingDispatches = function(callback)
+{
+ WebInspector.runAfterPendingDispatchesQueue.push(callback);
+};
+
+WebInspector.queuesAreEmpty = function()
+{
+ var copy = this.runAfterPendingDispatchesQueue.slice();
+ this.runAfterPendingDispatchesQueue = [];
+ for (var i = 0; i < copy.length; ++i)
+ copy[i].call(this);
+};
+
+(function()
+{
+var originalAddToFrame = InspectorFrontendHost.addResourceSourceToFrame;
+InspectorFrontendHost.addResourceSourceToFrame = function(identifier, element)
+{
+ var resource = WebInspector.resources[identifier];
+ if (!resource)
+ return;
+ originalAddToFrame.call(this, identifier, resource.mimeType, element);
+};
+})();
+
+WebInspector.pausedScript = function(callFrames)
+{
+ this.panels.scripts.debuggerPaused(callFrames);
+};
diff --git a/WebKit/chromium/src/js/DevToolsHostStub.js b/WebKit/chromium/src/js/DevToolsHostStub.js
new file mode 100644
index 0000000..8b2f46b
--- /dev/null
+++ b/WebKit/chromium/src/js/DevToolsHostStub.js
@@ -0,0 +1,309 @@
+/*
+ * 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.
+ */
+
+/**
+ * @fileoverview These stubs emulate backend functionality and allows
+ * DevTools frontend to function as a standalone web app.
+ */
+
+if (!window["RemoteDebuggerAgent"]) {
+
+/**
+ * FIXME: change field naming style to use trailing underscore.
+ * @constructor
+ */
+RemoteDebuggerAgentStub = function()
+{
+};
+
+
+RemoteDebuggerAgentStub.prototype.getContextId = function()
+{
+ RemoteDebuggerAgent.setContextId(3);
+};
+
+
+RemoteDebuggerAgentStub.prototype.processDebugCommands = function()
+{
+};
+
+
+/**
+ * @constructor
+ */
+RemoteProfilerAgentStub = function()
+{
+};
+
+
+RemoteProfilerAgentStub.prototype.getActiveProfilerModules = function()
+{
+ ProfilerStubHelper.GetInstance().getActiveProfilerModules();
+};
+
+
+RemoteProfilerAgentStub.prototype.getLogLines = function(pos)
+{
+ ProfilerStubHelper.GetInstance().getLogLines(pos);
+};
+
+
+/**
+ * @constructor
+ */
+RemoteToolsAgentStub = function()
+{
+};
+
+
+RemoteToolsAgentStub.prototype.dispatchOnInjectedScript = function()
+{
+};
+
+
+RemoteToolsAgentStub.prototype.dispatchOnInspectorController = function()
+{
+};
+
+
+/**
+ * @constructor
+ */
+ProfilerStubHelper = function()
+{
+ this.activeProfilerModules_ = devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_NONE;
+ this.heapProfSample_ = 0;
+ this.log_ = '';
+};
+
+
+ProfilerStubHelper.GetInstance = function()
+{
+ if (!ProfilerStubHelper.instance_)
+ ProfilerStubHelper.instance_ = new ProfilerStubHelper();
+ return ProfilerStubHelper.instance_;
+};
+
+
+ProfilerStubHelper.prototype.StopProfiling = function(modules)
+{
+ this.activeProfilerModules_ &= ~modules;
+};
+
+
+ProfilerStubHelper.prototype.StartProfiling = function(modules)
+{
+ var profModules = devtools.ProfilerAgent.ProfilerModules;
+ if (modules & profModules.PROFILER_MODULE_HEAP_SNAPSHOT) {
+ if (modules & profModules.PROFILER_MODULE_HEAP_STATS) {
+ this.log_ +=
+ 'heap-sample-begin,"Heap","allocated",' +
+ (new Date()).getTime() + '\n' +
+ 'heap-sample-stats,"Heap","allocated",10000,1000\n';
+ this.log_ +=
+ 'heap-sample-item,STRING_TYPE,100,1000\n' +
+ 'heap-sample-item,CODE_TYPE,10,200\n' +
+ 'heap-sample-item,MAP_TYPE,20,350\n';
+ this.log_ += ProfilerStubHelper.HeapSamples[this.heapProfSample_++];
+ this.heapProfSample_ %= ProfilerStubHelper.HeapSamples.length;
+ this.log_ += 'heap-sample-end,"Heap","allocated"\n';
+ }
+ } else {
+ if (modules & profModules.PROFILER_MODULE_CPU)
+ this.log_ += ProfilerStubHelper.ProfilerLogBuffer;
+ this.activeProfilerModules_ |= modules;
+ }
+};
+
+
+ProfilerStubHelper.prototype.getActiveProfilerModules = function()
+{
+ var self = this;
+ setTimeout(function() {
+ RemoteProfilerAgent.didGetActiveProfilerModules(self.activeProfilerModules_);
+ }, 100);
+};
+
+
+ProfilerStubHelper.prototype.getLogLines = function(pos)
+{
+ var profModules = devtools.ProfilerAgent.ProfilerModules;
+ var logLines = this.log_.substr(pos);
+ setTimeout(function() {
+ RemoteProfilerAgent.didGetLogLines(pos + logLines.length, logLines);
+ }, 100);
+};
+
+
+ProfilerStubHelper.ProfilerLogBuffer =
+ 'profiler,begin,1\n' +
+ 'profiler,resume\n' +
+ 'code-creation,LazyCompile,0x1000,256,"test1 http://aaa.js:1"\n' +
+ 'code-creation,LazyCompile,0x2000,256,"test2 http://bbb.js:2"\n' +
+ 'code-creation,LazyCompile,0x3000,256,"test3 http://ccc.js:3"\n' +
+ 'tick,0x1010,0x0,3\n' +
+ 'tick,0x2020,0x0,3,0x1010\n' +
+ 'tick,0x2020,0x0,3,0x1010\n' +
+ 'tick,0x3010,0x0,3,0x2020, 0x1010\n' +
+ 'tick,0x2020,0x0,3,0x1010\n' +
+ 'tick,0x2030,0x0,3,0x2020, 0x1010\n' +
+ 'tick,0x2020,0x0,3,0x1010\n' +
+ 'tick,0x1010,0x0,3\n' +
+ 'profiler,pause\n';
+
+
+ProfilerStubHelper.HeapSamples = [
+ 'heap-js-cons-item,foo,1,100\n' +
+ 'heap-js-cons-item,bar,20,2000\n' +
+ 'heap-js-cons-item,Object,5,100\n' +
+ 'heap-js-ret-item,foo,bar;3\n' +
+ 'heap-js-ret-item,bar,foo;5\n' +
+ 'heap-js-ret-item,Object:0x1234,(roots);1\n',
+
+ 'heap-js-cons-item,foo,2000,200000\n' +
+ 'heap-js-cons-item,bar,10,1000\n' +
+ 'heap-js-cons-item,Object,6,120\n' +
+ 'heap-js-ret-item,foo,bar;7,Object:0x1234;10\n' +
+ 'heap-js-ret-item,bar,foo;10,Object:0x1234;10\n' +
+ 'heap-js-ret-item,Object:0x1234,(roots);1\n',
+
+ 'heap-js-cons-item,foo,15,1500\n' +
+ 'heap-js-cons-item,bar,15,1500\n' +
+ 'heap-js-cons-item,Object,5,100\n' +
+ 'heap-js-cons-item,Array,3,1000\n' +
+ 'heap-js-ret-item,foo,bar;3,Array:0x5678;1\n' +
+ 'heap-js-ret-item,bar,foo;5,Object:0x1234;8,Object:0x5678;2\n' +
+ 'heap-js-ret-item,Object:0x1234,(roots);1,Object:0x5678;2\n' +
+ 'heap-js-ret-item,Object:0x5678,(global property);3,Object:0x1234;5\n' +
+ 'heap-js-ret-item,Array:0x5678,(global property);3,Array:0x5678;2\n',
+
+ 'heap-js-cons-item,bar,20,2000\n' +
+ 'heap-js-cons-item,Object,6,120\n' +
+ 'heap-js-ret-item,bar,foo;5,Object:0x1234;1,Object:0x1235;3\n' +
+ 'heap-js-ret-item,Object:0x1234,(global property);3\n' +
+ 'heap-js-ret-item,Object:0x1235,(global property);5\n',
+
+ 'heap-js-cons-item,foo,15,1500\n' +
+ 'heap-js-cons-item,bar,15,1500\n' +
+ 'heap-js-cons-item,Array,10,1000\n' +
+ 'heap-js-ret-item,foo,bar;1,Array:0x5678;1\n' +
+ 'heap-js-ret-item,bar,foo;5\n' +
+ 'heap-js-ret-item,Array:0x5678,(roots);3\n',
+
+ 'heap-js-cons-item,bar,20,2000\n' +
+ 'heap-js-cons-item,baz,15,1500\n' +
+ 'heap-js-ret-item,bar,baz;3\n' +
+ 'heap-js-ret-item,baz,bar;3\n'
+];
+
+
+/**
+ * @constructor
+ */
+RemoteDebuggerCommandExecutorStub = function()
+{
+};
+
+
+RemoteDebuggerCommandExecutorStub.prototype.DebuggerCommand = function(cmd)
+{
+ if ('{"seq":2,"type":"request","command":"scripts","arguments":{"includeSource":false}}' === cmd) {
+ var response1 =
+ '{"seq":5,"request_seq":2,"type":"response","command":"scripts","' +
+ 'success":true,"body":[{"handle":61,"type":"script","name":"' +
+ 'http://www/~test/t.js","id":59,"lineOffset":0,"columnOffset":0,' +
+ '"lineCount":1,"sourceStart":"function fib(n) {","sourceLength":300,' +
+ '"scriptType":2,"compilationType":0,"context":{"ref":60}}],"refs":[{' +
+ '"handle":60,"type":"context","data":"page,3"}],"running":false}';
+ this.sendResponse_(response1);
+ } else if ('{"seq":3,"type":"request","command":"scripts","arguments":{"ids":[59],"includeSource":true}}' === cmd) {
+ this.sendResponse_(
+ '{"seq":8,"request_seq":3,"type":"response","command":"scripts",' +
+ '"success":true,"body":[{"handle":1,"type":"script","name":' +
+ '"http://www/~test/t.js","id":59,"lineOffset":0,"columnOffset":0,' +
+ '"lineCount":1,"source":"function fib(n) {return n+1;}",' +
+ '"sourceLength":244,"scriptType":2,"compilationType":0,"context":{' +
+ '"ref":0}}],"refs":[{"handle":0,"type":"context","data":"page,3}],"' +
+ '"running":false}');
+ } else if (cmd.indexOf('"command":"profile"') !== -1) {
+ var cmdObj = JSON.parse(cmd);
+ if (cmdObj.arguments.command === "resume")
+ ProfilerStubHelper.GetInstance().StartProfiling(parseInt(cmdObj.arguments.modules));
+ else if (cmdObj.arguments.command === "pause")
+ ProfilerStubHelper.GetInstance().StopProfiling(parseInt(cmdObj.arguments.modules));
+ else
+ debugPrint("Unexpected profile command: " + cmdObj.arguments.command);
+ } else
+ debugPrint("Unexpected command: " + cmd);
+};
+
+
+RemoteDebuggerCommandExecutorStub.prototype.DebuggerPauseScript = function()
+{
+};
+
+
+RemoteDebuggerCommandExecutorStub.prototype.sendResponse_ = function(response)
+{
+ setTimeout(function() {
+ RemoteDebuggerAgent.debuggerOutput(response);
+ }, 0);
+};
+
+
+DevToolsHostStub = function()
+{
+ this.isStub = true;
+};
+DevToolsHostStub.prototype.__proto__ = WebInspector.InspectorFrontendHostStub.prototype;
+
+
+DevToolsHostStub.prototype.reset = function()
+{
+};
+
+
+DevToolsHostStub.prototype.setting = function()
+{
+};
+
+
+DevToolsHostStub.prototype.setSetting = function()
+{
+};
+
+
+window["RemoteDebuggerAgent"] = new RemoteDebuggerAgentStub();
+window["RemoteDebuggerCommandExecutor"] = new RemoteDebuggerCommandExecutorStub();
+window["RemoteProfilerAgent"] = new RemoteProfilerAgentStub();
+window["RemoteToolsAgent"] = new RemoteToolsAgentStub();
+InspectorFrontendHost = new DevToolsHostStub();
+
+}
diff --git a/WebKit/chromium/src/js/HeapProfilerPanel.js b/WebKit/chromium/src/js/HeapProfilerPanel.js
new file mode 100644
index 0000000..abbf580
--- /dev/null
+++ b/WebKit/chromium/src/js/HeapProfilerPanel.js
@@ -0,0 +1,966 @@
+/*
+ * 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.
+ */
+
+/**
+ * @fileoverview Heap profiler panel implementation.
+ */
+
+WebInspector.ProfilesPanel.prototype.addSnapshot = function(snapshot) {
+ snapshot.title = WebInspector.UIString("Snapshot %d", snapshot.number);
+ snapshot.typeId = WebInspector.HeapSnapshotProfileType.TypeId;
+
+ var snapshots = WebInspector.HeapSnapshotProfileType.snapshots;
+ snapshots.push(snapshot);
+
+ snapshot.listIndex = snapshots.length - 1;
+
+ if (WebInspector.CPUProfile)
+ this.addProfileHeader(WebInspector.HeapSnapshotProfileType.TypeId, snapshot);
+ else
+ this.addProfileHeader(snapshot);
+
+ this.dispatchEventToListeners("snapshot added");
+}
+
+
+WebInspector.HeapSnapshotView = function(parent, profile)
+{
+ WebInspector.View.call(this);
+
+ this.element.addStyleClass("heap-snapshot-view");
+
+ this.parent = parent;
+ this.parent.addEventListener("snapshot added", this._updateBaseOptions, this);
+
+ this.showCountAsPercent = false;
+ this.showSizeAsPercent = false;
+ this.showCountDeltaAsPercent = false;
+ this.showSizeDeltaAsPercent = false;
+
+ this.categories = {
+ code: new WebInspector.ResourceCategory("code", WebInspector.UIString("Code"), "rgb(255,121,0)"),
+ data: new WebInspector.ResourceCategory("data", WebInspector.UIString("Objects"), "rgb(47,102,236)")
+ };
+
+ var summaryContainer = document.createElement("div");
+ summaryContainer.id = "heap-snapshot-summary-container";
+
+ this.countsSummaryBar = new WebInspector.SummaryBar(this.categories);
+ this.countsSummaryBar.element.className = "heap-snapshot-summary";
+ this.countsSummaryBar.calculator = new WebInspector.HeapSummaryCountCalculator();
+ var countsLabel = document.createElement("div");
+ countsLabel.className = "heap-snapshot-summary-label";
+ countsLabel.textContent = WebInspector.UIString("Count");
+ this.countsSummaryBar.element.appendChild(countsLabel);
+ summaryContainer.appendChild(this.countsSummaryBar.element);
+
+ this.sizesSummaryBar = new WebInspector.SummaryBar(this.categories);
+ this.sizesSummaryBar.element.className = "heap-snapshot-summary";
+ this.sizesSummaryBar.calculator = new WebInspector.HeapSummarySizeCalculator();
+ var sizesLabel = document.createElement("label");
+ sizesLabel.className = "heap-snapshot-summary-label";
+ sizesLabel.textContent = WebInspector.UIString("Size");
+ this.sizesSummaryBar.element.appendChild(sizesLabel);
+ summaryContainer.appendChild(this.sizesSummaryBar.element);
+
+ this.element.appendChild(summaryContainer);
+
+ var columns = { "cons": { title: WebInspector.UIString("Constructor"), disclosure: true, sortable: true },
+ "count": { title: WebInspector.UIString("Count"), width: "54px", sortable: true },
+ "size": { title: WebInspector.UIString("Size"), width: "72px", sort: "descending", sortable: true },
+ "countDelta": { title: WebInspector.UIString("\xb1 Count"), width: "72px", sortable: true },
+ "sizeDelta": { title: WebInspector.UIString("\xb1 Size"), width: "72px", sortable: true } };
+
+ this.dataGrid = new WebInspector.DataGrid(columns);
+ this.dataGrid.addEventListener("sorting changed", this._sortData, this);
+ this.dataGrid.element.addEventListener("mousedown", this._mouseDownInDataGrid.bind(this), true);
+ this.element.appendChild(this.dataGrid.element);
+
+ this.profile = profile;
+
+ this.baseSelectElement = document.createElement("select");
+ this.baseSelectElement.className = "status-bar-item";
+ this.baseSelectElement.addEventListener("change", this._changeBase.bind(this), false);
+ this._updateBaseOptions();
+ if (this.profile.listIndex > 0)
+ this.baseSelectElement.selectedIndex = this.profile.listIndex - 1;
+ else
+ this.baseSelectElement.selectedIndex = this.profile.listIndex;
+ this._resetDataGridList();
+
+ this.percentButton = new WebInspector.StatusBarButton("", "percent-time-status-bar-item status-bar-item");
+ this.percentButton.addEventListener("click", this._percentClicked.bind(this), false);
+
+ this.refresh();
+
+ this._updatePercentButton();
+};
+
+WebInspector.HeapSnapshotView.prototype = {
+
+ get statusBarItems()
+ {
+ return [this.baseSelectElement, this.percentButton.element];
+ },
+
+ get profile()
+ {
+ return this._profile;
+ },
+
+ set profile(profile)
+ {
+ this._profile = profile;
+ },
+
+ show: function(parentElement)
+ {
+ WebInspector.View.prototype.show.call(this, parentElement);
+ this.dataGrid.updateWidths();
+ },
+
+ hide: function()
+ {
+ WebInspector.View.prototype.hide.call(this);
+ this._currentSearchResultIndex = -1;
+ },
+
+ resize: function()
+ {
+ if (this.dataGrid)
+ this.dataGrid.updateWidths();
+ },
+
+ refresh: function()
+ {
+ this.dataGrid.removeChildren();
+
+ var children = this.snapshotDataGridList.children;
+ var count = children.length;
+ for (var index = 0; index < count; ++index)
+ this.dataGrid.appendChild(children[index]);
+
+ this._updateSummaryGraph();
+ },
+
+ refreshShowAsPercents: function()
+ {
+ this._updatePercentButton();
+ this.refreshVisibleData();
+ },
+
+ _deleteSearchMatchedFlags: function(node)
+ {
+ delete node._searchMatchedConsColumn;
+ delete node._searchMatchedCountColumn;
+ delete node._searchMatchedSizeColumn;
+ delete node._searchMatchedCountDeltaColumn;
+ delete node._searchMatchedSizeDeltaColumn;
+ },
+
+ searchCanceled: function()
+ {
+ if (this._searchResults) {
+ for (var i = 0; i < this._searchResults.length; ++i) {
+ var profileNode = this._searchResults[i].profileNode;
+ this._deleteSearchMatchedFlags(profileNode);
+ profileNode.refresh();
+ }
+ }
+
+ delete this._searchFinishedCallback;
+ this._currentSearchResultIndex = -1;
+ this._searchResults = [];
+ },
+
+ performSearch: function(query, finishedCallback)
+ {
+ // Call searchCanceled since it will reset everything we need before doing a new search.
+ this.searchCanceled();
+
+ query = query.trimWhitespace();
+
+ if (!query.length)
+ return;
+
+ this._searchFinishedCallback = finishedCallback;
+
+ var helper = WebInspector.HeapSnapshotView.SearchHelper;
+
+ var operationAndNumber = helper.parseOperationAndNumber(query);
+ var operation = operationAndNumber[0];
+ var queryNumber = operationAndNumber[1];
+
+ var percentUnits = helper.percents.test(query);
+ var megaBytesUnits = helper.megaBytes.test(query);
+ var kiloBytesUnits = helper.kiloBytes.test(query);
+ var bytesUnits = helper.bytes.test(query);
+
+ var queryNumberBytes = (megaBytesUnits ? (queryNumber * 1024 * 1024) : (kiloBytesUnits ? (queryNumber * 1024) : queryNumber));
+
+ function matchesQuery(heapSnapshotDataGridNode)
+ {
+ WebInspector.HeapSnapshotView.prototype._deleteSearchMatchedFlags(heapSnapshotDataGridNode);
+
+ if (percentUnits) {
+ heapSnapshotDataGridNode._searchMatchedCountColumn = operation(heapSnapshotDataGridNode.countPercent, queryNumber);
+ heapSnapshotDataGridNode._searchMatchedSizeColumn = operation(heapSnapshotDataGridNode.sizePercent, queryNumber);
+ heapSnapshotDataGridNode._searchMatchedCountDeltaColumn = operation(heapSnapshotDataGridNode.countDeltaPercent, queryNumber);
+ heapSnapshotDataGridNode._searchMatchedSizeDeltaColumn = operation(heapSnapshotDataGridNode.sizeDeltaPercent, queryNumber);
+ } else if (megaBytesUnits || kiloBytesUnits || bytesUnits) {
+ heapSnapshotDataGridNode._searchMatchedSizeColumn = operation(heapSnapshotDataGridNode.size, queryNumberBytes);
+ heapSnapshotDataGridNode._searchMatchedSizeDeltaColumn = operation(heapSnapshotDataGridNode.sizeDelta, queryNumberBytes);
+ } else {
+ heapSnapshotDataGridNode._searchMatchedCountColumn = operation(heapSnapshotDataGridNode.count, queryNumber);
+ heapSnapshotDataGridNode._searchMatchedCountDeltaColumn = operation(heapSnapshotDataGridNode.countDelta, queryNumber);
+ }
+
+ if (heapSnapshotDataGridNode.constructorName.hasSubstring(query, true))
+ heapSnapshotDataGridNode._searchMatchedConsColumn = true;
+
+ if (heapSnapshotDataGridNode._searchMatchedConsColumn ||
+ heapSnapshotDataGridNode._searchMatchedCountColumn ||
+ heapSnapshotDataGridNode._searchMatchedSizeColumn ||
+ heapSnapshotDataGridNode._searchMatchedCountDeltaColumn ||
+ heapSnapshotDataGridNode._searchMatchedSizeDeltaColumn) {
+ heapSnapshotDataGridNode.refresh();
+ return true;
+ }
+
+ return false;
+ }
+
+ var current = this.snapshotDataGridList.children[0];
+ var depth = 0;
+ var info = {};
+
+ // The second and subsequent levels of heap snapshot nodes represent retainers,
+ // so recursive expansion will be infinite, since a graph is being traversed.
+ // So default to a recursion cap of 2 levels.
+ var maxDepth = 2;
+
+ while (current) {
+ if (matchesQuery(current))
+ this._searchResults.push({ profileNode: current });
+ current = current.traverseNextNode(false, null, (depth >= maxDepth), info);
+ depth += info.depthChange;
+ }
+
+ finishedCallback(this, this._searchResults.length);
+ },
+
+ jumpToFirstSearchResult: WebInspector.CPUProfileView.prototype.jumpToFirstSearchResult,
+ jumpToLastSearchResult: WebInspector.CPUProfileView.prototype.jumpToLastSearchResult,
+ jumpToNextSearchResult: WebInspector.CPUProfileView.prototype.jumpToNextSearchResult,
+ jumpToPreviousSearchResult: WebInspector.CPUProfileView.prototype.jumpToPreviousSearchResult,
+ showingFirstSearchResult: WebInspector.CPUProfileView.prototype.showingFirstSearchResult,
+ showingLastSearchResult: WebInspector.CPUProfileView.prototype.showingLastSearchResult,
+ _jumpToSearchResult: WebInspector.CPUProfileView.prototype._jumpToSearchResult,
+
+ refreshVisibleData: function()
+ {
+ var child = this.dataGrid.children[0];
+ while (child) {
+ child.refresh();
+ child = child.traverseNextNode(false, null, true);
+ }
+ this._updateSummaryGraph();
+ },
+
+ _changeBase: function() {
+ if (this.baseSnapshot === WebInspector.HeapSnapshotProfileType.snapshots[this.baseSelectElement.selectedIndex])
+ return;
+
+ this._resetDataGridList();
+ this.refresh();
+
+ if (!this.currentQuery || !this._searchFinishedCallback || !this._searchResults)
+ return;
+
+ // The current search needs to be performed again. First negate out previous match
+ // count by calling the search finished callback with a negative number of matches.
+ // Then perform the search again with the same query and callback.
+ this._searchFinishedCallback(this, -this._searchResults.length);
+ this.performSearch(this.currentQuery, this._searchFinishedCallback);
+ },
+
+ _createSnapshotDataGridList: function()
+ {
+ if (this._snapshotDataGridList)
+ delete this._snapshotDataGridList;
+
+ this._snapshotDataGridList = new WebInspector.HeapSnapshotDataGridList(this, this.baseSnapshot.entries, this.profile.entries);
+ return this._snapshotDataGridList;
+ },
+
+ _mouseDownInDataGrid: function(event)
+ {
+ if (event.detail < 2)
+ return;
+
+ var cell = event.target.enclosingNodeOrSelfWithNodeName("td");
+ if (!cell || (!cell.hasStyleClass("count-column") && !cell.hasStyleClass("size-column") && !cell.hasStyleClass("countDelta-column") && !cell.hasStyleClass("sizeDelta-column")))
+ return;
+
+ if (cell.hasStyleClass("count-column"))
+ this.showCountAsPercent = !this.showCountAsPercent;
+ else if (cell.hasStyleClass("size-column"))
+ this.showSizeAsPercent = !this.showSizeAsPercent;
+ else if (cell.hasStyleClass("countDelta-column"))
+ this.showCountDeltaAsPercent = !this.showCountDeltaAsPercent;
+ else if (cell.hasStyleClass("sizeDelta-column"))
+ this.showSizeDeltaAsPercent = !this.showSizeDeltaAsPercent;
+
+ this.refreshShowAsPercents();
+
+ event.preventDefault();
+ event.stopPropagation();
+ },
+
+ get _isShowingAsPercent()
+ {
+ return this.showCountAsPercent && this.showSizeAsPercent && this.showCountDeltaAsPercent && this.showSizeDeltaAsPercent;
+ },
+
+ _percentClicked: function(event)
+ {
+ var currentState = this._isShowingAsPercent;
+ this.showCountAsPercent = !currentState;
+ this.showSizeAsPercent = !currentState;
+ this.showCountDeltaAsPercent = !currentState;
+ this.showSizeDeltaAsPercent = !currentState;
+ this.refreshShowAsPercents();
+ },
+
+ _resetDataGridList: function()
+ {
+ this.baseSnapshot = WebInspector.HeapSnapshotProfileType.snapshots[this.baseSelectElement.selectedIndex];
+ var lastComparator = WebInspector.HeapSnapshotDataGridList.propertyComparator("size", false);
+ if (this.snapshotDataGridList)
+ lastComparator = this.snapshotDataGridList.lastComparator;
+ this.snapshotDataGridList = this._createSnapshotDataGridList();
+ this.snapshotDataGridList.sort(lastComparator, true);
+ },
+
+ _sortData: function()
+ {
+ var sortAscending = this.dataGrid.sortOrder === "ascending";
+ var sortColumnIdentifier = this.dataGrid.sortColumnIdentifier;
+ var sortProperty = {
+ "cons": ["constructorName", null],
+ "count": ["count", null],
+ "size": ["size", "count"],
+ "countDelta": this.showCountDeltaAsPercent ? ["countDeltaPercent", null] : ["countDelta", null],
+ "sizeDelta": this.showSizeDeltaAsPercent ? ["sizeDeltaPercent", "countDeltaPercent"] : ["sizeDelta", "sizeDeltaPercent"]
+ }[sortColumnIdentifier];
+
+ this.snapshotDataGridList.sort(WebInspector.HeapSnapshotDataGridList.propertyComparator(sortProperty[0], sortProperty[1], sortAscending));
+
+ this.refresh();
+ },
+
+ _updateBaseOptions: function()
+ {
+ var list = WebInspector.HeapSnapshotProfileType.snapshots;
+ // We're assuming that snapshots can only be added.
+ if (this.baseSelectElement.length === list.length)
+ return;
+
+ for (var i = this.baseSelectElement.length, n = list.length; i < n; ++i) {
+ var baseOption = document.createElement("option");
+ baseOption.label = WebInspector.UIString("Compared to %s", list[i].title);
+ this.baseSelectElement.appendChild(baseOption);
+ }
+ },
+
+ _updatePercentButton: function()
+ {
+ if (this._isShowingAsPercent) {
+ this.percentButton.title = WebInspector.UIString("Show absolute counts and sizes.");
+ this.percentButton.toggled = true;
+ } else {
+ this.percentButton.title = WebInspector.UIString("Show counts and sizes as percentages.");
+ this.percentButton.toggled = false;
+ }
+ },
+
+ _updateSummaryGraph: function()
+ {
+ this.countsSummaryBar.calculator.showAsPercent = this._isShowingAsPercent;
+ this.countsSummaryBar.update(this.profile.lowlevels);
+
+ this.sizesSummaryBar.calculator.showAsPercent = this._isShowingAsPercent;
+ this.sizesSummaryBar.update(this.profile.lowlevels);
+ }
+};
+
+WebInspector.HeapSnapshotView.prototype.__proto__ = WebInspector.View.prototype;
+
+WebInspector.HeapSnapshotView.SearchHelper = {
+ // In comparators, we assume that a value from a node is passed as the first parameter.
+ operations: { LESS: function (a, b) { return a !== null && a < b; },
+ LESS_OR_EQUAL: function (a, b) { return a !== null && a <= b; },
+ EQUAL: function (a, b) { return a !== null && a === b; },
+ GREATER_OR_EQUAL: function (a, b) { return a !== null && a >= b; },
+ GREATER: function (a, b) { return a !== null && a > b; } },
+
+ operationParsers: { LESS: /^<(\d+)/,
+ LESS_OR_EQUAL: /^<=(\d+)/,
+ GREATER_OR_EQUAL: /^>=(\d+)/,
+ GREATER: /^>(\d+)/ },
+
+ parseOperationAndNumber: function(query)
+ {
+ var operations = WebInspector.HeapSnapshotView.SearchHelper.operations;
+ var parsers = WebInspector.HeapSnapshotView.SearchHelper.operationParsers;
+ for (var operation in parsers) {
+ var match = query.match(parsers[operation]);
+ if (match !== null)
+ return [operations[operation], parseFloat(match[1])];
+ }
+ return [operations.EQUAL, parseFloat(query)];
+ },
+
+ percents: /%$/,
+
+ megaBytes: /MB$/i,
+
+ kiloBytes: /KB$/i,
+
+ bytes: /B$/i
+}
+
+WebInspector.HeapSummaryCalculator = function(lowLevelField)
+{
+ this.total = 1;
+ this.lowLevelField = lowLevelField;
+}
+
+WebInspector.HeapSummaryCalculator.prototype = {
+ computeSummaryValues: function(lowLevels)
+ {
+ var highLevels = {data: 0, code: 0};
+ this.total = 0;
+ for (var item in lowLevels) {
+ var highItem = this._highFromLow(item);
+ if (highItem) {
+ var value = lowLevels[item][this.lowLevelField];
+ highLevels[highItem] += value;
+ this.total += value;
+ }
+ }
+ var result = {categoryValues: highLevels};
+ if (!this.showAsPercent)
+ result.total = this.total;
+ return result;
+ },
+
+ formatValue: function(value)
+ {
+ if (this.showAsPercent)
+ return WebInspector.UIString("%.2f%%", value / this.total * 100.0);
+ else
+ return this._valueToString(value);
+ },
+
+ get showAsPercent()
+ {
+ return this._showAsPercent;
+ },
+
+ set showAsPercent(x)
+ {
+ this._showAsPercent = x;
+ }
+}
+
+WebInspector.HeapSummaryCountCalculator = function()
+{
+ WebInspector.HeapSummaryCalculator.call(this, "count");
+}
+
+WebInspector.HeapSummaryCountCalculator.prototype = {
+ _highFromLow: function(type) {
+ if (type === "CODE_TYPE" || type === "SHARED_FUNCTION_INFO_TYPE" || type === "SCRIPT_TYPE") return "code";
+ if (type === "STRING_TYPE" || type === "HEAP_NUMBER_TYPE" || type.match(/^JS_/)) return "data";
+ return null;
+ },
+
+ _valueToString: function(value) {
+ return value.toString();
+ }
+}
+
+WebInspector.HeapSummaryCountCalculator.prototype.__proto__ = WebInspector.HeapSummaryCalculator.prototype;
+
+WebInspector.HeapSummarySizeCalculator = function()
+{
+ WebInspector.HeapSummaryCalculator.call(this, "size");
+}
+
+WebInspector.HeapSummarySizeCalculator.prototype = {
+ _highFromLow: function(type) {
+ if (type === "CODE_TYPE" || type === "SHARED_FUNCTION_INFO_TYPE" || type === "SCRIPT_TYPE") return "code";
+ if (type === "STRING_TYPE" || type === "HEAP_NUMBER_TYPE" || type.match(/^JS_/) || type.match(/_ARRAY_TYPE$/)) return "data";
+ return null;
+ },
+
+ _valueToString: Number.bytesToString
+}
+
+WebInspector.HeapSummarySizeCalculator.prototype.__proto__ = WebInspector.HeapSummaryCalculator.prototype;
+
+WebInspector.HeapSnapshotSidebarTreeElement = function(snapshot)
+{
+ this.profile = snapshot;
+
+ WebInspector.SidebarTreeElement.call(this, "heap-snapshot-sidebar-tree-item", "", "", snapshot, false);
+
+ this.refreshTitles();
+};
+
+WebInspector.HeapSnapshotSidebarTreeElement.prototype = {
+ get mainTitle()
+ {
+ if (this._mainTitle)
+ return this._mainTitle;
+ return this.profile.title;
+ },
+
+ set mainTitle(x)
+ {
+ this._mainTitle = x;
+ this.refreshTitles();
+ }
+};
+
+WebInspector.HeapSnapshotSidebarTreeElement.prototype.__proto__ = WebInspector.ProfileSidebarTreeElement.prototype;
+
+WebInspector.HeapSnapshotDataGridNodeWithRetainers = function(owningTree)
+{
+ this.tree = owningTree;
+
+ WebInspector.DataGridNode.call(this, null, this._hasRetainers);
+
+ this.addEventListener("populate", this._populate, this);
+};
+
+WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype = {
+ isEmptySet: function(set)
+ {
+ for (var x in set)
+ return false;
+ return true;
+ },
+
+ get _hasRetainers()
+ {
+ return !this.isEmptySet(this.retainers);
+ },
+
+ get _parent()
+ {
+ // For top-level nodes, return owning tree as a parent, not data grid.
+ return this.parent !== this.dataGrid ? this.parent : this.tree;
+ },
+
+ _populate: function(event)
+ {
+ var self = this;
+ this.produceDiff(this.baseRetainers, this.retainers, function(baseItem, snapshotItem) {
+ self.appendChild(new WebInspector.HeapSnapshotDataGridRetainerNode(self.snapshotView, baseItem, snapshotItem, self.tree));
+ });
+
+ if (this._parent) {
+ var currentComparator = this._parent.lastComparator;
+ if (currentComparator)
+ this.sort(currentComparator, true);
+ }
+
+ this.removeEventListener("populate", this._populate, this);
+ },
+
+ produceDiff: function(baseEntries, currentEntries, callback)
+ {
+ for (var item in currentEntries)
+ callback(baseEntries[item], currentEntries[item]);
+
+ for (item in baseEntries) {
+ if (!(item in currentEntries))
+ callback(baseEntries[item], null);
+ }
+ },
+
+ sort: function(comparator, force) {
+ if (!force && this.lastComparator === comparator)
+ return;
+
+ this.children.sort(comparator);
+ var childCount = this.children.length;
+ for (var childIndex = 0; childIndex < childCount; ++childIndex)
+ this.children[childIndex]._recalculateSiblings(childIndex);
+ for (var i = 0; i < this.children.length; ++i) {
+ var child = this.children[i];
+ if (!force && (!child.expanded || child.lastComparator === comparator))
+ continue;
+ child.sort(comparator, force);
+ }
+ this.lastComparator = comparator;
+ },
+
+ signForDelta: function(delta) {
+ if (delta === 0)
+ return "";
+ if (delta > 0)
+ return "+";
+ else
+ // Math minus sign, same width as plus.
+ return "\u2212";
+ },
+
+ showDeltaAsPercent: function(value) {
+ if (value === Number.POSITIVE_INFINITY)
+ return WebInspector.UIString("new");
+ else if (value === Number.NEGATIVE_INFINITY)
+ return WebInspector.UIString("deleted");
+ if (value > 1000.0)
+ return WebInspector.UIString("%s >1000%%", this.signForDelta(value));
+ return WebInspector.UIString("%s%.2f%%", this.signForDelta(value), Math.abs(value));
+ },
+
+ getTotalCount: function() {
+ if (!this._count) {
+ this._count = 0;
+ for (var i = 0, n = this.children.length; i < n; ++i)
+ this._count += this.children[i].count;
+ }
+ return this._count;
+ },
+
+ getTotalSize: function() {
+ if (!this._size) {
+ this._size = 0;
+ for (var i = 0, n = this.children.length; i < n; ++i)
+ this._size += this.children[i].size;
+ }
+ return this._size;
+ },
+
+ get countPercent()
+ {
+ return this.count / this._parent.getTotalCount() * 100.0;
+ },
+
+ get sizePercent()
+ {
+ return this.size / this._parent.getTotalSize() * 100.0;
+ },
+
+ get countDeltaPercent()
+ {
+ if (this.baseCount > 0) {
+ if (this.count > 0)
+ return this.countDelta / this.baseCount * 100.0;
+ else
+ return Number.NEGATIVE_INFINITY;
+ } else
+ return Number.POSITIVE_INFINITY;
+ },
+
+ get sizeDeltaPercent()
+ {
+ if (this.baseSize > 0) {
+ if (this.size > 0)
+ return this.sizeDelta / this.baseSize * 100.0;
+ else
+ return Number.NEGATIVE_INFINITY;
+ } else
+ return Number.POSITIVE_INFINITY;
+ },
+
+ get data()
+ {
+ var data = {};
+
+ data["cons"] = this.constructorName;
+
+ if (this.snapshotView.showCountAsPercent)
+ data["count"] = WebInspector.UIString("%.2f%%", this.countPercent);
+ else
+ data["count"] = this.count;
+
+ if (this.size !== null) {
+ if (this.snapshotView.showSizeAsPercent)
+ data["size"] = WebInspector.UIString("%.2f%%", this.sizePercent);
+ else
+ data["size"] = Number.bytesToString(this.size);
+ } else
+ data["size"] = "";
+
+ if (this.snapshotView.showCountDeltaAsPercent)
+ data["countDelta"] = this.showDeltaAsPercent(this.countDeltaPercent);
+ else
+ data["countDelta"] = WebInspector.UIString("%s%d", this.signForDelta(this.countDelta), Math.abs(this.countDelta));
+
+ if (this.sizeDelta !== null) {
+ if (this.snapshotView.showSizeDeltaAsPercent)
+ data["sizeDelta"] = this.showDeltaAsPercent(this.sizeDeltaPercent);
+ else
+ data["sizeDelta"] = WebInspector.UIString("%s%s", this.signForDelta(this.sizeDelta), Number.bytesToString(Math.abs(this.sizeDelta)));
+ } else
+ data["sizeDelta"] = "";
+
+ return data;
+ },
+
+ createCell: function(columnIdentifier)
+ {
+ var cell = WebInspector.DataGridNode.prototype.createCell.call(this, columnIdentifier);
+
+ if ((columnIdentifier === "cons" && this._searchMatchedConsColumn) ||
+ (columnIdentifier === "count" && this._searchMatchedCountColumn) ||
+ (columnIdentifier === "size" && this._searchMatchedSizeColumn) ||
+ (columnIdentifier === "countDelta" && this._searchMatchedCountDeltaColumn) ||
+ (columnIdentifier === "sizeDelta" && this._searchMatchedSizeDeltaColumn))
+ cell.addStyleClass("highlight");
+
+ return cell;
+ }
+};
+
+WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.__proto__ = WebInspector.DataGridNode.prototype;
+
+WebInspector.HeapSnapshotDataGridNode = function(snapshotView, baseEntry, snapshotEntry, owningTree)
+{
+ this.snapshotView = snapshotView;
+
+ if (!snapshotEntry)
+ snapshotEntry = { cons: baseEntry.cons, count: 0, size: 0, retainers: {} };
+ this.constructorName = snapshotEntry.cons;
+ this.count = snapshotEntry.count;
+ this.size = snapshotEntry.size;
+ this.retainers = snapshotEntry.retainers;
+
+ if (!baseEntry)
+ baseEntry = { count: 0, size: 0, retainers: {} };
+ this.baseCount = baseEntry.count;
+ this.countDelta = this.count - this.baseCount;
+ this.baseSize = baseEntry.size;
+ this.sizeDelta = this.size - this.baseSize;
+ this.baseRetainers = baseEntry.retainers;
+
+ WebInspector.HeapSnapshotDataGridNodeWithRetainers.call(this, owningTree);
+};
+
+WebInspector.HeapSnapshotDataGridNode.prototype.__proto__ = WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype;
+
+WebInspector.HeapSnapshotDataGridList = function(snapshotView, baseEntries, snapshotEntries)
+{
+ this.tree = this;
+ this.snapshotView = snapshotView;
+ this.children = [];
+ this.lastComparator = null;
+ this.populateChildren(baseEntries, snapshotEntries);
+};
+
+WebInspector.HeapSnapshotDataGridList.prototype = {
+ appendChild: function(child)
+ {
+ this.insertChild(child, this.children.length);
+ },
+
+ insertChild: function(child, index)
+ {
+ this.children.splice(index, 0, child);
+ },
+
+ removeChildren: function()
+ {
+ this.children = [];
+ },
+
+ populateChildren: function(baseEntries, snapshotEntries)
+ {
+ var self = this;
+ this.produceDiff(baseEntries, snapshotEntries, function(baseItem, snapshotItem) {
+ self.appendChild(new WebInspector.HeapSnapshotDataGridNode(self.snapshotView, baseItem, snapshotItem, self));
+ });
+ },
+
+ produceDiff: WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.produceDiff,
+ sort: WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.sort,
+ getTotalCount: WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.getTotalCount,
+ getTotalSize: WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.getTotalSize
+};
+
+WebInspector.HeapSnapshotDataGridList.propertyComparators = [{}, {}];
+
+WebInspector.HeapSnapshotDataGridList.propertyComparator = function(property, property2, isAscending)
+{
+ var propertyHash = property + "#" + property2;
+ var comparator = this.propertyComparators[(isAscending ? 1 : 0)][propertyHash];
+ if (!comparator) {
+ comparator = function(lhs, rhs) {
+ var l = lhs[property], r = rhs[property];
+ if ((l === null || r === null) && property2 !== null)
+ l = lhs[property2], r = rhs[property2];
+ var result = l < r ? -1 : (l > r ? 1 : 0);
+ return isAscending ? result : -result;
+ };
+ this.propertyComparators[(isAscending ? 1 : 0)][propertyHash] = comparator;
+ }
+ return comparator;
+};
+
+WebInspector.HeapSnapshotDataGridRetainerNode = function(snapshotView, baseEntry, snapshotEntry, owningTree)
+{
+ this.snapshotView = snapshotView;
+
+ if (!snapshotEntry)
+ snapshotEntry = { cons: baseEntry.cons, count: 0, clusters: {} };
+ this.constructorName = snapshotEntry.cons;
+ this.count = snapshotEntry.count;
+ this.retainers = this._calculateRetainers(this.snapshotView.profile, snapshotEntry.clusters);
+
+ if (!baseEntry)
+ baseEntry = { count: 0, clusters: {} };
+ this.baseCount = baseEntry.count;
+ this.countDelta = this.count - this.baseCount;
+ this.baseRetainers = this._calculateRetainers(this.snapshotView.baseSnapshot, baseEntry.clusters);
+
+ this.size = null;
+ this.sizeDelta = null;
+
+ WebInspector.HeapSnapshotDataGridNodeWithRetainers.call(this, owningTree);
+}
+
+WebInspector.HeapSnapshotDataGridRetainerNode.prototype = {
+ get sizePercent()
+ {
+ return null;
+ },
+
+ get sizeDeltaPercent()
+ {
+ return null;
+ },
+
+ _calculateRetainers: function(snapshot, clusters) {
+ var retainers = {};
+ if (this.isEmptySet(clusters)) {
+ if (this.constructorName in snapshot.entries)
+ return snapshot.entries[this.constructorName].retainers;
+ } else {
+ // In case when an entry is retained by clusters, we need to gather up the list
+ // of retainers by merging retainers of every cluster.
+ // E.g. having such a tree:
+ // A
+ // Object:1 10
+ // X 3
+ // Y 4
+ // Object:2 5
+ // X 6
+ //
+ // will result in a following retainers list: X 9, Y 4.
+ for (var clusterName in clusters) {
+ if (clusterName in snapshot.clusters) {
+ var clusterRetainers = snapshot.clusters[clusterName].retainers;
+ for (var clusterRetainer in clusterRetainers) {
+ var clusterRetainerEntry = clusterRetainers[clusterRetainer];
+ if (!(clusterRetainer in retainers))
+ retainers[clusterRetainer] = { cons: clusterRetainerEntry.cons, count: 0, clusters: {} };
+ retainers[clusterRetainer].count += clusterRetainerEntry.count;
+ for (var clusterRetainerCluster in clusterRetainerEntry.clusters)
+ retainers[clusterRetainer].clusters[clusterRetainerCluster] = true;
+ }
+ }
+ }
+ }
+ return retainers;
+ }
+};
+
+WebInspector.HeapSnapshotDataGridRetainerNode.prototype.__proto__ = WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype;
+
+
+WebInspector.HeapSnapshotProfileType = function()
+{
+ WebInspector.ProfileType.call(this, WebInspector.HeapSnapshotProfileType.TypeId, WebInspector.UIString("HEAP SNAPSHOTS"));
+}
+
+WebInspector.HeapSnapshotProfileType.TypeId = "HEAP";
+
+WebInspector.HeapSnapshotProfileType.snapshots = [];
+
+WebInspector.HeapSnapshotProfileType.prototype = {
+ get buttonTooltip()
+ {
+ return WebInspector.UIString("Take heap snapshot.");
+ },
+
+ get buttonStyle()
+ {
+ return "heap-snapshot-status-bar-item status-bar-item";
+ },
+
+ buttonClicked: function()
+ {
+ InspectorBackend.takeHeapSnapshot();
+ },
+
+ get welcomeMessage()
+ {
+ return WebInspector.UIString("Get a heap snapshot by pressing<br>the %s button on the status bar.");
+ },
+
+ createSidebarTreeElementForProfile: function(profile)
+ {
+ var element = new WebInspector.HeapSnapshotSidebarTreeElement(profile);
+ element.small = false;
+ return element;
+ },
+
+ createView: function(profile)
+ {
+ return new WebInspector.HeapSnapshotView(WebInspector.panels.profiles, profile);
+ }
+}
+
+WebInspector.HeapSnapshotProfileType.prototype.__proto__ = WebInspector.ProfileType.prototype;
+
+
+(function() {
+ var originalCreatePanels = WebInspector._createPanels;
+ WebInspector._createPanels = function() {
+ originalCreatePanels.apply(this, arguments);
+ if (WebInspector.panels.profiles)
+ WebInspector.panels.profiles.registerProfileType(new WebInspector.HeapSnapshotProfileType());
+ }
+})();
diff --git a/WebKit/chromium/src/js/Images/segmentChromium.png b/WebKit/chromium/src/js/Images/segmentChromium.png
new file mode 100755
index 0000000..607559b
--- /dev/null
+++ b/WebKit/chromium/src/js/Images/segmentChromium.png
Binary files differ
diff --git a/WebKit/chromium/src/js/Images/segmentHoverChromium.png b/WebKit/chromium/src/js/Images/segmentHoverChromium.png
new file mode 100755
index 0000000..0a743d9
--- /dev/null
+++ b/WebKit/chromium/src/js/Images/segmentHoverChromium.png
Binary files differ
diff --git a/WebKit/chromium/src/js/Images/segmentHoverEndChromium.png b/WebKit/chromium/src/js/Images/segmentHoverEndChromium.png
new file mode 100755
index 0000000..cf62072
--- /dev/null
+++ b/WebKit/chromium/src/js/Images/segmentHoverEndChromium.png
Binary files differ
diff --git a/WebKit/chromium/src/js/Images/segmentSelectedChromium.png b/WebKit/chromium/src/js/Images/segmentSelectedChromium.png
new file mode 100755
index 0000000..a1f7251
--- /dev/null
+++ b/WebKit/chromium/src/js/Images/segmentSelectedChromium.png
Binary files differ
diff --git a/WebKit/chromium/src/js/Images/segmentSelectedEndChromium.png b/WebKit/chromium/src/js/Images/segmentSelectedEndChromium.png
new file mode 100755
index 0000000..07641db
--- /dev/null
+++ b/WebKit/chromium/src/js/Images/segmentSelectedEndChromium.png
Binary files differ
diff --git a/WebKit/chromium/src/js/Images/statusbarBackgroundChromium.png b/WebKit/chromium/src/js/Images/statusbarBackgroundChromium.png
new file mode 100755
index 0000000..9d326ac
--- /dev/null
+++ b/WebKit/chromium/src/js/Images/statusbarBackgroundChromium.png
Binary files differ
diff --git a/WebKit/chromium/src/js/Images/statusbarBottomBackgroundChromium.png b/WebKit/chromium/src/js/Images/statusbarBottomBackgroundChromium.png
new file mode 100755
index 0000000..7c7db0a
--- /dev/null
+++ b/WebKit/chromium/src/js/Images/statusbarBottomBackgroundChromium.png
Binary files differ
diff --git a/WebKit/chromium/src/js/Images/statusbarButtonsChromium.png b/WebKit/chromium/src/js/Images/statusbarButtonsChromium.png
new file mode 100755
index 0000000..0c6635d
--- /dev/null
+++ b/WebKit/chromium/src/js/Images/statusbarButtonsChromium.png
Binary files differ
diff --git a/WebKit/chromium/src/js/Images/statusbarMenuButtonChromium.png b/WebKit/chromium/src/js/Images/statusbarMenuButtonChromium.png
new file mode 100755
index 0000000..bf26684
--- /dev/null
+++ b/WebKit/chromium/src/js/Images/statusbarMenuButtonChromium.png
Binary files differ
diff --git a/WebKit/chromium/src/js/Images/statusbarMenuButtonSelectedChromium.png b/WebKit/chromium/src/js/Images/statusbarMenuButtonSelectedChromium.png
new file mode 100755
index 0000000..3c0aeec
--- /dev/null
+++ b/WebKit/chromium/src/js/Images/statusbarMenuButtonSelectedChromium.png
Binary files differ
diff --git a/WebKit/chromium/src/js/InjectDispatch.js b/WebKit/chromium/src/js/InjectDispatch.js
new file mode 100644
index 0000000..e070c42
--- /dev/null
+++ b/WebKit/chromium/src/js/InjectDispatch.js
@@ -0,0 +1,106 @@
+/*
+ * 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.
+ */
+
+/**
+ * @fileoverview Injects "injected" object into the inspectable page.
+ */
+
+
+var InspectorControllerDispatcher = {};
+
+/**
+ * Main dispatch method, all calls from the host to InspectorController go
+ * through this one.
+ * @param {string} functionName Function to call
+ * @param {string} json_args JSON-serialized call parameters.
+ * @return {string} JSON-serialized result of the dispatched call.
+ */
+InspectorControllerDispatcher.dispatch = function(functionName, json_args)
+{
+ var params = JSON.parse(json_args);
+ InspectorBackend[functionName].apply(InspectorBackend, params);
+};
+
+/**
+ * Special controller object for APU related messages. Outgoing messages
+ * are sent to this object if the ApuAgentDispatcher is enabled.
+ **/
+var ApuAgentDispatcher = { enabled : false };
+
+/**
+ * Dispatches messages to APU. This filters and transforms
+ * outgoing messages that are used by APU.
+ * @param {string} method name of the dispatch method.
+ **/
+ApuAgentDispatcher.dispatchToApu = function(method, args)
+{
+ if (method !== "addRecordToTimeline" && method !== "updateResource" && method !== "addResource")
+ return;
+ // TODO(knorton): Transform args so they can be used
+ // by APU.
+ DevToolsAgentHost.dispatchToApu(JSON.stringify(args));
+};
+
+/**
+ * This is called by the InspectorFrontend for serialization.
+ * We serialize the call and send it to the client over the IPC
+ * using dispatchOut bound method.
+ */
+function dispatch(method, var_args) {
+ // Handle all messages with non-primitieve arguments here.
+ var args = Array.prototype.slice.call(arguments);
+
+ if (method === "inspectedWindowCleared" || method === "reset" || method === "setAttachedWindow") {
+ // Filter out messages we don't need here.
+ // We do it on the sender side since they may have non-serializable
+ // parameters.
+ return;
+ }
+
+ // Sniff some inspector controller state changes in order to support
+ // cross-navigation instrumentation. Keep names in sync with
+ // webdevtoolsagent_impl.
+ if (method === "timelineProfilerWasStarted")
+ DevToolsAgentHost.runtimeFeatureStateChanged("timeline-profiler", true);
+ else if (method === "timelineProfilerWasStopped")
+ DevToolsAgentHost.runtimeFeatureStateChanged("timeline-profiler", false);
+ else if (method === "resourceTrackingWasEnabled")
+ DevToolsAgentHost.runtimeFeatureStateChanged("resource-tracking", true);
+ else if (method === "resourceTrackingWasDisabled")
+ DevToolsAgentHost.runtimeFeatureStateChanged("resource-tracking", false);
+
+ if (ApuAgentDispatcher.enabled) {
+ ApuAgentDispatcher.dispatchToApu(method, args);
+ return;
+ }
+
+ var call = JSON.stringify(args);
+ DevToolsAgentHost.dispatch(call);
+};
diff --git a/WebKit/chromium/src/js/InspectorControllerImpl.js b/WebKit/chromium/src/js/InspectorControllerImpl.js
new file mode 100644
index 0000000..c92a94c
--- /dev/null
+++ b/WebKit/chromium/src/js/InspectorControllerImpl.js
@@ -0,0 +1,279 @@
+/*
+ * 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.
+ */
+
+/**
+ * @fileoverview DevTools' implementation of the InspectorController API.
+ */
+
+if (!this.devtools)
+ devtools = {};
+
+devtools.InspectorBackendImpl = function()
+{
+ WebInspector.InspectorBackendStub.call(this);
+ this.installInspectorControllerDelegate_("clearMessages");
+ this.installInspectorControllerDelegate_("copyNode");
+ this.installInspectorControllerDelegate_("deleteCookie");
+ this.installInspectorControllerDelegate_("didEvaluateForTestInFrontend");
+ this.installInspectorControllerDelegate_("disableResourceTracking");
+ this.installInspectorControllerDelegate_("disableTimeline");
+ this.installInspectorControllerDelegate_("enableResourceTracking");
+ this.installInspectorControllerDelegate_("enableTimeline");
+ this.installInspectorControllerDelegate_("getChildNodes");
+ this.installInspectorControllerDelegate_("getCookies");
+ this.installInspectorControllerDelegate_("getDatabaseTableNames");
+ this.installInspectorControllerDelegate_("getDOMStorageEntries");
+ this.installInspectorControllerDelegate_("getEventListenersForNode");
+ this.installInspectorControllerDelegate_("getResourceContent");
+ this.installInspectorControllerDelegate_("highlightDOMNode");
+ this.installInspectorControllerDelegate_("hideDOMNodeHighlight");
+ this.installInspectorControllerDelegate_("releaseWrapperObjectGroup");
+ this.installInspectorControllerDelegate_("removeAttribute");
+ this.installInspectorControllerDelegate_("removeDOMStorageItem");
+ this.installInspectorControllerDelegate_("removeNode");
+ this.installInspectorControllerDelegate_("saveFrontendSettings");
+ this.installInspectorControllerDelegate_("setAttribute");
+ this.installInspectorControllerDelegate_("setDOMStorageItem");
+ this.installInspectorControllerDelegate_("setInjectedScriptSource");
+ this.installInspectorControllerDelegate_("setTextNodeValue");
+ this.installInspectorControllerDelegate_("startTimelineProfiler");
+ this.installInspectorControllerDelegate_("stopTimelineProfiler");
+ this.installInspectorControllerDelegate_("storeLastActivePanel");
+};
+devtools.InspectorBackendImpl.prototype.__proto__ = WebInspector.InspectorBackendStub.prototype;
+
+
+/**
+ * {@inheritDoc}.
+ */
+devtools.InspectorBackendImpl.prototype.toggleNodeSearch = function()
+{
+ WebInspector.InspectorBackendStub.prototype.toggleNodeSearch.call(this);
+ this.callInspectorController_.call(this, "toggleNodeSearch");
+ if (!this.searchingForNode()) {
+ // This is called from ElementsPanel treeOutline's focusNodeChanged().
+ DevToolsHost.activateWindow();
+ }
+};
+
+
+/**
+ * @override
+ */
+devtools.InspectorBackendImpl.prototype.debuggerEnabled = function()
+{
+ return true;
+};
+
+
+/**
+ * @override
+ */
+devtools.InspectorBackendImpl.prototype.profilerEnabled = function()
+{
+ return true;
+};
+
+
+devtools.InspectorBackendImpl.prototype.addBreakpoint = function(sourceID, line, condition)
+{
+ devtools.tools.getDebuggerAgent().addBreakpoint(sourceID, line, condition);
+};
+
+
+devtools.InspectorBackendImpl.prototype.removeBreakpoint = function(sourceID, line)
+{
+ devtools.tools.getDebuggerAgent().removeBreakpoint(sourceID, line);
+};
+
+devtools.InspectorBackendImpl.prototype.updateBreakpoint = function(sourceID, line, condition)
+{
+ devtools.tools.getDebuggerAgent().updateBreakpoint(sourceID, line, condition);
+};
+
+devtools.InspectorBackendImpl.prototype.pauseInDebugger = function()
+{
+ devtools.tools.getDebuggerAgent().pauseExecution();
+};
+
+
+devtools.InspectorBackendImpl.prototype.resumeDebugger = function()
+{
+ devtools.tools.getDebuggerAgent().resumeExecution();
+};
+
+
+devtools.InspectorBackendImpl.prototype.stepIntoStatementInDebugger = function()
+{
+ devtools.tools.getDebuggerAgent().stepIntoStatement();
+};
+
+
+devtools.InspectorBackendImpl.prototype.stepOutOfFunctionInDebugger = function()
+{
+ devtools.tools.getDebuggerAgent().stepOutOfFunction();
+};
+
+
+devtools.InspectorBackendImpl.prototype.stepOverStatementInDebugger = function()
+{
+ devtools.tools.getDebuggerAgent().stepOverStatement();
+};
+
+/**
+ * @override
+ */
+devtools.InspectorBackendImpl.prototype.setPauseOnExceptionsState = function(state)
+{
+ this._setPauseOnExceptionsState = state;
+ // TODO(yurys): support all three states. See http://crbug.com/32877
+ var enabled = (state !== WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions);
+ return devtools.tools.getDebuggerAgent().setPauseOnExceptions(enabled);
+};
+
+/**
+ * @override
+ */
+devtools.InspectorBackendImpl.prototype.pauseOnExceptionsState = function()
+{
+ return (this._setPauseOnExceptionsState || WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions);
+};
+
+/**
+ * @override
+ */
+devtools.InspectorBackendImpl.prototype.pauseOnExceptions = function()
+{
+ return devtools.tools.getDebuggerAgent().pauseOnExceptions();
+};
+
+
+/**
+ * @override
+ */
+devtools.InspectorBackendImpl.prototype.setPauseOnExceptions = function(value)
+{
+ return devtools.tools.getDebuggerAgent().setPauseOnExceptions(value);
+};
+
+
+/**
+ * @override
+ */
+devtools.InspectorBackendImpl.prototype.startProfiling = function()
+{
+ devtools.tools.getProfilerAgent().startProfiling(devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_CPU);
+};
+
+
+/**
+ * @override
+ */
+devtools.InspectorBackendImpl.prototype.stopProfiling = function()
+{
+ devtools.tools.getProfilerAgent().stopProfiling( devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_CPU);
+};
+
+
+/**
+ * @override
+ */
+devtools.InspectorBackendImpl.prototype.getProfileHeaders = function(callId)
+{
+ WebInspector.didGetProfileHeaders(callId, []);
+};
+
+
+/**
+ * Emulate WebKit InspectorController behavior. It stores profiles on renderer side,
+ * and is able to retrieve them by uid using "getProfile".
+ */
+devtools.InspectorBackendImpl.prototype.addFullProfile = function(profile)
+{
+ WebInspector.__fullProfiles = WebInspector.__fullProfiles || {};
+ WebInspector.__fullProfiles[profile.uid] = profile;
+};
+
+
+/**
+ * @override
+ */
+devtools.InspectorBackendImpl.prototype.getProfile = function(callId, uid)
+{
+ if (WebInspector.__fullProfiles && (uid in WebInspector.__fullProfiles))
+ WebInspector.didGetProfile(callId, WebInspector.__fullProfiles[uid]);
+};
+
+
+/**
+ * @override
+ */
+devtools.InspectorBackendImpl.prototype.takeHeapSnapshot = function()
+{
+ devtools.tools.getProfilerAgent().startProfiling(devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_HEAP_SNAPSHOT
+ | devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_HEAP_STATS
+ | devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_JS_CONSTRUCTORS);
+};
+
+
+/**
+ * @override
+ */
+devtools.InspectorBackendImpl.prototype.dispatchOnInjectedScript = function(callId, injectedScriptId, methodName, argsString, async)
+{
+ // Encode injectedScriptId into callId
+ if (typeof injectedScriptId !== "number")
+ injectedScriptId = 0;
+ RemoteToolsAgent.dispatchOnInjectedScript(callId, injectedScriptId, methodName, argsString, async);
+};
+
+
+/**
+ * Installs delegating handler into the inspector controller.
+ * @param {string} methodName Method to install delegating handler for.
+ */
+devtools.InspectorBackendImpl.prototype.installInspectorControllerDelegate_ = function(methodName)
+{
+ this[methodName] = this.callInspectorController_.bind(this, methodName);
+};
+
+
+/**
+ * Bound function with the installInjectedScriptDelegate_ actual
+ * implementation.
+ */
+devtools.InspectorBackendImpl.prototype.callInspectorController_ = function(methodName, var_arg)
+{
+ var args = Array.prototype.slice.call(arguments, 1);
+ RemoteToolsAgent.dispatchOnInspectorController(WebInspector.Callback.wrap(function(){}), methodName, JSON.stringify(args));
+};
+
+
+InspectorBackend = new devtools.InspectorBackendImpl();
diff --git a/WebKit/chromium/src/js/ProfilerAgent.js b/WebKit/chromium/src/js/ProfilerAgent.js
new file mode 100644
index 0000000..e08c5d2
--- /dev/null
+++ b/WebKit/chromium/src/js/ProfilerAgent.js
@@ -0,0 +1,227 @@
+/*
+ * 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.
+ */
+
+/**
+ * @fileoverview Provides communication interface to remote v8 profiler.
+ */
+
+/**
+ * @constructor
+ */
+devtools.ProfilerAgent = function()
+{
+ RemoteProfilerAgent.didGetActiveProfilerModules = this._didGetActiveProfilerModules.bind(this);
+ RemoteProfilerAgent.didGetLogLines = this._didGetLogLines.bind(this);
+
+ /**
+ * Active profiler modules flags.
+ * @type {number}
+ */
+ this._activeProfilerModules = devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_NONE;
+
+ /**
+ * Interval for polling profiler state.
+ * @type {number}
+ */
+ this._getActiveProfilerModulesInterval = null;
+
+ /**
+ * Profiler log position.
+ * @type {number}
+ */
+ this._logPosition = 0;
+
+ /**
+ * Last requested log position.
+ * @type {number}
+ */
+ this._lastRequestedLogPosition = -1;
+
+ /**
+ * Whether log contents retrieval must be forced next time.
+ * @type {boolean}
+ */
+ this._forceGetLogLines = false;
+
+ /**
+ * Profiler processor instance.
+ * @type {devtools.profiler.Processor}
+ */
+ this._profilerProcessor = new devtools.profiler.Processor();
+};
+
+
+/**
+ * A copy of enum from include/v8.h
+ * @enum {number}
+ */
+devtools.ProfilerAgent.ProfilerModules = {
+ PROFILER_MODULE_NONE: 0,
+ PROFILER_MODULE_CPU: 1,
+ PROFILER_MODULE_HEAP_STATS: 1 << 1,
+ PROFILER_MODULE_JS_CONSTRUCTORS: 1 << 2,
+ PROFILER_MODULE_HEAP_SNAPSHOT: 1 << 16
+};
+
+
+/**
+ * Sets up callbacks that deal with profiles processing.
+ */
+devtools.ProfilerAgent.prototype.setupProfilerProcessorCallbacks = function()
+{
+ // A temporary icon indicating that the profile is being processed.
+ var processingIcon = new WebInspector.SidebarTreeElement(
+ "profile-sidebar-tree-item",
+ WebInspector.UIString("Processing..."),
+ '', null, false);
+ var profilesSidebar = WebInspector.panels.profiles.getProfileType(WebInspector.CPUProfileType.TypeId).treeElement;
+
+ this._profilerProcessor.setCallbacks(
+ function onProfileProcessingStarted() {
+ // Set visually empty string. Subtitle hiding is done via styles
+ // manipulation which doesn't play well with dynamic append / removal.
+ processingIcon.subtitle = " ";
+ profilesSidebar.appendChild(processingIcon);
+ },
+ function onProfileProcessingStatus(ticksCount) {
+ processingIcon.subtitle = WebInspector.UIString("%d ticks processed", ticksCount);
+ },
+ function onProfileProcessingFinished(profile) {
+ profilesSidebar.removeChild(processingIcon);
+ profile.typeId = WebInspector.CPUProfileType.TypeId;
+ InspectorBackend.addFullProfile(profile);
+ WebInspector.addProfileHeader(profile);
+ // If no profile is currently shown, show the new one.
+ var profilesPanel = WebInspector.panels.profiles;
+ if (!profilesPanel.visibleView) {
+ profilesPanel.showProfile(profile);
+ }
+ }
+ );
+};
+
+
+/**
+ * Initializes profiling state.
+ */
+devtools.ProfilerAgent.prototype.initializeProfiling = function()
+{
+ this.setupProfilerProcessorCallbacks();
+ this._forceGetLogLines = true;
+ this._getActiveProfilerModulesInterval = setInterval(function() { RemoteProfilerAgent.getActiveProfilerModules(); }, 1000);
+};
+
+
+/**
+ * Requests the next chunk of log lines.
+ * @param {boolean} immediately Do not postpone the request.
+ * @private
+ */
+devtools.ProfilerAgent.prototype._getNextLogLines = function(immediately)
+{
+ if (this._lastRequestedLogPosition == this._logPosition)
+ return;
+ var pos = this._lastRequestedLogPosition = this._logPosition;
+ if (immediately)
+ RemoteProfilerAgent.getLogLines(pos);
+ else
+ setTimeout(function() { RemoteProfilerAgent.getLogLines(pos); }, 500);
+};
+
+
+/**
+ * Starts profiling.
+ * @param {number} modules List of modules to enable.
+ */
+devtools.ProfilerAgent.prototype.startProfiling = function(modules)
+{
+ var cmd = new devtools.DebugCommand("profile", {
+ "modules": modules,
+ "command": "resume"});
+ devtools.DebuggerAgent.sendCommand_(cmd);
+ RemoteDebuggerAgent.processDebugCommands();
+ if (modules & devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_HEAP_SNAPSHOT) {
+ // Active modules will not change, instead, a snapshot will be logged.
+ this._getNextLogLines();
+ }
+};
+
+
+/**
+ * Stops profiling.
+ */
+devtools.ProfilerAgent.prototype.stopProfiling = function(modules)
+{
+ var cmd = new devtools.DebugCommand("profile", {
+ "modules": modules,
+ "command": "pause"});
+ devtools.DebuggerAgent.sendCommand_(cmd);
+ RemoteDebuggerAgent.processDebugCommands();
+};
+
+
+/**
+ * Handles current profiler status.
+ * @param {number} modules List of active (started) modules.
+ */
+devtools.ProfilerAgent.prototype._didGetActiveProfilerModules = function(modules)
+{
+ var profModules = devtools.ProfilerAgent.ProfilerModules;
+ var profModuleNone = profModules.PROFILER_MODULE_NONE;
+ if (this._forceGetLogLines || (modules !== profModuleNone && this._activeProfilerModules === profModuleNone)) {
+ this._forceGetLogLines = false;
+ // Start to query log data.
+ this._getNextLogLines(true);
+ }
+ this._activeProfilerModules = modules;
+ // Update buttons.
+ WebInspector.setRecordingProfile(modules & profModules.PROFILER_MODULE_CPU);
+};
+
+
+/**
+ * Handles a portion of a profiler log retrieved by getLogLines call.
+ * @param {number} pos Current position in log.
+ * @param {string} log A portion of profiler log.
+ */
+devtools.ProfilerAgent.prototype._didGetLogLines = function(pos, log)
+{
+ this._logPosition = pos;
+ if (log.length > 0)
+ this._profilerProcessor.processLogChunk(log);
+ else {
+ // Allow re-reading from the last position.
+ this._lastRequestedLogPosition = this._logPosition - 1;
+ if (this._activeProfilerModules === devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_NONE)
+ // No new data and profiling is stopped---suspend log reading.
+ return;
+ }
+ this._getNextLogLines();
+};
diff --git a/WebKit/chromium/src/js/ProfilerProcessor.js b/WebKit/chromium/src/js/ProfilerProcessor.js
new file mode 100644
index 0000000..f678d2c
--- /dev/null
+++ b/WebKit/chromium/src/js/ProfilerProcessor.js
@@ -0,0 +1,543 @@
+/*
+ * 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.
+ */
+
+/**
+ * @fileoverview Profiler processor is used to process log file produced
+ * by V8 and produce an internal profile representation which is used
+ * for building profile views in "Profiles" tab.
+ */
+
+
+/**
+ * Creates a Profile View builder object compatible with WebKit Profiler UI.
+ *
+ * @param {number} samplingRate Number of ms between profiler ticks.
+ * @constructor
+ */
+devtools.profiler.WebKitViewBuilder = function(samplingRate)
+{
+ devtools.profiler.ViewBuilder.call(this, samplingRate);
+};
+devtools.profiler.WebKitViewBuilder.prototype.__proto__ = devtools.profiler.ViewBuilder.prototype;
+
+
+/**
+ * @override
+ */
+devtools.profiler.WebKitViewBuilder.prototype.createViewNode = function(funcName, totalTime, selfTime, head)
+{
+ return new devtools.profiler.WebKitViewNode(funcName, totalTime, selfTime, head);
+};
+
+
+/**
+ * Constructs a Profile View node object for displaying in WebKit Profiler UI.
+ *
+ * @param {string} internalFuncName A fully qualified function name.
+ * @param {number} totalTime Amount of time that application spent in the
+ * corresponding function and its descendants (not that depending on
+ * profile they can be either callees or callers.)
+ * @param {number} selfTime Amount of time that application spent in the
+ * corresponding function only.
+ * @param {devtools.profiler.ProfileView.Node} head Profile view head.
+ * @constructor
+ */
+devtools.profiler.WebKitViewNode = function(internalFuncName, totalTime, selfTime, head)
+{
+ devtools.profiler.ProfileView.Node.call(this, internalFuncName, totalTime, selfTime, head);
+ this.initFuncInfo_();
+ this.callUID = internalFuncName;
+};
+devtools.profiler.WebKitViewNode.prototype.__proto__ = devtools.profiler.ProfileView.Node.prototype;
+
+
+/**
+ * RegEx for stripping V8's prefixes of compiled functions.
+ */
+devtools.profiler.WebKitViewNode.FUNC_NAME_STRIP_RE = /^(?:LazyCompile|Function|Callback): (.*)$/;
+
+
+/**
+ * RegEx for extracting script source URL and line number.
+ */
+devtools.profiler.WebKitViewNode.FUNC_NAME_PARSE_RE = /^((?:get | set )?[^ ]+) (.*):(\d+)( \{\d+\})?$/;
+
+
+/**
+ * Inits "functionName", "url", and "lineNumber" fields using "internalFuncName"
+ * field.
+ * @private
+ */
+devtools.profiler.WebKitViewNode.prototype.initFuncInfo_ = function()
+{
+ var nodeAlias = devtools.profiler.WebKitViewNode;
+ this.functionName = this.internalFuncName;
+
+ var strippedName = nodeAlias.FUNC_NAME_STRIP_RE.exec(this.functionName);
+ if (strippedName)
+ this.functionName = strippedName[1];
+
+ var parsedName = nodeAlias.FUNC_NAME_PARSE_RE.exec(this.functionName);
+ if (parsedName) {
+ this.functionName = parsedName[1];
+ if (parsedName[4])
+ this.functionName += parsedName[4];
+ this.url = parsedName[2];
+ this.lineNumber = parsedName[3];
+ } else {
+ this.url = '';
+ this.lineNumber = 0;
+ }
+};
+
+
+/**
+ * Ancestor of a profile object that leaves out only JS-related functions.
+ * @constructor
+ */
+devtools.profiler.JsProfile = function()
+{
+ devtools.profiler.Profile.call(this);
+};
+devtools.profiler.JsProfile.prototype.__proto__ = devtools.profiler.Profile.prototype;
+
+
+/**
+ * RegExp that leaves only non-native JS functions.
+ * @type {RegExp}
+ */
+devtools.profiler.JsProfile.JS_NON_NATIVE_RE = new RegExp(
+ "^" +
+ "(?:Callback:)|" +
+ "(?:Script: (?!native))|" +
+ "(?:(?:LazyCompile|Function): [^ ]*(?: (?!native )[^ ]+:\\d+)?$)");
+
+
+/**
+ * @override
+ */
+devtools.profiler.JsProfile.prototype.skipThisFunction = function(name)
+{
+ return !devtools.profiler.JsProfile.JS_NON_NATIVE_RE.test(name);
+};
+
+
+/**
+ * Profiler processor. Consumes profiler log and builds profile views.
+ * FIXME: change field naming style to use trailing underscore.
+ *
+ * @param {function(devtools.profiler.ProfileView)} newProfileCallback Callback
+ * that receives a new processed profile.
+ * @constructor
+ */
+devtools.profiler.Processor = function()
+{
+ var dispatches = {
+ "code-creation": {
+ parsers: [null, this.createAddressParser("code"), parseInt, null],
+ processor: this.processCodeCreation_, backrefs: true,
+ needsProfile: true },
+ "code-move": { parsers: [this.createAddressParser("code"),
+ this.createAddressParser("code-move-to")],
+ processor: this.processCodeMove_, backrefs: true,
+ needsProfile: true },
+ "code-delete": { parsers: [this.createAddressParser("code")],
+ processor: this.processCodeDelete_, backrefs: true,
+ needsProfile: true },
+ "function-creation": { parsers: [this.createAddressParser("code"),
+ this.createAddressParser("function-obj")],
+ processor: this.processFunctionCreation_, backrefs: true },
+ "function-move": { parsers: [this.createAddressParser("code"),
+ this.createAddressParser("code-move-to")],
+ processor: this.processFunctionMove_, backrefs: true },
+ "function-delete": { parsers: [this.createAddressParser("code")],
+ processor: this.processFunctionDelete_, backrefs: true },
+ "tick": { parsers: [this.createAddressParser("code"),
+ this.createAddressParser("stack"), parseInt, "var-args"],
+ processor: this.processTick_, backrefs: true, needProfile: true },
+ "profiler": { parsers: [null, "var-args"],
+ processor: this.processProfiler_, needsProfile: false },
+ "heap-sample-begin": { parsers: [null, null, parseInt],
+ processor: this.processHeapSampleBegin_ },
+ "heap-sample-stats": { parsers: [null, null, parseInt, parseInt],
+ processor: this.processHeapSampleStats_ },
+ "heap-sample-item": { parsers: [null, parseInt, parseInt],
+ processor: this.processHeapSampleItem_ },
+ "heap-js-cons-item": { parsers: [null, parseInt, parseInt],
+ processor: this.processHeapJsConsItem_ },
+ "heap-js-ret-item": { parsers: [null, "var-args"],
+ processor: this.processHeapJsRetItem_ },
+ "heap-sample-end": { parsers: [null, null],
+ processor: this.processHeapSampleEnd_ },
+ // Not used in DevTools Profiler.
+ "shared-library": null,
+ // Obsolete row types.
+ "code-allocate": null,
+ "begin-code-region": null,
+ "end-code-region": null};
+
+ if (devtools.profiler.Profile.VERSION === 2) {
+ dispatches["tick"] = { parsers: [this.createAddressParser("code"),
+ this.createAddressParser("stack"),
+ this.createAddressParser("func"), parseInt, "var-args"],
+ processor: this.processTickV2_, backrefs: true };
+ }
+
+ devtools.profiler.LogReader.call(this, dispatches);
+
+ /**
+ * Callback that is called when a new profile is encountered in the log.
+ * @type {function()}
+ */
+ this.startedProfileProcessing_ = null;
+
+ /**
+ * Callback that is called periodically to display processing status.
+ * @type {function()}
+ */
+ this.profileProcessingStatus_ = null;
+
+ /**
+ * Callback that is called when a profile has been processed and is ready
+ * to be shown.
+ * @type {function(devtools.profiler.ProfileView)}
+ */
+ this.finishedProfileProcessing_ = null;
+
+ /**
+ * The current profile.
+ * @type {devtools.profiler.JsProfile}
+ */
+ this.currentProfile_ = null;
+
+ /**
+ * Builder of profile views. Created during "profiler,begin" event processing.
+ * @type {devtools.profiler.WebKitViewBuilder}
+ */
+ this.viewBuilder_ = null;
+
+ /**
+ * Next profile id.
+ * @type {number}
+ */
+ this.profileId_ = 1;
+
+ /**
+ * Counter for processed ticks.
+ * @type {number}
+ */
+ this.ticksCount_ = 0;
+
+ /**
+ * Interval id for updating processing status.
+ * @type {number}
+ */
+ this.processingInterval_ = null;
+
+ /**
+ * The current heap snapshot.
+ * @type {string}
+ */
+ this.currentHeapSnapshot_ = null;
+
+ /**
+ * Next heap snapshot id.
+ * @type {number}
+ */
+ this.heapSnapshotId_ = 1;
+};
+devtools.profiler.Processor.prototype.__proto__ = devtools.profiler.LogReader.prototype;
+
+
+/**
+ * @override
+ */
+devtools.profiler.Processor.prototype.printError = function(str)
+{
+ debugPrint(str);
+};
+
+
+/**
+ * @override
+ */
+devtools.profiler.Processor.prototype.skipDispatch = function(dispatch)
+{
+ return dispatch.needsProfile && this.currentProfile_ === null;
+};
+
+
+/**
+ * Sets profile processing callbacks.
+ *
+ * @param {function()} started Started processing callback.
+ * @param {function(devtools.profiler.ProfileView)} finished Finished
+ * processing callback.
+ */
+devtools.profiler.Processor.prototype.setCallbacks = function(started, processing, finished)
+{
+ this.startedProfileProcessing_ = started;
+ this.profileProcessingStatus_ = processing;
+ this.finishedProfileProcessing_ = finished;
+};
+
+
+/**
+ * An address for the fake "(program)" entry. WebKit's visualisation
+ * has assumptions on how the top of the call tree should look like,
+ * and we need to add a fake entry as the topmost function. This
+ * address is chosen because it's the end address of the first memory
+ * page, which is never used for code or data, but only as a guard
+ * page for catching AV errors.
+ *
+ * @type {number}
+ */
+devtools.profiler.Processor.PROGRAM_ENTRY = 0xffff;
+/**
+ * @type {string}
+ */
+devtools.profiler.Processor.PROGRAM_ENTRY_STR = "0xffff";
+
+
+/**
+ * Sets new profile callback.
+ * @param {function(devtools.profiler.ProfileView)} callback Callback function.
+ */
+devtools.profiler.Processor.prototype.setNewProfileCallback = function(callback)
+{
+ this.newProfileCallback_ = callback;
+};
+
+
+devtools.profiler.Processor.prototype.processProfiler_ = function(state, params)
+{
+ switch (state) {
+ case "resume":
+ if (this.currentProfile_ === null) {
+ this.currentProfile_ = new devtools.profiler.JsProfile();
+ // see the comment for devtools.profiler.Processor.PROGRAM_ENTRY
+ this.currentProfile_.addCode("Function", "(program)", devtools.profiler.Processor.PROGRAM_ENTRY, 1);
+ if (this.startedProfileProcessing_)
+ this.startedProfileProcessing_();
+ this.ticksCount_ = 0;
+ var self = this;
+ if (this.profileProcessingStatus_) {
+ this.processingInterval_ = window.setInterval(
+ function() { self.profileProcessingStatus_(self.ticksCount_); },
+ 1000);
+ }
+ }
+ break;
+ case "pause":
+ if (this.currentProfile_ !== null) {
+ window.clearInterval(this.processingInterval_);
+ this.processingInterval_ = null;
+ if (this.finishedProfileProcessing_)
+ this.finishedProfileProcessing_(this.createProfileForView());
+ this.currentProfile_ = null;
+ }
+ break;
+ case "begin":
+ var samplingRate = NaN;
+ if (params.length > 0)
+ samplingRate = parseInt(params[0]);
+ if (isNaN(samplingRate))
+ samplingRate = 1;
+ this.viewBuilder_ = new devtools.profiler.WebKitViewBuilder(samplingRate);
+ break;
+ // These events are valid but aren't used.
+ case "compression":
+ case "end": break;
+ default:
+ throw new Error("unknown profiler state: " + state);
+ }
+};
+
+
+devtools.profiler.Processor.prototype.processCodeCreation_ = function(type, start, size, name)
+{
+ this.currentProfile_.addCode(this.expandAlias(type), name, start, size);
+};
+
+
+devtools.profiler.Processor.prototype.processCodeMove_ = function(from, to)
+{
+ this.currentProfile_.moveCode(from, to);
+};
+
+
+devtools.profiler.Processor.prototype.processCodeDelete_ = function(start)
+{
+ this.currentProfile_.deleteCode(start);
+};
+
+
+devtools.profiler.Processor.prototype.processFunctionCreation_ = function(functionAddr, codeAddr)
+{
+ this.currentProfile_.addCodeAlias(functionAddr, codeAddr);
+};
+
+
+devtools.profiler.Processor.prototype.processFunctionMove_ = function(from, to)
+{
+ this.currentProfile_.safeMoveDynamicCode(from, to);
+};
+
+
+devtools.profiler.Processor.prototype.processFunctionDelete_ = function(start)
+{
+ this.currentProfile_.safeDeleteDynamicCode(start);
+};
+
+
+// TODO(mnaganov): Remove after next V8 roll.
+devtools.profiler.Processor.prototype.processTick_ = function(pc, sp, vmState, stack)
+{
+ // see the comment for devtools.profiler.Processor.PROGRAM_ENTRY
+ stack.push(devtools.profiler.Processor.PROGRAM_ENTRY_STR);
+ this.currentProfile_.recordTick(this.processStack(pc, stack));
+ this.ticksCount_++;
+};
+
+
+devtools.profiler.Processor.prototype.processTickV2_ = function(pc, sp, func, vmState, stack)
+{
+ // see the comment for devtools.profiler.Processor.PROGRAM_ENTRY
+ stack.push(devtools.profiler.Processor.PROGRAM_ENTRY_STR);
+
+
+ if (func) {
+ var funcEntry = this.currentProfile_.findEntry(func);
+ if (!funcEntry || !funcEntry.isJSFunction || !funcEntry.isJSFunction())
+ func = 0;
+ else {
+ var currEntry = this.currentProfile_.findEntry(pc);
+ if (!currEntry || !currEntry.isJSFunction || currEntry.isJSFunction()) {
+ func = 0;
+ }
+ }
+ }
+
+ this.currentProfile_.recordTick(this.processStack(pc, func, stack));
+ this.ticksCount_++;
+};
+
+
+devtools.profiler.Processor.prototype.processHeapSampleBegin_ = function(space, state, ticks)
+{
+ if (space !== "Heap") return;
+ this.currentHeapSnapshot_ = {
+ number: this.heapSnapshotId_++,
+ entries: {},
+ clusters: {},
+ lowlevels: {},
+ ticks: ticks
+ };
+};
+
+
+devtools.profiler.Processor.prototype.processHeapSampleStats_ = function(space, state, capacity, used)
+{
+ if (space !== "Heap") return;
+};
+
+
+devtools.profiler.Processor.prototype.processHeapSampleItem_ = function(item, number, size)
+{
+ if (!this.currentHeapSnapshot_) return;
+ this.currentHeapSnapshot_.lowlevels[item] = {
+ type: item, count: number, size: size
+ };
+};
+
+
+devtools.profiler.Processor.prototype.processHeapJsConsItem_ = function(item, number, size)
+{
+ if (!this.currentHeapSnapshot_) return;
+ this.currentHeapSnapshot_.entries[item] = {
+ cons: item, count: number, size: size, retainers: {}
+ };
+};
+
+
+devtools.profiler.Processor.prototype.processHeapJsRetItem_ = function(item, retainersArray)
+{
+ if (!this.currentHeapSnapshot_) return;
+ var rawRetainers = {};
+ for (var i = 0, n = retainersArray.length; i < n; ++i) {
+ var entry = retainersArray[i].split(";");
+ rawRetainers[entry[0]] = parseInt(entry[1], 10);
+ }
+
+ function mergeRetainers(entry) {
+ for (var rawRetainer in rawRetainers) {
+ var consName = rawRetainer.indexOf(":") !== -1 ? rawRetainer.split(":")[0] : rawRetainer;
+ if (!(consName in entry.retainers))
+ entry.retainers[consName] = { cons: consName, count: 0, clusters: {} };
+ var retainer = entry.retainers[consName];
+ retainer.count += rawRetainers[rawRetainer];
+ if (consName !== rawRetainer)
+ retainer.clusters[rawRetainer] = true;
+ }
+ }
+
+ if (item.indexOf(":") !== -1) {
+ // Array, Function, or Object instances cluster case.
+ if (!(item in this.currentHeapSnapshot_.clusters)) {
+ this.currentHeapSnapshot_.clusters[item] = {
+ cons: item, retainers: {}
+ };
+ }
+ mergeRetainers(this.currentHeapSnapshot_.clusters[item]);
+ item = item.split(":")[0];
+ }
+ mergeRetainers(this.currentHeapSnapshot_.entries[item]);
+};
+
+
+devtools.profiler.Processor.prototype.processHeapSampleEnd_ = function(space, state)
+{
+ if (space !== "Heap") return;
+ var snapshot = this.currentHeapSnapshot_;
+ this.currentHeapSnapshot_ = null;
+ WebInspector.panels.profiles.addSnapshot(snapshot);
+};
+
+
+/**
+ * Creates a profile for further displaying in ProfileView.
+ */
+devtools.profiler.Processor.prototype.createProfileForView = function()
+{
+ var profile = this.viewBuilder_.buildView(this.currentProfile_.getTopDownProfile());
+ profile.uid = this.profileId_++;
+ profile.title = UserInitiatedProfileName + "." + profile.uid;
+ return profile;
+};
diff --git a/WebKit/chromium/src/js/Tests.js b/WebKit/chromium/src/js/Tests.js
new file mode 100644
index 0000000..fa0c99f
--- /dev/null
+++ b/WebKit/chromium/src/js/Tests.js
@@ -0,0 +1,1862 @@
+/*
+ * 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.
+ */
+
+
+/**
+ * @fileoverview This file contains small testing framework along with the
+ * test suite for the frontend. These tests are a part of the continues build
+ * and are executed by the devtools_sanity_unittest.cc as a part of the
+ * Interactive UI Test suite.
+ * FIXME: change field naming style to use trailing underscore.
+ */
+
+if (window.domAutomationController) {
+
+var ___interactiveUiTestsMode = true;
+
+/**
+ * Test suite for interactive UI tests.
+ * @constructor
+ */
+TestSuite = function()
+{
+ this.controlTaken_ = false;
+ this.timerId_ = -1;
+};
+
+
+/**
+ * Reports test failure.
+ * @param {string} message Failure description.
+ */
+TestSuite.prototype.fail = function(message)
+{
+ if (this.controlTaken_)
+ this.reportFailure_(message);
+ else
+ throw message;
+};
+
+
+/**
+ * Equals assertion tests that expected === actual.
+ * @param {Object} expected Expected object.
+ * @param {Object} actual Actual object.
+ * @param {string} opt_message User message to print if the test fails.
+ */
+TestSuite.prototype.assertEquals = function(expected, actual, opt_message)
+{
+ if (expected !== actual) {
+ var message = "Expected: '" + expected + "', but was '" + actual + "'";
+ if (opt_message)
+ message = opt_message + "(" + message + ")";
+ this.fail(message);
+ }
+};
+
+
+/**
+ * True assertion tests that value == true.
+ * @param {Object} value Actual object.
+ * @param {string} opt_message User message to print if the test fails.
+ */
+TestSuite.prototype.assertTrue = function(value, opt_message)
+{
+ this.assertEquals(true, !!value, opt_message);
+};
+
+
+/**
+ * Contains assertion tests that string contains substring.
+ * @param {string} string Outer.
+ * @param {string} substring Inner.
+ */
+TestSuite.prototype.assertContains = function(string, substring)
+{
+ if (string.indexOf(substring) === -1)
+ this.fail("Expected to: '" + string + "' to contain '" + substring + "'");
+};
+
+
+/**
+ * Takes control over execution.
+ */
+TestSuite.prototype.takeControl = function()
+{
+ this.controlTaken_ = true;
+ // Set up guard timer.
+ var self = this;
+ this.timerId_ = setTimeout(function() {
+ self.reportFailure_("Timeout exceeded: 20 sec");
+ }, 20000);
+};
+
+
+/**
+ * Releases control over execution.
+ */
+TestSuite.prototype.releaseControl = function()
+{
+ if (this.timerId_ !== -1) {
+ clearTimeout(this.timerId_);
+ this.timerId_ = -1;
+ }
+ this.reportOk_();
+};
+
+
+/**
+ * Async tests use this one to report that they are completed.
+ */
+TestSuite.prototype.reportOk_ = function()
+{
+ window.domAutomationController.send("[OK]");
+};
+
+
+/**
+ * Async tests use this one to report failures.
+ */
+TestSuite.prototype.reportFailure_ = function(error)
+{
+ if (this.timerId_ !== -1) {
+ clearTimeout(this.timerId_);
+ this.timerId_ = -1;
+ }
+ window.domAutomationController.send("[FAILED] " + error);
+};
+
+
+/**
+ * Runs all global functions starting with "test" as unit tests.
+ */
+TestSuite.prototype.runTest = function(testName)
+{
+ try {
+ this[testName]();
+ if (!this.controlTaken_)
+ this.reportOk_();
+ } catch (e) {
+ this.reportFailure_(e);
+ }
+};
+
+
+/**
+ * @param {string} panelName Name of the panel to show.
+ */
+TestSuite.prototype.showPanel = function(panelName)
+{
+ // Open Scripts panel.
+ var toolbar = document.getElementById("toolbar");
+ var button = toolbar.getElementsByClassName(panelName)[0];
+ button.click();
+ this.assertEquals(WebInspector.panels[panelName], WebInspector.currentPanel);
+};
+
+
+/**
+ * Overrides the method with specified name until it's called first time.
+ * @param {Object} receiver An object whose method to override.
+ * @param {string} methodName Name of the method to override.
+ * @param {Function} override A function that should be called right after the
+ * overriden method returns.
+ * @param {boolean} opt_sticky Whether restore original method after first run
+ * or not.
+ */
+TestSuite.prototype.addSniffer = function(receiver, methodName, override, opt_sticky)
+{
+ var orig = receiver[methodName];
+ if (typeof orig !== "function")
+ this.fail("Cannot find method to override: " + methodName);
+ var test = this;
+ receiver[methodName] = function(var_args) {
+ try {
+ var result = orig.apply(this, arguments);
+ } finally {
+ if (!opt_sticky)
+ receiver[methodName] = orig;
+ }
+ // In case of exception the override won't be called.
+ try {
+ override.apply(this, arguments);
+ } catch (e) {
+ test.fail("Exception in overriden method '" + methodName + "': " + e);
+ }
+ return result;
+ };
+};
+
+
+// UI Tests
+
+
+/**
+ * Tests that the real injected host is present in the context.
+ */
+TestSuite.prototype.testHostIsPresent = function()
+{
+ this.assertTrue(typeof InspectorFrontendHost === "object" && !InspectorFrontendHost.isStub);
+};
+
+
+/**
+ * Tests elements tree has an "HTML" root.
+ */
+TestSuite.prototype.testElementsTreeRoot = function()
+{
+ var doc = WebInspector.domAgent.document;
+ this.assertEquals("HTML", doc.documentElement.nodeName);
+ this.assertTrue(doc.documentElement.hasChildNodes());
+};
+
+
+/**
+ * Tests that main resource is present in the system and that it is
+ * the only resource.
+ */
+TestSuite.prototype.testMainResource = function()
+{
+ var tokens = [];
+ var resources = WebInspector.resources;
+ for (var id in resources)
+ tokens.push(resources[id].lastPathComponent);
+ this.assertEquals("simple_page.html", tokens.join(","));
+};
+
+
+/**
+ * Tests that resources tab is enabled when corresponding item is selected.
+ */
+TestSuite.prototype.testEnableResourcesTab = function()
+{
+ this.showPanel("resources");
+
+ var test = this;
+ this.addSniffer(WebInspector, "updateResource",
+ function(identifier, payload) {
+ test.assertEquals("simple_page.html", payload.lastPathComponent);
+ WebInspector.panels.resources.refresh();
+ WebInspector.panels.resources.revealAndSelectItem(WebInspector.resources[identifier]);
+
+ test.releaseControl();
+ });
+
+ // Following call should lead to reload that we capture in the
+ // addResource override.
+ WebInspector.panels.resources._enableResourceTracking();
+
+ // We now have some time to report results to controller.
+ this.takeControl();
+};
+
+
+/**
+ * Tests that correct content length is reported for resources.
+ */
+TestSuite.prototype.testResourceContentLength = function()
+{
+ this.showPanel("resources");
+ var test = this;
+
+ var png = false;
+ var html = false;
+ this.addSniffer(WebInspector, "updateResource",
+ function(identifier, payload) {
+ if (!payload.didLengthChange)
+ return;
+ var resource = WebInspector.resources[identifier];
+ if (!resource || !resource.url)
+ return;
+ if (resource.url.search("image.html$") !== -1) {
+ var expectedLength = 87;
+ test.assertTrue(
+ resource.contentLength <= expectedLength,
+ "image.html content length is greater thatn expected.");
+ if (expectedLength === resource.contentLength)
+ html = true;
+ } else if (resource.url.search("image.png") !== -1) {
+ var expectedLength = 257796;
+ test.assertTrue(
+ resource.contentLength <= expectedLength,
+ "image.png content length is greater than expected.");
+ if (expectedLength === resource.contentLength)
+ png = true;
+ }
+ if (html && png) {
+ // Wait 1 second before releasing control to check that the content
+ // lengths are not updated anymore.
+ setTimeout(function() {
+ test.releaseControl();
+ }, 1000);
+ }
+ }, true);
+
+ // Make sure resource tracking is on.
+ WebInspector.panels.resources._enableResourceTracking();
+ // Reload inspected page to update all resources.
+ test.evaluateInConsole_(
+ "window.location.reload(true);",
+ function(resultText) {
+ test.assertEquals("undefined", resultText, "Unexpected result of reload().");
+ });
+
+ // We now have some time to report results to controller.
+ this.takeControl();
+};
+
+
+/**
+ * Tests resource headers.
+ */
+TestSuite.prototype.testResourceHeaders = function()
+{
+ this.showPanel("resources");
+
+ var test = this;
+
+ var responseOk = false;
+ var timingOk = false;
+
+ this.addSniffer(WebInspector, "updateResource",
+ function(identifier, payload) {
+ var resource = this.resources[identifier];
+ if (!resource || resource.mainResource) {
+ // We are only interested in secondary resources in this test.
+ return;
+ }
+
+ var requestHeaders = JSON.stringify(resource.requestHeaders);
+ test.assertContains(requestHeaders, "Accept");
+
+ if (payload.didResponseChange) {
+ var responseHeaders = JSON.stringify(resource.responseHeaders);
+ test.assertContains(responseHeaders, "Content-type");
+ test.assertContains(responseHeaders, "Content-Length");
+ test.assertTrue(typeof resource.responseReceivedTime !== "undefined");
+ responseOk = true;
+ }
+
+ if (payload.didTimingChange) {
+ test.assertTrue(typeof resource.startTime !== "undefined");
+ timingOk = true;
+ }
+
+ if (payload.didCompletionChange) {
+ test.assertTrue(responseOk);
+ test.assertTrue(timingOk);
+ test.assertTrue(typeof resource.endTime !== "undefined");
+ test.releaseControl();
+ }
+ }, true);
+
+ WebInspector.panels.resources._enableResourceTracking();
+ this.takeControl();
+};
+
+
+/**
+ * Tests the mime type of a cached (HTTP 304) resource.
+ */
+TestSuite.prototype.testCachedResourceMimeType = function()
+{
+ this.showPanel("resources");
+
+ var test = this;
+ var hasReloaded = false;
+
+ this.addSniffer(WebInspector, "updateResource",
+ function(identifier, payload) {
+ var resource = this.resources[identifier];
+ if (!resource || resource.mainResource) {
+ // We are only interested in secondary resources in this test.
+ return;
+ }
+
+ if (payload.didResponseChange) {
+ // Test server uses a default mime type for JavaScript files.
+ test.assertEquals("text/html", payload.mimeType);
+ if (!hasReloaded) {
+ hasReloaded = true;
+ // Reload inspected page to update all resources.
+ test.evaluateInConsole_("window.location.reload(true);", function() {});
+ } else
+ test.releaseControl();
+ }
+
+ }, true);
+
+ WebInspector.panels.resources._enableResourceTracking();
+ this.takeControl();
+};
+
+
+/**
+ * Tests that profiler works.
+ */
+TestSuite.prototype.testProfilerTab = function()
+{
+ this.showPanel("profiles");
+
+ var test = this;
+ this.addSniffer(WebInspector.panels.profiles, "addProfileHeader",
+ function(typeOrProfile, profile) {
+ if (!profile)
+ profile = typeOrProfile;
+ var panel = WebInspector.panels.profiles;
+ panel.showProfile(profile);
+ var node = panel.visibleView.profileDataGridTree.children[0];
+ // Iterate over displayed functions and search for a function
+ // that is called "fib" or "eternal_fib". If found, it will mean
+ // that we actually have profiled page's code.
+ while (node) {
+ if (node.functionName.indexOf("fib") !== -1)
+ test.releaseControl();
+ node = node.traverseNextNode(true, null, true);
+ }
+
+ test.fail();
+ });
+ var ticksCount = 0;
+ var tickRecord = "\nt,";
+ this.addSniffer(RemoteProfilerAgent, "didGetLogLines",
+ function(posIgnored, log) {
+ var pos = 0;
+ while ((pos = log.indexOf(tickRecord, pos)) !== -1) {
+ pos += tickRecord.length;
+ ticksCount++;
+ }
+ if (ticksCount > 100)
+ InspectorBackend.stopProfiling();
+ }, true);
+
+ InspectorBackend.startProfiling();
+ this.takeControl();
+};
+
+
+/**
+ * Tests that scripts tab can be open and populated with inspected scripts.
+ */
+TestSuite.prototype.testShowScriptsTab = function()
+{
+ this.showPanel("scripts");
+ var test = this;
+ // There should be at least main page script.
+ this._waitUntilScriptsAreParsed(["debugger_test_page.html$"],
+ function() {
+ test.releaseControl();
+ });
+ // Wait until all scripts are added to the debugger.
+ this.takeControl();
+};
+
+
+/**
+ * Tests that scripts tab is populated with inspected scripts even if it
+ * hadn't been shown by the moment inspected paged refreshed.
+ * @see http://crbug.com/26312
+ */
+TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh = function()
+{
+ var test = this;
+ this.assertEquals(WebInspector.panels.elements, WebInspector.currentPanel, "Elements panel should be current one.");
+
+ this.addSniffer(devtools.DebuggerAgent.prototype, "reset", waitUntilScriptIsParsed);
+
+ // Reload inspected page. It will reset the debugger agent.
+ test.evaluateInConsole_(
+ "window.location.reload(true);",
+ function(resultText) {
+ test.assertEquals("undefined", resultText, "Unexpected result of reload().");
+ });
+
+ function waitUntilScriptIsParsed() {
+ var parsed = devtools.tools.getDebuggerAgent().parsedScripts_;
+ for (var id in parsed) {
+ var url = parsed[id].getUrl();
+ if (url && url.search("debugger_test_page.html$") !== -1) {
+ checkScriptsPanel();
+ return;
+ }
+ }
+ test.addSniffer(devtools.DebuggerAgent.prototype, "addScriptInfo_", waitUntilScriptIsParsed);
+ }
+
+ function checkScriptsPanel() {
+ test.showPanel("scripts");
+ test.assertTrue(test._scriptsAreParsed(["debugger_test_page.html$"]), "Inspected script not found in the scripts list");
+ test.releaseControl();
+ }
+
+ // Wait until all scripts are added to the debugger.
+ this.takeControl();
+};
+
+
+/**
+ * Tests that scripts list contains content scripts.
+ */
+TestSuite.prototype.testContentScriptIsPresent = function()
+{
+ this.showPanel("scripts");
+ var test = this;
+
+ test._waitUntilScriptsAreParsed(
+ ["page_with_content_script.html$", "simple_content_script.js$"],
+ function() {
+ test.releaseControl();
+ });
+
+ // Wait until all scripts are added to the debugger.
+ this.takeControl();
+};
+
+
+/**
+ * Tests that scripts are not duplicaed on Scripts tab switch.
+ */
+TestSuite.prototype.testNoScriptDuplicatesOnPanelSwitch = function()
+{
+ var test = this;
+
+ // There should be two scripts: one for the main page and another
+ // one which is source of console API(see
+ // InjectedScript._ensureCommandLineAPIInstalled).
+ var expectedScriptsCount = 2;
+ var parsedScripts = [];
+
+ this.showPanel("scripts");
+
+
+ function switchToElementsTab() {
+ test.showPanel("elements");
+ setTimeout(switchToScriptsTab, 0);
+ }
+
+ function switchToScriptsTab() {
+ test.showPanel("scripts");
+ setTimeout(checkScriptsPanel, 0);
+ }
+
+ function checkScriptsPanel() {
+ test.assertTrue(!!WebInspector.panels.scripts.visibleView, "No visible script view.");
+ test.assertTrue(test._scriptsAreParsed(["debugger_test_page.html$"]), "Some scripts are missing.");
+ checkNoDuplicates();
+ test.releaseControl();
+ }
+
+ function checkNoDuplicates() {
+ var scriptSelect = document.getElementById("scripts-files");
+ var options = scriptSelect.options;
+ for (var i = 0; i < options.length; i++) {
+ var scriptName = options[i].text;
+ for (var j = i + 1; j < options.length; j++)
+ test.assertTrue(scriptName !== options[j].text, "Found script duplicates: " + test.optionsToString_(options));
+ }
+ }
+
+ test._waitUntilScriptsAreParsed(
+ ["debugger_test_page.html$"],
+ function() {
+ checkNoDuplicates();
+ setTimeout(switchToElementsTab, 0);
+ });
+
+
+ // Wait until all scripts are added to the debugger.
+ this.takeControl();
+};
+
+
+/**
+ * Tests that a breakpoint can be set.
+ */
+TestSuite.prototype.testSetBreakpoint = function()
+{
+ var test = this;
+ this.showPanel("scripts");
+
+ var breakpointLine = 12;
+
+ this._waitUntilScriptsAreParsed(["debugger_test_page.html"],
+ function() {
+ test.showMainPageScriptSource_(
+ "debugger_test_page.html",
+ function(view, url) {
+ view._addBreakpoint(breakpointLine);
+ // Force v8 execution.
+ RemoteDebuggerAgent.processDebugCommands();
+ test.waitForSetBreakpointResponse_(url, breakpointLine,
+ function() {
+ test.releaseControl();
+ });
+ });
+ });
+
+ this.takeControl();
+};
+
+
+/**
+ * Tests that pause on exception works.
+ */
+TestSuite.prototype.testPauseOnException = function()
+{
+ this.showPanel("scripts");
+ var test = this;
+
+ // TODO(yurys): remove else branch once the states are supported.
+ if (WebInspector.ScriptsPanel.PauseOnExceptionsState) {
+ while (WebInspector.currentPanel.pauseOnExceptionButton.state !== WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnUncaughtExceptions)
+ WebInspector.currentPanel.pauseOnExceptionButton.element.click();
+ } else {
+ // Make sure pause on exceptions is on.
+ if (!WebInspector.currentPanel.pauseOnExceptionButton.toggled)
+ WebInspector.currentPanel.pauseOnExceptionButton.element.click();
+ }
+
+ this._executeCodeWhenScriptsAreParsed("handleClick()", ["pause_on_exception.html$"]);
+
+ this._waitForScriptPause(
+ {
+ functionsOnStack: ["throwAnException", "handleClick", "(anonymous function)"],
+ lineNumber: 6,
+ lineText: " return unknown_var;"
+ },
+ function() {
+ test.releaseControl();
+ });
+
+ this.takeControl();
+};
+
+
+// Tests that debugger works correctly if pause event occurs when DevTools
+// frontend is being loaded.
+TestSuite.prototype.testPauseWhenLoadingDevTools = function()
+{
+ this.showPanel("scripts");
+ var test = this;
+
+ var expectations = {
+ functionsOnStack: ["callDebugger"],
+ lineNumber: 8,
+ lineText: " debugger;"
+ };
+
+
+ // Script execution can already be paused.
+ if (WebInspector.currentPanel.paused) {
+ var callFrame = WebInspector.currentPanel.sidebarPanes.callstack.selectedCallFrame;
+ this.assertEquals(expectations.functionsOnStack[0], callFrame.functionName);
+ var callbackInvoked = false;
+ this._checkSourceFrameWhenLoaded(expectations, function() {
+ callbackInvoked = true;
+ if (test.controlTaken_)
+ test.releaseControl();
+ });
+ if (!callbackInvoked) {
+ test.takeControl();
+ }
+ return;
+ }
+
+ this._waitForScriptPause(
+ {
+ functionsOnStack: ["callDebugger"],
+ lineNumber: 8,
+ lineText: " debugger;"
+ },
+ function() {
+ test.releaseControl();
+ });
+ this.takeControl();
+};
+
+
+// Tests that pressing "Pause" will pause script execution if the script
+// is already running.
+TestSuite.prototype.testPauseWhenScriptIsRunning = function()
+{
+ this.showPanel("scripts");
+ var test = this;
+
+ test.evaluateInConsole_(
+ 'setTimeout("handleClick()" , 0)',
+ function(resultText) {
+ test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText);
+ testScriptPauseAfterDelay();
+ });
+
+ // Wait for some time to make sure that inspected page is running the
+ // infinite loop.
+ function testScriptPauseAfterDelay() {
+ setTimeout(testScriptPause, 300);
+ }
+
+ function testScriptPause() {
+ // The script should be in infinite loop. Click "Pause" button to
+ // pause it and wait for the result.
+ WebInspector.panels.scripts.pauseButton.click();
+
+ test._waitForScriptPause(
+ {
+ functionsOnStack: ["handleClick", "(anonymous function)"],
+ lineNumber: 5,
+ lineText: " while(true) {"
+ },
+ function() {
+ test.releaseControl();
+ });
+ }
+
+ this.takeControl();
+};
+
+
+/**
+ * Serializes options collection to string.
+ * @param {HTMLOptionsCollection} options
+ * @return {string}
+ */
+TestSuite.prototype.optionsToString_ = function(options)
+{
+ var names = [];
+ for (var i = 0; i < options.length; i++)
+ names.push('"' + options[i].text + '"');
+ return names.join(",");
+};
+
+
+/**
+ * Ensures that main HTML resource is selected in Scripts panel and that its
+ * source frame is setup. Invokes the callback when the condition is satisfied.
+ * @param {HTMLOptionsCollection} options
+ * @param {function(WebInspector.SourceView,string)} callback
+ */
+TestSuite.prototype.showMainPageScriptSource_ = function(scriptName, callback)
+{
+ var test = this;
+
+ var scriptSelect = document.getElementById("scripts-files");
+ var options = scriptSelect.options;
+
+ test.assertTrue(options.length, "Scripts list is empty");
+
+ // Select page's script if it's not current option.
+ var scriptResource;
+ if (options[scriptSelect.selectedIndex].text === scriptName)
+ scriptResource = options[scriptSelect.selectedIndex].representedObject;
+ else {
+ var pageScriptIndex = -1;
+ for (var i = 0; i < options.length; i++) {
+ if (options[i].text === scriptName) {
+ pageScriptIndex = i;
+ break;
+ }
+ }
+ test.assertTrue(-1 !== pageScriptIndex, "Script with url " + scriptName + " not found among " + test.optionsToString_(options));
+ scriptResource = options[pageScriptIndex].representedObject;
+
+ // Current panel is "Scripts".
+ WebInspector.currentPanel._showScriptOrResource(scriptResource);
+ test.assertEquals(pageScriptIndex, scriptSelect.selectedIndex, "Unexpected selected option index.");
+ }
+
+ test.assertTrue(scriptResource instanceof WebInspector.Resource,
+ "Unexpected resource class.");
+ test.assertTrue(!!scriptResource.url, "Resource URL is null.");
+ test.assertTrue(scriptResource.url.search(scriptName + "$") !== -1, "Main HTML resource should be selected.");
+
+ var scriptsPanel = WebInspector.panels.scripts;
+
+ var view = scriptsPanel.visibleView;
+ test.assertTrue(view instanceof WebInspector.SourceView);
+
+ if (!view.sourceFrame._loaded) {
+ test.addSniffer(view, "_sourceFrameSetupFinished", function(event) {
+ callback(view, scriptResource.url);
+ });
+ } else
+ callback(view, scriptResource.url);
+};
+
+
+/*
+ * Evaluates the code in the console as if user typed it manually and invokes
+ * the callback when the result message is received and added to the console.
+ * @param {string} code
+ * @param {function(string)} callback
+ */
+TestSuite.prototype.evaluateInConsole_ = function(code, callback)
+{
+ WebInspector.console.visible = true;
+ WebInspector.console.prompt.text = code;
+ WebInspector.console.promptElement.dispatchEvent( TestSuite.createKeyEvent("Enter"));
+
+ this.addSniffer(WebInspector.ConsoleView.prototype, "addMessage",
+ function(commandResult) {
+ callback(commandResult.toMessageElement().textContent);
+ });
+};
+
+
+/*
+ * Waits for "setbreakpoint" response, checks that corresponding breakpoint
+ * was successfully set and invokes the callback if it was.
+ * @param {string} scriptUrl
+ * @param {number} breakpointLine
+ * @param {function()} callback
+ */
+TestSuite.prototype.waitForSetBreakpointResponse_ = function(scriptUrl, breakpointLine, callback)
+{
+ var test = this;
+ test.addSniffer(
+ devtools.DebuggerAgent.prototype,
+ "handleSetBreakpointResponse_",
+ function(msg) {
+ var bps = this.urlToBreakpoints_[scriptUrl];
+ test.assertTrue(!!bps, "No breakpoints for line " + breakpointLine);
+ var line = devtools.DebuggerAgent.webkitToV8LineNumber_(breakpointLine);
+ test.assertTrue(!!bps[line].getV8Id(), "Breakpoint id was not assigned.");
+ callback();
+ });
+};
+
+
+/**
+ * Tests eval on call frame.
+ */
+TestSuite.prototype.testEvalOnCallFrame = function()
+{
+ this.showPanel("scripts");
+
+ var breakpointLine = 16;
+
+ var test = this;
+ this.addSniffer(devtools.DebuggerAgent.prototype, "handleScriptsResponse_",
+ function(msg) {
+ test.showMainPageScriptSource_(
+ "debugger_test_page.html",
+ function(view, url) {
+ view._addBreakpoint(breakpointLine);
+ // Force v8 execution.
+ RemoteDebuggerAgent.processDebugCommands();
+ test.waitForSetBreakpointResponse_(url, breakpointLine, setBreakpointCallback);
+ });
+ });
+
+ function setBreakpointCallback() {
+ // Since breakpoints are ignored in evals' calculate() function is
+ // execute after zero-timeout so that the breakpoint is hit.
+ test.evaluateInConsole_(
+ 'setTimeout("calculate(123)" , 0)',
+ function(resultText) {
+ test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText);
+ waitForBreakpointHit();
+ });
+ }
+
+ function waitForBreakpointHit() {
+ test.addSniffer(
+ devtools.DebuggerAgent.prototype,
+ "handleBacktraceResponse_",
+ function(msg) {
+ test.assertEquals(2, this.callFrames_.length, "Unexpected stack depth on the breakpoint. " + JSON.stringify(msg));
+ test.assertEquals("calculate", this.callFrames_[0].functionName, "Unexpected top frame function.");
+ // Evaluate "e+1" where "e" is an argument of "calculate" function.
+ test.evaluateInConsole_(
+ "e+1",
+ function(resultText) {
+ test.assertEquals("124", resultText, 'Unexpected "e+1" value.');
+ test.releaseControl();
+ });
+ });
+ }
+
+ this.takeControl();
+};
+
+
+/**
+ * Tests that console auto completion works when script execution is paused.
+ */
+TestSuite.prototype.testCompletionOnPause = function()
+{
+ this.showPanel("scripts");
+ var test = this;
+ this._executeCodeWhenScriptsAreParsed("handleClick()", ["completion_on_pause.html$"]);
+
+ this._waitForScriptPause(
+ {
+ functionsOnStack: ["innerFunction", "handleClick", "(anonymous function)"],
+ lineNumber: 9,
+ lineText: " debugger;"
+ },
+ showConsole);
+
+ function showConsole() {
+ test.addSniffer(WebInspector.console, "afterShow", testLocalsCompletion);
+ WebInspector.showConsole();
+ }
+
+ function testLocalsCompletion() {
+ checkCompletions("th", ["parameter1", "closureLocal", "p", "createClosureLocal"], testThisCompletion);
+ }
+
+ function testThisCompletion() {
+ checkCompletions("this.", ["field1", "field2", "m"], testFieldCompletion);
+ }
+
+ function testFieldCompletion() {
+ checkCompletions("this.field1.", ["id", "name"], function() { test.releaseControl(); });
+ }
+
+ function checkCompletions(expression, expectedProperties, callback) {
+ test.addSniffer(WebInspector.console, "_reportCompletions",
+ function(bestMatchOnly, completionsReadyCallback, dotNotation, bracketNotation, prefix, result, isException) {
+ test.assertTrue(!isException, "Exception while collecting completions");
+ for (var i = 0; i < expectedProperties.length; i++) {
+ var name = expectedProperties[i];
+ test.assertTrue(result[name], "Name " + name + " not found among the completions: " + JSON.stringify(result));
+ }
+ setTimeout(callback, 0);
+ });
+ WebInspector.console.prompt.text = expression;
+ WebInspector.console.prompt.autoCompleteSoon();
+ }
+
+ this.takeControl();
+};
+
+
+/**
+ * Tests that inspected page doesn't hang on reload if it contains a syntax
+ * error and DevTools window is open.
+ */
+TestSuite.prototype.testAutoContinueOnSyntaxError = function()
+{
+ this.showPanel("scripts");
+ var test = this;
+
+ function checkScriptsList() {
+ var scriptSelect = document.getElementById("scripts-files");
+ var options = scriptSelect.options;
+ // There should be only console API source (see
+ // InjectedScript._ensureCommandLineAPIInstalled) since the page script
+ // contains a syntax error.
+ for (var i = 0 ; i < options.length; i++) {
+ if (options[i].text.search("script_syntax_error.html$") !== -1)
+ test.fail("Script with syntax error should not be in the list of parsed scripts.");
+ }
+ }
+
+ this.addSniffer(devtools.DebuggerAgent.prototype, "handleScriptsResponse_",
+ function(msg) {
+ checkScriptsList();
+
+ // Reload inspected page.
+ test.evaluateInConsole_(
+ "window.location.reload(true);",
+ function(resultText) {
+ test.assertEquals("undefined", resultText, "Unexpected result of reload().");
+ waitForExceptionEvent();
+ });
+ });
+
+ function waitForExceptionEvent() {
+ var exceptionCount = 0;
+ test.addSniffer(
+ devtools.DebuggerAgent.prototype,
+ "handleExceptionEvent_",
+ function(msg) {
+ exceptionCount++;
+ test.assertEquals(1, exceptionCount, "Too many exceptions.");
+ test.assertEquals(undefined, msg.getBody().script, "Unexpected exception: " + JSON.stringify(msg));
+ test.releaseControl();
+ });
+
+ // Check that the script is not paused on parse error.
+ test.addSniffer(
+ WebInspector,
+ "pausedScript",
+ function(callFrames) {
+ test.fail("Script execution should not pause on syntax error.");
+ });
+ }
+
+ this.takeControl();
+};
+
+
+/**
+ * Checks current execution line against expectations.
+ * @param {WebInspector.SourceFrame} sourceFrame
+ * @param {number} lineNumber Expected line number
+ * @param {string} lineContent Expected line text
+ */
+TestSuite.prototype._checkExecutionLine = function(sourceFrame, lineNumber, lineContent)
+{
+ this.assertEquals(lineNumber, sourceFrame.executionLine, "Unexpected execution line number.");
+ this.assertEquals(lineContent, sourceFrame._textModel.line(lineNumber - 1), "Unexpected execution line text.");
+}
+
+
+/**
+ * Checks that all expected scripts are present in the scripts list
+ * in the Scripts panel.
+ * @param {Array.<string>} expected Regular expressions describing
+ * expected script names.
+ * @return {boolean} Whether all the scripts are in "scripts-files" select
+ * box
+ */
+TestSuite.prototype._scriptsAreParsed = function(expected)
+{
+ var scriptSelect = document.getElementById("scripts-files");
+ var options = scriptSelect.options;
+
+ // Check that at least all the expected scripts are present.
+ var missing = expected.slice(0);
+ for (var i = 0 ; i < options.length; i++) {
+ for (var j = 0; j < missing.length; j++) {
+ if (options[i].text.search(missing[j]) !== -1) {
+ missing.splice(j, 1);
+ break;
+ }
+ }
+ }
+ return missing.length === 0;
+};
+
+
+/**
+ * Waits for script pause, checks expectations, and invokes the callback.
+ * @param {Object} expectations Dictionary of expectations
+ * @param {function():void} callback
+ */
+TestSuite.prototype._waitForScriptPause = function(expectations, callback)
+{
+ var test = this;
+ // Wait until script is paused.
+ test.addSniffer(
+ WebInspector,
+ "pausedScript",
+ function(callFrames) {
+ var functionsOnStack = [];
+ for (var i = 0; i < callFrames.length; i++)
+ functionsOnStack.push(callFrames[i].functionName);
+
+ test.assertEquals(expectations.functionsOnStack.join(","), functionsOnStack.join(","), "Unexpected stack.");
+
+ // Check that execution line where the script is paused is
+ // expected one.
+ test._checkSourceFrameWhenLoaded(expectations, callback);
+ });
+};
+
+
+/**
+ * Waits for current source frame to load, checks expectations, and invokes
+ * the callback.
+ * @param {Object} expectations Dictionary of expectations
+ * @param {function():void} callback
+ */
+TestSuite.prototype._checkSourceFrameWhenLoaded = function(expectations, callback)
+{
+ var test = this;
+
+ var frame = WebInspector.currentPanel.visibleView.sourceFrame;
+ if (frame._loaded)
+ checkExecLine();
+ else {
+ setTimeout(function() {
+ test._checkSourceFrameWhenLoaded(expectations, callback);
+ }, 100);
+ }
+ function checkExecLine() {
+ test._checkExecutionLine(frame, expectations.lineNumber, expectations.lineText);
+ callback();
+ }
+};
+
+
+/**
+ * Performs sequence of steps.
+ * @param {Array.<Object|Function>} Array [expectations1,action1,expectations2,
+ * action2,...,actionN].
+ */
+TestSuite.prototype._performSteps = function(actions)
+{
+ var test = this;
+ var i = 0;
+ function doNextAction() {
+ if (i > 0)
+ actions[i++]();
+ if (i < actions.length - 1)
+ test._waitForScriptPause(actions[i++], doNextAction);
+ }
+ doNextAction();
+};
+
+
+/**
+ * Waits until all the scripts are parsed and asynchronously executes the code
+ * in the inspected page.
+ */
+TestSuite.prototype._executeCodeWhenScriptsAreParsed = function(code, expectedScripts)
+{
+ var test = this;
+
+ function executeFunctionInInspectedPage() {
+ // Since breakpoints are ignored in evals' calculate() function is
+ // execute after zero-timeout so that the breakpoint is hit.
+ test.evaluateInConsole_(
+ 'setTimeout("' + code + '" , 0)',
+ function(resultText) {
+ test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText);
+ });
+ }
+
+ test._waitUntilScriptsAreParsed(expectedScripts, executeFunctionInInspectedPage);
+};
+
+
+/**
+ * Waits until all the scripts are parsed and invokes the callback.
+ */
+TestSuite.prototype._waitUntilScriptsAreParsed = function(expectedScripts, callback)
+{
+ var test = this;
+
+ function waitForAllScripts() {
+ if (test._scriptsAreParsed(expectedScripts))
+ callback();
+ else
+ test.addSniffer(WebInspector, "parsedScriptSource", waitForAllScripts);
+ }
+
+ waitForAllScripts();
+};
+
+
+/**
+ * Waits until all debugger scripts are parsed and executes "a()" in the
+ * inspected page.
+ */
+TestSuite.prototype._executeFunctionForStepTest = function()
+{
+ this._executeCodeWhenScriptsAreParsed("a()", ["debugger_step.html$", "debugger_step.js$"]);
+};
+
+
+/**
+ * Tests step over in the debugger.
+ */
+TestSuite.prototype.testStepOver = function()
+{
+ this.showPanel("scripts");
+ var test = this;
+
+ this._executeFunctionForStepTest();
+
+ this._performSteps([
+ {
+ functionsOnStack: ["d","a","(anonymous function)"],
+ lineNumber: 3,
+ lineText: " debugger;"
+ },
+ function() {
+ document.getElementById("scripts-step-over").click();
+ },
+ {
+ functionsOnStack: ["d","a","(anonymous function)"],
+ lineNumber: 5,
+ lineText: " var y = fact(10);"
+ },
+ function() {
+ document.getElementById("scripts-step-over").click();
+ },
+ {
+ functionsOnStack: ["d","a","(anonymous function)"],
+ lineNumber: 6,
+ lineText: " return y;"
+ },
+ function() {
+ test.releaseControl();
+ }
+ ]);
+
+ test.takeControl();
+};
+
+
+/**
+ * Tests step out in the debugger.
+ */
+TestSuite.prototype.testStepOut = function()
+{
+ this.showPanel("scripts");
+ var test = this;
+
+ this._executeFunctionForStepTest();
+
+ this._performSteps([
+ {
+ functionsOnStack: ["d","a","(anonymous function)"],
+ lineNumber: 3,
+ lineText: " debugger;"
+ },
+ function() {
+ document.getElementById("scripts-step-out").click();
+ },
+ {
+ functionsOnStack: ["a","(anonymous function)"],
+ lineNumber: 8,
+ lineText: " printResult(result);"
+ },
+ function() {
+ test.releaseControl();
+ }
+ ]);
+
+ test.takeControl();
+};
+
+
+/**
+ * Tests step in in the debugger.
+ */
+TestSuite.prototype.testStepIn = function()
+{
+ this.showPanel("scripts");
+ var test = this;
+
+ this._executeFunctionForStepTest();
+
+ this._performSteps([
+ {
+ functionsOnStack: ["d","a","(anonymous function)"],
+ lineNumber: 3,
+ lineText: " debugger;"
+ },
+ function() {
+ document.getElementById("scripts-step-over").click();
+ },
+ {
+ functionsOnStack: ["d","a","(anonymous function)"],
+ lineNumber: 5,
+ lineText: " var y = fact(10);"
+ },
+ function() {
+ document.getElementById("scripts-step-into").click();
+ },
+ {
+ functionsOnStack: ["fact","d","a","(anonymous function)"],
+ lineNumber: 15,
+ lineText: " return r;"
+ },
+ function() {
+ test.releaseControl();
+ }
+ ]);
+
+ test.takeControl();
+};
+
+
+/**
+ * Gets a XPathResult matching given xpath.
+ * @param {string} xpath
+ * @param {number} resultType
+ * @param {Node} opt_ancestor Context node. If not specified documentElement
+ * will be used
+ * @return {XPathResult} Type of returned value is determined by "resultType" parameter
+ */
+
+TestSuite.prototype._evaluateXpath = function(xpath, resultType, opt_ancestor)
+{
+ if (!opt_ancestor)
+ opt_ancestor = document.documentElement;
+ try {
+ return document.evaluate(xpath, opt_ancestor, null, resultType, null);
+ } catch(e) {
+ this.fail('Error in expression: "' + xpath + '".' + e);
+ }
+};
+
+
+/**
+ * Gets first Node matching given xpath.
+ * @param {string} xpath
+ * @param {Node} opt_ancestor Context node. If not specified documentElement
+ * will be used
+ * @return {?Node}
+ */
+TestSuite.prototype._findNode = function(xpath, opt_ancestor)
+{
+ var result = this._evaluateXpath(xpath, XPathResult.FIRST_ORDERED_NODE_TYPE, opt_ancestor).singleNodeValue;
+ this.assertTrue(!!result, "Cannot find node on path: " + xpath);
+ return result;
+};
+
+
+/**
+ * Gets a text matching given xpath.
+ * @param {string} xpath
+ * @param {Node} opt_ancestor Context node. If not specified documentElement
+ * will be used
+ * @return {?string}
+ */
+TestSuite.prototype._findText = function(xpath, opt_ancestor)
+{
+ var result = this._evaluateXpath(xpath, XPathResult.STRING_TYPE, opt_ancestor).stringValue;
+ this.assertTrue(!!result, "Cannot find text on path: " + xpath);
+ return result;
+};
+
+
+/**
+ * Gets an iterator over nodes matching given xpath.
+ * @param {string} xpath
+ * @param {Node} opt_ancestor Context node. If not specified, documentElement
+ * will be used
+ * @return {XPathResult} Iterator over the nodes
+ */
+TestSuite.prototype._nodeIterator = function(xpath, opt_ancestor)
+{
+ return this._evaluateXpath(xpath, XPathResult.ORDERED_NODE_ITERATOR_TYPE, opt_ancestor);
+};
+
+
+/**
+ * Checks the scopeSectionDiv against the expectations.
+ * @param {Node} scopeSectionDiv The section div
+ * @param {Object} expectations Expectations dictionary
+ */
+TestSuite.prototype._checkScopeSectionDiv = function(scopeSectionDiv, expectations)
+{
+ var scopeTitle = this._findText('./div[@class="header"]/div[@class="title"]/text()', scopeSectionDiv);
+ this.assertEquals(expectations.title, scopeTitle, "Unexpected scope section title.");
+ if (!expectations.properties)
+ return;
+ this.assertTrue(scopeSectionDiv.hasStyleClass("expanded"), 'Section "' + scopeTitle + '" is collapsed.');
+
+ var propertyIt = this._nodeIterator("./ol/li", scopeSectionDiv);
+ var propertyLi;
+ var foundProps = [];
+ while (propertyLi = propertyIt.iterateNext()) {
+ var name = this._findText('./span[@class="name"]/text()', propertyLi);
+ var value = this._findText('./span[@class="value"]/text()', propertyLi);
+ this.assertTrue(!!name, 'Invalid variable name: "' + name + '"');
+ this.assertTrue(name in expectations.properties, "Unexpected property: " + name);
+ this.assertEquals(expectations.properties[name], value, 'Unexpected "' + name + '" property value.');
+ delete expectations.properties[name];
+ foundProps.push(name + " = " + value);
+ }
+
+ // Check that all expected properties were found.
+ for (var p in expectations.properties)
+ this.fail('Property "' + p + '" was not found in scope "' + scopeTitle + '". Found properties: "' + foundProps.join(",") + '"');
+};
+
+
+/**
+ * Expands scope sections matching the filter and invokes the callback on
+ * success.
+ * @param {function(WebInspector.ObjectPropertiesSection, number):boolean}
+ * filter
+ * @param {Function} callback
+ */
+TestSuite.prototype._expandScopeSections = function(filter, callback)
+{
+ var sections = WebInspector.currentPanel.sidebarPanes.scopechain.sections;
+
+ var toBeUpdatedCount = 0;
+ function updateListener() {
+ --toBeUpdatedCount;
+ if (toBeUpdatedCount === 0) {
+ // Report when all scopes are expanded and populated.
+ callback();
+ }
+ }
+
+ // Global scope is always the last one.
+ for (var i = 0; i < sections.length - 1; i++) {
+ var section = sections[i];
+ if (!filter(sections, i))
+ continue;
+ ++toBeUpdatedCount;
+ var populated = section.populated;
+
+ this._hookGetPropertiesCallback(updateListener,
+ function() {
+ section.expand();
+ if (populated) {
+ // Make sure "updateProperties" callback will be called at least once
+ // after it was overridden.
+ section.update();
+ }
+ });
+ }
+};
+
+
+/**
+ * Tests that scopes can be expanded and contain expected data.
+ */
+TestSuite.prototype.testExpandScope = function()
+{
+ this.showPanel("scripts");
+ var test = this;
+
+ this._executeCodeWhenScriptsAreParsed("handleClick()", ["debugger_closure.html$"]);
+
+ this._waitForScriptPause(
+ {
+ functionsOnStack: ["innerFunction", "handleClick", "(anonymous function)"],
+ lineNumber: 8,
+ lineText: " debugger;"
+ },
+ expandAllSectionsExceptGlobal);
+
+ // Expanding Global scope takes for too long so we skeep it.
+ function expandAllSectionsExceptGlobal() {
+ test._expandScopeSections(function(sections, i) {
+ return i < sections.length - 1;
+ },
+ examineScopes /* When all scopes are expanded and populated check them. */);
+ }
+
+ // Check scope sections contents.
+ function examineScopes() {
+ var scopeVariablesSection = test._findNode('//div[@id="scripts-sidebar"]/div[div[@class="title"]/text()="Scope Variables"]');
+ var expectedScopes = [
+ {
+ title: "Local",
+ properties: {
+ x:"2009",
+ innerFunctionLocalVar:"2011",
+ "this": "global",
+ }
+ },
+ {
+ title: "Closure",
+ properties: {
+ n:"TextParam",
+ makeClosureLocalVar:"local.TextParam",
+ }
+ },
+ {
+ title: "Global",
+ },
+ ];
+ var it = test._nodeIterator('./div[@class="body"]/div', scopeVariablesSection);
+ var scopeIndex = 0;
+ var scopeDiv;
+ while (scopeDiv = it.iterateNext()) {
+ test.assertTrue(scopeIndex < expectedScopes.length, "Too many scopes.");
+ test._checkScopeSectionDiv(scopeDiv, expectedScopes[scopeIndex]);
+ ++scopeIndex;
+ }
+ test.assertEquals(expectedScopes.length, scopeIndex, "Unexpected number of scopes.");
+
+ test.releaseControl();
+ }
+
+ test.takeControl();
+};
+
+
+/**
+ * Returns child tree element for a property with given name.
+ * @param {TreeElement} parent Parent tree element.
+ * @param {string} childName
+ * @param {string} objectPath Path to the object. Will be printed in the case
+ * of failure.
+ * @return {TreeElement}
+ */
+TestSuite.prototype._findChildProperty = function(parent, childName, objectPath)
+{
+ var children = parent.children;
+ for (var i = 0; i < children.length; i++) {
+ var treeElement = children[i];
+ var property = treeElement.property;
+ if (property.name === childName)
+ return treeElement;
+ }
+ this.fail('Cannot find property "' + childName + '" in ' + objectPath);
+};
+
+
+/**
+ * Executes the 'code' with InjectedScriptAccess.getProperties overriden
+ * so that all callbacks passed to InjectedScriptAccess.getProperties are
+ * extended with the "hook".
+ * @param {Function} hook The hook function.
+ * @param {Function} code A code snippet to be executed.
+ */
+TestSuite.prototype._hookGetPropertiesCallback = function(hook, code)
+{
+ var accessor = InjectedScriptAccess.prototype;
+ var orig = accessor.getProperties;
+ accessor.getProperties = function(objectProxy, ignoreHasOwnProperty, abbreviate, callback) {
+ orig.call(this, objectProxy, ignoreHasOwnProperty, abbreviate,
+ function() {
+ callback.apply(this, arguments);
+ hook();
+ });
+ };
+ try {
+ code();
+ } finally {
+ accessor.getProperties = orig;
+ }
+};
+
+
+/**
+ * Tests that all elements in prototype chain of an object have expected
+ * intrinic proprties(__proto__, constructor, prototype).
+ */
+TestSuite.prototype.testDebugIntrinsicProperties = function()
+{
+ this.showPanel("scripts");
+ var test = this;
+
+ this._executeCodeWhenScriptsAreParsed("handleClick()", ["debugger_intrinsic_properties.html$"]);
+
+ this._waitForScriptPause(
+ {
+ functionsOnStack: ["callDebugger", "handleClick", "(anonymous function)"],
+ lineNumber: 29,
+ lineText: " debugger;"
+ },
+ expandLocalScope);
+
+ var localScopeSection = null;
+ function expandLocalScope() {
+ test._expandScopeSections(function(sections, i) {
+ if (i === 0) {
+ test.assertTrue(sections[i].object.isLocal, "Scope #0 is not Local.");
+ localScopeSection = sections[i];
+ return true;
+ }
+ return false;
+ },
+ examineLocalScope);
+ }
+
+ function examineLocalScope() {
+ var scopeExpectations = [
+ "a", "Object", [
+ "constructor", "function Child()", [
+ "constructor", "function Function()", null,
+ "name", "Child", null,
+ "prototype", "Object", [
+ "childProtoField", 21, null
+ ]
+ ],
+
+ "__proto__", "Object", [
+ "__proto__", "Object", [
+ "__proto__", "Object", [
+ "__proto__", "null", null,
+ "constructor", "function Object()", null,
+ ],
+ "constructor", "function Parent()", [
+ "name", "Parent", null,
+ "prototype", "Object", [
+ "parentProtoField", 11, null,
+ ]
+ ],
+ "parentProtoField", 11, null,
+ ],
+ "constructor", "function Child()", null,
+ "childProtoField", 21, null,
+ ],
+
+ "parentField", 10, null,
+ "childField", 20, null,
+ ]
+ ];
+
+ checkProperty(localScopeSection.propertiesTreeOutline, "<Local Scope>", scopeExpectations);
+ }
+
+ var propQueue = [];
+ var index = 0;
+ var expectedFinalIndex = 8;
+
+ function expandAndCheckNextProperty() {
+ if (index === propQueue.length) {
+ test.assertEquals(expectedFinalIndex, index, "Unexpected number of expanded objects.");
+ test.releaseControl();
+ return;
+ }
+
+ // Read next property data from the queue.
+ var treeElement = propQueue[index].treeElement;
+ var path = propQueue[index].path;
+ var expectations = propQueue[index].expectations;
+ index++;
+
+ // Expand the property.
+ test._hookGetPropertiesCallback(function() {
+ checkProperty(treeElement, path, expectations);
+ },
+ function() {
+ treeElement.expand();
+ });
+ }
+
+ function checkProperty(treeElement, path, expectations) {
+ for (var i = 0; i < expectations.length; i += 3) {
+ var name = expectations[i];
+ var description = expectations[i+1];
+ var value = expectations[i+2];
+
+ var propertyPath = path + "." + name;
+ var propertyTreeElement = test._findChildProperty(treeElement, name, path);
+ test.assertTrue(propertyTreeElement, 'Property "' + propertyPath + '" not found.');
+ test.assertEquals(description, propertyTreeElement.property.value.description, 'Unexpected "' + propertyPath + '" description.');
+ if (value) {
+ // Schedule property content check.
+ propQueue.push({
+ treeElement: propertyTreeElement,
+ path: propertyPath,
+ expectations: value,
+ });
+ }
+ }
+ // Check next property in the queue.
+ expandAndCheckNextProperty();
+ }
+
+ test.takeControl();
+};
+
+
+/**
+ * Tests "Pause" button will pause debugger when a snippet is evaluated.
+ */
+TestSuite.prototype.testPauseInEval = function()
+{
+ this.showPanel("scripts");
+
+ var test = this;
+
+ var pauseButton = document.getElementById("scripts-pause");
+ pauseButton.click();
+
+ devtools.tools.evaluateJavaScript("fib(10)");
+
+ this.addSniffer(WebInspector, "pausedScript",
+ function() {
+ test.releaseControl();
+ });
+
+ test.takeControl();
+};
+
+
+/**
+ * Key event with given key identifier.
+ */
+TestSuite.createKeyEvent = function(keyIdentifier)
+{
+ var evt = document.createEvent("KeyboardEvent");
+ evt.initKeyboardEvent("keydown", true /* can bubble */, true /* can cancel */, null /* view */, keyIdentifier, "");
+ return evt;
+};
+
+
+/**
+ * Tests console eval.
+ */
+TestSuite.prototype.testConsoleEval = function()
+{
+ var test = this;
+ this.evaluateInConsole_("123",
+ function(resultText) {
+ test.assertEquals("123", resultText);
+ test.releaseControl();
+ });
+
+ this.takeControl();
+};
+
+
+/**
+ * Tests console log.
+ */
+TestSuite.prototype.testConsoleLog = function()
+{
+ WebInspector.console.visible = true;
+ var messages = WebInspector.console.messages;
+ var index = 0;
+
+ var test = this;
+ var assertNext = function(line, message, opt_class, opt_count, opt_substr) {
+ var elem = messages[index++].toMessageElement();
+ var clazz = elem.getAttribute("class");
+ var expectation = (opt_count || '') + 'console_test_page.html:' + line + message;
+ if (opt_substr)
+ test.assertContains(elem.textContent, expectation);
+ else
+ test.assertEquals(expectation, elem.textContent);
+ if (opt_class)
+ test.assertContains(clazz, "console-" + opt_class);
+ };
+
+ assertNext("5", "log", "log-level");
+ assertNext("7", "debug", "log-level");
+ assertNext("9", "info", "log-level");
+ assertNext("11", "warn", "warning-level");
+ assertNext("13", "error", "error-level");
+ assertNext("15", "Message format number 1, 2 and 3.5");
+ assertNext("17", "Message format for string");
+ assertNext("19", "Object Object");
+ assertNext("22", "repeated", "log-level", 5);
+ assertNext("26", "count: 1");
+ assertNext("26", "count: 2");
+ assertNext("29", "group", "group-title");
+ index++;
+ assertNext("33", "timer:", "log-level", "", true);
+ assertNext("35", "1 2 3", "log-level");
+ assertNext("37", "HTMLDocument", "log-level");
+ assertNext("39", "<html>", "log-level", "", true);
+};
+
+
+/**
+ * Tests eval of global objects.
+ */
+TestSuite.prototype.testEvalGlobal = function()
+{
+ WebInspector.console.visible = true;
+
+ var inputs = ["foo", "foobar"];
+ var expectations = ["foo", "fooValue", "foobar", "ReferenceError: foobar is not defined"];
+
+ // Do not change code below - simply add inputs and expectations above.
+ var initEval = function(input) {
+ WebInspector.console.prompt.text = input;
+ WebInspector.console.promptElement.dispatchEvent( TestSuite.createKeyEvent("Enter"));
+ };
+ var test = this;
+ var messagesCount = 0;
+ var inputIndex = 0;
+ this.addSniffer(WebInspector.ConsoleView.prototype, "addMessage",
+ function(commandResult) {
+ messagesCount++;
+ if (messagesCount === expectations.length) {
+ var messages = WebInspector.console.messages;
+ for (var i = 0; i < expectations; ++i) {
+ var elem = messages[i++].toMessageElement();
+ test.assertEquals(elem.textContent, expectations[i]);
+ }
+ test.releaseControl();
+ } else if (messagesCount % 2 === 0)
+ initEval(inputs[inputIndex++]);
+ }, true);
+
+ initEval(inputs[inputIndex++]);
+ this.takeControl();
+};
+
+
+/**
+ * Tests that Storage panel can be open and that local DOM storage is added
+ * to the panel.
+ */
+TestSuite.prototype.testShowStoragePanel = function()
+{
+ var test = this;
+ this.addSniffer(WebInspector.panels.storage, "addDOMStorage",
+ function(storage) {
+ var orig = storage.getEntries;
+ storage.getEntries = function(callback) {
+ orig.call(this, function(entries) {
+ callback(entries);
+ test.releaseControl();
+ });
+ };
+ try {
+ WebInspector.currentPanel.selectDOMStorage(storage.id);
+ storage.getEntries = orig;
+ } catch (e) {
+ test.fail("Exception in selectDOMStorage: " + e);
+ }
+ });
+ this.showPanel("storage");
+
+ // Access localStorage so that it's pushed to the frontend.
+ this.evaluateInConsole_(
+ 'setTimeout("localStorage.x = 10" , 0)',
+ function(resultText) {
+ test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText);
+ });
+
+ // Wait until DOM storage is added to the panel.
+ this.takeControl();
+};
+
+
+/**
+ * Test runner for the test suite.
+ */
+var uiTests = {};
+
+
+/**
+ * Run each test from the test suit on a fresh instance of the suite.
+ */
+uiTests.runAllTests = function()
+{
+ // For debugging purposes.
+ for (var name in TestSuite.prototype) {
+ if (name.substring(0, 4) === "test" && typeof TestSuite.prototype[name] === "function")
+ uiTests.runTest(name);
+ }
+};
+
+
+/**
+ * Run specified test on a fresh instance of the test suite.
+ * @param {string} name Name of a test method from TestSuite class.
+ */
+uiTests.runTest = function(name)
+{
+ new TestSuite().runTest(name);
+};
+
+
+}
diff --git a/WebKit/chromium/src/js/devTools.css b/WebKit/chromium/src/js/devTools.css
new file mode 100755
index 0000000..1fa935f
--- /dev/null
+++ b/WebKit/chromium/src/js/devTools.css
@@ -0,0 +1,223 @@
+#scripts-files option.injected {
+ color: rgb(70, 134, 240);
+}
+
+.data-grid table {
+ line-height: 120%;
+}
+
+body.attached #toolbar {
+ height: 34px;
+ border-top: 1px solid rgb(100, 100, 100);
+ cursor: default; /* overriden */
+ padding-left: 0;
+}
+
+
+/* Chrome theme overrides */
+body.platform-windows #toolbar {
+ background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(242, 247, 253)), to(rgb(223, 234, 248)));
+}
+
+body.platform-windows.inactive #toolbar {
+ background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(248, 248, 248)), to(rgb(237, 237, 237)));
+}
+
+
+/* Heap Profiler Styles */
+
+.heap-snapshot-status-bar-item .glyph {
+ -webkit-mask-image: url(Images/focusButtonGlyph.png);
+}
+
+.heap-snapshot-sidebar-tree-item .icon {
+ content: url(Images/profileIcon.png);
+}
+
+.heap-snapshot-sidebar-tree-item.small .icon {
+ content: url(Images/profileSmallIcon.png);
+}
+
+.heap-snapshot-view {
+ display: none;
+ overflow: hidden;
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+}
+
+.heap-snapshot-view.visible {
+ display: block;
+}
+
+.heap-snapshot-view .data-grid {
+ border: none;
+ max-height: 100%;
+ position: absolute;
+ left: 0;
+ right: 0;
+ top: 0;
+ bottom: 93px;
+}
+
+.heap-snapshot-view .data-grid th.count-column {
+ text-align: center;
+}
+
+.heap-snapshot-view .data-grid td.count-column {
+ text-align: right;
+}
+
+.heap-snapshot-view .data-grid th.size-column {
+ text-align: center;
+}
+
+.heap-snapshot-view .data-grid td.size-column {
+ text-align: right;
+}
+
+.heap-snapshot-view .data-grid th.countDelta-column {
+ text-align: center;
+}
+
+.heap-snapshot-view .data-grid td.countDelta-column {
+ text-align: right;
+}
+
+.heap-snapshot-view .data-grid th.sizeDelta-column {
+ text-align: center;
+}
+
+.heap-snapshot-view .data-grid td.sizeDelta-column {
+ text-align: right;
+}
+
+#heap-snapshot-summary-container {
+ position: absolute;
+ padding-top: 20px;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ height: 93px;
+ margin-left: -1px;
+ border-left: 1px solid rgb(102, 102, 102);
+ background-color: rgb(101, 111, 130);
+ background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0)));
+ background-repeat: repeat-x;
+ background-position: top;
+ text-align: center;
+ text-shadow: black 0 1px 1px;
+ white-space: nowrap;
+ color: white;
+ -webkit-background-size: 1px 6px;
+ -webkit-background-origin: padding;
+ -webkit-background-clip: padding;
+}
+
+.heap-snapshot-summary {
+ display: inline-block;
+ width: 50%;
+ min-width: 300px;
+ position: relative;
+}
+
+.heap-snapshot-summary canvas.summary-graph {
+ width: 225px;
+}
+
+.heap-snapshot-summary-label {
+ font-size: 12px;
+ font-weight: bold;
+ position: absolute;
+ top: 1px;
+ width: 50%;
+ left: 25%;
+}
+
+body.platform-windows .section > .header {
+ border: 1px solid rgb(92, 116, 157);
+ background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(105, 133, 180)), to(rgb(92, 116, 157)));
+}
+
+body.platform-windows .console-group-messages .section > .header {
+ padding: 0 8px 0 0;
+ background-image: none;
+ border: none;
+ min-height: 0;
+}
+
+body.platform-windows #resources-filter {
+ background: -webkit-gradient(linear, left top, left bottom, from(rgb(233, 233, 233)), to(rgb(233, 233, 233)));
+}
+
+body.platform-windows .crumbs .crumb {
+ -webkit-border-image: url(Images/segmentChromium.png) 0 12 0 2;
+}
+
+body.platform-windows .crumbs .crumb.end {
+ -webkit-border-image: url(Images/segmentEndChromium.png) 0 2 0 2;
+}
+
+body.platform-windows .crumbs .crumb.selected {
+ -webkit-border-image: url(Images/segmentSelectedChromium.png) 0 12 0 2;
+ color: white;
+ text-shadow: rgba(255, 255, 255, 0.5) 0 0px 0;
+}
+
+body.platform-windows .crumbs .crumb.selected:hover {
+ -webkit-border-image: url(Images/segmentSelectedChromium.png) 0 12 0 2;
+}
+
+body.platform-windows .crumbs .crumb.selected.end, .crumbs .crumb.selected.end:hover {
+ -webkit-border-image: url(Images/segmentSelectedEndChromium.png) 0 2 0 2;
+}
+
+body.platform-windows .crumbs .crumb:hover {
+ -webkit-border-image: url(Images/segmentHoverChromium.png) 0 12 0 2;
+}
+
+body.platform-windows .crumbs .crumb.dimmed:hover {
+ -webkit-border-image: url(Images/segmentHoverChromium.png) 0 12 0 2;
+}
+
+body.platform-windows .crumbs .crumb.end:hover {
+ -webkit-border-image: url(Images/segmentHoverEndChromium.png) 0 2 0 2;
+}
+
+body.platform-windows body.drawer-visible #main-status-bar {
+ background-image: url(Images/statusbarResizerVertical.png), url(Images/statusbarBackgroundChromium.png);
+}
+
+body.platform-windows .status-bar {
+ background-image: url(Images/statusbarBackgroundChromium.png);
+}
+
+body.platform-windows button.status-bar-item {
+ background-image: url(Images/statusbarButtonsChromium.png);
+}
+
+body.platform-windows select.status-bar-item:active {
+ -webkit-border-image: url(Images/statusbarMenuButtonSelectedChromium.png) 0 17 0 2;
+}
+
+body.platform-windows #drawer {
+ background-image: url(Images/statusbarBottomBackgroundChromium.png);
+}
+
+body.platform-windows select.status-bar-item {
+ -webkit-border-image: url(Images/statusbarMenuButtonChromium.png) 0 17 0 2;
+}
+
+.scope-bar li.selected {
+ -webkit-box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.0);
+}
+
+.scope-bar li:active {
+ -webkit-box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.0);
+}
+
+.timeline-category-tree-item input {
+ vertical-align: middle;
+}
diff --git a/WebKit/chromium/tests/TransparencyWinTest.cpp b/WebKit/chromium/tests/TransparencyWinTest.cpp
new file mode 100644
index 0000000..b83c2a9
--- /dev/null
+++ b/WebKit/chromium/tests/TransparencyWinTest.cpp
@@ -0,0 +1,693 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "TransparencyWin.h"
+
+#include "AffineTransform.h"
+#include "ImageBuffer.h"
+
+#include <gtest/gtest.h>
+#include <windows.h>
+
+namespace WebCore {
+
+static FloatRect RECTToFloatRect(const RECT* rect)
+{
+ return FloatRect(static_cast<float>(rect->left),
+ static_cast<float>(rect->top),
+ static_cast<float>(rect->right - rect->left),
+ static_cast<float>(rect->bottom - rect->top));
+}
+
+static void drawNativeRect(GraphicsContext* context,
+ int x, int y, int w, int h)
+{
+ skia::PlatformCanvas* canvas = context->platformContext()->canvas();
+ HDC dc = canvas->beginPlatformPaint();
+
+ RECT innerRc;
+ innerRc.left = x;
+ innerRc.top = y;
+ innerRc.right = x + w;
+ innerRc.bottom = y + h;
+ FillRect(dc, &innerRc,
+ reinterpret_cast<HBRUSH>(GetStockObject(BLACK_BRUSH)));
+
+ canvas->endPlatformPaint();
+}
+
+static Color getPixelAt(GraphicsContext* context, int x, int y)
+{
+ const SkBitmap& bitmap = context->platformContext()->canvas()->
+ getTopPlatformDevice().accessBitmap(false);
+ return Color(*reinterpret_cast<const RGBA32*>(bitmap.getAddr32(x, y)));
+}
+
+// Resets the top layer's alpha channel to 0 for each pixel. This simulates
+// Windows messing it up.
+static void clearTopLayerAlphaChannel(GraphicsContext* context)
+{
+ SkBitmap& bitmap = const_cast<SkBitmap&>(context->platformContext()->
+ canvas()->getTopPlatformDevice().accessBitmap(false));
+ for (int y = 0; y < bitmap.height(); y++) {
+ uint32_t* row = bitmap.getAddr32(0, y);
+ for (int x = 0; x < bitmap.width(); x++)
+ row[x] &= 0x00FFFFFF;
+ }
+}
+
+// Clears the alpha channel on the specified pixel.
+static void clearTopLayerAlphaPixel(GraphicsContext* context, int x, int y)
+{
+ SkBitmap& bitmap = const_cast<SkBitmap&>(context->platformContext()->
+ canvas()->getTopPlatformDevice().accessBitmap(false));
+ *bitmap.getAddr32(x, y) &= 0x00FFFFFF;
+}
+
+static std::ostream& operator<<(std::ostream& out, const Color& c)
+{
+ std::ios_base::fmtflags oldFlags = out.flags(std::ios_base::hex |
+ std::ios_base::showbase);
+ out << c.rgb();
+ out.flags(oldFlags);
+ return out;
+}
+
+TEST(TransparencyWin, NoLayer)
+{
+ OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(17, 16), DeviceRGB));
+
+ // KeepTransform
+ {
+ TransparencyWin helper;
+ helper.init(src->context(),
+ TransparencyWin::NoLayer,
+ TransparencyWin::KeepTransform,
+ IntRect(1, 1, 14, 12));
+
+ EXPECT_TRUE(src->context() == helper.context());
+ EXPECT_TRUE(IntSize(14, 12) == helper.m_layerSize);
+ EXPECT_TRUE(IntRect(1, 1, 14, 12) == helper.drawRect());
+ }
+
+ // Untransform is not allowed for NoLayer.
+
+ // ScaleTransform
+ src->context()->save();
+ src->context()->scale(FloatSize(2.0, 0.5));
+ {
+ TransparencyWin helper;
+ helper.init(src->context(),
+ TransparencyWin::NoLayer,
+ TransparencyWin::ScaleTransform,
+ IntRect(2, 2, 6, 6));
+ helper.composite();
+
+ // The coordinate system should be based in the upper left of our box.
+ // It should be post-transformed.
+ EXPECT_TRUE(src->context() == helper.context());
+ EXPECT_TRUE(IntSize(12, 3) == helper.m_layerSize);
+ EXPECT_TRUE(IntRect(4, 1, 12, 3) == helper.drawRect());
+ }
+ src->context()->restore();
+}
+
+TEST(TransparencyWin, WhiteLayer)
+{
+ OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), DeviceRGB));
+
+ // KeepTransform
+ {
+ TransparencyWin helper;
+ helper.init(src->context(),
+ TransparencyWin::WhiteLayer,
+ TransparencyWin::KeepTransform,
+ IntRect(1, 1, 14, 12));
+ helper.composite();
+
+ EXPECT_TRUE(src->context() != helper.context());
+ EXPECT_TRUE(IntSize(14, 12) == helper.m_layerSize);
+ EXPECT_TRUE(IntRect(1, 1, 14, 12) == helper.drawRect());
+ }
+
+ // Untransform
+ {
+ TransparencyWin helper;
+ helper.init(src->context(),
+ TransparencyWin::WhiteLayer,
+ TransparencyWin::Untransform,
+ IntRect(1, 1, 14, 12));
+ helper.composite();
+
+ EXPECT_TRUE(src->context() != helper.context());
+ EXPECT_TRUE(IntSize(14, 12) == helper.m_layerSize);
+ EXPECT_TRUE(IntRect(0, 0, 14, 12) == helper.drawRect());
+ }
+
+ // ScaleTransform
+ src->context()->save();
+ src->context()->scale(FloatSize(2.0, 0.5));
+ {
+ TransparencyWin helper;
+ helper.init(src->context(),
+ TransparencyWin::WhiteLayer,
+ TransparencyWin::ScaleTransform,
+ IntRect(2, 2, 6, 6));
+ helper.composite();
+
+ // The coordinate system should be based in the upper left of our box.
+ // It should be post-transformed.
+ EXPECT_TRUE(src->context() != helper.context());
+ EXPECT_TRUE(IntSize(12, 3) == helper.m_layerSize);
+ EXPECT_TRUE(IntRect(0, 0, 12, 3) == helper.drawRect());
+ }
+ src->context()->restore();
+}
+
+TEST(TransparencyWin, TextComposite)
+{
+ OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), DeviceRGB));
+
+ // KeepTransform is the only valid transform mode for TextComposite.
+ {
+ TransparencyWin helper;
+ helper.init(src->context(),
+ TransparencyWin::TextComposite,
+ TransparencyWin::KeepTransform,
+ IntRect(1, 1, 14, 12));
+ helper.composite();
+
+ EXPECT_TRUE(src->context() != helper.context());
+ EXPECT_TRUE(IntSize(14, 12) == helper.m_layerSize);
+ EXPECT_TRUE(IntRect(1, 1, 14, 12) == helper.drawRect());
+ }
+}
+
+TEST(TransparencyWin, OpaqueCompositeLayer)
+{
+ OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), DeviceRGB));
+
+ // KeepTransform
+ {
+ TransparencyWin helper;
+ helper.init(src->context(),
+ TransparencyWin::OpaqueCompositeLayer,
+ TransparencyWin::KeepTransform,
+ IntRect(1, 1, 14, 12));
+ helper.composite();
+
+ EXPECT_TRUE(src->context() != helper.context());
+ EXPECT_TRUE(IntSize(14, 12) == helper.m_layerSize);
+ EXPECT_TRUE(IntRect(1, 1, 14, 12) == helper.drawRect());
+ }
+
+ // KeepTransform with scroll applied.
+ src->context()->save();
+ src->context()->translate(0, -1);
+ {
+ TransparencyWin helper;
+ helper.init(src->context(),
+ TransparencyWin::OpaqueCompositeLayer,
+ TransparencyWin::KeepTransform,
+ IntRect(1, 1, 14, 14));
+ helper.composite();
+
+ EXPECT_TRUE(src->context() != helper.context());
+ EXPECT_TRUE(IntSize(14, 14) == helper.m_layerSize);
+ EXPECT_TRUE(IntRect(1, 1, 14, 14) == helper.drawRect());
+ }
+ src->context()->restore();
+
+ // Untransform
+ {
+ TransparencyWin helper;
+ helper.init(src->context(),
+ TransparencyWin::OpaqueCompositeLayer,
+ TransparencyWin::Untransform,
+ IntRect(1, 1, 14, 12));
+ helper.composite();
+
+ EXPECT_TRUE(src->context() != helper.context());
+ EXPECT_TRUE(IntSize(14, 12) == helper.m_layerSize);
+ EXPECT_TRUE(IntRect(0, 0, 14, 12) == helper.drawRect());
+ }
+
+ // ScaleTransform
+ src->context()->save();
+ src->context()->scale(FloatSize(2.0, 0.5));
+ {
+ TransparencyWin helper;
+ helper.init(src->context(),
+ TransparencyWin::OpaqueCompositeLayer,
+ TransparencyWin::ScaleTransform,
+ IntRect(2, 2, 6, 6));
+ helper.composite();
+
+ // The coordinate system should be based in the upper left of our box.
+ // It should be post-transformed.
+ EXPECT_TRUE(src->context() != helper.context());
+ EXPECT_TRUE(IntSize(12, 3) == helper.m_layerSize);
+ EXPECT_TRUE(IntRect(0, 0, 12, 3) == helper.drawRect());
+ }
+ src->context()->restore();
+}
+
+TEST(TransparencyWin, WhiteLayerPixelTest)
+{
+ // Make a total transparent buffer, and draw the white layer inset by 1 px.
+ OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), DeviceRGB));
+
+ {
+ TransparencyWin helper;
+ helper.init(src->context(),
+ TransparencyWin::WhiteLayer,
+ TransparencyWin::KeepTransform,
+ IntRect(1, 1, 14, 14));
+
+ // Coordinates should be in the original space, not the layer.
+ drawNativeRect(helper.context(), 3, 3, 1, 1);
+ clearTopLayerAlphaChannel(helper.context());
+ helper.composite();
+ }
+
+ // The final image should be transparent around the edges for 1 px, white
+ // in the middle, with (3,3) (what we drew above) being opaque black.
+ EXPECT_EQ(Color(Color::transparent), getPixelAt(src->context(), 0, 0));
+ EXPECT_EQ(Color(Color::white), getPixelAt(src->context(), 2, 2));
+ EXPECT_EQ(Color(Color::black), getPixelAt(src->context(), 3, 3));
+ EXPECT_EQ(Color(Color::white), getPixelAt(src->context(), 4, 4));
+}
+
+TEST(TransparencyWin, OpaqueCompositeLayerPixel)
+{
+ Color red(0xFFFF0000), darkRed(0xFFBF0000);
+ Color green(0xFF00FF00);
+
+ // Make a red bottom layer, followed by a half green next layer @ 50%.
+ OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), DeviceRGB));
+
+ FloatRect fullRect(0, 0, 16, 16);
+ src->context()->fillRect(fullRect, red, DeviceColorSpace);
+ src->context()->beginTransparencyLayer(0.5);
+ FloatRect rightHalf(8, 0, 8, 16);
+ src->context()->fillRect(rightHalf, green, DeviceColorSpace);
+
+ // Make a transparency layer inset by one pixel, and fill it inset by
+ // another pixel with 50% black.
+ {
+ TransparencyWin helper;
+ helper.init(src->context(),
+ TransparencyWin::OpaqueCompositeLayer,
+ TransparencyWin::KeepTransform,
+ IntRect(1, 1, 14, 14));
+
+ FloatRect inner(2, 2, 12, 12);
+ helper.context()->fillRect(inner, Color(0x7f000000), DeviceColorSpace);
+ // These coordinates are relative to the layer, whish is inset by 1x1
+ // pixels from the top left. So we're actually clearing (2, 2) and
+ // (13,13), which are the extreme corners of the black area (and which
+ // we check below).
+ clearTopLayerAlphaPixel(helper.context(), 1, 1);
+ clearTopLayerAlphaPixel(helper.context(), 12, 12);
+ helper.composite();
+ }
+
+ // Finish the compositing.
+ src->context()->endTransparencyLayer();
+
+ // Check that we got the right values, it should be like the rectangle was
+ // drawn with half opacity even though the alpha channel got messed up.
+ EXPECT_EQ(red, getPixelAt(src->context(), 0, 0));
+ EXPECT_EQ(red, getPixelAt(src->context(), 1, 1));
+ EXPECT_EQ(darkRed, getPixelAt(src->context(), 2, 2));
+
+ // The dark result is:
+ // (black @ 50% atop green) @ 50% atop red = 0xFF804000
+ // which is 0xFFA02000 (Skia computes 0xFFA11F00 due to rounding).
+ Color darkGreenRed(0xFF803f00);
+ EXPECT_EQ(darkGreenRed, getPixelAt(src->context(), 13, 13));
+
+ // 50% green on top of red = FF808000 (rounded to what Skia will produce).
+ Color greenRed(0xFF807F00);
+ EXPECT_EQ(greenRed, getPixelAt(src->context(), 14, 14));
+ EXPECT_EQ(greenRed, getPixelAt(src->context(), 15, 15));
+}
+
+// Tests that translations are properly handled when using KeepTransform.
+TEST(TransparencyWin, TranslateOpaqueCompositeLayer)
+{
+ // Fill with white.
+ OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), DeviceRGB));
+ Color white(0xFFFFFFFF);
+ FloatRect fullRect(0, 0, 16, 16);
+ src->context()->fillRect(fullRect, white, DeviceColorSpace);
+
+ // Scroll down by 8 (coordinate system goes up).
+ src->context()->save();
+ src->context()->translate(0, -8);
+
+ Color red(0xFFFF0000);
+ Color green(0xFF00FF00);
+ {
+ // Make the transparency layer after translation will be @ (0, -8) with
+ // size 16x16.
+ TransparencyWin helper;
+ helper.init(src->context(),
+ TransparencyWin::OpaqueCompositeLayer,
+ TransparencyWin::KeepTransform,
+ IntRect(0, 0, 16, 16));
+
+ // Draw a red pixel at (15, 15). This should be the at (15, 7) after
+ // the transform.
+ FloatRect bottomRight(15, 15, 1, 1);
+ helper.context()->fillRect(bottomRight, green, DeviceColorSpace);
+ helper.composite();
+ }
+
+ src->context()->restore();
+
+ // Check the pixel we wrote.
+ EXPECT_EQ(green, getPixelAt(src->context(), 15, 7));
+}
+
+// Same as OpaqueCompositeLayer, but the canvas has a rotation applied. This
+// tests that the propert transform is applied to the copied layer.
+TEST(TransparencyWin, RotateOpaqueCompositeLayer)
+{
+ OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), DeviceRGB));
+
+ // The background is white.
+ Color white(0xFFFFFFFF);
+ FloatRect fullRect(0, 0, 16, 16);
+ src->context()->fillRect(fullRect, white, DeviceColorSpace);
+
+ // Rotate the image by 90 degrees. This matrix is the same as
+ // cw90.rotate(90); but avoids rounding errors. Rounding errors can cause
+ // Skia to think that !rectStaysRect() and it will fall through to path
+ // drawing mode, which in turn gives us antialiasing. We want no
+ // antialiasing or other rounding problems since we're testing exact pixel
+ // values.
+ src->context()->save();
+ AffineTransform cw90(0, 1, -1, 0, 0, 0);
+ src->context()->concatCTM(cw90);
+
+ // Make a transparency layer consisting of a horizontal line of 50% black.
+ // Since the rotation is applied, this will actually be a vertical line
+ // down the middle of the image.
+ src->context()->beginTransparencyLayer(0.5);
+ FloatRect blackRect(0, -9, 16, 2);
+ Color black(0xFF000000);
+ src->context()->fillRect(blackRect, black, DeviceColorSpace);
+
+ // Now draw 50% red square.
+ {
+ // Create a transparency helper inset one pixel in the buffer. The
+ // coordinates are before transforming into this space, and maps to
+ // IntRect(1, 1, 14, 14).
+ TransparencyWin helper;
+ helper.init(src->context(),
+ TransparencyWin::OpaqueCompositeLayer,
+ TransparencyWin::Untransform,
+ IntRect(1, -15, 14, 14));
+
+ // Fill with red.
+ helper.context()->fillRect(helper.drawRect(), Color(0x7f7f0000), DeviceColorSpace);
+ clearTopLayerAlphaChannel(helper.context());
+ helper.composite();
+ }
+
+ // Finish the compositing.
+ src->context()->endTransparencyLayer();
+
+ // Top corner should be the original background.
+ EXPECT_EQ(white, getPixelAt(src->context(), 0, 0));
+
+ // Check the stripe down the middle, first at the top...
+ Color gray(0xFF808080);
+ EXPECT_EQ(white, getPixelAt(src->context(), 6, 0));
+ EXPECT_EQ(gray, getPixelAt(src->context(), 7, 0));
+ EXPECT_EQ(gray, getPixelAt(src->context(), 8, 0));
+ EXPECT_EQ(white, getPixelAt(src->context(), 9, 0));
+
+ // ...now at the bottom.
+ EXPECT_EQ(white, getPixelAt(src->context(), 6, 15));
+ EXPECT_EQ(gray, getPixelAt(src->context(), 7, 15));
+ EXPECT_EQ(gray, getPixelAt(src->context(), 8, 15));
+ EXPECT_EQ(white, getPixelAt(src->context(), 9, 15));
+
+ // Our red square should be 25% red over the top of those two.
+ Color redwhite(0xFFdfbfbf);
+ Color redgray(0xFF9f8080);
+ EXPECT_EQ(white, getPixelAt(src->context(), 0, 1));
+ EXPECT_EQ(redwhite, getPixelAt(src->context(), 1, 1));
+ EXPECT_EQ(redwhite, getPixelAt(src->context(), 6, 1));
+ EXPECT_EQ(redgray, getPixelAt(src->context(), 7, 1));
+ EXPECT_EQ(redgray, getPixelAt(src->context(), 8, 1));
+ EXPECT_EQ(redwhite, getPixelAt(src->context(), 9, 1));
+ EXPECT_EQ(redwhite, getPixelAt(src->context(), 14, 1));
+ EXPECT_EQ(white, getPixelAt(src->context(), 15, 1));
+
+ // Complete the 50% transparent layer.
+ src->context()->restore();
+}
+
+TEST(TransparencyWin, TranslateScaleOpaqueCompositeLayer)
+{
+ OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), DeviceRGB));
+
+ // The background is white on top with red on bottom.
+ Color white(0xFFFFFFFF);
+ FloatRect topRect(0, 0, 16, 8);
+ src->context()->fillRect(topRect, white, DeviceColorSpace);
+ Color red(0xFFFF0000);
+ FloatRect bottomRect(0, 8, 16, 8);
+ src->context()->fillRect(bottomRect, red, DeviceColorSpace);
+
+ src->context()->save();
+
+ // Translate left by one pixel.
+ AffineTransform left;
+ left.translate(-1, 0);
+
+ // Scale by 2x.
+ AffineTransform scale;
+ scale.scale(2.0);
+ src->context()->concatCTM(scale);
+
+ // Then translate up by one pixel (which will actually be 2 due to scaling).
+ AffineTransform up;
+ up.translate(0, -1);
+ src->context()->concatCTM(up);
+
+ // Now draw 50% red square.
+ {
+ // Create a transparency helper inset one pixel in the buffer. The
+ // coordinates are before transforming into this space, and maps to
+ // IntRect(1, 1, 14, 14).
+ TransparencyWin helper;
+ helper.init(src->context(),
+ TransparencyWin::OpaqueCompositeLayer,
+ TransparencyWin::KeepTransform,
+ IntRect(1, -15, 14, 14));
+
+ // Fill with red.
+ helper.context()->fillRect(helper.drawRect(), Color(0x7f7f0000), DeviceColorSpace);
+ clearTopLayerAlphaChannel(helper.context());
+ helper.composite();
+ }
+}
+
+// Tests scale mode with no additional copy.
+TEST(TransparencyWin, Scale)
+{
+ // Create an opaque white buffer.
+ OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), DeviceRGB));
+ FloatRect fullBuffer(0, 0, 16, 16);
+ src->context()->fillRect(fullBuffer, Color::white, DeviceColorSpace);
+
+ // Scale by 2x.
+ src->context()->save();
+ AffineTransform scale;
+ scale.scale(2.0);
+ src->context()->concatCTM(scale);
+
+ // Start drawing a rectangle from 1->4. This should get scaled to 2->8.
+ {
+ TransparencyWin helper;
+ helper.init(src->context(),
+ TransparencyWin::NoLayer,
+ TransparencyWin::ScaleTransform,
+ IntRect(1, 1, 3, 3));
+
+ // The context should now have the identity transform and the returned
+ // rect should be scaled.
+ EXPECT_TRUE(helper.context()->getCTM().isIdentity());
+ EXPECT_EQ(2, helper.drawRect().x());
+ EXPECT_EQ(2, helper.drawRect().y());
+ EXPECT_EQ(8, helper.drawRect().right());
+ EXPECT_EQ(8, helper.drawRect().bottom());
+
+ // Set the pixel at (2, 2) to be transparent. This should be fixed when
+ // the helper goes out of scope. We don't want to call
+ // clearTopLayerAlphaChannel because that will actually clear the whole
+ // canvas (since we have no extra layer!).
+ SkBitmap& bitmap = const_cast<SkBitmap&>(helper.context()->
+ platformContext()->canvas()->getTopPlatformDevice().
+ accessBitmap(false));
+ *bitmap.getAddr32(2, 2) &= 0x00FFFFFF;
+ helper.composite();
+ }
+
+ src->context()->restore();
+
+ // Check the pixel we previously made transparent, it should have gotten
+ // fixed back up to white.
+
+ // The current version doesn't fixup transparency when there is no layer.
+ // This seems not to be necessary, so we don't bother, but if it becomes
+ // necessary, this line should be uncommented.
+ // EXPECT_EQ(Color(Color::white), getPixelAt(src->context(), 2, 2));
+}
+
+// Tests scale mode with an additional copy for transparency. This will happen
+// if we have a scaled textbox, for example. WebKit will create a new
+// transparency layer, draw the text field, then draw the text into it, then
+// composite this down with an opacity.
+TEST(TransparencyWin, ScaleTransparency)
+{
+ // Create an opaque white buffer.
+ OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), DeviceRGB));
+ FloatRect fullBuffer(0, 0, 16, 16);
+ src->context()->fillRect(fullBuffer, Color::white, DeviceColorSpace);
+
+ // Make another layer (which duplicates how WebKit will make this). We fill
+ // the top half with red, and have the layer be 50% opaque.
+ src->context()->beginTransparencyLayer(0.5);
+ FloatRect topHalf(0, 0, 16, 8);
+ src->context()->fillRect(topHalf, Color(0xFFFF0000), DeviceColorSpace);
+
+ // Scale by 2x.
+ src->context()->save();
+ AffineTransform scale;
+ scale.scale(2.0);
+ src->context()->concatCTM(scale);
+
+ // Make a layer inset two pixels (because of scaling, this is 2->14). And
+ // will it with 50% black.
+ {
+ TransparencyWin helper;
+ helper.init(src->context(),
+ TransparencyWin::OpaqueCompositeLayer,
+ TransparencyWin::ScaleTransform,
+ IntRect(1, 1, 6, 6));
+
+ helper.context()->fillRect(helper.drawRect(), Color(0x7f000000), DeviceColorSpace);
+ clearTopLayerAlphaChannel(helper.context());
+ helper.composite();
+ }
+
+ // Finish the layer.
+ src->context()->restore();
+ src->context()->endTransparencyLayer();
+
+ Color redBackground(0xFFFF8080); // 50% red composited on white.
+ EXPECT_EQ(redBackground, getPixelAt(src->context(), 0, 0));
+ EXPECT_EQ(redBackground, getPixelAt(src->context(), 1, 1));
+
+ // Top half (minus two pixel border) should be 50% gray atop opaque
+ // red = 0xFF804141. Then that's composited with 50% transparency on solid
+ // white = 0xFFC0A1A1.
+ Color darkRed(0xFFBF8080);
+ EXPECT_EQ(darkRed, getPixelAt(src->context(), 2, 2));
+ EXPECT_EQ(darkRed, getPixelAt(src->context(), 7, 7));
+
+ // Bottom half (minus a two pixel border) should be a layer with 5% gray
+ // with another 50% opacity composited atop white.
+ Color darkWhite(0xFFBFBFBF);
+ EXPECT_EQ(darkWhite, getPixelAt(src->context(), 8, 8));
+ EXPECT_EQ(darkWhite, getPixelAt(src->context(), 13, 13));
+
+ Color white(0xFFFFFFFF); // Background in the lower-right.
+ EXPECT_EQ(white, getPixelAt(src->context(), 14, 14));
+ EXPECT_EQ(white, getPixelAt(src->context(), 15, 15));
+}
+
+TEST(TransparencyWin, Text)
+{
+ OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), DeviceRGB));
+
+ // Our text should end up 50% transparent blue-green.
+ Color fullResult(0x80008080);
+
+ {
+ TransparencyWin helper;
+ helper.init(src->context(),
+ TransparencyWin::TextComposite,
+ TransparencyWin::KeepTransform,
+ IntRect(0, 0, 16, 16));
+ helper.setTextCompositeColor(fullResult);
+
+ // Write several different squares to simulate ClearType. These should
+ // all reduce to 2/3 coverage.
+ FloatRect pixel(0, 0, 1, 1);
+ helper.context()->fillRect(pixel, 0xFFFF0000, DeviceColorSpace);
+ pixel.move(1.0f, 0.0f);
+ helper.context()->fillRect(pixel, 0xFF00FF00, DeviceColorSpace);
+ pixel.move(1.0f, 0.0f);
+ helper.context()->fillRect(pixel, 0xFF0000FF, DeviceColorSpace);
+ pixel.move(1.0f, 0.0f);
+ helper.context()->fillRect(pixel, 0xFF008080, DeviceColorSpace);
+ pixel.move(1.0f, 0.0f);
+ helper.context()->fillRect(pixel, 0xFF800080, DeviceColorSpace);
+ pixel.move(1.0f, 0.0f);
+ helper.context()->fillRect(pixel, 0xFF808000, DeviceColorSpace);
+
+ // Try one with 100% coverage (opaque black).
+ pixel.move(1.0f, 0.0f);
+ helper.context()->fillRect(pixel, 0xFF000000, DeviceColorSpace);
+
+ // Now mess with the alpha channel.
+ clearTopLayerAlphaChannel(helper.context());
+ helper.composite();
+ }
+
+ Color oneThirdResult(0x55005555); // = fullResult * 2 / 3
+ EXPECT_EQ(oneThirdResult, getPixelAt(src->context(), 0, 0));
+ EXPECT_EQ(oneThirdResult, getPixelAt(src->context(), 1, 0));
+ EXPECT_EQ(oneThirdResult, getPixelAt(src->context(), 2, 0));
+ EXPECT_EQ(oneThirdResult, getPixelAt(src->context(), 3, 0));
+ EXPECT_EQ(oneThirdResult, getPixelAt(src->context(), 4, 0));
+ EXPECT_EQ(oneThirdResult, getPixelAt(src->context(), 5, 0));
+ EXPECT_EQ(fullResult, getPixelAt(src->context(), 6, 0));
+ EXPECT_EQ(Color::transparent, getPixelAt(src->context(), 7, 0));
+}
+
+} // namespace WebCore
diff --git a/WebKit/chromium/tests/UniscribeHelperTest.cpp b/WebKit/chromium/tests/UniscribeHelperTest.cpp
new file mode 100644
index 0000000..8aaed11
--- /dev/null
+++ b/WebKit/chromium/tests/UniscribeHelperTest.cpp
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include <gtest/gtest.h>
+
+#include "PlatformString.h"
+#include "UniscribeHelper.h"
+
+using namespace WebCore;
+
+namespace {
+
+class UniscribeTest : public testing::Test {
+public:
+ UniscribeTest()
+ {
+ }
+
+ // Returns an HFONT with the given name. The caller does not have to free
+ // this, it will be automatically freed at the end of the test. Returns 0
+ // on failure. On success, the
+ HFONT MakeFont(const wchar_t* fontName, SCRIPT_CACHE** cache)
+ {
+ LOGFONT lf;
+ memset(&lf, 0, sizeof(LOGFONT));
+ lf.lfHeight = 20;
+ wcscpy_s(lf.lfFaceName, fontName);
+
+ HFONT hfont = CreateFontIndirect(&lf);
+ if (!hfont)
+ return 0;
+
+ *cache = new SCRIPT_CACHE;
+ **cache = 0;
+ createdFonts.append(std::make_pair(hfont, *cache));
+ return hfont;
+ }
+
+protected:
+ // Default font properties structure for tests to use.
+ SCRIPT_FONTPROPERTIES properties;
+
+private:
+ virtual void SetUp()
+ {
+ memset(&properties, 0, sizeof(SCRIPT_FONTPROPERTIES));
+ properties.cBytes = sizeof(SCRIPT_FONTPROPERTIES);
+ properties.wgBlank = ' ';
+ properties.wgDefault = '?'; // Used when the char is not in the font.
+ properties.wgInvalid = '#'; // Used for invalid characters.
+ }
+
+ virtual void TearDown()
+ {
+ // Free any allocated fonts.
+ for (size_t i = 0; i < createdFonts.size(); i++) {
+ DeleteObject(createdFonts[i].first);
+ ScriptFreeCache(createdFonts[i].second);
+ delete createdFonts[i].second;
+ }
+ createdFonts.clear();
+ }
+
+ // Tracks allocated fonts so we can delete them at the end of the test.
+ // The script cache pointer is heap allocated and must be freed.
+ Vector< std::pair<HFONT, SCRIPT_CACHE*> > createdFonts;
+};
+
+} // namespace
+
+// This test tests giving Uniscribe a very large buffer, which will cause a
+// failure.
+TEST_F(UniscribeTest, TooBig)
+{
+ // Make a large string with an e with a zillion combining accents.
+ String input(L"e");
+ for (int i = 0; i < 100000; i++)
+ input.append(static_cast<UChar>(0x301)); // Combining acute accent.
+
+ SCRIPT_CACHE* scriptCache;
+ HFONT hfont = MakeFont(L"Times New Roman", &scriptCache);
+ ASSERT_TRUE(hfont);
+
+ // Test a long string without the normal length protection we have. This
+ // will cause shaping to fail.
+ {
+ UniscribeHelper uniscribe(
+ input.characters(), static_cast<int>(input.length()),
+ false, hfont, scriptCache, &properties);
+ uniscribe.initWithOptionalLengthProtection(false);
+
+ // There should be one shaping entry, with nothing in it.
+ ASSERT_EQ(1, uniscribe.m_shapes.size());
+ EXPECT_EQ(0, uniscribe.m_shapes[0].m_glyphs.size());
+ EXPECT_EQ(0, uniscribe.m_shapes[0].m_logs.size());
+ EXPECT_EQ(0, uniscribe.m_shapes[0].m_visualAttributes.size());
+ EXPECT_EQ(0, uniscribe.m_shapes[0].m_advance.size());
+ EXPECT_EQ(0, uniscribe.m_shapes[0].m_offsets.size());
+ EXPECT_EQ(0, uniscribe.m_shapes[0].m_justify.size());
+ EXPECT_EQ(0, uniscribe.m_shapes[0].m_abc.abcA);
+ EXPECT_EQ(0, uniscribe.m_shapes[0].m_abc.abcB);
+ EXPECT_EQ(0, uniscribe.m_shapes[0].m_abc.abcC);
+
+ // The sizes of the other stuff should match the shaping entry.
+ EXPECT_EQ(1, uniscribe.m_runs.size());
+ EXPECT_EQ(1, uniscribe.m_screenOrder.size());
+
+ // Check that the various querying functions handle the empty case
+ // properly.
+ EXPECT_EQ(0, uniscribe.width());
+ EXPECT_EQ(0, uniscribe.firstGlyphForCharacter(0));
+ EXPECT_EQ(0, uniscribe.firstGlyphForCharacter(1000));
+ EXPECT_EQ(0, uniscribe.xToCharacter(0));
+ EXPECT_EQ(0, uniscribe.xToCharacter(1000));
+ }
+
+ // Now test the very large string and make sure it is handled properly by
+ // the length protection.
+ {
+ UniscribeHelper uniscribe(
+ input.characters(), static_cast<int>(input.length()),
+ false, hfont, scriptCache, &properties);
+ uniscribe.initWithOptionalLengthProtection(true);
+
+ // There should be 0 runs and shapes.
+ EXPECT_EQ(0, uniscribe.m_runs.size());
+ EXPECT_EQ(0, uniscribe.m_shapes.size());
+ EXPECT_EQ(0, uniscribe.m_screenOrder.size());
+
+ EXPECT_EQ(0, uniscribe.width());
+ EXPECT_EQ(0, uniscribe.firstGlyphForCharacter(0));
+ EXPECT_EQ(0, uniscribe.firstGlyphForCharacter(1000));
+ EXPECT_EQ(0, uniscribe.xToCharacter(0));
+ EXPECT_EQ(0, uniscribe.xToCharacter(1000));
+ }
+}
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index 92de7e4..7a44884 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,97 @@
+2010-02-09 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
+
+ Make sure cached frames have their scrollbars disconnected from
+ the WebView's adjustments.
+
+ * WebCoreSupport/FrameLoaderClientGtk.cpp:
+ (WebKit::FrameLoaderClient::savePlatformDataToCachedFrame):
+
+2010-02-09 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] Set GtkAdjustments on our FrameView when loading a page in the PageCache
+ https://bugs.webkit.org/show_bug.cgi?id=34754
+
+ Test that lower, and upper bounds are kept when goibg back with
+ page cache enabled, and disabled. Page cache behaviour is still a
+ bit broken (see FIXME).
+
+ * tests/testwebview.c:
+ (server_callback):
+ (map_event_cb):
+ (do_test_webkit_web_view_adjustments):
+ (test_webkit_web_view_adjustments):
+ (main):
+
+2010-02-09 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ [GTK] Set GtkAdjustments on our FrameView when loading a page in the PageCache
+ https://bugs.webkit.org/show_bug.cgi?id=34754
+
+ Set the Gtk Adjustments of the FrameViews when they are restored
+ from the PageCache too. Right we only do it for the newly created
+ FrameViews in transitionToCommittedForNewPage, but we it also
+ needs to be done in the equilavent transition method for cached
+ pages.
+
+ * WebCoreSupport/FrameLoaderClientGtk.cpp:
+ (WebKit::postCommitFrameViewSetup):
+ (WebKit::FrameLoaderClient::transitionToCommittedFromCachedFrame):
+ (WebKit::FrameLoaderClient::transitionToCommittedForNewPage):
+
+2010-02-08 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ [GTK] Implement FrameLoaderClient::hasWebView
+ https://bugs.webkit.org/show_bug.cgi?id=34682
+
+ Used for sanity-check ASSERTS in the FrameLoader code.
+
+ * WebCoreSupport/FrameLoaderClientGtk.cpp:
+ (WebKit::FrameLoaderClient::hasWebView):
+
+2010-02-08 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by Xan Lopez.
+
+ News about 1.1.21.
+
+ * NEWS:
+
+2010-02-05 Shinichiro Hamaji <hamaji@chromium.org>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ [Gtk] Implement layoutTestController.pageNumberForElementById
+ https://bugs.webkit.org/show_bug.cgi?id=34572
+
+ * webkit/webkitprivate.h:
+ * webkit/webkitwebframe.cpp:
+ (webkit_web_frame_page_number_for_element_by_id):
+
+2010-02-04 Christian Dywan <christian@twotoasts.de>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ [GTK] Add and cleanup return values of signals in view and frame
+ https://bugs.webkit.org/show_bug.cgi?id=33484
+
+ Add missing and cleanup return values of web frame and web view signals.
+
+ * webkit/webkitwebframe.cpp:
+ (webkit_web_frame_class_init):
+ * webkit/webkitwebview.cpp:
+ (DNDContentsRequest::webkit_web_view_class_init):
+
2010-02-02 Gustavo Noronha Silva <gns@gnome.org>
Reviewed by Xan Lopez.
diff --git a/WebKit/gtk/NEWS b/WebKit/gtk/NEWS
index 807fca4..4e5bc2c 100644
--- a/WebKit/gtk/NEWS
+++ b/WebKit/gtk/NEWS
@@ -1,4 +1,18 @@
=================
+WebKitGTK+ 1.1.21
+=================
+
+What's new in WebKitGTK+ 1.1.21?
+
+ - New custom-made GStreamer source element that uses the WebCore
+ network layer to download media data; this makes sure any headers
+ and cookies will automatically get added when making requests.
+ - WebKit will now let libsoup know who the first party for a given
+ message is, making it possible to implement accept/deny policies in
+ Soup.
+ - The usual stream of fixes, and improvements
+
+=================
WebKitGTK+ 1.1.20
=================
diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
index 8f1bec2..1ccc8a1 100644
--- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
@@ -3,7 +3,7 @@
* Copyright (C) 2007, 2008, 2009 Holger Hans Peter Freyther
* Copyright (C) 2007 Christian Dywan <christian@twotoasts.de>
* Copyright (C) 2008, 2009 Collabora Ltd. All rights reserved.
- * Copyright (C) 2009 Gustavo Noronha Silva <gns@gnome.org>
+ * Copyright (C) 2009, 2010 Gustavo Noronha Silva <gns@gnome.org>
* Copyright (C) Research In Motion Limited 2009. All rights reserved.
*
* This library is free software; you can redistribute it and/or
@@ -25,6 +25,7 @@
#include "FrameLoaderClientGtk.h"
#include "ArchiveResource.h"
+#include "CachedFrame.h"
#include "Color.h"
#include "DocumentLoader.h"
#include "DocumentLoaderGtk.h"
@@ -563,8 +564,7 @@ void FrameLoaderClient::setMainFrameDocumentReady(bool)
bool FrameLoaderClient::hasWebView() const
{
- notImplemented();
- return true;
+ return getViewFromFrame(m_frame);
}
void FrameLoaderClient::dispatchDidFinishLoad()
@@ -646,9 +646,7 @@ void FrameLoaderClient::setCopiesOnScroll()
void FrameLoaderClient::detachedFromParent2()
{
- FrameView *view = core(m_frame)->view();
- if (view)
- view->setGtkAdjustments(0, 0);
+ notImplemented();
}
void FrameLoaderClient::detachedFromParent3()
@@ -1116,12 +1114,40 @@ void FrameLoaderClient::updateGlobalHistoryRedirectLinks()
notImplemented();
}
-void FrameLoaderClient::savePlatformDataToCachedFrame(CachedFrame*)
+void FrameLoaderClient::savePlatformDataToCachedFrame(CachedFrame* cachedFrame)
+{
+ // We need to do this here in order to disconnect the scrollbars
+ // that are being used by the frame that is being cached from the
+ // adjustments, otherwise they will react to changes in the
+ // adjustments, and bad things will happen.
+ if (cachedFrame->view())
+ cachedFrame->view()->setGtkAdjustments(0, 0);
+}
+
+static void postCommitFrameViewSetup(WebKitWebFrame *frame, FrameView *view, bool resetValues)
{
+ WebKitWebView* containingWindow = getViewFromFrame(frame);
+ WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(containingWindow);
+ view->setGtkAdjustments(priv->horizontalAdjustment, priv->verticalAdjustment, resetValues);
+
+ if (priv->currentMenu) {
+ GtkMenu* menu = priv->currentMenu;
+ priv->currentMenu = 0;
+
+ gtk_menu_popdown(menu);
+ g_object_unref(menu);
+ }
}
-void FrameLoaderClient::transitionToCommittedFromCachedFrame(CachedFrame*)
+void FrameLoaderClient::transitionToCommittedFromCachedFrame(CachedFrame* cachedFrame)
{
+ ASSERT(cachedFrame->view());
+
+ Frame* frame = core(m_frame);
+ if (frame != frame->page()->mainFrame())
+ return;
+
+ postCommitFrameViewSetup(m_frame, cachedFrame->view(), false);
}
void FrameLoaderClient::transitionToCommittedForNewPage()
@@ -1140,16 +1166,7 @@ void FrameLoaderClient::transitionToCommittedForNewPage()
if (frame != frame->page()->mainFrame())
return;
- WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(containingWindow);
- frame->view()->setGtkAdjustments(priv->horizontalAdjustment, priv->verticalAdjustment);
-
- if (priv->currentMenu) {
- GtkMenu* menu = priv->currentMenu;
- priv->currentMenu = NULL;
-
- gtk_menu_popdown(menu);
- g_object_unref(menu);
- }
+ postCommitFrameViewSetup(m_frame, frame->view(), true);
}
}
diff --git a/WebKit/gtk/tests/testwebview.c b/WebKit/gtk/tests/testwebview.c
index 7482747..c028a36 100644
--- a/WebKit/gtk/tests/testwebview.c
+++ b/WebKit/gtk/tests/testwebview.c
@@ -55,6 +55,12 @@ server_callback(SoupServer* server, SoupMessage* msg,
g_assert(!error);
soup_message_body_append(msg->response_body, SOUP_MEMORY_TAKE, contents, length);
+ } else if (g_str_equal(path, "/bigdiv.html")) {
+ char* contents = g_strdup("<html><body><div style=\"background-color: green; height: 1200px;\"></div></body></html>");
+ soup_message_body_append(msg->response_body, SOUP_MEMORY_TAKE, contents, strlen(contents));
+ } else if (g_str_equal(path, "/iframe.html")) {
+ char* contents = g_strdup("<html><body><div style=\"background-color: green; height: 50px;\"></div><iframe src=\"bigdiv.html\"></iframe></body></html>");
+ soup_message_body_append(msg->response_body, SOUP_MEMORY_TAKE, contents, strlen(contents));
} else {
char* contents = g_strdup("<html><body>test</body></html>");
soup_message_body_append(msg->response_body, SOUP_MEMORY_TAKE, contents, strlen(contents));
@@ -121,6 +127,103 @@ static void test_webkit_web_view_icon_uri()
g_object_unref(view);
}
+static gboolean map_event_cb(GtkWidget *widget, GdkEvent* event, gpointer data)
+{
+ GMainLoop* loop = (GMainLoop*)data;
+ g_main_loop_quit(loop);
+
+ return FALSE;
+}
+
+static void do_test_webkit_web_view_adjustments(gboolean with_page_cache)
+{
+ char* effective_uri = g_strconcat(base_uri, "bigdiv.html", NULL);
+ char* second_uri = g_strconcat(base_uri, "iframe.html", NULL);
+ GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ GtkWidget* scrolled_window = gtk_scrolled_window_new(NULL, NULL);
+ WebKitWebView* view = WEBKIT_WEB_VIEW(webkit_web_view_new());
+ GtkAdjustment* adjustment;
+ double lower;
+ double upper;
+
+ if (with_page_cache) {
+ WebKitWebSettings* settings = webkit_web_view_get_settings(view);
+ g_object_set(settings, "enable-page-cache", TRUE, NULL);
+ }
+
+ gtk_window_set_default_size(GTK_WINDOW(window), 400, 200);
+
+ gtk_container_add(GTK_CONTAINER(window), scrolled_window);
+ gtk_container_add(GTK_CONTAINER(scrolled_window), GTK_WIDGET(view));
+
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+
+ loop = g_main_loop_new(NULL, TRUE);
+
+ g_object_connect(G_OBJECT(view),
+ "signal::notify::progress", idle_quit_loop_cb, NULL,
+ NULL);
+
+ /* Wait for window to show up */
+ gtk_widget_show_all(window);
+ g_signal_connect(window, "map-event",
+ G_CALLBACK(map_event_cb), loop);
+ g_main_loop_run(loop);
+
+ /* Load a page with a big div that will cause scrollbars to appear */
+ webkit_web_view_load_uri(view, effective_uri);
+ g_main_loop_run(loop);
+
+ adjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(scrolled_window));
+ g_assert_cmpfloat(gtk_adjustment_get_value(adjustment), ==, 0.0);
+
+ lower = gtk_adjustment_get_lower(adjustment);
+ upper = gtk_adjustment_get_upper(adjustment);
+
+ /* Scroll the view using JavaScript */
+ webkit_web_view_execute_script(view, "window.scrollBy(0, 100)");
+
+ /* Make sure the ScrolledWindow noticed the scroll */
+ g_assert_cmpfloat(gtk_adjustment_get_value(adjustment), ==, 100.0);
+
+ /* Load a second URI */
+ webkit_web_view_load_uri(view, second_uri);
+ g_main_loop_run(loop);
+
+ /* Make sure the scrollbar has been reset */
+ g_assert_cmpfloat(gtk_adjustment_get_value(adjustment), ==, 0.0);
+
+ /* Go back */
+ webkit_web_view_go_back(view);
+
+ /* When using page cache, go_back will return syncronously */
+ if (!with_page_cache)
+ g_main_loop_run(loop);
+
+ /* Make sure GTK+ has time to process the changes in size, for the adjusments */
+ while (gtk_events_pending())
+ gtk_main_iteration();
+
+ /* Make sure upper and lower bounds have been restored correctly */
+ g_assert_cmpfloat(lower, ==, gtk_adjustment_get_lower(adjustment));
+ g_assert_cmpfloat(upper, ==, gtk_adjustment_get_upper(adjustment));
+
+ g_assert_cmpfloat(gtk_adjustment_get_value(adjustment), ==, 100.0);
+
+ g_free(effective_uri);
+ g_free(second_uri);
+
+ gtk_widget_destroy(window);
+}
+
+static void test_webkit_web_view_adjustments()
+{
+ /* Test this with page cache disabled, and enabled. */
+ do_test_webkit_web_view_adjustments(FALSE);
+ do_test_webkit_web_view_adjustments(TRUE);
+}
+
int main(int argc, char** argv)
{
SoupServer* server;
@@ -153,6 +256,7 @@ int main(int argc, char** argv)
g_test_bug_base("https://bugs.webkit.org/");
g_test_add_func("/webkit/webview/icon-uri", test_webkit_web_view_icon_uri);
+ g_test_add_func("/webkit/webview/adjustments", test_webkit_web_view_adjustments);
return g_test_run ();
}
diff --git a/WebKit/gtk/webkit/webkitprivate.h b/WebKit/gtk/webkit/webkitprivate.h
index e9d61a6..44b4d0c 100644
--- a/WebKit/gtk/webkit/webkitprivate.h
+++ b/WebKit/gtk/webkit/webkitprivate.h
@@ -298,6 +298,9 @@ extern "C" {
WEBKIT_API gchar*
webkit_web_frame_counter_value_for_element_by_id (WebKitWebFrame* frame, const gchar* id);
+ WEBKIT_API int
+ webkit_web_frame_page_number_for_element_by_id(WebKitWebFrame* frame, const gchar* id, float pageWidth, float pageHeight);
+
WEBKIT_API guint
webkit_web_frame_get_pending_unload_event_count(WebKitWebFrame* frame);
diff --git a/WebKit/gtk/webkit/webkitwebframe.cpp b/WebKit/gtk/webkit/webkitwebframe.cpp
index 35d9524..fbd246d 100644
--- a/WebKit/gtk/webkit/webkitwebframe.cpp
+++ b/WebKit/gtk/webkit/webkitwebframe.cpp
@@ -269,6 +269,9 @@ static void webkit_web_frame_class_init(WebKitWebFrameClass* frameClass)
* WebKitWebFrame:horizontal-scrollbar-policy and
* WebKitWebFrame:vertical-scrollbar-policy properties.
*
+ * Return value: %TRUE to stop other handlers from being invoked for the
+ * event. %FALSE to propagate the event further.
+ *
* Since: 1.1.14
*/
webkit_web_frame_signals[SCROLLBARS_POLICY_CHANGED] = g_signal_new("scrollbars-policy-changed",
@@ -841,6 +844,29 @@ gchar* webkit_web_frame_counter_value_for_element_by_id(WebKitWebFrame* frame, c
}
/**
+ * webkit_web_frame_page_number_for_element_by_id
+ * @frame: a #WebKitWebFrame
+ * @id: an element ID string
+ * @pageWidth: width of a page
+ * @pageHeight: height of a page
+ *
+ * Return value: The number of page where the specified element will be put
+ */
+int webkit_web_frame_page_number_for_element_by_id(WebKitWebFrame* frame, const gchar* id, float pageWidth, float pageHeight)
+{
+ g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL);
+
+ Frame* coreFrame = core(frame);
+ if (!coreFrame)
+ return -1;
+
+ Element* coreElement = coreFrame->document()->getElementById(AtomicString(id));
+ if (!coreElement)
+ return -1;
+ return PrintContext::pageNumberForElement(coreElement, FloatSize(pageWidth, pageHeight));
+}
+
+/**
* webkit_web_frame_get_pending_unload_event_count:
* @frame: a #WebKitWebFrame
*
diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp
index ad13895..8c5b802 100644
--- a/WebKit/gtk/webkit/webkitwebview.cpp
+++ b/WebKit/gtk/webkit/webkitwebview.cpp
@@ -1325,7 +1325,6 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* WebKitWebView::create-web-view:
* @web_view: the object on which the signal is emitted
* @frame: the #WebKitWebFrame
- * @return: a newly allocated #WebKitWebView or %NULL
*
* Emitted when the creation of a new window is requested.
* If this signal is handled the signal handler should return the
@@ -1338,6 +1337,8 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* the new #WebKitWebView. The widget to which the widget is added will
* handle that.
*
+ * Return value: a newly allocated #WebKitWebView, or %NULL
+ *
* Since: 1.0.3
*/
webkit_web_view_signals[CREATE_WEB_VIEW] = g_signal_new("create-web-view",
@@ -1353,8 +1354,6 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
/**
* WebKitWebView::web-view-ready:
* @web_view: the object on which the signal is emitted
- * @return: %TRUE to stop other handlers from being invoked for
- * the event, %FALSE to propagate the event further
*
* Emitted after #WebKitWebView::create-web-view when the new #WebKitWebView
* should be displayed to the user. When this signal is emitted
@@ -1367,6 +1366,9 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* time of the window, so you may want to connect to the ::notify
* signal of the #WebKitWebWindowFeatures object to handle those.
*
+ * Return value: %TRUE to stop handlers from being invoked for the event or
+ * %FALSE to propagate the event furter
+ *
* Since: 1.0.3
*/
webkit_web_view_signals[WEB_VIEW_READY] = g_signal_new("web-view-ready",
@@ -1381,14 +1383,15 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
/**
* WebKitWebView::close-web-view:
* @web_view: the object on which the signal is emitted
- * @return: %TRUE to stop handlers from being invoked for the event or
- * %FALSE to propagate the event furter
*
* Emitted when closing a #WebKitWebView is requested. This occurs when a
* call is made from JavaScript's window.close function. The default
* signal handler does not do anything. It is the owner's responsibility
* to hide or delete the web view, if necessary.
*
+ * Return value: %TRUE to stop handlers from being invoked for the event or
+ * %FALSE to propagate the event furter
+ *
* Since: 1.1.11
*/
webkit_web_view_signals[CLOSE_WEB_VIEW] = g_signal_new("close-web-view",
@@ -1405,10 +1408,11 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* @web_view: the object on which the signal is emitted
* @frame: the #WebKitWebFrame that required the navigation
* @request: a #WebKitNetworkRequest
- * @return: a WebKitNavigationResponse
*
* Emitted when @frame requests a navigation to another page.
*
+ * Return value: a #WebKitNavigationResponse
+ *
* Deprecated: Use WebKitWebView::navigation-policy-decision-requested
* instead
*/
@@ -1430,8 +1434,6 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* @request: a #WebKitNetworkRequest
* @navigation_action: a #WebKitWebNavigation
* @policy_decision: a #WebKitWebPolicyDecision
- * @return: TRUE if a decision was made, FALSE to have the
- * default behavior apply
*
* Emitted when @frame requests opening a new window. With this
* signal the browser can use the context of the request to decide
@@ -1453,6 +1455,9 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* webkit_web_policy_decision_download() on the @policy_decision
* object.
*
+ * Return value: %TRUE if a decision was made, %FALSE to have the
+ * default behavior apply
+ *
* Since: 1.1.4
*/
webkit_web_view_signals[NEW_WINDOW_POLICY_DECISION_REQUESTED] =
@@ -1476,8 +1481,6 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* @request: a #WebKitNetworkRequest
* @navigation_action: a #WebKitWebNavigation
* @policy_decision: a #WebKitWebPolicyDecision
- * @return: TRUE if a decision was made, FALSE to have the
- * default behavior apply
*
* Emitted when @frame requests a navigation to another page.
* If this signal is not handled, the default behavior is to allow the
@@ -1490,6 +1493,9 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* webkit_web_policy_decision_download() on the @policy_decision
* object.
*
+ * Return value: %TRUE if a decision was made, %FALSE to have the
+ * default behavior apply
+ *
* Since: 1.0.3
*/
webkit_web_view_signals[NAVIGATION_POLICY_DECISION_REQUESTED] = g_signal_new("navigation-policy-decision-requested",
@@ -1512,8 +1518,6 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* @request: a WebKitNetworkRequest
* @mimetype: the MIME type attempted to load
* @policy_decision: a #WebKitWebPolicyDecision
- * @return: TRUE if a decision was made, FALSE to have the
- * default behavior apply
*
* Decide whether or not to display the given MIME type. If this
* signal is not handled, the default behavior is to show the
@@ -1531,6 +1535,9 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* webkit_web_policy_decision_download() on the @policy_decision
* object.
*
+ * Return value: %TRUE if a decision was made, %FALSE to have the
+ * default behavior apply
+ *
* Since: 1.0.3
*/
webkit_web_view_signals[MIME_TYPE_POLICY_DECISION_REQUESTED] = g_signal_new("mime-type-policy-decision-requested",
@@ -1578,7 +1585,6 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* @web_view: the object on which the signal is emitted
* @download: a #WebKitDownload object that lets you control the
* download process
- * @return: %TRUE if the download should be performed, %FALSE to cancel it.
*
* A new Download is being requested. By default, if the signal is
* not handled, the download is cancelled. If you handle the download
@@ -1601,6 +1607,9 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* is to download anything that WebKit can't handle, which you can
* figure out by using webkit_web_view_can_show_mime_type()).
*
+ * Return value: TRUE if the download should be performed, %FALSE to
+ * cancel it
+ *
* Since: 1.1.2
*/
webkit_web_view_signals[DOWNLOAD_REQUESTED] = g_signal_new("download-requested",
@@ -1681,6 +1690,9 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* handle the signal if you want to provide your own error page.
*
* Since: 1.1.6
+ *
+ * Return value: %TRUE to stop other handlers from being invoked for the
+ * event. %FALSE to propagate the event further.
*/
webkit_web_view_signals[LOAD_ERROR] = g_signal_new("load-error",
G_TYPE_FROM_CLASS(webViewClass),
@@ -1774,8 +1786,6 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* WebKitWebView::print-requested
* @web_view: the object in which the signal is emitted
* @web_frame: the frame that is requesting to be printed
- * @return: %TRUE if the print request has been handled, %FALSE if
- * the default handler should run
*
* Emitted when printing is requested by the frame, usually
* because of a javascript call. When handling this signal you
@@ -1787,6 +1797,9 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* ignore a print request you must connect to this signal, and
* return %TRUE.
*
+ * Return value: %TRUE if the print request has been handled, %FALSE if
+ * the default handler should run
+ *
* Since: 1.1.5
*/
webkit_web_view_signals[PRINT_REQUESTED] = g_signal_new("print-requested",
@@ -1843,9 +1856,11 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* @message: the message text
* @line: the line where the error occured
* @source_id: the source id
- * @return: TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further.
*
* A JavaScript console message was created.
+ *
+ * Return value: %TRUE to stop other handlers from being invoked for the
+ * event. %FALSE to propagate the event further.
*/
webkit_web_view_signals[CONSOLE_MESSAGE] = g_signal_new("console-message",
G_TYPE_FROM_CLASS(webViewClass),
@@ -1862,9 +1877,11 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* @web_view: the object on which the signal is emitted
* @frame: the relevant frame
* @message: the message text
- * @return: TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further.
*
* A JavaScript alert dialog was created.
+ *
+ * Return value: %TRUE to stop other handlers from being invoked for the
+ * event. %FALSE to propagate the event further.
*/
webkit_web_view_signals[SCRIPT_ALERT] = g_signal_new("script-alert",
G_TYPE_FROM_CLASS(webViewClass),
@@ -1882,9 +1899,11 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* @frame: the relevant frame
* @message: the message text
* @confirmed: whether the dialog has been confirmed
- * @return: TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further.
*
* A JavaScript confirm dialog was created, providing Yes and No buttons.
+ *
+ * Return value: %TRUE to stop other handlers from being invoked for the
+ * event. %FALSE to propagate the event further.
*/
webkit_web_view_signals[SCRIPT_CONFIRM] = g_signal_new("script-confirm",
G_TYPE_FROM_CLASS(webViewClass),
@@ -1903,9 +1922,11 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* @message: the message text
* @default: the default value
* @text: To be filled with the return value or NULL if the dialog was cancelled.
- * @return: TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further.
*
* A JavaScript prompt dialog was created, providing an entry to input text.
+ *
+ * Return value: %TRUE to stop other handlers from being invoked for the
+ * event. %FALSE to propagate the event further.
*/
webkit_web_view_signals[SCRIPT_PROMPT] = g_signal_new("script-prompt",
G_TYPE_FROM_CLASS(webViewClass),
@@ -2032,6 +2053,8 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
*
* The #WebKitWebView::move-cursor will be emitted to apply the
* cursor movement described by its parameters to the @view.
+ *
+ * Return value: %TRUE or %FALSE
*
* Since: 1.1.4
*/
@@ -2059,6 +2082,8 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* to set the property value of "webkit-widget-is-selected". This can
* be used to draw a visual indicator of the selection.
*
+ * Return value: a new #GtkWidget, or %NULL
+ *
* Since: 1.1.8
*/
webkit_web_view_signals[PLUGIN_WIDGET] = g_signal_new("create-plugin-widget",
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 8bbd4de..b545a40 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,189 @@
+2010-02-12 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Darin Adler.
+
+ <rdar://problem/7615234> REGRESSION (r48586): Loading an HTML page causes
+ PDFKit to be loaded
+
+ * WebView/WebPDFDocumentExtras.h: Removed the category declaration and
+ addWebPDFDocumentExtras(). Declare allScriptsInPDFDocument().
+ * WebView/WebPDFDocumentExtras.mm:
+ (allScriptsInPDFDocument): Changed the -_web_allScripts method into this function.
+ * WebView/WebPDFRepresentation.mm: Removed +initialize.
+ (-[WebPDFRepresentation finishedLoadingWithDataSource:]): Use
+ allScriptsInPDFDocument() instead of -_web_allScripts.
+
+2010-02-10 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Exported some new JavaScript heap introspection.
+
+ * Misc/WebCoreStatistics.h:
+ * Misc/WebCoreStatistics.mm:
+ (+[WebCoreStatistics javaScriptObjectTypeCounts]): Just like
+ javaScriptProtectedObjectTypeCounts, except this function enumerates all
+ live objects, not just protected objects.
+
+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:
+
+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
+
+ * ForwardingHeaders/wtf/ValueCheck.h: Added.
+
+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.
+
+ * WebView/WebPreferenceKeysPrivate.h:
+ * WebView/WebPreferences.mm:
+ (+[WebPreferences initialize]):
+ (-[WebPreferences isFrameSetFlatteningEnabled]):
+ (-[WebPreferences setFrameSetFlatteningEnabled:]):
+ * WebView/WebPreferencesPrivate.h:
+ * WebView/WebView.mm:
+ (-[WebView _preferencesChangedNotification:]):
+
+2010-02-09 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34771
+ A stray mouse moved event is sent to plug-ins after mouse exit
+
+ * WebCoreSupport/WebFrameLoaderClient.mm: (NetscapePluginWidget::handleEvent): A mouseout
+ DOM event is dispatched while handling NSMouseMoved - but we shouldn't be sending a
+ mouse moved event to plug-ins at this point.
+
+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
+
+ * Misc/WebCoreStatistics.h:
+ * Misc/WebCoreStatistics.mm:
+ (-[WebFrame numberOfPages:pageWidthInPixels:]):
+
+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
+
+ * Plugins/Hosted/WebKitPluginClient.defs: Made PCSetProperty and PCRemoveProperty async.
+ A plug-in can call back whil processing this call (e.g. for NPN_SetException), so we need
+ to listen for messages while waiting for reply.
+
+ * Plugins/Hosted/NetscapePluginHostProxy.mm:
+ (WKPCEvaluate): If there is no instance proxy, return KERN_FAILURE. This improves consistency
+ between method implementations, and leaves us with one less IPC call to make in failure case
+ (returning false with KERN_SUCCESS and returning KERN_FAILURE looks the same from plugin
+ host code).
+ (WKPCInvoke): Ditto.
+ (WKPCInvokeDefault): Ditto.
+ (WKPCGetProperty): Ditto.
+ (WKPCSetProperty): Send a reply once done.
+ (WKPCRemoveProperty): Ditto.
+ (WKPCHasProperty): If there is no instance proxy, return KERN_FAILURE.
+ (WKPCHasMethod): Ditto.
+ (WKPCEnumerate): Ditto.
+
+2010-02-08 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ <rdar://problem/6530010> OOP: Support NPN_SetException
+
+ Tested by plugins/netscape-throw-exception.html (removed it from skipped list).
+
+ * Plugins/Hosted/NetscapePluginHostProxy.mm:
+ (WKPCSetException):
+ * Plugins/Hosted/NetscapePluginInstanceProxy.h:
+ * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+ (WebKit::globalExceptionString):
+ (WebKit::NetscapePluginInstanceProxy::setGlobalException):
+ (WebKit::NetscapePluginInstanceProxy::moveGlobalExceptionToExecState):
+ * Plugins/Hosted/ProxyInstance.mm:
+ (WebKit::ProxyInstance::invoke):
+ (WebKit::ProxyInstance::getPropertyNames):
+ (WebKit::ProxyInstance::fieldValue):
+ (WebKit::ProxyInstance::setFieldValue):
+ * Plugins/Hosted/WebKitPluginClient.defs:
+ Route exception string to a global that's checked after calling into plug-in (just like in
+ in-process case).
+
+2010-02-05 Kevin Decker <kdecker@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34661
+ <rdar://problem/7614067> REGRESSION (Safari 4.0-> Safari 4.0.4): NPP_SetWindow no longer sets a clipRect of (0,0,0,0) when it becomes hidden
+
+ * Plugins/Hosted/WebHostedNetscapePluginView.mm:
+ (-[WebHostedNetscapePluginView updateAndSetWindow]): When clipping out NPDrawingModelCoreAnimation plug-ins, provide a zero'd out clipRect.
+ * Plugins/WebBaseNetscapePluginView.h: Moved superviewsHaveSuperviews to the base class.
+ * Plugins/WebBaseNetscapePluginView.mm:
+ (-[WebBaseNetscapePluginView superviewsHaveSuperviews]): Added to the base class; extracted from WebNetscapePluginView.
+ (-[WebBaseNetscapePluginView shouldClipOutPlugin]): Added new method with code extracted from WebNetscapePluginView.
+ * Plugins/WebNetscapePluginView.mm:
+ (-[WebNetscapePluginView saveAndSetNewPortStateForUpdate:]): When clipping out NPDrawingModelCoreAnimation plug-ins, provide a zero'd out clipRect.
+
+2010-02-04 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Dan Bernstein.
+
+ Fix the ability to #include <WebKit/DOMFile.h>.
+
+ * MigrateHeaders.make: Mark DOMBlob.h as a public header since the already-public DOMFile.h depends on it.
+
+2010-02-04 John Sullivan <sullivan@apple.com>
+
+ https://bugs.webkit.org/show_bug.cgi?id=34611
+ WebLocalizedString() could use an assertion that it is being called on the main thread
+
+ Reviewed by Tim Hatcher.
+
+ * Misc/WebLocalizableStrings.m: Removed.
+ * Misc/WebLocalizableStrings.mm: Copied from mac/Misc/WebLocalizableStrings.m.
+ Renamed to use .mm extension so it can include a C++ header.
+ (WebLocalizedString):
+ Added an assertion that this is being called on the main thread.
+
+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
+
+ * WebView/WebFrameView.mm:
+ (-[WebFrameView _verticalPageScrollDistance]): Use Scrollbar methods instead of
+ constants, and cap the scroll distance.
+ (-[WebFrameView initWithFrame:]): Use Scrollbar::pixelsPerLineStep() instead of
+ cScrollbarPixelsPerLineStep.
+ (-[WebFrameView _horizontalPageScrollDistance]):Use Scrollbar methods instead of
+ constants, and cap the scroll distance.
+
2010-02-01 Shinichiro Hamaji <hamaji@chromium.org>
Reviewed by Eric Seidel.
diff --git a/WebKit/mac/Configurations/FeatureDefines.xcconfig b/WebKit/mac/Configurations/FeatureDefines.xcconfig
index 24589c7..8343ce7 100644
--- a/WebKit/mac/Configurations/FeatureDefines.xcconfig
+++ b/WebKit/mac/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/WebKit/mac/Configurations/Version.xcconfig b/WebKit/mac/Configurations/Version.xcconfig
index 75f9bd4..0e289b1 100644
--- a/WebKit/mac/Configurations/Version.xcconfig
+++ b/WebKit/mac/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/WebKit/mac/ForwardingHeaders/wtf/ValueCheck.h b/WebKit/mac/ForwardingHeaders/wtf/ValueCheck.h
new file mode 100644
index 0000000..7a067ff
--- /dev/null
+++ b/WebKit/mac/ForwardingHeaders/wtf/ValueCheck.h
@@ -0,0 +1 @@
+#import <JavaScriptCore/ValueCheck.h>
diff --git a/WebKit/mac/MigrateHeaders.make b/WebKit/mac/MigrateHeaders.make
index 7d01c99..f4bf744 100644
--- a/WebKit/mac/MigrateHeaders.make
+++ b/WebKit/mac/MigrateHeaders.make
@@ -36,7 +36,7 @@ all : \
$(PUBLIC_HEADERS_DIR)/DOM.h \
$(PUBLIC_HEADERS_DIR)/DOMAbstractView.h \
$(PUBLIC_HEADERS_DIR)/DOMAttr.h \
- $(PRIVATE_HEADERS_DIR)/DOMBlob.h \
+ $(PUBLIC_HEADERS_DIR)/DOMBlob.h \
$(INTERNAL_HEADERS_DIR)/DOMBlobInternal.h \
$(PUBLIC_HEADERS_DIR)/DOMCDATASection.h \
$(PUBLIC_HEADERS_DIR)/DOMCSS.h \
diff --git a/WebKit/mac/Misc/WebCoreStatistics.h b/WebKit/mac/Misc/WebCoreStatistics.h
index 6c45fb9..d205083 100644
--- a/WebKit/mac/Misc/WebCoreStatistics.h
+++ b/WebKit/mac/Misc/WebCoreStatistics.h
@@ -43,6 +43,7 @@
+ (size_t)javaScriptProtectedObjectsCount;
+ (size_t)javaScriptProtectedGlobalObjectsCount;
+ (NSCountedSet *)javaScriptProtectedObjectTypeCounts;
++ (NSCountedSet *)javaScriptObjectTypeCounts;
+ (void)garbageCollectJavaScriptObjects;
+ (void)garbageCollectJavaScriptObjectsOnAlternateThreadForDebugging:(BOOL)waitUntilDone;
@@ -85,4 +86,5 @@
- (NSString *)renderTreeAsExternalRepresentation;
- (NSString *)counterValueForElement:(DOMElement*)element;
- (int)pageNumberForElement:(DOMElement*)element:(float)pageWidthInPixels:(float)pageHeightInPixels;
+- (int)numberOfPages:(float)pageWidthInPixels:(float)pageHeightInPixels;
@end
diff --git a/WebKit/mac/Misc/WebCoreStatistics.mm b/WebKit/mac/Misc/WebCoreStatistics.mm
index b18ee29..9e8ae05 100644
--- a/WebKit/mac/Misc/WebCoreStatistics.mm
+++ b/WebKit/mac/Misc/WebCoreStatistics.mm
@@ -93,6 +93,21 @@ using namespace WebCore;
return result;
}
++ (NSCountedSet *)javaScriptObjectTypeCounts
+{
+ JSLock lock(SilenceAssertionsOnly);
+
+ NSCountedSet *result = [NSCountedSet set];
+
+ OwnPtr<HashCountedSet<const char*> > counts(JSDOMWindow::commonJSGlobalData()->heap.objectTypeCounts());
+ HashCountedSet<const char*>::iterator end = counts->end();
+ for (HashCountedSet<const char*>::iterator it = counts->begin(); it != end; ++it)
+ for (unsigned i = 0; i < it->second; ++i)
+ [result addObject:[NSString stringWithUTF8String:it->first]];
+
+ return result;
+}
+
+ (void)garbageCollectJavaScriptObjects
{
gcController().garbageCollectNow();
@@ -256,4 +271,9 @@ using namespace WebCore;
return PrintContext::pageNumberForElement(core(element), FloatSize(pageWidthInPixels, pageHeightInPixels));
}
+- (int)numberOfPages:(float)pageWidthInPixels:(float)pageHeightInPixels
+{
+ return PrintContext::numberOfPages(_private->coreFrame, FloatSize(pageWidthInPixels, pageHeightInPixels));
+}
+
@end
diff --git a/WebKit/mac/Misc/WebLocalizableStrings.m b/WebKit/mac/Misc/WebLocalizableStrings.mm
index 0babfbc..4006bb7 100644
--- a/WebKit/mac/Misc/WebLocalizableStrings.m
+++ b/WebKit/mac/Misc/WebLocalizableStrings.mm
@@ -29,11 +29,18 @@
#import <WebKit/WebLocalizableStrings.h>
#import <wtf/Assertions.h>
+#import <wtf/Threading.h>
WebLocalizableStringsBundle WebKitLocalizableStringsBundle = { "com.apple.WebKit", 0 };
NSString *WebLocalizedString(WebLocalizableStringsBundle *stringsBundle, const char *key)
{
+ // This function is not thread-safe due at least to its unguarded use of the mainBundle static variable
+ // and its use of [NSBundle localizedStringForKey:::], which is not guaranteed to be thread-safe. If
+ // we decide we need to use this on background threads, we'll need to add locking here and make sure
+ // it doesn't affect performance.
+ ASSERT(isMainThread());
+
NSBundle *bundle;
if (stringsBundle == NULL) {
static NSBundle *mainBundle;
diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm b/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm
index 0e6c9a3..c5beb07 100644
--- a/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm
+++ b/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm
@@ -39,6 +39,7 @@
#import <WebCore/Frame.h>
#import <WebCore/IdentifierRep.h>
#import <WebCore/ScriptController.h>
+#import <string>
extern "C" {
#import "WebKitPluginHost.h"
@@ -568,10 +569,8 @@ kern_return_t WKPCEvaluate(mach_port_t clientPort, uint32_t pluginID, uint32_t r
return KERN_FAILURE;
NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);
- if (!instanceProxy) {
- _WKPHBooleanAndDataReply(hostProxy->port(), pluginID, requestID, false, 0, 0);
- return KERN_SUCCESS;
- }
+ if (!instanceProxy)
+ return KERN_FAILURE;
PluginDestroyDeferrer deferrer(instanceProxy);
@@ -625,18 +624,14 @@ kern_return_t WKPCInvoke(mach_port_t clientPort, uint32_t pluginID, uint32_t req
return KERN_FAILURE;
NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);
- if (!instanceProxy) {
- _WKPHBooleanAndDataReply(hostProxy->port(), pluginID, requestID, false, 0, 0);
- return KERN_SUCCESS;
- }
+ if (!instanceProxy)
+ return KERN_FAILURE;
PluginDestroyDeferrer deferrer(instanceProxy);
IdentifierRep* identifier = reinterpret_cast<IdentifierRep*>(serverIdentifier);
- if (!IdentifierRep::isValid(identifier)) {
- _WKPHBooleanAndDataReply(hostProxy->port(), instanceProxy->pluginID(), requestID, false, 0, 0);
- return KERN_SUCCESS;
- }
+ if (!IdentifierRep::isValid(identifier))
+ return KERN_FAILURE;
Identifier methodNameIdentifier = identifierFromIdentifierRep(identifier);
@@ -661,10 +656,8 @@ kern_return_t WKPCInvokeDefault(mach_port_t clientPort, uint32_t pluginID, uint3
return KERN_FAILURE;
NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);
- if (!instanceProxy) {
- _WKPHBooleanAndDataReply(hostProxy->port(), pluginID, requestID, false, 0, 0);
- return KERN_SUCCESS;
- }
+ if (!instanceProxy)
+ return KERN_FAILURE;
PluginDestroyDeferrer deferrer(instanceProxy);
@@ -707,16 +700,12 @@ kern_return_t WKPCGetProperty(mach_port_t clientPort, uint32_t pluginID, uint32_
return KERN_FAILURE;
NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);
- if (!instanceProxy) {
- _WKPHBooleanAndDataReply(hostProxy->port(), pluginID, requestID, false, 0, 0);
- return KERN_SUCCESS;
- }
+ if (!instanceProxy)
+ return KERN_FAILURE;
IdentifierRep* identifier = reinterpret_cast<IdentifierRep*>(serverIdentifier);
- if (!IdentifierRep::isValid(identifier)) {
- _WKPHBooleanAndDataReply(hostProxy->port(), pluginID, requestID, false, 0, 0);
- return KERN_SUCCESS;
- }
+ if (!IdentifierRep::isValid(identifier))
+ return KERN_FAILURE;
PluginDestroyDeferrer deferrer(instanceProxy);
@@ -737,7 +726,7 @@ kern_return_t WKPCGetProperty(mach_port_t clientPort, uint32_t pluginID, uint32_
return KERN_SUCCESS;
}
-kern_return_t WKPCSetProperty(mach_port_t clientPort, uint32_t pluginID, uint32_t objectID, uint64_t serverIdentifier, data_t valueData, mach_msg_type_number_t valueLength, boolean_t* returnValue)
+kern_return_t WKPCSetProperty(mach_port_t clientPort, uint32_t pluginID, uint32_t requestID, uint32_t objectID, uint64_t serverIdentifier, data_t valueData, mach_msg_type_number_t valueLength)
{
DataDeallocator deallocator(valueData, valueLength);
@@ -753,18 +742,21 @@ kern_return_t WKPCSetProperty(mach_port_t clientPort, uint32_t pluginID, uint32_
IdentifierRep* identifier = reinterpret_cast<IdentifierRep*>(serverIdentifier);
if (!IdentifierRep::isValid(identifier))
- *returnValue = false;
-
+ return KERN_FAILURE;
+
+ bool result;
if (identifier->isString()) {
Identifier propertyNameIdentifier = identifierFromIdentifierRep(identifier);
- *returnValue = instanceProxy->setProperty(objectID, propertyNameIdentifier, valueData, valueLength);
+ result = instanceProxy->setProperty(objectID, propertyNameIdentifier, valueData, valueLength);
} else
- *returnValue = instanceProxy->setProperty(objectID, identifier->number(), valueData, valueLength);
-
+ result = instanceProxy->setProperty(objectID, identifier->number(), valueData, valueLength);
+
+ _WKPHBooleanReply(hostProxy->port(), instanceProxy->pluginID(), requestID, result);
+
return KERN_SUCCESS;
}
-kern_return_t WKPCRemoveProperty(mach_port_t clientPort, uint32_t pluginID, uint32_t objectID, uint64_t serverIdentifier, boolean_t* returnValue)
+kern_return_t WKPCRemoveProperty(mach_port_t clientPort, uint32_t pluginID, uint32_t requestID, uint32_t objectID, uint64_t serverIdentifier)
{
NetscapePluginHostProxy* hostProxy = pluginProxyMap().get(clientPort);
if (!hostProxy)
@@ -779,13 +771,16 @@ kern_return_t WKPCRemoveProperty(mach_port_t clientPort, uint32_t pluginID, uint
IdentifierRep* identifier = reinterpret_cast<IdentifierRep*>(serverIdentifier);
if (!IdentifierRep::isValid(identifier))
return KERN_FAILURE;
-
+
+ bool result;
if (identifier->isString()) {
Identifier propertyNameIdentifier = identifierFromIdentifierRep(identifier);
- *returnValue = instanceProxy->removeProperty(objectID, propertyNameIdentifier);
+ result = instanceProxy->removeProperty(objectID, propertyNameIdentifier);
} else
- *returnValue = instanceProxy->removeProperty(objectID, identifier->number());
-
+ result = instanceProxy->removeProperty(objectID, identifier->number());
+
+ _WKPHBooleanReply(hostProxy->port(), instanceProxy->pluginID(), requestID, result);
+
return KERN_SUCCESS;
}
@@ -796,18 +791,14 @@ kern_return_t WKPCHasProperty(mach_port_t clientPort, uint32_t pluginID, uint32_
return KERN_FAILURE;
NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);
- if (!instanceProxy) {
- _WKPHBooleanReply(hostProxy->port(), pluginID, requestID, false);
- return KERN_SUCCESS;
- }
+ if (!instanceProxy)
+ return KERN_FAILURE;
PluginDestroyDeferrer deferrer(instanceProxy);
IdentifierRep* identifier = reinterpret_cast<IdentifierRep*>(serverIdentifier);
- if (!IdentifierRep::isValid(identifier)) {
- _WKPHBooleanReply(hostProxy->port(), instanceProxy->pluginID(), requestID, false);
- return KERN_SUCCESS;
- }
+ if (!IdentifierRep::isValid(identifier))
+ return KERN_FAILURE;
boolean_t returnValue;
if (identifier->isString()) {
@@ -828,18 +819,14 @@ kern_return_t WKPCHasMethod(mach_port_t clientPort, uint32_t pluginID, uint32_t
return KERN_FAILURE;
NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);
- if (!instanceProxy) {
- _WKPHBooleanReply(hostProxy->port(), pluginID, requestID, false);
- return KERN_SUCCESS;
- }
+ if (!instanceProxy)
+ return KERN_FAILURE;
PluginDestroyDeferrer deferrer(instanceProxy);
IdentifierRep* identifier = reinterpret_cast<IdentifierRep*>(serverIdentifier);
- if (!IdentifierRep::isValid(identifier)) {
- _WKPHBooleanReply(hostProxy->port(), instanceProxy->pluginID(), requestID, false);
- return KERN_SUCCESS;
- }
+ if (!IdentifierRep::isValid(identifier))
+ return KERN_FAILURE;
Identifier methodNameIdentifier = identifierFromIdentifierRep(identifier);
boolean_t returnValue = instanceProxy->hasMethod(objectID, methodNameIdentifier);
@@ -880,10 +867,8 @@ kern_return_t WKPCEnumerate(mach_port_t clientPort, uint32_t pluginID, uint32_t
return KERN_FAILURE;
NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);
- if (!instanceProxy) {
- _WKPHBooleanAndDataReply(hostProxy->port(), pluginID, requestID, false, 0, 0);
- return KERN_SUCCESS;
- }
+ if (!instanceProxy)
+ return KERN_FAILURE;
data_t resultData = 0;
mach_msg_type_number_t resultLength = 0;
@@ -1149,4 +1134,14 @@ kern_return_t WKPCRunSyncOpenPanel(mach_port_t clientPort, data_t panelData, mac
}
#endif // !defined(BUILDING_ON_SNOW_LEOPARD)
+kern_return_t WKPCSetException(mach_port_t clientPort, data_t message, mach_msg_type_number_t messageCnt)
+{
+ DataDeallocator deallocator(message, messageCnt);
+
+ string str(message, messageCnt);
+ NetscapePluginInstanceProxy::setGlobalException(str.c_str());
+
+ return KERN_SUCCESS;
+}
+
#endif // USE(PLUGIN_HOST_PROCESS)
diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
index 2ef6b02..76981a4 100644
--- a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
+++ b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
@@ -140,7 +140,7 @@ public:
data_t& usernameData, mach_msg_type_number_t& usernameLength, data_t& passwordData, mach_msg_type_number_t& passwordLength);
bool convertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace,
double& destX, double& destY, NPCoordinateSpace destSpace);
-
+
PassRefPtr<JSC::Bindings::Instance> createBindingsInstance(PassRefPtr<JSC::Bindings::RootObject>);
RetainPtr<NSData *> marshalValues(JSC::ExecState*, const JSC::ArgList& args);
void marshalValue(JSC::ExecState*, JSC::JSValue value, data_t& resultData, mach_msg_type_number_t& resultLength);
@@ -167,6 +167,9 @@ public:
void didDraw();
void privateBrowsingModeDidChange(bool isPrivateBrowsingEnabled);
+ static void setGlobalException(const WebCore::String&);
+ static void moveGlobalExceptionToExecState(JSC::ExecState*);
+
// Reply structs
struct Reply {
enum Type {
diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
index e4fe1d2..c09e3ea 100644
--- a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
+++ b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
@@ -40,6 +40,7 @@
#import "WebUIDelegate.h"
#import "WebUIDelegatePrivate.h"
#import "WebViewInternal.h"
+#import <JavaScriptCore/Error.h>
#import <JavaScriptCore/JSLock.h>
#import <JavaScriptCore/PropertyNameArray.h>
#import <WebCore/CString.h>
@@ -1492,6 +1493,30 @@ void NetscapePluginInstanceProxy::privateBrowsingModeDidChange(bool isPrivateBro
_WKPHPluginInstancePrivateBrowsingModeDidChange(m_pluginHostProxy->port(), m_pluginID, isPrivateBrowsingEnabled);
}
+static String& globalExceptionString()
+{
+ DEFINE_STATIC_LOCAL(String, exceptionString, ());
+ return exceptionString;
+}
+
+void NetscapePluginInstanceProxy::setGlobalException(const String& exception)
+{
+ globalExceptionString() = exception;
+}
+
+void NetscapePluginInstanceProxy::moveGlobalExceptionToExecState(ExecState* exec)
+{
+ if (globalExceptionString().isNull())
+ return;
+
+ {
+ JSLock lock(SilenceAssertionsOnly);
+ throwError(exec, GeneralError, globalExceptionString());
+ }
+
+ globalExceptionString() = UString();
+}
+
} // namespace WebKit
#endif // USE(PLUGIN_HOST_PROCESS)
diff --git a/WebKit/mac/Plugins/Hosted/ProxyInstance.mm b/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
index 1af2ef8..1587ad0 100644
--- a/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
+++ b/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
@@ -147,6 +147,7 @@ JSValue ProxyInstance::invoke(JSC::ExecState* exec, InvokeType type, uint64_t id
return jsUndefined();
auto_ptr<NetscapePluginInstanceProxy::BooleanAndDataReply> reply = waitForReply<NetscapePluginInstanceProxy::BooleanAndDataReply>(requestID);
+ NetscapePluginInstanceProxy::moveGlobalExceptionToExecState(exec);
if (!reply.get() || !reply->m_returnValue)
return jsUndefined();
@@ -253,7 +254,7 @@ void ProxyInstance::getPropertyNames(ExecState* exec, PropertyNameArray& nameArr
return;
auto_ptr<NetscapePluginInstanceProxy::BooleanAndDataReply> reply = waitForReply<NetscapePluginInstanceProxy::BooleanAndDataReply>(requestID);
-
+ NetscapePluginInstanceProxy::moveGlobalExceptionToExecState(exec);
if (!reply.get() || !reply->m_returnValue)
return;
@@ -361,6 +362,7 @@ JSC::JSValue ProxyInstance::fieldValue(ExecState* exec, const Field* field) cons
return jsUndefined();
auto_ptr<NetscapePluginInstanceProxy::BooleanAndDataReply> reply = waitForReply<NetscapePluginInstanceProxy::BooleanAndDataReply>(requestID);
+ NetscapePluginInstanceProxy::moveGlobalExceptionToExecState(exec);
if (!reply.get() || !reply->m_returnValue)
return jsUndefined();
@@ -387,6 +389,7 @@ void ProxyInstance::setFieldValue(ExecState* exec, const Field* field, JSValue v
return;
auto_ptr<NetscapePluginInstanceProxy::BooleanReply> reply = waitForReply<NetscapePluginInstanceProxy::BooleanReply>(requestID);
+ NetscapePluginInstanceProxy::moveGlobalExceptionToExecState(exec);
}
void ProxyInstance::invalidate()
diff --git a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
index 9baa328..42f0877 100644
--- a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
@@ -161,12 +161,24 @@ extern "C" {
// Use AppKit to convert view coordinates to NSWindow coordinates.
NSRect boundsInWindow = [self convertRect:[self bounds] toView:nil];
- NSRect visibleRectInWindow = [self convertRect:[self visibleRect] toView:nil];
+ NSRect visibleRectInWindow;
+
+ // Core Animation plug-ins need to be updated (with a 0,0,0,0 clipRect) when
+ // moved to a background tab. We don't do this for Core Graphics plug-ins as
+ // older versions of Flash have historical WebKit-specific code that isn't
+ // compatible with this behavior.
+ BOOL shouldClipOutPlugin = _pluginLayer && [self shouldClipOutPlugin];
+ if (!shouldClipOutPlugin)
+ visibleRectInWindow = [self convertRect:[self visibleRect] toView:nil];
+ else
+ visibleRectInWindow = NSZeroRect;
// Flip Y to convert NSWindow coordinates to top-left-based window coordinates.
float borderViewHeight = [[self currentWindow] frame].size.height;
boundsInWindow.origin.y = borderViewHeight - NSMaxY(boundsInWindow);
- visibleRectInWindow.origin.y = borderViewHeight - NSMaxY(visibleRectInWindow);
+
+ if (!shouldClipOutPlugin)
+ visibleRectInWindow.origin.y = borderViewHeight - NSMaxY(visibleRectInWindow);
BOOL sizeChanged = !NSEqualSizes(_previousSize, boundsInWindow.size);
_previousSize = boundsInWindow.size;
diff --git a/WebKit/mac/Plugins/Hosted/WebKitPluginClient.defs b/WebKit/mac/Plugins/Hosted/WebKitPluginClient.defs
index 0cf4005..58a7996 100644
--- a/WebKit/mac/Plugins/Hosted/WebKitPluginClient.defs
+++ b/WebKit/mac/Plugins/Hosted/WebKitPluginClient.defs
@@ -149,18 +149,18 @@ simpleroutine PCGetProperty(clientPort :mach_port_t;
objectID :uint32_t;
propertyNameIdentifier :uint64_t);
-routine PCSetProperty(clientPort :mach_port_t;
+simpleroutine PCSetProperty(clientPort :mach_port_t;
pluginID :uint32_t;
+ requestID :uint32_t;
objectID :uint32_t;
propertyNameIdentifier :uint64_t;
- value :data_t;
- out returnValue :boolean_t);
+ value :data_t);
-routine PCRemoveProperty(clientPort :mach_port_t;
+simpleroutine PCRemoveProperty(clientPort :mach_port_t;
pluginID :uint32_t;
+ requestID :uint32_t;
objectID :uint32_t;
- propertyNameIdentifier :uint64_t;
- out returnValue :boolean_t);
+ propertyNameIdentifier :uint64_t);
simpleroutine PCHasProperty(clientPort :mach_port_t;
pluginID :uint32_t;
@@ -236,3 +236,6 @@ simpleroutine PCRunSyncOpenPanel(clientPort :mach_port_t;
simpleroutine PCSetFullScreenWindowIsShowing(clientPort :mach_port_t;
isShowing :boolean_t);
+
+simpleroutine PCSetException(clientPort :mach_port_t;
+ message :data_t);
diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginView.h b/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
index 246fcf1..029a058 100644
--- a/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
+++ b/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
@@ -119,6 +119,7 @@ class WebHaltablePlugin;
- (void)addWindowObservers;
- (void)removeWindowObservers;
+- (BOOL)shouldClipOutPlugin;
- (BOOL)convertFromX:(double)sourceX andY:(double)sourceY space:(NPCoordinateSpace)sourceSpace
toX:(double *)destX andY:(double *)destY space:(NPCoordinateSpace)destSpace;
diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
index bf8b80b..e93509a 100644
--- a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
@@ -545,6 +545,22 @@ String WebHaltablePlugin::pluginName() const
return _isHalted;
}
+- (BOOL)superviewsHaveSuperviews
+{
+ NSView *contentView = [[self window] contentView];
+ for (NSView *view = self; view; view = [view superview]) {
+ if (view == contentView)
+ return YES;
+ }
+ return NO;
+}
+
+- (BOOL)shouldClipOutPlugin
+{
+ NSWindow *window = [self window];
+ return !window || [window isMiniaturized] || [NSApp isHidden] || ![self superviewsHaveSuperviews] || [self isHiddenOrHasHiddenAncestor];
+}
+
- (BOOL)hasBeenHalted
{
return _hasBeenHalted;
diff --git a/WebKit/mac/Plugins/WebNetscapePluginView.mm b/WebKit/mac/Plugins/WebNetscapePluginView.mm
index 4a4a435..e96abe8 100644
--- a/WebKit/mac/Plugins/WebNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/WebNetscapePluginView.mm
@@ -197,19 +197,6 @@ typedef struct {
#pragma mark EVENTS
-- (BOOL)superviewsHaveSuperviews
-{
- NSView *contentView = [[self window] contentView];
- NSView *view;
- for (view = self; view != nil; view = [view superview]) {
- if (view == contentView) {
- return YES;
- }
- }
- return NO;
-}
-
-
// The WindowRef created by -[NSWindow windowRef] has a QuickDraw GrafPort that covers
// the entire window frame (or structure region to use the Carbon term) rather then just the window content.
// We can remove this when <rdar://problem/4201099> is fixed.
@@ -329,12 +316,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
// 3) the window is miniaturized or the app is hidden
// 4) we're inside of viewWillMoveToWindow: with a nil window. In this case, superviews may already have nil
// superviews and nil windows and results from convertRect:toView: are incorrect.
- NSWindow *realWindow = [self window];
- if (window.width <= 0 || window.height <= 0 || window.x < -100000
- || realWindow == nil || [realWindow isMiniaturized]
- || [NSApp isHidden]
- || ![self superviewsHaveSuperviews]
- || [self isHiddenOrHasHiddenAncestor]) {
+ if (window.width <= 0 || window.height <= 0 || window.x < -100000 || [self shouldClipOutPlugin]) {
// The following code tries to give plug-ins the same size they will eventually have.
// The specifiedWidth and specifiedHeight variables are used to predict the size that
@@ -351,6 +333,13 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
window.clipRect.bottom = window.clipRect.top;
window.clipRect.left = window.clipRect.right;
+
+ // Core Animation plug-ins need to be updated (with a 0,0,0,0 clipRect) when
+ // moved to a background tab. We don't do this for Core Graphics plug-ins as
+ // older versions of Flash have historical WebKit-specific code that isn't
+ // compatible with this behavior.
+ if (drawingModel == NPDrawingModelCoreAnimation)
+ getNPRect(NSZeroRect, window.clipRect);
} else {
getNPRect(visibleRectInWindow, window.clipRect);
}
diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
index 5934d7c..eaec807 100644
--- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
@@ -1484,15 +1484,15 @@ public:
{
}
- virtual void handleEvent(Event*)
+ virtual void handleEvent(Event* event)
{
Frame* frame = Frame::frameForWidget(this);
if (!frame)
return;
- NSEvent* event = frame->eventHandler()->currentNSEvent();
- if ([event type] == NSMouseMoved)
- [(WebBaseNetscapePluginView *)platformWidget() handleMouseMoved:event];
+ NSEvent* currentNSEvent = frame->eventHandler()->currentNSEvent();
+ if (event->type() == eventNames().mousemoveEvent)
+ [(WebBaseNetscapePluginView *)platformWidget() handleMouseMoved:currentNSEvent];
}
};
diff --git a/WebKit/mac/WebView/WebFrameView.mm b/WebKit/mac/WebView/WebFrameView.mm
index 565e64d..b6b1941 100644
--- a/WebKit/mac/WebView/WebFrameView.mm
+++ b/WebKit/mac/WebView/WebFrameView.mm
@@ -201,7 +201,7 @@ enum {
- (float)_verticalPageScrollDistance
{
float height = [[self _contentView] bounds].size.height;
- return max(height * cFractionToStepWhenPaging, 1.f);
+ return max<float>(height * Scrollbar::minFractionToStepWhenPaging(), height - Scrollbar::maxOverlapBetweenPages());
}
static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCClass, NSArray *supportTypes)
@@ -342,7 +342,7 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
[scrollView setHasVerticalScroller:NO];
[scrollView setHasHorizontalScroller:NO];
[scrollView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
- [scrollView setLineScroll:cScrollbarPixelsPerLineStep];
+ [scrollView setLineScroll:Scrollbar::pixelsPerLineStep()];
[self addSubview:scrollView];
// Don't call our overridden version of setNextKeyView here; we need to make the standard NSView
@@ -613,7 +613,7 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
- (float)_horizontalPageScrollDistance
{
float width = [[self _contentView] bounds].size.width;
- return max(width * cFractionToStepWhenPaging, 1.f);
+ return max<float>(width * Scrollbar::minFractionToStepWhenPaging(), width - Scrollbar::maxOverlapBetweenPages());
}
- (BOOL)_pageVertically:(BOOL)up
diff --git a/WebKit/mac/WebView/WebPDFDocumentExtras.h b/WebKit/mac/WebView/WebPDFDocumentExtras.h
index 5a33ccf..0dce43e 100644
--- a/WebKit/mac/WebView/WebPDFDocumentExtras.h
+++ b/WebKit/mac/WebView/WebPDFDocumentExtras.h
@@ -23,10 +23,6 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import <PDFKit/PDFDocument.h>
+@class PDFDocument;
-@interface PDFDocument (WebPDFDocumentExtras)
-- (NSArray *)_web_allScripts;
-@end
-
-void addWebPDFDocumentExtras(Class);
+NSArray *allScriptsInPDFDocument(PDFDocument *);
diff --git a/WebKit/mac/WebView/WebPDFDocumentExtras.mm b/WebKit/mac/WebView/WebPDFDocumentExtras.mm
index ec580ec..b7043df 100644
--- a/WebKit/mac/WebView/WebPDFDocumentExtras.mm
+++ b/WebKit/mac/WebView/WebPDFDocumentExtras.mm
@@ -68,10 +68,10 @@ static void getAllValuesInPDFNameTree(CGPDFDictionaryRef tree, Vector<CGPDFObjec
appendValuesInPDFNameSubtreeToVector(tree, allValues);
}
-static NSArray *web_PDFDocumentAllScripts(id self, SEL _cmd)
+NSArray *allScriptsInPDFDocument(PDFDocument *document)
{
NSMutableArray *scripts = [NSMutableArray array];
- CGPDFDocumentRef pdfDocument = [self documentRef];
+ CGPDFDocumentRef pdfDocument = [document documentRef];
if (!pdfDocument)
return scripts;
@@ -129,13 +129,3 @@ static NSArray *web_PDFDocumentAllScripts(id self, SEL _cmd)
return scripts;
}
-
-void addWebPDFDocumentExtras(Class pdfDocumentClass)
-{
-#ifndef BUILDING_ON_TIGER
- class_addMethod(pdfDocumentClass, @selector(_web_allScripts), (IMP)web_PDFDocumentAllScripts, "@@:");
-#else
- static struct objc_method_list methodList = { 0, 1, { @selector(_web_allScripts), (char*)"@@:", (IMP)web_PDFDocumentAllScripts } };
- class_addMethods(pdfDocumentClass, &methodList);
-#endif
-}
diff --git a/WebKit/mac/WebView/WebPDFRepresentation.mm b/WebKit/mac/WebView/WebPDFRepresentation.mm
index 924bda8..36449f3 100644
--- a/WebKit/mac/WebView/WebPDFRepresentation.mm
+++ b/WebKit/mac/WebView/WebPDFRepresentation.mm
@@ -70,16 +70,6 @@
return PDFDocumentClass;
}
-+ (void)initialize
-{
- if (self != [WebPDFRepresentation class])
- return;
-
- Class pdfDocumentClass = [self PDFDocumentClass];
- if (pdfDocumentClass)
- addWebPDFDocumentExtras(pdfDocumentClass);
-}
-
- (void)setDataSource:(WebDataSource *)dataSource;
{
}
@@ -136,7 +126,7 @@
PDFDocument *doc = [[[[self class] PDFDocumentClass] alloc] initWithData:data];
[view setPDFDocument:doc];
- NSArray *scripts = [doc _web_allScripts];
+ NSArray *scripts = allScriptsInPDFDocument(doc);
[doc release];
doc = nil;
diff --git a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
index 7085cec..b8e912e 100644
--- a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
+++ b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
@@ -90,6 +90,7 @@
#define WebKitWebGLEnabledPreferenceKey @"WebKitWebGLEnabled"
#define WebKitUsesProxiedOpenPanelPreferenceKey @"WebKitUsesProxiedOpenPanel"
#define WebKitPluginAllowedRunTimePreferenceKey @"WebKitPluginAllowedRunTime"
+#define WebKitFrameSetFlatteningEnabledPreferenceKey @"WebKitFrameSetFlatteningEnabled"
// These are private both because callers should be using the cover methods and because the
// cover methods themselves are private.
diff --git a/WebKit/mac/WebView/WebPreferences.mm b/WebKit/mac/WebView/WebPreferences.mm
index d06cc13..a1176a9 100644
--- a/WebKit/mac/WebView/WebPreferences.mm
+++ b/WebKit/mac/WebView/WebPreferences.mm
@@ -356,6 +356,7 @@ static WebCacheModel cacheModelForMainBundle(void)
[NSNumber numberWithBool:NO], WebKitWebGLEnabledPreferenceKey,
[NSNumber numberWithBool:NO], WebKitUsesProxiedOpenPanelPreferenceKey,
[NSNumber numberWithUnsignedInt:4], WebKitPluginAllowedRunTimePreferenceKey,
+ [NSNumber numberWithBool:NO], WebKitFrameSetFlatteningEnabledPreferenceKey,
nil];
// This value shouldn't ever change, which is assumed in the initialization of WebKitPDFDisplayModePreferenceKey above
@@ -1204,6 +1205,16 @@ static NSString *classIBCreatorID = nil;
return [self _setIntegerValue:allowedRunTime forKey:WebKitPluginAllowedRunTimePreferenceKey];
}
+- (BOOL)isFrameSetFlatteningEnabled
+{
+ return [self _boolValueForKey:WebKitFrameSetFlatteningEnabledPreferenceKey];
+}
+
+- (void)setFrameSetFlatteningEnabled:(BOOL)flag
+{
+ [self _setBoolValue:flag forKey:WebKitFrameSetFlatteningEnabledPreferenceKey];
+}
+
- (void)didRemoveFromWebView
{
ASSERT(_private->numWebViews);
diff --git a/WebKit/mac/WebView/WebPreferencesPrivate.h b/WebKit/mac/WebView/WebPreferencesPrivate.h
index 20c98b2..7c84d8d 100644
--- a/WebKit/mac/WebView/WebPreferencesPrivate.h
+++ b/WebKit/mac/WebView/WebPreferencesPrivate.h
@@ -113,6 +113,9 @@ extern NSString *WebPreferencesRemovedNotification;
- (unsigned)pluginAllowedRunTime;
- (void)setPluginAllowedRunTime:(unsigned)allowedRunTime;
+- (BOOL)isFrameSetFlatteningEnabled;
+- (void)setFrameSetFlatteningEnabled:(BOOL)flag;
+
// zero means do AutoScale
- (float)PDFScaleFactor;
- (void)setPDFScaleFactor:(float)scale;
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index e583bb5..4b449de 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -1334,6 +1334,7 @@ static bool fastDocumentTeardownEnabled()
settings->setPluginAllowedRunTime([preferences pluginAllowedRunTime]);
settings->setWebGLEnabled([preferences webGLEnabled]);
settings->setLoadDeferringEnabled(shouldEnableLoadDeferring());
+ settings->setFrameSetFlatteningEnabled([preferences isFrameSetFlatteningEnabled]);
}
static inline IMP getMethod(id o, SEL s)
diff --git a/WebKit/qt/Api/DerivedSources.pro b/WebKit/qt/Api/DerivedSources.pro
new file mode 100644
index 0000000..8702fde
--- /dev/null
+++ b/WebKit/qt/Api/DerivedSources.pro
@@ -0,0 +1,96 @@
+TEMPLATE = lib
+TARGET = dummy
+
+include(headers.pri)
+
+CONFIG -= debug_and_release
+
+DESTDIR = ../../../include/QtWebKit
+
+QUOTE = ""
+DOUBLE_ESCAPED_QUOTE = ""
+ESCAPE = ""
+win32-msvc*|symbian {
+ ESCAPE = "^"
+} else:win32-g++:isEmpty(QMAKE_SH) {
+ # MinGW's make will run makefile commands using sh, even if make
+ # was run from the Windows shell, if it finds sh in the path.
+ ESCAPE = "^"
+} else {
+ QUOTE = "\'"
+ DOUBLE_ESCAPED_QUOTE = "\\\'"
+}
+
+qtheader_module.target = $${DESTDIR}/QtWebKit
+qtheader_module.depends = $${_PRO_FILE_}
+qtheader_module.commands = echo $${QUOTE}$${LITERAL_HASH}ifndef QT_QTWEBKIT_MODULE_H$${QUOTE} > $${qtheader_module.target} &&
+qtheader_module.commands += echo $${QUOTE}$${LITERAL_HASH}define QT_QTWEBKIT_MODULE_H$${QUOTE} >> $${qtheader_module.target} &&
+qtheader_module.commands += echo $${QUOTE}$${LITERAL_HASH}include $${ESCAPE}<QtNetwork/QtNetwork$${ESCAPE}>$${QUOTE} >> $${qtheader_module.target} &&
+WEBKIT_CLASS_HEADERS = $${LITERAL_DOLLAR}$${LITERAL_DOLLAR}$${LITERAL_DOLLAR}$${LITERAL_DOLLAR}PWD/QtWebKit
+
+regex = ".*\sclass\sQWEBKIT_EXPORT\s(\w+)\s(.*)"
+
+for(HEADER, WEBKIT_API_HEADERS) {
+ qtheader_module.depends += $$HEADER
+ # Quotes need to be escaped once more when placed in eval()
+ eval(qtheader_module.commands += echo $${DOUBLE_ESCAPED_QUOTE}\$${LITERAL_HASH}include \\\"$$basename(HEADER)\\\"$${DOUBLE_ESCAPED_QUOTE} >> $${qtheader_module.target} &&)
+
+ HEADER_NAME = $$basename(HEADER)
+ HEADER_TARGET = $$replace(HEADER_NAME, [^a-zA-Z0-9_], -)
+ HEADER_TARGET = "qtheader-$${HEADER_TARGET}"
+
+ eval($${HEADER_TARGET}.target = $${DESTDIR}/$${HEADER_NAME})
+ eval($${HEADER_TARGET}.depends = $$HEADER)
+ eval($${HEADER_TARGET}.commands = echo $${DOUBLE_ESCAPED_QUOTE}\$${LITERAL_HASH}include \\\"$$HEADER\\\"$${DOUBLE_ESCAPED_QUOTE} > $$eval($${HEADER_TARGET}.target))
+
+ QMAKE_EXTRA_TARGETS += $$HEADER_TARGET
+
+ src_words = $$cat($$HEADER)
+ # Really make sure we're dealing with words
+ src_words = $$split(src_words, " ")
+
+ src = $$join(src_words, $${LITERAL_WHITESPACE})
+ for(ever) {
+ # Looking up by line is faster, so we try that first
+ res = $$find(src_words, "QWEBKIT_EXPORT")
+ isEmpty(res):break()
+
+ # Then do a slow lookup to ensure we're dealing with an exported class
+ res = $$find(src, $$regex)
+ isEmpty(res):break()
+
+ exp = $$replace(src, $$regex, "EXPORTED_CLASS = \1")
+ eval($$exp)
+
+ CLASS_TARGET = "qtheader_$${EXPORTED_CLASS}"
+
+ eval($${CLASS_TARGET}.target = $${DESTDIR}/$${EXPORTED_CLASS})
+ eval($${CLASS_TARGET}.depends = $$eval($${HEADER_TARGET}.target))
+ eval($${CLASS_TARGET}.commands = echo $${DOUBLE_ESCAPED_QUOTE}\$${LITERAL_HASH}include \\\"$$basename(HEADER)\\\"$${DOUBLE_ESCAPED_QUOTE} > $$eval($${CLASS_TARGET}.target))
+
+ QMAKE_EXTRA_TARGETS += $$CLASS_TARGET
+ WEBKIT_CLASS_HEADERS += $${LITERAL_DOLLAR}$${LITERAL_DOLLAR}$${LITERAL_DOLLAR}$${LITERAL_DOLLAR}PWD/$${EXPORTED_CLASS}
+
+ generated_files.depends += $$eval($${CLASS_TARGET}.target)
+ qtheader_pri.depends += $$eval($${CLASS_TARGET}.target)
+
+ # Qt's QRegExp does not support inline non-greedy matching,
+ # so we'll have to work around it by updating the haystack
+ src = $$replace(src, $$regex, "\2")
+ src_words = $$join(src, $${LITERAL_WHITESPACE})
+ }
+}
+
+qtheader_module.commands += echo $${QUOTE}$${LITERAL_HASH}endif // QT_QTWEBKIT_MODULE_H$${QUOTE} >> $${qtheader_module.target}
+QMAKE_EXTRA_TARGETS += qtheader_module
+
+qtheader_pri.target = $${DESTDIR}/classheaders.pri
+qtheader_pri.depends = $${WEBKIT_API_HEADERS} $${_PRO_FILE_}
+qtheader_pri.commands = echo $${QUOTE}WEBKIT_CLASS_HEADERS = $${WEBKIT_CLASS_HEADERS}$${QUOTE} > $${qtheader_pri.target}
+QMAKE_EXTRA_TARGETS += qtheader_pri
+
+generated_files.depends += $${qtheader_module.target} $${qtheader_pri.target}
+QMAKE_EXTRA_TARGETS += generated_files
+
+
+
diff --git a/WebKit/qt/Api/qgraphicswebview.cpp b/WebKit/qt/Api/qgraphicswebview.cpp
index 8d4f3ba..b323598 100644
--- a/WebKit/qt/Api/qgraphicswebview.cpp
+++ b/WebKit/qt/Api/qgraphicswebview.cpp
@@ -27,6 +27,7 @@
#include "qwebpage_p.h"
#include "QWebPageClient.h"
#include <FrameView.h>
+#include <QtCore/qmetaobject.h>
#include <QtCore/qsharedpointer.h>
#include <QtCore/qtimer.h>
#include <QtGui/qapplication.h>
@@ -78,13 +79,14 @@ public:
, page(0)
#if USE(ACCELERATED_COMPOSITING)
, rootGraphicsLayer(0)
- , shouldSync(true)
+ , shouldSync(false)
#endif
{
#if USE(ACCELERATED_COMPOSITING)
// the overlay and stays alive for the lifetime of
// this QGraphicsWebView as the scrollbars are needed when there's no compositing
q->setFlag(QGraphicsItem::ItemUsesExtendedStyleOption);
+ syncMetaMethod = q->metaObject()->method(q->metaObject()->indexOfMethod("syncLayers()"));
#endif
}
@@ -131,6 +133,9 @@ public:
// compositor telling us to do so. We'll get that call from ChromeClientQt
bool shouldSync;
+ // we have to flush quite often, so we use a meta-method instead of QTimer::singleShot for putting the event in the queue
+ QMetaMethod syncMetaMethod;
+
// we need to put the root graphics layer behind the overlay (which contains the scrollbar)
enum { RootGraphicsLayerZValue, OverlayZValue };
#endif
@@ -178,7 +183,7 @@ void QGraphicsWebViewPrivate::markForSync(bool scheduleSync)
{
shouldSync = true;
if (scheduleSync)
- QTimer::singleShot(0, q, SLOT(syncLayers()));
+ syncMetaMethod.invoke(q, Qt::QueuedConnection);
}
void QGraphicsWebViewPrivate::updateCompositingScrollPosition()
@@ -224,6 +229,7 @@ void QGraphicsWebViewPrivate::update(const QRect & dirtyRect)
#if USE(ACCELERATED_COMPOSITING)
if (overlay)
overlay->update(QRectF(dirtyRect));
+ syncLayers();
#endif
}
@@ -442,7 +448,6 @@ void QGraphicsWebView::paint(QPainter* painter, const QStyleOptionGraphicsItem*
{
#if USE(ACCELERATED_COMPOSITING)
page()->mainFrame()->render(painter, d->overlay ? QWebFrame::ContentsLayer : QWebFrame::AllLayers, option->exposedRect.toAlignedRect());
- d->syncLayers();
#else
page()->mainFrame()->render(painter, QWebFrame::AllLayers, option->exposedRect.toRect());
#endif
diff --git a/WebKit/qt/Api/qwebelement.cpp b/WebKit/qt/Api/qwebelement.cpp
index 441bec7..9d4d0d0 100644
--- a/WebKit/qt/Api/qwebelement.cpp
+++ b/WebKit/qt/Api/qwebelement.cpp
@@ -38,7 +38,6 @@
#include "NodeList.h"
#include "PropertyNameArray.h"
#include "RenderImage.h"
-#include "ScriptFunctionCall.h"
#include "StaticNodeList.h"
#include "qt_runtime.h"
#include "qwebframe.h"
diff --git a/WebKit/qt/Api/qwebframe.cpp b/WebKit/qt/Api/qwebframe.cpp
index aeb7a22..4c1f318 100644
--- a/WebKit/qt/Api/qwebframe.cpp
+++ b/WebKit/qt/Api/qwebframe.cpp
@@ -220,6 +220,19 @@ QString QWEBKIT_EXPORT qt_drt_counterValueForElementById(QWebFrame* qFrame, cons
return QString();
}
+int QWEBKIT_EXPORT qt_drt_pageNumberForElementById(QWebFrame* qFrame, const QString& id, float width, float height)
+{
+ Frame* frame = QWebFramePrivate::core(qFrame);
+ if (!frame)
+ return -1;
+
+ Element* element = frame->document()->getElementById(AtomicString(id));
+ if (!element)
+ return -1;
+
+ return PrintContext::pageNumberForElement(element, FloatSize(width, height));
+}
+
// Suspend active DOM objects in this frame.
void QWEBKIT_EXPORT qt_suspendActiveDOMObjects(QWebFrame* qFrame)
{
diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp
index ea2401b..f661918 100644
--- a/WebKit/qt/Api/qwebpage.cpp
+++ b/WebKit/qt/Api/qwebpage.cpp
@@ -146,6 +146,11 @@ void QWEBKIT_EXPORT qt_drt_run(bool b)
QWebPagePrivate::drtRun = b;
}
+void QWEBKIT_EXPORT qt_drt_setFrameSetFlatteningEnabled(QWebPage* page, bool enabled)
+{
+ QWebPagePrivate::core(page)->settings()->setFrameSetFlatteningEnabled(enabled);
+}
+
void QWEBKIT_EXPORT qt_webpage_setGroupName(QWebPage* page, const QString& groupName)
{
page->handle()->page->setGroupName(groupName);
@@ -444,6 +449,11 @@ QWebPagePrivate::~QWebPagePrivate()
delete page;
}
+WebCore::Page* QWebPagePrivate::core(QWebPage* page)
+{
+ return page->d->page;
+}
+
bool QWebPagePrivate::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type)
{
if (insideOpenCall
@@ -1945,6 +1955,8 @@ bool QWebPage::shouldInterruptJavaScript()
If the view associated with the web page is a QWebView object, then the default implementation forwards
the request to QWebView's createWindow() function; otherwise it returns a null pointer.
+ If \a type is WebModalDialog, the application must call setWindowModality(Qt::ApplicationModal) on the new window.
+
\sa acceptNavigationRequest()
*/
QWebPage *QWebPage::createWindow(WebWindowType type)
diff --git a/WebKit/qt/Api/qwebpage_p.h b/WebKit/qt/Api/qwebpage_p.h
index dbc981e..15ddfb2 100644
--- a/WebKit/qt/Api/qwebpage_p.h
+++ b/WebKit/qt/Api/qwebpage_p.h
@@ -62,6 +62,9 @@ class QWebPagePrivate {
public:
QWebPagePrivate(QWebPage*);
~QWebPagePrivate();
+
+ static WebCore::Page* core(QWebPage*);
+
void createMainFrame();
#ifndef QT_NO_CONTEXTMENU
QMenu* createContextMenu(const WebCore::ContextMenu* webcoreMenu, const QList<WebCore::ContextMenuItem>* items, QBitArray* visitedWebActions);
diff --git a/WebKit/qt/Api/qwebview.cpp b/WebKit/qt/Api/qwebview.cpp
index b5a5a90..79c16c7 100644
--- a/WebKit/qt/Api/qwebview.cpp
+++ b/WebKit/qt/Api/qwebview.cpp
@@ -60,96 +60,141 @@ void QWebViewPrivate::_q_pageDestroyed()
#ifdef Q_WS_MAEMO_5
#include "qabstractkineticscroller.h"
+#include "qapplication.h"
-class QWebViewKineticScroller : public QAbstractKineticScroller {
+// QCoreApplication::sendSpontaneousEvent() is private, hence this friend wrapper
+bool qt_sendSpontaneousEvent(QObject* receiver, QEvent* ev)
+{
+ return QCoreApplication::sendSpontaneousEvent(receiver, ev);
+}
+
+class QWebViewKineticScroller : public QObject, public QAbstractKineticScroller {
public:
- QWebViewKineticScroller() : QAbstractKineticScroller() {}
- // remember the frame where the button was pressed
+ QWebViewKineticScroller()
+ : QObject()
+ , QAbstractKineticScroller()
+ , m_view(0)
+ , m_ignoreEvents(false)
+ {
+ }
+
+ void setWidget(QWebView* widget)
+ {
+ if (m_view) {
+ m_view->removeEventFilter(this);
+ QWebFrame* frame = m_view->page()->mainFrame();
+ frame->setScrollBarPolicy(Qt::Vertical, m_oldVerticalScrollBarPolicy);
+ frame->setScrollBarPolicy(Qt::Horizontal, m_oldHorizontalScrollBarPolicy);
+ }
+
+ m_view = widget;
+ setParent(m_view);
+ if (m_view) {
+ QWebFrame* frame = m_view->page()->mainFrame();
+ m_oldHorizontalScrollBarPolicy = frame->scrollBarPolicy(Qt::Horizontal);
+ m_oldVerticalScrollBarPolicy = frame->scrollBarPolicy(Qt::Vertical);
+ frame->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
+ frame->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
+ m_view->installEventFilter(this);
+ }
+ }
+
+protected:
bool eventFilter(QObject* o, QEvent* ev)
{
+ if (!o || m_view != o || m_ignoreEvents || !m_view->isEnabled())
+ return QObject::eventFilter(o, ev);
+
+ bool res = false;
+
switch (ev->type()) {
case QEvent::MouseButtonPress: {
+ // remember the frame where the button was pressed
QWebFrame* hitFrame = scrollingFrameAt(static_cast<QMouseEvent*>(ev)->pos());
if (hitFrame)
m_frame = hitFrame;
- break;
+ // fall through
}
+ case QEvent::MouseMove:
+ case QEvent::MouseButtonRelease:
+ case QEvent::MouseButtonDblClick:
+ res = handleMouseEvent(static_cast<QMouseEvent*>(ev));
+ break;
default:
break;
}
- return QAbstractKineticScroller::eventFilter(o, ev);
+ return res ? true : QObject::eventFilter(o, ev);
}
-protected:
- QWebFrame* currentFrame() const
+ void cancelLeftMouseButtonPress(const QPoint& /* globalPressPos */)
{
- if (!m_frame.isNull())
- return m_frame.data();
-
- QWebView* view = static_cast<QWebView*>(widget());
- QWebFrame* frame = view->page()->mainFrame();
- return frame;
+ QMouseEvent cmem(QEvent::MouseMove, QPoint(-INT_MAX, -INT_MAX), Qt::LeftButton, QApplication::mouseButtons() | Qt::LeftButton, QApplication::keyboardModifiers());
+ sendEvent(m_view, &cmem);
+ QMouseEvent cmer(QEvent::MouseButtonRelease, QPoint(-INT_MAX, -INT_MAX), Qt::LeftButton, QApplication::mouseButtons() & ~Qt::LeftButton, QApplication::keyboardModifiers());
+ sendEvent(m_view, &cmer);
}
- // Returns the innermost frame at the given position that can scroll.
- QWebFrame* scrollingFrameAt(const QPoint& pos) const
+ QWebFrame* currentFrame() const
{
- QWebView* view = static_cast<QWebView*>(widget());
- QWebFrame* mainFrame = view->page()->mainFrame();
- QWebFrame* hitFrame = mainFrame->hitTestContent(pos).frame();
- QSize range = hitFrame->contentsSize() - hitFrame->geometry().size();
+ if (m_frame)
+ return m_frame;
- while (hitFrame && range.width() <= 1 && range.height() <= 1)
- hitFrame = hitFrame->parentFrame();
+ if (m_view)
+ return m_view->page()->mainFrame();
- return hitFrame;
+ return 0;
}
- void attachToWidget()
+ // Returns the innermost frame at the given position that can scroll.
+ QWebFrame* scrollingFrameAt(const QPoint& pos) const
{
- QWebView* view = static_cast<QWebView*>(widget());
- QWebFrame* mainFrame = view->page()->mainFrame();
- m_oldHorizontalScrollBarPolicy = mainFrame->scrollBarPolicy(Qt::Horizontal);
- m_oldVerticalScrollBarPolicy = mainFrame->scrollBarPolicy(Qt::Vertical);
- mainFrame->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
- mainFrame->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
- view->installEventFilter(this);
- }
+ QWebFrame* hitFrame = 0;
+ if (m_view) {
+ QWebFrame* frame = m_view->page()->mainFrame();
+ hitFrame = frame->hitTestContent(pos).frame();
+ QSize range = hitFrame->contentsSize() - hitFrame->geometry().size();
- void removeFromWidget()
- {
- QWebView* view = static_cast<QWebView*>(widget());
- view->removeEventFilter(this);
- QWebFrame* mainFrame = view->page()->mainFrame();
- mainFrame->setScrollBarPolicy(Qt::Vertical, m_oldVerticalScrollBarPolicy);
- mainFrame->setScrollBarPolicy(Qt::Horizontal, m_oldHorizontalScrollBarPolicy);
+ while (hitFrame && range.width() <= 1 && range.height() <= 1)
+ hitFrame = hitFrame->parentFrame();
+
+ return hitFrame;
+ }
}
- QRect positionRange() const
+ QPoint maximumScrollPosition() const
{
- QRect r;
QWebFrame* frame = currentFrame();
- r.setSize(frame->contentsSize() - frame->geometry().size());
- return r;
+ QSize s = frame ? frame->contentsSize() - frame->geometry().size() : QSize(0, 0);
+ return QPoint(qMax(0, s.width()), qMax(0, s.height()));
}
- QPoint position() const
+ QPoint scrollPosition() const
{
QWebFrame* frame = currentFrame();
- return frame->scrollPosition();
+ return frame ? frame->scrollPosition() : QPoint();
}
QSize viewportSize() const
{
- return static_cast<QWebView*>(widget())->page()->viewportSize();
+ return m_view ? m_view->page()->viewportSize() : QSize();
}
- void setPosition(const QPoint& point, const QPoint& /* overShootDelta */)
+ void setScrollPosition(const QPoint& point, const QPoint& /* overShootDelta */)
{
QWebFrame* frame = currentFrame();
- frame->setScrollPosition(point);
+ if (frame)
+ frame->setScrollPosition(point);
+ }
+
+ void sendEvent(QWidget* w, QEvent* ev)
+ {
+ m_ignoreEvents = true;
+ qt_sendSpontaneousEvent(w, ev);
+ m_ignoreEvents = false;
}
+ QWebView* m_view;
+ bool m_ignoreEvents;
QPointer<QWebFrame> m_frame;
Qt::ScrollBarPolicy m_oldVerticalScrollBarPolicy;
Qt::ScrollBarPolicy m_oldHorizontalScrollBarPolicy;
@@ -259,7 +304,7 @@ QWebView::QWebView(QWidget *parent)
#endif
#if defined(Q_WS_MAEMO_5)
QAbstractKineticScroller* scroller = new QWebViewKineticScroller();
- scroller->setWidget(this);
+ static_cast<QWebViewKineticScroller*>(scroller)->setWidget(this);
setProperty("kineticScroller", QVariant::fromValue(scroller));
#endif
setAcceptDrops(true);
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index e63ee86..e0d1b28 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,222 @@
+2010-02-12 Diego Gonzalez <diego.gonzalez@openbossa.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Qt DRT now dump the frame loader callbacks when LayoutTestController()
+ method is called.
+
+ LayoutTests:
+ http/tests/security/mixedContent/data-url-script-in-iframe.html
+ http/tests/security/mixedContent/empty-url-plugin-in-frame.html
+ http/tests/security/mixedContent/insecure-css-in-iframe.html
+ http/tests/security/mixedContent/insecure-iframe-in-iframe.html
+ http/tests/security/mixedContent/insecure-image-in-iframe.html
+ http/tests/security/mixedContent/insecure-plugin-in-iframe.html
+ http/tests/security/mixedContent/insecure-script-in-iframe.html
+ http/tests/security/mixedContent/redirect-http-to-https-script-in-iframe.html
+ http/tests/security/mixedContent/redirect-https-to-http-script-in-iframe.html
+
+ [Qt] Make possible Qt DRT dump frame load callbacks
+ https://bugs.webkit.org/show_bug.cgi?id=34702
+
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::didDisplayInsecureContent):
+ (WebCore::FrameLoaderClientQt::didRunInsecureContent):
+
+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.
+
+ * tests/tests.pri:
+
+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
+
+ * Api/DerivedSources.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
+
+ * Api/DerivedSources.pro:
+
+2010-02-09 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by nobody, build fix.
+
+ [Qt] Fix standalone build with MinGW.
+
+ * tests/qwebelement/tst_qwebelement.cpp:
+ * tests/tests.pri:
+
+2010-02-10 Diego Gonzalez <diego.gonzalez@openbossa.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Implement pageNumberForElementById() method in Qt DRT LayoutTestController,
+ to make Qt DRT able to get page number.
+
+ LayoutTests:
+ printing/page-break-always.html
+ printing/pageNumerForElementById.html
+ printing/css2.1/page-break-before-000.html
+ printing/css2.1/page-break-after-000.html
+ printing/css2.1/page-break-after-004.html
+ printing/css2.1/page-break-before-001.html
+ printing/css2.1/page-break-after-001.html
+ printing/css2.1/page-break-after-002.html
+ printing/css2.1/page-break-before-002.html
+ printing/css2.1/page-break-inside-000.html
+
+ [Qt] Make possible Qt DRT get a page number for element by ID
+ https://bugs.webkit.org/show_bug.cgi?id=34777
+
+ * Api/qwebframe.cpp:
+ (qt_drt_pageNumberForElementById):
+
+2010-02-09 Yael Aharon <yael.aharon@nokia.com>
+
+ Reviewed by Adam Barth.
+
+ [Qt] Unit test for window.runModalDialog
+ https://bugs.webkit.org/show_bug.cgi?id=34755
+
+ * tests/qwebpage/tst_qwebpage.cpp:
+ (TestModalPage::TestModalPage):
+ (TestModalPage::createWindow):
+ (tst_QWebPage::showModalDialog):
+
+2010-02-09 Andreas Kling <andreas.kling@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Sync with API changes in Maemo 5 kinetic scrolling
+
+ https://bugs.webkit.org/show_bug.cgi?id=34747
+
+ This is a forward-port of http://qt.gitorious.org/+qt-developers/qt/x11-maemo/commit/08497561
+
+ * Api/qwebview.cpp:
+ (qt_sendSpontaneousEvent):
+ (QWebViewKineticScroller::QWebViewKineticScroller):
+ (QWebViewKineticScroller::setWidget):
+ (QWebViewKineticScroller::eventFilter):
+ (QWebViewKineticScroller::cancelLeftMouseButtonPress):
+ (QWebViewKineticScroller::currentFrame):
+ (QWebViewKineticScroller::scrollingFrameAt):
+ (QWebViewKineticScroller::maximumScrollPosition):
+ (QWebViewKineticScroller::scrollPosition):
+ (QWebViewKineticScroller::viewportSize):
+ (QWebViewKineticScroller::setScrollPosition):
+ (QWebViewKineticScroller::sendEvent):
+ (QWebView::QWebView):
+
+2010-02-09 Yael Aharon <yael.aharon@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Webkit in Qt does not have window.showModalDialog
+ https://bugs.webkit.org/show_bug.cgi?id=25585
+
+ Create a new eventloop when runModal() is called.
+ Added comemnt in QWebPage::createWindow that the application is responsible
+ for setting the modality of the appropriate window.
+
+ * Api/qwebpage.cpp:
+ * WebCoreSupport/ChromeClientQt.cpp:
+ (WebCore::ChromeClientQt::ChromeClientQt):
+ (WebCore::ChromeClientQt::~ChromeClientQt):
+ (WebCore::ChromeClientQt::canRunModal):
+ (WebCore::ChromeClientQt::runModal):
+ * WebCoreSupport/ChromeClientQt.h:
+
+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
+
+ Privately export the setFrameSetFlatteningEnabled setting for
+ use with the Qt DRT.
+
+ * Api/qwebpage.cpp:
+ (qt_drt_setFrameSetFlatteningEnabled):
+ (QWebPagePrivate::core):
+ * Api/qwebpage_p.h:
+
+2010-02-05 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ [Qt] Fix build on Windows
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ DerivedSources for our API headers failed on Windows,
+ due to Windows not accepting ; as a command separator,
+ not needing quotes for echo, and needing < and > escaped.
+
+ We now detect Windows and set these quote markers and
+ escape markers accordingly, as well as use && for separating
+ individual commands.
+
+ * Api/DerivedSources.pro:
+
+2010-02-05 Yury Semikhatsky <yurys@chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ Remove unused inmport of ScriptFunctionCall.h
+
+ https://bugs.webkit.org/show_bug.cgi?id=33592
+
+ * Api/qwebelement.cpp:
+
+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.
+
+ * Api/DerivedSources.pro: Added. List of headers + pro file magic
+ * Api/headers.pri: Removed, list of headers is now in the above file
+
+2010-02-04 No'am Rosenthal <noam.rosenthal@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ [Qt] Tuning and optimizations to GraphicsLayerQt. Mainly reduced usage
+ of QTimer::singleShot, and moved syncLayers() from paint() to update()
+ https://bugs.webkit.org/show_bug.cgi?id=34062
+
+ * Api/qgraphicswebview.cpp:
+ (QGraphicsWebViewPrivate::update): Moved the sync operation to update
+ (QGraphicsWebView::paint): Moved the sync operation to update
+
2010-02-03 Andras Becsi <abecsi@webkit.org>
Unreviewed build fix.
diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
index f1e6a86..893a1b7 100644
--- a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
@@ -44,6 +44,7 @@
#include "SecurityOrigin.h"
#include <qdebug.h>
+#include <qeventloop.h>
#include <qtextdocument.h>
#include <qtooltip.h>
@@ -62,13 +63,15 @@ namespace WebCore {
ChromeClientQt::ChromeClientQt(QWebPage* webPage)
: m_webPage(webPage)
+ , m_eventLoop(0)
{
toolBarsVisible = statusBarVisible = menuBarVisible = true;
}
ChromeClientQt::~ChromeClientQt()
{
-
+ if (m_eventLoop)
+ m_eventLoop->exit();
}
void ChromeClientQt::setWindowRect(const FloatRect& rect)
@@ -173,14 +176,16 @@ void ChromeClientQt::show()
bool ChromeClientQt::canRunModal()
{
- notImplemented();
- return false;
+ return true;
}
void ChromeClientQt::runModal()
{
- notImplemented();
+ m_eventLoop = new QEventLoop();
+ QEventLoop* eventLoop = m_eventLoop;
+ m_eventLoop->exec();
+ delete eventLoop;
}
diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.h b/WebKit/qt/WebCoreSupport/ChromeClientQt.h
index 7699349..6b3017d 100644
--- a/WebKit/qt/WebCoreSupport/ChromeClientQt.h
+++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.h
@@ -34,6 +34,7 @@
#include "KURL.h"
#include "PlatformString.h"
+class QEventLoop;
class QWebPage;
namespace WebCore {
@@ -158,6 +159,7 @@ namespace WebCore {
bool toolBarsVisible;
bool statusBarVisible;
bool menuBarVisible;
+ QEventLoop* m_eventLoop;
};
}
diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
index 760e37e..16a6faa 100644
--- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
@@ -672,11 +672,17 @@ void FrameLoaderClientQt::dispatchDidChangeBackForwardIndex() const
void FrameLoaderClientQt::didDisplayInsecureContent()
{
+ if (dumpFrameLoaderCallbacks)
+ printf("didDisplayInsecureContent\n");
+
notImplemented();
}
void FrameLoaderClientQt::didRunInsecureContent(WebCore::SecurityOrigin*)
{
+ if (dumpFrameLoaderCallbacks)
+ printf("didRunInsecureContent\n");
+
notImplemented();
}
diff --git a/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp b/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp
index dde65cf..8db0ec3 100644
--- a/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp
+++ b/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp
@@ -18,13 +18,13 @@
*/
-#include <../util.h>
#include <QtTest/QtTest>
#include <qwebpage.h>
#include <qwidget.h>
#include <qwebview.h>
#include <qwebframe.h>
#include <qwebelement.h>
+#include <util.h>
//TESTED_CLASS=
//TESTED_FILES=
diff --git a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
index f48fb73..ba7a87e 100644
--- a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
+++ b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
@@ -110,6 +110,7 @@ private slots:
void originatingObjectInNetworkRequests();
void testJSPrompt();
+ void showModalDialog();
private:
QWebView* m_view;
@@ -1828,5 +1829,26 @@ void tst_QWebPage::testJSPrompt()
QVERIFY(res);
}
+class TestModalPage : public QWebPage
+{
+ Q_OBJECT
+public:
+ TestModalPage(QObject* parent = 0) : QWebPage(parent) {
+ }
+ virtual QWebPage* createWindow(WebWindowType) {
+ QWebPage* page = new TestModalPage();
+ connect(page, SIGNAL(windowCloseRequested()), page, SLOT(deleteLater()));
+ return page;
+ }
+};
+
+void tst_QWebPage::showModalDialog()
+{
+ TestModalPage page;
+ page.mainFrame()->setHtml(QString("<html></html>"));
+ QString res = page.mainFrame()->evaluateJavaScript("window.showModalDialog('javascript:window.returnValue=dialogArguments; window.close();', 'This is a test');").toString();
+ QCOMPARE(res, QString("This is a test"));
+}
+
QTEST_MAIN(tst_QWebPage)
#include "tst_qwebpage.moc"
diff --git a/WebKit/qt/tests/tests.pri b/WebKit/qt/tests/tests.pri
index c3d7755..187950a 100644
--- a/WebKit/qt/tests/tests.pri
+++ b/WebKit/qt/tests/tests.pri
@@ -3,6 +3,9 @@ CONFIG -= app_bundle
TARGET = tst_$$TARGET
SOURCES += $$_PRO_FILE_PWD_/$${TARGET}.cpp
+INCLUDEPATH += \
+ $$PWD \
+ $$PWD/../Api
exists($$_PRO_FILE_PWD_/$${TARGET}.qrc):RESOURCES += $$_PRO_FILE_PWD_/$${TARGET}.qrc
diff --git a/WebKit/win/AccessibleBase.cpp b/WebKit/win/AccessibleBase.cpp
index 0704771..3e8306f 100644
--- a/WebKit/win/AccessibleBase.cpp
+++ b/WebKit/win/AccessibleBase.cpp
@@ -382,10 +382,10 @@ HRESULT STDMETHODCALLTYPE AccessibleBase::get_accKeyboardShortcut(VARIANT vChild
HRESULT STDMETHODCALLTYPE AccessibleBase::accSelect(long selectionFlags, VARIANT vChild)
{
// According to MSDN, these combinations are invalid.
- if (((selectionFlags & (SELFLAG_ADDSELECTION | SELFLAG_REMOVESELECTION)) == (SELFLAG_ADDSELECTION | SELFLAG_REMOVESELECTION)) ||
- ((selectionFlags & (SELFLAG_ADDSELECTION | SELFLAG_TAKESELECTION)) == (SELFLAG_ADDSELECTION | SELFLAG_TAKESELECTION)) ||
- ((selectionFlags & (SELFLAG_REMOVESELECTION | SELFLAG_TAKESELECTION)) == (SELFLAG_REMOVESELECTION | SELFLAG_TAKESELECTION)) ||
- ((selectionFlags & (SELFLAG_EXTENDSELECTION | SELFLAG_TAKESELECTION)) == (SELFLAG_REMOVESELECTION | SELFLAG_TAKESELECTION)))
+ if (((selectionFlags & (SELFLAG_ADDSELECTION | SELFLAG_REMOVESELECTION)) == (SELFLAG_ADDSELECTION | SELFLAG_REMOVESELECTION))
+ || ((selectionFlags & (SELFLAG_ADDSELECTION | SELFLAG_TAKESELECTION)) == (SELFLAG_ADDSELECTION | SELFLAG_TAKESELECTION))
+ || ((selectionFlags & (SELFLAG_REMOVESELECTION | SELFLAG_TAKESELECTION)) == (SELFLAG_REMOVESELECTION | SELFLAG_TAKESELECTION))
+ || ((selectionFlags & (SELFLAG_EXTENDSELECTION | SELFLAG_TAKESELECTION)) == (SELFLAG_EXTENDSELECTION | SELFLAG_TAKESELECTION)))
return E_INVALIDARG;
AccessibilityObject* childObject;
@@ -406,15 +406,19 @@ HRESULT STDMETHODCALLTYPE AccessibleBase::accSelect(long selectionFlags, VARIANT
Vector<RefPtr<AccessibilityObject> > selectedChildren(1);
selectedChildren[0] = childObject;
static_cast<AccessibilityListBox*>(parentObject)->setSelectedChildren(selectedChildren);
- } else if (parentObject->isMenuListPopup())
+ } else { // any element may be selectable by virtue of it having the aria-selected property
+ ASSERT(!parentObject->isMultiSelectable());
childObject->setSelected(true);
- else
- return E_INVALIDARG;
+ }
}
- // MSDN says that ADD, REMOVE, and EXTENDSELECTION are invalid for
+ // MSDN says that ADD, REMOVE, and EXTENDSELECTION with no other flags are invalid for
// single-select.
- if (!parentObject->isMultiSelectable())
+ const long allSELFLAGs = SELFLAG_TAKEFOCUS | SELFLAG_TAKESELECTION | SELFLAG_EXTENDSELECTION | SELFLAG_ADDSELECTION | SELFLAG_REMOVESELECTION;
+ if (!parentObject->isMultiSelectable()
+ && (((selectionFlags & allSELFLAGs) == SELFLAG_ADDSELECTION)
+ || ((selectionFlags & allSELFLAGs) == SELFLAG_REMOVESELECTION)
+ || ((selectionFlags & allSELFLAGs) == SELFLAG_EXTENDSELECTION)))
return E_INVALIDARG;
if (selectionFlags & SELFLAG_ADDSELECTION)
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index 36d3144..feb22a1 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,113 @@
+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 Windows port.
+
+ * Interfaces/IWebPreferencesPrivate.idl:
+ * WebPreferenceKeysPrivate.h:
+ * WebPreferences.cpp:
+ (WebPreferences::initializeDefaultSettings):
+ (WebPreferences::isFrameSetFlatteningEnabled):
+ (WebPreferences::setFrameSetFlatteningEnabled):
+ * WebPreferences.h:
+ * WebView.cpp:
+ (WebView::notifyPreferencesChanged):
+
+2010-02-10 Adam Roben <aroben@apple.com>
+
+ Remove unnecessary #include of shfolder.h
+
+ shfolder.h has been deprecated in newer versions of the Windows SDK.
+
+ Fixes <http://webkit.org/b/34803> WebPreferences.cpp fails to compile
+ under VS2010 RC due to #include of shfolder.h.
+
+ Reviewed by Darin Adler.
+
+ * WebPreferences.cpp: Removed #include.
+
+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.
+
+ * WebView.cpp:
+ (WebView::shouldClose):
+
+2010-02-08 Brent Fulgham <bfulgham@webkit.org>
+
+ Reviewed by Adam Roben.
+
+ Include header position in World Transform used for plugin positioning.
+ https://bugs.webkit.org/show_bug.cgi?id=34709
+
+ * WebFrame.cpp:
+ (WebFrame::spoolPage): Correct WinCairo plugin print positioning to
+ account for header size. Existing code ignored this, causing
+ plugins to overlay other elements.
+
+2010-02-04 Alice Liu <alice.liu@apple.com>
+
+ Reviewed by Jon Honeycutt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34612 " MSAA: accSelect returns error
+ codes for most elements that arent listbox or menupopup related"
+ <rdar://problem/7436861>
+
+ * AccessibleBase.cpp:
+ (AccessibleBase::accSelect):
+ - Stop sending E_INVALIDARG for elements that request TAKE_SELECTION that
+ aren't beneath listboxes or menupopups. This was too restrictive since
+ any element can be selectable.
+ - Correct the misinterpretation of MSDN's stipulation of situations involving
+ adding, removing, and extending selection on single-select elements
+
+2010-02-04 Brent Fulgham <bfulgham@webkit.org>
+
+ Reviewed by Adam Roben.
+
+ Properly handle margin settings when printing Plugins in WinCairo.
+ https://bugs.webkit.org/show_bug.cgi?id=34613
+
+ * WebFrame.cpp:
+ (WebFrame::spoolPage): Adjust the GraphicsContext passed to the
+ paintContents method so that the World Transform is properly
+ positioned to account for margin settings at the time that
+ PluginViewWin.cpp processes the drawing operations.
+
+2010-02-04 Brent Fulgham <bfulgham@webkit.org>
+
+ Reviewed by Adam Roben.
+
+ Properly handle margin settings in WinCairo.
+ https://bugs.webkit.org/show_bug.cgi?id=34545
+
+ * WebFrame.cpp:
+ (scaleFactor): Require the margin information as an input
+ parameter, and use them when computing the scaling factor.
+ (WebFrame::drawHeader): Pass margin size to scaleFactor.
+ (WebFrame::drawFooter): Pass margin size to scaleFactor.
+ (WebFrame::spoolPage):
+ 1. Pass margin size to scaleFactor.
+ 2. Recognize that the return value of printerMarginRect is
+ already in device units, and therefore scale it so that
+ the Cairo drawing is correct.
+ 3. Remove scaling call for margins in GDI code, as it is
+ already in scaled units.
+
2010-02-03 Brian Weinstein <bweinstein@apple.com>
Reviewed by Steve Falkenburg.
diff --git a/WebKit/win/Interfaces/IWebPreferencesPrivate.idl b/WebKit/win/Interfaces/IWebPreferencesPrivate.idl
index 1293fb8..613a53d 100644
--- a/WebKit/win/Interfaces/IWebPreferencesPrivate.idl
+++ b/WebKit/win/Interfaces/IWebPreferencesPrivate.idl
@@ -79,6 +79,9 @@ interface IWebPreferencesPrivate : IUnknown
HRESULT isXSSAuditorEnabled([out, retval] BOOL *enabled);
HRESULT setXSSAuditorEnabled([in] BOOL enabled);
+ HRESULT isFrameSetFlatteningEnabled([out, retval] BOOL *enabled);
+ HRESULT setFrameSetFlatteningEnabled([in] BOOL enabled);
+
HRESULT experimentalNotificationsEnabled([out, retval] BOOL *enabled);
HRESULT setExperimentalNotificationsEnabled([in] BOOL enabled);
diff --git a/WebKit/win/Interfaces/WebKit.idl b/WebKit/win/Interfaces/WebKit.idl
index 94dc697..3cd748c 100644
--- a/WebKit/win/Interfaces/WebKit.idl
+++ b/WebKit/win/Interfaces/WebKit.idl
@@ -294,4 +294,3 @@ library WebKit
[default] interface IWebGeolocationPosition;
}
}
-
diff --git a/WebKit/win/WebFrame.cpp b/WebKit/win/WebFrame.cpp
index c0c1601..b7ad014 100644
--- a/WebKit/win/WebFrame.cpp
+++ b/WebKit/win/WebFrame.cpp
@@ -2018,11 +2018,17 @@ void WebFrame::spoolPage(PlatformGraphicsContext* pctx, GraphicsContext* spoolCt
CGContextRestoreGState(pctx);
}
#elif PLATFORM(CAIRO)
-static float scaleFactor(HDC printDC, const IntRect& pageRect)
+static float scaleFactor(HDC printDC, const IntRect& marginRect, const IntRect& pageRect)
{
const IntRect& printRect = printerRect(printDC);
- float scale = static_cast<float>(printRect.width()) / static_cast<float>(pageRect.width());
+ IntRect adjustedRect = IntRect(
+ printRect.x() + marginRect.x(),
+ printRect.y() + marginRect.y(),
+ printRect.width() - marginRect.x() - marginRect.right(),
+ printRect.height() - marginRect.y() - marginRect.bottom());
+
+ float scale = static_cast<float>(adjustedRect.width()) / static_cast<float>(pageRect.width());
if (!scale)
scale = 1.0;
@@ -2038,8 +2044,9 @@ static HDC hdcFromContext(PlatformGraphicsContext* pctx)
void WebFrame::drawHeader(PlatformGraphicsContext* pctx, IWebUIDelegate* ui, const IntRect& pageRect, float headerHeight)
{
HDC hdc = hdcFromContext(pctx);
+ const IntRect& marginRect = printerMarginRect(hdc);
- const float scale = scaleFactor(hdc, pageRect);
+ const float scale = scaleFactor(hdc, marginRect, pageRect);
int x = static_cast<int>(scale * pageRect.x());
int y = 0;
RECT headerRect = {x, y, x + static_cast<int>(scale * pageRect.width()), y + static_cast<int>(scale * headerHeight)};
@@ -2050,8 +2057,9 @@ void WebFrame::drawHeader(PlatformGraphicsContext* pctx, IWebUIDelegate* ui, con
void WebFrame::drawFooter(PlatformGraphicsContext* pctx, IWebUIDelegate* ui, const IntRect& pageRect, UINT page, UINT pageCount, float headerHeight, float footerHeight)
{
HDC hdc = hdcFromContext(pctx);
+ const IntRect& marginRect = printerMarginRect(hdc);
- const float scale = scaleFactor(hdc, pageRect);
+ const float scale = scaleFactor(hdc, marginRect, pageRect);
int x = static_cast<int>(scale * pageRect.x());
int y = static_cast<int>(scale * max(static_cast<int>(headerHeight) + pageRect.height(), m_pageHeight-static_cast<int>(footerHeight)));
RECT footerRect = {x, y, x + static_cast<int>(scale * pageRect.width()), y + static_cast<int>(scale * footerHeight)};
@@ -2064,24 +2072,34 @@ void WebFrame::spoolPage(PlatformGraphicsContext* pctx, GraphicsContext* spoolCt
Frame* coreFrame = core(this);
const IntRect& pageRect = m_pageRects[page];
- IntRect marginRect = printerMarginRect(printDC);
+ const IntRect& marginRect = printerMarginRect(printDC);
cairo_save(pctx);
- float scale = scaleFactor(printDC, pageRect);
+ spoolCtx->save();
+ float scale = scaleFactor(printDC, marginRect, pageRect);
cairo_scale(pctx, scale, scale);
- cairo_translate(pctx, -pageRect.x() + marginRect.x(), -pageRect.y() + marginRect.y() + headerHeight);
+ IntRect cairoMarginRect (marginRect);
+ cairoMarginRect.scale (1 / scale);
+
+ // Modify Cairo and GDI World Transform to account for margin in the
+ // subsequent WebKit-controlled 'paintContents' drawing operations:
+ spoolCtx->translate(cairoMarginRect.x(), cairoMarginRect.y() + headerHeight);
+
+ // Modify Cairo (only) to account for page position.
+ cairo_translate(pctx, -pageRect.x(), -pageRect.y());
coreFrame->view()->paintContents(spoolCtx, pageRect);
- cairo_translate(pctx, pageRect.x() - marginRect.x(), pageRect.y() - marginRect.y() - headerHeight);
+ cairo_translate(pctx, pageRect.x(), pageRect.y());
XFORM originalWorld;
::GetWorldTransform(printDC, &originalWorld);
- // Position world transform to account for margin
+ // Position GDI world transform to account for margin in GDI-only
+ // header/footer calls
XFORM newWorld = originalWorld;
- newWorld.eDx = scale * marginRect.x();
- newWorld.eDy = scale * marginRect.y();
+ newWorld.eDx = marginRect.x();
+ newWorld.eDy = marginRect.y();
::SetWorldTransform(printDC, &newWorld);
@@ -2095,6 +2113,7 @@ void WebFrame::spoolPage(PlatformGraphicsContext* pctx, GraphicsContext* spoolCt
cairo_show_page(pctx);
ASSERT(!cairo_status(pctx));
+ spoolCtx->restore();
cairo_restore(pctx);
}
#endif
diff --git a/WebKit/win/WebPreferenceKeysPrivate.h b/WebKit/win/WebPreferenceKeysPrivate.h
index 3b4197c..9f768f2 100644
--- a/WebKit/win/WebPreferenceKeysPrivate.h
+++ b/WebKit/win/WebPreferenceKeysPrivate.h
@@ -130,6 +130,8 @@
#define WebKitPluginAllowedRunTimePreferenceKey "WebKitPluginAllowedRunTime"
+#define WebKitFrameSetFlatteningEnabledPreferenceKey "WebKitFrameSetFlatteningEnabled"
+
#define WebKitAcceleratedCompositingEnabledPreferenceKey "WebKitAcceleratedCompositingEnabled"
#define WebKitCustomDragCursorsEnabledPreferenceKey "WebKitCustomDragCursorsEnabled"
diff --git a/WebKit/win/WebPreferences.cpp b/WebKit/win/WebPreferences.cpp
index c23f236..13c2ac4 100644
--- a/WebKit/win/WebPreferences.cpp
+++ b/WebKit/win/WebPreferences.cpp
@@ -43,7 +43,6 @@
#include <CoreFoundation/CoreFoundation.h>
#include <limits>
#include <shlobj.h>
-#include <shfolder.h>
#include <tchar.h>
#include <wtf/HashMap.h>
#include <wtf/OwnArrayPtr.h>
@@ -207,6 +206,7 @@ void WebPreferences::initializeDefaultSettings()
CFDictionaryAddValue(defaults, CFSTR(WebKitWebSecurityEnabledPreferenceKey), kCFBooleanTrue);
CFDictionaryAddValue(defaults, CFSTR(WebKitAllowUniversalAccessFromFileURLsPreferenceKey), kCFBooleanFalse);
CFDictionaryAddValue(defaults, CFSTR(WebKitXSSAuditorEnabledPreferenceKey), kCFBooleanTrue);
+ CFDictionaryAddValue(defaults, CFSTR(WebKitFrameSetFlatteningEnabledPreferenceKey), kCFBooleanFalse);
CFDictionaryAddValue(defaults, CFSTR(WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey), kCFBooleanTrue);
CFDictionaryAddValue(defaults, CFSTR(WebKitPluginsEnabledPreferenceKey), kCFBooleanTrue);
CFDictionaryAddValue(defaults, CFSTR(WebKitDatabasesEnabledPreferenceKey), kCFBooleanTrue);
@@ -806,6 +806,20 @@ HRESULT STDMETHODCALLTYPE WebPreferences::setXSSAuditorEnabled(
return S_OK;
}
+HRESULT STDMETHODCALLTYPE WebPreferences::isFrameSetFlatteningEnabled(
+ /* [retval][out] */ BOOL* enabled)
+{
+ *enabled = boolValueForKey(CFSTR(WebKitFrameSetFlatteningEnabledPreferenceKey));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setFrameSetFlatteningEnabled(
+ /* [in] */ BOOL enabled)
+{
+ setBoolValue(CFSTR(WebKitFrameSetFlatteningEnabledPreferenceKey), enabled);
+ return S_OK;
+}
+
HRESULT STDMETHODCALLTYPE WebPreferences::javaScriptCanOpenWindowsAutomatically(
/* [retval][out] */ BOOL* enabled)
{
diff --git a/WebKit/win/WebPreferences.h b/WebKit/win/WebPreferences.h
index 1631e78..9209b7d 100644
--- a/WebKit/win/WebPreferences.h
+++ b/WebKit/win/WebPreferences.h
@@ -380,6 +380,12 @@ public:
virtual HRESULT STDMETHODCALLTYPE pluginAllowedRunTime(
/* [retval][out] */ UINT* allowedRunTime);
+ virtual HRESULT STDMETHODCALLTYPE isFrameSetFlatteningEnabled(
+ /* [retval][out] */ BOOL* enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE setFrameSetFlatteningEnabled(
+ /* [in] */ BOOL enabled);
+
virtual HRESULT STDMETHODCALLTYPE setPreferenceForTest(
/* [in] */ BSTR key,
/* [in] */ BSTR value);
diff --git a/WebKit/win/WebView.cpp b/WebKit/win/WebView.cpp
index 6144532..880c75f 100644
--- a/WebKit/win/WebView.cpp
+++ b/WebKit/win/WebView.cpp
@@ -4645,6 +4645,11 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification)
return hr;
settings->setPluginAllowedRunTime(runTime);
+ hr = prefsPrivate->isFrameSetFlatteningEnabled(&enabled);
+ if (FAILED(hr))
+ return hr;
+ settings->setFrameSetFlatteningEnabled(enabled);
+
#if USE(ACCELERATED_COMPOSITING)
hr = prefsPrivate->acceleratedCompositingEnabled(&enabled);
if (FAILED(hr))
@@ -4653,7 +4658,7 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification)
#endif
#if ENABLE(3D_CANVAS)
- settings->setExperimentalWebGLEnabled(true);
+ settings->setWebGLEnabled(true);
#endif // ENABLE(3D_CANVAS)
if (!m_closeWindowTimer.isActive())
@@ -5060,7 +5065,7 @@ HRESULT STDMETHODCALLTYPE WebView::shouldClose(
}
*result = TRUE;
- if (Frame* frame = m_page->focusController()->focusedOrMainFrame())
+ if (Frame* frame = m_page->mainFrame())
*result = frame->shouldClose() ? TRUE : FALSE;
return S_OK;
}
diff --git a/WebKit/wx/ChangeLog b/WebKit/wx/ChangeLog
index 26d14d6..05efbd2 100644
--- a/WebKit/wx/ChangeLog
+++ b/WebKit/wx/ChangeLog
@@ -1,3 +1,20 @@
+2010-02-04 Kevin Ollivier <kevino@theolliviers.com>
+
+ Build fix after changes in r54345.
+
+ * WebView.cpp:
+ (wxWebView::OnKeyEvents):
+
+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
+
+ * WebView.cpp:
+ (wxWebView::OnKeyEvents): Use Scrollbar method instead of constant.
+
2010-02-03 Kevin Watters <kevinwatters@gmail.com>
Reviewed by Kevin Ollivier.
diff --git a/WebKit/wx/WebView.cpp b/WebKit/wx/WebView.cpp
index 5fdae83..c448bbf 100644
--- a/WebKit/wx/WebView.cpp
+++ b/WebKit/wx/WebView.cpp
@@ -797,19 +797,19 @@ void wxWebView::OnKeyEvents(wxKeyEvent& event)
break;
case WXK_LEFT:
case WXK_NUMPAD_LEFT:
- frame->view()->scrollBy(WebCore::IntSize(-WebCore::cScrollbarPixelsPerLineStep, 0));
+ frame->view()->scrollBy(WebCore::IntSize(-WebCore::Scrollbar::pixelsPerLineStep(), 0));
return;
case WXK_UP:
case WXK_NUMPAD_UP:
- frame->view()->scrollBy(WebCore::IntSize(0, -WebCore::cScrollbarPixelsPerLineStep));
+ frame->view()->scrollBy(WebCore::IntSize(0, -WebCore::Scrollbar::pixelsPerLineStep()));
return;
case WXK_RIGHT:
case WXK_NUMPAD_RIGHT:
- frame->view()->scrollBy(WebCore::IntSize(WebCore::cScrollbarPixelsPerLineStep, 0));
+ frame->view()->scrollBy(WebCore::IntSize(WebCore::Scrollbar::pixelsPerLineStep(), 0));
return;
case WXK_DOWN:
case WXK_NUMPAD_DOWN:
- frame->view()->scrollBy(WebCore::IntSize(0, WebCore::cScrollbarPixelsPerLineStep));
+ frame->view()->scrollBy(WebCore::IntSize(0, WebCore::Scrollbar::pixelsPerLineStep()));
return;
case WXK_END:
case WXK_NUMPAD_END:
@@ -821,11 +821,11 @@ void wxWebView::OnKeyEvents(wxKeyEvent& event)
return;
case WXK_PAGEUP:
case WXK_NUMPAD_PAGEUP:
- frame->view()->scrollBy(WebCore::IntSize(0, -frame->view()->visibleHeight() * WebCore::cFractionToStepWhenPaging));
+ frame->view()->scrollBy(WebCore::IntSize(0, -frame->view()->visibleHeight() * WebCore::Scrollbar::minFractionToStepWhenPaging()));
return;
case WXK_PAGEDOWN:
case WXK_NUMPAD_PAGEDOWN:
- frame->view()->scrollBy(WebCore::IntSize(0, frame->view()->visibleHeight() * WebCore::cFractionToStepWhenPaging));
+ frame->view()->scrollBy(WebCore::IntSize(0, frame->view()->visibleHeight() * WebCore::Scrollbar::minFractionToStepWhenPaging()));
return;
//These we don't want turning into char events, stuff 'em
case WXK_ESCAPE:
diff --git a/WebKitLibraries/ChangeLog b/WebKitLibraries/ChangeLog
index 4f8f848..8eccc7d 100644
--- a/WebKitLibraries/ChangeLog
+++ b/WebKitLibraries/ChangeLog
@@ -1,3 +1,36 @@
+2010-02-11 Brian Weinstein <bweinstein@apple.com>
+
+ Rubber-stamped by Eric Seidel.
+
+ Turn back on SVG Filters on Windows, as they were accidentally disabled and cause
+ test breakage.
+
+ * win/tools/vsprops/FeatureDefines.vsprops:
+
+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
+
+ * win/tools/vsprops/FeatureDefines.vsprops:
+
+2010-02-04 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Steve Falkenburg.
+
+ Update auto-version.sh to better handle major version numbers with fewer than three digits,
+ and the case when WEBKITLIBRARIESDIR is not set.
+
+ * win/tools/scripts/auto-version.sh:
+
+2010-02-04 Steve Falkenburg <sfalken@apple.com>
+
+ Windows build fix for projects not defining WebKitLibrariesDir.
+
+ * win/tools/scripts/auto-version.sh:
+
2010-02-03 Dan Bernstein <mitz@apple.com>
Reviewed by Anders Carlsson.
diff --git a/WebKitLibraries/win/tools/scripts/VERSION b/WebKitLibraries/win/tools/scripts/VERSION
index 625c09b..910fbe3 100644
--- a/WebKitLibraries/win/tools/scripts/VERSION
+++ b/WebKitLibraries/win/tools/scripts/VERSION
@@ -1 +1 @@
-532
+533
diff --git a/WebKitLibraries/win/tools/scripts/auto-version.sh b/WebKitLibraries/win/tools/scripts/auto-version.sh
index cbdc1af..acb1c61 100755
--- a/WebKitLibraries/win/tools/scripts/auto-version.sh
+++ b/WebKitLibraries/win/tools/scripts/auto-version.sh
@@ -32,14 +32,21 @@ chomp()
eval $1=\$value;
}
-FALLBACK_VERSION_PATH=`cygpath -u "$WEBKITLIBRARIESDIR\\tools\\scripts\\VERSION"`
+if [[ -n "$WEBKITLIBRARIESDIR" ]]; then
+ FALLBACK_VERSION_PATH=`cygpath -u "$WEBKITLIBRARIESDIR\\tools\\scripts\\VERSION"`
+ FALLBACK_VERSION=$(cat "$FALLBACK_VERSION_PATH");
+
+ COPYRIGHT_END_YEAR_PATH=`cygpath -u "$WEBKITLIBRARIESDIR\\tools\\scripts\\COPYRIGHT-END-YEAR"`
+ COPYRIGHT_END_YEAR=$(cat "$COPYRIGHT_END_YEAR_PATH");
+ chomp COPYRIGHT_END_YEAR
+fi
+
OUTPUT_FILE=$(cygpath -u "$1")/include/autoversion.h
mkdir -p "$(dirname "$OUTPUT_FILE")"
# Take the initial version number from RC_PROJECTSOURCEVERSION if it
# exists, otherwise fall back to the version number stored in the source.
ENVIRONMENT_VERSION="$RC_PROJECTSOURCEVERSION";
-FALLBACK_VERSION=$(cat "$FALLBACK_VERSION_PATH");
PROPOSED_VERSION=${ENVIRONMENT_VERSION:-$FALLBACK_VERSION}
chomp PROPOSED_VERSION
@@ -53,7 +60,7 @@ BUILD_TINY_VERSION=$(echo "$PROPOSED_VERSION.." | cut -d '.' -f 3)
# Cut the major component down to three characters by dropping any
# extra leading digits, then adjust the major version portion of the
# version string to match.
-CHARACTERS_TO_DROP=$(( ${#BUILD_MAJOR_VERSION} - 3 ))
+CHARACTERS_TO_DROP=$(( ${#BUILD_MAJOR_VERSION} > 3 ? ${#BUILD_MAJOR_VERSION} - 3 : 0 ))
BUILD_MAJOR_VERSION=${BUILD_MAJOR_VERSION:$CHARACTERS_TO_DROP}
PROPOSED_VERSION=${PROPOSED_VERSION:$CHARACTERS_TO_DROP}
@@ -87,10 +94,6 @@ if [ -z ${ENVIRONMENT_VERSION} ]; then
VERSION_TEXT="${VERSION_TEXT_SHORT} ${USER} - ${BUILD_DATE} - r${SVN_REVISION}"
fi
-COPYRIGHT_END_YEAR_PATH=`cygpath -u "$WEBKITLIBRARIESDIR\\tools\\scripts\\COPYRIGHT-END-YEAR"`
-COPYRIGHT_END_YEAR=$(cat "$COPYRIGHT_END_YEAR_PATH");
-chomp COPYRIGHT_END_YEAR
-
cat > "$OUTPUT_FILE" <<EOF
#define __VERSION_TEXT__ "${VERSION_TEXT}"
#define __BUILD_NUMBER__ "${VERSION_TEXT}"
@@ -103,5 +106,10 @@ cat > "$OUTPUT_FILE" <<EOF
#define __BUILD_NUMBER_MINOR__ ${BUILD_MINOR_VERSION}
#define __BUILD_NUMBER_VARIANT__ ${BUILD_TINY_VERSION}
#define __SVN_REVISION__ ${SVN_REVISION}
+EOF
+
+if [[ -n "${COPYRIGHT_END_YEAR}" ]]; then
+cat >> "$OUTPUT_FILE" <<EOF
#define __COPYRIGHT_YEAR_END_TEXT__ "${COPYRIGHT_END_YEAR}"
EOF
+fi
diff --git a/WebKitLibraries/win/tools/vsprops/FeatureDefines.vsprops b/WebKitLibraries/win/tools/vsprops/FeatureDefines.vsprops
index 45495a3..e3893f2 100644
--- a/WebKitLibraries/win/tools/vsprops/FeatureDefines.vsprops
+++ b/WebKitLibraries/win/tools/vsprops/FeatureDefines.vsprops
@@ -9,7 +9,7 @@
>
<Tool
Name="VCCLCompilerTool"
- PreprocessorDefinitions="$(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)"
+ PreprocessorDefinitions="$(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)"
/>
<UserMacro
Name="ENABLE_3D_CANVAS"
@@ -97,6 +97,11 @@
PerformEnvironmentSet="true"
/>
<UserMacro
+ Name="ENABLE_RUBY"
+ Value="ENABLE_RUBY"
+ PerformEnvironmentSet="true"
+ />
+ <UserMacro
Name="ENABLE_SHARED_WORKERS"
Value="ENABLE_SHARED_WORKERS"
PerformEnvironmentSet="true"
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index ed2e4bf..ab4b32d 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,830 @@
+2010-02-12 Diego Gonzalez <diego.gonzalez@openbossa.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Qt DRT now dump the frame loader callbacks when LayoutTestController()
+ method is called.
+
+ LayoutTests:
+ http/tests/security/mixedContent/data-url-script-in-iframe.html
+ http/tests/security/mixedContent/empty-url-plugin-in-frame.html
+ http/tests/security/mixedContent/insecure-css-in-iframe.html
+ http/tests/security/mixedContent/insecure-iframe-in-iframe.html
+ http/tests/security/mixedContent/insecure-image-in-iframe.html
+ http/tests/security/mixedContent/insecure-plugin-in-iframe.html
+ http/tests/security/mixedContent/insecure-script-in-iframe.html
+ http/tests/security/mixedContent/redirect-http-to-https-script-in-iframe.html
+ http/tests/security/mixedContent/redirect-https-to-http-script-in-iframe.html
+
+ [Qt] Make possible Qt DRT dump frame load callbacks
+ https://bugs.webkit.org/show_bug.cgi?id=34702
+
+ * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
+ (LayoutTestController::reset):
+ (LayoutTestController::dumpFrameLoadCallbacks):
+ * DumpRenderTree/qt/LayoutTestControllerQt.h:
+
+2010-02-12 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Antti Koivisto.
+
+ Make QtLauncher somewhat useable on S60.
+
+ Show the window fullscreen to make scrollbars appear, resize
+ the toolbar buttons to 16x16 to give more screen space to
+ web content and moved the location lineedit into a separate
+ line.
+
+ * QtLauncher/main.cpp:
+ (LauncherWindow::LauncherWindow):
+ * QtLauncher/mainwindow.cpp:
+ (MainWindow::buildUI):
+
+2010-02-12 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 FrameSet Flattening support to Mac DRT.
+
+ * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
+ (LayoutTestController::setFrameSetFlatteningEnabled):
+ * DumpRenderTree/win/DumpRenderTree.cpp:
+ (resetDefaultsToConsistentValues):
+ * DumpRenderTree/win/LayoutTestControllerWin.cpp:
+ (LayoutTestController::setXSSAuditorEnabled):
+ * DumpRenderTree/wx/LayoutTestControllerWx.cpp:
+ (LayoutTestController::setFrameSetFlatteningEnabled):
+ * DumpRenderTree/LayoutTestController.cpp:
+ (setFrameSetFlatteningEnabledCallback):
+ (LayoutTestController::staticFunctions):
+ * DumpRenderTree/LayoutTestController.h:
+ * DumpRenderTree/mac/DumpRenderTree.mm:
+ (resetDefaultsToConsistentValues):
+ * DumpRenderTree/mac/LayoutTestControllerMac.mm:
+ (LayoutTestController::setFrameSetFlatteningEnabled):
+
+2010-02-12 Dirk Pranke <dpranke@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Fix typos in driver_test.py
+
+ https://bugs.webkit.org/show_bug.cgi?id=34810
+
+ * Scripts/webkitpy/layout_tests/driver_test.py:
+
+2010-02-12 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Make it possible to toggle the use of QGraphicsView in QtLauncher at run-time
+ https://bugs.webkit.org/show_bug.cgi?id=34844
+
+ * QtLauncher/main.cpp:
+ (LauncherWindow::LauncherWindow):
+ (LauncherWindow::initializeView):
+ (LauncherWindow::setupUI):
+ * QtLauncher/webview.cpp:
+ (WebViewGraphicsBased::WebViewGraphicsBased):
+
+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
+
+ Update pywebsocket to 0.4.8, which supports cgi directories.
+ run-webkit-tests and run-webkit-websocketserver will run
+ pywebsocket, specifying /websocket/test/cookies as cgi directory.
+
+ * Scripts/run-webkit-tests:
+ * Scripts/run-webkit-websocketserver:
+ * pywebsocket/mod_pywebsocket/standalone.py:
+ * pywebsocket/setup.py:
+
+2010-02-11 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org>
+
+ Reviewed by Dan Bernstein.
+
+ [Mac] Duplicated setXSSAuditorEnabled preference at Mac DRT
+ https://bugs.webkit.org/show_bug.cgi?id=34798
+
+ Remove duplicated setXSSAuditorEnabled preference at Mac DRT
+
+ * DumpRenderTree/mac/DumpRenderTree.mm:
+ (resetDefaultsToConsistentValues):
+
+2010-02-11 Eric Seidel <eric@webkit.org>
+
+ No review, build fix only.
+
+ webkitdirs.pm has a crazy amount of duplicated feature detection code
+ https://bugs.webkit.org/show_bug.cgi?id=34869
+
+ * Scripts/build-webkit: Fix typo which broke bots.
+
+2010-02-11 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ webkitdirs.pm has a crazy amount of duplicated feature detection code
+ https://bugs.webkit.org/show_bug.cgi?id=34869
+
+ * Scripts/build-webkit: Use the new hotness.
+ * Scripts/run-webkit-tests: ditto
+ * Scripts/webkitdirs.pm: Remove a bunch of bad duplicate code.
+ * Scripts/webkitperl/features.pm: Added.
+ - Simplified the 10 methods in webkitdirs.pm into 2 exported methods in this new file.
+
+2010-02-11 Daniel Bates <dbates@rim.com>
+
+ Reviewed by Adam Barth.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34830
+
+ Makes method User.prompt static and adds the parameter repeat
+ to prompt the user up to repeat times.
+
+ * Scripts/test-webkitpy:
+ * Scripts/webkitpy/bugzilla.py: Substituted method User.prompt for method raw_input.
+ * Scripts/webkitpy/commands/upload.py: Ditto
+ * Scripts/webkitpy/credentials.py: Ditto
+ * Scripts/mock_bugzillatool.py: Updated prototype of MockUser.prompt to match User.prompt.
+ * Scripts/webkitpy/user.py: Made method prompt static and added parameter repeat.
+ * Scripts/webkitpy/user_unittest.py: Added.
+
+2010-02-10 Yuzo Fujishima <yuzo@google.com>
+
+ Reviewed by Darin Adler.
+
+ Allow underscored identifiers in CSSParser.cpp
+
+ Flex (http://flex.sourceforge.net/) uses identifiers named as yy_*.
+ WebCore/css/CSSParser.cpp needs to handle some such identifiers.
+ We should relax the style rule for the file to allow underscored identifiers.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34787
+
+ * Scripts/webkitpy/style/checker.py:
+
+2010-02-11 Eric Seidel <eric@webkit.org>
+
+ Rubber-stamped by Adam Barth.
+
+ Remove DrawTest, the application I used when bringing up SVG support on the Mac.
+ The code hasn't been touched (or used) in years. No sense in keeping it in trunk.
+
+ * Scripts/build-drawtest: Removed.
+ * Scripts/run-drawtest: Removed.
+ * DrawTest: Removed.
+
+2010-02-11 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Need a command to clear r+ on obsolete patches in the pending-commit queue.
+ https://bugs.webkit.org/show_bug.cgi?id=34863
+
+ Unfortunately our http://webkit.org/pending-commit bugzilla query is not
+ smart enough to ignore obsolete patches, so bugs show up there which are
+ still open, but do not have patches ready for landing on them.
+ This new command "clean-pending-commit" will remove r+ from obsolete patches
+ in the pending-commit list.
+
+ * Scripts/test-webkitpy: Add grammar_unittest
+ * Scripts/webkitpy/commands/upload.py: Add clean-pending-commit and make assign-to-committer ignore cq+'d patches.
+ * Scripts/webkitpy/grammar.py: Add join_with_separators
+ * Scripts/webkitpy/grammar_unittest.py: Added.
+
+2010-02-11 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ run-chromium-webkit-tests fails random pixel tests on Mac
+ https://bugs.webkit.org/show_bug.cgi?id=34862
+
+ This is due to the fact that the Mac port has an
+ invalid path to the image diff tool. Currently it points
+ to image_diff even though ImageDiff would be correct. We
+ can't change it to the right path yet without causing the
+ script to hang. ImageDiff expects to be long-running and
+ be passed image data over stdin. image_diff (chromium's fork)
+ expects to be passed command line arguments.
+ This fix works around the random failures by disabling pixel
+ tests on mac and logging if the user was trying to run with pixel
+ tests enabled.
+
+ * Scripts/webkitpy/layout_tests/port/mac.py:
+
+2010-02-11 Nikolas Zimmermann <nzimmermann@rim.com>
+
+ Reviewed by Adam Roben.
+ Try to fix build breakage from r54665.
+
+ * Scripts/check-for-global-initializers:
+
+2010-02-11 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Make it possible to toggle accelerated compositing from the menu
+ at run-time.
+
+ * QtLauncher/main.cpp:
+ (LauncherWindow::toggleAcceleratedCompositing):
+ (LauncherWindow::setupUI):
+
+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
+
+ * Scripts/build-webkit:
+
+2010-02-10 Dirk Pranke <dpranke@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Fix various minor bugs keeping run-chromium-webkit-tests from actually
+ working on the linux and win ports of Chromium.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34739
+
+ * Scripts/webkitpy/layout_tests/layout_package/test_shell_thread.py:
+ * Scripts/webkitpy/layout_tests/port/__init__.py:
+ * Scripts/webkitpy/layout_tests/port/base.py:
+ * Scripts/webkitpy/layout_tests/port/chromium.py:
+ * Scripts/webkitpy/layout_tests/port/chromium_linux.py:
+ * Scripts/webkitpy/layout_tests/port/chromium_win.py:
+ * Scripts/webkitpy/layout_tests/port/http_server.py:
+ * Scripts/webkitpy/layout_tests/port/websocket_server.py:
+
+2010-02-10 Eric Seidel <eric@webkit.org>
+
+ Reviewed by David Levin.
+
+ run-chromium-webkit-tests --platform=mac-leopard crashes when using a custom build directory
+ https://bugs.webkit.org/show_bug.cgi?id=34817
+
+ This doesn't fix the root cause of us not
+ correctly failing when support binaries are missing.
+ This only causes the DumpRenderTree binary not to be
+ missing in the custom build directory case.
+ Later patches will make us correctly fail fast when
+ support binaries (like DumpRenderTree or ImageDiff) are missing.
+
+ * Scripts/webkit-build-directory: Added.
+ - Need a way to re-use the perl logic for finding build directories in non-perl scripts.
+ * Scripts/webkitpy/layout_tests/port/base.py: Add a FIXME.
+ * Scripts/webkitpy/layout_tests/port/mac.py:
+ - Call webkit-build-directory to find the build directory instead of assuming "WebKitBuild"
+ * Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py: Add FIXMEs.
+
+2010-02-10 Kevin Watters <kevinwatters@gmail.com>
+
+ Reviewed by Kevin Ollivier.
+
+ [wx] Add Windows complex text support.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34759
+
+ * wx/build/settings.py:
+
+2010-02-10 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] Build fix. Add stub for new LayoutTestController method.
+
+ * DumpRenderTree/wx/LayoutTestControllerWx.cpp:
+ (LayoutTestController::numberOfPages):
+
+2010-02-10 Csaba Osztrogonác <ossy@webkit.org>
+
+ Unreviewed. Roll out r54626, because it broke GTK and Win build.
+ https://bugs.webkit.org/show_bug.cgi?id=32717
+
+ * DumpRenderTree/LayoutTestController.cpp:
+ (LayoutTestController::staticFunctions):
+ * DumpRenderTree/LayoutTestController.h:
+ * DumpRenderTree/mac/DumpRenderTree.mm:
+ (resetDefaultsToConsistentValues):
+ * DumpRenderTree/mac/LayoutTestControllerMac.mm:
+
+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 FrameSet Flattening support to Mac DRT.
+
+ * DumpRenderTree/LayoutTestController.cpp:
+ (setFrameSetFlatteningEnabledCallback):
+ (LayoutTestController::staticFunctions):
+ * DumpRenderTree/LayoutTestController.h:
+ * DumpRenderTree/mac/DumpRenderTree.mm:
+ (resetDefaultsToConsistentValues):
+ * DumpRenderTree/mac/LayoutTestControllerMac.mm:
+ (LayoutTestController::setFrameSetFlatteningEnabled):
+
+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.
+
+ * DumpRenderTree/win/TestNetscapePlugin/main.cpp:
+ (executeScript):
+ Moved to an earlier point in the file.
+ (NPP_New):
+ If the plug-in has an onDestroy attribute, store its value.
+ (NPP_Destroy):
+ If the plug-in has code to run on destruction, run it and free it.
+
+2010-02-10 Diego Gonzalez <diego.gonzalez@openbossa.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Implement pageNumberForElementById() method in Qt DRT LayoutTestController,
+ to make Qt DRT able to get page number.
+
+ LayoutTests:
+ printing/page-break-always.html
+ printing/pageNumerForElementById.html
+ printing/css2.1/page-break-before-000.html
+ printing/css2.1/page-break-after-000.html
+ printing/css2.1/page-break-after-004.html
+ printing/css2.1/page-break-before-001.html
+ printing/css2.1/page-break-after-001.html
+ printing/css2.1/page-break-after-002.html
+ printing/css2.1/page-break-before-002.html
+ printing/css2.1/page-break-inside-000.html
+
+ [Qt] Make possible Qt DRT get a page number for element by ID
+ https://bugs.webkit.org/show_bug.cgi?id=34777
+
+ * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
+ (LayoutTestController::pageNumberForElementById):
+ * DumpRenderTree/qt/LayoutTestControllerQt.h:
+
+2010-02-10 Andras Becsi <abecsi@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Make run-iexploder-tests work on Linux.
+ https://bugs.webkit.org/show_bug.cgi?id=34748
+
+ Extract the platform dependant Apache configuration checking code in httpd.pm to a separate function
+ called getHTTPDConfigPathForTestDirectory and use run-launcher instead of run-safari if run on Linux.
+
+ * Scripts/run-iexploder-tests:
+ * Scripts/webkitperl/httpd.pm:
+
+2010-02-09 Csaba Osztrogonác <ossy@webkit.org>
+
+ [Qt] Unreviewed. Roll-out r54543, because layout tests crash in debug mode.
+ https://bugs.webkit.org/show_bug.cgi?id=34713
+
+ * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
+ (WebCore::WebPage::WebPage):
+ * DumpRenderTree/qt/main.cpp:
+ (main):
+
+2010-02-09 Alejandro G. Castro <alex@igalia.com>
+
+ Unreviewed; added myself to committers
+
+ * Scripts/webkitpy/committers.py:
+
+2010-02-09 Yael Aharon <yael.aharon@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Webkit in Qt does not have window.showModalDialog
+ https://bugs.webkit.org/show_bug.cgi?id=25585
+
+ Set the modality flag when createWindow is called with window type WebWindowDialog.
+
+ * QtLauncher/main.cpp:
+ (WebPage::createWindow):
+
+2010-02-09 Andras Becsi <abecsi@webkit.org>
+
+ Unreviewed trivial warning fix.
+
+ * Scripts/build-webkit:
+
+2010-02-09 Gabor Rapcsanyi <rgabor@inf.u-szeged.hu>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Add possibility of passing parameters to build-webkit by environment variable,
+ because the buildbot slaves can't control the arguments.
+
+ * Scripts/build-webkit:
+
+2010-02-09 Chang Shu <Chang.Shu@nokia.com>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt] Enable appcache feature.
+ https://bugs.webkit.org/show_bug.cgi?id=34713
+
+
+ * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
+ (WebCore::WebPage::WebPage):
+ * DumpRenderTree/qt/main.cpp:
+ (main):
+
+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
+
+ * DumpRenderTree/LayoutTestController.cpp:
+ (parsePageParameters):
+ (pageNumberForElementByIdCallback):
+ (numberOfPagesCallback):
+ (LayoutTestController::staticFunctions):
+ * DumpRenderTree/LayoutTestController.h:
+ * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
+ (LayoutTestController::numberOfPages):
+ * DumpRenderTree/mac/LayoutTestControllerMac.mm:
+ (LayoutTestController::numberOfPages):
+ * DumpRenderTree/win/LayoutTestControllerWin.cpp:
+ (LayoutTestController::numberOfPages):
+
+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
+
+ * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp:
+ (pluginGetProperty): Raise an exception when accessing a particular property.
+ (pluginSetProperty): Ditto.
+ (pluginInvoke): Added methods to get and set host object properties.
+
+2010-02-08 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ Reviewed by Ariya Hidayat.
+
+ [Qt] Backport No'am Rosenthal's frame rate measurement
+
+ * QtLauncher/main.cpp:
+ (LauncherWindow::LauncherWindow):
+ (LauncherApplication::handleUserOptions):
+ * QtLauncher/webview.cpp:
+ (WebViewGraphicsBased::WebViewGraphicsBased):
+ (WebViewGraphicsBased::enableFrameRateMeasurement):
+ (WebViewGraphicsBased::updateFrameRate):
+ (WebViewGraphicsBased::paintEvent):
+ * QtLauncher/webview.h:
+
+2010-02-08 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ Reviewed by Tor Arne Vestbø.
+
+ [Qt] Make overridePreference complain when it does not
+ support the preference given.
+
+ * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
+ (LayoutTestController::overridePreference):
+
+2010-02-08 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Set stdout/stderr to binary mode for DRT on Windows
+
+ This makes sure we don't end up with lots of CRLFs in the
+ DRT output, which breaks tons of results. Matches what
+ the Windows DRT does.
+
+ * DumpRenderTree/qt/main.cpp:
+
+2010-02-08 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Build fix for Qt on Windows.
+
+ Don't use noreturn directly since it's a gcc attribute.
+ Instead use the NO_RETURN macro from AlwaysInline.h
+
+ * QtLauncher/QtLauncher.pro:
+ * QtLauncher/utils.h:
+
+2010-02-05 Chris Jerdonek <cjerdonek@webkit.org>
+
+ Reviewed by Shinichiro Hamaji.
+
+ Suppressed check-webkit-style's underscore check in Qt's autotests.
+ Also made the path-specific filter check case-insensitive.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34574
+
+ * Scripts/webkitpy/style/checker.py:
+ - Added a list element to _PATH_RULES_SPECIFIER for
+ directories that should be excluded from the
+ "readability/naming" category (the category that relates to
+ underscores in identifiers, for example).
+
+ * Scripts/webkitpy/style/checker_unittest.py:
+ - Added an "end-to-end" test for "WebKit/qt/tests/".
+
+ * Scripts/webkitpy/style/filter.py:
+ - Altered FilterConfiguration's should_check() method to
+ check for path substring matches case-insensitively.
+
+ * Scripts/webkitpy/style/filter_unittest.py:
+ - Added a test to check case-insensitive path substring matching.
+
+ * Scripts/webkitpy/style/processors/cpp.py:
+ - Removed the hard-coded "WebKit/gtk/webkit/" path reference
+ since this is now taken care of by the _PATH_RULES_SPECIFIER
+ configuration variable.
+
+ * Scripts/webkitpy/style/processors/cpp_unittest.py:
+ - Removed the unit test for the GTK directory since this
+ is now taken care of by the checker._PATH_RULES_SPECIFIER
+ end-to-end tests.
+
+2010-02-08 Leith Bade <leith@leithalweapon.geek.nz>
+
+ Reviewed by Darin Adler.
+
+ Fixes: https://bugs.webkit.org/show_bug.cgi?id=34637
+ Corrects the newline inserted into WebKitOutputDir, and WebKitLibrariesDir Windows
+ environemnt variables when there is a space in the user's /home path.
+
+ * Scripts/webkitdirs.pm:
+ - Added missing quotes around $sourceDir in argument list of cygpath in determineWindowsSourceDir().
+
+2010-02-05 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34670
+ TestNetscapePlugin should work with Firefox
+
+ * DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp: (NPP_New): Default to Carbon if
+ browser doesn't tell what it supports.
+
+2010-02-05 Shinichiro Hamaji <hamaji@chromium.org>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ [Gtk] Implement layoutTestController.pageNumberForElementById
+ https://bugs.webkit.org/show_bug.cgi?id=34572
+
+ * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
+ (LayoutTestController::pageNumberForElementById):
+
+2010-02-03 Dirk Pranke <dpranke@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Add a simple test implementation and the WebKit Mac implementation
+ for the layout_tests/port package. Also add a simple test driver of
+ that interface.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34511
+
+ * Scripts/webkitpy/layout_tests/driver_test.py: Added.
+ * Scripts/webkitpy/layout_tests/port/__init__.py:
+ * Scripts/webkitpy/layout_tests/port/mac.py: Added.
+ * Scripts/webkitpy/layout_tests/port/test.py: Added.
+
+2010-02-03 Dirk Pranke <dpranke@chromium.org>
+
+ Reviewed by Eric Siedel.
+
+ Refactor the port package into an object-oriented style and merge
+ path_utils into it. We add a 'base' and a 'chromium' object to the
+ port package; this will allow us to easily add new ports (like
+ WebKit Mac).
+
+ https://bugs.webkit.org/show_bug.cgi?id=34511
+
+ * Scripts/rebaseline-chromium-webkit-tests:
+ * Scripts/run-chromium-webkit-tests:
+ * Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py:
+ * Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py:
+ * Scripts/webkitpy/layout_tests/layout_package/test_expectations.py:
+ * Scripts/webkitpy/layout_tests/layout_package/test_files.py:
+ * Scripts/webkitpy/layout_tests/layout_package/test_shell_thread.py:
+ * Scripts/webkitpy/layout_tests/port/__init__.py:
+ * Scripts/webkitpy/layout_tests/port/apache_http_server.py:
+ * Scripts/webkitpy/layout_tests/port/base.py: Added.
+ * Scripts/webkitpy/layout_tests/port/chromium.py: Added.
+ * Scripts/webkitpy/layout_tests/port/chromium_linux.py:
+ * Scripts/webkitpy/layout_tests/port/chromium_mac.py:
+ * Scripts/webkitpy/layout_tests/port/chromium_win.py:
+ * Scripts/webkitpy/layout_tests/port/http_server.py:
+ * Scripts/webkitpy/layout_tests/port/http_server_base.py:
+ * Scripts/webkitpy/layout_tests/port/path_utils.py: Removed.
+ * Scripts/webkitpy/layout_tests/port/websocket_server.py:
+ * Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py:
+ * Scripts/webkitpy/layout_tests/run_chromium_webkit_tests.py:
+ * Scripts/webkitpy/layout_tests/test_types/fuzzy_image_diff.py:
+ * Scripts/webkitpy/layout_tests/test_types/image_diff.py:
+ * Scripts/webkitpy/layout_tests/test_types/test_type_base.py:
+ * Scripts/webkitpy/layout_tests/test_types/text_diff.py:
+
+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
+
+ Add support for testing frame flattening with the Qt DRT
+
+ * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
+ (LayoutTestController::setFrameSetFlatteningEnabled):
+ * DumpRenderTree/qt/LayoutTestControllerQt.h:
+
+2010-02-03 Chris Jerdonek <cjerdonek@webkit.org>
+
+ Reviewed by Shinichiro Hamaji.
+
+ Provided a way in check-webkit-style to specify filter rules
+ on a per file or folder basis, via a configuration variable.
+
+ https://bugs.webkit.org/show_bug.cgi?id=33684
+
+ * Scripts/webkitpy/style/checker.py:
+ - Added _PATH_RULES_SPECIFIER configuration variable.
+ - In ProcessorOptions class--
+ - Changed the CategoryFilter attribute to FilterConfiguration.
+ - Added path parameter to is_reportable().
+ - Renamed ArgumentDefaults filter_rules attribute to
+ base_filter_rules.
+ - Updated ArgumentPrinter class.
+ - Added filter rule validation to ArgumentParser (instead of
+ in CategoryFilter constructor).
+
+ * Scripts/webkitpy/style/checker_unittest.py:
+ - Updated unit tests as necessary.
+ - Added unit tests for PATH_RULES_SPECIFIER.
+
+ * Scripts/webkitpy/style/error_handlers.py:
+ - Updated DefaultStyleErrorHandler to use file path when
+ calling is_reportable().
+
+ * Scripts/webkitpy/style/error_handlers_unittest.py:
+ - Updated unit tests as necessary.
+
+ * Scripts/webkitpy/style/filter.py:
+ - Marked CategoryFilter internal with an underscore.
+ - Removed argument validation from CategoryFilter.
+ - Added FilterConfiguration class.
+
+ * Scripts/webkitpy/style/filter_unittest.py:
+ - Updated CategoryFilterTest class.
+ - Added FilterConfigurationTest unit tests.
+
+ * Scripts/webkitpy/style/processors/cpp.py:
+ - Removed _is_test_filename() code.
+ - Removed hard-coded path checks from check_include_line().
+
+ * Scripts/webkitpy/style/processors/cpp_unittest.py:
+ - Removed three unit tests related to exempted files.
+
+2010-02-05 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ Reviewed by Ariya Hidayat.
+
+ [Qt] Apply the command line options as settings to the
+ graphics system.
+
+ * QtLauncher/main.cpp:
+ (LauncherWindow::LauncherWindow):
+ (requiresGraphicsView):
+ (LauncherApplication::handleUserOptions):
+ * QtLauncher/webview.h:
+ (WebViewGraphicsBased::setItemCacheMode):
+
+2010-02-05 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Notify user that run-webkit-tests has to be run under Cygwin
+
+ The script will bail out if run under Windows shell or Msys.
+
+ * Scripts/run-webkit-tests:
+ * Scripts/webkitdirs.pm:
+
+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.
+
+ * Scripts/webkitdirs.pm: Run qmake and make on new API-DerivedSources
+
+2010-02-05 Andras Becsi <abecsi@webkit.org>
+
+ Unreviewed typo fix.
+
+ Fix wrong whitespace alignment introduced in r54342.
+
+ * Scripts/run-webkit-tests:
+
+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.
+
+ * Scripts/check-for-weak-vtables-and-externals: Renamed from WebKitTools/Scripts/check-for-weak-vtables.
+ Teach the script how to detect weak external symbols so that these errors can be caught immediately
+ in the future.
+
+2010-02-04 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ Rubberstamped by Oliver Hunt.
+
+ [Qt] Make it possible to choose whether the launcher should
+ use the traditional QWidget based QWebView or the newer
+ QGraphics based QGraphicsWebView on a QGraphicsView.
+
+ * QtLauncher/main.cpp:
+ (LauncherWindow::LauncherWindow):
+ (LauncherWindow::eventFilter):
+ (LauncherWindow::loadStarted):
+ (LauncherWindow::print):
+ (LauncherWindow::screenshot):
+ (LauncherWindow::setEditable):
+ (LauncherWindow::setupUI):
+ (main):
+ * QtLauncher/webview.cpp:
+ (WebViewGraphicsBased::WebViewGraphicsBased):
+ (WebViewGraphicsBased::resizeEvent):
+ (GraphicsWebView::mousePressEvent):
+ (GraphicsWebView::contextMenuEvent):
+ * QtLauncher/webview.h:
+ (WebViewTraditional::WebViewTraditional):
+ (GraphicsWebView::GraphicsWebView):
+ (WebViewGraphicsBased::setPage):
+
+2010-02-04 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ Rubberstamped by Oliver Hunt.
+
+ [Qt] QtLauncher cleanup.
+
+ Refactor option handling out in utility functions and make the
+ arguments more Qt compatible.
+
+ * QtLauncher/main.cpp:
+ (requiresGraphicsView):
+ (LauncherApplication::handleUserOptions):
+ * QtLauncher/utils.cpp:
+ (takeOptionValue):
+ (formatKeys):
+ (enumToKeys):
+ (appQuit):
+ * QtLauncher/utils.h:
+
+2010-02-04 Andras Becsi <abecsi@inf.u-szeged.hu>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Implement a locking and scheduling mechanism for http testing sessions to be able
+ to run multiple instances of run-webkit-tests parallel on the same machine.
+ If a test session wants to run http tests and this feature is enabled, the pending
+ sessions create lockfiles with sequential lock numbers. These locks are used to schedule
+ the running test sessions in first come first served order. An exclusive lock ensures
+ that the lock numbers are sequential to avoid deadlocks and starvation.
+ Because the buildbot master specifies the flags used by slaves we need an environment
+ variable too to be able to use the feature per-slave.
+ Exporting WEBKIT_WAIT_FOR_HTTPD=1 before testing or using the --wait-for-httpd
+ flag enables this feature, otherwise this patch has no effect on the testing whatsoever.
+
+ https://bugs.webkit.org/show_bug.cgi?id=33153
+
+ * Scripts/run-webkit-tests:
+ * Scripts/webkitperl/httpd.pm:
+
2010-01-22 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
Reviewed by Simon Hausmann.
diff --git a/WebKitTools/DrawTest/AppDelegate.h b/WebKitTools/DrawTest/AppDelegate.h
deleted file mode 100644
index 7103bb8..0000000
--- a/WebKitTools/DrawTest/AppDelegate.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2005 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.
- */
-
-#import <Cocoa/Cocoa.h>
-
-
-@interface AppDelegate : NSObject {
- IBOutlet NSWindow *svgImageRepTestWindow;
-}
-
-- (IBAction)showTestsPanel:(id)sender;
-- (IBAction)showImageRepTestWindow:(id)sender;
-- (IBAction)showInspectorPanel:(id)sender;
-
-@end
diff --git a/WebKitTools/DrawTest/AppDelegate.m b/WebKitTools/DrawTest/AppDelegate.m
deleted file mode 100644
index 0f20b35..0000000
--- a/WebKitTools/DrawTest/AppDelegate.m
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2005 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.
- */
-#import "AppDelegate.h"
-
-#import "TestController.h"
-#import "DrawTestInspectorController.h"
-
-@implementation AppDelegate
-
-- (IBAction)showTestsPanel:(id)sender
-{
- [[TestController sharedController] showTestsPanel:sender];
-}
-
-- (IBAction)showImageRepTestWindow:(id)sender
-{
- [svgImageRepTestWindow makeKeyAndOrderFront:sender];
-}
-
-- (IBAction)showInspectorPanel:(id)sender
-{
- [[DrawTestInspectorController sharedInstance] showInspectorPanel:sender];
-}
-
-- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender
-{
- return NO;
-}
-
-@end
diff --git a/WebKitTools/DrawTest/DrawTest.xcodeproj/project.pbxproj b/WebKitTools/DrawTest/DrawTest.xcodeproj/project.pbxproj
deleted file mode 100644
index cb6a265..0000000
--- a/WebKitTools/DrawTest/DrawTest.xcodeproj/project.pbxproj
+++ /dev/null
@@ -1,387 +0,0 @@
-// !$*UTF8*$!
-{
- archiveVersion = 1;
- classes = {
- };
- objectVersion = 42;
- objects = {
-
-/* Begin PBXBuildFile section */
- 78662E6D096B4E1600907EA7 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 78662E6C096B4E1600907EA7 /* WebKit.framework */; };
- 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; };
- 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
- 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
- 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
- A8C006CF0898634600BA5114 /* SVGTest.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C006B00898634600BA5114 /* SVGTest.m */; };
- A8C006D00898634600BA5114 /* ScalingImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C006B20898634600BA5114 /* ScalingImageView.m */; };
- A8C006D20898634600BA5114 /* DrawTestView.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C006B50898634600BA5114 /* DrawTestView.m */; };
- A8C006D30898634600BA5114 /* DrawTestToolbarController.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C006B70898634600BA5114 /* DrawTestToolbarController.m */; };
- A8C006D40898634600BA5114 /* DrawTestInspectorController.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C006BB0898634600BA5114 /* DrawTestInspectorController.m */; };
- A8C006D50898634600BA5114 /* DrawTestDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C006BD0898634600BA5114 /* DrawTestDocument.m */; };
- A8C006E10898634600BA5114 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C006CA0898634600BA5114 /* AppDelegate.m */; };
- A8C006E20898634600BA5114 /* TestViewerSplitView.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C006CC0898634600BA5114 /* TestViewerSplitView.m */; };
- A8C006E30898634600BA5114 /* TestController.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C006CE0898634600BA5114 /* TestController.m */; };
- A8C006F3089865E900BA5114 /* DrawTestDocument.nib in Resources */ = {isa = PBXBuildFile; fileRef = A8C006ED089865E900BA5114 /* DrawTestDocument.nib */; };
- A8C006F4089865E900BA5114 /* Inspector.nib in Resources */ = {isa = PBXBuildFile; fileRef = A8C006EF089865E900BA5114 /* Inspector.nib */; };
- A8C006F5089865E900BA5114 /* TestViewer.nib in Resources */ = {isa = PBXBuildFile; fileRef = A8C006F1089865E900BA5114 /* TestViewer.nib */; };
-/* End PBXBuildFile section */
-
-/* Begin PBXFileReference section */
- 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
- 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
- 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
- 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
- 29B97319FDCFA39411CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; sourceTree = "<group>"; };
- 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
- 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
- 32CA4F630368D1EE00C91783 /* DrawTest_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawTest_Prefix.pch; sourceTree = "<group>"; };
- 78662E6C096B4E1600907EA7 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
- 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
- 8D1107320486CEB800E47090 /* DrawTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DrawTest.app; sourceTree = BUILT_PRODUCTS_DIR; };
- A8C006AF0898634600BA5114 /* TestController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestController.h; sourceTree = "<group>"; };
- A8C006B00898634600BA5114 /* SVGTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGTest.m; sourceTree = "<group>"; };
- A8C006B10898634600BA5114 /* SVGTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTest.h; sourceTree = "<group>"; };
- A8C006B20898634600BA5114 /* ScalingImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScalingImageView.m; sourceTree = "<group>"; };
- A8C006B30898634600BA5114 /* ScalingImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScalingImageView.h; sourceTree = "<group>"; };
- A8C006B50898634600BA5114 /* DrawTestView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DrawTestView.m; sourceTree = "<group>"; };
- A8C006B60898634600BA5114 /* DrawTestView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawTestView.h; sourceTree = "<group>"; };
- A8C006B70898634600BA5114 /* DrawTestToolbarController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DrawTestToolbarController.m; sourceTree = "<group>"; };
- A8C006B80898634600BA5114 /* DrawTestDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawTestDocument.h; sourceTree = "<group>"; };
- A8C006BA0898634600BA5114 /* DrawTestToolbarController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawTestToolbarController.h; sourceTree = "<group>"; };
- A8C006BB0898634600BA5114 /* DrawTestInspectorController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DrawTestInspectorController.m; sourceTree = "<group>"; };
- A8C006BC0898634600BA5114 /* DrawTestInspectorController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawTestInspectorController.h; sourceTree = "<group>"; };
- A8C006BD0898634600BA5114 /* DrawTestDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DrawTestDocument.m; sourceTree = "<group>"; };
- A8C006CA0898634600BA5114 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
- A8C006CB0898634600BA5114 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
- A8C006CC0898634600BA5114 /* TestViewerSplitView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestViewerSplitView.m; sourceTree = "<group>"; };
- A8C006CD0898634600BA5114 /* TestViewerSplitView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestViewerSplitView.h; sourceTree = "<group>"; };
- A8C006CE0898634600BA5114 /* TestController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestController.m; sourceTree = "<group>"; };
- A8C006EE089865E900BA5114 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/DrawTestDocument.nib; sourceTree = "<group>"; };
- A8C006F0089865E900BA5114 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/Inspector.nib; sourceTree = "<group>"; };
- A8C006F2089865E900BA5114 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/TestViewer.nib; sourceTree = "<group>"; };
-/* End PBXFileReference section */
-
-/* Begin PBXFrameworksBuildPhase section */
- 8D11072E0486CEB800E47090 /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
- 78662E6D096B4E1600907EA7 /* WebKit.framework in Frameworks */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXFrameworksBuildPhase section */
-
-/* Begin PBXGroup section */
- 080E96DDFE201D6D7F000001 /* Classes */ = {
- isa = PBXGroup;
- children = (
- A8C006E6089863B100BA5114 /* Test Browser */,
- A8C006E5089863A100BA5114 /* Viewer */,
- A8C006CB0898634600BA5114 /* AppDelegate.h */,
- A8C006CA0898634600BA5114 /* AppDelegate.m */,
- A8C006B30898634600BA5114 /* ScalingImageView.h */,
- A8C006B20898634600BA5114 /* ScalingImageView.m */,
- );
- name = Classes;
- sourceTree = "<group>";
- };
- 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
- isa = PBXGroup;
- children = (
- 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
- 78662E6C096B4E1600907EA7 /* WebKit.framework */,
- );
- name = "Linked Frameworks";
- sourceTree = "<group>";
- };
- 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = {
- isa = PBXGroup;
- children = (
- 29B97324FDCFA39411CA2CEA /* AppKit.framework */,
- 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */,
- 29B97325FDCFA39411CA2CEA /* Foundation.framework */,
- );
- name = "Other Frameworks";
- sourceTree = "<group>";
- };
- 19C28FACFE9D520D11CA2CBB /* Products */ = {
- isa = PBXGroup;
- children = (
- 8D1107320486CEB800E47090 /* DrawTest.app */,
- );
- name = Products;
- sourceTree = "<group>";
- };
- 29B97314FDCFA39411CA2CEA /* DrawTest */ = {
- isa = PBXGroup;
- children = (
- 080E96DDFE201D6D7F000001 /* Classes */,
- 29B97315FDCFA39411CA2CEA /* Other Sources */,
- 29B97317FDCFA39411CA2CEA /* Resources */,
- 29B97323FDCFA39411CA2CEA /* Frameworks */,
- 19C28FACFE9D520D11CA2CBB /* Products */,
- );
- name = DrawTest;
- sourceTree = "<group>";
- };
- 29B97315FDCFA39411CA2CEA /* Other Sources */ = {
- isa = PBXGroup;
- children = (
- 32CA4F630368D1EE00C91783 /* DrawTest_Prefix.pch */,
- 29B97316FDCFA39411CA2CEA /* main.m */,
- );
- name = "Other Sources";
- sourceTree = "<group>";
- };
- 29B97317FDCFA39411CA2CEA /* Resources */ = {
- isa = PBXGroup;
- children = (
- A8C006ED089865E900BA5114 /* DrawTestDocument.nib */,
- 8D1107310486CEB800E47090 /* Info.plist */,
- 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
- A8C006EF089865E900BA5114 /* Inspector.nib */,
- 29B97318FDCFA39411CA2CEA /* MainMenu.nib */,
- A8C006F1089865E900BA5114 /* TestViewer.nib */,
- );
- name = Resources;
- sourceTree = "<group>";
- };
- 29B97323FDCFA39411CA2CEA /* Frameworks */ = {
- isa = PBXGroup;
- children = (
- 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */,
- 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
- );
- name = Frameworks;
- sourceTree = "<group>";
- };
- A8C006E5089863A100BA5114 /* Viewer */ = {
- isa = PBXGroup;
- children = (
- A8C006B80898634600BA5114 /* DrawTestDocument.h */,
- A8C006BD0898634600BA5114 /* DrawTestDocument.m */,
- A8C006BA0898634600BA5114 /* DrawTestToolbarController.h */,
- A8C006B70898634600BA5114 /* DrawTestToolbarController.m */,
- A8C006B60898634600BA5114 /* DrawTestView.h */,
- A8C006B50898634600BA5114 /* DrawTestView.m */,
- );
- name = Viewer;
- sourceTree = "<group>";
- };
- A8C006E6089863B100BA5114 /* Test Browser */ = {
- isa = PBXGroup;
- children = (
- A8C006BC0898634600BA5114 /* DrawTestInspectorController.h */,
- A8C006BB0898634600BA5114 /* DrawTestInspectorController.m */,
- A8C006B10898634600BA5114 /* SVGTest.h */,
- A8C006B00898634600BA5114 /* SVGTest.m */,
- A8C006AF0898634600BA5114 /* TestController.h */,
- A8C006CE0898634600BA5114 /* TestController.m */,
- A8C006CD0898634600BA5114 /* TestViewerSplitView.h */,
- A8C006CC0898634600BA5114 /* TestViewerSplitView.m */,
- );
- name = "Test Browser";
- sourceTree = "<group>";
- };
-/* End PBXGroup section */
-
-/* Begin PBXNativeTarget section */
- 8D1107260486CEB800E47090 /* DrawTest */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = A8C006740898624E00BA5114 /* Build configuration list for PBXNativeTarget "DrawTest" */;
- buildPhases = (
- 8D1107290486CEB800E47090 /* Resources */,
- 8D11072C0486CEB800E47090 /* Sources */,
- 8D11072E0486CEB800E47090 /* Frameworks */,
- );
- buildRules = (
- );
- dependencies = (
- );
- name = DrawTest;
- productInstallPath = "$(HOME)/Applications";
- productName = DrawTest;
- productReference = 8D1107320486CEB800E47090 /* DrawTest.app */;
- productType = "com.apple.product-type.application";
- };
-/* End PBXNativeTarget section */
-
-/* Begin PBXProject section */
- 29B97313FDCFA39411CA2CEA /* Project object */ = {
- isa = PBXProject;
- buildConfigurationList = A8C006780898624E00BA5114 /* Build configuration list for PBXProject "DrawTest" */;
- compatibilityVersion = "Xcode 2.4";
- hasScannedForEncodings = 1;
- mainGroup = 29B97314FDCFA39411CA2CEA /* DrawTest */;
- projectDirPath = "";
- projectRoot = "";
- targets = (
- 8D1107260486CEB800E47090 /* DrawTest */,
- );
- };
-/* End PBXProject section */
-
-/* Begin PBXResourcesBuildPhase section */
- 8D1107290486CEB800E47090 /* Resources */ = {
- isa = PBXResourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- A8C006F3089865E900BA5114 /* DrawTestDocument.nib in Resources */,
- 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
- A8C006F4089865E900BA5114 /* Inspector.nib in Resources */,
- 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */,
- A8C006F5089865E900BA5114 /* TestViewer.nib in Resources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXResourcesBuildPhase section */
-
-/* Begin PBXSourcesBuildPhase section */
- 8D11072C0486CEB800E47090 /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- A8C006E10898634600BA5114 /* AppDelegate.m in Sources */,
- A8C006D50898634600BA5114 /* DrawTestDocument.m in Sources */,
- A8C006D40898634600BA5114 /* DrawTestInspectorController.m in Sources */,
- A8C006D30898634600BA5114 /* DrawTestToolbarController.m in Sources */,
- A8C006D20898634600BA5114 /* DrawTestView.m in Sources */,
- 8D11072D0486CEB800E47090 /* main.m in Sources */,
- A8C006D00898634600BA5114 /* ScalingImageView.m in Sources */,
- A8C006CF0898634600BA5114 /* SVGTest.m in Sources */,
- A8C006E30898634600BA5114 /* TestController.m in Sources */,
- A8C006E20898634600BA5114 /* TestViewerSplitView.m in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXSourcesBuildPhase section */
-
-/* Begin PBXVariantGroup section */
- 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = {
- isa = PBXVariantGroup;
- children = (
- 089C165DFE840E0CC02AAC07 /* English */,
- );
- name = InfoPlist.strings;
- sourceTree = "<group>";
- };
- 29B97318FDCFA39411CA2CEA /* MainMenu.nib */ = {
- isa = PBXVariantGroup;
- children = (
- 29B97319FDCFA39411CA2CEA /* English */,
- );
- name = MainMenu.nib;
- sourceTree = "<group>";
- };
- A8C006ED089865E900BA5114 /* DrawTestDocument.nib */ = {
- isa = PBXVariantGroup;
- children = (
- A8C006EE089865E900BA5114 /* English */,
- );
- name = DrawTestDocument.nib;
- sourceTree = "<group>";
- };
- A8C006EF089865E900BA5114 /* Inspector.nib */ = {
- isa = PBXVariantGroup;
- children = (
- A8C006F0089865E900BA5114 /* English */,
- );
- name = Inspector.nib;
- sourceTree = "<group>";
- };
- A8C006F1089865E900BA5114 /* TestViewer.nib */ = {
- isa = PBXVariantGroup;
- children = (
- A8C006F2089865E900BA5114 /* English */,
- );
- name = TestViewer.nib;
- sourceTree = "<group>";
- };
-/* End PBXVariantGroup section */
-
-/* Begin XCBuildConfiguration section */
- A8C006750898624E00BA5114 /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- COPY_PHASE_STRIP = NO;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_ENABLE_FIX_AND_CONTINUE = YES;
- GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
- GCC_OPTIMIZATION_LEVEL = 0;
- GCC_PRECOMPILE_PREFIX_HEADER = YES;
- GCC_PREFIX_HEADER = DrawTest_Prefix.pch;
- GCC_TREAT_WARNINGS_AS_ERRORS = YES;
- GCC_WARN_ABOUT_RETURN_TYPE = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- INFOPLIST_FILE = Info.plist;
- INSTALL_PATH = "$(HOME)/Applications";
- PREBINDING = NO;
- PRODUCT_NAME = DrawTest;
- WRAPPER_EXTENSION = app;
- ZERO_LINK = YES;
- };
- name = Debug;
- };
- A8C006760898624E00BA5114 /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- COPY_PHASE_STRIP = YES;
- GCC_ENABLE_FIX_AND_CONTINUE = NO;
- GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
- GCC_PRECOMPILE_PREFIX_HEADER = YES;
- GCC_PREFIX_HEADER = DrawTest_Prefix.pch;
- GCC_TREAT_WARNINGS_AS_ERRORS = YES;
- GCC_WARN_ABOUT_RETURN_TYPE = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- INFOPLIST_FILE = Info.plist;
- INSTALL_PATH = "$(HOME)/Applications";
- PREBINDING = NO;
- PRODUCT_NAME = DrawTest;
- WRAPPER_EXTENSION = app;
- ZERO_LINK = NO;
- };
- name = Release;
- };
- A8C006790898624E00BA5114 /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- DEBUG_INFORMATION_FORMAT = dwarf;
- GCC_C_LANGUAGE_STANDARD = gnu99;
- };
- name = Debug;
- };
- A8C0067A0898624E00BA5114 /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- DEBUG_INFORMATION_FORMAT = dwarf;
- GCC_C_LANGUAGE_STANDARD = gnu99;
- };
- name = Release;
- };
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
- A8C006740898624E00BA5114 /* Build configuration list for PBXNativeTarget "DrawTest" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- A8C006750898624E00BA5114 /* Debug */,
- A8C006760898624E00BA5114 /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
- A8C006780898624E00BA5114 /* Build configuration list for PBXProject "DrawTest" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- A8C006790898624E00BA5114 /* Debug */,
- A8C0067A0898624E00BA5114 /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
-/* End XCConfigurationList section */
- };
- rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
-}
diff --git a/WebKitTools/DrawTest/DrawTestDocument.h b/WebKitTools/DrawTest/DrawTestDocument.h
deleted file mode 100644
index b0b16d9..0000000
--- a/WebKitTools/DrawTest/DrawTestDocument.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
- * Copyright (C) 2006 Nefaur Khandker <nefaurk@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.
- */
-
-#import <Cocoa/Cocoa.h>
-
-@class DrawTestView;
-@class DrawTestToolbarController;
-
-@interface DrawTestDocument : NSDocument
-{
- IBOutlet DrawTestView *drawView;
- IBOutlet NSDrawer *debugDrawer;
-
- DrawTestToolbarController *toolbarController;
-}
-
-// Debug menu
-- (IBAction)dumpSVGToConsole:(id)sender;
-- (IBAction)toggleDebugDrawer:(id)sender;
-- (IBAction)runWindowResizeTest:(id)sender;
-
-@end
diff --git a/WebKitTools/DrawTest/DrawTestDocument.m b/WebKitTools/DrawTest/DrawTestDocument.m
deleted file mode 100644
index c71e7ad..0000000
--- a/WebKitTools/DrawTest/DrawTestDocument.m
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
- * Copyright (C) 2006 Nefaur Khandker <nefaurk@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.
- */
-
-#import "DrawTestDocument.h"
-#import "DrawTestView.h"
-#import "DrawTestToolbarController.h"
-#import <WebKit/WebView.h>
-#import <WebKit/WebFrame.h>
-#import <WebKit/WebDataSource.h>
-
-@implementation DrawTestDocument
-
-- (id)initWithType:(NSString *)typeName error:(NSError **)outError
-{
- if (outError) {
- NSDictionary *errorInfo = [NSDictionary dictionaryWithObjectsAndKeys:
- @"No document could be created.", NSLocalizedDescriptionKey,
- @"New document creation not yet supported.", NSLocalizedFailureReasonErrorKey,
- nil];
- *outError = [NSError errorWithDomain:NSCocoaErrorDomain code:0 userInfo:errorInfo];
- }
- [self release];
- return nil;
-}
-
-- (void)dealloc
-{
- [toolbarController release];
- [super dealloc];
-}
-
-- (NSString *)windowNibName
-{
- return @"DrawTestDocument";
-}
-
-- (BOOL)readFromFile:(NSString *)filename ofType:(NSString *)docType
-{
- // TODO: Check the validity of the document before returning YES.
- return YES;
-}
-
-- (void)windowControllerDidLoadNib:(NSWindowController *)aController
-{
- [super windowControllerDidLoadNib:aController];
- toolbarController = [[DrawTestToolbarController alloc] initWithDrawView:drawView];
- [drawView setDocument:[self fileURL]];
-}
-
-- (IBAction)dumpSVGToConsole:(id)sender
-{
- WebDataSource* dataSource = [[drawView mainFrame] dataSource];
- NSLog(@"SVG Markup for file %@:\n%@", [self fileURL], [[dataSource representation] documentSource]);
-}
-
-- (IBAction)openSourceForSelection:(id)sender
-{
- // TODO: The "path" message (below) will not produce a valid pathname if we are dealing with a remote file.
- NSString *filename = [[self fileURL] path];
- [[NSWorkspace sharedWorkspace] openFile:filename withApplication:@"TextEdit"];
-}
-
-- (NSData *)dataRepresentationOfType:(NSString *)aType
-{
- WebDataSource* dataSource = [[drawView mainFrame] dataSource];
- return [dataSource data];
-}
-
-#pragma mark -
-#pragma mark Debug Methods
-
-- (IBAction)toggleDebugDrawer:(id)sender
-{
- [debugDrawer toggle:sender];
-}
-
-- (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item
-{
- return nil;
-}
-
-- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item
-{
- return NO;
-}
-
-- (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item
-{
- return 0;
-}
-
-- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item
-{
- return nil;
-}
-
-- (IBAction)runWindowResizeTest:(id)sender
-{
- NSWindow *window = [drawView window];
- NSScreen *screen = [window screen];
- float screenHeight = [screen visibleFrame].size.height;
- NSRect originalFrame = [window frame];
- // initial setup
- BOOL toolbarVisible = [[window toolbar] isVisible];
- if (toolbarVisible) [window toggleToolbarShown:self];
- [window setFrame:NSMakeRect(0,screenHeight-100,100,100) display:YES];
-
- // grab time.
- CFAbsoluteTime start = CFAbsoluteTimeGetCurrent();
-
- // run test
- for (int x = 0; x < 3; x++) {
- for (float size = 100; size < 500.f; size += 20.f) {
- [window setFrame:NSMakeRect(0, screenHeight-size, size, size) display:YES];
- }
- }
-
- double elapsed = CFAbsoluteTimeGetCurrent() - start;
-
- // log
- NSLog(@"Window resize test: %fs", elapsed);
-
- // restore
- if (toolbarVisible) [window toggleToolbarShown:self];
- [window setFrame:originalFrame display:YES];
-}
-
-@end
diff --git a/WebKitTools/DrawTest/DrawTestInspectorController.h b/WebKitTools/DrawTest/DrawTestInspectorController.h
deleted file mode 100644
index 43c06f0..0000000
--- a/WebKitTools/DrawTest/DrawTestInspectorController.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2005 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.
- */
-
-#import <Cocoa/Cocoa.h>
-
-
-@interface DrawTestInspectorController : NSObject {
- IBOutlet NSPanel *_inspectorPanel;
-}
-
-+ (id)sharedInstance;
-
-- (IBAction)showInspectorPanel:(id)sender;
-
-@end
diff --git a/WebKitTools/DrawTest/DrawTestToolbarController.m b/WebKitTools/DrawTest/DrawTestToolbarController.m
deleted file mode 100644
index 9190252..0000000
--- a/WebKitTools/DrawTest/DrawTestToolbarController.m
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
- * Copyright (C) 2006 Nefaur Khandker <nefaurk@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.
- */
-
-#import "DrawTestToolbarController.h"
-
-enum
-{
- ToolbarBrowseToolTag = 0,
- ToolbarPanToolTag,
- ToolbarZoomToolTag,
-
- ToolbarPointerToolTag,
- ToolbarLineToolTag,
- ToolbarRectangleToolTag,
- ToolbarElipseToolTag,
- ToolbarTriangleToolTag,
- ToolbarPolyLineToolTag,
- ToolbarArcToolTag,
-
- ToolbarDeleteSelectionTag,
-
- ToolbarMoveForwardTag,
- ToolbarMoveBackwardTag,
- ToolbarMoveToFrontTag,
- ToolbarMoveToBackTag,
- ToolbarMiscItem
-};
-
-// Constants
-NSString *ToolbarIdentifier = @"Main Document Toolbar";
-
-NSString *ToolbarBrowseToolIdentifier = @"Browse";
-NSString *ToolbarPanToolIdentifier = @"Pan";
-NSString *ToolbarZoomToolIdentifier = @"Zoom";
-
-NSString *ToolbarPointerToolIdentifier = @"Pointer";
-NSString *ToolbarRectangleToolIdentifier = @"Rectangle";
-NSString *ToolbarElipseToolIdentifier = @"Oval";
-NSString *ToolbarTriangleToolIdentifier = @"Triangle";
-NSString *ToolbarPolyLineToolIdentifier = @"PolyLine";
-NSString *ToolbarArcToolIdentifier = @"Arc";
-
-NSString *ToolbarDeleteShapeIdentifier = @"Delete";
-NSString *ToolbarMoveForwardIdentifier = @"Forward";
-NSString *ToolbarMoveBackwardIdentifier = @"Backward";
-NSString *ToolbarMoveToFrontIdentifier = @"Front";
-NSString *ToolbarMoveToBackIdentifier = @"Back";
-
-NSString *ToolbarPointerToolImage = @"Toolbar_Pointer";
-NSString *ToolbarRectangleToolImage = @"Toolbar_Rectangle";
-NSString *ToolbarElipseToolImage = @"Toolbar_Oval";
-NSString *ToolbarTriangleToolImage = @"Toolbar_Triangle";
-
-NSString *ToolbarDeleteShapeImage = @"Toolbar_Delete";
-NSString *ToolbarMoveForwardImage = @"Toolbar_Forward";
-NSString *ToolbarMoveBackwardImage = @"Toolbar_Backward";
-NSString *ToolbarMoveToFrontImage = @"Toolbar_Front";
-NSString *ToolbarMoveToBackImage = @"Toolbar_Back";
-
-@interface DrawTestToolbarController (InternalMethods)
-- (void)setupToolbar;
-- (void)addToolbarItemWithIdentifier:(NSString *)identifier withImage:(NSString *)image withTag:(int)tag;
-- (void)addToolbarItemWithIdentifier:(NSString *)identifier withImage:(NSString *)image;
-- (void)addToolbarItem:(NSString *)identifier
- withLabel:(NSString *)label
- withPaletteLabel:(NSString *)paletteLabel
- withImage:(NSString *)imageName
- withToolTip:(NSString *)toolTip
- withTag:(int)tag;
-@end
-
-
-@implementation DrawTestToolbarController
-
-- (id)initWithDrawView:(WebView *)drawView
-{
- if (self = [super init]){
- _drawView = [drawView retain];
- [self setupToolbar]; // could be done lazily.
- }
- return self;
-}
-
-- (void)dealloc
-{
- [_toolbarItems release];
- [super dealloc];
-}
-
-
-- (void)addToolbarItemWithIdentifier:(NSString *)identifier withImage:(NSString *)image withTag:(int)tag
-{
-
- [self addToolbarItem:identifier
- withLabel:identifier
- withPaletteLabel:identifier
- withImage:image
- withToolTip:identifier
- withTag:tag];
-}
-
-- (void)addToolbarItemWithIdentifier:(NSString *)identifier withImage:(NSString *)image
-{
- [self addToolbarItemWithIdentifier:identifier withImage:image withTag:ToolbarMiscItem];
-}
-
-- (void)addToolbarItem:(NSString *)identifier
- withLabel:(NSString *)label
- withPaletteLabel:(NSString *)paletteLabel
- withImage:(NSString *)imageName
- withToolTip:(NSString *)toolTip
- withTag:(int)tag
-{
- NSToolbarItem *item = [[[NSToolbarItem alloc] initWithItemIdentifier:identifier] autorelease];
-
- [item setLabel:label];
- [item setPaletteLabel:paletteLabel];
- [item setToolTip:toolTip];
- [item setImage:[NSImage imageNamed:imageName]];
- [item setTarget:self];
- [item setAction:@selector(clickedToolbarItem:)];
- [item setTag:tag];
-
- [_toolbarItems setObject:item forKey:identifier];
-}
-
-- (void)setupToolbar
-{
- _toolbarItems = [[NSMutableDictionary alloc] init];
-
- [self addToolbarItemWithIdentifier:ToolbarBrowseToolIdentifier
- withImage:ToolbarPointerToolImage
- withTag:ToolbarBrowseToolTag];
- [[_toolbarItems objectForKey:ToolbarBrowseToolIdentifier] setImage:[[NSCursor pointingHandCursor] image]];
-
- [self addToolbarItemWithIdentifier:ToolbarPanToolIdentifier
- withImage:ToolbarPointerToolImage
- withTag:ToolbarPanToolTag];
- [[_toolbarItems objectForKey:ToolbarPanToolIdentifier] setImage:[[NSCursor openHandCursor] image]];
-
- [self addToolbarItemWithIdentifier:ToolbarZoomToolIdentifier
- withImage:ToolbarPointerToolImage
- withTag:ToolbarZoomToolTag];
-
-
- [self addToolbarItemWithIdentifier:ToolbarPointerToolIdentifier
- withImage:ToolbarPointerToolImage
- withTag:ToolbarPointerToolTag];
-
- [self addToolbarItemWithIdentifier:ToolbarRectangleToolIdentifier
- withImage:ToolbarRectangleToolImage
- withTag:ToolbarRectangleToolTag];
-
- [self addToolbarItemWithIdentifier:ToolbarElipseToolIdentifier
- withImage:ToolbarElipseToolImage
- withTag:ToolbarElipseToolTag];
-
- [self addToolbarItemWithIdentifier:ToolbarTriangleToolIdentifier
- withImage:ToolbarTriangleToolImage
- withTag:ToolbarTriangleToolTag];
-
- [self addToolbarItemWithIdentifier:ToolbarDeleteShapeIdentifier
- withImage:ToolbarDeleteShapeImage
- withTag:ToolbarDeleteSelectionTag];
-
- [self addToolbarItemWithIdentifier:ToolbarMoveForwardIdentifier
- withImage:ToolbarMoveForwardImage
- withTag:ToolbarMoveForwardTag];
-
- [self addToolbarItemWithIdentifier:ToolbarMoveBackwardIdentifier
- withImage:ToolbarMoveBackwardImage
- withTag:ToolbarMoveBackwardTag];
-
- [self addToolbarItemWithIdentifier:ToolbarMoveToFrontIdentifier
- withImage:ToolbarMoveToFrontImage
- withTag:ToolbarMoveToFrontTag];
-
- [self addToolbarItemWithIdentifier:ToolbarMoveToBackIdentifier
- withImage:ToolbarMoveToBackImage
- withTag:ToolbarMoveToBackTag];
-
-
- NSToolbar *toolbar = [[[NSToolbar alloc] initWithIdentifier:ToolbarIdentifier] autorelease];
-
- [toolbar setAllowsUserCustomization:YES];
- [toolbar setAutosavesConfiguration:YES];
- [toolbar setDisplayMode:NSToolbarDisplayModeIconAndLabel];
- [toolbar setSizeMode:NSToolbarSizeModeSmall];
- [toolbar setDisplayMode:NSToolbarDisplayModeLabelOnly];
- [toolbar setDelegate:self];
- [toolbar setSelectedItemIdentifier:ToolbarBrowseToolIdentifier];
- [toolbar setVisible:NO];
-
- [[_drawView window] setToolbar:toolbar];
-}
-
-
-- (void)clickedToolbarItem:(id)sender
-{
- int tag = [sender tag];
-
- switch(tag) {
-#if 0
- case ToolbarBrowseToolTag:
- [_drawView setToolMode:DrawViewToolBrowse];
- break;
- case ToolbarPanToolTag:
- [_drawView setToolMode:DrawViewToolPan];
- break;
- case ToolbarZoomToolTag:
- [_drawView setToolMode:DrawViewToolZoom];
- break;
- case ToolbarPointerToolTag:
- [_drawView setToolMode:DrawViewToolArrow];
- break;
- case ToolbarRectangleToolTag:
- [_drawView setToolMode:DrawViewToolRectangle];
- break;
- case ToolbarElipseToolTag:
- [_drawView setToolMode:DrawViewToolElipse];
- break;
- case ToolbarTriangleToolTag:
- [_drawView setToolMode:DrawViewToolTriangle];
- break;
- case ToolbarMoveForwardTag:
- [_drawView moveSelectionForward:sender];
- break;
- case ToolbarMoveBackwardTag:
- [_drawView moveSelectionBackward:sender];
- break;
- case ToolbarDeleteSelectionTag:
- [_drawView deleteSelection:sender];
- break;
-#endif
- default:
- NSLog(@"Toolbar item: %i not implemented!", tag);
- }
-
- [_drawView setNeedsDisplay:YES];
-}
-
-// NSToolbar delegate methods
-- (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdent
- willBeInsertedIntoToolbar:(BOOL)willBeInserted
-{
- NSToolbarItem * toolbarItem = [_toolbarItems objectForKey:itemIdent];
-
- if( toolbarItem == nil )
- toolbarItem = [[[NSToolbarItem alloc] initWithItemIdentifier:itemIdent] autorelease];
-
- return toolbarItem;
-}
-
-- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar
-{
- return [NSArray arrayWithObjects:
- ToolbarBrowseToolIdentifier,
- ToolbarPanToolIdentifier,
- ToolbarZoomToolIdentifier,
- ToolbarPointerToolIdentifier,
- ToolbarRectangleToolIdentifier,
- ToolbarElipseToolIdentifier,
- ToolbarTriangleToolIdentifier,
- ToolbarDeleteShapeIdentifier,
- NSToolbarShowColorsItemIdentifier,
- ToolbarMoveForwardIdentifier,
- ToolbarMoveBackwardIdentifier,
- ToolbarMoveToFrontIdentifier,
- ToolbarMoveToBackIdentifier,
- NSToolbarCustomizeToolbarItemIdentifier,
- NSToolbarFlexibleSpaceItemIdentifier,
- NSToolbarSpaceItemIdentifier,
- NSToolbarSeparatorItemIdentifier, nil];
-}
-
-- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar *)toolbar
-{
- return [NSArray arrayWithObjects:
- ToolbarBrowseToolIdentifier,
- ToolbarPanToolIdentifier,
- //ToolbarZoomToolIdentifier,
- NSToolbarFlexibleSpaceItemIdentifier,
- ToolbarPointerToolIdentifier,
- ToolbarRectangleToolIdentifier,
- ToolbarElipseToolIdentifier,
- //ToolbarTriangleToolIdentifier,
- //NSToolbarSeparatorItemIdentifier,
- ToolbarDeleteShapeIdentifier,
- //ToolbarMoveForwardIdentifier,
- //ToolbarMoveBackwardIdentifier,
- //ToolbarMoveToFrontIdentifier,
- //ToolbarMoveToBackIdentifier,
- NSToolbarSeparatorItemIdentifier,
- //NSToolbarShowColorsItemIdentifier,
- //NSToolbarFlexibleSpaceItemIdentifier,
- NSToolbarCustomizeToolbarItemIdentifier,
- nil];
-}
-
-- (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar
-{
- return [NSArray arrayWithObjects:
- ToolbarBrowseToolIdentifier,
- ToolbarPanToolIdentifier,
- ToolbarZoomToolIdentifier,
- ToolbarPointerToolIdentifier,
- ToolbarRectangleToolIdentifier,
- ToolbarElipseToolIdentifier,
- ToolbarTriangleToolIdentifier,
- nil];
-}
-
-- (BOOL)validateToolbarItem:(NSToolbarItem *)theItem
-{
- BOOL enabled = YES;
-
-#if 0
- switch([theItem tag]) {
- case ToolbarMoveForwardTag:
- case ToolbarMoveBackwardTag:
- case ToolbarMoveToFrontTag:
- case ToolbarMoveToBackTag:
- case ToolbarDeleteSelectionTag:
- enabled = ([[_drawView selectedCanvasItems] count] != 0);
- }
-#endif
-
- return enabled;
-}
-
-@end
diff --git a/WebKitTools/DrawTest/DrawTestView.h b/WebKitTools/DrawTest/DrawTestView.h
deleted file mode 100644
index 95d5956..0000000
--- a/WebKitTools/DrawTest/DrawTestView.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
- * Copyright (C) 2006 Nefaur Khandker <nefaurk@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.
- */
-
-#import <Cocoa/Cocoa.h>
-
-#import <WebKit/WebView.h>
-
-@interface DrawTestView : WebView
-{
-
-}
-
-- (void)setDocument:(NSURL *)documentURL;
-
-@end
diff --git a/WebKitTools/DrawTest/DrawTest_Prefix.pch b/WebKitTools/DrawTest/DrawTest_Prefix.pch
deleted file mode 100644
index 8393f01..0000000
--- a/WebKitTools/DrawTest/DrawTest_Prefix.pch
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2005 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.
- */
-
-//
-// Prefix header for all source files of the 'DrawTest' target in the 'DrawTest' project
-//
-
-#ifdef __OBJC__
-#import <Cocoa/Cocoa.h>
-
-#define foreacharray(__variable, __container) \
- for (int __variable##__i=0, __variable##__n=[__container count]; \
- __variable##__i < __variable##__n && (__variable = [__container objectAtIndex:__variable##__i]); \
- ++__variable##__i)
-#endif
diff --git a/WebKitTools/DrawTest/English.lproj/DrawTestDocument.nib/classes.nib b/WebKitTools/DrawTest/English.lproj/DrawTestDocument.nib/classes.nib
deleted file mode 100644
index 296ffc3..0000000
--- a/WebKitTools/DrawTest/English.lproj/DrawTestDocument.nib/classes.nib
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- IBClasses = (
- {
- ACTIONS = {toggleShowDebugAxes = id; toggleShowDebugString = id; };
- CLASS = DrawTestView;
- LANGUAGE = ObjC;
- SUPERCLASS = DrawView;
- },
- {
- ACTIONS = {
- deleteSelection = id;
- moveSelectionBackward = id;
- moveSelectionForward = id;
- zoomIn = id;
- zoomOriginal = id;
- zoomOut = id;
- zoomToFit = id;
- };
- CLASS = DrawView;
- LANGUAGE = ObjC;
- SUPERCLASS = NSView;
- },
- {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
- {
- ACTIONS = {dumpSVGToConsole = id; };
- CLASS = MyDocument;
- LANGUAGE = ObjC;
- OUTLETS = {drawView = KCanvasTestView; };
- SUPERCLASS = NSDocument;
- },
- {CLASS = NSSegmentedControl; LANGUAGE = ObjC; SUPERCLASS = NSControl; }
- );
- IBVersion = 1;
-} \ No newline at end of file
diff --git a/WebKitTools/DrawTest/English.lproj/DrawTestDocument.nib/info.nib b/WebKitTools/DrawTest/English.lproj/DrawTestDocument.nib/info.nib
deleted file mode 100644
index 3c96fd5..0000000
--- a/WebKitTools/DrawTest/English.lproj/DrawTestDocument.nib/info.nib
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>IBDocumentLocation</key>
- <string>86 30 356 240 0 0 1024 746 </string>
- <key>IBEditorPositions</key>
- <dict>
- <key>50</key>
- <string>377 327 270 342 0 0 1024 746 </string>
- </dict>
- <key>IBFramework Version</key>
- <string>437.0</string>
- <key>IBOpenObjects</key>
- <array>
- <integer>50</integer>
- <integer>5</integer>
- </array>
- <key>IBSystem Version</key>
- <string>8C42</string>
-</dict>
-</plist>
diff --git a/WebKitTools/DrawTest/English.lproj/DrawTestDocument.nib/keyedobjects.nib b/WebKitTools/DrawTest/English.lproj/DrawTestDocument.nib/keyedobjects.nib
deleted file mode 100644
index b78ff2c..0000000
--- a/WebKitTools/DrawTest/English.lproj/DrawTestDocument.nib/keyedobjects.nib
+++ /dev/null
Binary files differ
diff --git a/WebKitTools/DrawTest/English.lproj/InfoPlist.strings b/WebKitTools/DrawTest/English.lproj/InfoPlist.strings
deleted file mode 100644
index 0a7822d..0000000
--- a/WebKitTools/DrawTest/English.lproj/InfoPlist.strings
+++ /dev/null
Binary files differ
diff --git a/WebKitTools/DrawTest/English.lproj/Inspector.nib/classes.nib b/WebKitTools/DrawTest/English.lproj/Inspector.nib/classes.nib
deleted file mode 100644
index 725f5a4..0000000
--- a/WebKitTools/DrawTest/English.lproj/Inspector.nib/classes.nib
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- IBClasses = (
- {
- CLASS = DrawTestInspectorController;
- LANGUAGE = ObjC;
- OUTLETS = {"_inspectorPanel" = NSPanel; };
- SUPERCLASS = NSObject;
- },
- {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
- );
- IBVersion = 1;
-} \ No newline at end of file
diff --git a/WebKitTools/DrawTest/English.lproj/Inspector.nib/info.nib b/WebKitTools/DrawTest/English.lproj/Inspector.nib/info.nib
deleted file mode 100644
index d930763..0000000
--- a/WebKitTools/DrawTest/English.lproj/Inspector.nib/info.nib
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>IBDocumentLocation</key>
- <string>261 184 356 240 0 0 1024 746 </string>
- <key>IBFramework Version</key>
- <string>437.0</string>
- <key>IBOpenObjects</key>
- <array>
- <integer>7</integer>
- </array>
- <key>IBSystem Version</key>
- <string>8B9</string>
-</dict>
-</plist>
diff --git a/WebKitTools/DrawTest/English.lproj/Inspector.nib/keyedobjects.nib b/WebKitTools/DrawTest/English.lproj/Inspector.nib/keyedobjects.nib
deleted file mode 100644
index 02869ca..0000000
--- a/WebKitTools/DrawTest/English.lproj/Inspector.nib/keyedobjects.nib
+++ /dev/null
Binary files differ
diff --git a/WebKitTools/DrawTest/English.lproj/MainMenu.nib/classes.nib b/WebKitTools/DrawTest/English.lproj/MainMenu.nib/classes.nib
deleted file mode 100644
index c0ca441..0000000
--- a/WebKitTools/DrawTest/English.lproj/MainMenu.nib/classes.nib
+++ /dev/null
@@ -1,44 +0,0 @@
-{
- IBClasses = (
- {
- ACTIONS = {showImageRepTestWindow = id; showInspectorPanel = id; showTestsPanel = id; };
- CLASS = AppDelegate;
- LANGUAGE = ObjC;
- OUTLETS = {svgImageRepTestWindow = NSWindow; };
- SUPERCLASS = NSObject;
- },
- {
- ACTIONS = {
- dumpSVGToConsole = id;
- openSelectionInViewer = id;
- openSourceForSelection = id;
- runWindowResizeTest = id;
- showCompositeWindow = id;
- showImageRepTestWindow = id;
- showInspectorPanel = id;
- showTestsPanel = id;
- toggleDebugDrawer = id;
- toggleFilterSupport = id;
- toggleShowDebugAxes = id;
- toggleShowDebugString = id;
- toggleViewersScaleRule = id;
- zoomIn = id;
- zoomOriginal = id;
- zoomOut = id;
- zoomToContent = id;
- };
- CLASS = FirstResponder;
- LANGUAGE = ObjC;
- SUPERCLASS = NSObject;
- },
- {CLASS = KCanvasTestView; LANGUAGE = ObjC; SUPERCLASS = NSView; },
- {
- ACTIONS = {dumpSVGToConsole = id; };
- CLASS = MyDocument;
- LANGUAGE = ObjC;
- OUTLETS = {canvasView = KCanvasTestView; };
- SUPERCLASS = NSDocument;
- }
- );
- IBVersion = 1;
-} \ No newline at end of file
diff --git a/WebKitTools/DrawTest/English.lproj/MainMenu.nib/info.nib b/WebKitTools/DrawTest/English.lproj/MainMenu.nib/info.nib
deleted file mode 100644
index 9b783e0..0000000
--- a/WebKitTools/DrawTest/English.lproj/MainMenu.nib/info.nib
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>IBDocumentLocation</key>
- <string>274 58 356 240 0 0 1024 746 </string>
- <key>IBEditorPositions</key>
- <dict>
- <key>29</key>
- <string>128 678 355 44 0 0 1024 746 </string>
- </dict>
- <key>IBFramework Version</key>
- <string>439.0</string>
- <key>IBOpenObjects</key>
- <array>
- <integer>29</integer>
- </array>
- <key>IBSystem Version</key>
- <string>8C32</string>
-</dict>
-</plist>
diff --git a/WebKitTools/DrawTest/English.lproj/MainMenu.nib/keyedobjects.nib b/WebKitTools/DrawTest/English.lproj/MainMenu.nib/keyedobjects.nib
deleted file mode 100644
index 642b5ae..0000000
--- a/WebKitTools/DrawTest/English.lproj/MainMenu.nib/keyedobjects.nib
+++ /dev/null
Binary files differ
diff --git a/WebKitTools/DrawTest/English.lproj/TestViewer.nib/classes.nib b/WebKitTools/DrawTest/English.lproj/TestViewer.nib/classes.nib
deleted file mode 100644
index eb82ec7..0000000
--- a/WebKitTools/DrawTest/English.lproj/TestViewer.nib/classes.nib
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- IBClasses = (
- {CLASS = DrawView; LANGUAGE = ObjC; SUPERCLASS = NSView; },
- {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
- {CLASS = KCanvasTestView; LANGUAGE = ObjC; SUPERCLASS = NSView; },
- {CLASS = MyImageView; LANGUAGE = ObjC; SUPERCLASS = NSImageView; },
- {
- ACTIONS = {
- browse = id;
- jumpToParentDirectory = id;
- openSelectionInViewer = id;
- openSourceForSelection = id;
- openTestViewerForSelection = id;
- showCompositeWindow = id;
- showTestWindow = id;
- showTestsPanel = id;
- toggleViewersScaleRule = id;
- };
- CLASS = TestController;
- LANGUAGE = ObjC;
- OUTLETS = {
- "_compositeImageView" = NSImageView;
- "_compositeWindow" = NSWindow;
- "_parentDirectoryPopup" = NSPopUpButton;
- "_splitView" = TestViewerSplitView;
- "_testPanel" = NSPanel;
- "_testWindow" = NSWindow;
- "_testsArrayController" = NSArrayController;
- "_testsTableView" = NSTableView;
- };
- SUPERCLASS = NSObject;
- },
- {CLASS = TestViewerSplitView; LANGUAGE = ObjC; SUPERCLASS = NSView; }
- );
- IBVersion = 1;
-} \ No newline at end of file
diff --git a/WebKitTools/DrawTest/English.lproj/TestViewer.nib/info.nib b/WebKitTools/DrawTest/English.lproj/TestViewer.nib/info.nib
deleted file mode 100644
index ca801e8..0000000
--- a/WebKitTools/DrawTest/English.lproj/TestViewer.nib/info.nib
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>IBDocumentLocation</key>
- <string>263 119 356 240 0 0 1024 746 </string>
- <key>IBFramework Version</key>
- <string>437.0</string>
- <key>IBOpenObjects</key>
- <array>
- <integer>24</integer>
- <integer>60</integer>
- </array>
- <key>IBSystem Version</key>
- <string>8C26</string>
-</dict>
-</plist>
diff --git a/WebKitTools/DrawTest/English.lproj/TestViewer.nib/keyedobjects.nib b/WebKitTools/DrawTest/English.lproj/TestViewer.nib/keyedobjects.nib
deleted file mode 100644
index 46b8964..0000000
--- a/WebKitTools/DrawTest/English.lproj/TestViewer.nib/keyedobjects.nib
+++ /dev/null
Binary files differ
diff --git a/WebKitTools/DrawTest/Info.plist b/WebKitTools/DrawTest/Info.plist
deleted file mode 100644
index 0fd092b..0000000
--- a/WebKitTools/DrawTest/Info.plist
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>CFBundleDevelopmentRegion</key>
- <string>English</string>
- <key>CFBundleDocumentTypes</key>
- <array>
- <dict>
- <key>CFBundleTypeExtensions</key>
- <array>
- <string>svg</string>
- </array>
- <key>CFBundleTypeName</key>
- <string>SVG Document</string>
- <key>CFBundleTypeOSTypes</key>
- <array>
- <string>????</string>
- </array>
- <key>CFBundleTypeRole</key>
- <string>Editor</string>
- <key>LSTypeIsPackage</key>
- <false/>
- <key>NSDocumentClass</key>
- <string>DrawTestDocument</string>
- <key>NSPersistentStoreTypeKey</key>
- <string>Binary</string>
- </dict>
- </array>
- <key>CFBundleExecutable</key>
- <string>DrawTest</string>
- <key>CFBundleGetInfoString</key>
- <string>420+, Copyright 2005, 2006 Apple Computer, Inc.</string>
- <key>CFBundleIdentifier</key>
- <string>com.apple.DrawTest</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundlePackageType</key>
- <string>APPL</string>
- <key>CFBundleSignature</key>
- <string>????</string>
- <key>CFBundleVersion</key>
- <string>1.0</string>
- <key>NSMainNibFile</key>
- <string>MainMenu</string>
- <key>NSPrincipalClass</key>
- <string>NSApplication</string>
-</dict>
-</plist>
diff --git a/WebKitTools/DrawTest/SVGTest.h b/WebKitTools/DrawTest/SVGTest.h
deleted file mode 100644
index 70eed41..0000000
--- a/WebKitTools/DrawTest/SVGTest.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
- * Copyright (C) 2006 Nefaur Khandker <nefaurk@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.
- */
-
-#import <Cocoa/Cocoa.h>
-
-@interface SVGTest : NSObject {
- NSString *_svgPath;
- NSString *_imagePath;
-
- NSImage *_image;
- NSImage *_compositeImage;
- BOOL _hasPassed;
-}
-
-+ (id)testWithSVGPath:(NSString *)svgPath imagePath:(NSString *)imagePath;
-- (id)initWithSVGPath:(NSString *)svgPath imagePath:(NSString *)imagePath;
-
-- (NSString *)imagePath;
-- (NSString *)svgPath;
-
-- (NSImage *)image;
-- (NSImage *)compositeImage;
-- (NSString *)name;
-
-@end
diff --git a/WebKitTools/DrawTest/SVGTest.m b/WebKitTools/DrawTest/SVGTest.m
deleted file mode 100644
index 4ea562d..0000000
--- a/WebKitTools/DrawTest/SVGTest.m
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
- * Copyright (C) 2006 Nefaur Khandker <nefaurk@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.
- */
-
-#import "SVGTest.h"
-
-#import <WebKit/WebView.h>
-
-@implementation SVGTest
-
-+ (id)testWithSVGPath:(NSString *)svgPath imagePath:(NSString *)imagePath
-{
- SVGTest *test = [[self alloc] initWithSVGPath:svgPath imagePath:imagePath];
- return [test autorelease];
-}
-
-static WebView *__sharedDrawView = nil;
-+ (WebView *)sharedDrawView
-{
- if (!__sharedDrawView) {
- __sharedDrawView = [[WebView alloc] initWithFrame:NSMakeRect(0,0,0,0)];
- }
- return __sharedDrawView;
-}
-
-- (id)initWithSVGPath:(NSString *)svgPath imagePath:(NSString *)imagePath
-{
- if (self = [super init]) {
- _svgPath = [svgPath copy];
- _imagePath = [imagePath copy];
- }
- return self;
-}
-
-- (NSString *)imagePath
-{
- return _imagePath;
-}
-
-- (NSString *)svgPath
-{
- return _svgPath;
-}
-
-- (NSImage *)image
-{
- if (!_image && _imagePath) {
- _image = [[NSImage alloc] initByReferencingFile:_imagePath];
- }
- return _image;
-}
-
-- (NSString *)name
-{
- NSMutableString *name = [[[[_svgPath lastPathComponent] stringByDeletingPathExtension] mutableCopy] autorelease];
- [name replaceOccurrencesOfString:@"_" withString:@" " options:0 range:NSMakeRange(0, [name length])];
- return [name capitalizedString];
-}
-
-- (void)generateCompositeIfNecessary
-{
- if (!_compositeImage) {
- WebView *view = [SVGTest sharedDrawView];
- NSSize svgSize = [view bounds].size;
-
- NSImage *image = [self image];
- NSSize imageSize = [image size];
-
- NSBitmapImageRep *svgImage = [view bitmapImageRepForCachingDisplayInRect:[view bounds]];
- [view cacheDisplayInRect:[view bounds] toBitmapImageRep:svgImage];
-
- NSSize unionSize = NSMakeSize(MAX(svgSize.width, imageSize.width), MAX(svgSize.height, imageSize.height));
- _compositeImage = [[NSImage alloc] initWithSize:unionSize];
-
- [_compositeImage lockFocus];
- [svgImage drawInRect:NSMakeRect(0,0,svgSize.width,svgSize.height)];
- [image drawInRect:NSMakeRect(0,0,imageSize.width,imageSize.height)
- fromRect:NSMakeRect(0,0,imageSize.width,imageSize.height)
- operation:NSCompositeXOR fraction:1.0];
- [_compositeImage unlockFocus];
- }
-}
-
-- (NSImage *)compositeImage
-{
- [self generateCompositeIfNecessary];
- return _compositeImage;
-}
-
-
-@end
diff --git a/WebKitTools/DrawTest/TestController.h b/WebKitTools/DrawTest/TestController.h
deleted file mode 100644
index 1e781fe..0000000
--- a/WebKitTools/DrawTest/TestController.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
- * Copyright (C) 2006 Nefaur Khandker <nefaurk@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.
- */
-
-#import <Cocoa/Cocoa.h>
-
-@class DrawTestView;
-@class SVGTest;
-@class TestViewerSplitView;
-
-@interface TestController : NSObject {
- IBOutlet NSPanel *_testPanel;
- IBOutlet NSWindow *_testWindow;
- IBOutlet TestViewerSplitView *_splitView;
-
- IBOutlet NSArrayController *_testsArrayController;
- IBOutlet NSPopUpButton *_parentDirectoryPopup;
- IBOutlet NSTableView *_testsTableView;
-
- IBOutlet NSWindow *_compositeWindow;
- IBOutlet NSImageView *_compositeImageView;
-
-@private
- NSString *_currentPath;
- NSArray *_tests;
- SVGTest *_selectedTest;
-
- DrawTestView *_drawView;
- NSImageView *_imageView;
-}
-
-+ (id)sharedController;
-
-- (IBAction)showTestsPanel:(id)sender;
-- (IBAction)showTestWindow:(id)sender;
-- (IBAction)showCompositeWindow:(id)sender;
-
-- (IBAction)browse:(id)sender;
-- (IBAction)jumpToParentDirectory:(id)sender;
-- (IBAction)openTestViewerForSelection:(id)sender;
-- (IBAction)openSourceForSelection:(id)sender;
-- (IBAction)openSelectionInViewer:(id)sender;
-- (IBAction)toggleViewersScaleRule:(id)sender;
-
-- (NSArray *)tests;
-- (NSString *)currentPath;
-- (void)setCurrentPath:(NSString *)newPath;
-- (NSArray *)directoryHierarchy;
-
-@end
diff --git a/WebKitTools/DrawTest/TestController.m b/WebKitTools/DrawTest/TestController.m
deleted file mode 100644
index 506920b..0000000
--- a/WebKitTools/DrawTest/TestController.m
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
- * Copyright (C) 2006 Nefaur Khandker <nefaurk@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.
- */
-
-#import "TestController.h"
-#import "SVGTest.h"
-#import "TestViewerSplitView.h"
-#import "ScalingImageView.h"
-#import "DrawTestView.h"
-
-#import <WebKit/WebView.h>
-
-@interface NSArray (TestControllerAdditions)
-- (id)firstObject;
-@end
-
-@implementation NSArray (TestControllerAdditions)
-- (id)firstObject
-{
- if ([self count])
- return [self objectAtIndex:0];
- return nil;
-}
-@end
-
-static TestController *__sharedInstance = nil;
-
-@implementation TestController
-
-- (id)init
-{
- if (self = [super init]) {
- NSString *path = [[NSUserDefaults standardUserDefaults] objectForKey:@"TestDirectory"];
- BOOL isDirectory = NO;
- if (![[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory] || !isDirectory) {
- path = [@"~" stringByStandardizingPath];
- }
- [self setCurrentPath:path];
- }
- return self;
-}
-
-+ (void)initialize
-{
- [self setKeys:[NSArray arrayWithObject:@"currentPath"] triggerChangeNotificationsForDependentKey:@"directoryHierarchy"];
- [self setKeys:[NSArray arrayWithObject:@"currentPath"] triggerChangeNotificationsForDependentKey:@"tests"];
-}
-
-+ (id)sharedController
-{
- if (!__sharedInstance) {
- __sharedInstance = [[self alloc] init];
- }
- return __sharedInstance;
-}
-
-- (void)loadNibIfNecessary
-{
- if (!_testPanel) {
- [NSBundle loadNibNamed:@"TestViewer" owner:self];
- }
-}
-
-- (void)awakeFromNib
-{
- [_testsTableView setTarget:self];
- [_testsTableView setDoubleAction:@selector(openTestViewerForSelection:)];
- _drawView = [[DrawTestView alloc] initWithFrame:NSZeroRect];
- _imageView = [[ScalingImageView alloc] initWithFrame:NSZeroRect];
- [_splitView addSubview:_drawView];
- [_splitView addSubview:_imageView];
-}
-
-- (IBAction)showTestsPanel:(id)sender
-{
- [self loadNibIfNecessary];
- [_testPanel makeKeyAndOrderFront:sender];
-}
-
-- (IBAction)showTestWindow:(id)sender
-{
- [self loadNibIfNecessary];
- [_testWindow makeKeyAndOrderFront:sender];
-}
-
-- (IBAction)showCompositeWindow:(id)sender
-{
- [self loadNibIfNecessary];
- NSLog(@"showCompositeWindow: %@", _compositeWindow);
- [_compositeWindow makeKeyAndOrderFront:sender];
-}
-
-- (IBAction)browse:(id)sender
-{
- NSOpenPanel *openPanel = [NSOpenPanel openPanel];
- [openPanel setCanChooseDirectories:YES];
- [openPanel setCanChooseFiles:NO];
- [openPanel beginSheetForDirectory:nil file:nil modalForWindow:_testPanel modalDelegate:self didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:NULL];
-}
-
-- (void)openPanelDidEnd:(NSOpenPanel *)openPanel returnCode:(int)returnCode contextInfo:(void *)contextInfo
-{
- if (returnCode == NSOKButton) {
- NSArray *folders = [openPanel filenames];
- NSString *selectedFolder = [folders firstObject];
- [self setCurrentPath:selectedFolder];
- }
-}
-
-- (IBAction)jumpToParentDirectory:(id)sender
-{
- int index = [_parentDirectoryPopup indexOfSelectedItem];
- NSArray *components = [_currentPath pathComponents];
- NSArray *newComponents = [components subarrayWithRange:NSMakeRange(0, [components count] - index)];
- NSString *newPath = [NSString pathWithComponents:newComponents];
- [self setCurrentPath:newPath];
-}
-
-- (void)setSelectedTest:(SVGTest *)selectedTest
-{
- id oldTest = _selectedTest;
- _selectedTest = [selectedTest retain];
- [oldTest release];
-
- if ([_testWindow isVisible]) {
- [_testWindow setTitle:[NSString stringWithFormat:@"Test Viewer - %@", [_selectedTest name]]];
- [_drawView setDocument:[NSURL fileURLWithPath:[_selectedTest svgPath]]];
- [_imageView setImage:[_selectedTest image]];
- if ([_compositeWindow isVisible])
- [_compositeImageView setImage:[_selectedTest compositeImage]];
- }
-}
-
-- (void)tableViewSelectionDidChange:(NSNotification *)aNotification
-{
- [self setSelectedTest:[[_testsArrayController selectedObjects] firstObject]];
-}
-
-- (IBAction)openTestViewerForSelection:(id)sender
-{
- [self showTestWindow:sender];
- [_drawView setDocument:[NSURL fileURLWithPath:[_selectedTest svgPath]]];
- [_imageView setImage:[_selectedTest image]];
-}
-
-- (IBAction)openSourceForSelection:(id)sender
-{
- [[NSWorkspace sharedWorkspace] openFile:[_selectedTest svgPath] withApplication:@"TextEdit"];
-}
-
-- (IBAction)openSelectionInViewer:(id)sender
-{
- [[NSWorkspace sharedWorkspace] openFile:[_selectedTest svgPath]];
-}
-
-- (NSString *)imagePathForSVGPath:(NSString *)svgPath
-{
- // eventually this code will build an array instead...
-
- NSString *currentDirectory = [self currentPath];
- NSString *parentDirectory = [currentDirectory stringByDeletingLastPathComponent];
-
- NSString *testName = [[svgPath lastPathComponent] stringByDeletingPathExtension];
- NSString *imageName, *imageDirectory, *imagePath;
-
- // first look in ../png/test.png -- SVG 1.1 baselines
- // The SVG 1.1 spec has various different pngs, we should allow the
- // tester to choose...
- imageName = [[@"full-" stringByAppendingString:testName] stringByAppendingPathExtension:@"png"];
- imageDirectory = [parentDirectory stringByAppendingPathComponent:@"png"];
- imagePath = [imageDirectory stringByAppendingPathComponent:imageName];
- if ([[NSFileManager defaultManager] fileExistsAtPath:imagePath]) return imagePath;
-
- // then look for ../name.png -- openclipart.org
- imageName = [testName stringByAppendingPathExtension:@"png"];
- imageDirectory = parentDirectory;
- imagePath = [imageDirectory stringByAppendingPathComponent:imageName];
- if ([[NSFileManager defaultManager] fileExistsAtPath:imagePath]) return imagePath;
-
- // then look for ./name-w3c.png -- WebCore tests
- imageName = [[testName stringByAppendingString:@"-w3c"] stringByAppendingPathExtension:@"png"];
- imageDirectory = currentDirectory;
- imagePath = [imageDirectory stringByAppendingPathComponent:imageName];
- if ([[NSFileManager defaultManager] fileExistsAtPath:imagePath]) return imagePath;
-
- // finally try name-baseline.png -- ksvg regression baselines
- imageName = [[testName stringByAppendingString:@"-baseline"] stringByAppendingPathExtension:@"png"];
- imageDirectory = currentDirectory;
- imagePath = [imageDirectory stringByAppendingPathComponent:imageName];
- if ([[NSFileManager defaultManager] fileExistsAtPath:imagePath]) return imagePath;
-
- return nil;
-}
-
-- (NSArray *)tests
-{
- if (!_tests) {
- NSMutableArray *newTests = [[NSMutableArray alloc] init];
- NSArray *files = [[NSFileManager defaultManager] directoryContentsAtPath:[self currentPath]];
- NSString *file = nil;
- foreacharray(file, files) {
- if ([[file pathExtension] isEqualToString:@"svg"]) {
- NSString *svgPath = [[self currentPath] stringByAppendingPathComponent:file];
- NSString *imagePath = [self imagePathForSVGPath:svgPath];
- [newTests addObject:[SVGTest testWithSVGPath:svgPath imagePath:imagePath]];
- }
- }
- [self setValue:newTests forKey:@"tests"];
- }
- return _tests;
-}
-
-- (NSArray *)directoryHierarchy
-{
- // A hackish way to reverse an array.
- return [[[_currentPath pathComponents] reverseObjectEnumerator] allObjects];
-}
-
-- (NSString *)currentPath
-{
- return _currentPath;
-}
-
-- (void)setCurrentPath:(NSString *)newPath
-{
- if (![newPath isEqualToString:_currentPath]) {
- [_currentPath release];
- _currentPath = [newPath copy];
- [self setValue:nil forKey:@"tests"];
- }
-
- [[NSUserDefaults standardUserDefaults] setObject:_currentPath forKey:@"TestDirectory"];
-}
-
-- (IBAction)toggleViewersScaleRule:(id)sender
-{
-#if 0
- if ([_drawView imageScaling] == NSScaleProportionally) {
- [_drawView setImageScaling:NSScaleNone];
- [_imageView setImageScaling:NSScaleNone];
- } else {
- [_drawView setImageScaling:NSScaleProportionally];
- [_imageView setImageScaling:NSScaleProportionally];
- }
-#endif
-}
-
-@end
diff --git a/WebKitTools/DrawTest/TestViewerSplitView.h b/WebKitTools/DrawTest/TestViewerSplitView.h
deleted file mode 100644
index e663f23..0000000
--- a/WebKitTools/DrawTest/TestViewerSplitView.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2005 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.
- */
-#import <Cocoa/Cocoa.h>
-
-@interface TestViewerSplitView : NSView {
- NSMutableArray *subviewLabels;
-}
-
-@end
diff --git a/WebKitTools/DrawTest/TestViewerSplitView.m b/WebKitTools/DrawTest/TestViewerSplitView.m
deleted file mode 100644
index 96f2055..0000000
--- a/WebKitTools/DrawTest/TestViewerSplitView.m
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2005 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.
- */
-
-#import "TestViewerSplitView.h"
-
-@implementation TestViewerSplitView
-
-- (void)drawRect:(NSRect)rect
-{
- NSArray *subviews = [self subviews];
- int subviewCount = [subviews count];
- for (int x=0; x < subviewCount; x++) {
- NSView *subview = [subviews objectAtIndex:x];
- [subview drawRect:rect];
-#if 0
- NSString *label = [subviewLabels objectAtIndex:0];
- [label drawAtPoint:[subview frame].origin withAttributes:NULL];
-#endif
- }
-}
-
-- (void)retileSubviews
-{
- NSRect bounds = [self bounds];
- NSArray *subviews = [self subviews];
- int subviewCount = [subviews count];
- if (!subviewCount) return;
- float subviewWidth = bounds.size.width / subviewCount;
-
- for (int x=0; x < subviewCount; x++) {
- [[subviews objectAtIndex:x] setFrame:NSMakeRect(x * subviewWidth, 0, subviewWidth, bounds.size.height)];
- }
-}
-
-- (void)didAddSubview:(NSView *)subview
-{
- [super didAddSubview:subview];
- [self retileSubviews];
-}
-
-- (void)willRemoveSubview:(NSView *)subview
-{
- [super willRemoveSubview:subview];
- [self retileSubviews];
-}
-
-- (void)setFrame:(NSRect)newFrame
-{
- // ideally we also want to catch when the bounds changes without the
- // frame changing, but we're not bothering with that now - ECS 7/29/05
- [super setFrame:newFrame];
- [self retileSubviews];
-}
-
-@end
diff --git a/WebKitTools/DrawTest/main.m b/WebKitTools/DrawTest/main.m
deleted file mode 100644
index 90337b6..0000000
--- a/WebKitTools/DrawTest/main.m
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2005 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.
- */
-
-int main (int argc, const char *argv[])
-{
- return NSApplicationMain(argc, argv);
-}
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/LayoutTestController.cpp
index 0537d7c..c2393c3 100644
--- a/WebKitTools/DumpRenderTree/LayoutTestController.cpp
+++ b/WebKitTools/DumpRenderTree/LayoutTestController.cpp
@@ -465,26 +465,34 @@ static JSValueRef notifyDoneCallback(JSContextRef context, JSObjectRef function,
return JSValueMakeUndefined(context);
}
-static JSValueRef pageNumberForElementByIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+static bool parsePageParameters(JSContextRef context, int argumentCount, const JSValueRef* arguments, JSValueRef* exception, float& pageWidthInPixels, float& pageHeightInPixels)
{
// FIXME: These values should sync with maxViewWidth/Height in
// DumpRenderTree.mm. Factor these values out to somewhere.
- float pageWidthInPixels = 800;
- float pageHeightInPixels = 600;
+ pageWidthInPixels = 800;
+ pageHeightInPixels = 600;
switch (argumentCount) {
- case 1:
- break;
- case 3:
- pageWidthInPixels = static_cast<float>(JSValueToNumber(context, arguments[1], exception));
+ case 2:
+ pageWidthInPixels = static_cast<float>(JSValueToNumber(context, arguments[0], exception));
if (*exception)
- return JSValueMakeUndefined(context);
- pageHeightInPixels = static_cast<float>(JSValueToNumber(context, arguments[2], exception));
+ return false;
+ pageHeightInPixels = static_cast<float>(JSValueToNumber(context, arguments[1], exception));
if (*exception)
- return JSValueMakeUndefined(context);
+ return false;
+ case 0: // Fall through.
break;
default:
- return JSValueMakeUndefined(context);
+ return false;
}
+ return true;
+}
+
+static JSValueRef pageNumberForElementByIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ float pageWidthInPixels = 0;
+ float pageHeightInPixels = 0;
+ if (!parsePageParameters(context, argumentCount - 1, arguments + 1, exception, pageWidthInPixels, pageHeightInPixels))
+ return JSValueMakeUndefined(context);
JSRetainPtr<JSStringRef> elementId(Adopt, JSValueToStringCopy(context, arguments[0], exception));
if (*exception)
@@ -495,6 +503,17 @@ static JSValueRef pageNumberForElementByIdCallback(JSContextRef context, JSObjec
return JSValueMakeNumber(context, pageNumber);
}
+static JSValueRef numberOfPagesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ float pageWidthInPixels = 0;
+ float pageHeightInPixels = 0;
+ if (!parsePageParameters(context, argumentCount, arguments, exception, pageWidthInPixels, pageHeightInPixels))
+ return JSValueMakeUndefined(context);
+
+ LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+ return JSValueMakeNumber(context, controller->numberOfPages(pageWidthInPixels, pageHeightInPixels));
+}
+
static JSValueRef queueBackNavigationCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
// Has mac & windows implementation
@@ -897,6 +916,18 @@ static JSValueRef setXSSAuditorEnabledCallback(JSContextRef context, JSObjectRef
return JSValueMakeUndefined(context);
}
+static JSValueRef setFrameSetFlatteningEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ // Has mac & windows implementation
+ if (argumentCount < 1)
+ return JSValueMakeUndefined(context);
+
+ LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+ controller->setFrameSetFlatteningEnabled(JSValueToBoolean(context, arguments[0]));
+
+ return JSValueMakeUndefined(context);
+}
+
static JSValueRef setAllowUniversalAccessFromFileURLsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
// Has mac & windows implementation
@@ -1329,6 +1360,7 @@ JSStaticFunction* LayoutTestController::staticFunctions()
{ "grantDesktopNotificationPermission", grantDesktopNotificationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "isCommandEnabled", isCommandEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "keepWebHistory", keepWebHistoryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "numberOfPages", numberOfPagesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "notifyDone", notifyDoneCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "numberOfActiveAnimations", numberOfActiveAnimationsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "overridePreference", overridePreferenceCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
@@ -1373,6 +1405,7 @@ JSStaticFunction* LayoutTestController::staticFunctions()
{ "setPopupBlockingEnabled", setPopupBlockingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setPrivateBrowsingEnabled", setPrivateBrowsingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setXSSAuditorEnabled", setXSSAuditorEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "setFrameSetFlatteningEnabled", setFrameSetFlatteningEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setSelectTrailingWhitespaceEnabled", setSelectTrailingWhitespaceEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setSmartInsertDeleteEnabled", setSmartInsertDeleteEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setStopProvisionalFrameLoads", setStopProvisionalFrameLoadsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.h b/WebKitTools/DumpRenderTree/LayoutTestController.h
index 76e7cb3..5f9df50 100644
--- a/WebKitTools/DumpRenderTree/LayoutTestController.h
+++ b/WebKitTools/DumpRenderTree/LayoutTestController.h
@@ -56,6 +56,7 @@ public:
bool isCommandEnabled(JSStringRef name);
void keepWebHistory();
void notifyDone();
+ int numberOfPages(float pageWidthInPixels, float pageHeightInPixels);
void overridePreference(JSStringRef key, JSStringRef value);
int pageNumberForElementById(JSStringRef id, float pageWidthInPixels, float pageHeightInPixels);
JSStringRef pathToLocalResource(JSContextRef, JSStringRef url);
@@ -89,6 +90,7 @@ public:
void setUserStyleSheetEnabled(bool flag);
void setUserStyleSheetLocation(JSStringRef path);
void setXSSAuditorEnabled(bool flag);
+ void setFrameSetFlatteningEnabled(bool enable);
void waitForPolicyDelegate();
size_t webHistoryItemCount();
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp
index fa8aed1..e69da73 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp
@@ -133,6 +133,7 @@ enum {
ID_PROPERTY_RETURN_ERROR_FROM_NEWSTREAM,
ID_PROPERTY_PRIVATE_BROWSING_ENABLED,
ID_PROPERTY_CACHED_PRIVATE_BROWSING_ENABLED,
+ ID_PROPERTY_THROW_EXCEPTION_PROPERTY,
NUM_PROPERTY_IDENTIFIERS
};
@@ -146,6 +147,7 @@ static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = {
"returnErrorFromNewStream",
"privateBrowsingEnabled",
"cachedPrivateBrowsingEnabled",
+ "testThrowExceptionProperty"
};
enum {
@@ -172,6 +174,8 @@ enum {
ID_DESTROY_NULL_STREAM,
ID_TEST_RELOAD_PLUGINS_NO_PAGES,
ID_TEST_RELOAD_PLUGINS_AND_PAGES,
+ ID_TEST_GET_BROWSER_PROPERTY,
+ ID_TEST_SET_BROWSER_PROPERTY,
NUM_METHOD_IDENTIFIERS
};
@@ -199,7 +203,9 @@ static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
"testFail",
"destroyNullStream",
"reloadPluginsNoPages",
- "reloadPluginsAndPages"
+ "reloadPluginsAndPages",
+ "testGetBrowserProperty",
+ "testSetBrowserProperty"
};
static NPUTF8* createCStringFromNPVariant(const NPVariant* variant)
@@ -264,6 +270,9 @@ static bool pluginGetProperty(NPObject* obj, NPIdentifier name, NPVariant* resul
} else if (name == pluginPropertyIdentifiers[ID_PROPERTY_CACHED_PRIVATE_BROWSING_ENABLED]) {
BOOLEAN_TO_NPVARIANT(plugin->cachedPrivateBrowsingMode, *result);
return true;
+ } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_THROW_EXCEPTION_PROPERTY]) {
+ browser->setexception(obj, "plugin object testThrowExceptionProperty SUCCESS");
+ return true;
}
return false;
}
@@ -280,6 +289,9 @@ static bool pluginSetProperty(NPObject* obj, NPIdentifier name, const NPVariant*
} else if (name == pluginPropertyIdentifiers[ID_PROPERTY_RETURN_ERROR_FROM_NEWSTREAM]) {
plugin->returnErrorFromNewStream = NPVARIANT_TO_BOOLEAN(*variant);
return true;
+ } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_THROW_EXCEPTION_PROPERTY]) {
+ browser->setexception(obj, "plugin object testThrowExceptionProperty SUCCESS");
+ return true;
}
return false;
@@ -789,6 +801,12 @@ static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* a
} else if (name == pluginMethodIdentifiers[ID_TEST_RELOAD_PLUGINS_AND_PAGES]) {
browser->reloadplugins(true);
return true;
+ } else if (name == pluginMethodIdentifiers[ID_TEST_GET_BROWSER_PROPERTY]) {
+ browser->getproperty(plugin->npp, NPVARIANT_TO_OBJECT(args[0]), stringVariantToIdentifier(args[1]), result);
+ return true;
+ } else if (name == pluginMethodIdentifiers[ID_TEST_SET_BROWSER_PROPERTY]) {
+ browser->setproperty(plugin->npp, NPVARIANT_TO_OBJECT(args[0]), stringVariantToIdentifier(args[1]), &args[2]);
+ return true;
}
return false;
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp
index 5883ffb..8ef228a 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp
@@ -119,8 +119,9 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ch
NPBool supportsCocoa = false;
#ifndef NP_NO_CARBON
+ // A browser that doesn't know about NPNVsupportsCarbonBool is one that only supports Carbon event model.
if (browser->getvalue(instance, NPNVsupportsCarbonBool, &supportsCarbon) != NPERR_NO_ERROR)
- supportsCarbon = false;
+ supportsCarbon = true;
#endif
if (browser->getvalue(instance, NPNVsupportsCocoaBool, &supportsCocoa) != NPERR_NO_ERROR)
diff --git a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
index bad09fb..422e2c2 100644
--- a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
@@ -55,6 +55,7 @@ void webkit_application_cache_set_maximum_size(unsigned long long size);
unsigned int webkit_worker_thread_count(void);
void webkit_white_list_access_from_origin(const gchar* sourceOrigin, const gchar* destinationProtocol, const gchar* destinationHost, bool allowDestinationSubdomains);
gchar* webkit_web_frame_counter_value_for_element_by_id(WebKitWebFrame* frame, const gchar* id);
+int webkit_web_frame_page_number_for_element_by_id(WebKitWebFrame* frame, const gchar* id, float pageWidth, float pageHeight);
void webkit_web_inspector_execute_script(WebKitWebInspector* inspector, long callId, const gchar* script);
}
@@ -140,7 +141,15 @@ void LayoutTestController::keepWebHistory()
// FIXME: implement
}
-int LayoutTestController::pageNumberForElementById(JSStringRef, float, float)
+int LayoutTestController::pageNumberForElementById(JSStringRef id, float pageWidth, float pageHeight)
+{
+ gchar* idGChar = JSStringCopyUTF8CString(id);
+ int pageNumber = webkit_web_frame_page_number_for_element_by_id(mainFrame, idGChar, pageWidth, pageHeight);
+ g_free(idGChar);
+ return pageNumber;
+}
+
+int LayoutTestController::numberOfPages(float, float)
{
// FIXME: implement
return -1;
@@ -325,6 +334,11 @@ void LayoutTestController::setXSSAuditorEnabled(bool flag)
g_object_set(G_OBJECT(settings), "enable-xss-auditor", flag, NULL);
}
+void LayoutTestController::setFrameSetFlatteningEnabled(bool flag)
+{
+ // FIXME: implement
+}
+
void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool flag)
{
WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
diff --git a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
index 12e1941..7a4429b 100644
--- a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
+++ b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
@@ -421,8 +421,8 @@ static void resetDefaultsToConsistentValues()
[preferences setJavaScriptCanOpenWindowsAutomatically:YES];
[preferences setOfflineWebApplicationCacheEnabled:YES];
[preferences setDeveloperExtrasEnabled:NO];
- [preferences setXSSAuditorEnabled:NO];
[preferences setLoadsImagesAutomatically:YES];
+ [preferences setFrameSetFlatteningEnabled:NO];
if (persistentUserStyleSheetLocation) {
[preferences setUserStyleSheetLocation:[NSURL URLWithString:(NSString *)(persistentUserStyleSheetLocation.get())]];
[preferences setUserStyleSheetEnabled:YES];
diff --git a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
index 67c8c91..b726e72 100644
--- a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
+++ b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
@@ -188,6 +188,11 @@ int LayoutTestController::pageNumberForElementById(JSStringRef id, float pageWid
return [mainFrame pageNumberForElement:element:pageWidthInPixels:pageHeightInPixels];
}
+int LayoutTestController::numberOfPages(float pageWidthInPixels, float pageHeightInPixels)
+{
+ return [mainFrame numberOfPages:pageWidthInPixels:pageHeightInPixels];
+}
+
size_t LayoutTestController::webHistoryItemCount()
{
return [[[WebHistory optionalSharedHistory] allItems] count];
@@ -319,6 +324,11 @@ void LayoutTestController::setXSSAuditorEnabled(bool enabled)
[[[mainFrame webView] preferences] setXSSAuditorEnabled:enabled];
}
+void LayoutTestController::setFrameSetFlatteningEnabled(bool enabled)
+{
+ [[[mainFrame webView] preferences] setFrameSetFlatteningEnabled:enabled];
+}
+
void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool enabled)
{
[[[mainFrame webView] preferences] setAllowUniversalAccessFromFileURLs:enabled];
diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
index ca48003..51c1181 100644
--- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
+++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
@@ -37,7 +37,9 @@
#include <qwebsettings.h>
extern void qt_dump_editing_callbacks(bool b);
+extern void qt_dump_frame_loader(bool b);
extern void qt_dump_resource_load_callbacks(bool b);
+extern void qt_drt_setFrameSetFlatteningEnabled(QWebPage*, bool);
extern void qt_drt_setJavaScriptProfilingEnabled(QWebFrame*, bool enabled);
extern bool qt_drt_pauseAnimation(QWebFrame*, const QString& name, double time, const QString& elementId);
extern bool qt_drt_pauseTransitionOfProperty(QWebFrame*, const QString& name, double time, const QString& elementId);
@@ -48,6 +50,7 @@ extern void qt_drt_setDomainRelaxationForbiddenForURLScheme(bool forbidden, cons
extern void qt_drt_whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains);
extern QString qt_drt_counterValueForElementById(QWebFrame* qFrame, const QString& id);
extern int qt_drt_workerThreadCount();
+extern int qt_drt_pageNumberForElementById(QWebFrame* qFrame, const QString& id, float width, float height);
LayoutTestController::LayoutTestController(WebCore::DumpRenderTree* drt)
: QObject()
@@ -75,6 +78,7 @@ void LayoutTestController::reset()
m_webHistory = 0;
m_globalFlag = false;
qt_dump_editing_callbacks(false);
+ qt_dump_frame_loader(false);
qt_dump_resource_load_callbacks(false);
emit hidePage();
}
@@ -201,6 +205,11 @@ void LayoutTestController::dumpEditingCallbacks()
qt_dump_editing_callbacks(true);
}
+void LayoutTestController::dumpFrameLoadCallbacks()
+{
+ qt_dump_frame_loader(true);
+}
+
void LayoutTestController::dumpResourceLoadCallbacks()
{
qt_dump_resource_load_callbacks(true);
@@ -287,6 +296,11 @@ void LayoutTestController::hideWebInspector()
m_drt->webPage()->webInspector()->hide();
}
+void LayoutTestController::setFrameSetFlatteningEnabled(bool enabled)
+{
+ qt_drt_setFrameSetFlatteningEnabled(m_drt->webPage(), enabled);
+}
+
void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool enabled)
{
m_drt->webPage()->settings()->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, enabled);
@@ -421,6 +435,9 @@ void LayoutTestController::overridePreference(const QString& name, const QVarian
settings->setFontSize(QWebSettings::DefaultFontSize, value.toInt());
else if (name == "WebKitUsesPageCachePreferenceKey")
QWebSettings::setMaximumPagesInCache(value.toInt());
+ else
+ printf("ERROR: LayoutTestController::overridePreference() does not support the '%s' preference\n",
+ name.toLatin1().data());
}
void LayoutTestController::setUserStyleSheetLocation(const QString& url)
@@ -445,3 +462,14 @@ int LayoutTestController::workerThreadCount()
{
return qt_drt_workerThreadCount();
}
+
+int LayoutTestController::pageNumberForElementById(const QString& id, float width, float height)
+{
+ // If no size specified, webpage viewport size is used
+ if (!width && !height) {
+ width = m_drt->webPage()->viewportSize().width();
+ height = m_drt->webPage()->viewportSize().height();
+ }
+
+ return qt_drt_pageNumberForElementById(m_drt->webPage()->mainFrame(), id, width, height);
+}
diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
index 365640d..64cbcc9 100644
--- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
+++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
@@ -96,6 +96,7 @@ public slots:
void setGlobalFlag(bool flag) { m_globalFlag = flag; }
void handleErrorPages() { m_handleErrorPages = true; }
void dumpEditingCallbacks();
+ void dumpFrameLoadCallbacks();
void dumpResourceLoadCallbacks();
void queueBackNavigation(int howFarBackward);
void queueForwardNavigation(int howFarForward);
@@ -115,6 +116,8 @@ public slots:
void dumpSelectionRect() const {}
void showWebInspector();
void hideWebInspector();
+
+ void setFrameSetFlatteningEnabled(bool enable);
void setAllowUniversalAccessFromFileURLs(bool enable);
void setJavaScriptProfilingEnabled(bool enable);
void setFixedContentsSize(int width, int height);
@@ -146,6 +149,7 @@ public slots:
void setUserStyleSheetEnabled(bool enabled);
void setDomainRelaxationForbiddenForURLScheme(bool forbidden, const QString& scheme);
int workerThreadCount();
+ int pageNumberForElementById(const QString& id, float width = 0, float height = 0);
private slots:
void processWork();
diff --git a/WebKitTools/DumpRenderTree/qt/main.cpp b/WebKitTools/DumpRenderTree/qt/main.cpp
index 69d3c23..efcda57 100644
--- a/WebKitTools/DumpRenderTree/qt/main.cpp
+++ b/WebKitTools/DumpRenderTree/qt/main.cpp
@@ -48,6 +48,11 @@
#include <fontconfig/fontconfig.h>
#endif
+#ifdef Q_OS_WIN
+#include <io.h>
+#include <fcntl.h>
+#endif
+
#include <limits.h>
#include <signal.h>
@@ -101,6 +106,11 @@ static NO_RETURN void crashHandler(int sig)
int main(int argc, char* argv[])
{
+#ifdef Q_OS_WIN
+ _setmode(1, _O_BINARY);
+ _setmode(2, _O_BINARY);
+#endif
+
#ifdef Q_WS_X11
FcInit();
WebCore::DumpRenderTree::initializeFonts();
diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
index 1315f9e..261b9e6 100644
--- a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
+++ b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
@@ -792,6 +792,7 @@ static void resetDefaultsToConsistentValues(IWebPreferences* preferences)
prefsPrivate->setExperimentalNotificationsEnabled(TRUE);
prefsPrivate->setShouldPaintNativeControls(FALSE); // FIXME - need to make DRT pass with Windows native controls <http://bugs.webkit.org/show_bug.cgi?id=25592>
prefsPrivate->setXSSAuditorEnabled(FALSE);
+ prefsPrivate->setFrameSetFlatteningEnabled(FALSE);
prefsPrivate->setOfflineWebApplicationCacheEnabled(TRUE);
}
setAlwaysAcceptCookies(false);
diff --git a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
index 4f5e925..34fd2e6 100644
--- a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
+++ b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
@@ -372,6 +372,23 @@ void LayoutTestController::setXSSAuditorEnabled(bool enabled)
prefsPrivate->setXSSAuditorEnabled(enabled);
}
+void LayoutTestController::setFrameSetFlatteningEnabled(bool enabled)
+{
+ COMPtr<IWebView> webView;
+ if (FAILED(frame->webView(&webView)))
+ return;
+
+ COMPtr<IWebPreferences> preferences;
+ if (FAILED(webView->preferences(&preferences)))
+ return;
+
+ COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences);
+ if (!prefsPrivate)
+ return;
+
+ prefsPrivate->setFrameSetFlatteningEnabled(enabled);
+}
+
void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool enabled)
{
COMPtr<IWebView> webView;
@@ -1109,3 +1126,9 @@ int LayoutTestController::pageNumberForElementById(JSStringRef, float, float)
// FIXME: implement
return -1;
}
+
+int LayoutTestController::numberOfPages(float, float)
+{
+ // FIXME: implement
+ return -1;
+}
diff --git a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp
index 82b1d4d..08a2f6a 100644
--- a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp
+++ b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp
@@ -71,6 +71,19 @@ NPError __stdcall NP_Shutdown()
return NPERR_NO_ERROR;
}
+static void executeScript(const PluginObject* object, const char* script)
+{
+ NPObject *windowScriptObject;
+ browser->getvalue(object->npp, NPNVWindowNPObject, &windowScriptObject);
+
+ NPString npScript;
+ npScript.UTF8Characters = script;
+ npScript.UTF8Length = strlen(script);
+
+ NPVariant browserResult;
+ browser->evaluate(object->npp, windowScriptObject, &npScript, &browserResult);
+ browser->releasevariantvalue(&browserResult);
+}
NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char *argn[], char *argv[], NPSavedData *saved)
{
@@ -84,6 +97,8 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ch
obj->onStreamDestroy = _strdup(argv[i]);
else if (_stricmp(argn[i], "onURLNotify") == 0 && !obj->onURLNotify)
obj->onURLNotify = _strdup(argv[i]);
+ else if (_stricmp(argn[i], "onDestroy") == 0 && !obj->onDestroy)
+ obj->onDestroy = _strdup(argv[i]);
else if (_stricmp(argn[i], "logSrc") == 0) {
for (int i = 0; i < argc; i++)
if (_stricmp(argn[i], "src") == 0)
@@ -113,6 +128,11 @@ NPError NPP_Destroy(NPP instance, NPSavedData **save)
if (obj->onStreamDestroy)
free(obj->onStreamDestroy);
+ if (obj->onDestroy) {
+ executeScript(obj, obj->onDestroy);
+ free(obj->onDestroy);
+ }
+
if (obj->logDestroy)
printf("PLUGIN: NPP_Destroy\n");
@@ -135,20 +155,6 @@ NPError NPP_SetWindow(NPP instance, NPWindow *window)
return NPERR_NO_ERROR;
}
-static void executeScript(const PluginObject* obj, const char* script)
-{
- NPObject *windowScriptObject;
- browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject);
-
- NPString npScript;
- npScript.UTF8Characters = script;
- npScript.UTF8Length = strlen(script);
-
- NPVariant browserResult;
- browser->evaluate(obj->npp, windowScriptObject, &npScript, &browserResult);
- browser->releasevariantvalue(&browserResult);
-}
-
NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream *stream, NPBool seekable, uint16 *stype)
{
PluginObject* obj = (PluginObject*)instance->pdata;
diff --git a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
index 6d3b624..3bc84cd 100644
--- a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
+++ b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
@@ -170,6 +170,11 @@ void LayoutTestController::setXSSAuditorEnabled(bool enabled)
// FIXME: implement
}
+void LayoutTestController::setFrameSetFlatteningEnabled(bool enabled)
+{
+ // FIXME: implement
+}
+
void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool enabled)
{
// FIXME: implement
@@ -365,3 +370,9 @@ int LayoutTestController::pageNumberForElementById(JSStringRef, float, float)
// FIXME: implement
return -1;
}
+
+int LayoutTestController::numberOfPages(float, float)
+{
+ // FIXME: implement
+ return -1;
+} \ No newline at end of file
diff --git a/WebKitTools/QtLauncher/QtLauncher.pro b/WebKitTools/QtLauncher/QtLauncher.pro
index e448f69..7dcc8e4 100644
--- a/WebKitTools/QtLauncher/QtLauncher.pro
+++ b/WebKitTools/QtLauncher/QtLauncher.pro
@@ -24,6 +24,8 @@ DESTDIR = ../../bin
include(../../WebKit.pri)
+INCLUDEPATH += ../../JavaScriptCore
+
QT += network
macx:QT+=xml
QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
diff --git a/WebKitTools/QtLauncher/main.cpp b/WebKitTools/QtLauncher/main.cpp
index 31bca8e..c725c2f 100644
--- a/WebKitTools/QtLauncher/main.cpp
+++ b/WebKitTools/QtLauncher/main.cpp
@@ -70,6 +70,14 @@
void QWEBKIT_EXPORT qt_drt_garbageCollector_collect();
#endif
+
+static bool gUseGraphicsView = false;
+static bool gUseCompositing = false;
+static bool gCacheWebView = false;
+static bool gShowFrameRate = false;
+static QGraphicsView::ViewportUpdateMode gViewportUpdateMode = QGraphicsView::MinimalViewportUpdate;
+
+
class LauncherWindow : public MainWindow {
Q_OBJECT
@@ -85,8 +93,6 @@ public:
bool eventFilter(QObject* obj, QEvent* event);
#endif
- QWebView* webView() const { return view; }
-
protected slots:
void loadStarted();
void loadFinished();
@@ -109,6 +115,8 @@ protected slots:
void selectElements();
void setTouchMocking(bool on);
+ void toggleAcceleratedCompositing(bool toggle);
+ void initializeView(bool useGraphicsView = false);
public slots:
void newWindow(const QString& url = QString());
@@ -121,7 +129,7 @@ private:
QVector<int> zoomLevels;
int currentZoom;
- QWebView* view;
+ QWidget* m_view;
WebInspector* inspector;
QAction* formatMenuAction;
@@ -140,14 +148,15 @@ LauncherWindow::LauncherWindow(QString url)
QSplitter* splitter = new QSplitter(Qt::Vertical, this);
setCentralWidget(splitter);
- view = new WebViewTraditional(splitter);
- view->setPage(page());
-
-#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
- view->installEventFilter(this);
- touchMocking = false;
+#if defined(Q_WS_S60)
+ showMaximized();
+#else
+ resize(800, 600);
#endif
+ m_view = 0;
+ initializeView();
+
connect(page(), SIGNAL(loadStarted()), this, SLOT(loadStarted()));
connect(page(), SIGNAL(loadFinished(bool)), this, SLOT(loadFinished()));
connect(page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)),
@@ -238,7 +247,7 @@ void LauncherWindow::sendTouchEvent()
bool LauncherWindow::eventFilter(QObject* obj, QEvent* event)
{
- if (!touchMocking || obj != view)
+ if (!touchMocking || obj != m_view)
return QObject::eventFilter(obj, event);
if (event->type() == QEvent::MouseButtonPress
@@ -290,7 +299,7 @@ bool LauncherWindow::eventFilter(QObject* obj, QEvent* event)
touchPoint.setState(Qt::TouchPointPressed);
touchPoint.setId(1);
touchPoint.setScreenPos(QCursor::pos());
- touchPoint.setPos(view->mapFromGlobal(QCursor::pos()));
+ touchPoint.setPos(m_view->mapFromGlobal(QCursor::pos()));
touchPoint.setPressure(1);
touchPoints.append(touchPoint);
sendTouchEvent();
@@ -305,7 +314,7 @@ bool LauncherWindow::eventFilter(QObject* obj, QEvent* event)
void LauncherWindow::loadStarted()
{
- view->setFocus(Qt::OtherFocusReason);
+ m_view->setFocus(Qt::OtherFocusReason);
}
void LauncherWindow::loadFinished()
@@ -362,14 +371,14 @@ void LauncherWindow::print()
#if !defined(QT_NO_PRINTER)
QPrintPreviewDialog dlg(this);
connect(&dlg, SIGNAL(paintRequested(QPrinter*)),
- view, SLOT(print(QPrinter*)));
+ m_view, SLOT(print(QPrinter*)));
dlg.exec();
#endif
}
void LauncherWindow::screenshot()
{
- QPixmap pixmap = QPixmap::grabWidget(view);
+ QPixmap pixmap = QPixmap::grabWidget(m_view);
QLabel* label = new QLabel;
label->setAttribute(Qt::WA_DeleteOnClose);
label->setWindowTitle("Screenshot - Preview");
@@ -385,7 +394,7 @@ void LauncherWindow::screenshot()
void LauncherWindow::setEditable(bool on)
{
- view->page()->setContentEditable(on);
+ page()->setContentEditable(on);
formatMenuAction->setVisible(on);
}
@@ -429,6 +438,38 @@ void LauncherWindow::setTouchMocking(bool on)
#endif
}
+void LauncherWindow::toggleAcceleratedCompositing(bool toggle)
+{
+ page()->settings()->setAttribute(QWebSettings::AcceleratedCompositingEnabled, toggle);
+}
+
+void LauncherWindow::initializeView(bool useGraphicsView)
+{
+ delete m_view;
+
+ QSplitter* splitter = static_cast<QSplitter*>(centralWidget());
+
+ if (!useGraphicsView) {
+ WebViewTraditional* view = new WebViewTraditional(splitter);
+ view->setPage(page());
+ m_view = view;
+ } else {
+ WebViewGraphicsBased* view = new WebViewGraphicsBased(splitter);
+ view->setPage(page());
+ view->setViewportUpdateMode(gViewportUpdateMode);
+ view->setItemCacheMode(gCacheWebView ? QGraphicsItem::DeviceCoordinateCache : QGraphicsItem::NoCache);
+ if (gShowFrameRate)
+ view->enableFrameRateMeasurement();
+ page()->settings()->setAttribute(QWebSettings::AcceleratedCompositingEnabled, gUseCompositing);
+ m_view = view;
+ }
+
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+ m_view->installEventFilter(this);
+ touchMocking = false;
+#endif
+}
+
void LauncherWindow::newWindow(const QString& url)
{
LauncherWindow* mw = new LauncherWindow(url);
@@ -459,8 +500,8 @@ void LauncherWindow::setupUI()
setEditable->setCheckable(true);
QMenu* viewMenu = menuBar()->addMenu("&View");
- viewMenu->addAction(view->pageAction(QWebPage::Stop));
- viewMenu->addAction(view->pageAction(QWebPage::Reload));
+ viewMenu->addAction(page()->action(QWebPage::Stop));
+ viewMenu->addAction(page()->action(QWebPage::Reload));
viewMenu->addSeparator();
QAction* zoomIn = viewMenu->addAction("Zoom &In", this, SLOT(zoomIn()));
QAction* zoomOut = viewMenu->addAction("Zoom &Out", this, SLOT(zoomOut()));
@@ -498,11 +539,21 @@ void LauncherWindow::setupUI()
touchMockAction->setCheckable(true);
touchMockAction->setShortcut(QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_T));
#endif
+
+ QAction* toggleAcceleratedCompositing = toolsMenu->addAction("Toggle Accelerated Compositing", this, SLOT(toggleAcceleratedCompositing(bool)));
+ toggleAcceleratedCompositing->setCheckable(true);
+ toggleAcceleratedCompositing->setChecked(false);
+
+ QAction* toggleGraphicsView = toolsMenu->addAction("Toggle use of QGraphicsView", this, SLOT(initializeView(bool)));
+ toggleGraphicsView->setCheckable(true);
+ toggleGraphicsView->setChecked(false);
}
-QWebPage* WebPage::createWindow(QWebPage::WebWindowType)
+QWebPage* WebPage::createWindow(QWebPage::WebWindowType type)
{
LauncherWindow* mw = new LauncherWindow;
+ if (type == WebModalDialog)
+ mw->setWindowModality(Qt::ApplicationModal);
mw->show();
return mw->page();
}
@@ -549,9 +600,6 @@ private:
void handleUserOptions();
void applyDefaultSettings();
- QList<QString> enumToKeys(const QMetaObject o, const QString& name, const QString& strip);
- QString formatKeys(QList<QString> keys);
-
private:
bool m_isRobotized;
QStringList m_urls;
@@ -582,36 +630,11 @@ LauncherApplication::LauncherApplication(int& argc, char** argv)
handleUserOptions();
}
-QString LauncherApplication::formatKeys(QList<QString> keys)
-{
- QString result;
- for (int i = 0; i < keys.count() - 1; i++)
- result.append(keys.at(i) + "|");
- result.append(keys.last());
- return result;
-}
-
-QList<QString> LauncherApplication::enumToKeys(const QMetaObject o, const QString& name, const QString& strip)
-{
- QList<QString> list;
-
- int enumIndex = o.indexOfEnumerator(name.toLatin1().data());
- QMetaEnum enumerator = o.enumerator(enumIndex);
-
- if (enumerator.isValid()) {
- for (int i = 0; i < enumerator.keyCount(); i++) {
- QString key(enumerator.valueToKey(i));
- list.append(key.remove(strip));
- }
- }
-
- return list;
-}
-
-static void fail(const QString& errorMsg)
+static void requiresGraphicsView(const QString& option)
{
- qDebug() << "ERROR:" << errorMsg.toLatin1().data();
- exit(1);
+ if (gUseGraphicsView)
+ return;
+ appQuit(1, QString("%1 only works in combination with the -graphicsbased option").arg(option));
}
void LauncherApplication::handleUserOptions()
@@ -625,56 +648,62 @@ void LauncherApplication::handleUserOptions()
QList<QString> updateModes(enumToKeys(QGraphicsView::staticMetaObject,
"ViewportUpdateMode", "ViewportUpdate"));
- if (args.contains("--help")) {
+ if (args.contains("-help")) {
qDebug() << "Usage:" << programName.toLatin1().data()
- << "[--graphicsbased]"
- << "[--compositing]"
- << QString("[--viewport-update-mode %1]").arg(formatKeys(updateModes)).toLatin1().data()
- << "[--cache-webview]"
+ << "[-graphicsbased]"
+ << "[-compositing]"
+ << QString("[-viewport-update-mode %1]").arg(formatKeys(updateModes)).toLatin1().data()
+ << "[-cache-webview]"
+ << "[-show-fps]"
<< "[-r list]"
<< "URLs";
- exit(0);
+ appQuit(0);
}
- bool useGraphicsView = false;
+ if (args.contains("-graphicsbased"))
+ gUseGraphicsView = true;
- if (args.contains("--graphicsbased"))
- useGraphicsView = true;
+ if (args.contains("-compositing")) {
+ requiresGraphicsView("-compositing");
+ gUseCompositing = true;
+ }
- if (args.contains("--compositing") && useGraphicsView)
- QWebSettings::globalSettings()->setAttribute(QWebSettings::AcceleratedCompositingEnabled, true);
+ if (args.contains("-show-fps")) {
+ requiresGraphicsView("-show-fps");
+ gShowFrameRate = true;
+ }
- if (args.contains("--cache-webview") && useGraphicsView)
- ; // view->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
+ if (args.contains("-cache-webview")) {
+ requiresGraphicsView("-cache-webview");
+ gCacheWebView = true;
+ }
- int modeIndex = args.indexOf("--viewport-update-mode");
- if (modeIndex != -1 && ++modeIndex < args.count() && !args.at(modeIndex).startsWith("-")) {
- QString mode = args.takeAt(modeIndex);
- if (useGraphicsView) {
- int idx = updateModes.indexOf(mode);
- if (idx != -1) {
- ; // view->setViewportUpdateMode(static_cast<QGraphicsView::ViewportUpdateMode>(idx));
- } else {
- fail(QString("--viewport-update-mode value has to be one of [%1]")
- .arg(formatKeys(updateModes)).toLatin1().data());
- }
- }
+ QString arg1("-viewport-update-mode");
+ int modeIndex = args.indexOf(arg1);
+ if (modeIndex != -1) {
+ requiresGraphicsView(arg1);
+
+ QString mode = takeOptionValue(&args, modeIndex);
+ if (mode.isEmpty())
+ appQuit(1, QString("%1 needs a value of one of [%2]").arg(arg1).arg(formatKeys(updateModes)));
+ int idx = updateModes.indexOf(mode);
+ if (idx == -1)
+ appQuit(1, QString("%1 value has to be one of [%2]").arg(arg1).arg(formatKeys(updateModes)));
+
+ gViewportUpdateMode = static_cast<QGraphicsView::ViewportUpdateMode>(idx);
}
int robotIndex = args.indexOf("-r");
if (robotIndex != -1) {
- if (++robotIndex < args.count() && !args.at(robotIndex).startsWith("-")) {
- QString listFile = args.takeAt(robotIndex);
- if (!QFile::exists(listFile))
- fail(QString("The list file supplied to -r does not exist."));
- else {
- m_isRobotized = true;
- m_urls = QStringList(listFile);
- return;
- }
- }
- else
- fail(QString("-r needs a list file to start in robotized mode"));
+ QString listFile = takeOptionValue(&args, robotIndex);
+ if (listFile.isEmpty())
+ appQuit(1, "-r needs a list file to start in robotized mode");
+ if (!QFile::exists(listFile))
+ appQuit(1, "The list file supplied to -r does not exist.");
+
+ m_isRobotized = true;
+ m_urls = QStringList(listFile);
+ return;
}
int lastArg = args.lastIndexOf(QRegExp("^-.*"));
@@ -687,10 +716,9 @@ int main(int argc, char **argv)
LauncherApplication app(argc, argv);
if (app.isRobotized()) {
- LauncherWindow* window = new LauncherWindow;
- QWebView* view = window->webView();
- UrlLoader loader(view->page()->mainFrame(), app.urls().at(0));
- QObject::connect(view->page()->mainFrame(), SIGNAL(loadFinished(bool)), &loader, SLOT(loadNext()));
+ LauncherWindow* window = new LauncherWindow();
+ UrlLoader loader(window->page()->mainFrame(), app.urls().at(0));
+ QObject::connect(window->page()->mainFrame(), SIGNAL(loadFinished(bool)), &loader, SLOT(loadNext()));
loader.loadNext();
window->show();
return launcherMain(app);
diff --git a/WebKitTools/QtLauncher/mainwindow.cpp b/WebKitTools/QtLauncher/mainwindow.cpp
index 2662f5e..47755ec 100644
--- a/WebKitTools/QtLauncher/mainwindow.cpp
+++ b/WebKitTools/QtLauncher/mainwindow.cpp
@@ -50,6 +50,9 @@ MainWindow::MainWindow(const QString& url)
void MainWindow::buildUI()
{
QToolBar* bar = addToolBar("Navigation");
+#if defined(Q_WS_S60)
+ bar->setIconSize(QSize(16, 16));
+#endif
bar->addAction(page()->action(QWebPage::Back));
bar->addAction(page()->action(QWebPage::Forward));
bar->addAction(page()->action(QWebPage::Reload));
@@ -61,7 +64,12 @@ void MainWindow::buildUI()
QCompleter* completer = new QCompleter(this);
urlEdit->setCompleter(completer);
completer->setModel(&urlModel);
+#if defined(Q_WS_S60)
+ addToolBarBreak();
+ addToolBar("Location")->addWidget(urlEdit);
+#else
bar->addWidget(urlEdit);
+#endif
connect(page()->mainFrame(), SIGNAL(titleChanged(const QString&)),
this, SLOT(setWindowTitle(const QString&)));
diff --git a/WebKitTools/QtLauncher/utils.cpp b/WebKitTools/QtLauncher/utils.cpp
index 7013f46..2d45dd0 100644
--- a/WebKitTools/QtLauncher/utils.cpp
+++ b/WebKitTools/QtLauncher/utils.cpp
@@ -27,6 +27,54 @@
#include "utils.h"
+
+QString takeOptionValue(QStringList* arguments, int index)
+{
+ QString result;
+
+ if (++index < arguments->count() && !arguments->at(index).startsWith("-"))
+ result = arguments->takeAt(index);
+
+ return result;
+}
+
+QString formatKeys(QList<QString> keys)
+{
+ QString result;
+ for (int i = 0; i < keys.count() - 1; i++)
+ result.append(keys.at(i) + "|");
+ result.append(keys.last());
+ return result;
+}
+
+QList<QString> enumToKeys(const QMetaObject o, const QString& name, const QString& strip)
+{
+ QList<QString> list;
+
+ int enumIndex = o.indexOfEnumerator(name.toLatin1().data());
+ QMetaEnum enumerator = o.enumerator(enumIndex);
+
+ if (enumerator.isValid()) {
+ for (int i = 0; i < enumerator.keyCount(); i++) {
+ QString key(enumerator.valueToKey(i));
+ list.append(key.remove(strip));
+ }
+ }
+
+ return list;
+}
+
+void appQuit(int exitCode, const QString& msg)
+{
+ if (!msg.isEmpty()) {
+ if (exitCode > 0)
+ qDebug("ERROR: %s", msg.toLatin1().data());
+ else
+ qDebug() << msg;
+ }
+ exit(exitCode);
+}
+
QUrl urlFromUserInput(const QString& string)
{
QString input(string);
@@ -40,3 +88,5 @@ QUrl urlFromUserInput(const QString& string)
return QUrl(input);
#endif
}
+
+
diff --git a/WebKitTools/QtLauncher/utils.h b/WebKitTools/QtLauncher/utils.h
index afe771e..9a16067 100644
--- a/WebKitTools/QtLauncher/utils.h
+++ b/WebKitTools/QtLauncher/utils.h
@@ -28,8 +28,17 @@
#ifndef utils_h
#define utils_h
+#include <wtf/AlwaysInline.h>
+
#include <QtCore>
+// options handling
+QString takeOptionValue(QStringList* arguments, int index);
+QString formatKeys(QList<QString> keys);
+QList<QString> enumToKeys(const QMetaObject o, const QString& name, const QString& strip);
+
+NO_RETURN void appQuit(int status, const QString& msg = QString());
+
QUrl urlFromUserInput(const QString& input);
#endif
diff --git a/WebKitTools/QtLauncher/webview.cpp b/WebKitTools/QtLauncher/webview.cpp
index d08da4c..443fc3e 100644
--- a/WebKitTools/QtLauncher/webview.cpp
+++ b/WebKitTools/QtLauncher/webview.cpp
@@ -33,6 +33,64 @@
#include "webview.h"
#include <QtGui>
+#include <QGraphicsScene>
+
+WebViewGraphicsBased::WebViewGraphicsBased(QWidget* parent)
+ : QGraphicsView(parent)
+ , m_item(new GraphicsWebView)
+ , m_numPaintsTotal(0)
+ , m_numPaintsSinceLastMeasure(0)
+ , m_measureFps(false)
+{
+ setScene(new QGraphicsScene(this));
+ scene()->addItem(m_item);
+
+ setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+
+}
+
+void WebViewGraphicsBased::resizeEvent(QResizeEvent* event)
+{
+ QGraphicsView::resizeEvent(event);
+ QRectF rect(QPoint(0, 0), event->size());
+ m_item->setGeometry(rect);
+}
+
+void WebViewGraphicsBased::enableFrameRateMeasurement()
+{
+ m_measureFps = true;
+ m_lastConsultTime = m_startTime = QTime::currentTime();
+ QTimer* updateTimer = new QTimer(this);
+ updateTimer->setInterval(1000);
+ connect(updateTimer, SIGNAL(timeout()), this, SLOT(updateFrameRate()));
+ updateTimer->start();
+}
+
+void WebViewGraphicsBased::updateFrameRate()
+{
+ QTime now = QTime::currentTime();
+
+ int interval = m_lastConsultTime.msecsTo(now);
+ int total = m_startTime.msecsTo(now);
+
+ int average = total ? m_numPaintsTotal * 1000 / total : 0;
+ int current = interval ? m_numPaintsSinceLastMeasure * 1000 / interval : 0;
+
+ qDebug("[FPS] average: %d, current: %d", average, current);
+
+ m_lastConsultTime = now;
+ m_numPaintsSinceLastMeasure = 0;
+}
+
+void WebViewGraphicsBased::paintEvent(QPaintEvent* event)
+{
+ QGraphicsView::paintEvent(event);
+ if (!m_measureFps)
+ return;
+ m_numPaintsSinceLastMeasure++;
+ m_numPaintsTotal++;
+}
static QMenu* createContextMenu(QWebPage* page, QPoint position)
{
@@ -49,7 +107,7 @@ static QMenu* createContextMenu(QWebPage* page, QPoint position)
return menu;
}
-void WebViewGraphicsBased::mousePressEvent(QGraphicsSceneMouseEvent* event)
+void GraphicsWebView::mousePressEvent(QGraphicsSceneMouseEvent* event)
{
setProperty("mouseButtons", QVariant::fromValue(int(event->buttons())));
setProperty("keyboardModifiers", QVariant::fromValue(int(event->modifiers())));
@@ -65,7 +123,7 @@ void WebViewTraditional::mousePressEvent(QMouseEvent* event)
QWebView::mousePressEvent(event);
}
-void WebViewGraphicsBased::contextMenuEvent(QGraphicsSceneContextMenuEvent* event)
+void GraphicsWebView::contextMenuEvent(QGraphicsSceneContextMenuEvent* event)
{
QMenu* menu = createContextMenu(page(), event->pos().toPoint());
menu->exec(mapToScene(event->pos()).toPoint());
diff --git a/WebKitTools/QtLauncher/webview.h b/WebKitTools/QtLauncher/webview.h
index 68f220e..83bd801 100644
--- a/WebKitTools/QtLauncher/webview.h
+++ b/WebKitTools/QtLauncher/webview.h
@@ -36,27 +36,56 @@
#include "webpage.h"
#include <qwebview.h>
#include <qgraphicswebview.h>
+#include <QGraphicsView>
+#include <QGraphicsWidget>
+#include <QTime>
-class WebViewGraphicsBased : public QGraphicsWebView {
+class WebViewTraditional : public QWebView {
+ Q_OBJECT
+
+public:
+ WebViewTraditional(QWidget* parent) : QWebView(parent) {}
+
+protected:
+ virtual void contextMenuEvent(QContextMenuEvent*);
+ virtual void mousePressEvent(QMouseEvent*);
+};
+
+
+class GraphicsWebView : public QGraphicsWebView {
Q_OBJECT
public:
- WebViewGraphicsBased(QGraphicsItem* parent = 0) : QGraphicsWebView(parent) {};
+ GraphicsWebView(QGraphicsItem* parent = 0) : QGraphicsWebView(parent) {};
protected:
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent*);
virtual void mousePressEvent(QGraphicsSceneMouseEvent*);
};
-class WebViewTraditional : public QWebView {
+
+class WebViewGraphicsBased : public QGraphicsView {
Q_OBJECT
public:
- WebViewTraditional(QWidget* parent) : QWebView(parent) {}
+ WebViewGraphicsBased(QWidget* parent);
+ virtual void resizeEvent(QResizeEvent*);
+ void setPage(QWebPage* page) { m_item->setPage(page); }
+ void setItemCacheMode(QGraphicsItem::CacheMode mode) { m_item->setCacheMode(mode); }
-protected:
- virtual void contextMenuEvent(QContextMenuEvent*);
- virtual void mousePressEvent(QMouseEvent*);
+ void enableFrameRateMeasurement();
+ virtual void paintEvent(QPaintEvent* event);
+
+public slots:
+ void updateFrameRate();
+
+private:
+ GraphicsWebView* m_item;
+ int m_numPaintsTotal;
+ int m_numPaintsSinceLastMeasure;
+ QTime m_startTime;
+ QTime m_lastConsultTime;
+ bool m_measureFps;
};
#endif
diff --git a/WebKitTools/Scripts/build-webkit b/WebKitTools/Scripts/build-webkit
index 8171fba..5ae1aae 100755
--- a/WebKitTools/Scripts/build-webkit
+++ b/WebKitTools/Scripts/build-webkit
@@ -36,6 +36,7 @@ use FindBin;
use Getopt::Long qw(:config pass_through);
use lib $FindBin::Bin;
use webkitdirs;
+use webkitperl::features;
use POSIX;
sub formatBuildTime($);
@@ -52,7 +53,7 @@ my $startTime = time();
my ($threeDCanvasSupport, $threeDRenderingSupport, $channelMessagingSupport, $clientBasedGeolocationSupport, $databaseSupport, $datagridSupport, $datalistSupport,
$domStorageSupport, $eventsourceSupport, $filtersSupport, $geolocationSupport, $iconDatabaseSupport, $indexedDatabaseSupport,
- $javaScriptDebuggerSupport, $mathmlSupport, $offlineWebApplicationSupport, $sharedWorkersSupport,
+ $javaScriptDebuggerSupport, $mathmlSupport, $offlineWebApplicationSupport, $rubySupport, $sharedWorkersSupport,
$svgSupport, $svgAnimationSupport, $svgAsImageSupport, $svgDOMObjCBindingsSupport, $svgFontsSupport,
$svgForeignObjectSupport, $svgUseSupport, $videoSupport, $webSocketsSupport, $wmlSupport, $wcssSupport, $xhtmlmpSupport, $workersSupport,
$xpathSupport, $xsltSupport, $coverageSupport, $notificationsSupport);
@@ -112,6 +113,9 @@ my @features = (
{ option => "offline-web-applications", desc => "Toggle Offline Web Application Support",
define => "ENABLE_OFFLINE_WEB_APPLICATIONS", default => 1, value => \$offlineWebApplicationSupport },
+ { option => "ruby", desc => "Toggle HTML5 Ruby support",
+ define => "ENABLE_RUBY", default => 1, value => \$rubySupport },
+
{ option => "shared-workers", desc => "Toggle SharedWorkers support",
define => "ENABLE_SHARED_WORKERS", default => (isAppleWebKit() || isGtk()), value => \$sharedWorkersSupport },
@@ -169,6 +173,9 @@ if (isQt()) {
}
}
+# Additional environment parameters
+push @ARGV, split(/ /, $ENV{'BUILD_WEBKIT_ARGS'}) if ($ENV{'BUILD_WEBKIT_ARGS'});
+
# Initialize values from defaults
foreach (@ARGV) {
if ($_ eq '--minimal') {
@@ -316,7 +323,7 @@ if (isGtk()) {
}
# Force re-link of existing libraries if different than expected
-removeLibraryDependingOnSVG("WebCore", $svgSupport);
+removeLibraryDependingOnFeature("WebCore", "SVG", $svgSupport);
if (isInspectorFrontend()) {
exit exitStatus(copyInspectorFrontendFiles());
diff --git a/WebKitTools/Scripts/check-for-global-initializers b/WebKitTools/Scripts/check-for-global-initializers
index a74f57d..cf83048 100755
--- a/WebKitTools/Scripts/check-for-global-initializers
+++ b/WebKitTools/Scripts/check-for-global-initializers
@@ -107,7 +107,7 @@ for my $file (sort @files) {
next if $shortName eq "Node.o";
next if $shortName eq "Page.o";
next if $shortName eq "Range.o";
- next if $shortName eq "RenderBlockLineLayout.o";
+ next if $shortName eq "BidiRun.o";
next if $shortName eq "RenderObject.o";
next if $shortName eq "SubresourceLoader.o";
next if $shortName eq "SVGElementInstance.o";
diff --git a/WebKitTools/Scripts/check-for-weak-vtables b/WebKitTools/Scripts/check-for-weak-vtables-and-externals
index a10a236..a3dc364 100755
--- a/WebKitTools/Scripts/check-for-weak-vtables
+++ b/WebKitTools/Scripts/check-for-weak-vtables-and-externals
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+# Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -11,7 +11,7 @@
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
-# 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+# 3. Neither the name of Apple Inc. ("Apple") nor the names of
# its contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
@@ -26,10 +26,10 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# "check-for-weak-vtables" script for WebKit Open Source Project
+# "check-for-weak-vtables-and-externals" script for WebKit Open Source Project
# Intended to be invoked from an Xcode build step to check if there are
-# any weak vtables in a target.
+# any weak vtables or weak externals in a target.
use warnings;
use strict;
@@ -63,18 +63,27 @@ if (!defined $executablePathAge || !defined $buildTimestampAge || $executablePat
next;
}
my @weakVTableClasses = ();
+ my @weakExternalSymbols = ();
while (<NM>) {
if (/^STDOUT:/) {
- push @weakVTableClasses, $1 if /weak external vtable for (.*)$/;
+ # Ignore undefined, RTTI and typeinfo symbols.
+ next if /\bundefined\b/ or /\b__ZT[IS]/;
+
+ if (/weak external vtable for (.*)$/) {
+ push @weakVTableClasses, $1;
+ } elsif (/weak external (.*)$/) {
+ push @weakExternalSymbols, $1;
+ }
} else {
print STDERR if $_ ne "nm: no name list\n";
}
}
close NM;
- if (@weakVTableClasses) {
- my $shortName = $executablePath;
- $shortName =~ s/.*\///;
+ my $shortName = $executablePath;
+ $shortName =~ s/.*\///;
+
+ if (@weakVTableClasses) {
print "ERROR: $shortName has a weak vtable in it ($executablePath)\n";
print "ERROR: Fix by making sure the first virtual function in each of these classes is not an inline:\n";
for my $class (sort @weakVTableClasses) {
@@ -82,6 +91,16 @@ if (!defined $executablePathAge || !defined $buildTimestampAge || $executablePat
}
$sawError = 1;
}
+
+ if (@weakExternalSymbols) {
+ print "ERROR: $shortName has a weak external symbol in it ($executablePath)\n";
+ print "ERROR: A weak external symbol is generated when a symbol is defined in multiple compilation units and is also marked as being exported from the library.\n";
+ print "ERROR: A common cause of weak external symbols is when an inline function is listed in the linker export file.\n";
+ for my $symbol (sort @weakExternalSymbols) {
+ print "ERROR: symbol $symbol\n";
+ }
+ $sawError = 1;
+ }
}
if ($sawError and !$coverageBuild) {
diff --git a/WebKitTools/Scripts/rebaseline-chromium-webkit-tests b/WebKitTools/Scripts/rebaseline-chromium-webkit-tests
index 9a8a156..aea0edc 100755
--- a/WebKitTools/Scripts/rebaseline-chromium-webkit-tests
+++ b/WebKitTools/Scripts/rebaseline-chromium-webkit-tests
@@ -11,7 +11,7 @@
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
-# * Neither the Chromium name nor the names of its
+# * 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.
#
diff --git a/WebKitTools/Scripts/run-chromium-webkit-tests b/WebKitTools/Scripts/run-chromium-webkit-tests
index 9c027b8..221b5aa 100755
--- a/WebKitTools/Scripts/run-chromium-webkit-tests
+++ b/WebKitTools/Scripts/run-chromium-webkit-tests
@@ -11,7 +11,7 @@
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
-# * Neither the Chromium name nor the names of its
+# * 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.
#
@@ -33,6 +33,7 @@ import sys
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])),
"webkitpy", "layout_tests"))
+sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0]))))
import run_chromium_webkit_tests
if __name__ == '__main__':
diff --git a/WebKitTools/Scripts/run-drawtest b/WebKitTools/Scripts/run-drawtest
deleted file mode 100755
index 2cd61de..0000000
--- a/WebKitTools/Scripts/run-drawtest
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/perl -w
-
-# Copyright (C) 2005 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.
-# 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
-# its contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
-# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# Simplified "run" script for WebKit Open Source Project.
-
-use strict;
-use FindBin;
-use lib $FindBin::Bin;
-use webkitdirs;
-
-setConfiguration();
-my $productDir = productDir();
-
-# Check to see that all the frameworks are built (w/ SVG support).
-checkFrameworks();
-checkWebCoreSVGSupport(1);
-
-# Set up DYLD_FRAMEWORK_PATH to point to the product directory.
-print "Start DrawTest with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n";
-$ENV{DYLD_FRAMEWORK_PATH} = $productDir;
-my $drawtestPath = "$productDir/DrawTest.app/Contents/MacOS/DrawTest";
-exec $drawtestPath or die;
diff --git a/WebKitTools/Scripts/run-iexploder-tests b/WebKitTools/Scripts/run-iexploder-tests
index 1b3976f..7f2f04f 100755
--- a/WebKitTools/Scripts/run-iexploder-tests
+++ b/WebKitTools/Scripts/run-iexploder-tests
@@ -101,9 +101,13 @@ sub runSafariWithIExploder()
print REDIRECT_HTML "</html>\n";
close REDIRECT_HTML;
- local %ENV;
- $ENV{DYLD_INSERT_LIBRARIES} = "/usr/lib/libgmalloc.dylib" if $guardMalloc;
- system "WebKitTools/Scripts/run-safari", "-NSOpen", "$iExploderTestDirectory/redirect.html";
+ if (!isAppleWebKit()) {
+ system "WebKitTools/Scripts/run-launcher", "$iExploderTestDirectory/redirect.html";
+ } else {
+ local %ENV;
+ $ENV{DYLD_INSERT_LIBRARIES} = "/usr/lib/libgmalloc.dylib" if $guardMalloc;
+ system "WebKitTools/Scripts/run-safari", "-NSOpen", "$iExploderTestDirectory/redirect.html";
+ }
}
sub configureAndOpenHTTPDIfNeeded()
@@ -114,8 +118,9 @@ sub configureAndOpenHTTPDIfNeeded()
my $webkitDirectory = getcwd();
my $testDirectory = $webkitDirectory . "/LayoutTests";
my $iExploderDirectory = $webkitDirectory . "/WebKitTools/iExploder";
- my $httpdConfig = "$testDirectory/http/conf/httpd.conf";
- $httpdConfig = "$testDirectory/http/conf/apache2-httpd.conf" if `$httpdPath -v` =~ m|Apache/2|;
+
+ my $httpdConfig = getHTTPDConfigPathForTestDirectory($testDirectory);
+
my $documentRoot = "$iExploderDirectory/htdocs";
my $typesConfig = "$testDirectory/http/conf/mime.types";
my $sslCertificate = "$testDirectory/http/conf/webkit-httpd.pem";
diff --git a/WebKitTools/Scripts/run-webkit-tests b/WebKitTools/Scripts/run-webkit-tests
index 6b21e48..809e078 100755
--- a/WebKitTools/Scripts/run-webkit-tests
+++ b/WebKitTools/Scripts/run-webkit-tests
@@ -67,6 +67,7 @@ use Time::HiRes qw(time usleep);
use List::Util 'shuffle';
use lib $FindBin::Bin;
+use webkitperl::features;
use webkitperl::httpd;
use webkitdirs;
use VCSUtils;
@@ -154,9 +155,15 @@ my $treatSkipped = "default";
my $useRemoteLinksToTests = 0;
my $useValgrind = 0;
my $verbose = 0;
+my $shouldWaitForHTTPD = 0;
my @leaksFilenames;
+if (isWindows() || isMsys()) {
+ print "This script has to be run under Cygwin to function correctly.\n";
+ exit 1;
+}
+
# Default to --no-http for wx for now.
$testHTTP = 0 if (isWx());
@@ -224,6 +231,7 @@ Usage: $programName [options] [testdir|testpath ...]
--exit-after-n-failures N Exit after the first N failures instead of running all tests
-h|--help Show this help message
--[no-]http Run (or do not run) http tests (default: $httpDefault)
+ --[no-]wait-for-httpd Wait for httpd if some other test session is using it already (same as WEBKIT_WAIT_FOR_HTTPD=1). (default: $shouldWaitForHTTPD)
-i|--ignore-tests Comma-separated list of directories or tests to ignore
--iterations n Number of times to run the set of tests (e.g. ABCABCABC)
--[no-]launch-safari Launch (or do not launch) Safari to display test results (default: $launchSafariDefault)
@@ -267,6 +275,7 @@ my $getOptionsResult = GetOptions(
'guard-malloc|g' => \$guardMalloc,
'help|h' => \$showHelp,
'http!' => \$testHTTP,
+ 'wait-for-httpd!' => \$shouldWaitForHTTPD,
'ignore-metrics!' => \$ignoreMetrics,
'ignore-tests|i=s' => \$ignoreTests,
'iterations=i' => \$iterations,
@@ -308,6 +317,8 @@ my $skippedOnly = $treatSkipped eq "only";
my $configuration = configuration();
+# We need an environment variable to be able to enable the feature per-slave
+$shouldWaitForHTTPD = $ENV{"WEBKIT_WAIT_FOR_HTTPD"} unless ($shouldWaitForHTTPD);
$verbose = 1 if $testsPerDumpTool == 1;
if ($shouldCheckLeaks && $testsPerDumpTool > 1000) {
@@ -410,12 +421,12 @@ my %ignoredDirectories = map { $_ => 1 } qw(platform);
my %ignoredLocalDirectories = map { $_ => 1 } qw(.svn _svn resources script-tests);
my %supportedFileExtensions = map { $_ => 1 } qw(html shtml xml xhtml pl php);
-if (!checkWebCoreMathMLSupport(0)) {
+if (!checkWebCoreFeatureSupport("MathML", 0)) {
$ignoredDirectories{'mathml'} = 1;
}
-# FIXME: We should fix webkitdirs.pm:hasSVG/WMLSupport() to do the correct feature detection for Cygwin.
-if (checkWebCoreSVGSupport(0)) {
+# FIXME: We should fix webkitperl/features.pm:hasFeature() to do the correct feature detection for Cygwin.
+if (checkWebCoreFeatureSupport("SVG", 0)) {
$supportedFileExtensions{'svg'} = 1;
} elsif (isCygwin()) {
$supportedFileExtensions{'svg'} = 1;
@@ -433,20 +444,20 @@ if (!$testMedia) {
$ignoredDirectories{'http/tests/media'} = 1;
}
-if (!checkWebCoreAcceleratedCompositingSupport(0)) {
+if (!checkWebCoreFeatureSupport("Accelerated Compositing", 0)) {
$ignoredDirectories{'compositing'} = 1;
}
-if (!checkWebCore3DRenderingSupport(0)) {
+if (!checkWebCoreFeatureSupport("3D Rendering", 0)) {
$ignoredDirectories{'animations/3d'} = 1;
$ignoredDirectories{'transforms/3d'} = 1;
}
-if (!checkWebCore3DCanvasSupport(0)) {
+if (!checkWebCoreFeatureSupport("3D Canvas", 0)) {
$ignoredDirectories{'fast/canvas/webgl'} = 1;
}
-if (checkWebCoreWMLSupport(0)) {
+if (checkWebCoreFeatureSupport("WML", 0)) {
$supportedFileExtensions{'wml'} = 1;
} else {
$ignoredDirectories{'http/tests/wml'} = 1;
@@ -454,14 +465,10 @@ if (checkWebCoreWMLSupport(0)) {
$ignoredDirectories{'wml'} = 1;
}
-if (!checkWebCoreXHTMLMPSupport(0)) {
+if (!checkWebCoreFeatureSupport("XHTMLMP", 0)) {
$ignoredDirectories{'fast/xhtmlmp'} = 1;
}
-if (!checkWebCoreWCSSSupport(0)) {
- $ignoredDirectories{'fast/wcss'} = 1;
-}
-
processIgnoreTests($ignoreTests, "ignore-tests") if $ignoreTests;
if (!$ignoreSkipped) {
if (!$skippedOnly || @ARGV == 0) {
@@ -943,7 +950,14 @@ for my $test (@tests) {
}
}
}
-printf "\n%0.2fs total testing time\n", (time - $overallStartTime) . "";
+my $totalTestingTime = time - $overallStartTime;
+my $waitTime = getWaitTime();
+if ($waitTime > 0.1) {
+ my $normalizedTestingTime = $totalTestingTime - $waitTime;
+ printf "\n%0.2fs HTTPD waiting time\n", $waitTime . "";
+ printf "%0.2fs normalized testing time", $normalizedTestingTime . "";
+}
+printf "\n%0.2fs total testing time\n", $totalTestingTime . "";
!$isDumpToolOpen || die "Failed to close $dumpToolName.\n";
@@ -1360,6 +1374,7 @@ sub configureAndOpenHTTPDIfNeeded()
my @defaultArgs = getDefaultConfigForTestDirectory($testDirectory);
@args = (@defaultArgs, @args);
+ waitForHTTPDLock() if $shouldWaitForHTTPD;
$isHttpdOpen = openHTTPD(@args);
}
@@ -1383,6 +1398,7 @@ sub openWebSocketServerIfNeeded()
"-d", "$webSocketHandlerDir",
"-s", "$webSocketHandlerScanDir",
"-m", "$webSocketHandlerMapFile",
+ "-x", "/websocket/tests/cookies",
"-l", "$logFile",
"--strict",
);
diff --git a/WebKitTools/Scripts/run-webkit-websocketserver b/WebKitTools/Scripts/run-webkit-websocketserver
index bbc5af6..64a724d 100755
--- a/WebKitTools/Scripts/run-webkit-websocketserver
+++ b/WebKitTools/Scripts/run-webkit-websocketserver
@@ -75,6 +75,7 @@ sub openWebSocketServer()
"-d", "$webSocketHandlerDir",
"-s", "$webSocketHandlerScanDir",
"-m", "$webSocketHandlerMapFile",
+ "-x", "/websocket/tests/cookies",
);
$ENV{"PYTHONPATH"} = $webSocketPythonPath;
diff --git a/WebKitTools/Scripts/test-webkitpy b/WebKitTools/Scripts/test-webkitpy
index ca58b50..cfd3434 100755
--- a/WebKitTools/Scripts/test-webkitpy
+++ b/WebKitTools/Scripts/test-webkitpy
@@ -43,6 +43,7 @@ from webkitpy.committers_unittest import *
from webkitpy.credentials_unittest import *
from webkitpy.diff_parser_unittest import *
from webkitpy.executive_unittest import *
+from webkitpy.grammar_unittest import *
from webkitpy.multicommandtool_unittest import *
from webkitpy.networktransaction_unittest import *
from webkitpy.patchcollection_unittest import *
@@ -51,6 +52,7 @@ from webkitpy.steps.steps_unittest import *
from webkitpy.steps.closebugforlanddiff_unittest import *
from webkitpy.steps.updatechangelogswithreview_unittests import *
from webkitpy.style.unittests import * # for check-webkit-style
+from webkitpy.user_unittest import *
from webkitpy.webkit_logging_unittest import *
from webkitpy.webkitport_unittest import *
diff --git a/WebKitTools/Scripts/build-drawtest b/WebKitTools/Scripts/webkit-build-directory
index fa9b7c2..a85c587 100755
--- a/WebKitTools/Scripts/build-drawtest
+++ b/WebKitTools/Scripts/webkit-build-directory
@@ -1,6 +1,6 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
-# Copyright (C) 2005, 2006 Apple Computer, 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
@@ -26,23 +26,40 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# Simplified build script for WebKit Open Source Project.
-# Modified copy of build-dumprendertree. Perhaps these could share code.
+# A script to expose WebKit's build directory detection logic to non-perl scripts.
-use strict;
use FindBin;
+use Getopt::Long;
+
use lib $FindBin::Bin;
use webkitdirs;
-checkRequiredSystemConfig();
-setConfiguration();
-chdirWebKit();
-my @options = XcodeOptions();
+my $showBaseProductDirectory = 0;
+my $showHelp = 0;
+
+my $programName = basename($0);
+my $usage = <<EOF;
+Usage: $programName [options]
+ --base Show the root build directory instead of one corresponding to the current target (e.g. Debug, Release)
+ --debug Show build directory for the Debug target
+ -h|--help Show this help message
+ --release Show build directory for the Release target
+EOF
+
+setConfiguration(); # Figure out from the command line if we're --debug or --release or the default.
+
+my $getOptionsResult = GetOptions(
+ 'base' => \$showBaseProductDirectory,
+ 'help|h' => \$showHelp,
+);
-# Check to see that all the frameworks are built (w/ SVG support).
-checkFrameworks();
-checkWebCoreSVGSupport(1);
+if (!$getOptionsResult || $showHelp) {
+ print STDERR $usage;
+ exit 1;
+}
-# Build
-chdir "WebKitTools/DrawTest" or die;
-exit system "xcodebuild", "-project", "DrawTest.xcodeproj", @options;
+if ($showBaseProductDirectory) {
+ print baseProductDir() . "\n";
+} else {
+ print productDir() . "\n";
+}
diff --git a/WebKitTools/Scripts/webkitdirs.pm b/WebKitTools/Scripts/webkitdirs.pm
index 8b2ecc1..a788b3d 100644
--- a/WebKitTools/Scripts/webkitdirs.pm
+++ b/WebKitTools/Scripts/webkitdirs.pm
@@ -573,222 +573,17 @@ sub builtDylibPathForName
}
# Check to see that all the frameworks are built.
-sub checkFrameworks
+sub checkFrameworks # FIXME: This is a poor name since only the Mac calls built WebCore a Framework.
{
return if isCygwin();
my @frameworks = ("JavaScriptCore", "WebCore");
- push(@frameworks, "WebKit") if isAppleMacWebKit();
+ push(@frameworks, "WebKit") if isAppleMacWebKit(); # FIXME: This seems wrong, all ports should have a WebKit these days.
for my $framework (@frameworks) {
my $path = builtDylibPathForName($framework);
die "Can't find built framework at \"$path\".\n" unless -e $path;
}
}
-sub libraryContainsSymbol
-{
- my $path = shift;
- my $symbol = shift;
-
- if (isCygwin() or isWindows()) {
- # FIXME: Implement this for Windows.
- return 0;
- }
-
- my $foundSymbol = 0;
- if (-e $path) {
- open NM, "-|", "nm", $path or die;
- while (<NM>) {
- $foundSymbol = 1 if /$symbol/;
- }
- close NM;
- }
- return $foundSymbol;
-}
-
-sub hasMathMLSupport
-{
- my $path = shift;
-
- return libraryContainsSymbol($path, "MathMLElement");
-}
-
-sub checkWebCoreMathMLSupport
-{
- my $required = shift;
- my $framework = "WebCore";
- my $path = builtDylibPathForName($framework);
- my $hasMathML = hasMathMLSupport($path);
- if ($required && !$hasMathML) {
- die "$framework at \"$path\" does not include MathML Support, please run build-webkit --mathml\n";
- }
- return $hasMathML;
-}
-
-sub hasSVGSupport
-{
- my $path = shift;
-
- if (isWx()) {
- return 0;
- }
-
- # We used to look for SVGElement but isSVGElement is a valid symbol in --no-svg builds.
- return libraryContainsSymbol($path, "SVGDefsElement");
-}
-
-sub removeLibraryDependingOnSVG
-{
- my $frameworkName = shift;
- my $shouldHaveSVG = shift;
-
- my $path = builtDylibPathForName($frameworkName);
- return unless -x $path;
-
- my $hasSVG = hasSVGSupport($path);
- system "rm -f $path" if ($shouldHaveSVG xor $hasSVG);
-}
-
-sub checkWebCoreSVGSupport
-{
- my $required = shift;
- my $framework = "WebCore";
- my $path = builtDylibPathForName($framework);
- my $hasSVG = hasSVGSupport($path);
- if ($required && !$hasSVG) {
- die "$framework at \"$path\" does not include SVG Support, please run build-webkit --svg\n";
- }
- return $hasSVG;
-}
-
-sub hasAcceleratedCompositingSupport
-{
- # On platforms other than Mac the Skipped files are used to skip compositing tests
- return 1 if !isAppleMacWebKit();
-
- my $path = shift;
- return libraryContainsSymbol($path, "GraphicsLayer");
-}
-
-sub checkWebCoreAcceleratedCompositingSupport
-{
- my $required = shift;
- my $framework = "WebCore";
- my $path = builtDylibPathForName($framework);
- my $hasAcceleratedCompositing = hasAcceleratedCompositingSupport($path);
- if ($required && !$hasAcceleratedCompositing) {
- die "$framework at \"$path\" does not use accelerated compositing\n";
- }
- return $hasAcceleratedCompositing;
-}
-
-sub has3DRenderingSupport
-{
- # On platforms other than Mac the Skipped files are used to skip 3D tests
- return 1 if !isAppleMacWebKit();
-
- my $path = shift;
- return libraryContainsSymbol($path, "WebCoreHas3DRendering");
-}
-
-sub checkWebCore3DRenderingSupport
-{
- my $required = shift;
- my $framework = "WebCore";
- my $path = builtDylibPathForName($framework);
- my $has3DRendering = has3DRenderingSupport($path);
- if ($required && !$has3DRendering) {
- die "$framework at \"$path\" does not include 3D rendering Support, please run build-webkit --3d-rendering\n";
- }
- return $has3DRendering;
-}
-
-sub has3DCanvasSupport
-{
- return 0 if isQt();
-
- my $path = shift;
- return libraryContainsSymbol($path, "WebGLShader");
-}
-
-sub checkWebCore3DCanvasSupport
-{
- my $required = shift;
- my $framework = "WebCore";
- my $path = builtDylibPathForName($framework);
- my $has3DCanvas = has3DCanvasSupport($path);
- if ($required && !$has3DCanvas) {
- die "$framework at \"$path\" does not include 3D Canvas Support, please run build-webkit --3d-canvas\n";
- }
- return $has3DCanvas;
-}
-
-sub hasWMLSupport
-{
- my $path = shift;
- return libraryContainsSymbol($path, "WMLElement");
-}
-
-sub removeLibraryDependingOnWML
-{
- my $frameworkName = shift;
- my $shouldHaveWML = shift;
-
- my $path = builtDylibPathForName($frameworkName);
- return unless -x $path;
-
- my $hasWML = hasWMLSupport($path);
- system "rm -f $path" if ($shouldHaveWML xor $hasWML);
-}
-
-sub checkWebCoreWMLSupport
-{
- my $required = shift;
- my $framework = "WebCore";
- my $path = builtDylibPathForName($framework);
- my $hasWML = hasWMLSupport($path);
- if ($required && !$hasWML) {
- die "$framework at \"$path\" does not include WML Support, please run build-webkit --wml\n";
- }
- return $hasWML;
-}
-
-sub hasXHTMLMPSupport
-{
- my $path = shift;
- return libraryContainsSymbol($path, "isXHTMLMPDocument");
-}
-
-sub checkWebCoreXHTMLMPSupport
-{
- my $required = shift;
- my $framework = "WebCore";
- my $path = builtDylibPathForName($framework);
- my $hasXHTMLMP = hasXHTMLMPSupport($path);
- if ($required && !$hasXHTMLMP) {
- die "$framework at \"$path\" does not include XHTML MP Support\n";
- }
- return $hasXHTMLMP;
-}
-
-sub hasWCSSSupport
-{
- # FIXME: When WCSS support is landed this should be updated to check for WCSS
- # being enabled in a manner similar to how we check for XHTML MP above.
- return 0;
-}
-
-sub checkWebCoreWCSSSupport
-{
- my $required = shift;
- my $framework = "WebCore";
- my $path = builtDylibPathForName($framework);
- my $hasWCSS = hasWCSSSupport($path);
- if ($required && !$hasWCSS) {
- die "$framework at \"$path\" does not include WCSS Support\n";
- }
- return $hasWCSS;
-}
-
sub isInspectorFrontend()
{
determineIsInspectorFrontend();
@@ -954,6 +749,11 @@ sub isWindows()
return ($^O eq "MSWin32") || 0;
}
+sub isMsys()
+{
+ return ($^O eq "msys") || 0;
+}
+
sub isLinux()
{
return ($^O eq "linux") || 0;
@@ -1107,7 +907,7 @@ sub determineWindowsSourceDir()
{
return if $windowsSourceDir;
my $sourceDir = sourceDir();
- chomp($windowsSourceDir = `cygpath -w $sourceDir`);
+ chomp($windowsSourceDir = `cygpath -w '$sourceDir'`);
}
sub windowsSourceDir()
@@ -1491,27 +1291,21 @@ sub buildQMakeProject($@)
my $dsMakefile = "Makefile.DerivedSources";
- print "Calling '$make $makeargs -f $dsMakefile generated_files' in " . $dir . "/JavaScriptCore\n\n";
- if ($make eq "nmake") {
- $result = system "pushd JavaScriptCore && $make $makeargs -f $dsMakefile generated_files && popd";
- } else {
- $result = system "$make $makeargs -C JavaScriptCore -f $dsMakefile generated_files";
- }
- if ($result ne 0) {
- die "Failed to generate JavaScriptCore's derived sources!\n";
- }
-
- print "Calling '$make $makeargs -f $dsMakefile generated_files' in " . $dir . "/WebCore\n\n";
- if ($make eq "nmake") {
- $result = system "pushd WebCore && $make $makeargs -f $dsMakefile generated_files && popd";
- } else {
- $result = system "$make $makeargs -C WebCore -f $dsMakefile generated_files";
- }
- if ($result ne 0) {
- die "Failed to generate WebCore's derived sources!\n";
+ # Iterate over different source directories manually to workaround a problem with qmake+extraTargets+s60
+ for my $subdir ("JavaScriptCore", "WebCore", "WebKit/qt/Api") {
+ print "Calling '$make $makeargs -f $dsMakefile generated_files' in " . $dir . "/$subdir\n\n";
+ if ($make eq "nmake") {
+ my $subdirWindows = $subdir;
+ $subdirWindows =~ s:/:\\:g;
+ $result = system "pushd $subdirWindows && $make $makeargs -f $dsMakefile generated_files && popd";
+ } else {
+ $result = system "$make $makeargs -C $subdir -f $dsMakefile generated_files";
+ }
+ if ($result ne 0) {
+ die "Failed to generate ${subdir}'s derived sources!\n";
+ }
}
-
push @buildArgs, "OUTPUT_DIR=" . baseProductDir() . "/$config";
push @buildArgs, sourceDir() . "/WebKit.pro";
if ($config =~ m/debug/i) {
diff --git a/WebKitTools/Scripts/webkitperl/features.pm b/WebKitTools/Scripts/webkitperl/features.pm
new file mode 100644
index 0000000..1f88022
--- /dev/null
+++ b/WebKitTools/Scripts/webkitperl/features.pm
@@ -0,0 +1,104 @@
+# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved
+# Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
+# Copyright (C) 2010 Andras Becsi (abecsi@inf.u-szeged.hu), University of Szeged
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# Module to share code to detect the existance of features in built binaries.
+
+use strict;
+use warnings;
+
+BEGIN {
+ use Exporter ();
+ our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
+ $VERSION = 1.00;
+ @ISA = qw(Exporter);
+ @EXPORT = qw(&checkWebCoreFeatureSupport
+ &removeLibraryDependingOnFeature);
+ %EXPORT_TAGS = ( );
+ @EXPORT_OK = ();
+}
+
+sub libraryContainsSymbol($$)
+{
+ my ($path, $symbol) = @_;
+
+ if (isCygwin() or isWindows()) {
+ # FIXME: Implement this for Windows.
+ return 0;
+ }
+
+ my $foundSymbol = 0;
+ if (-e $path) {
+ open NM, "-|", "nm", $path or die;
+ while (<NM>) {
+ $foundSymbol = 1 if /$symbol/; # FIXME: This should probably check for word boundaries before/after the symbol name.
+ }
+ close NM;
+ }
+ return $foundSymbol;
+}
+
+sub hasFeature($$)
+{
+ my ($featureName, $path) = @_;
+ my %symbolForFeature = (
+ "MathML" => "MathMLElement",
+ "SVG" => "SVGDefsElement", # We used to look for SVGElement but isSVGElement exists (and would match) in --no-svg builds.
+ "Accelerated Compositing" => "GraphicsLayer",
+ "3D Rendering" => "WebCoreHas3DRendering",
+ "3D Canvas" => "WebGLShader",
+ "WML" => "WMLElement",
+ "XHTMLMP" => "isXHTMLMPDocument",
+ );
+ my $symbolName = $symbolForFeature{$featureName};
+ die "Unknown feature: $featureName" unless $symbolName;
+ return libraryContainsSymbol($path, $symbolName);
+}
+
+sub checkWebCoreFeatureSupport($$)
+{
+ my ($feature, $required) = @_;
+ my $libraryName = "WebCore";
+ my $path = builtDylibPathForName($libraryName);
+ my $hasFeature = hasFeature($feature, $path);
+ if ($required && !$hasFeature) {
+ die "$libraryName at \"$path\" does not include $hasFeature support. See build-webkit --help\n";
+ }
+ return $hasFeature;
+}
+
+sub removeLibraryDependingOnFeature($$$)
+{
+ my ($libraryName, $featureName, $shouldHaveFeature) = @_;
+ my $path = builtDylibPathForName($libraryName);
+ return unless -x $path;
+
+ my $hasFeature = hasFeature($featureName, $path);
+ system "rm -f $path" if ($shouldHaveFeature xor $hasFeature);
+}
+
+1;
diff --git a/WebKitTools/Scripts/webkitperl/httpd.pm b/WebKitTools/Scripts/webkitperl/httpd.pm
index d082870..05eb21c 100644
--- a/WebKitTools/Scripts/webkitperl/httpd.pm
+++ b/WebKitTools/Scripts/webkitperl/httpd.pm
@@ -34,6 +34,7 @@ use warnings;
use File::Path;
use File::Spec;
use File::Spec::Functions;
+use Fcntl ':flock';
use IPC::Open2;
use webkitdirs;
@@ -43,20 +44,32 @@ BEGIN {
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
$VERSION = 1.00;
@ISA = qw(Exporter);
- @EXPORT = qw(&getHTTPDPath &getDefaultConfigForTestDirectory &openHTTPD &closeHTTPD &getHTTPDPid &setShouldWaitForUserInterrupt);
+ @EXPORT = qw(&getHTTPDPath
+ &getHTTPDConfigPathForTestDirectory
+ &getDefaultConfigForTestDirectory
+ &openHTTPD
+ &closeHTTPD
+ &setShouldWaitForUserInterrupt
+ &waitForHTTPDLock
+ &getWaitTime);
%EXPORT_TAGS = ( );
@EXPORT_OK = ();
}
my $tmpDir = "/tmp";
+my $httpdLockPrefix = "WebKitHttpd.lock.";
+my $myLockFile;
+my $exclusiveLockFile = File::Spec->catfile($tmpDir, "WebKit.lock");
my $httpdPath;
my $httpdPidDir = File::Spec->catfile($tmpDir, "WebKit");
my $httpdPidFile = File::Spec->catfile($httpdPidDir, "httpd.pid");
my $httpdPid;
my $waitForUserInterrupt = 0;
+my $waitBeginTime;
+my $waitEndTime;
-$SIG{'INT'} = 'cleanup';
-$SIG{'TERM'} = 'cleanup';
+$SIG{'INT'} = 'handleInterrupt';
+$SIG{'TERM'} = 'handleInterrupt';
sub getHTTPDPath
{
@@ -73,24 +86,7 @@ sub getDefaultConfigForTestDirectory
my ($testDirectory) = @_;
die "No test directory has been specified." unless ($testDirectory);
- my $httpdConfig;
- getHTTPDPath();
- if (isCygwin()) {
- my $windowsConfDirectory = "$testDirectory/http/conf/";
- unless (-x "/usr/lib/apache/libphp4.dll") {
- copy("$windowsConfDirectory/libphp4.dll", "/usr/lib/apache/libphp4.dll");
- chmod(0755, "/usr/lib/apache/libphp4.dll");
- }
- $httpdConfig = "$windowsConfDirectory/cygwin-httpd.conf";
- } elsif (isDebianBased()) {
- $httpdConfig = "$testDirectory/http/conf/apache2-debian-httpd.conf";
- } elsif (isFedoraBased()) {
- $httpdConfig = "$testDirectory/http/conf/fedora-httpd.conf";
- } else {
- $httpdConfig = "$testDirectory/http/conf/httpd.conf";
- $httpdConfig = "$testDirectory/http/conf/apache2-httpd.conf" if `$httpdPath -v` =~ m|Apache/2|;
- }
-
+ my $httpdConfig = getHTTPDConfigPathForTestDirectory($testDirectory);
my $documentRoot = "$testDirectory/http/tests";
my $jsTestResourcesDirectory = $testDirectory . "/fast/js/resources";
my $typesConfig = "$testDirectory/http/conf/mime.types";
@@ -119,6 +115,30 @@ sub getDefaultConfigForTestDirectory
}
+sub getHTTPDConfigPathForTestDirectory
+{
+ my ($testDirectory) = @_;
+ die "No test directory has been specified." unless ($testDirectory);
+ my $httpdConfig;
+ getHTTPDPath();
+ if (isCygwin()) {
+ my $windowsConfDirectory = "$testDirectory/http/conf/";
+ unless (-x "/usr/lib/apache/libphp4.dll") {
+ copy("$windowsConfDirectory/libphp4.dll", "/usr/lib/apache/libphp4.dll");
+ chmod(0755, "/usr/lib/apache/libphp4.dll");
+ }
+ $httpdConfig = "$windowsConfDirectory/cygwin-httpd.conf";
+ } elsif (isDebianBased()) {
+ $httpdConfig = "$testDirectory/http/conf/apache2-debian-httpd.conf";
+ } elsif (isFedoraBased()) {
+ $httpdConfig = "$testDirectory/http/conf/fedora-httpd.conf";
+ } else {
+ $httpdConfig = "$testDirectory/http/conf/httpd.conf";
+ $httpdConfig = "$testDirectory/http/conf/apache2-httpd.conf" if `$httpdPath -v` =~ m|Apache/2|;
+ }
+ return $httpdConfig;
+}
+
sub openHTTPD(@)
{
my (@args) = @_;
@@ -141,7 +161,10 @@ sub openHTTPD(@)
--$retryCount;
}
- die "Timed out waiting for httpd to quit" unless $retryCount;
+ if (!$retryCount) {
+ cleanUp();
+ die "Timed out waiting for httpd to quit";
+ }
}
}
@@ -156,7 +179,7 @@ sub openHTTPD(@)
}
if (!$retryCount) {
- rmtree $httpdPidDir;
+ cleanUp();
die "Timed out waiting for httpd to start";
}
@@ -172,20 +195,19 @@ sub openHTTPD(@)
sub closeHTTPD
{
close HTTPDIN;
+ my $retryCount = 20;
if ($httpdPid) {
kill 15, $httpdPid;
- my $retryCount = 20;
while (-f $httpdPidFile && $retryCount) {
sleep 1;
--$retryCount;
}
-
- if (!$retryCount) {
- print STDERR "Timed out waiting for httpd to terminate!\n";
- return 0;
- }
}
- rmdir $httpdPidDir;
+ cleanUp();
+ if (!$retryCount) {
+ print STDERR "Timed out waiting for httpd to terminate!\n";
+ return 0;
+ }
return 1;
}
@@ -194,9 +216,94 @@ sub setShouldWaitForUserInterrupt
$waitForUserInterrupt = 1;
}
-sub cleanup
+sub handleInterrupt
{
closeHTTPD();
print "\n";
exit(1);
}
+
+sub cleanUp
+{
+ rmdir $httpdPidDir;
+ unlink $exclusiveLockFile;
+ unlink $myLockFile if $myLockFile;
+}
+
+sub extractLockNumber
+{
+ my ($lockFile) = @_;
+ return -1 unless $lockFile;
+ return substr($lockFile, length($httpdLockPrefix));
+}
+
+sub getLockFiles
+{
+ opendir(TMPDIR, $tmpDir) or die "Could not open " . $tmpDir . ".";
+ my @lockFiles = grep {m/^$httpdLockPrefix\d+$/} readdir(TMPDIR);
+ @lockFiles = sort { extractLockNumber($a) <=> extractLockNumber($b) } @lockFiles;
+ closedir(TMPDIR);
+ return @lockFiles;
+}
+
+sub getNextAvailableLockNumber
+{
+ my @lockFiles = getLockFiles();
+ return 0 unless @lockFiles;
+ return extractLockNumber($lockFiles[-1]) + 1;
+}
+
+sub getLockNumberForCurrentRunning
+{
+ my @lockFiles = getLockFiles();
+ return 0 unless @lockFiles;
+ return extractLockNumber($lockFiles[0]);
+}
+
+sub waitForHTTPDLock
+{
+ $waitBeginTime = time;
+ scheduleHttpTesting();
+ # If we are the only one waiting for Apache just run the tests without any further checking
+ if (scalar getLockFiles() > 1) {
+ my $currentLockFile = File::Spec->catfile($tmpDir, "$httpdLockPrefix" . getLockNumberForCurrentRunning());
+ my $currentLockPid = <SCHEDULER_LOCK> if (-f $currentLockFile && open(SCHEDULER_LOCK, "<$currentLockFile"));
+ # Wait until we are allowed to run the http tests
+ while ($currentLockPid && $currentLockPid != $$) {
+ $currentLockFile = File::Spec->catfile($tmpDir, "$httpdLockPrefix" . getLockNumberForCurrentRunning());
+ if ($currentLockFile eq $myLockFile) {
+ $currentLockPid = <SCHEDULER_LOCK> if open(SCHEDULER_LOCK, "<$currentLockFile");
+ if ($currentLockPid != $$) {
+ print STDERR "\nPID mismatch.\n";
+ last;
+ }
+ } else {
+ sleep 1;
+ }
+ }
+ }
+ $waitEndTime = time;
+}
+
+sub scheduleHttpTesting
+{
+ # We need an exclusive lock file to avoid deadlocks and starvation and ensure that the scheduler lock numbers are sequential.
+ # The scheduler locks are used to schedule the running test sessions in first come first served order.
+ while (!(open(SEQUENTIAL_GUARD_LOCK, ">$exclusiveLockFile") && flock(SEQUENTIAL_GUARD_LOCK, LOCK_EX|LOCK_NB))) {}
+ $myLockFile = File::Spec->catfile($tmpDir, "$httpdLockPrefix" . getNextAvailableLockNumber());
+ open(SCHEDULER_LOCK, ">$myLockFile");
+ print SCHEDULER_LOCK "$$";
+ print SEQUENTIAL_GUARD_LOCK "$$";
+ close(SCHEDULER_LOCK);
+ close(SEQUENTIAL_GUARD_LOCK);
+ unlink $exclusiveLockFile;
+}
+
+sub getWaitTime
+{
+ my $waitTime = 0;
+ if ($waitBeginTime && $waitEndTime) {
+ $waitTime = $waitEndTime - $waitBeginTime;
+ }
+ return $waitTime;
+}
diff --git a/WebKitTools/Scripts/webkitpy/bugzilla.py b/WebKitTools/Scripts/webkitpy/bugzilla.py
index c1cf41d..4506af2 100644
--- a/WebKitTools/Scripts/webkitpy/bugzilla.py
+++ b/WebKitTools/Scripts/webkitpy/bugzilla.py
@@ -39,6 +39,7 @@ from datetime import datetime # used in timestamp()
from webkitpy.webkit_logging import error, log
from webkitpy.committers import CommitterList
from webkitpy.credentials import Credentials
+from webkitpy.user import User
# WebKit includes a built copy of BeautifulSoup in Scripts/webkitpy
# so this import should always succeed.
@@ -559,7 +560,7 @@ class Bugzilla(object):
for name in components:
i += 1
log("%2d. %s" % (i, name))
- result = int(raw_input("Enter a number: ")) - 1
+ result = int(User.prompt("Enter a number: ")) - 1
return components[result]
def _check_create_bug_response(self, response_html):
diff --git a/WebKitTools/Scripts/webkitpy/commands/upload.py b/WebKitTools/Scripts/webkitpy/commands/upload.py
index 8d23d8b..15bdfbb 100644
--- a/WebKitTools/Scripts/webkitpy/commands/upload.py
+++ b/WebKitTools/Scripts/webkitpy/commands/upload.py
@@ -41,10 +41,11 @@ from webkitpy.bugzilla import parse_bug_id
from webkitpy.commands.abstractsequencedcommand import AbstractSequencedCommand
from webkitpy.comments import bug_comment_from_svn_revision
from webkitpy.committers import CommitterList
-from webkitpy.grammar import pluralize
+from webkitpy.grammar import pluralize, join_with_separators
from webkitpy.webkit_logging import error, log
from webkitpy.mock import Mock
from webkitpy.multicommandtool import AbstractDeclarativeCommand
+from webkitpy.user import User
class CommitMessageForCurrentDiff(AbstractDeclarativeCommand):
name = "commit-message"
@@ -54,11 +55,45 @@ class CommitMessageForCurrentDiff(AbstractDeclarativeCommand):
os.chdir(tool.scm().checkout_root)
print "%s" % tool.scm().commit_message_for_this_commit().message()
+class CleanPendingCommit(AbstractDeclarativeCommand):
+ name = "clean-pending-commit"
+ help_text = "Clear r+ on obsolete patches so they do not appear in the pending-commit list."
+
+ # NOTE: This was designed to be generic, but right now we're only processing patches from the pending-commit list, so only r+ matters.
+ def _flags_to_clear_on_patch(self, patch):
+ if not patch.is_obsolete():
+ return None
+ what_was_cleared = []
+ if patch.review() == "+":
+ if patch.reviewer():
+ what_was_cleared.append("%s's review+" % patch.reviewer().full_name)
+ else:
+ what_was_cleared.append("review+")
+ return join_with_separators(what_was_cleared)
+
+ def execute(self, options, args, tool):
+ committers = CommitterList()
+ for bug_id in tool.bugs.queries.fetch_bug_ids_from_pending_commit_list():
+ bug = self.tool.bugs.fetch_bug(bug_id)
+ patches = bug.patches(include_obsolete=True)
+ for patch in patches:
+ flags_to_clear = self._flags_to_clear_on_patch(patch)
+ if not flags_to_clear:
+ continue
+ message = "Cleared %s from obsolete attachment %s so that this bug does not appear in http://webkit.org/pending-commit." % (flags_to_clear, patch.id())
+ self.tool.bugs.obsolete_attachment(patch.id(), message)
+
class AssignToCommitter(AbstractDeclarativeCommand):
name = "assign-to-committer"
help_text = "Assign bug to whoever attached the most recent r+'d patch"
+ def _patches_have_commiters(self, reviewed_patches):
+ for patch in reviewed_patches:
+ if not patch.committer():
+ return False
+ return True
+
def _assign_bug_to_last_patch_attacher(self, bug_id):
committers = CommitterList()
bug = self.tool.bugs.fetch_bug(bug_id)
@@ -71,6 +106,12 @@ class AssignToCommitter(AbstractDeclarativeCommand):
if not reviewed_patches:
log("Bug %s has no non-obsolete patches, ignoring." % bug_id)
return
+
+ # We only need to do anything with this bug if one of the r+'d patches does not have a valid committer (cq+ set).
+ if self._patches_have_commiters(reviewed_patches):
+ log("All reviewed patches on bug %s already have commit-queue+, ignoring." % bug_id)
+ return
+
latest_patch = reviewed_patches[-1]
attacher_email = latest_patch.attacher_email()
committer = committers.committer_by_email(attacher_email)
@@ -383,7 +424,7 @@ class CreateBug(AbstractDeclarativeCommand):
bug_id = tool.bugs.create_bug(bug_title, comment_text, options.component, diff_file, "Patch", cc=options.cc, mark_for_review=options.review, mark_for_commit_queue=options.request_commit)
def prompt_for_bug_title_and_comment(self):
- bug_title = raw_input("Bug title: ")
+ bug_title = User.prompt("Bug title: ")
print "Bug comment (hit ^D on blank line to end):"
lines = sys.stdin.readlines()
try:
diff --git a/WebKitTools/Scripts/webkitpy/commands/upload_unittest.py b/WebKitTools/Scripts/webkitpy/commands/upload_unittest.py
index 33001ac..7fa8797 100644
--- a/WebKitTools/Scripts/webkitpy/commands/upload_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/commands/upload_unittest.py
@@ -40,9 +40,12 @@ class UploadCommandsTest(CommandsTest):
expected_stdout = "Mock message\n"
self.assert_execute_outputs(CommitMessageForCurrentDiff(), [], expected_stdout=expected_stdout, tool=tool)
+ def test_clean_pending_commit(self):
+ self.assert_execute_outputs(CleanPendingCommit(), [])
+
def test_assign_to_committer(self):
tool = MockBugzillaTool()
- expected_stderr = "Bug 77 is already assigned to foo@foo.com (None).\nBug 76 has no non-obsolete patches, ignoring.\n"
+ expected_stderr = "Warning, attachment 128 on bug 42 has invalid committer (non-committer@example.com)\nBug 77 is already assigned to foo@foo.com (None).\nBug 76 has no non-obsolete patches, ignoring.\n"
self.assert_execute_outputs(AssignToCommitter(), [], expected_stderr=expected_stderr, tool=tool)
tool.bugs.reassign_bug.assert_called_with(42, "eric@webkit.org", "Attachment 128 was posted by a committer and has review+, assigning to Eric Seidel for commit.")
diff --git a/WebKitTools/Scripts/webkitpy/committers.py b/WebKitTools/Scripts/webkitpy/committers.py
index 0efb4e7..7af0987 100644
--- a/WebKitTools/Scripts/webkitpy/committers.py
+++ b/WebKitTools/Scripts/webkitpy/committers.py
@@ -65,6 +65,7 @@ committers_unable_to_review = [
Committer("Aaron Boodman", "aa@chromium.org"),
Committer("Adam Langley", "agl@chromium.org"),
Committer("Albert J. Wong", "ajwong@chromium.org"),
+ Committer("Alejandro G. Castro", ["alex@igalia.com", "alex@webkit.org"]),
Committer("Alexander Kellett", ["lypanov@mac.com", "a-lists001@lypanov.net", "lypanov@kde.org"]),
Committer("Alexander Pavlov", "apavlov@chromium.org"),
Committer("Andre Boule", "aboule@apple.com"),
diff --git a/WebKitTools/Scripts/webkitpy/credentials.py b/WebKitTools/Scripts/webkitpy/credentials.py
index a4d8e34..295c576 100644
--- a/WebKitTools/Scripts/webkitpy/credentials.py
+++ b/WebKitTools/Scripts/webkitpy/credentials.py
@@ -37,6 +37,7 @@ import re
from webkitpy.executive import Executive, ScriptError
from webkitpy.webkit_logging import log
from webkitpy.scm import Git
+from webkitpy.user import User
class Credentials(object):
@@ -124,7 +125,7 @@ class Credentials(object):
(username, password) = self._credentials_from_keychain(username)
if not username:
- username = raw_input("%s login: " % self.host)
+ username = User.prompt("%s login: " % self.host)
if not password:
password = getpass.getpass("%s password for %s: " % (self.host,
username))
diff --git a/WebKitTools/Scripts/webkitpy/grammar.py b/WebKitTools/Scripts/webkitpy/grammar.py
index 78809e0..651bbc9 100644
--- a/WebKitTools/Scripts/webkitpy/grammar.py
+++ b/WebKitTools/Scripts/webkitpy/grammar.py
@@ -43,3 +43,11 @@ def pluralize(noun, count):
if count != 1:
noun = plural(noun)
return "%d %s" % (count, noun)
+
+
+def join_with_separators(list_of_strings, separator=', ', last_separator=', and '):
+ if not list_of_strings:
+ return ""
+ if len(list_of_strings) == 1:
+ return list_of_strings[0]
+ return "%s%s%s" % (separator.join(list_of_strings[:-1]), last_separator, list_of_strings[-1])
diff --git a/WebKitTools/Scripts/webkitpy/grammar_unittest.py b/WebKitTools/Scripts/webkitpy/grammar_unittest.py
new file mode 100644
index 0000000..3d8b179
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/grammar_unittest.py
@@ -0,0 +1,38 @@
+# 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.
+
+import unittest
+from webkitpy.grammar import join_with_separators
+
+class GrammarTest(unittest.TestCase):
+
+ def test_join_with_separators(self):
+ self.assertEqual(join_with_separators(["one", "two", "three"]), "one, two, and three")
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/driver_test.py b/WebKitTools/Scripts/webkitpy/layout_tests/driver_test.py
new file mode 100644
index 0000000..6e4ba99
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/driver_test.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+# 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.
+
+#
+# FIXME: this is a poor attempt at a unit tests driver. We should replace
+# this with something that actually uses a unit testing framework or
+# at least produces output that could be useful.
+
+"""Simple test client for the port/Driver interface."""
+
+import os
+import optparse
+import port
+
+
+def run_tests(port, options, tests):
+ # |image_path| is a path to the image capture from the driver.
+ image_path = 'image_result.png'
+ driver = port.start_driver(image_path, None)
+ for t in tests:
+ uri = port.filename_to_uri(os.path.join(port.layout_tests_dir(), t))
+ print "uri: " + uri
+ crash, timeout, checksum, output, err = \
+ driver.run_test(uri, int(options.timeout), None)
+ print "crash: " + str(crash)
+ print "timeout: " + str(timeout)
+ print "checksum: " + str(checksum)
+ print 'stdout: """'
+ print ''.join(output)
+ print '"""'
+ print 'stderr: """'
+ print ''.join(err)
+ print '"""'
+ print
+
+
+if __name__ == '__main__':
+ optparser = optparse.OptionParser()
+ optparser.add_option('-p', '--platform', action='store', default='mac',
+ help='Platform to test (e.g., "mac", "chromium-mac", etc.')
+ optparser.add_option('-t', '--target', action='store', default='Release',
+ help='build type ("Debug" or "Release")')
+ optparser.add_option('', '--timeout', action='store', default='2000',
+ help='test timeout in milliseconds (2000 by default)')
+ optparser.add_option('', '--wrapper', action='store')
+ optparser.add_option('', '--no-pixel-tests', action='store_true',
+ default=False,
+ help='disable pixel-to-pixel PNG comparisons')
+ options, args = optparser.parse_args()
+ p = port.get(options.platform, options)
+ run_tests(p, options, args)
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py
index f38a7ab..520ab1f 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py
@@ -29,9 +29,9 @@
import logging
import os
+import simplejson
from layout_package import json_results_generator
-from port import path_utils
from layout_package import test_expectations
from layout_package import test_failures
@@ -45,7 +45,7 @@ class JSONLayoutResultsGenerator(json_results_generator.JSONResultsGenerator):
WONTFIX = "wontfixCounts"
DEFERRED = "deferredCounts"
- def __init__(self, builder_name, build_name, build_number,
+ def __init__(self, port, builder_name, build_name, build_number,
results_file_base_path, builder_base_url,
test_timings, expectations, result_summary, all_tests):
"""Modifies the results.json file. Grabs it off the archive directory
@@ -56,7 +56,7 @@ class JSONLayoutResultsGenerator(json_results_generator.JSONResultsGenerator):
results.
(see the comment of JSONResultsGenerator.__init__ for other Args)
"""
-
+ self._port = port
self._builder_name = builder_name
self._build_name = build_name
self._build_number = build_number
@@ -153,7 +153,7 @@ class JSONLayoutResultsGenerator(json_results_generator.JSONResultsGenerator):
test, test_name, tests)
# Remove tests that don't exist anymore.
- full_path = os.path.join(path_utils.layout_tests_dir(), test_name)
+ full_path = os.path.join(self._port.layout_tests_dir(), test_name)
full_path = os.path.normpath(full_path)
if not os.path.exists(full_path):
del tests[test_name]
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py
index dc24ade..84be0e1 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py
@@ -29,19 +29,15 @@
import logging
import os
+import simplejson
import subprocess
import sys
import time
import urllib2
import xml.dom.minidom
-from port import path_utils
from layout_package import test_expectations
-sys.path.append(path_utils.path_from_base('third_party', 'WebKit',
- 'WebKitTools'))
-import simplejson
-
class JSONResultsGenerator(object):
@@ -80,7 +76,7 @@ class JSONResultsGenerator(object):
RESULTS_FILENAME = "results.json"
- def __init__(self, builder_name, build_name, build_number,
+ def __init__(self, port, builder_name, build_name, build_number,
results_file_base_path, builder_base_url,
test_timings, failures, passed_tests, skipped_tests, all_tests):
"""Modifies the results.json file. Grabs it off the archive directory
@@ -100,6 +96,7 @@ class JSONResultsGenerator(object):
all_tests: List of all the tests that were run. This should not
include skipped tests.
"""
+ self._port = port
self._builder_name = builder_name
self._build_name = build_name
self._build_number = build_number
@@ -122,22 +119,24 @@ class JSONResultsGenerator(object):
results_file.write(json)
results_file.close()
- def _get_svn_revision(self, in_directory=None):
+ def _get_svn_revision(self, in_directory):
"""Returns the svn revision for the given directory.
Args:
in_directory: The directory where svn is to be run.
"""
- output = subprocess.Popen(["svn", "info", "--xml"],
- cwd=in_directory,
- shell=(sys.platform == 'win32'),
- stdout=subprocess.PIPE).communicate()[0]
- try:
- dom = xml.dom.minidom.parseString(output)
- return dom.getElementsByTagName('entry')[0].getAttribute(
- 'revision')
- except xml.parsers.expat.ExpatError:
- return ""
+ if os.path.exists(os.path.join(in_directory, '.svn')):
+ output = subprocess.Popen(["svn", "info", "--xml"],
+ cwd=in_directory,
+ shell=(sys.platform == 'win32'),
+ stdout=subprocess.PIPE).communicate()[0]
+ try:
+ dom = xml.dom.minidom.parseString(output)
+ return dom.getElementsByTagName('entry')[0].getAttribute(
+ 'revision')
+ except xml.parsers.expat.ExpatError:
+ return ""
+ return ""
def _get_archived_json_results(self):
"""Reads old results JSON file if it exists.
@@ -305,16 +304,19 @@ class JSONResultsGenerator(object):
self._insert_item_into_raw_list(results_for_builder,
self._build_number, self.BUILD_NUMBERS)
- path_to_webkit = path_utils.path_from_base('third_party', 'WebKit',
- 'WebCore')
- self._insert_item_into_raw_list(results_for_builder,
- self._get_svn_revision(path_to_webkit),
- self.WEBKIT_SVN)
-
- path_to_chrome_base = path_utils.path_from_base()
- self._insert_item_into_raw_list(results_for_builder,
- self._get_svn_revision(path_to_chrome_base),
- self.CHROME_SVN)
+ # These next two branches test to see which source repos we can
+ # pull revisions from.
+ if hasattr(self._port, 'path_from_webkit_base'):
+ path_to_webkit = self._port.path_from_webkit_base()
+ self._insert_item_into_raw_list(results_for_builder,
+ self._get_svn_revision(path_to_webkit),
+ self.WEBKIT_SVN)
+
+ if hasattr(self._port, 'path_from_chromium_base'):
+ path_to_chrome = self._port.path_from_chromium_base()
+ self._insert_item_into_raw_list(results_for_builder,
+ self._get_svn_revision(path_to_chrome),
+ self.CHROME_SVN)
self._insert_item_into_raw_list(results_for_builder,
int(time.time()),
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_expectations.py b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_expectations.py
index 5b0d186..a3650ed 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_expectations.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_expectations.py
@@ -36,10 +36,7 @@ import os
import re
import sys
import time
-from port import path_utils
-sys.path.append(path_utils.path_from_base('third_party', 'WebKit',
- 'WebKitTools'))
import simplejson
# Test expectation and modifier constants.
@@ -53,12 +50,28 @@ import simplejson
class TestExpectations:
TEST_LIST = "test_expectations.txt"
- def __init__(self, tests, directory, platform, is_debug_mode, is_lint_mode,
- tests_are_present=True):
- """Reads the test expectations files from the given directory."""
- path = os.path.join(directory, self.TEST_LIST)
- self._expected_failures = TestExpectationsFile(path, tests, platform,
- is_debug_mode, is_lint_mode, tests_are_present=tests_are_present)
+ def __init__(self, port, tests, expectations, test_platform_name,
+ is_debug_mode, is_lint_mode, tests_are_present=True):
+ """Loads and parses the test expectations given in the string.
+ Args:
+ port: handle to object containing platform-specific functionality
+ test: list of all of the test files
+ expectations: test expectations as a string
+ test_platform_name: name of the platform to match expectations
+ against. Note that this may be different than
+ port.test_platform_name() when is_lint_mode is True.
+ is_debug_mode: whether to use the DEBUG or RELEASE modifiers
+ in the expectations
+ is_lint_mode: If True, just parse the expectations string
+ looking for errors.
+ tests_are_present: whether the test files exist in the file
+ system and can be probed for. This is useful for distinguishing
+ test files from directories, and is needed by the LTTF
+ dashboard, where the files aren't actually locally present.
+ """
+ self._expected_failures = TestExpectationsFile(port, expectations,
+ tests, test_platform_name, is_debug_mode, is_lint_mode,
+ tests_are_present=tests_are_present)
# TODO(ojan): Allow for removing skipped tests when getting the list of
# tests to run, but not when getting metrics.
@@ -230,9 +243,6 @@ class TestExpectationsFile:
EXPECTATION_ORDER = (PASS, CRASH, TIMEOUT, MISSING, IMAGE_PLUS_TEXT,
TEXT, IMAGE, FAIL, SKIP)
- BASE_PLATFORMS = ('linux', 'mac', 'win')
- PLATFORMS = BASE_PLATFORMS + ('win-xp', 'win-vista', 'win-7')
-
BUILD_TYPES = ('debug', 'release')
MODIFIERS = {'skip': SKIP,
@@ -251,37 +261,34 @@ class TestExpectationsFile:
'fail': FAIL,
'flaky': FLAKY}
- def __init__(self, path, full_test_list, platform, is_debug_mode,
- is_lint_mode, expectations_as_str=None, suppress_errors=False,
+ def __init__(self, port, expectations, full_test_list, test_platform_name,
+ is_debug_mode, is_lint_mode, suppress_errors=False,
tests_are_present=True):
"""
- path: The path to the expectation file. An error is thrown if a test is
- listed more than once.
+ expectations: Contents of the expectations file
full_test_list: The list of all tests to be run pending processing of
the expections for those tests.
- platform: Which platform from self.PLATFORMS to filter tests for.
+ test_platform_name: name of the platform to match expectations
+ against. Note that this may be different than
+ port.test_platform_name() when is_lint_mode is True.
is_debug_mode: Whether we testing a test_shell built debug mode.
is_lint_mode: Whether this is just linting test_expecatations.txt.
- expectations_as_str: Contents of the expectations file. Used instead of
- the path. This makes unittesting sane.
suppress_errors: Whether to suppress lint errors.
tests_are_present: Whether the test files are present in the local
filesystem. The LTTF Dashboard uses False here to avoid having to
keep a local copy of the tree.
"""
- self._path = path
- self._expectations_as_str = expectations_as_str
+ self._port = port
+ self._expectations = expectations
+ self._full_test_list = full_test_list
+ self._test_platform_name = test_platform_name
+ self._is_debug_mode = is_debug_mode
self._is_lint_mode = is_lint_mode
self._tests_are_present = tests_are_present
- self._full_test_list = full_test_list
self._suppress_errors = suppress_errors
self._errors = []
self._non_fatal_errors = []
- self._platform = self.to_test_platform_name(platform)
- if self._platform is None:
- raise Exception("Unknown platform '%s'" % (platform))
- self._is_debug_mode = is_debug_mode
# Maps relative test paths as listed in the expectations file to a
# list of maps containing modifiers and expectations for each time
@@ -320,27 +327,13 @@ class TestExpectationsFile:
"""Returns an object that can be iterated over. Allows for not caring
about whether we're iterating over a file or a new-line separated
string."""
- if self._expectations_as_str:
- iterable = [x + "\n" for x in
- self._expectations_as_str.split("\n")]
- # Strip final entry if it's empty to avoid added in an extra
- # newline.
- if iterable[len(iterable) - 1] == "\n":
- return iterable[:len(iterable) - 1]
- return iterable
- else:
- return open(self._path)
-
- def to_test_platform_name(self, name):
- """Returns the test expectation platform that will be used for a
- given platform name, or None if there is no match."""
- chromium_prefix = 'chromium-'
- name = name.lower()
- if name.startswith(chromium_prefix):
- name = name[len(chromium_prefix):]
- if name in self.PLATFORMS:
- return name
- return None
+ iterable = [x + "\n" for x in
+ self._expectations.split("\n")]
+ # Strip final entry if it's empty to avoid added in an extra
+ # newline.
+ if iterable[-1] == "\n":
+ return iterable[:-1]
+ return iterable
def get_test_set(self, modifier, expectation=None, include_skips=True):
if expectation is None:
@@ -398,6 +391,12 @@ class TestExpectationsFile:
no
"""
+ # FIXME - remove_platform_from file worked by writing a new
+ # test_expectations.txt file over the old one. Now that we're just
+ # parsing strings, we need to change this to return the new
+ # expectations string.
+ raise NotImplementedException('remove_platform_from_file')
+
new_file = self._path + '.new'
logging.debug('Original file: "%s"', self._path)
logging.debug('New file: "%s"', new_file)
@@ -430,11 +429,12 @@ class TestExpectationsFile:
elif action == ADD_PLATFORMS_EXCEPT_THIS:
parts = line.split(':')
new_options = parts[0]
- for p in self.PLATFORMS:
- p = p.upper();
+ for p in self._port.test_platform_names():
+ p = p.upper()
# This is a temp solution for rebaselining tool.
# Do not add tags WIN-7 and WIN-VISTA to test expectations
- # if the original line does not specify the platform option.
+ # if the original line does not specify the platform
+ # option.
# TODO(victorw): Remove WIN-VISTA and WIN-7 once we have
# reliable Win 7 and Win Vista buildbots setup.
if not p in (platform.upper(), 'WIN-VISTA', 'WIN-7'):
@@ -517,7 +517,7 @@ class TestExpectationsFile:
has_any_platform = False
for option in options:
- if option in self.PLATFORMS:
+ if option in self._port.test_platform_names():
has_any_platform = True
if not option == platform:
return REMOVE_PLATFORM
@@ -547,7 +547,7 @@ class TestExpectationsFile:
for option in options:
if option in self.MODIFIERS:
modifiers.add(option)
- elif option in self.PLATFORMS:
+ elif option in self._port.test_platform_names():
has_any_platform = True
elif option.startswith('bug'):
has_bug_id = True
@@ -590,7 +590,7 @@ class TestExpectationsFile:
options: list of options
"""
for opt in options:
- if self._platform.startswith(opt):
+ if self._test_platform_name.startswith(opt):
return True
return False
@@ -632,7 +632,7 @@ class TestExpectationsFile:
'indefinitely, then it should be just timeout.',
test_list_path)
- full_path = os.path.join(path_utils.layout_tests_dir(),
+ full_path = os.path.join(self._port.layout_tests_dir(),
test_list_path)
full_path = os.path.normpath(full_path)
# WebKit's way of skipping tests is to add a -disabled suffix.
@@ -662,7 +662,7 @@ class TestExpectationsFile:
else:
build_type = 'RELEASE'
print "\nFAILURES FOR PLATFORM: %s, BUILD_TYPE: %s" \
- % (self._platform.upper(), build_type)
+ % (self._test_platform_name.upper(), build_type)
for error in self._non_fatal_errors:
logging.error(error)
@@ -695,7 +695,7 @@ class TestExpectationsFile:
def _expand_tests(self, test_list_path):
"""Convert the test specification to an absolute, normalized
path and make sure directories end with the OS path separator."""
- path = os.path.join(path_utils.layout_tests_dir(), test_list_path)
+ path = os.path.join(self._port.layout_tests_dir(), test_list_path)
path = os.path.normpath(path)
path = self._fix_dir(path)
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_files.py b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_files.py
index b7e620d..3c087c0 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_files.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_files.py
@@ -36,7 +36,6 @@ under that directory."""
import glob
import os
-from port import path_utils
# When collecting test cases, we include any file with these extensions.
_supported_file_extensions = set(['.html', '.shtml', '.xml', '.xhtml', '.pl',
@@ -45,7 +44,7 @@ _supported_file_extensions = set(['.html', '.shtml', '.xml', '.xhtml', '.pl',
_skipped_directories = set(['.svn', '_svn', 'resources', 'script-tests'])
-def gather_test_files(paths):
+def gather_test_files(port, paths):
"""Generate a set of test files and return them.
Args:
@@ -57,14 +56,14 @@ def gather_test_files(paths):
if paths:
for path in paths:
# If there's an * in the name, assume it's a glob pattern.
- path = os.path.join(path_utils.layout_tests_dir(), path)
+ path = os.path.join(port.layout_tests_dir(), path)
if path.find('*') > -1:
filenames = glob.glob(path)
paths_to_walk.update(filenames)
else:
paths_to_walk.add(path)
else:
- paths_to_walk.add(path_utils.layout_tests_dir())
+ paths_to_walk.add(port.layout_tests_dir())
# Now walk all the paths passed in on the command line and get filenames
test_files = set()
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_shell_thread.py b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_shell_thread.py
index 9f52686..3452035 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_shell_thread.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_shell_thread.py
@@ -40,21 +40,22 @@ import logging
import os
import Queue
import signal
-import subprocess
import sys
import thread
import threading
import time
-from port import path_utils
import test_failures
-def process_output(proc, test_info, test_types, test_args, target, output_dir):
+def process_output(port, test_info, test_types, test_args, target, output_dir,
+ crash, timeout, test_run_time, actual_checksum,
+ output, error):
"""Receives the output from a test_shell process, subjects it to a number
of tests, and returns a list of failure types the test produced.
Args:
+ port: port-specific hooks
proc: an active test_shell process
test_info: Object containing the test filename, uri and timeout
test_types: list of test types to subject the output to
@@ -64,84 +65,39 @@ def process_output(proc, test_info, test_types, test_args, target, output_dir):
Returns: a list of failure objects and times for the test being processed
"""
- outlines = []
- extra_lines = []
failures = []
- crash = False
# Some test args, such as the image hash, may be added or changed on a
# test-by-test basis.
local_test_args = copy.copy(test_args)
- start_time = time.time()
-
- line = proc.stdout.readline()
-
- # Only start saving output lines once we've loaded the URL for the test.
- url = None
- test_string = test_info.uri.strip()
-
- while line.rstrip() != "#EOF":
- # Make sure we haven't crashed.
- if line == '' and proc.poll() is not None:
- failures.append(test_failures.FailureCrash())
-
- # This is hex code 0xc000001d, which is used for abrupt
- # termination. This happens if we hit ctrl+c from the prompt and
- # we happen to be waiting on the test_shell.
- # sdoyon: Not sure for which OS and in what circumstances the
- # above code is valid. What works for me under Linux to detect
- # ctrl+c is for the subprocess returncode to be negative SIGINT.
- # And that agrees with the subprocess documentation.
- if (-1073741510 == proc.returncode or
- - signal.SIGINT == proc.returncode):
- raise KeyboardInterrupt
- crash = True
- break
-
- # Don't include #URL lines in our output
- if line.startswith("#URL:"):
- url = line.rstrip()[5:]
- if url != test_string:
- logging.fatal("Test got out of sync:\n|%s|\n|%s|" %
- (url, test_string))
- raise AssertionError("test out of sync")
- elif line.startswith("#MD5:"):
- local_test_args.hash = line.rstrip()[5:]
- elif line.startswith("#TEST_TIMED_OUT"):
- # Test timed out, but we still need to read until #EOF.
- failures.append(test_failures.FailureTimeout())
- elif url:
- outlines.append(line)
- else:
- extra_lines.append(line)
-
- line = proc.stdout.readline()
-
- end_test_time = time.time()
-
- if len(extra_lines):
- extra = "".join(extra_lines)
- if crash:
- logging.debug("Stacktrace for %s:\n%s" % (test_string, extra))
- # Strip off "file://" since RelativeTestFilename expects
- # filesystem paths.
- filename = os.path.join(output_dir,
- path_utils.relative_test_filename(test_string[7:]))
- filename = os.path.splitext(filename)[0] + "-stack.txt"
- path_utils.maybe_make_directory(os.path.split(filename)[0])
- open(filename, "wb").write(extra)
- else:
- logging.debug("Previous test output extra lines after dump:\n%s" %
- extra)
+ local_test_args.hash = actual_checksum
+
+ if crash:
+ failures.append(test_failures.FailureCrash())
+ if timeout:
+ failures.append(test_failures.FailureTimeout())
+
+ if crash:
+ logging.debug("Stacktrace for %s:\n%s" % (test_info.filename, error))
+ # Strip off "file://" since RelativeTestFilename expects
+ # filesystem paths.
+ filename = os.path.join(output_dir, test_info.filename)
+ filename = os.path.splitext(filename)[0] + "-stack.txt"
+ port.maybe_make_directory(os.path.split(filename)[0])
+ open(filename, "wb").write(error)
+ elif error:
+ logging.debug("Previous test output extra lines after dump:\n%s" %
+ error)
# Check the output and save the results.
+ start_time = time.time()
time_for_diffs = {}
for test_type in test_types:
start_diff_time = time.time()
- new_failures = test_type.compare_output(test_info.filename,
- proc, ''.join(outlines),
- local_test_args, target)
+ new_failures = test_type.compare_output(port, test_info.filename,
+ output, local_test_args,
+ target)
# Don't add any more failures if we already have a crash, so we don't
# double-report those tests. We do double-report for timeouts since
# we still want to see the text and image output.
@@ -150,28 +106,11 @@ def process_output(proc, test_info, test_types, test_args, target, output_dir):
time_for_diffs[test_type.__class__.__name__] = (
time.time() - start_diff_time)
- total_time_for_all_diffs = time.time() - end_test_time
- test_run_time = end_test_time - start_time
+ total_time_for_all_diffs = time.time() - start_diff_time
return TestStats(test_info.filename, failures, test_run_time,
total_time_for_all_diffs, time_for_diffs)
-def start_test_shell(command, args):
- """Returns the process for a new test_shell started in layout-tests mode.
- """
- cmd = []
- # Hook for injecting valgrind or other runtime instrumentation,
- # used by e.g. tools/valgrind/valgrind_tests.py.
- wrapper = os.environ.get("BROWSER_WRAPPER", None)
- if wrapper != None:
- cmd += [wrapper]
- cmd += command + ['--layout-tests'] + args
- return subprocess.Popen(cmd,
- stdin=subprocess.PIPE,
- stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT)
-
-
class TestStats:
def __init__(self, filename, failures, test_run_time,
@@ -186,17 +125,19 @@ class TestStats:
class SingleTestThread(threading.Thread):
"""Thread wrapper for running a single test file."""
- def __init__(self, test_shell_command, shell_args, test_info, test_types,
- test_args, target, output_dir):
+ def __init__(self, port, image_path, shell_args, test_info,
+ test_types, test_args, target, output_dir):
"""
Args:
+ port: object implementing port-specific hooks
test_info: Object containing the test filename, uri and timeout
output_dir: Directory to put crash stacks into.
See TestShellThread for documentation of the remaining arguments.
"""
threading.Thread.__init__(self)
- self._command = test_shell_command
+ self._port = port
+ self._image_path = image_path
self._shell_args = shell_args
self._test_info = test_info
self._test_types = test_types
@@ -205,10 +146,18 @@ class SingleTestThread(threading.Thread):
self._output_dir = output_dir
def run(self):
- proc = start_test_shell(self._command, self._shell_args +
- ["--time-out-ms=" + self._test_info.timeout, self._test_info.uri])
- self._test_stats = process_output(proc, self._test_info,
- self._test_types, self._test_args, self._target, self._output_dir)
+ driver = self._port.start_test_driver(self._image_path,
+ self._shell_args)
+ start = time.time()
+ crash, timeout, actual_checksum, output, error = \
+ driver.run_test(test_info.uri.strip(), test_info.timeout,
+ test_info.image_hash)
+ end = time.time()
+ self._test_stats = process_output(self._port,
+ self._test_info, self._test_types, self._test_args,
+ self._target, self._output_dir, crash, timeout, end - start,
+ actual_checksum, output, error)
+ driver.stop()
def get_test_stats(self):
return self._test_stats
@@ -216,17 +165,16 @@ class SingleTestThread(threading.Thread):
class TestShellThread(threading.Thread):
- def __init__(self, filename_list_queue, result_queue, test_shell_command,
- test_types, test_args, shell_args, options):
+ def __init__(self, port, filename_list_queue, result_queue,
+ test_types, test_args, image_path, shell_args, options):
"""Initialize all the local state for this test shell thread.
Args:
+ port: interface to port-specific hooks
filename_list_queue: A thread safe Queue class that contains lists
of tuples of (filename, uri) pairs.
result_queue: A thread safe Queue class that will contain tuples of
(test, failure lists) for the test results.
- test_shell_command: A list specifying the command+args for
- test_shell
test_types: A list of TestType objects to run the test output
against.
test_args: A TestArguments object to pass to each TestType.
@@ -236,13 +184,14 @@ class TestShellThread(threading.Thread):
run_webkit_tests; they are typically passed via the
run_webkit_tests.TestRunner class."""
threading.Thread.__init__(self)
+ self._port = port
self._filename_list_queue = filename_list_queue
self._result_queue = result_queue
self._filename_list = []
- self._test_shell_command = test_shell_command
self._test_types = test_types
self._test_args = test_args
- self._test_shell_proc = None
+ self._driver = None
+ self._image_path = image_path
self._shell_args = shell_args
self._options = options
self._canceled = False
@@ -379,11 +328,11 @@ class TestShellThread(threading.Thread):
# Print the error message(s).
error_str = '\n'.join([' ' + f.message() for f in failures])
logging.debug("%s %s failed:\n%s" % (self.getName(),
- path_utils.relative_test_filename(filename),
+ self._port.relative_test_filename(filename),
error_str))
else:
logging.debug("%s %s passed" % (self.getName(),
- path_utils.relative_test_filename(filename)))
+ self._port.relative_test_filename(filename)))
self._result_queue.put((filename, failures))
if batch_size > 0 and batch_count > batch_size:
@@ -407,7 +356,7 @@ class TestShellThread(threading.Thread):
Return:
A list of TestFailure objects describing the error.
"""
- worker = SingleTestThread(self._test_shell_command,
+ worker = SingleTestThread(self._port, self._image_path,
self._shell_args,
test_info,
self._test_types,
@@ -431,7 +380,7 @@ class TestShellThread(threading.Thread):
# tradeoff in order to avoid losing the rest of this thread's
# results.
logging.error('Test thread hung: killing all test_shells')
- path_utils.kill_all_test_shells()
+ worker._driver.stop()
try:
stats = worker.get_test_stats()
@@ -454,32 +403,23 @@ class TestShellThread(threading.Thread):
A list of TestFailure objects describing the error.
"""
self._ensure_test_shell_is_running()
- # Args to test_shell is a space-separated list of
- # "uri timeout pixel_hash"
- # The timeout and pixel_hash are optional. The timeout is used if this
- # test has a custom timeout. The pixel_hash is used to avoid doing an
- # image dump if the checksums match, so it should be set to a blank
- # value if we are generating a new baseline.
- # (Otherwise, an image from a previous run will be copied into
- # the baseline.)
+ # The pixel_hash is used to avoid doing an image dump if the
+ # checksums match, so it should be set to a blank value if we
+ # are generating a new baseline. (Otherwise, an image from a
+ # previous run will be copied into the baseline.)
image_hash = test_info.image_hash
if image_hash and self._test_args.new_baseline:
image_hash = ""
- self._test_shell_proc.stdin.write(("%s %s %s\n" %
- (test_info.uri, test_info.timeout, image_hash)))
-
- # If the test shell is dead, the above may cause an IOError as we
- # try to write onto the broken pipe. If this is the first test for
- # this test shell process, than the test shell did not
- # successfully start. If this is not the first test, then the
- # previous tests have caused some kind of delayed crash. We don't
- # try to recover here.
- self._test_shell_proc.stdin.flush()
-
- stats = process_output(self._test_shell_proc, test_info,
- self._test_types, self._test_args,
- self._options.target,
- self._options.results_directory)
+ start = time.time()
+ crash, timeout, actual_checksum, output, error = \
+ self._driver.run_test(test_info.uri, test_info.timeout, image_hash)
+ end = time.time()
+
+ stats = process_output(self._port, test_info, self._test_types,
+ self._test_args, self._options.target,
+ self._options.results_directory, crash,
+ timeout, end - start, actual_checksum,
+ output, error)
self._test_stats.append(stats)
return stats.failures
@@ -489,23 +429,12 @@ class TestShellThread(threading.Thread):
running tests singly, since those each start a separate test shell in
their own thread.
"""
- if (not self._test_shell_proc or
- self._test_shell_proc.poll() is not None):
- self._test_shell_proc = start_test_shell(self._test_shell_command,
- self._shell_args)
+ if (not self._driver or self._driver.poll() is not None):
+ self._driver = self._port.start_driver(
+ self._image_path, self._shell_args)
def _kill_test_shell(self):
"""Kill the test shell process if it's running."""
- if self._test_shell_proc:
- self._test_shell_proc.stdin.close()
- self._test_shell_proc.stdout.close()
- if self._test_shell_proc.stderr:
- self._test_shell_proc.stderr.close()
- if (sys.platform not in ('win32', 'cygwin') and
- not self._test_shell_proc.poll()):
- # Closing stdin/stdout/stderr hangs sometimes on OS X.
- null = open(os.devnull, "w")
- subprocess.Popen(["kill", "-9",
- str(self._test_shell_proc.pid)], stderr=null)
- null.close()
- self._test_shell_proc = None
+ if self._driver:
+ self._driver.stop()
+ self._driver = None
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/__init__.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/__init__.py
index 1730085..3509675 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/__init__.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/__init__.py
@@ -27,24 +27,39 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-"""Platform-specific utilities and pseudo-constants
+"""Port-specific entrypoints for the layout tests test infrastructure."""
-Any functions whose implementations or values differ from one platform to
-another should be defined in their respective <platform>.py
-modules. The appropriate one of those will be imported into this module to
-provide callers with a common, platform-independent interface.
-
-This file should only ever be imported by layout_package.path_utils.
-"""
import sys
-# We may not support the version of Python that a user has installed (Cygwin
-# especially has had problems), but we'll allow the platform utils to be
-# included in any case so we don't get an import error.
-if sys.platform in ('cygwin', 'win32'):
- from chromium_win import *
-elif sys.platform == 'darwin':
- from chromium_mac import *
-elif sys.platform in ('linux', 'linux2', 'freebsd7', 'openbsd4'):
- from chromium_linux import *
+
+def get(port_name=None, options=None):
+ """Returns an object implementing the Port interface. If
+ port_name is None, this routine attempts to guess at the most
+ appropriate port on this platform."""
+ port_to_use = port_name
+ if port_to_use is None:
+ if sys.platform == 'win32':
+ port_to_use = 'chromium-win'
+ elif sys.platform == 'linux2':
+ port_to_use = 'chromium-linux'
+ elif sys.platform == 'darwin':
+ port_to_use = 'chromium-mac'
+
+ if port_to_use == 'test':
+ import test
+ return test.TestPort(port_name, options)
+ elif port_to_use.startswith('mac'):
+ import mac
+ return mac.MacPort(port_name, options)
+ elif port_to_use.startswith('chromium-mac'):
+ import chromium_mac
+ return chromium_mac.ChromiumMacPort(port_name, options)
+ elif port_to_use.startswith('chromium-linux'):
+ import chromium_linux
+ return chromium_linux.ChromiumLinuxPort(port_name, options)
+ elif port_to_use.startswith('chromium-win'):
+ import chromium_win
+ return chromium_win.ChromiumWinPort(port_name, options)
+
+ raise NotImplementedError('unsupported port: %s' % port_to_use)
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/apache_http_server.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/apache_http_server.py
index 1fb0367..9ff3671 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/apache_http_server.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/apache_http_server.py
@@ -37,19 +37,19 @@ import subprocess
import sys
import http_server_base
-import path_utils
-import port
class LayoutTestApacheHttpd(http_server_base.HttpServerBase):
- def __init__(self, output_dir):
+ def __init__(self, port_obj, output_dir):
"""Args:
+ port_obj: handle to the platform-specific routines
output_dir: the absolute path to the layout test result directory
"""
+ http_server_base.HttpServerBase.__init__(self, port_obj)
self._output_dir = output_dir
self._httpd_proc = None
- path_utils.maybe_make_directory(output_dir)
+ port_obj.maybe_make_directory(output_dir)
self.mappings = [{'port': 8000},
{'port': 8080},
@@ -59,15 +59,14 @@ class LayoutTestApacheHttpd(http_server_base.HttpServerBase):
# The upstream .conf file assumed the existence of /tmp/WebKit for
# placing apache files like the lock file there.
self._runtime_path = os.path.join("/tmp", "WebKit")
- path_utils.maybe_make_directory(self._runtime_path)
+ port_obj.maybe_make_directory(self._runtime_path)
# The PID returned when Apache is started goes away (due to dropping
# privileges?). The proper controlling PID is written to a file in the
# apache runtime directory.
self._pid_file = os.path.join(self._runtime_path, 'httpd.pid')
- test_dir = path_utils.path_from_base('third_party', 'WebKit',
- 'LayoutTests')
+ test_dir = self._port_obj.layout_tests_dir()
js_test_resources_dir = self._cygwin_safe_join(test_dir, "fast", "js",
"resources")
mime_types_path = self._cygwin_safe_join(test_dir, "http", "conf",
@@ -78,7 +77,7 @@ class LayoutTestApacheHttpd(http_server_base.HttpServerBase):
error_log = self._cygwin_safe_join(output_dir, "error_log.txt")
document_root = self._cygwin_safe_join(test_dir, "http", "tests")
- executable = port.apache_executable_path()
+ executable = self._port_obj._path_to_apache()
if self._is_cygwin():
executable = self._get_cygwin_path(executable)
@@ -95,7 +94,8 @@ class LayoutTestApacheHttpd(http_server_base.HttpServerBase):
os.environ.get("USER", ""))]
if self._is_cygwin():
- cygbin = path_utils.path_from_base('third_party', 'cygwin', 'bin')
+ cygbin = self._port_obj._path_from_base('third_party', 'cygwin',
+ 'bin')
# Not entirely sure why, but from cygwin we need to run the
# httpd command through bash.
self._start_cmd = [
@@ -146,7 +146,7 @@ class LayoutTestApacheHttpd(http_server_base.HttpServerBase):
test_dir: absolute path to the LayoutTests directory.
output_dir: absolute path to the layout test results directory.
"""
- httpd_config = port.apache_config_file_path()
+ httpd_config = self._port_obj._path_to_apache_config_file()
httpd_config_copy = os.path.join(output_dir, "httpd.conf")
httpd_conf = open(httpd_config).read()
if self._is_cygwin():
@@ -156,22 +156,11 @@ class LayoutTestApacheHttpd(http_server_base.HttpServerBase):
# plus the relative paths to the .so files listed in the .conf
# file. We have apache/cygwin checked into our tree so
# people don't have to install it into their cygwin.
- cygusr = path_utils.path_from_base('third_party', 'cygwin', 'usr')
+ cygusr = self._port_obj._path_from_base('third_party', 'cygwin',
+ 'usr')
httpd_conf = httpd_conf.replace('ServerRoot "/usr"',
'ServerRoot "%s"' % self._get_cygwin_path(cygusr))
- # TODO(ojan): Instead of writing an extra file, checkin a conf file
- # upstream. Or, even better, upstream/delete all our chrome http
- # tests so we don't need this special-cased DocumentRoot and then
- # just use the upstream
- # conf file.
- chrome_document_root = path_utils.path_from_base('webkit', 'data',
- 'layout_tests')
- if self._is_cygwin():
- chrome_document_root = self._get_cygwin_path(chrome_document_root)
- httpd_conf = (httpd_conf +
- self._get_virtual_host_config(chrome_document_root, 8081))
-
f = open(httpd_config_copy, 'wb')
f.write(httpd_conf)
f.close()
@@ -226,4 +215,4 @@ class LayoutTestApacheHttpd(http_server_base.HttpServerBase):
httpd_pid = None
if os.path.exists(self._pid_file):
httpd_pid = int(open(self._pid_file).readline())
- path_utils.shut_down_http_server(httpd_pid)
+ self._port_obj._shut_down_http_server(httpd_pid)
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py
new file mode 100644
index 0000000..ce06b44
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py
@@ -0,0 +1,645 @@
+#!/usr/bin/env python
+# 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 Google name 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.
+
+"""Abstract base class of Port-specific entrypoints for the layout tests
+test infrastructure (the Port and Driver classes)."""
+
+import cgi
+import difflib
+import errno
+import os
+import subprocess
+import sys
+
+import apache_http_server
+import http_server
+import websocket_server
+
+# Python bug workaround. See Port.wdiff_text() for an explanation.
+_wdiff_available = True
+
+
+# FIXME: This class should merge with webkitpy.webkit_port at some point.
+class Port(object):
+ """Abstract class for Port-specific hooks for the layout_test package.
+ """
+
+ def __init__(self, port_name=None, options=None):
+ self._name = port_name
+ self._options = options
+ self._helper = None
+ self._http_server = None
+ self._webkit_base_dir = None
+ self._websocket_server = None
+
+ def baseline_path(self):
+ """Return the absolute path to the directory to store new baselines
+ in for this port."""
+ raise NotImplementedError('Port.baseline_path')
+
+ def baseline_search_path(self):
+ """Return a list of absolute paths to directories to search under for
+ baselines. The directories are searched in order."""
+ raise NotImplementedError('Port.baseline_search_path')
+
+ def check_sys_deps(self):
+ """If the port needs to do some runtime checks to ensure that the
+ tests can be run successfully, they should be done here.
+
+ Returns whether the system is properly configured."""
+ raise NotImplementedError('Port.check_sys_deps')
+
+ def compare_text(self, actual_text, expected_text):
+ """Return whether or not the two strings are *not* equal. This
+ routine is used to diff text output.
+
+ While this is a generic routine, we include it in the Port
+ interface so that it can be overriden for testing purposes."""
+ return actual_text != expected_text
+
+ def diff_image(self, actual_filename, expected_filename, diff_filename):
+ """Compare two image files and produce a delta image file.
+
+ Return 1 if the two files are different, 0 if they are the same.
+ Also produce a delta image of the two images and write that into
+ |diff_filename|.
+
+ While this is a generic routine, we include it in the Port
+ interface so that it can be overriden for testing purposes."""
+ executable = self._path_to_image_diff()
+ cmd = [executable, '--diff', actual_filename, expected_filename,
+ diff_filename]
+ result = 1
+ try:
+ result = subprocess.call(cmd)
+ except OSError, e:
+ if e.errno == errno.ENOENT or e.errno == errno.EACCES:
+ _compare_available = False
+ else:
+ raise e
+ except ValueError:
+ # work around a race condition in Python 2.4's implementation
+ # of subprocess.Popen. See http://bugs.python.org/issue1199282 .
+ pass
+ return result
+
+ def diff_text(self, actual_text, expected_text,
+ actual_filename, expected_filename):
+ """Returns a string containing the diff of the two text strings
+ in 'unified diff' format.
+
+ While this is a generic routine, we include it in the Port
+ interface so that it can be overriden for testing purposes."""
+ diff = difflib.unified_diff(expected_text.splitlines(True),
+ actual_text.splitlines(True),
+ expected_filename,
+ actual_filename)
+ return ''.join(diff)
+
+ def expected_baselines(self, filename, suffix, all_baselines=False):
+ """Given a test name, finds where the baseline results are located.
+
+ Args:
+ filename: absolute filename to test file
+ suffix: file suffix of the expected results, including dot; e.g.
+ '.txt' or '.png'. This should not be None, but may be an empty
+ string.
+ all_baselines: If True, return an ordered list of all baseline paths
+ for the given platform. If False, return only the first one.
+ Returns
+ a list of ( platform_dir, results_filename ), where
+ platform_dir - abs path to the top of the results tree (or test
+ tree)
+ results_filename - relative path from top of tree to the results
+ file
+ (os.path.join of the two gives you the full path to the file,
+ unless None was returned.)
+ Return values will be in the format appropriate for the current
+ platform (e.g., "\\" for path separators on Windows). If the results
+ file is not found, then None will be returned for the directory,
+ but the expected relative pathname will still be returned.
+
+ This routine is generic but lives here since it is used in
+ conjunction with the other baseline and filename routines that are
+ platform specific.
+ """
+ testname = os.path.splitext(self.relative_test_filename(filename))[0]
+
+ baseline_filename = testname + '-expected' + suffix
+
+ baseline_search_path = self.baseline_search_path()
+
+ baselines = []
+ for platform_dir in baseline_search_path:
+ if os.path.exists(os.path.join(platform_dir, baseline_filename)):
+ baselines.append((platform_dir, baseline_filename))
+
+ if not all_baselines and baselines:
+ return baselines
+
+ # If it wasn't found in a platform directory, return the expected
+ # result in the test directory, even if no such file actually exists.
+ platform_dir = self.layout_tests_dir()
+ if os.path.exists(os.path.join(platform_dir, baseline_filename)):
+ baselines.append((platform_dir, baseline_filename))
+
+ if baselines:
+ return baselines
+
+ return [(None, baseline_filename)]
+
+ def expected_filename(self, filename, suffix):
+ """Given a test name, returns an absolute path to its expected results.
+
+ If no expected results are found in any of the searched directories,
+ the directory in which the test itself is located will be returned.
+ The return value is in the format appropriate for the platform
+ (e.g., "\\" for path separators on windows).
+
+ Args:
+ filename: absolute filename to test file
+ suffix: file suffix of the expected results, including dot; e.g. '.txt'
+ or '.png'. This should not be None, but may be an empty string.
+ platform: the most-specific directory name to use to build the
+ search list of directories, e.g., 'chromium-win', or
+ 'chromium-mac-leopard' (we follow the WebKit format)
+
+ This routine is generic but is implemented here to live alongside
+ the other baseline and filename manipulation routines.
+ """
+ platform_dir, baseline_filename = self.expected_baselines(
+ filename, suffix)[0]
+ if platform_dir:
+ return os.path.join(platform_dir, baseline_filename)
+ return os.path.join(self.layout_tests_dir(), baseline_filename)
+
+ def filename_to_uri(self, filename):
+ """Convert a test file to a URI."""
+ LAYOUTTEST_HTTP_DIR = "http/tests/"
+ LAYOUTTEST_WEBSOCKET_DIR = "websocket/tests/"
+
+ relative_path = self.relative_test_filename(filename)
+ port = None
+ use_ssl = False
+
+ if relative_path.startswith(LAYOUTTEST_HTTP_DIR):
+ # http/tests/ run off port 8000 and ssl/ off 8443
+ relative_path = relative_path[len(LAYOUTTEST_HTTP_DIR):]
+ port = 8000
+ elif relative_path.startswith(LAYOUTTEST_WEBSOCKET_DIR):
+ # websocket/tests/ run off port 8880 and 9323
+ # Note: the root is /, not websocket/tests/
+ port = 8880
+
+ # Make http/tests/local run as local files. This is to mimic the
+ # logic in run-webkit-tests.
+ #
+ # TODO(dpranke): remove the media reference and the SSL reference?
+ if (port and not relative_path.startswith("local/") and
+ not relative_path.startswith("media/")):
+ if relative_path.startswith("ssl/"):
+ port += 443
+ protocol = "https"
+ else:
+ protocol = "http"
+ return "%s://127.0.0.1:%u/%s" % (protocol, port, relative_path)
+
+ if sys.platform in ('cygwin', 'win32'):
+ return "file:///" + self.get_absolute_path(filename)
+ return "file://" + self.get_absolute_path(filename)
+
+ def get_absolute_path(self, filename):
+ """Return the absolute path in unix format for the given filename.
+
+ This routine exists so that platforms that don't use unix filenames
+ can convert accordingly."""
+ return os.path.abspath(filename)
+
+ def layout_tests_dir(self):
+ """Return the absolute path to the top of the LayoutTests directory."""
+ return self.path_from_webkit_base('LayoutTests')
+
+ def maybe_make_directory(self, *path):
+ """Creates the specified directory if it doesn't already exist."""
+ try:
+ os.makedirs(os.path.join(*path))
+ except OSError, e:
+ if e.errno != errno.EEXIST:
+ raise
+
+ def name(self):
+ """Return the name of the port (e.g., 'mac', 'chromium-win-xp').
+
+ Note that this is different from the test_platform_name(), which
+ may be different (e.g., 'win-xp' instead of 'chromium-win-xp'."""
+ return self._name
+
+ def num_cores(self):
+ """Return the number of cores/cpus available on this machine.
+
+ This routine is used to determine the default amount of parallelism
+ used by run-chromium-webkit-tests."""
+ raise NotImplementedError('Port.num_cores')
+
+ def path_from_webkit_base(self, *comps):
+ """Returns the full path to path made by joining the top of the
+ WebKit source tree and the list of path components in |*comps|."""
+ if not self._webkit_base_dir:
+ abspath = os.path.abspath(__file__)
+ self._webkit_base_dir = abspath[0:abspath.find('WebKitTools')]
+ return os.path.join(self._webkit_base_dir, *comps)
+
+ def remove_directory(self, *path):
+ """Recursively removes a directory, even if it's marked read-only.
+
+ Remove the directory located at *path, if it exists.
+
+ shutil.rmtree() doesn't work on Windows if any of the files
+ or directories are read-only, which svn repositories and
+ some .svn files are. We need to be able to force the files
+ to be writable (i.e., deletable) as we traverse the tree.
+
+ Even with all this, Windows still sometimes fails to delete a file,
+ citing a permission error (maybe something to do with antivirus
+ scans or disk indexing). The best suggestion any of the user
+ forums had was to wait a bit and try again, so we do that too.
+ It's hand-waving, but sometimes it works. :/
+ """
+ file_path = os.path.join(*path)
+ if not os.path.exists(file_path):
+ return
+
+ win32 = False
+ if sys.platform == 'win32':
+ win32 = True
+ # Some people don't have the APIs installed. In that case we'll do
+ # without.
+ try:
+ win32api = __import__('win32api')
+ win32con = __import__('win32con')
+ except ImportError:
+ win32 = False
+
+ def remove_with_retry(rmfunc, path):
+ os.chmod(path, stat.S_IWRITE)
+ if win32:
+ win32api.SetFileAttributes(path,
+ win32con.FILE_ATTRIBUTE_NORMAL)
+ try:
+ return rmfunc(path)
+ except EnvironmentError, e:
+ if e.errno != errno.EACCES:
+ raise
+ print 'Failed to delete %s: trying again' % repr(path)
+ time.sleep(0.1)
+ return rmfunc(path)
+ else:
+
+ def remove_with_retry(rmfunc, path):
+ if os.path.islink(path):
+ return os.remove(path)
+ else:
+ return rmfunc(path)
+
+ for root, dirs, files in os.walk(file_path, topdown=False):
+ # For POSIX: making the directory writable guarantees
+ # removability. Windows will ignore the non-read-only
+ # bits in the chmod value.
+ os.chmod(root, 0770)
+ for name in files:
+ remove_with_retry(os.remove, os.path.join(root, name))
+ for name in dirs:
+ remove_with_retry(os.rmdir, os.path.join(root, name))
+
+ remove_with_retry(os.rmdir, file_path)
+
+ def test_platform_name(self):
+ return self._name
+
+ def relative_test_filename(self, filename):
+ """Relative unix-style path for a filename under the LayoutTests
+ directory. Filenames outside the LayoutTests directory should raise
+ an error."""
+ return filename[len(self.layout_tests_dir()) + 1:]
+
+ def results_directory(self):
+ """Absolute path to the place to store the test results."""
+ raise NotImplemented('Port.results_directory')
+
+ def setup_test_run(self):
+ """This routine can be overridden to perform any port-specific
+ work that shouuld be done at the beginning of a test run."""
+ pass
+
+ def show_html_results_file(self, results_filename):
+ """This routine should display the HTML file pointed at by
+ results_filename in a users' browser."""
+ raise NotImplementedError('Port.show_html_results_file')
+
+ def start_driver(self, png_path, options):
+ """Starts a new test Driver and returns a handle to the object."""
+ raise NotImplementedError('Port.start_driver')
+
+ def start_helper(self):
+ """Start a layout test helper if needed on this port. The test helper
+ is used to reconfigure graphics settings and do other things that
+ may be necessary to ensure a known test configuration."""
+ raise NotImplementedError('Port.start_helper')
+
+ def start_http_server(self):
+ """Start a web server if it is available. Do nothing if
+ it isn't. This routine is allowed to (and may) fail if a server
+ is already running."""
+ if self._options.use_apache:
+ self._http_server = apache_http_server.LayoutTestApacheHttpd(self,
+ self._options.results_directory)
+ else:
+ self._http_server = http_server.Lighttpd(self,
+ self._options.results_directory)
+ self._http_server.start()
+
+ def start_websocket_server(self):
+ """Start a websocket server if it is available. Do nothing if
+ it isn't. This routine is allowed to (and may) fail if a server
+ is already running."""
+ self._websocket_server = websocket_server.PyWebSocket(self,
+ self._options.results_directory)
+ self._websocket_server.start()
+
+ def stop_helper(self):
+ """Shut down the test helper if it is running. Do nothing if
+ it isn't, or it isn't available."""
+ raise NotImplementedError('Port.stop_helper')
+
+ def stop_http_server(self):
+ """Shut down the http server if it is running. Do nothing if
+ it isn't, or it isn't available."""
+ if self._http_server:
+ self._http_server.stop()
+
+ def stop_websocket_server(self):
+ """Shut down the websocket server if it is running. Do nothing if
+ it isn't, or it isn't available."""
+ if self._websocket_server:
+ self._websocket_server.stop()
+
+ def test_expectations(self):
+ """Returns the test expectations for this port.
+
+ Basically this string should contain the equivalent of a
+ test_expectations file. See test_expectations.py for more details."""
+ raise NotImplementedError('Port.test_expectations')
+
+ def test_base_platform_names(self):
+ """Return a list of the 'base' platforms on your port. The base
+ platforms represent different architectures, operating systems,
+ or implementations (as opposed to different versions of a single
+ platform). For example, 'mac' and 'win' might be different base
+ platforms, wherease 'mac-tiger' and 'mac-leopard' might be
+ different platforms. This routine is used by the rebaselining tool
+ and the dashboards, and the strings correspond to the identifiers
+ in your test expectations (*not* necessarily the platform names
+ themselves)."""
+ raise NotImplementedError('Port.base_test_platforms')
+
+ def test_platform_name(self):
+ """Returns the string that corresponds to the given platform name
+ in the test expectations. This may be the same as name(), or it
+ may be different. For example, chromium returns 'mac' for
+ 'chromium-mac'."""
+ raise NotImplementedError('Port.test_platform_name')
+
+ def test_platforms(self):
+ """Returns the list of test platform identifiers as used in the
+ test_expectations and on dashboards, the rebaselining tool, etc.
+
+ Note that this is not necessarily the same as the list of ports,
+ which must be globally unique (e.g., both 'chromium-mac' and 'mac'
+ might return 'mac' as a test_platform name'."""
+ raise NotImplementedError('Port.platforms')
+
+ def version(self):
+ """Returns a string indicating the version of a given platform, e.g.
+ '-leopard' or '-xp'.
+
+ This is used to help identify the exact port when parsing test
+ expectations, determining search paths, and logging information."""
+ raise NotImplementedError('Port.version')
+
+ def wdiff_text(self, actual_filename, expected_filename):
+ """Returns a string of HTML indicating the word-level diff of the
+ contents of the two filenames. Returns an empty string if word-level
+ diffing isn't available."""
+ executable = self._path_to_wdiff()
+ cmd = [executable,
+ '--start-delete=##WDIFF_DEL##',
+ '--end-delete=##WDIFF_END##',
+ '--start-insert=##WDIFF_ADD##',
+ '--end-insert=##WDIFF_END##',
+ expected_filename,
+ actual_filename]
+ global _wdiff_available
+ result = ''
+ try:
+ # Python's Popen has a bug that causes any pipes opened to a
+ # process that can't be executed to be leaked. Since this
+ # code is specifically designed to tolerate exec failures
+ # to gracefully handle cases where wdiff is not installed,
+ # the bug results in a massive file descriptor leak. As a
+ # workaround, if an exec failure is ever experienced for
+ # wdiff, assume it's not available. This will leak one
+ # file descriptor but that's better than leaking each time
+ # wdiff would be run.
+ #
+ # http://mail.python.org/pipermail/python-list/
+ # 2008-August/505753.html
+ # http://bugs.python.org/issue3210
+ #
+ # It also has a threading bug, so we don't output wdiff if
+ # the Popen raises a ValueError.
+ # http://bugs.python.org/issue1236
+ if _wdiff_available:
+ try:
+ wdiff = subprocess.Popen(cmd,
+ stdout=subprocess.PIPE).communicate()[0]
+ except ValueError, e:
+ # Working around a race in Python 2.4's implementation
+ # of Popen().
+ wdiff = ''
+ wdiff = cgi.escape(wdiff)
+ wdiff = wdiff.replace('##WDIFF_DEL##', '<span class=del>')
+ wdiff = wdiff.replace('##WDIFF_ADD##', '<span class=add>')
+ wdiff = wdiff.replace('##WDIFF_END##', '</span>')
+ result = '<head><style>.del { background: #faa; } '
+ result += '.add { background: #afa; }</style></head>'
+ result += '<pre>' + wdiff + '</pre>'
+ except OSError, e:
+ if (e.errno == errno.ENOENT or e.errno == errno.EACCES or
+ e.errno == errno.ECHILD):
+ _wdiff_available = False
+ else:
+ raise e
+ return result
+
+ #
+ # PROTECTED ROUTINES
+ #
+ # The routines below should only be called by routines in this class
+ # or any of its subclasses.
+ #
+
+ def _kill_process(self, pid):
+ """Forcefully kill a process.
+
+ This routine should not be used or needed generically, but can be
+ used in helper files like http_server.py."""
+ raise NotImplementedError('Port.kill_process')
+
+ def _path_to_apache(self):
+ """Returns the full path to the apache binary.
+
+ This is needed only by ports that use the apache_http_server module."""
+ raise NotImplementedError('Port.path_to_apache')
+
+ def _path_to_apache_config_file(self):
+ """Returns the full path to the apache binary.
+
+ This is needed only by ports that use the apache_http_server module."""
+ raise NotImplementedError('Port.path_to_apache_config_file')
+
+ def _path_to_driver(self):
+ """Returns the full path to the test driver (DumpRenderTree)."""
+ raise NotImplementedError('Port.path_to_driver')
+
+ def _path_to_helper(self):
+ """Returns the full path to the layout_test_helper binary, which
+ is used to help configure the system for the test run, or None
+ if no helper is needed.
+
+ This is likely only used by start/stop_helper()."""
+ raise NotImplementedError('Port._path_to_helper')
+
+ def _path_to_image_diff(self):
+ """Returns the full path to the image_diff binary, or None if it
+ is not available.
+
+ This is likely used only by diff_image()"""
+ raise NotImplementedError('Port.path_to_image_diff')
+
+ def _path_to_lighttpd(self):
+ """Returns the path to the LigHTTPd binary.
+
+ This is needed only by ports that use the http_server.py module."""
+ raise NotImplementedError('Port._path_to_lighttpd')
+
+ def _path_to_lighttpd_modules(self):
+ """Returns the path to the LigHTTPd modules directory.
+
+ This is needed only by ports that use the http_server.py module."""
+ raise NotImplementedError('Port._path_to_lighttpd_modules')
+
+ def _path_to_lighttpd_php(self):
+ """Returns the path to the LigHTTPd PHP executable.
+
+ This is needed only by ports that use the http_server.py module."""
+ raise NotImplementedError('Port._path_to_lighttpd_php')
+
+ def _path_to_wdiff(self):
+ """Returns the full path to the wdiff binary, or None if it is
+ not available.
+
+ This is likely used only by wdiff_text()"""
+ raise NotImplementedError('Port._path_to_wdiff')
+
+ def _shut_down_http_server(self, pid):
+ """Forcefully and synchronously kills the web server.
+
+ This routine should only be called from http_server.py or its
+ subclasses."""
+ raise NotImplementedError('Port._shut_down_http_server')
+
+ def _webkit_baseline_path(self, platform):
+ """Return the full path to the top of the baseline tree for a
+ given platform."""
+ return os.path.join(self.layout_tests_dir(), 'platform',
+ platform)
+
+
+class Driver:
+ """Abstract interface for the DumpRenderTree interface."""
+
+ def __init__(self, port, png_path, options):
+ """Initialize a Driver to subsequently run tests.
+
+ Typically this routine will spawn DumpRenderTree in a config
+ ready for subsequent input.
+
+ port - reference back to the port object.
+ png_path - an absolute path for the driver to write any image
+ data for a test (as a PNG). If no path is provided, that
+ indicates that pixel test results will not be checked.
+ options - any port-specific driver options."""
+ raise NotImplementedError('Driver.__init__')
+
+ def run_test(self, uri, timeout, checksum):
+ """Run a single test and return the results.
+
+ Note that it is okay if a test times out or crashes and leaves
+ the driver in an indeterminate state. The upper layers of the program
+ are responsible for cleaning up and ensuring things are okay.
+
+ uri - a full URI for the given test
+ timeout - number of milliseconds to wait before aborting this test.
+ checksum - if present, the expected checksum for the image for this
+ test
+
+ Returns a tuple of the following:
+ crash - a boolean indicating whether the driver crashed on the test
+ timeout - a boolean indicating whehter the test timed out
+ checksum - a string containing the checksum of the image, if
+ present
+ output - any text output
+ error - any unexpected or additional (or error) text output
+
+ Note that the image itself should be written to the path that was
+ specified in the __init__() call."""
+ raise NotImplementedError('Driver.run_test')
+
+ def poll(self):
+ """Returns None if the Driver is still running. Returns the returncode
+ if it has exited."""
+ raise NotImplementedError('Driver.poll')
+
+ def returncode(self):
+ """Returns the system-specific returncode if the Driver has stopped or
+ exited."""
+ raise NotImplementedError('Driver.returncode')
+
+ def stop(self):
+ raise NotImplementedError('Driver.stop')
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py
new file mode 100644
index 0000000..70a8dea
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py
@@ -0,0 +1,260 @@
+#!/usr/bin/env python
+# 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.
+
+"""Chromium implementations of the Port interface."""
+
+import logging
+import os
+import shutil
+import signal
+import subprocess
+import sys
+import time
+
+import base
+import http_server
+import websocket_server
+
+
+class ChromiumPort(base.Port):
+ """Abstract base class for Chromium implementations of the Port class."""
+
+ def __init__(self, port_name=None, options=None):
+ base.Port.__init__(self, port_name, options)
+ self._chromium_base_dir = None
+
+ def baseline_path(self):
+ return self._chromium_baseline_path(self._name)
+
+ def check_sys_deps(self):
+ result = True
+ test_shell_binary_path = self._path_to_driver()
+ if os.path.exists(test_shell_binary_path):
+ proc = subprocess.Popen([test_shell_binary_path,
+ '--check-layout-test-sys-deps'])
+ if proc.wait() != 0:
+ logging.error("Aborting because system dependencies check "
+ "failed.")
+ logging.error("To override, invoke with --nocheck-sys-deps")
+ result = False
+ else:
+ logging.error('test driver is not found at %s' %
+ test_shell_binary_path)
+ result = False
+
+ image_diff_path = self._path_to_image_diff()
+ if (not os.path.exists(image_diff_path) and not
+ self._options.no_pixel_tests):
+ logging.error('image diff not found at %s' % image_diff_path)
+ logging.error("To override, invoke with --no-pixel-tests")
+ result = False
+
+ return result
+
+ def compare_text(self, actual_text, expected_text):
+ return actual_text != expected_text
+
+ def path_from_chromium_base(self, *comps):
+ """Returns the full path to path made by joining the top of the
+ Chromium source tree and the list of path components in |*comps|."""
+ if not self._chromium_base_dir:
+ abspath = os.path.abspath(__file__)
+ self._chromium_base_dir = abspath[0:abspath.find('third_party')]
+ return os.path.join(self._chromium_base_dir, *comps)
+
+ def results_directory(self):
+ return self.path_from_chromium_base('webkit', self._options.target,
+ self._options.results_directory)
+
+ def setup_test_run(self):
+ # Delete the disk cache if any to ensure a clean test run.
+ test_shell_binary_path = self._path_to_driver()
+ cachedir = os.path.split(test_shell_binary_path)[0]
+ cachedir = os.path.join(cachedir, "cache")
+ if os.path.exists(cachedir):
+ shutil.rmtree(cachedir)
+
+ def show_results_html_file(self, results_filename):
+ subprocess.Popen([self._path_to_driver(),
+ self.filename_to_uri(results_filename)])
+
+ def start_driver(self, image_path, options):
+ """Starts a new Driver and returns a handle to it."""
+ return ChromiumDriver(self, image_path, options)
+
+ def start_helper(self):
+ helper_path = self._path_to_helper()
+ if helper_path:
+ logging.debug("Starting layout helper %s" % helper_path)
+ self._helper = subprocess.Popen([helper_path],
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=None)
+ is_ready = self._helper.stdout.readline()
+ if not is_ready.startswith('ready'):
+ logging.error("layout_test_helper failed to be ready")
+
+ def stop_helper(self):
+ if self._helper:
+ logging.debug("Stopping layout test helper")
+ self._helper.stdin.write("x\n")
+ self._helper.stdin.close()
+ self._helper.wait()
+
+ def test_base_platform_names(self):
+ return ('linux', 'mac', 'win')
+
+ def test_expectations(self, options=None):
+ """Returns the test expectations for this port.
+
+ Basically this string should contain the equivalent of a
+ test_expectations file. See test_expectations.py for more details."""
+ expectations_file = self.path_from_chromium_base('webkit', 'tools',
+ 'layout_tests', 'test_expectations.txt')
+ return file(expectations_file, "r").read()
+
+ def test_platform_names(self):
+ return self.test_base_platform_names() + ('win-xp',
+ 'win-vista', 'win-7')
+
+ #
+ # PROTECTED METHODS
+ #
+ # These routines should only be called by other methods in this file
+ # or any subclasses.
+ #
+
+ def _chromium_baseline_path(self, platform):
+ if platform is None:
+ platform = self.name()
+ return self.path_from_chromium_base('webkit', 'data', 'layout_tests',
+ 'platform', platform, 'LayoutTests')
+
+
+class ChromiumDriver(base.Driver):
+ """Abstract interface for the DumpRenderTree interface."""
+
+ def __init__(self, port, image_path, options):
+ self._port = port
+ self._options = options
+ self._target = port._options.target
+ self._image_path = image_path
+
+ cmd = []
+ # Hook for injecting valgrind or other runtime instrumentation,
+ # used by e.g. tools/valgrind/valgrind_tests.py.
+ wrapper = os.environ.get("BROWSER_WRAPPER", None)
+ if wrapper != None:
+ cmd += [wrapper]
+ if self._port._options.wrapper:
+ # This split() isn't really what we want -- it incorrectly will
+ # split quoted strings within the wrapper argument -- but in
+ # practice it shouldn't come up and the --help output warns
+ # about it anyway.
+ cmd += self._options.wrapper.split()
+ cmd += [port._path_to_driver(), '--layout-tests']
+ if options:
+ cmd += options
+ self._proc = subprocess.Popen(cmd, stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT)
+
+ def poll(self):
+ return self._proc.poll()
+
+ def returncode(self):
+ return self._proc.returncode
+
+ def run_test(self, uri, timeoutms, checksum):
+ output = []
+ error = []
+ crash = False
+ timeout = False
+ actual_uri = None
+ actual_checksum = None
+
+ start_time = time.time()
+ cmd = uri
+ if timeoutms:
+ cmd += ' ' + str(timeoutms)
+ if checksum:
+ cmd += ' ' + checksum
+ cmd += "\n"
+
+ self._proc.stdin.write(cmd)
+ line = self._proc.stdout.readline()
+ while line.rstrip() != "#EOF":
+ # Make sure we haven't crashed.
+ if line == '' and self.poll() is not None:
+ # This is hex code 0xc000001d, which is used for abrupt
+ # termination. This happens if we hit ctrl+c from the prompt
+ # and we happen to be waiting on the test_shell.
+ # sdoyon: Not sure for which OS and in what circumstances the
+ # above code is valid. What works for me under Linux to detect
+ # ctrl+c is for the subprocess returncode to be negative
+ # SIGINT. And that agrees with the subprocess documentation.
+ if (-1073741510 == self._proc.returncode or
+ - signal.SIGINT == self._proc.returncode):
+ raise KeyboardInterrupt
+ crash = True
+ break
+
+ # Don't include #URL lines in our output
+ if line.startswith("#URL:"):
+ actual_uri = line.rstrip()[5:]
+ if uri != actual_uri:
+ logging.fatal("Test got out of sync:\n|%s|\n|%s|" %
+ (uri, actual_uri))
+ raise AssertionError("test out of sync")
+ elif line.startswith("#MD5:"):
+ actual_checksum = line.rstrip()[5:]
+ elif line.startswith("#TEST_TIMED_OUT"):
+ timeout = True
+ # Test timed out, but we still need to read until #EOF.
+ elif actual_uri:
+ output.append(line)
+ else:
+ error.append(line)
+
+ line = self._proc.stdout.readline()
+
+ return (crash, timeout, actual_checksum, ''.join(output),
+ ''.join(error))
+
+ def stop(self):
+ if self._proc:
+ self._proc.stdin.close()
+ self._proc.stdout.close()
+ if self._proc.stderr:
+ self._proc.stderr.close()
+ if (sys.platform not in ('win32', 'cygwin') and
+ not self._proc.poll()):
+ # Closing stdin/stdout/stderr hangs sometimes on OS X.
+ null = open(os.devnull, "w")
+ subprocess.Popen(["kill", "-9",
+ str(self._proc.pid)], stderr=null)
+ null.close()
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_linux.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_linux.py
index 9ffc401..8fd5343 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_linux.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_linux.py
@@ -27,222 +27,123 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-"""This is the Linux implementation of the port
- package. This file should only be imported by that package."""
+"""Chromium Mac implementation of the Port interface."""
import os
+import platform
import signal
import subprocess
-import sys
-import logging
-import chromium_win
-import path_utils
+import chromium
-
-def platform_name():
- """Returns the name of the platform we're currently running on."""
- return 'chromium-linux' + platform_version()
-
-
-def platform_version():
- """Returns the version string for the platform, e.g. '-vista' or
- '-snowleopard'. If the platform does not distinguish between
- minor versions, it returns ''."""
- return ''
-
-
-def get_num_cores():
- """Returns the number of cores on the machine. For hyperthreaded machines,
- this will be double the number of actual processors."""
- num_cores = os.sysconf("SC_NPROCESSORS_ONLN")
- if isinstance(num_cores, int) and num_cores > 0:
- return num_cores
- return 1
-
-
-def baseline_path(platform=None):
- """Returns the path relative to the top of the source tree for the
- baselines for the specified platform version. If |platform| is None,
- then the version currently in use is used."""
- if platform is None:
- platform = platform_name()
- return path_utils.path_from_base('webkit', 'data', 'layout_tests',
- 'platform', platform, 'LayoutTests')
-
-
-def baseline_search_path(platform=None):
- """Returns the list of directories to search for baselines/results, in
- order of preference. Paths are relative to the top of the source tree."""
- return [baseline_path(platform),
- chromium_win.baseline_path('chromium-win'),
- path_utils.webkit_baseline_path('win'),
- path_utils.webkit_baseline_path('mac')]
-
-
-def apache_executable_path():
- """Returns the executable path to start Apache"""
- path = os.path.join("/usr", "sbin", "apache2")
- if os.path.exists(path):
- return path
- print "Unable to fine Apache executable %s" % path
- _missing_apache()
-
-
-def apache_config_file_path():
- """Returns the path to Apache config file"""
- return path_utils.path_from_base("third_party", "WebKit", "LayoutTests",
- "http", "conf", "apache2-debian-httpd.conf")
-
-
-def lighttpd_executable_path():
- """Returns the executable path to start LigHTTPd"""
- binpath = "/usr/sbin/lighttpd"
- if os.path.exists(binpath):
- return binpath
- print "Unable to find LigHTTPd executable %s" % binpath
- _missing_lighttpd()
-
-
-def lighttpd_module_path():
- """Returns the library module path for LigHTTPd"""
- modpath = "/usr/lib/lighttpd"
- if os.path.exists(modpath):
- return modpath
- print "Unable to find LigHTTPd modules %s" % modpath
- _missing_lighttpd()
-
-
-def lighttpd_php_path():
- """Returns the PHP executable path for LigHTTPd"""
- binpath = "/usr/bin/php-cgi"
- if os.path.exists(binpath):
- return binpath
- print "Unable to find PHP CGI executable %s" % binpath
- _missing_lighttpd()
-
-
-def wdiff_path():
- """Path to the WDiff executable, which we assume is already installed and
- in the user's $PATH."""
- return 'wdiff'
-
-
-def image_diff_path(target):
- """Path to the image_diff binary.
-
- Args:
- target: Build target mode (debug or release)"""
- return _path_from_build_results(target, 'image_diff')
-
-
-def layout_test_helper_path(target):
- """Path to the layout_test helper binary, if needed, empty otherwise"""
- return ''
-
-
-def test_shell_path(target):
- """Return the platform-specific binary path for our TestShell.
-
- Args:
- target: Build target mode (debug or release) """
- if target in ('Debug', 'Release'):
- try:
- debug_path = _path_from_build_results('Debug', 'test_shell')
- release_path = _path_from_build_results('Release', 'test_shell')
-
- debug_mtime = os.stat(debug_path).st_mtime
- release_mtime = os.stat(release_path).st_mtime
-
- if debug_mtime > release_mtime and target == 'Release' or \
- release_mtime > debug_mtime and target == 'Debug':
- logging.info('\x1b[31mWarning: you are not running the most '
- 'recent test_shell binary. You need to pass '
- '--debug or not to select between Debug and '
- 'Release.\x1b[0m')
- # This will fail if we don't have both a debug and release binary.
- # That's fine because, in this case, we must already be running the
- # most up-to-date one.
- except path_utils.PathNotFound:
- pass
-
- return _path_from_build_results(target, 'test_shell')
-
-
-def fuzzy_match_path():
- """Return the path to the fuzzy matcher binary."""
- return path_utils.path_from_base('third_party', 'fuzzymatch', 'fuzzymatch')
-
-
-def shut_down_http_server(server_pid):
- """Shut down the lighttpd web server. Blocks until it's fully shut down.
-
- Args:
- server_pid: The process ID of the running server.
- """
- # server_pid is not set when "http_server.py stop" is run manually.
- if server_pid is None:
- # This isn't ideal, since it could conflict with web server processes
- # not started by http_server.py, but good enough for now.
- kill_all_process('lighttpd')
- kill_all_process('apache2')
- else:
- try:
- os.kill(server_pid, signal.SIGTERM)
- #TODO(mmoss) Maybe throw in a SIGKILL just to be sure?
- except OSError:
- # Sometimes we get a bad PID (e.g. from a stale httpd.pid file),
- # so if kill fails on the given PID, just try to 'killall' web
- # servers.
- shut_down_http_server(None)
-
-
-def kill_process(pid):
- """Forcefully kill the process.
-
- Args:
- pid: The id of the process to be killed.
- """
- os.kill(pid, signal.SIGKILL)
-
-
-def kill_all_process(process_name):
- null = open(os.devnull)
- subprocess.call(['killall', '-TERM', '-u', os.getenv('USER'),
- process_name], stderr=null)
- null.close()
-
-
-def kill_all_test_shells():
- """Kills all instances of the test_shell binary currently running."""
- kill_all_process('test_shell')
-
-#
-# Private helper functions
-#
-
-
-def _missing_lighttpd():
- print 'Please install using: "sudo apt-get install lighttpd php5-cgi"'
- print 'For complete Linux build requirements, please see:'
- print 'http://code.google.com/p/chromium/wiki/LinuxBuildInstructions'
- sys.exit(1)
-
-
-def _missing_apache():
- print ('Please install using: "sudo apt-get install apache2 '
- 'libapache2-mod-php5"')
- print 'For complete Linux build requirements, please see:'
- print 'http://code.google.com/p/chromium/wiki/LinuxBuildInstructions'
- sys.exit(1)
-
-
-def _path_from_build_results(*pathies):
- # FIXME(dkegel): use latest or warn if more than one found?
- for dir in ["sconsbuild", "out", "xcodebuild"]:
- try:
- return path_utils.path_from_base(dir, *pathies)
- except:
- pass
- raise path_utils.PathNotFound("Unable to find %s in build tree" %
- (os.path.join(*pathies)))
+
+class ChromiumLinuxPort(chromium.ChromiumPort):
+ """Chromium Linux implementation of the Port class."""
+
+ def __init__(self, port_name=None, options=None):
+ if port_name is None:
+ port_name = 'chromium-linux'
+ chromium.ChromiumPort.__init__(self, port_name, options)
+
+ def baseline_search_path(self):
+ return [self.baseline_path(),
+ self._chromium_baseline_path('chromium-win'),
+ self._webkit_baseline_path('win'),
+ self._webkit_baseline_path('mac')]
+
+ def check_sys_deps(self):
+ # We have no platform-specific dependencies to check.
+ return True
+
+ def num_cores(self):
+ num_cores = os.sysconf("SC_NPROCESSORS_ONLN")
+ if isinstance(num_cores, int) and num_cores > 0:
+ return num_cores
+ return 1
+
+ def test_platform_name(self):
+ # We use 'linux' instead of 'chromium-linux' in test_expectations.txt.
+ return 'linux'
+
+ def version(self):
+ # We don't have different versions on linux.
+ return ''
+
+ #
+ # PROTECTED METHODS
+ #
+
+ def _build_path(self, *comps):
+ base = self.path_from_chromium_base()
+ if os.path.exists(os.path.join(base, 'sconsbuild')):
+ return self.path_from_chromium_base('sconsbuild',
+ self._options.target, *comps)
+ else:
+ return self.path_from_chromium_base('out',
+ self._options.target, *comps)
+
+ def _kill_process(self, pid):
+ """Forcefully kill the process.
+
+ Args:
+ pid: The id of the process to be killed.
+ """
+ os.kill(pid, signal.SIGKILL)
+
+ def _kill_all_process(self, process_name):
+ null = open(os.devnull)
+ subprocess.call(['killall', '-TERM', '-u', os.getenv('USER'),
+ process_name], stderr=null)
+ null.close()
+
+ def _path_to_apache(self):
+ return '/usr/sbin/apache2'
+
+ def _path_to_apache_config_file(self):
+ return os.path.join(self.layout_tests_dir(), 'http', 'conf',
+ 'apache2-debian-httpd.conf')
+
+ def _path_to_lighttpd(self):
+ return "/usr/sbin/lighttpd"
+
+ def _path_to_lighttpd_modules(self):
+ return "/usr/lib/lighttpd"
+
+ def _path_to_lighttpd_php(self):
+ return "/usr/bin/php-cgi"
+
+ def _path_to_driver(self):
+ return self._build_path('test_shell')
+
+ def _path_to_helper(self):
+ return None
+
+ def _path_to_image_diff(self):
+ return self._build_path('image_diff')
+
+ def _path_to_wdiff(self):
+ return 'wdiff'
+
+ def _shut_down_http_server(self, server_pid):
+ """Shut down the lighttpd web server. Blocks until it's fully
+ shut down.
+
+ Args:
+ server_pid: The process ID of the running server.
+ """
+ # server_pid is not set when "http_server.py stop" is run manually.
+ if server_pid is None:
+ # TODO(mmoss) This isn't ideal, since it could conflict with
+ # lighttpd processes not started by http_server.py,
+ # but good enough for now.
+ self._kill_all_process('lighttpd')
+ self._kill_all_process('apache2')
+ else:
+ try:
+ os.kill(server_pid, signal.SIGTERM)
+ # TODO(mmoss) Maybe throw in a SIGKILL just to be sure?
+ except OSError:
+ # Sometimes we get a bad PID (e.g. from a stale httpd.pid
+ # file), so if kill fails on the given PID, just try to
+ # 'killall' web servers.
+ self._shut_down_http_server(None)
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_mac.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_mac.py
index d0fbc01..7e7b4ca 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_mac.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_mac.py
@@ -27,175 +27,136 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-"""This is the Mac implementation of the port interface
- package. This file should only be imported by that package."""
+"""Chromium Mac implementation of the Port interface."""
import os
import platform
import signal
import subprocess
-import path_utils
-
-
-def platform_name():
- """Returns the name of the platform we're currently running on."""
- # At the moment all chromium mac results are version-independent. At some
- # point we may need to return 'chromium-mac' + PlatformVersion()
- return 'chromium-mac'
-
-
-def platform_version():
- """Returns the version string for the platform, e.g. '-vista' or
- '-snowleopard'. If the platform does not distinguish between
- minor versions, it returns ''."""
- os_version_string = platform.mac_ver()[0] # e.g. "10.5.6"
- if not os_version_string:
- return '-leopard'
-
- release_version = int(os_version_string.split('.')[1])
-
- # we don't support 'tiger' or earlier releases
- if release_version == 5:
- return '-leopard'
- elif release_version == 6:
- return '-snowleopard'
-
- return ''
-
-
-def get_num_cores():
- """Returns the number of cores on the machine. For hyperthreaded machines,
- this will be double the number of actual processors."""
- return int(os.popen2("sysctl -n hw.ncpu")[1].read())
-
-
-def baseline_path(platform=None):
- """Returns the path relative to the top of the source tree for the
- baselines for the specified platform version. If |platform| is None,
- then the version currently in use is used."""
- if platform is None:
- platform = platform_name()
- return path_utils.path_from_base('webkit', 'data', 'layout_tests',
- 'platform', platform, 'LayoutTests')
-
-# TODO: We should add leopard and snowleopard to the list of paths to check
-# once we start running the tests from snowleopard.
-
-
-def baseline_search_path(platform=None):
- """Returns the list of directories to search for baselines/results, in
- order of preference. Paths are relative to the top of the source tree."""
- return [baseline_path(platform),
- path_utils.webkit_baseline_path('mac' + platform_version()),
- path_utils.webkit_baseline_path('mac')]
-
-
-def wdiff_path():
- """Path to the WDiff executable, which we assume is already installed and
- in the user's $PATH."""
- return 'wdiff'
-
-
-def image_diff_path(target):
- """Path to the image_diff executable
-
- Args:
- target: build type - 'Debug','Release',etc."""
- return path_utils.path_from_base('xcodebuild', target, 'image_diff')
-
-
-def layout_test_helper_path(target):
- """Path to the layout_test_helper executable, if needed, empty otherwise
-
- Args:
- target: build type - 'Debug','Release',etc."""
- return path_utils.path_from_base('xcodebuild', target,
- 'layout_test_helper')
-
-
-def test_shell_path(target):
- """Path to the test_shell executable.
-
- Args:
- target: build type - 'Debug','Release',etc."""
- # TODO(pinkerton): make |target| happy with case-sensitive file systems.
- return path_utils.path_from_base('xcodebuild', target, 'TestShell.app',
- 'Contents', 'MacOS', 'TestShell')
-
-
-def apache_executable_path():
- """Returns the executable path to start Apache"""
- return os.path.join("/usr", "sbin", "httpd")
-
-
-def apache_config_file_path():
- """Returns the path to Apache config file"""
- return path_utils.path_from_base("third_party", "WebKit", "LayoutTests",
- "http", "conf", "apache2-httpd.conf")
-
-
-def lighttpd_executable_path():
- """Returns the executable path to start LigHTTPd"""
- return path_utils.path_from_base('third_party', 'lighttpd', 'mac',
- 'bin', 'lighttpd')
-
-
-def lighttpd_module_path():
- """Returns the library module path for LigHTTPd"""
- return path_utils.path_from_base('third_party', 'lighttpd', 'mac', 'lib')
-
-
-def lighttpd_php_path():
- """Returns the PHP executable path for LigHTTPd"""
- return path_utils.path_from_base('third_party', 'lighttpd', 'mac', 'bin',
- 'php-cgi')
-
-
-def shut_down_http_server(server_pid):
- """Shut down the lighttpd web server. Blocks until it's fully shut down.
-
- Args:
- server_pid: The process ID of the running server.
- """
- # server_pid is not set when "http_server.py stop" is run manually.
- if server_pid is None:
- # TODO(mmoss) This isn't ideal, since it could conflict with lighttpd
- # processes not started by http_server.py, but good enough for now.
- kill_all_process('lighttpd')
- kill_all_process('httpd')
- else:
- try:
- os.kill(server_pid, signal.SIGTERM)
- # TODO(mmoss) Maybe throw in a SIGKILL just to be sure?
- except OSError:
- # Sometimes we get a bad PID (e.g. from a stale httpd.pid file),
- # so if kill fails on the given PID, just try to 'killall' web
- # servers.
- shut_down_http_server(None)
-
-
-def kill_process(pid):
- """Forcefully kill the process.
-
- Args:
- pid: The id of the process to be killed.
- """
- os.kill(pid, signal.SIGKILL)
-
-
-def kill_all_process(process_name):
- # On Mac OS X 10.6, killall has a new constraint: -SIGNALNAME or
- # -SIGNALNUMBER must come first. Example problem:
- # $ killall -u $USER -TERM lighttpd
- # killall: illegal option -- T
- # Use of the earlier -TERM placement is just fine on 10.5.
- null = open(os.devnull)
- subprocess.call(['killall', '-TERM', '-u', os.getenv('USER'),
- process_name], stderr=null)
- null.close()
-
-
-def kill_all_test_shells():
- """Kills all instances of the test_shell binary currently running."""
- kill_all_process('TestShell')
+import chromium
+
+
+class ChromiumMacPort(chromium.ChromiumPort):
+ """Chromium Mac implementation of the Port class."""
+
+ def __init__(self, port_name=None, options=None):
+ if port_name is None:
+ port_name = 'chromium-mac'
+ chromium.ChromiumPort.__init__(self, port_name, options)
+
+ def baseline_search_path(self):
+ return [self.baseline_path(),
+ self._webkit_baseline_path('mac' + self.version()),
+ self._webkit_baseline_path('mac')]
+
+ def check_sys_deps(self):
+ # We have no specific platform dependencies.
+ return True
+
+ def num_cores(self):
+ return int(subprocess.Popen(['sysctl','-n','hw.ncpu'],
+ stdout=subprocess.PIPE).stdout.read())
+
+ def test_platform_name(self):
+ # We use 'mac' instead of 'chromium-mac'
+ return 'mac'
+
+ def version(self):
+ os_version_string = platform.mac_ver()[0] # e.g. "10.5.6"
+ if not os_version_string:
+ return '-leopard'
+ release_version = int(os_version_string.split('.')[1])
+ # we don't support 'tiger' or earlier releases
+ if release_version == 5:
+ return '-leopard'
+ elif release_version == 6:
+ return '-snowleopard'
+ return ''
+
+ #
+ # PROTECTED METHODS
+ #
+
+ def _build_path(self, *comps):
+ return self.path_from_chromium_base('xcodebuild', self._options.target,
+ *comps)
+
+ def _lighttpd_path(self, *comps):
+ return self.path_from_chromium_base('third_party', 'lighttpd',
+ 'mac', *comps)
+
+ def _kill_process(self, pid):
+ """Forcefully kill the process.
+
+ Args:
+ pid: The id of the process to be killed.
+ """
+ os.kill(pid, signal.SIGKILL)
+
+ def _kill_all_process(self, process_name):
+ """Kill any processes running under this name."""
+ # On Mac OS X 10.6, killall has a new constraint: -SIGNALNAME or
+ # -SIGNALNUMBER must come first. Example problem:
+ # $ killall -u $USER -TERM lighttpd
+ # killall: illegal option -- T
+ # Use of the earlier -TERM placement is just fine on 10.5.
+ null = open(os.devnull)
+ subprocess.call(['killall', '-TERM', '-u', os.getenv('USER'),
+ process_name], stderr=null)
+ null.close()
+
+ def _path_to_apache(self):
+ return '/usr/sbin/httpd'
+
+ def _path_to_apache_config_file(self):
+ return os.path.join(self.layout_tests_dir(), 'http', 'conf',
+ 'apache2-httpd.conf')
+
+ def _path_to_lighttpd(self):
+ return self._lighttp_path('bin', 'lighttp')
+
+ def _path_to_lighttpd_modules(self):
+ return self._lighttp_path('lib')
+
+ def _path_to_lighttpd_php(self):
+ return self._lighttpd_path('bin', 'php-cgi')
+
+ def _path_to_driver(self):
+ # TODO(pinkerton): make |target| happy with case-sensitive file
+ # systems.
+ return self._build_path('TestShell.app', 'Contents', 'MacOS',
+ 'TestShell')
+
+ def _path_to_helper(self):
+ return self._build_path('layout_test_helper')
+
+ def _path_to_image_diff(self):
+ return self._build_path('image_diff')
+
+ def _path_to_wdiff(self):
+ return 'wdiff'
+
+ def _shut_down_http_server(self, server_pid):
+ """Shut down the lighttpd web server. Blocks until it's fully
+ shut down.
+
+ Args:
+ server_pid: The process ID of the running server.
+ """
+ # server_pid is not set when "http_server.py stop" is run manually.
+ if server_pid is None:
+ # TODO(mmoss) This isn't ideal, since it could conflict with
+ # lighttpd processes not started by http_server.py,
+ # but good enough for now.
+ self._kill_all_process('lighttpd')
+ self._kill_all_process('httpd')
+ else:
+ try:
+ os.kill(server_pid, signal.SIGTERM)
+ # TODO(mmoss) Maybe throw in a SIGKILL just to be sure?
+ except OSError:
+ # Sometimes we get a bad PID (e.g. from a stale httpd.pid
+ # file), so if kill fails on the given PID, just try to
+ # 'killall' web servers.
+ self._shut_down_http_server(None)
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py
index 1e0b212..352916c 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py
@@ -27,184 +27,129 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-"""This is the Linux implementation of the port
- package. This file should only be imported by that package."""
+"""Chromium Win implementation of the Port interface."""
import os
+import platform
+import signal
import subprocess
import sys
-import path_utils
+import chromium
-def platform_name():
- """Returns the name of the platform we're currently running on."""
- # We're not ready for version-specific results yet. When we uncomment
- # this, we also need to add it to the BaselineSearchPath()
- return 'chromium-win' + platform_version()
-
-def platform_version():
- """Returns the version string for the platform, e.g. '-vista' or
- '-snowleopard'. If the platform does not distinguish between
- minor versions, it returns ''."""
- winver = sys.getwindowsversion()
- if winver[0] == 6 and (winver[1] == 1):
- return '-7'
- if winver[0] == 6 and (winver[1] == 0):
- return '-vista'
- if winver[0] == 5 and (winver[1] == 1 or winver[1] == 2):
- return '-xp'
- return ''
-
-
-def get_num_cores():
- """Returns the number of cores on the machine. For hyperthreaded machines,
- this will be double the number of actual processors."""
- return int(os.environ.get('NUMBER_OF_PROCESSORS', 1))
-
-
-def baseline_path(platform=None):
- """Returns the path relative to the top of the source tree for the
- baselines for the specified platform version. If |platform| is None,
- then the version currently in use is used."""
- if platform is None:
- platform = platform_name()
- return path_utils.path_from_base('webkit', 'data', 'layout_tests',
- 'platform', platform, 'LayoutTests')
-
-
-def baseline_search_path(platform=None):
- """Returns the list of directories to search for baselines/results, in
- order of preference. Paths are relative to the top of the source tree."""
- dirs = []
- if platform is None:
- platform = platform_name()
-
- if platform == 'chromium-win-xp':
- dirs.append(baseline_path(platform))
- if platform in ('chromium-win-xp', 'chromium-win-vista'):
- dirs.append(baseline_path('chromium-win-vista'))
- dirs.append(baseline_path('chromium-win'))
- dirs.append(path_utils.webkit_baseline_path('win'))
- dirs.append(path_utils.webkit_baseline_path('mac'))
- return dirs
-
-
-def wdiff_path():
- """Path to the WDiff executable, whose binary is checked in on Win"""
- return path_utils.path_from_base('third_party', 'cygwin', 'bin',
- 'wdiff.exe')
-
-
-def image_diff_path(target):
- """Return the platform-specific binary path for the image compare util.
- We use this if we can't find the binary in the default location
- in path_utils.
-
- Args:
- target: Build target mode (debug or release)
- """
- return _find_binary(target, 'image_diff.exe')
-
-
-def layout_test_helper_path(target):
- """Return the platform-specific binary path for the layout test helper.
- We use this if we can't find the binary in the default location
- in path_utils.
-
- Args:
- target: Build target mode (debug or release)
- """
- return _find_binary(target, 'layout_test_helper.exe')
-
-
-def test_shell_path(target):
- """Return the platform-specific binary path for our TestShell.
- We use this if we can't find the binary in the default location
- in path_utils.
-
- Args:
- target: Build target mode (debug or release)
- """
- return _find_binary(target, 'test_shell.exe')
-
-
-def apache_executable_path():
- """Returns the executable path to start Apache"""
- path = path_utils.path_from_base('third_party', 'cygwin', "usr", "sbin")
- # Don't return httpd.exe since we want to use this from cygwin.
- return os.path.join(path, "httpd")
-
-
-def apache_config_file_path():
- """Returns the path to Apache config file"""
- return path_utils.path_from_base("third_party", "WebKit", "LayoutTests",
- "http", "conf", "cygwin-httpd.conf")
-
-
-def lighttpd_executable_path():
- """Returns the executable path to start LigHTTPd"""
- return path_utils.path_from_base('third_party', 'lighttpd', 'win',
- 'LightTPD.exe')
-
-
-def lighttpd_module_path():
- """Returns the library module path for LigHTTPd"""
- return path_utils.path_from_base('third_party', 'lighttpd', 'win', 'lib')
-
-
-def lighttpd_php_path():
- """Returns the PHP executable path for LigHTTPd"""
- return path_utils.path_from_base('third_party', 'lighttpd', 'win', 'php5',
- 'php-cgi.exe')
-
-
-def shut_down_http_server(server_pid):
- """Shut down the lighttpd web server. Blocks until it's fully shut down.
-
- Args:
- server_pid: The process ID of the running server.
- Unused in this implementation of the method.
- """
- subprocess.Popen(('taskkill.exe', '/f', '/im', 'LightTPD.exe'),
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE).wait()
- subprocess.Popen(('taskkill.exe', '/f', '/im', 'httpd.exe'),
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE).wait()
-
-
-def kill_process(pid):
- """Forcefully kill the process.
-
- Args:
- pid: The id of the process to be killed.
- """
- subprocess.call(('taskkill.exe', '/f', '/pid', str(pid)),
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
-
-
-def kill_all_test_shells(self):
- """Kills all instances of the test_shell binary currently running."""
- subprocess.Popen(('taskkill.exe', '/f', '/im', 'test_shell.exe'),
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE).wait()
-
-#
-# Private helper functions.
-#
-
-
-def _find_binary(target, binary):
- """On Windows, we look for binaries that we compile in potentially
- two places: src/webkit/$target (preferably, which we get if we
- built using webkit_glue.gyp), or src/chrome/$target (if compiled some
- other way)."""
- try:
- return path_utils.path_from_base('webkit', target, binary)
- except path_utils.PathNotFound:
- try:
- return path_utils.path_from_base('chrome', target, binary)
- except path_utils.PathNotFound:
- return path_utils.path_from_base('build', target, binary)
+class ChromiumWinPort(chromium.ChromiumPort):
+ """Chromium Win implementation of the Port class."""
+
+ def __init__(self, port_name=None, options=None):
+ if port_name is None:
+ port_name = 'chromium-win' + self.version()
+ chromium.ChromiumPort.__init__(self, port_name, options)
+
+ def baseline_search_path(self):
+ dirs = []
+ if self._name == 'chromium-win-xp':
+ dirs.append(self._chromium_baseline_path(self._name))
+ if self._name in ('chromium-win-xp', 'chromium-win-vista'):
+ dirs.append(self._chromium_baseline_path('chromium-win-vista'))
+ dirs.append(self._chromium_baseline_path('chromium-win'))
+ dirs.append(self._webkit_baseline_path('win'))
+ dirs.append(self._webkit_baseline_path('mac'))
+ return dirs
+
+ def check_sys_deps(self):
+ # TODO(dpranke): implement this
+ return True
+
+ def get_absolute_path(self, filename):
+ """Return the absolute path in unix format for the given filename."""
+ abspath = os.path.abspath(filename)
+ return abspath.replace('\\', '/')
+
+ def num_cores(self):
+ return int(os.environ.get('NUMBER_OF_PROCESSORS', 1))
+
+ def relative_test_filename(self, filename):
+ path = filename[len(self.layout_tests_dir()) + 1:]
+ return path.replace('\\', '/')
+
+ def test_platform_name(self):
+ # We return 'win-xp', not 'chromium-win-xp' here, for convenience.
+ return 'win' + self.version()
+
+ def version(self):
+ winver = sys.getwindowsversion()
+ if winver[0] == 6 and (winver[1] == 1):
+ return '-7'
+ if winver[0] == 6 and (winver[1] == 0):
+ return '-vista'
+ if winver[0] == 5 and (winver[1] == 1 or winver[1] == 2):
+ return '-xp'
+ return ''
+
+ #
+ # PROTECTED ROUTINES
+ #
+
+ def _build_path(self, *comps):
+ # FIXME(dpranke): allow for builds under 'chrome' as well.
+ return self.path_from_chromium_base('webkit', self._options.target,
+ *comps)
+
+ def _lighttpd_path(self, *comps):
+ return self.path_from_chromium_base('third_party', 'lighttpd', 'win',
+ *comps)
+
+ def _kill_process(self, pid):
+ """Forcefully kill the process.
+
+ Args:
+ pid: The id of the process to be killed.
+ """
+ subprocess.call(('taskkill.exe', '/f', '/pid', str(pid)),
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+
+ def _path_to_apache(self):
+ return self.path_from_chromium_base('third_party', 'cygwin', 'usr',
+ 'sbin', 'httpd')
+
+ def _path_to_apache_config_file(self):
+ return os.path.join(self.layout_tests_dir(), 'http', 'conf',
+ 'cygwin-httpd.conf')
+
+ def _path_to_lighttpd(self):
+ return self._lighttpd_path('LightTPD.exe')
+
+ def _path_to_lighttpd_modules(self):
+ return self._lighttpd_path('lib')
+
+ def _path_to_lighttpd_php(self):
+ return self._lighttpd_path('php5', 'php-cgi.exe')
+
+ def _path_to_driver(self):
+ return self._build_path('test_shell.exe')
+
+ def _path_to_helper(self):
+ return self._build_path('layout_test_helper.exe')
+
+ def _path_to_image_diff(self):
+ return self._build_path('image_diff.exe')
+
+ def _path_to_wdiff(self):
+ return self.path_from_chromium_base('third_party', 'cygwin', 'bin',
+ 'wdiff.exe')
+
+ def _shut_down_http_server(self, server_pid):
+ """Shut down the lighttpd web server. Blocks until it's fully
+ shut down.
+
+ Args:
+ server_pid: The process ID of the running server.
+ """
+ subprocess.Popen(('taskkill.exe', '/f', '/im', 'LightTPD.exe'),
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE).wait()
+ subprocess.Popen(('taskkill.exe', '/f', '/im', 'httpd.exe'),
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE).wait()
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/http_server.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/http_server.py
index 99e2ea1..0315704 100755
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/http_server.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/http_server.py
@@ -41,52 +41,21 @@ import time
import urllib
import http_server_base
-import path_utils
-class HttpdNotStarted(Exception): pass
-def remove_log_files(folder, starts_with):
- files = os.listdir(folder)
- for file in files:
- if file.startswith(starts_with):
- full_path = os.path.join(folder, file)
- os.remove(full_path)
+class HttpdNotStarted(Exception):
+ pass
class Lighttpd(http_server_base.HttpServerBase):
- # Webkit tests
- try:
- _webkit_tests = path_utils.path_from_base('third_party', 'WebKit',
- 'LayoutTests', 'http',
- 'tests')
- _js_test_resource = path_utils.path_from_base('third_party', 'WebKit',
- 'LayoutTests', 'fast',
- 'js', 'resources')
- except path_utils.PathNotFound:
- _webkit_tests = None
- _js_test_resource = None
-
- # Path where we can access all of the tests
- _all_tests = path_utils.path_from_base('webkit', 'data', 'layout_tests')
- # Self generated certificate for SSL server (for client cert get
- # <base-path>\chrome\test\data\ssl\certs\root_ca_cert.crt)
- _pem_file = path_utils.path_from_base(
- os.path.dirname(os.path.abspath(__file__)), 'httpd2.pem')
- # One mapping where we can get to everything
- VIRTUALCONFIG = [{'port': 8081, 'docroot': _all_tests}]
-
- if _webkit_tests:
- VIRTUALCONFIG.extend(
- # Three mappings (one with SSL enabled) for LayoutTests http tests
- [{'port': 8000, 'docroot': _webkit_tests},
- {'port': 8080, 'docroot': _webkit_tests},
- {'port': 8443, 'docroot': _webkit_tests, 'sslcert': _pem_file}])
-
- def __init__(self, output_dir, background=False, port=None,
+
+ def __init__(self, port_obj, output_dir, background=False, port=None,
root=None, register_cygwin=None, run_background=None):
"""Args:
output_dir: the absolute path to the layout test result directory
"""
+ # Webkit tests
+ http_server_base.HttpServerBase.__init__(self, port_obj)
self._output_dir = output_dir
self._process = None
self._port = port
@@ -96,6 +65,31 @@ class Lighttpd(http_server_base.HttpServerBase):
if self._port:
self._port = int(self._port)
+ try:
+ self._webkit_tests = os.path.join(
+ self._port_obj.layout_tests_dir(), 'http', 'tests')
+ self._js_test_resource = os.path.join(
+ self._port_obj.layout_tests_dir(), 'fast', 'js', 'resources')
+ except:
+ self._webkit_tests = None
+ self._js_test_resource = None
+
+ # Self generated certificate for SSL server (for client cert get
+ # <base-path>\chrome\test\data\ssl\certs\root_ca_cert.crt)
+ self._pem_file = os.path.join(
+ os.path.dirname(os.path.abspath(__file__)), 'httpd2.pem')
+
+ # One mapping where we can get to everything
+ self.VIRTUALCONFIG = []
+
+ if self._webkit_tests:
+ self.VIRTUALCONFIG.extend(
+ # Three mappings (one with SSL) for LayoutTests http tests
+ [{'port': 8000, 'docroot': self._webkit_tests},
+ {'port': 8080, 'docroot': self._webkit_tests},
+ {'port': 8443, 'docroot': self._webkit_tests,
+ 'sslcert': self._pem_file}])
+
def is_running(self):
return self._process != None
@@ -103,9 +97,8 @@ class Lighttpd(http_server_base.HttpServerBase):
if self.is_running():
raise 'Lighttpd already running'
- base_conf_file = path_utils.path_from_base('third_party',
- 'WebKitTools', 'Scripts', 'webkitpy', 'layout_tests',
- 'layout_package', 'lighttpd.conf')
+ base_conf_file = self._port_obj.path_from_webkit_base('WebKitTools',
+ 'Scripts', 'webkitpy', 'layout_tests', 'port', 'lighttpd.conf')
out_conf_file = os.path.join(self._output_dir, 'lighttpd.conf')
time_str = time.strftime("%d%b%Y-%H%M%S")
access_file_name = "access.log-" + time_str + ".txt"
@@ -114,8 +107,8 @@ class Lighttpd(http_server_base.HttpServerBase):
error_log = os.path.join(self._output_dir, log_file_name)
# Remove old log files. We only need to keep the last ones.
- remove_log_files(self._output_dir, "access.log-")
- remove_log_files(self._output_dir, "error.log-")
+ self.remove_log_files(self._output_dir, "access.log-")
+ self.remove_log_files(self._output_dir, "error.log-")
# Write out the config
f = file(base_conf_file, 'rb')
@@ -132,7 +125,7 @@ class Lighttpd(http_server_base.HttpServerBase):
' ".pl" => "/usr/bin/env",\n'
' ".asis" => "/bin/cat",\n'
' ".php" => "%s" )\n\n') %
- path_utils.lighttpd_php_path())
+ self._port_obj._path_to_lighttpd_php())
# Setup log files
f.write(('server.errorlog = "%s"\n'
@@ -161,7 +154,7 @@ class Lighttpd(http_server_base.HttpServerBase):
mappings = [{'port': 8000, 'docroot': self._root},
{'port': 8080, 'docroot': self._root},
{'port': 8443, 'docroot': self._root,
- 'sslcert': Lighttpd._pem_file}]
+ 'sslcert': self._pem_file}]
else:
mappings = self.VIRTUALCONFIG
for mapping in mappings:
@@ -176,12 +169,11 @@ class Lighttpd(http_server_base.HttpServerBase):
'}\n\n') % (mapping['port'], mapping['docroot']))
f.close()
- executable = path_utils.lighttpd_executable_path()
- module_path = path_utils.lighttpd_module_path()
+ executable = self._port_obj._path_to_lighttpd()
+ module_path = self._port_obj._path_to_lighttpd_modules()
start_cmd = [executable,
# Newly written config file
- '-f', path_utils.path_from_base(self._output_dir,
- 'lighttpd.conf'),
+ '-f', os.path.join(self._output_dir, 'lighttpd.conf'),
# Where it can find its module dynamic libraries
'-m', module_path]
@@ -203,12 +195,13 @@ class Lighttpd(http_server_base.HttpServerBase):
env = os.environ
if sys.platform in ('cygwin', 'win32'):
env['PATH'] = '%s;%s' % (
- path_utils.path_from_base('third_party', 'cygwin', 'bin'),
+ self._port_obj.path_from_chromium_base('third_party',
+ 'cygwin', 'bin'),
env['PATH'])
if sys.platform == 'win32' and self._register_cygwin:
- setup_mount = path_utils.path_from_base('third_party', 'cygwin',
- 'setup_mount.bat')
+ setup_mount = port.path_from_chromium_base('third_party',
+ 'cygwin', 'setup_mount.bat')
subprocess.Popen(setup_mount).wait()
logging.debug('Starting http server')
@@ -235,7 +228,7 @@ class Lighttpd(http_server_base.HttpServerBase):
httpd_pid = None
if self._process:
httpd_pid = self._process.pid
- path_utils.shut_down_http_server(httpd_pid)
+ self._port_obj._shut_down_http_server(httpd_pid)
if self._process:
self._process.wait()
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/http_server_base.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/http_server_base.py
index 026e070..e82943e 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/http_server_base.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/http_server_base.py
@@ -30,12 +30,16 @@
"""Base class with common routines between the Apache and Lighttpd servers."""
import logging
+import os
import time
import urllib
class HttpServerBase(object):
+ def __init__(self, port_obj):
+ self._port_obj = port_obj
+
def wait_for_action(self, action):
"""Repeat the action for 20 seconds or until it succeeds. Returns
whether it succeeded."""
@@ -65,3 +69,10 @@ class HttpServerBase(object):
return False
return True
+
+ def remove_log_files(self, folder, starts_with):
+ files = os.listdir(folder)
+ for file in files:
+ if file.startswith(starts_with):
+ full_path = os.path.join(folder, file)
+ os.remove(full_path)
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/mac.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/mac.py
new file mode 100644
index 0000000..4b73cec
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/mac.py
@@ -0,0 +1,439 @@
+#!/usr/bin/env python
+# 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 Google name 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.
+
+"""WebKit Mac implementation of the Port interface."""
+
+import fcntl
+import logging
+import os
+import pdb
+import platform
+import select
+import signal
+import subprocess
+import sys
+import time
+import webbrowser
+
+import base
+
+import webkitpy
+from webkitpy import executive
+
+class MacPort(base.Port):
+ """WebKit Mac implementation of the Port class."""
+
+ def __init__(self, port_name=None, options=None):
+ if port_name is None:
+ port_name = 'mac' + self.version()
+ base.Port.__init__(self, port_name, options)
+ self._cached_build_root = None
+
+ def baseline_search_path(self):
+ dirs = []
+ if self._name == 'mac-tiger':
+ dirs.append(self._webkit_baseline_path(self._name))
+ if self._name in ('mac-tiger', 'mac-leopard'):
+ dirs.append(self._webkit_baseline_path('mac-leopard'))
+ if self._name in ('mac-tiger', 'mac-leopard', 'mac-snowleopard'):
+ dirs.append(self._webkit_baseline_path('mac-snowleopard'))
+ dirs.append(self._webkit_baseline_path('mac'))
+ return dirs
+
+ def check_sys_deps(self):
+ # FIXME: This should run build-dumprendertree.
+ # This should also validate that all of the tool paths are valid.
+ return True
+
+ def num_cores(self):
+ return int(os.popen2("sysctl -n hw.ncpu")[1].read())
+
+ def results_directory(self):
+ return ('/tmp/run-chromium-webkit-tests-' +
+ self._options.results_directory)
+
+ def setup_test_run(self):
+ # This port doesn't require any specific configuration.
+ pass
+
+ def show_results_html_file(self, results_filename):
+ uri = self.filename_to_uri(results_filename)
+ webbrowser.open(uri, new=1)
+
+ def start_driver(self, image_path, options):
+ """Starts a new Driver and returns a handle to it."""
+ return MacDriver(self, image_path, options)
+
+ def start_helper(self):
+ # This port doesn't use a helper process.
+ pass
+
+ def stop_helper(self):
+ # This port doesn't use a helper process.
+ pass
+
+ def test_base_platform_names(self):
+ # At the moment we don't use test platform names, but we have
+ # to return something.
+ return ('mac',)
+
+ def test_expectations(self):
+ #
+ # The WebKit mac port uses 'Skipped' files at the moment. Each
+ # file contains a list of files or directories to be skipped during
+ # the test run. The total list of tests to skipped is given by the
+ # contents of the generic Skipped file found in platform/X plus
+ # a version-specific file found in platform/X-version. Duplicate
+ # entries are allowed. This routine reads those files and turns
+ # contents into the format expected by test_expectations.
+ expectations = []
+ skipped_files = []
+ if self._name in ('mac-tiger', 'mac-leopard', 'mac-snowleopard'):
+ skipped_files.append(os.path.join(
+ self._webkit_baseline_path(self._name), 'Skipped'))
+ skipped_files.append(os.path.join(self._webkit_baseline_path('mac'),
+ 'Skipped'))
+ for filename in skipped_files:
+ if os.path.exists(filename):
+ f = file(filename)
+ for l in f.readlines():
+ l = l.strip()
+ if not l.startswith('#') and len(l):
+ l = 'BUG_SKIPPED SKIP : ' + l + ' = FAIL'
+ if l not in expectations:
+ expectations.append(l)
+ f.close()
+
+ # TODO - figure out how to check for these dynamically
+ expectations.append('BUG_SKIPPED SKIP : fast/wcss = FAIL')
+ expectations.append('BUG_SKIPPED SKIP : fast/xhtmlmp = FAIL')
+ expectations.append('BUG_SKIPPED SKIP : http/tests/wml = FAIL')
+ expectations.append('BUG_SKIPPED SKIP : mathml = FAIL')
+ expectations.append('BUG_SKIPPED SKIP : platform/chromium = FAIL')
+ expectations.append('BUG_SKIPPED SKIP : platform/gtk = FAIL')
+ expectations.append('BUG_SKIPPED SKIP : platform/qt = FAIL')
+ expectations.append('BUG_SKIPPED SKIP : platform/win = FAIL')
+ expectations.append('BUG_SKIPPED SKIP : wml = FAIL')
+
+ # TODO - figure out how to handle webarchive tests
+ expectations.append('BUG_SKIPPED SKIP : webarchive = PASS')
+ expectations.append('BUG_SKIPPED SKIP : svg/webarchive = PASS')
+ expectations.append('BUG_SKIPPED SKIP : http/tests/webarchive = PASS')
+ expectations.append('BUG_SKIPPED SKIP : svg/custom/'
+ 'image-with-prefix-in-webarchive.svg = PASS')
+
+ expectations_str = '\n'.join(expectations)
+ return expectations_str
+
+ def test_platform_name(self):
+ # At the moment we don't use test platform names, but we have
+ # to return something.
+ return 'mac'
+
+ def test_platform_names(self):
+ # At the moment we don't use test platform names, but we have
+ # to return something.
+ return ('mac',)
+
+ def version(self):
+ os_version_string = platform.mac_ver()[0] # e.g. "10.5.6"
+ if not os_version_string:
+ return '-leopard'
+ release_version = int(os_version_string.split('.')[1])
+ if release_version == 4:
+ return '-tiger'
+ elif release_version == 5:
+ return '-leopard'
+ elif release_version == 6:
+ return '-snowleopard'
+ return ''
+
+ #
+ # PROTECTED METHODS
+ #
+
+ def _build_path(self, *comps):
+ if not self._cached_build_root:
+ self._cached_build_root = executive.run_command(["webkit-build-directory", "--base"]).rstrip()
+ return os.path.join(self._cached_build_root, self._options.target, *comps)
+
+ def _kill_process(self, pid):
+ """Forcefully kill the process.
+
+ Args:
+ pid: The id of the process to be killed.
+ """
+ os.kill(pid, signal.SIGKILL)
+
+ def _kill_all_process(self, process_name):
+ # On Mac OS X 10.6, killall has a new constraint: -SIGNALNAME or
+ # -SIGNALNUMBER must come first. Example problem:
+ # $ killall -u $USER -TERM lighttpd
+ # killall: illegal option -- T
+ # Use of the earlier -TERM placement is just fine on 10.5.
+ null = open(os.devnull)
+ subprocess.call(['killall', '-TERM', '-u', os.getenv('USER'),
+ process_name], stderr=null)
+ null.close()
+
+ def _path_to_apache(self):
+ return '/usr/sbin/httpd'
+
+ def _path_to_apache_config_file(self):
+ return os.path.join(self.layout_tests_dir(), 'http', 'conf',
+ 'apache2-httpd.conf')
+
+ def _path_to_driver(self):
+ return self._build_path('DumpRenderTree')
+
+ def _path_to_helper(self):
+ return None
+
+ def _path_to_image_diff(self):
+ return self._build_path('image_diff') # FIXME: This is wrong and should be "ImageDiff", but having the correct path causes other parts of the script to hang.
+
+ def _path_to_wdiff(self):
+ return 'wdiff' # FIXME: This does not exist on a default Mac OS X Leopard install.
+
+ def _shut_down_http_server(self, server_pid):
+ """Shut down the lighttpd web server. Blocks until it's fully
+ shut down.
+
+ Args:
+ server_pid: The process ID of the running server.
+ """
+ # server_pid is not set when "http_server.py stop" is run manually.
+ if server_pid is None:
+ # TODO(mmoss) This isn't ideal, since it could conflict with
+ # lighttpd processes not started by http_server.py,
+ # but good enough for now.
+ self._kill_all_process('httpd')
+ else:
+ try:
+ os.kill(server_pid, signal.SIGTERM)
+ # TODO(mmoss) Maybe throw in a SIGKILL just to be sure?
+ except OSError:
+ # Sometimes we get a bad PID (e.g. from a stale httpd.pid
+ # file), so if kill fails on the given PID, just try to
+ # 'killall' web servers.
+ self._shut_down_http_server(None)
+
+
+class MacDriver(base.Driver):
+ """implementation of the DumpRenderTree interface."""
+
+ def __init__(self, port, image_path, driver_options):
+ self._port = port
+ self._driver_options = driver_options
+ self._target = port._options.target
+ self._image_path = image_path
+ self._stdout_fd = None
+ self._cmd = None
+ self._env = None
+ self._proc = None
+ self._read_buffer = ''
+
+ cmd = []
+ # Hook for injecting valgrind or other runtime instrumentation,
+ # used by e.g. tools/valgrind/valgrind_tests.py.
+ wrapper = os.environ.get("BROWSER_WRAPPER", None)
+ if wrapper != None:
+ cmd += [wrapper]
+ if self._port._options.wrapper:
+ # This split() isn't really what we want -- it incorrectly will
+ # split quoted strings within the wrapper argument -- but in
+ # practice it shouldn't come up and the --help output warns
+ # about it anyway.
+ cmd += self._options.wrapper.split()
+ # FIXME: Using arch here masks any possible file-not-found errors from a non-existant driver executable.
+ cmd += ['arch', '-i386', port._path_to_driver(), '-']
+
+ # FIXME: This is a hack around our lack of ImageDiff support for now.
+ if not self._port._options.no_pixel_tests:
+ logging.warn("This port does not yet support pixel tests.")
+ self._port._options.no_pixel_tests = True
+ #cmd.append('--pixel-tests')
+
+ #if driver_options:
+ # cmd += driver_options
+ env = os.environ
+ env['DYLD_FRAMEWORK_PATH'] = self._port._build_path()
+ self._cmd = cmd
+ self._env = env
+ self.restart()
+
+ def poll(self):
+ return self._proc.poll()
+
+ def restart(self):
+ self.stop()
+ self._proc = subprocess.Popen(self._cmd, stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ env=self._env)
+
+ def returncode(self):
+ return self._proc.returncode
+
+ def run_test(self, uri, timeoutms, image_hash):
+ output = []
+ error = []
+ image = ''
+ crash = False
+ timeout = False
+ actual_uri = None
+ actual_image_hash = None
+
+ if uri.startswith("file:///"):
+ cmd = uri[7:]
+ else:
+ cmd = uri
+
+ if image_hash:
+ cmd += "'" + image_hash
+ cmd += "\n"
+
+ self._proc.stdin.write(cmd)
+ self._stdout_fd = self._proc.stdout.fileno()
+ fl = fcntl.fcntl(self._stdout_fd, fcntl.F_GETFL)
+ fcntl.fcntl(self._stdout_fd, fcntl.F_SETFL, fl | os.O_NONBLOCK)
+
+ stop_time = time.time() + (int(timeoutms) / 1000.0)
+ resp = ''
+ (timeout, line) = self._read_line(timeout, stop_time)
+ resp += line
+ have_seen_content_type = False
+ while not timeout and line.rstrip() != "#EOF":
+ # Make sure we haven't crashed.
+ if line == '' and self.poll() is not None:
+ # This is hex code 0xc000001d, which is used for abrupt
+ # termination. This happens if we hit ctrl+c from the prompt
+ # and we happen to be waiting on the test_shell.
+ # sdoyon: Not sure for which OS and in what circumstances the
+ # above code is valid. What works for me under Linux to detect
+ # ctrl+c is for the subprocess returncode to be negative
+ # SIGINT. And that agrees with the subprocess documentation.
+ if (-1073741510 == self.returncode() or
+ - signal.SIGINT == self.returncode()):
+ raise KeyboardInterrupt
+ crash = True
+ break
+
+ elif (line.startswith('Content-Type:') and not
+ have_seen_content_type):
+ have_seen_content_type = True
+ pass
+ else:
+ output.append(line)
+
+ (timeout, line) = self._read_line(timeout, stop_time)
+ resp += line
+
+ # Now read a second block of text for the optional image data
+ image_length = 0
+ (timeout, line) = self._read_line(timeout, stop_time)
+ resp += line
+ HASH_HEADER = 'ActualHash: '
+ LENGTH_HEADER = 'Content-Length: '
+ while not timeout and not crash and line.rstrip() != "#EOF":
+ if line == '' and self.poll() is not None:
+ if (-1073741510 == self.returncode() or
+ - signal.SIGINT == self.returncode()):
+ raise KeyboardInterrupt
+ crash = True
+ break
+ elif line.startswith(HASH_HEADER):
+ actual_image_hash = line[len(HASH_HEADER):].strip()
+ elif line.startswith('Content-Type:'):
+ pass
+ elif line.startswith(LENGTH_HEADER):
+ image_length = int(line[len(LENGTH_HEADER):])
+ elif image_length:
+ image += line
+
+ (timeout, line) = self._read_line(timeout, stop_time, image_length)
+ resp += line
+
+ if timeout:
+ self.restart()
+
+ if self._image_path and len(self._image_path):
+ image_file = file(self._image_path, "wb")
+ image_file.write(image)
+ image_file.close()
+
+ return (crash, timeout, actual_image_hash,
+ ''.join(output), ''.join(error))
+ pass
+
+ def stop(self):
+ if self._proc:
+ self._proc.stdin.close()
+ self._proc.stdout.close()
+ if self._proc.stderr:
+ self._proc.stderr.close()
+ if (sys.platform not in ('win32', 'cygwin') and
+ not self._proc.poll()):
+ # Closing stdin/stdout/stderr hangs sometimes on OS X.
+ null = open(os.devnull, "w")
+ subprocess.Popen(["kill", "-9",
+ str(self._proc.pid)], stderr=null)
+ null.close()
+
+ def _read_line(self, timeout, stop_time, image_length=0):
+ now = time.time()
+ read_fds = []
+
+ # first check to see if we have a line already read or if we've
+ # read the entire image
+ if image_length and len(self._read_buffer) >= image_length:
+ out = self._read_buffer[0:image_length]
+ self._read_buffer = self._read_buffer[image_length:]
+ return (timeout, out)
+
+ idx = self._read_buffer.find('\n')
+ if not image_length and idx != -1:
+ out = self._read_buffer[0:idx + 1]
+ self._read_buffer = self._read_buffer[idx + 1:]
+ return (timeout, out)
+
+ # If we've timed out, return just what we have, if anything
+ if timeout or now >= stop_time:
+ out = self._read_buffer
+ self._read_buffer = ''
+ return (True, out)
+
+ (read_fds, write_fds, err_fds) = select.select(
+ [self._stdout_fd], [], [], stop_time - now)
+ try:
+ if timeout or len(read_fds) == 1:
+ self._read_buffer += self._proc.stdout.read()
+ except IOError, e:
+ read = []
+ return self._read_line(timeout, stop_time)
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/path_utils.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/path_utils.py
deleted file mode 100644
index 70b8c03..0000000
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/path_utils.py
+++ /dev/null
@@ -1,395 +0,0 @@
-#!/usr/bin/env python
-# 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.
-
-"""This package contains utility methods for manipulating paths and
-filenames for test results and baselines. It also contains wrappers
-of a few routines in port/ so that the port package can
-be considered a 'protected' package - i.e., this file should be
-the only file that ever includes port. This leads to
-us including a few things that don't really have anything to do
- with paths, unfortunately."""
-
-import errno
-import os
-import stat
-import sys
-
-import port
-import chromium_win
-import chromium_mac
-import chromium_linux
-
-# Cache some values so we don't have to recalculate them. _basedir is
-# used by PathFromBase() and caches the full (native) path to the top
-# of the source tree (/src). _baseline_search_path is used by
-# ExpectedBaselines() and caches the list of native paths to search
-# for baseline results.
-_basedir = None
-_baseline_search_path = None
-
-
-class PathNotFound(Exception):
- pass
-
-
-def layout_tests_dir():
- """Returns the fully-qualified path to the directory containing the input
- data for the specified layout test."""
- return path_from_base('third_party', 'WebKit', 'LayoutTests')
-
-
-def chromium_baseline_path(platform=None):
- """Returns the full path to the directory containing expected
- baseline results from chromium ports. If |platform| is None, the
- currently executing platform is used.
-
- Note: although directly referencing individual port/* files is
- usually discouraged, we allow it here so that the rebaselining tool can
- pull baselines for platforms other than the host platform."""
-
- # Normalize the platform string.
- platform = platform_name(platform)
- if platform.startswith('chromium-mac'):
- return chromium_mac.baseline_path(platform)
- elif platform.startswith('chromium-win'):
- return chromium_win.baseline_path(platform)
- elif platform.startswith('chromium-linux'):
- return chromium_linux.baseline_path(platform)
-
- return port.baseline_path()
-
-
-def webkit_baseline_path(platform):
- """Returns the full path to the directory containing expected
- baseline results from WebKit ports."""
- return path_from_base('third_party', 'WebKit', 'LayoutTests',
- 'platform', platform)
-
-
-def baseline_search_path(platform=None):
- """Returns the list of directories to search for baselines/results for a
- given platform, in order of preference. Paths are relative to the top of
- the source tree. If parameter platform is None, returns the list for the
- current platform that the script is running on.
-
- Note: although directly referencing individual port/* files is
- usually discouraged, we allow it here so that the rebaselining tool can
- pull baselines for platforms other than the host platform."""
-
- # Normalize the platform name.
- platform = platform_name(platform)
- if platform.startswith('chromium-mac'):
- return chromium_mac.baseline_search_path(platform)
- elif platform.startswith('chromium-win'):
- return chromium_win.baseline_search_path(platform)
- elif platform.startswith('chromium-linux'):
- return chromium_linux.baseline_search_path(platform)
- return port.baseline_search_path()
-
-
-def expected_baselines(filename, suffix, platform=None, all_baselines=False):
- """Given a test name, finds where the baseline results are located.
-
- Args:
- filename: absolute filename to test file
- suffix: file suffix of the expected results, including dot; e.g. '.txt'
- or '.png'. This should not be None, but may be an empty string.
- platform: layout test platform: 'win', 'linux' or 'mac'. Defaults to
- the current platform.
- all_baselines: If True, return an ordered list of all baseline paths
- for the given platform. If False, return only the first
- one.
- Returns
- a list of ( platform_dir, results_filename ), where
- platform_dir - abs path to the top of the results tree (or test tree)
- results_filename - relative path from top of tree to the results file
- (os.path.join of the two gives you the full path to the file,
- unless None was returned.)
- Return values will be in the format appropriate for the current platform
- (e.g., "\\" for path separators on Windows). If the results file is not
- found, then None will be returned for the directory, but the expected
- relative pathname will still be returned.
- """
- global _baseline_search_path
- global _search_path_platform
- testname = os.path.splitext(relative_test_filename(filename))[0]
-
- baseline_filename = testname + '-expected' + suffix
-
- if (_baseline_search_path is None) or (_search_path_platform != platform):
- _baseline_search_path = baseline_search_path(platform)
- _search_path_platform = platform
-
- baselines = []
- for platform_dir in _baseline_search_path:
- if os.path.exists(os.path.join(platform_dir, baseline_filename)):
- baselines.append((platform_dir, baseline_filename))
-
- if not all_baselines and baselines:
- return baselines
-
- # If it wasn't found in a platform directory, return the expected result
- # in the test directory, even if no such file actually exists.
- platform_dir = layout_tests_dir()
- if os.path.exists(os.path.join(platform_dir, baseline_filename)):
- baselines.append((platform_dir, baseline_filename))
-
- if baselines:
- return baselines
-
- return [(None, baseline_filename)]
-
-
-def expected_filename(filename, suffix):
- """Given a test name, returns an absolute path to its expected results.
-
- If no expected results are found in any of the searched directories, the
- directory in which the test itself is located will be returned. The return
- value is in the format appropriate for the platform (e.g., "\\" for
- path separators on windows).
-
- Args:
- filename: absolute filename to test file
- suffix: file suffix of the expected results, including dot; e.g. '.txt'
- or '.png'. This should not be None, but may be an empty string.
- platform: the most-specific directory name to use to build the
- search list of directories, e.g., 'chromium-win', or
- 'chromium-mac-leopard' (we follow the WebKit format)
- """
- platform_dir, baseline_filename = expected_baselines(filename, suffix)[0]
- if platform_dir:
- return os.path.join(platform_dir, baseline_filename)
- return os.path.join(layout_tests_dir(), baseline_filename)
-
-
-def relative_test_filename(filename):
- """Provide the filename of the test relative to the layout tests
- directory as a unix style path (a/b/c)."""
- return _win_path_to_unix(filename[len(layout_tests_dir()) + 1:])
-
-
-def _win_path_to_unix(path):
- """Convert a windows path to use unix-style path separators (a/b/c)."""
- return path.replace('\\', '/')
-
-#
-# Routines that are arguably platform-specific but have been made
-# generic for now
-#
-
-
-def filename_to_uri(full_path):
- """Convert a test file to a URI."""
- LAYOUTTEST_HTTP_DIR = "http/tests/"
- LAYOUTTEST_WEBSOCKET_DIR = "websocket/tests/"
-
- relative_path = _win_path_to_unix(relative_test_filename(full_path))
- port = None
- use_ssl = False
-
- if relative_path.startswith(LAYOUTTEST_HTTP_DIR):
- # http/tests/ run off port 8000 and ssl/ off 8443
- relative_path = relative_path[len(LAYOUTTEST_HTTP_DIR):]
- port = 8000
- elif relative_path.startswith(LAYOUTTEST_WEBSOCKET_DIR):
- # websocket/tests/ run off port 8880 and 9323
- # Note: the root is /, not websocket/tests/
- port = 8880
-
- # Make http/tests/local run as local files. This is to mimic the
- # logic in run-webkit-tests.
- # TODO(jianli): Consider extending this to "media/".
- if port and not relative_path.startswith("local/"):
- if relative_path.startswith("ssl/"):
- port += 443
- protocol = "https"
- else:
- protocol = "http"
- return "%s://127.0.0.1:%u/%s" % (protocol, port, relative_path)
-
- if sys.platform in ('cygwin', 'win32'):
- return "file:///" + get_absolute_path(full_path)
- return "file://" + get_absolute_path(full_path)
-
-
-def get_absolute_path(path):
- """Returns an absolute UNIX path."""
- return _win_path_to_unix(os.path.abspath(path))
-
-
-def maybe_make_directory(*path):
- """Creates the specified directory if it doesn't already exist."""
- try:
- os.makedirs(os.path.join(*path))
- except OSError, e:
- if e.errno != errno.EEXIST:
- raise
-
-
-def path_from_base(*comps):
- """Returns an absolute filename from a set of components specified
- relative to the top of the source tree. If the path does not exist,
- the exception PathNotFound is raised."""
- global _basedir
- if _basedir == None:
- # We compute the top of the source tree by finding the absolute
- # path of this source file, and then climbing up three directories
- # as given in subpath. If we move this file, subpath needs to be
- # updated.
- path = os.path.abspath(__file__)
- subpath = os.path.join('third_party', 'WebKit')
- _basedir = path[:path.index(subpath)]
- path = os.path.join(_basedir, *comps)
- if not os.path.exists(path):
- raise PathNotFound('could not find %s' % (path))
- return path
-
-
-def remove_directory(*path):
- """Recursively removes a directory, even if it's marked read-only.
-
- Remove the directory located at *path, if it exists.
-
- shutil.rmtree() doesn't work on Windows if any of the files or directories
- are read-only, which svn repositories and some .svn files are. We need to
- be able to force the files to be writable (i.e., deletable) as we traverse
- the tree.
-
- Even with all this, Windows still sometimes fails to delete a file, citing
- a permission error (maybe something to do with antivirus scans or disk
- indexing). The best suggestion any of the user forums had was to wait a
- bit and try again, so we do that too. It's hand-waving, but sometimes it
- works. :/
- """
- file_path = os.path.join(*path)
- if not os.path.exists(file_path):
- return
-
- win32 = False
- if sys.platform == 'win32':
- win32 = True
- # Some people don't have the APIs installed. In that case we'll do
- # without.
- try:
- win32api = __import__('win32api')
- win32con = __import__('win32con')
- except ImportError:
- win32 = False
-
- def remove_with_retry(rmfunc, path):
- os.chmod(path, stat.S_IWRITE)
- if win32:
- win32api.SetFileAttributes(path,
- win32con.FILE_ATTRIBUTE_NORMAL)
- try:
- return rmfunc(path)
- except EnvironmentError, e:
- if e.errno != errno.EACCES:
- raise
- print 'Failed to delete %s: trying again' % repr(path)
- time.sleep(0.1)
- return rmfunc(path)
- else:
-
- def remove_with_retry(rmfunc, path):
- if os.path.islink(path):
- return os.remove(path)
- else:
- return rmfunc(path)
-
- for root, dirs, files in os.walk(file_path, topdown=False):
- # For POSIX: making the directory writable guarantees removability.
- # Windows will ignore the non-read-only bits in the chmod value.
- os.chmod(root, 0770)
- for name in files:
- remove_with_retry(os.remove, os.path.join(root, name))
- for name in dirs:
- remove_with_retry(os.rmdir, os.path.join(root, name))
-
- remove_with_retry(os.rmdir, file_path)
-
-#
-# Wrappers around port/
-#
-
-
-def platform_name(platform=None):
- """Returns the appropriate chromium platform name for |platform|. If
- |platform| is None, returns the name of the chromium platform on the
- currently running system. If |platform| is of the form 'chromium-*',
- it is returned unchanged, otherwise 'chromium-' is prepended."""
- if platform == None:
- return port.platform_name()
- if not platform.startswith('chromium-'):
- platform = "chromium-" + platform
- return platform
-
-
-def platform_version():
- return port.platform_version()
-
-
-def lighttpd_executable_path():
- return port.lighttpd_executable_path()
-
-
-def lighttpd_module_path():
- return port.lighttpd_module_path()
-
-
-def lighttpd_php_path():
- return port.lighttpd_php_path()
-
-
-def wdiff_path():
- return port.wdiff_path()
-
-
-def test_shell_path(target):
- return port.test_shell_path(target)
-
-
-def image_diff_path(target):
- return port.image_diff_path(target)
-
-
-def layout_test_helper_path(target):
- return port.layout_test_helper_path(target)
-
-
-def fuzzy_match_path():
- return port.fuzzy_match_path()
-
-
-def shut_down_http_server(server_pid):
- return port.shut_down_http_server(server_pid)
-
-
-def kill_all_test_shells():
- port.kill_all_test_shells()
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/test.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/test.py
new file mode 100644
index 0000000..0bc6e7c
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/test.py
@@ -0,0 +1,144 @@
+#!/usr/bin/env python
+# 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 Google name 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.
+
+"""Dummy Port implementation used for testing."""
+
+import os
+import time
+
+import base
+
+
+class TestPort(base.Port):
+ """Test implementation of the Port interface."""
+
+ def __init__(self, port_name=None, options=None):
+ base.Port.__init__(self, port_name, options)
+
+ def base_platforms(self):
+ return ('test',)
+
+ def baseline_path(self):
+ curdir = os.path.abspath(__file__)
+ self.topdir = curdir[0:curdir.index("WebKitTools")]
+ return os.path.join(self.topdir, 'LayoutTests', 'platform', 'test')
+
+ def baseline_search_path(self):
+ return [self.baseline_path()]
+
+ def check_sys_deps(self):
+ return True
+
+ def diff_image(self, actual_filename, expected_filename, diff_filename):
+ return False
+
+ def compare_text(self, actual_text, expected_text):
+ return False
+
+ def diff_text(self, actual_text, expected_text,
+ actual_filename, expected_filename):
+ return ''
+
+ def name(self):
+ return self._name
+
+ def num_cores(self):
+ return int(os.popen2("sysctl -n hw.ncpu")[1].read())
+
+ def options(self):
+ return self._options
+
+ def results_directory(self):
+ return '/tmp' + self._options.results_directory
+
+ def setup_test_run(self):
+ pass
+
+ def show_results_html_file(self, filename):
+ pass
+
+ def start_driver(self, image_path, options):
+ return TestDriver(image_path, options, self)
+
+ def start_http_server(self):
+ pass
+
+ def start_websocket_server(self):
+ pass
+
+ def start_helper(self):
+ pass
+
+ def stop_http_server(self):
+ pass
+
+ def stop_websocket_server(self):
+ pass
+
+ def stop_helper(self):
+ pass
+
+ def test_expectations(self):
+ return ''
+
+ def test_base_platform_names(self):
+ return ('test',)
+
+ def test_platform_name(self):
+ return 'test'
+
+ def test_platform_names(self):
+ return self.test_base_platform_names()
+
+ def version():
+ return ''
+
+ def wdiff_text(self, actual_filename, expected_filename):
+ return ''
+
+
+class TestDriver(base.Driver):
+ """Test/Dummy implementation of the DumpRenderTree interface."""
+
+ def __init__(self, image_path, test_driver_options, port):
+ self._driver_options = test_driver_options
+ self._image_path = image_path
+ self._port = port
+
+ def poll(self):
+ return True
+
+ def returncode(self):
+ return 0
+
+ def run_test(self, uri, timeoutms, image_hash):
+ return (False, False, image_hash, '', None)
+
+ def stop(self):
+ pass
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/websocket_server.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/websocket_server.py
index c6c7527..ba8a5e9 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/websocket_server.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/websocket_server.py
@@ -39,8 +39,6 @@ import tempfile
import time
import urllib
-import path_utils
-import port
import http_server
_WS_LOG_PREFIX = 'pywebsocket.ws.log-'
@@ -51,37 +49,29 @@ _DEFAULT_WSS_PORT = 9323
def url_is_alive(url):
- """Checks to see if we get an http response from |url|.
- We poll the url 5 times with a 1 second delay. If we don't
- get a reply in that time, we give up and assume the httpd
- didn't start properly.
-
- Args:
- url: The URL to check.
- Return:
- True if the url is alive.
- """
- wait_time = 5
- while wait_time > 0:
- try:
- response = urllib.urlopen(url)
- # Server is up and responding.
- return True
- except IOError:
- pass
- wait_time -= 1
- # Wait a second and try again.
- time.sleep(1)
-
- return False
-
-
-def remove_log_files(folder, starts_with):
- files = os.listdir(folder)
- for file in files:
- if file.startswith(starts_with):
- full_path = os.path.join(folder, file)
- os.remove(full_path)
+ """Checks to see if we get an http response from |url|.
+ We poll the url 5 times with a 1 second delay. If we don't
+ get a reply in that time, we give up and assume the httpd
+ didn't start properly.
+
+ Args:
+ url: The URL to check.
+ Return:
+ True if the url is alive.
+ """
+ wait_time = 5
+ while wait_time > 0:
+ try:
+ response = urllib.urlopen(url)
+ # Server is up and responding.
+ return True
+ except IOError:
+ pass
+ wait_time -= 1
+ # Wait a second and try again.
+ time.sleep(1)
+
+ return False
class PyWebSocketNotStarted(Exception):
@@ -94,18 +84,15 @@ class PyWebSocketNotFound(Exception):
class PyWebSocket(http_server.Lighttpd):
- def __init__(self, output_dir, port=_DEFAULT_WS_PORT,
- root=None,
- use_tls=False,
- private_key=http_server.Lighttpd._pem_file,
- certificate=http_server.Lighttpd._pem_file,
+ def __init__(self, port_obj, output_dir, port=_DEFAULT_WS_PORT,
+ root=None, use_tls=False,
register_cygwin=None,
pidfile=None):
"""Args:
output_dir: the absolute path to the layout test result directory
"""
- http_server.Lighttpd.__init__(self, output_dir,
- port=port,
+ http_server.Lighttpd.__init__(self, port_obj, output_dir,
+ port=_DEFAULT_WS_PORT,
root=root,
register_cygwin=register_cygwin)
self._output_dir = output_dir
@@ -113,8 +100,8 @@ class PyWebSocket(http_server.Lighttpd):
self._port = port
self._root = root
self._use_tls = use_tls
- self._private_key = private_key
- self._certificate = certificate
+ self._private_key = self._pem_file
+ self._certificate = self._pem_file
if self._port:
self._port = int(self._port)
if self._use_tls:
@@ -131,12 +118,10 @@ class PyWebSocket(http_server.Lighttpd):
os.path.join(self._root, 'websocket', 'tests'))
else:
try:
- self._web_socket_tests = path_utils.path_from_base(
- 'third_party', 'WebKit', 'LayoutTests', 'websocket',
- 'tests')
- self._layout_tests = path_utils.path_from_base(
- 'third_party', 'WebKit', 'LayoutTests')
- except path_utils.PathNotFound:
+ self._layout_tests = self._port_obj.layout_tests_dir()
+ self._web_socket_tests = os.path.join(self._layout_tests,
+ 'websocket', 'tests')
+ except:
self._web_socket_tests = None
def start(self):
@@ -155,7 +140,7 @@ class PyWebSocket(http_server.Lighttpd):
log_file_name = log_prefix + time_str
# Remove old log files. We only need to keep the last ones.
- remove_log_files(self._output_dir, log_prefix)
+ self.remove_log_files(self._output_dir, log_prefix)
error_log = os.path.join(self._output_dir, log_file_name + "-err.txt")
@@ -163,11 +148,12 @@ class PyWebSocket(http_server.Lighttpd):
self._wsout = open(output_log, "w")
python_interp = sys.executable
- pywebsocket_base = path_utils.path_from_base(
- 'third_party', 'WebKit', 'WebKitTools', 'pywebsocket')
- pywebsocket_script = path_utils.path_from_base(
- 'third_party', 'WebKit', 'WebKitTools', 'pywebsocket',
- 'mod_pywebsocket', 'standalone.py')
+ pywebsocket_base = os.path.join(
+ os.path.dirname(os.path.dirname(os.path.dirname(
+ os.path.dirname(os.path.dirname(
+ os.path.abspath(__file__)))))), 'pywebsocket')
+ pywebsocket_script = os.path.join(pywebsocket_base, 'mod_pywebsocket',
+ 'standalone.py')
start_cmd = [
python_interp, pywebsocket_script,
'-p', str(self._port),
@@ -193,12 +179,13 @@ class PyWebSocket(http_server.Lighttpd):
env = os.environ
if sys.platform in ('cygwin', 'win32'):
env['PATH'] = '%s;%s' % (
- path_utils.path_from_base('third_party', 'cygwin', 'bin'),
+ self._port_obj.path_from_chromium_base('third_party',
+ 'cygwin', 'bin'),
env['PATH'])
if sys.platform == 'win32' and self._register_cygwin:
- setup_mount = path_utils.path_from_base('third_party', 'cygwin',
- 'setup_mount.bat')
+ setup_mount = self._port_obj.path_from_chromium_base(
+ 'third_party', 'cygwin', 'setup_mount.bat')
subprocess.Popen(setup_mount).wait()
env['PYTHONPATH'] = (pywebsocket_base + os.path.pathsep +
@@ -255,7 +242,7 @@ class PyWebSocket(http_server.Lighttpd):
'Failed to find %s server pid.' % self._server_name)
logging.debug('Shutting down %s server %d.' % (self._server_name, pid))
- port.kill_process(pid)
+ self._port_obj._kill_process(pid)
if self._process:
self._process.wait()
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py b/WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py
index 414baaf..83cf99de 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py
@@ -54,7 +54,7 @@ import urllib
import webbrowser
import zipfile
-from port import path_utils
+from layout_package import path_utils
from layout_package import test_expectations
from test_types import image_diff
from test_types import text_diff
@@ -76,6 +76,7 @@ ARCHIVE_DIR_NAME_DICT = {'win': 'webkit-rel',
'linux-canary': 'webkit-rel-linux-webkit-org'}
+# FIXME: Should be rolled into webkitpy.Executive
def run_shell_with_return_code(command, print_output=False):
"""Executes a command and returns the output and process return code.
@@ -109,6 +110,7 @@ def run_shell_with_return_code(command, print_output=False):
return output, p.returncode
+# FIXME: Should be rolled into webkitpy.Executive
def run_shell(command, print_output=False):
"""Executes a command and returns the output.
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/run_chromium_webkit_tests.py b/WebKitTools/Scripts/webkitpy/layout_tests/run_chromium_webkit_tests.py
index 571ae3f..f0b68ee 100755
--- a/WebKitTools/Scripts/webkitpy/layout_tests/run_chromium_webkit_tests.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/run_chromium_webkit_tests.py
@@ -54,31 +54,24 @@ import Queue
import random
import re
import shutil
-import subprocess
import sys
import time
import traceback
+import simplejson
+
from layout_package import test_expectations
from layout_package import json_layout_results_generator
from layout_package import metered_stream
from layout_package import test_failures
from layout_package import test_shell_thread
from layout_package import test_files
-
-import port
-from port import apache_http_server
-from port import http_server
-from port import path_utils
-from port import websocket_server
-
from test_types import fuzzy_image_diff
from test_types import image_diff
from test_types import test_type_base
from test_types import text_diff
-sys.path.append(path_utils.path_from_base('third_party'))
-import simplejson
+import port
# Indicates that we want detailed progress updates in the output (prints
# directory-by-directory feedback).
@@ -96,17 +89,16 @@ TestExpectationsFile = test_expectations.TestExpectationsFile
class TestInfo:
"""Groups information about a test for easy passing of data."""
- def __init__(self, filename, timeout):
+ def __init__(self, port, filename, timeout):
"""Generates the URI and stores the filename and timeout for this test.
Args:
filename: Full path to the test.
timeout: Timeout for running the test in TestShell.
"""
self.filename = filename
- self.uri = path_utils.filename_to_uri(filename)
+ self.uri = port.filename_to_uri(filename)
self.timeout = timeout
- expected_hash_file = path_utils.expected_filename(filename,
- '.checksum')
+ expected_hash_file = port.expected_filename(filename, '.checksum')
try:
self.image_hash = open(expected_hash_file, "r").read()
except IOError, e:
@@ -175,24 +167,18 @@ class TestRunner:
NUM_RETRY_ON_UNEXPECTED_FAILURE = 1
- def __init__(self, options, meter):
+ def __init__(self, port, options, meter):
"""Initialize test runner data structures.
Args:
+ port: an object implementing port-specific
options: a dictionary of command line options
meter: a MeteredStream object to record updates to.
"""
+ self._port = port
self._options = options
self._meter = meter
- if options.use_apache:
- self._http_server = apache_http_server.LayoutTestApacheHttpd(
- options.results_directory)
- else:
- self._http_server = http_server.Lighttpd(options.results_directory)
-
- self._websocket_server = websocket_server.PyWebSocket(
- options.results_directory)
# disable wss server. need to install pyOpenSSL on buildbots.
# self._websocket_secure_server = websocket_server.PyWebSocket(
# options.results_directory, use_tls=True, port=9323)
@@ -203,8 +189,6 @@ class TestRunner:
# a set of test files, and the same tests as a list
self._test_files = set()
self._test_files_list = None
- self._file_dir = path_utils.path_from_base('webkit', 'tools',
- 'layout_tests')
self._result_queue = Queue.Queue()
# These are used for --log detailed-progress to track status by
@@ -219,20 +203,18 @@ class TestRunner:
logging.debug("flushing stderr")
sys.stderr.flush()
logging.debug("stopping http server")
- # Stop the http server.
- self._http_server.stop()
- # Stop the Web Socket / Web Socket Secure servers.
- self._websocket_server.stop()
- # self._websocket_secure_server.Stop()
+ self._port.stop_http_server()
+ logging.debug("stopping websocket server")
+ self._port.stop_websocket_server()
def gather_file_paths(self, paths):
"""Find all the files to test.
Args:
paths: a list of globs to use instead of the defaults."""
- self._test_files = test_files.gather_test_files(paths)
+ self._test_files = test_files.gather_test_files(self._port, paths)
- def parse_expectations(self, platform, is_debug_mode):
+ def parse_expectations(self, test_platform_name, is_debug_mode):
"""Parse the expectations from the test_list files and return a data
structure holding them. Throws an error if the test_list files have
invalid syntax."""
@@ -242,9 +224,10 @@ class TestRunner:
test_files = self._test_files
try:
- self._expectations = test_expectations.TestExpectations(test_files,
- self._file_dir, platform, is_debug_mode,
- self._options.lint_test_files)
+ expectations_str = self._port.test_expectations()
+ self._expectations = test_expectations.TestExpectations(
+ self._port, test_files, expectations_str, test_platform_name,
+ is_debug_mode, self._options.lint_test_files)
return self._expectations
except Exception, err:
if self._options.lint_test_files:
@@ -359,7 +342,8 @@ class TestRunner:
self._test_files = set(self._test_files_list)
self._expectations = self.parse_expectations(
- path_utils.platform_name(), self._options.target == 'Debug')
+ self._port.test_platform_name(),
+ self._options.target == 'Debug')
self._test_files = set(files)
self._test_files_list = files
@@ -424,8 +408,9 @@ class TestRunner:
is used for looking up the timeout value (in ms) to use for the given
test."""
if self._expectations.has_modifier(test_file, test_expectations.SLOW):
- return TestInfo(test_file, self._options.slow_time_out_ms)
- return TestInfo(test_file, self._options.time_out_ms)
+ return TestInfo(self._port, test_file,
+ self._options.slow_time_out_ms)
+ return TestInfo(self._port, test_file, self._options.time_out_ms)
def _get_test_file_queue(self, test_files):
"""Create the thread safe queue of lists of (test filenames, test URIs)
@@ -490,6 +475,7 @@ class TestRunner:
"""Returns the tuple of arguments for tests and for test_shell."""
shell_args = []
test_args = test_type_base.TestArguments()
+ png_path = None
if not self._options.no_pixel_tests:
png_path = os.path.join(self._options.results_directory,
"png_result%s.png" % index)
@@ -506,7 +492,7 @@ class TestRunner:
if self._options.gp_fault_error_box:
shell_args.append('--gp-fault-error-box')
- return (test_args, shell_args)
+ return test_args, png_path, shell_args
def _contains_tests(self, subdir):
for test_file in self._test_files_list:
@@ -514,23 +500,12 @@ class TestRunner:
return True
return False
- def _instantiate_test_shell_threads(self, test_shell_binary, test_files,
- result_summary):
+ def _instantiate_test_shell_threads(self, test_files, result_summary):
"""Instantitates and starts the TestShellThread(s).
Return:
The list of threads.
"""
- test_shell_command = [test_shell_binary]
-
- if self._options.wrapper:
- # This split() isn't really what we want -- it incorrectly will
- # split quoted strings within the wrapper argument -- but in
- # practice it shouldn't come up and the --help output warns
- # about it anyway.
- test_shell_command = (self._options.wrapper.split() +
- test_shell_command)
-
filename_queue = self._get_test_file_queue(test_files)
# Instantiate TestShellThreads and start them.
@@ -539,15 +514,16 @@ class TestRunner:
# Create separate TestTypes instances for each thread.
test_types = []
for t in self._test_types:
- test_types.append(t(self._options.platform,
+ test_types.append(t(self._port, self._options.platform,
self._options.results_directory))
- test_args, shell_args = self._get_test_shell_args(i)
- thread = test_shell_thread.TestShellThread(filename_queue,
+ test_args, png_path, shell_args = self._get_test_shell_args(i)
+ thread = test_shell_thread.TestShellThread(self._port,
+ filename_queue,
self._result_queue,
- test_shell_command,
test_types,
test_args,
+ png_path,
shell_args,
self._options)
if self._is_single_threaded():
@@ -558,19 +534,11 @@ class TestRunner:
return threads
- def _stop_layout_test_helper(self, proc):
- """Stop the layout test helper and closes it down."""
- if proc:
- logging.debug("Stopping layout test helper")
- proc.stdin.write("x\n")
- proc.stdin.close()
- proc.wait()
-
def _is_single_threaded(self):
"""Returns whether we should run all the tests in the main thread."""
return int(self._options.num_test_shells) == 1
- def _run_tests(self, test_shell_binary, file_list, result_summary):
+ def _run_tests(self, file_list, result_summary):
"""Runs the tests in the file_list.
Return: A tuple (failures, thread_timings, test_timings,
@@ -584,9 +552,8 @@ class TestRunner:
in the form {filename:filename, test_run_time:test_run_time}
result_summary: summary object to populate with the results
"""
- threads = self._instantiate_test_shell_threads(test_shell_binary,
- file_list,
- result_summary)
+ threads = self._instantiate_test_shell_threads(file_list,
+ result_summary)
# Wait for the threads to finish and collect test failures.
failures = {}
@@ -612,7 +579,7 @@ class TestRunner:
except KeyboardInterrupt:
for thread in threads:
thread.cancel()
- self._stop_layout_test_helper(layout_test_helper_proc)
+ self._port.stop_helper()
raise
for thread in threads:
# Check whether a TestShellThread died before normal completion.
@@ -642,42 +609,20 @@ class TestRunner:
if not self._test_files:
return 0
start_time = time.time()
- test_shell_binary = path_utils.test_shell_path(self._options.target)
# Start up any helper needed
- layout_test_helper_proc = None
if not self._options.no_pixel_tests:
- helper_path = path_utils.layout_test_helper_path(
- self._options.target)
- if len(helper_path):
- logging.debug("Starting layout helper %s" % helper_path)
- layout_test_helper_proc = subprocess.Popen(
- [helper_path], stdin=subprocess.PIPE,
- stdout=subprocess.PIPE, stderr=None)
- is_ready = layout_test_helper_proc.stdout.readline()
- if not is_ready.startswith('ready'):
- logging.error("layout_test_helper failed to be ready")
-
- # Check that the system dependencies (themes, fonts, ...) are correct.
- if not self._options.nocheck_sys_deps:
- proc = subprocess.Popen([test_shell_binary,
- "--check-layout-test-sys-deps"])
- if proc.wait() != 0:
- logging.info("Aborting because system dependencies check "
- "failed.\n To override, invoke with "
- "--nocheck-sys-deps")
- sys.exit(1)
+ self._port.start_helper()
if self._contains_tests(self.HTTP_SUBDIR):
- self._http_server.start()
+ self._port.start_http_server()
if self._contains_tests(self.WEBSOCKET_SUBDIR):
- self._websocket_server.start()
+ self._port.start_websocket_server()
# self._websocket_secure_server.Start()
thread_timings, test_timings, individual_test_timings = (
- self._run_tests(test_shell_binary, self._test_files_list,
- result_summary))
+ self._run_tests(self._test_files_list, result_summary))
# We exclude the crashes from the list of results to retry, because
# we want to treat even a potentially flaky crash as an error.
@@ -689,10 +634,10 @@ class TestRunner:
logging.debug("Retrying %d unexpected failure(s)" % len(failures))
retries += 1
retry_summary = ResultSummary(self._expectations, failures.keys())
- self._run_tests(test_shell_binary, failures.keys(), retry_summary)
+ self._run_tests(failures.keys(), retry_summary)
failures = self._get_failures(retry_summary, include_crashes=True)
- self._stop_layout_test_helper(layout_test_helper_proc)
+ self._port.stop_helper()
end_time = time.time()
write = create_logging_writer(self._options, 'timing')
@@ -777,7 +722,7 @@ class TestRunner:
next_test = self._test_files_list[self._current_test_number]
next_dir = os.path.dirname(
- path_utils.relative_test_filename(next_test))
+ self._port.relative_test_filename(next_test))
if self._current_progress_str == "":
self._current_progress_str = "%s: " % (next_dir)
self._current_dir = next_dir
@@ -803,7 +748,7 @@ class TestRunner:
next_test = self._test_files_list[self._current_test_number]
next_dir = os.path.dirname(
- path_utils.relative_test_filename(next_test))
+ self._port.relative_test_filename(next_test))
if result_summary.remaining:
remain_str = " (%d)" % (result_summary.remaining)
@@ -874,7 +819,7 @@ class TestRunner:
# Note that if a test crashed in the original run, we ignore
# whether or not it crashed when we retried it (if we retried it),
# and always consider the result not flaky.
- test = path_utils.relative_test_filename(filename)
+ test = self._port.relative_test_filename(filename)
expected = self._expectations.get_expectations_string(filename)
actual = [keywords[result]]
@@ -943,7 +888,7 @@ class TestRunner:
expectations_file.close()
json_layout_results_generator.JSONLayoutResultsGenerator(
- self._options.builder_name, self._options.build_name,
+ self._port, self._options.builder_name, self._options.build_name,
self._options.build_number, self._options.results_directory,
BUILDER_BASE_URL, individual_test_timings,
self._expectations, result_summary, self._test_files_list)
@@ -1110,7 +1055,7 @@ class TestRunner:
write(title)
for test_tuple in test_list:
filename = test_tuple.filename[len(
- path_utils.layout_tests_dir()) + 1:]
+ self._port.layout_tests_dir()) + 1:]
filename = filename.replace('\\', '/')
test_run_time = round(test_tuple.test_run_time, 1)
write(" %s took %s seconds" % (filename, test_run_time))
@@ -1328,7 +1273,7 @@ class TestRunner:
"""Prints one unexpected test result line."""
desc = TestExpectationsFile.EXPECTATION_DESCRIPTIONS[result][0]
self._meter.write(" %s -> unexpected %s\n" %
- (path_utils.relative_test_filename(test), desc))
+ (self._port.relative_test_filename(test), desc))
def _write_results_html_file(self, result_summary):
"""Write results.html which is a summary of tests that failed.
@@ -1366,12 +1311,12 @@ class TestRunner:
for test_file in test_files:
test_failures = result_summary.failures.get(test_file, [])
out_file.write("<p><a href='%s'>%s</a><br />\n"
- % (path_utils.filename_to_uri(test_file),
- path_utils.relative_test_filename(test_file)))
+ % (self._port.filename_to_uri(test_file),
+ self._port.relative_test_filename(test_file)))
for failure in test_failures:
out_file.write("&nbsp;&nbsp;%s<br/>"
% failure.result_html_output(
- path_utils.relative_test_filename(test_file)))
+ self._port.relative_test_filename(test_file)))
out_file.write("</p>\n")
# footer
@@ -1382,8 +1327,7 @@ class TestRunner:
"""Launches the test shell open to the results.html page."""
results_filename = os.path.join(self._options.results_directory,
"results.html")
- subprocess.Popen([path_utils.test_shell_path(self._options.target),
- path_utils.filename_to_uri(results_filename)])
+ self._port.show_results_html_file(results_filename)
def _add_to_dict_of_lists(dict, key, value):
@@ -1444,19 +1388,19 @@ def main(options, args):
else:
options.target = "Release"
+ port_obj = port.get(options.platform, options)
+
if not options.use_apache:
options.use_apache = sys.platform in ('darwin', 'linux2')
if options.results_directory.startswith("/"):
# Assume it's an absolute path and normalize.
- options.results_directory = path_utils.get_absolute_path(
+ options.results_directory = port_obj.get_absolute_path(
options.results_directory)
else:
# If it's a relative path, make the output directory relative to
# Debug or Release.
- basedir = path_utils.path_from_base('webkit')
- options.results_directory = path_utils.get_absolute_path(
- os.path.join(basedir, options.target, options.results_directory))
+ options.results_directory = port_obj.results_directory()
if options.clobber_old_results:
# Just clobber the actual test results directories since the other
@@ -1466,12 +1410,9 @@ def main(options, args):
if os.path.exists(path):
shutil.rmtree(path)
- # Ensure platform is valid and force it to the form 'chromium-<platform>'.
- options.platform = path_utils.platform_name(options.platform)
-
if not options.num_test_shells:
# TODO(ojan): Investigate perf/flakiness impact of using numcores + 1.
- options.num_test_shells = port.get_num_cores()
+ options.num_test_shells = port_obj.num_cores()
write = create_logging_writer(options, 'config')
write("Running %s test_shells in parallel" % options.num_test_shells)
@@ -1499,62 +1440,46 @@ def main(options, args):
paths += read_test_files(options.test_list)
# Create the output directory if it doesn't already exist.
- path_utils.maybe_make_directory(options.results_directory)
+ port_obj.maybe_make_directory(options.results_directory)
meter.update("Gathering files ...")
- test_runner = TestRunner(options, meter)
+ test_runner = TestRunner(port_obj, options, meter)
test_runner.gather_file_paths(paths)
if options.lint_test_files:
# Creating the expecations for each platform/target pair does all the
# test list parsing and ensures it's correct syntax (e.g. no dupes).
- for platform in TestExpectationsFile.PLATFORMS:
+ for platform in port_obj.test_platform_names():
test_runner.parse_expectations(platform, is_debug_mode=True)
test_runner.parse_expectations(platform, is_debug_mode=False)
print ("If there are no fail messages, errors or exceptions, then the "
"lint succeeded.")
sys.exit(0)
- try:
- test_shell_binary_path = path_utils.test_shell_path(options.target)
- except path_utils.PathNotFound:
- print "\nERROR: test_shell is not found. Be sure that you have built"
- print "it and that you are using the correct build. This script"
- print "will run the Release one by default. Use --debug to use the"
- print "Debug build.\n"
- sys.exit(1)
+ # Check that the system dependencies (themes, fonts, ...) are correct.
+ if not options.nocheck_sys_deps:
+ if not port_obj.check_sys_deps():
+ sys.exit(1)
write = create_logging_writer(options, "config")
- write("Using platform '%s'" % options.platform)
+ write("Using port '%s'" % port_obj.name())
write("Placing test results in %s" % options.results_directory)
if options.new_baseline:
- write("Placing new baselines in %s" %
- path_utils.chromium_baseline_path(options.platform))
- write("Using %s build at %s" % (options.target, test_shell_binary_path))
+ write("Placing new baselines in %s" % port_obj.baseline_path())
+ write("Using %s build" % options.target)
if options.no_pixel_tests:
write("Not running pixel tests")
write("")
meter.update("Parsing expectations ...")
- test_runner.parse_expectations(options.platform, options.target == 'Debug')
+ test_runner.parse_expectations(port_obj.test_platform_name(),
+ options.target == 'Debug')
meter.update("Preparing tests ...")
write = create_logging_writer(options, "expected")
result_summary = test_runner.prepare_lists_and_print_output(write)
- if 'cygwin' == sys.platform:
- logging.warn("#" * 40)
- logging.warn("# UNEXPECTED PYTHON VERSION")
- logging.warn("# This script should be run using the version of python")
- logging.warn("# in third_party/python_24/")
- logging.warn("#" * 40)
- sys.exit(1)
-
- # Delete the disk cache if any to ensure a clean test run.
- cachedir = os.path.split(test_shell_binary_path)[0]
- cachedir = os.path.join(cachedir, "cache")
- if os.path.exists(cachedir):
- shutil.rmtree(cachedir)
+ port_obj.setup_test_run()
test_runner.add_test_type(text_diff.TestTextDiff)
if not options.no_pixel_tests:
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/test_types/fuzzy_image_diff.py b/WebKitTools/Scripts/webkitpy/layout_tests/test_types/fuzzy_image_diff.py
index 100fd0d..89dd192 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/test_types/fuzzy_image_diff.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/test_types/fuzzy_image_diff.py
@@ -35,16 +35,14 @@ import errno
import logging
import os
import shutil
-import subprocess
-from port import path_utils
from layout_package import test_failures
from test_types import test_type_base
class FuzzyImageDiff(test_type_base.TestTypeBase):
- def compare_output(self, filename, proc, output, test_args, target):
+ def compare_output(self, filename, output, test_args, target):
"""Implementation of CompareOutput that checks the output image and
checksum against the expected files from the LayoutTest directory.
"""
@@ -54,7 +52,7 @@ class FuzzyImageDiff(test_type_base.TestTypeBase):
if test_args.hash is None:
return failures
- expected_png_file = path_utils.expected_filename(filename, '.png')
+ expected_png_file = self._port.expected_filename(filename, '.png')
if test_args.show_sources:
logging.debug('Using %s' % expected_png_file)
@@ -64,8 +62,7 @@ class FuzzyImageDiff(test_type_base.TestTypeBase):
failures.append(test_failures.FailureMissingImage(self))
# Run the fuzzymatcher
- r = subprocess.call([path_utils.fuzzy_match_path(),
- test_args.png_path, expected_png_file])
+ r = port.fuzzy_diff(test_args.png_path, expected_png_file)
if r != 0:
failures.append(test_failures.FailureFuzzyFailure(self))
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/test_types/image_diff.py b/WebKitTools/Scripts/webkitpy/layout_tests/test_types/image_diff.py
index 86b9659..1df7ca3 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/test_types/image_diff.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/test_types/image_diff.py
@@ -38,9 +38,7 @@ import errno
import logging
import os
import shutil
-import subprocess
-from port import path_utils
from layout_package import test_failures
from test_types import test_type_base
@@ -84,7 +82,7 @@ class ImageDiff(test_type_base.TestTypeBase):
self._save_baseline_data(filename, png_data, ".png")
self._save_baseline_data(filename, checksum, ".checksum")
- def _create_image_diff(self, filename, target):
+ def _create_image_diff(self, port, filename, target):
"""Creates the visual diff of the expected/actual PNGs.
Args:
@@ -98,32 +96,14 @@ class ImageDiff(test_type_base.TestTypeBase):
expected_filename = self.output_filename(filename,
self.FILENAME_SUFFIX_EXPECTED + '.png')
- global _compare_available
- cmd = ''
-
try:
- executable = path_utils.image_diff_path(target)
- cmd = [executable, '--diff', actual_filename, expected_filename,
- diff_filename]
- except Exception, e:
+ _compare_available = True
+ result = port.diff_image(actual_filename, expected_filename,
+ diff_filename)
+ except ValueError:
_compare_available = False
- result = 1
- if _compare_available:
- try:
- result = subprocess.call(cmd)
- except OSError, e:
- if e.errno == errno.ENOENT or e.errno == errno.EACCES:
- _compare_available = False
- else:
- raise e
- except ValueError:
- # work around a race condition in Python 2.4's implementation
- # of subprocess.Popen
- pass
-
global _compare_msg_printed
-
if not _compare_available and not _compare_msg_printed:
_compare_msg_printed = True
print('image_diff not found. Make sure you have a ' + target +
@@ -131,7 +111,7 @@ class ImageDiff(test_type_base.TestTypeBase):
return result
- def compare_output(self, filename, proc, output, test_args, target):
+ def compare_output(self, port, filename, output, test_args, target):
"""Implementation of CompareOutput that checks the output image and
checksum against the expected files from the LayoutTest directory.
"""
@@ -148,9 +128,9 @@ class ImageDiff(test_type_base.TestTypeBase):
return failures
# Compare hashes.
- expected_hash_file = path_utils.expected_filename(filename,
+ expected_hash_file = self._port.expected_filename(filename,
'.checksum')
- expected_png_file = path_utils.expected_filename(filename, '.png')
+ expected_png_file = self._port.expected_filename(filename, '.png')
if test_args.show_sources:
logging.debug('Using %s' % expected_hash_file)
@@ -166,8 +146,9 @@ class ImageDiff(test_type_base.TestTypeBase):
if not os.path.isfile(expected_png_file):
# Report a missing expected PNG file.
- self.write_output_files(filename, '', '.checksum', test_args.hash,
- expected_hash, diff=False, wdiff=False)
+ self.write_output_files(port, filename, '', '.checksum',
+ test_args.hash, expected_hash,
+ diff=False, wdiff=False)
self._copy_output_png(filename, test_args.png_path, '-actual.png')
failures.append(test_failures.FailureMissingImage(self))
return failures
@@ -176,14 +157,15 @@ class ImageDiff(test_type_base.TestTypeBase):
return failures
- self.write_output_files(filename, '', '.checksum', test_args.hash,
- expected_hash, diff=False, wdiff=False)
+ self.write_output_files(port, filename, '', '.checksum',
+ test_args.hash, expected_hash,
+ diff=False, wdiff=False)
self._copy_output_png(filename, test_args.png_path, '-actual.png')
self._copy_output_png(filename, expected_png_file, '-expected.png')
# Even though we only use result in one codepath below but we
# still need to call CreateImageDiff for other codepaths.
- result = self._create_image_diff(filename, target)
+ result = self._create_image_diff(port, filename, target)
if expected_hash == '':
failures.append(test_failures.FailureMissingImageHash(self))
elif test_args.hash != expected_hash:
@@ -196,7 +178,7 @@ class ImageDiff(test_type_base.TestTypeBase):
return failures
- def diff_files(self, file1, file2):
+ def diff_files(self, port, file1, file2):
"""Diff two image files.
Args:
@@ -208,17 +190,8 @@ class ImageDiff(test_type_base.TestTypeBase):
"""
try:
- executable = path_utils.image_diff_path('Debug')
- except Exception, e:
- logging.warn('Failed to find image diff executable.')
- return True
-
- cmd = [executable, file1, file2]
- result = 1
- try:
- result = subprocess.call(cmd)
- except OSError, e:
- logging.warn('Failed to compare image diff: %s', e)
+ result = port.diff_image(file1, file2)
+ except ValueError, e:
return True
return result == 1
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/test_types/test_type_base.py b/WebKitTools/Scripts/webkitpy/layout_tests/test_types/test_type_base.py
index 79b7e34..efa2e8c 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/test_types/test_type_base.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/test_types/test_type_base.py
@@ -33,13 +33,9 @@ Also defines the TestArguments "struct" to pass them additional arguments.
"""
import cgi
-import difflib
import errno
import logging
import os.path
-import subprocess
-
-from port import path_utils
class TestArguments(object):
@@ -74,7 +70,7 @@ class TestTypeBase(object):
FILENAME_SUFFIX_WDIFF = "-wdiff.html"
FILENAME_SUFFIX_COMPARE = "-diff.png"
- def __init__(self, platform, root_output_dir):
+ def __init__(self, port, platform, root_output_dir):
"""Initialize a TestTypeBase object.
Args:
@@ -83,14 +79,15 @@ class TestTypeBase(object):
root_output_dir: The unix style path to the output dir.
"""
self._root_output_dir = root_output_dir
+ self._port = port
self._platform = platform
def _make_output_directory(self, filename):
"""Creates the output directory (if needed) for a given test
filename."""
output_filename = os.path.join(self._root_output_dir,
- path_utils.relative_test_filename(filename))
- path_utils.maybe_make_directory(os.path.split(output_filename)[0])
+ self._port.relative_test_filename(filename))
+ self._port.maybe_make_directory(os.path.split(output_filename)[0])
def _save_baseline_data(self, filename, data, modifier):
"""Saves a new baseline file into the platform directory.
@@ -104,13 +101,13 @@ class TestTypeBase(object):
modifier: type of the result file, e.g. ".txt" or ".png"
"""
relative_dir = os.path.dirname(
- path_utils.relative_test_filename(filename))
+ self._port.relative_test_filename(filename))
output_dir = os.path.join(
- path_utils.chromium_baseline_path(self._platform), relative_dir)
+ self._port.chromium_baseline_path(self._platform), relative_dir)
output_file = os.path.basename(os.path.splitext(filename)[0] +
self.FILENAME_SUFFIX_EXPECTED + modifier)
- path_utils.maybe_make_directory(output_dir)
+ self._port.maybe_make_directory(output_dir)
output_path = os.path.join(output_dir, output_file)
logging.debug('writing new baseline to "%s"' % (output_path))
open(output_path, "wb").write(data)
@@ -130,10 +127,10 @@ class TestTypeBase(object):
The absolute windows path to the output filename
"""
output_filename = os.path.join(self._root_output_dir,
- path_utils.relative_test_filename(filename))
+ self._port.relative_test_filename(filename))
return os.path.splitext(output_filename)[0] + modifier
- def compare_output(self, filename, proc, output, test_args, target):
+ def compare_output(self, port, filename, output, test_args, target):
"""Method that compares the output from the test with the
expected value.
@@ -141,7 +138,6 @@ class TestTypeBase(object):
Args:
filename: absolute filename to test file
- proc: a reference to the test_shell process
output: a string containing the output of the test
test_args: a TestArguments object holding optional additional
arguments
@@ -152,8 +148,8 @@ class TestTypeBase(object):
"""
raise NotImplemented
- def write_output_files(self, filename, test_type, file_type, output,
- expected, diff=True, wdiff=False):
+ def write_output_files(self, port, filename, test_type, file_type,
+ output, expected, diff=True, wdiff=False):
"""Writes the test output, the expected output and optionally the diff
between the two to files in the results directory.
@@ -186,81 +182,15 @@ class TestTypeBase(object):
return
if diff:
- diff = difflib.unified_diff(expected.splitlines(True),
- output.splitlines(True),
- expected_filename,
- actual_filename)
-
+ diff = port.diff_text(expected, output, expected_filename,
+ actual_filename)
diff_filename = self.output_filename(filename,
test_type + self.FILENAME_SUFFIX_DIFF + file_type)
- open(diff_filename, "wb").write(''.join(diff))
+ open(diff_filename, "wb").write(diff)
if wdiff:
# Shell out to wdiff to get colored inline diffs.
- executable = path_utils.wdiff_path()
- cmd = [executable,
- '--start-delete=##WDIFF_DEL##',
- '--end-delete=##WDIFF_END##',
- '--start-insert=##WDIFF_ADD##',
- '--end-insert=##WDIFF_END##',
- expected_filename,
- actual_filename]
- filename = self.output_filename(filename,
- test_type + self.FILENAME_SUFFIX_WDIFF)
-
- global _wdiff_available
-
- try:
- # Python's Popen has a bug that causes any pipes opened to a
- # process that can't be executed to be leaked. Since this
- # code is specifically designed to tolerate exec failures
- # to gracefully handle cases where wdiff is not installed,
- # the bug results in a massive file descriptor leak. As a
- # workaround, if an exec failure is ever experienced for
- # wdiff, assume it's not available. This will leak one
- # file descriptor but that's better than leaking each time
- # wdiff would be run.
- #
- # http://mail.python.org/pipermail/python-list/
- # 2008-August/505753.html
- # http://bugs.python.org/issue3210
- #
- # It also has a threading bug, so we don't output wdiff if
- # the Popen raises a ValueError.
- # http://bugs.python.org/issue1236
- if _wdiff_available:
- wdiff = subprocess.Popen(
- cmd, stdout=subprocess.PIPE).communicate()[0]
- wdiff_failed = False
-
- except OSError, e:
- if (e.errno == errno.ENOENT or e.errno == errno.EACCES or
- e.errno == errno.ECHILD):
- _wdiff_available = False
- else:
- raise e
- except ValueError, e:
- wdiff_failed = True
-
- out = open(filename, 'wb')
-
- if not _wdiff_available:
- out.write(
- "wdiff not installed.<br/> "
- "If you're running OS X, you can install via macports."
- "<br/>"
- "If running Ubuntu linux, you can run "
- "'sudo apt-get install wdiff'.")
- elif wdiff_failed:
- out.write('wdiff failed due to running with multiple '
- 'test_shells in parallel.')
- else:
- wdiff = cgi.escape(wdiff)
- wdiff = wdiff.replace('##WDIFF_DEL##', '<span class=del>')
- wdiff = wdiff.replace('##WDIFF_ADD##', '<span class=add>')
- wdiff = wdiff.replace('##WDIFF_END##', '</span>')
- out.write('<head><style>.del { background: #faa; } ')
- out.write('.add { background: #afa; }</style></head>')
- out.write('<pre>' + wdiff + '</pre>')
-
- out.close()
+ wdiff = port.wdiff_text(expected_filename, actual_filename)
+ filename = self.output_filename(filename, test_type +
+ self.FILENAME_SUFFIX_WDIFF)
+ out = open(filename, 'wb').write(wdiff)
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/test_types/text_diff.py b/WebKitTools/Scripts/webkitpy/layout_tests/test_types/text_diff.py
index 3c895af..54b332b 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/test_types/text_diff.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/test_types/text_diff.py
@@ -37,7 +37,6 @@ import errno
import logging
import os.path
-from port import path_utils
from layout_package import test_failures
from test_types import test_type_base
@@ -61,8 +60,8 @@ class TestTextDiff(test_type_base.TestTypeBase):
"""Given the filename of the test, read the expected output from a file
and normalize the text. Returns a string with the expected text, or ''
if the expected output file was not found."""
- # Read the platform-specific expected text.
- expected_filename = path_utils.expected_filename(filename, '.txt')
+ # Read the port-specific expected text.
+ expected_filename = self._port.expected_filename(filename, '.txt')
if show_sources:
logging.debug('Using %s' % expected_filename)
@@ -79,7 +78,7 @@ class TestTextDiff(test_type_base.TestTypeBase):
# Normalize line endings
return text.strip("\r\n").replace("\r\n", "\n") + "\n"
- def compare_output(self, filename, proc, output, test_args, target):
+ def compare_output(self, port, filename, output, test_args, target):
"""Implementation of CompareOutput that checks the output text against
the expected text from the LayoutTest directory."""
failures = []
@@ -95,10 +94,10 @@ class TestTextDiff(test_type_base.TestTypeBase):
test_args.show_sources)
# Write output files for new tests, too.
- if output != expected:
+ if port.compare_text(output, expected):
# Text doesn't match, write output files.
- self.write_output_files(filename, "", ".txt", output, expected,
- diff=True, wdiff=True)
+ self.write_output_files(port, filename, "", ".txt", output,
+ expected, diff=True, wdiff=True)
if expected == '':
failures.append(test_failures.FailureMissingResult(self))
@@ -107,7 +106,7 @@ class TestTextDiff(test_type_base.TestTypeBase):
return failures
- def diff_files(self, file1, file2):
+ def diff_files(self, port, file1, file2):
"""Diff two text files.
Args:
@@ -118,5 +117,5 @@ class TestTextDiff(test_type_base.TestTypeBase):
False otherwise.
"""
- return (self.get_normalized_text(file1) !=
- self.get_normalized_text(file2))
+ return port.compare_text(self.get_normalized_text(file1),
+ self.get_normalized_text(file2))
diff --git a/WebKitTools/Scripts/webkitpy/mock_bugzillatool.py b/WebKitTools/Scripts/webkitpy/mock_bugzillatool.py
index 1aff53a..f522e40 100644
--- a/WebKitTools/Scripts/webkitpy/mock_bugzillatool.py
+++ b/WebKitTools/Scripts/webkitpy/mock_bugzillatool.py
@@ -321,7 +321,8 @@ class MockSCM(Mock):
class MockUser(object):
- def prompt(self, message):
+ @staticmethod
+ def prompt(message, repeat=1, raw_input=raw_input):
return "Mock user response"
def edit(self, files):
diff --git a/WebKitTools/Scripts/webkitpy/style/checker.py b/WebKitTools/Scripts/webkitpy/style/checker.py
index dc14ea3..fbda8cb 100644
--- a/WebKitTools/Scripts/webkitpy/style/checker.py
+++ b/WebKitTools/Scripts/webkitpy/style/checker.py
@@ -37,7 +37,8 @@ import sys
from .. style_references import parse_patch
from error_handlers import DefaultStyleErrorHandler
from error_handlers import PatchStyleErrorHandler
-from filter import CategoryFilter
+from filter import validate_filter_rules
+from filter import FilterConfiguration
from processors.common import check_no_carriage_return
from processors.common import categories as CommonCategories
from processors.cpp import CppProcessor
@@ -85,6 +86,46 @@ WEBKIT_DEFAULT_FILTER_RULES = [
]
+# FIXME: Change the second value of each tuple from a tuple to a list,
+# and alter the filter code so it accepts lists instead. (The
+# filter code will need to convert incoming values from a list
+# to a tuple prior to caching). This will make this
+# configuration setting a bit simpler since tuples have an
+# unusual syntax case.
+#
+# The path-specific filter rules.
+#
+# This list is order sensitive. Only the first path substring match
+# is used. See the FilterConfiguration documentation in filter.py
+# for more information on this list.
+_PATH_RULES_SPECIFIER = [
+ # Files in these directories are consumers of the WebKit
+ # API and therefore do not follow the same header including
+ # discipline as WebCore.
+ (["WebKitTools/WebKitAPITest/",
+ "WebKit/qt/QGVLauncher/"],
+ ("-build/include",
+ "-readability/streams")),
+ ([# The GTK+ APIs use GTK+ naming style, which includes
+ # lower-cased, underscore-separated values.
+ "WebKit/gtk/webkit/",
+ # There is no clean way to avoid "yy_*" names used by flex.
+ "WebCore/css/CSSParser.cpp",
+ # There is no clean way to avoid "xxx_data" methods inside
+ # Qt's autotests since they are called automatically by the
+ # QtTest module.
+ "WebKit/qt/tests/",
+ "JavaScriptCore/qt/tests"],
+ ("-readability/naming",)),
+ # These are test file patterns.
+ (["_test.cpp",
+ "_unittest.cpp",
+ "_regtest.cpp"],
+ ("-readability/streams", # Many unit tests use cout.
+ "-runtime/rtti")),
+]
+
+
# Some files should be skipped when checking style. For example,
# WebKit maintains some files in Mozilla style on purpose to ease
# future merges.
@@ -201,43 +242,56 @@ Syntax: %(program_name)s [--verbose=#] [--git-commit=<SingleCommit>] [--output=v
return usage
+# FIXME: Eliminate support for "extra_flag_values".
+#
+# FIXME: Remove everything from ProcessorOptions except for the
+# information that can be passed via the command line, and
+# rename to something like CheckWebKitStyleOptions. This
+# includes, but is not limited to, removing the
+# max_reports_per_error attribute and the is_reportable()
+# method. See also the FIXME below to create a new class
+# called something like CheckerConfiguration.
+#
# This class should not have knowledge of the flag key names.
class ProcessorOptions(object):
- """A container to store options to use when checking style.
+ """A container to store options passed via the command line.
Attributes:
- output_format: A string that is the output format. The supported
- output formats are "emacs" which emacs can parse
- and "vs7" which Microsoft Visual Studio 7 can parse.
-
- verbosity: An integer between 1-5 inclusive that restricts output
- to errors with a confidence score at or above this value.
- The default is 1, which displays all errors.
+ extra_flag_values: A string-string dictionary of all flag key-value
+ pairs that are not otherwise represented by this
+ class. The default is the empty dictionary.
- filter: A CategoryFilter instance. The default is the empty filter,
- which means that all categories should be checked.
+ filter_configuration: A FilterConfiguration instance. The default
+ is the "empty" filter configuration, which
+ means that all errors should be checked.
git_commit: A string representing the git commit to check.
The default is None.
- extra_flag_values: A string-string dictionary of all flag key-value
- pairs that are not otherwise represented by this
- class. The default is the empty dictionary.
+ max_reports_per_error: The maximum number of errors to report
+ per file, per category.
- """
+ output_format: A string that is the output format. The supported
+ output formats are "emacs" which emacs can parse
+ and "vs7" which Microsoft Visual Studio 7 can parse.
+
+ verbosity: An integer between 1-5 inclusive that restricts output
+ to errors with a confidence score at or above this value.
+ The default is 1, which reports all errors.
+ """
def __init__(self,
- output_format="emacs",
- verbosity=1,
- filter=None,
- max_reports_per_category=None,
+ extra_flag_values=None,
+ filter_configuration = None,
git_commit=None,
- extra_flag_values=None):
+ max_reports_per_category=None,
+ output_format="emacs",
+ verbosity=1):
if extra_flag_values is None:
extra_flag_values = {}
- if filter is None:
- filter = CategoryFilter()
+ if filter_configuration is None:
+ filter_configuration = FilterConfiguration()
if max_reports_per_category is None:
max_reports_per_category = {}
@@ -252,7 +306,7 @@ class ProcessorOptions(object):
'Value given: "%s".' % verbosity)
self.extra_flag_values = extra_flag_values
- self.filter = filter
+ self.filter_configuration = filter_configuration
self.git_commit = git_commit
self.max_reports_per_category = max_reports_per_category
self.output_format = output_format
@@ -263,7 +317,7 @@ class ProcessorOptions(object):
"""Return whether this ProcessorOptions instance is equal to another."""
if self.extra_flag_values != other.extra_flag_values:
return False
- if self.filter != other.filter:
+ if self.filter_configuration != other.filter_configuration:
return False
if self.git_commit != other.git_commit:
return False
@@ -278,15 +332,16 @@ class ProcessorOptions(object):
# Useful for unit testing.
def __ne__(self, other):
- # Python does not automatically deduce from __eq__().
- return not (self == other)
+ # Python does not automatically deduce this from __eq__().
+ return not self.__eq__(other)
- def is_reportable(self, category, confidence_in_error):
+ def is_reportable(self, category, confidence_in_error, path):
"""Return whether an error is reportable.
An error is reportable if the confidence in the error
is at least the current verbosity level, and if the current
- filter says that the category should be checked.
+ filter says that the category should be checked for the
+ given path.
Args:
category: A string that is a style category.
@@ -294,15 +349,13 @@ class ProcessorOptions(object):
represents the application's confidence in
the error. A higher number signifies greater
confidence.
+ path: The path of the file being checked
"""
if confidence_in_error < self.verbosity:
return False
- if self.filter is None:
- return True # All categories should be checked by default.
-
- return self.filter.should_check(category)
+ return self.filter_configuration.should_check(category, path)
# This class should not have knowledge of the flag key names.
@@ -313,16 +366,16 @@ class ArgumentDefaults(object):
Attributes:
output_format: A string that is the default output format.
verbosity: An integer that is the default verbosity level.
- filter_rules: A list of strings that are boolean filter rules
- to prepend to any user-specified rules.
+ base_filter_rules: A list of strings that are boolean filter rules
+ to prepend to any user-specified rules.
"""
def __init__(self, default_output_format, default_verbosity,
- default_filter_rules):
+ default_base_filter_rules):
self.output_format = default_output_format
self.verbosity = default_verbosity
- self.filter_rules = default_filter_rules
+ self.base_filter_rules = default_base_filter_rules
class ArgumentPrinter(object):
@@ -345,11 +398,10 @@ class ArgumentPrinter(object):
flags['output'] = options.output_format
flags['verbose'] = options.verbosity
- if options.filter:
- # Only include the filter flag if rules are present.
- filter_string = str(options.filter)
- if filter_string:
- flags['filter'] = filter_string
+ # Only include the filter flag if user-provided rules are present.
+ user_rules = options.filter_configuration.user_rules
+ if user_rules:
+ flags['filter'] = ",".join(user_rules)
if options.git_commit:
flags['git-commit'] = options.git_commit
@@ -409,7 +461,7 @@ class ArgumentParser(object):
self.doc_print(' ' + category + '\n')
self.doc_print('\nDefault filter rules**:\n')
- for filter_rule in sorted(self.defaults.filter_rules):
+ for filter_rule in sorted(self.defaults.base_filter_rules):
self.doc_print(' ' + filter_rule + '\n')
self.doc_print('\n**The command always evaluates the above rules, '
'and before any --filter flag.\n\n')
@@ -417,10 +469,7 @@ class ArgumentParser(object):
sys.exit(0)
def _parse_filter_flag(self, flag_value):
- """Parse the value of the --filter flag.
-
- These filters are applied when deciding whether to emit a given
- error message.
+ """Parse the --filter flag, and return a list of filter rules.
Args:
flag_value: A string of comma-separated filter rules, for
@@ -457,7 +506,7 @@ class ArgumentParser(object):
output_format = self.defaults.output_format
verbosity = self.defaults.verbosity
- filter_rules = self.defaults.filter_rules
+ base_rules = self.defaults.base_filter_rules
# The flags already supported by the ProcessorOptions class.
flags = ['help', 'output=', 'verbose=', 'filter=', 'git-commit=']
@@ -480,6 +529,7 @@ class ArgumentParser(object):
extra_flag_values = {}
git_commit = None
+ user_rules = []
for (opt, val) in opts:
if opt == '--help':
@@ -494,7 +544,7 @@ class ArgumentParser(object):
if not val:
self._exit_with_categories()
# Prepend the defaults.
- filter_rules = filter_rules + self._parse_filter_flag(val)
+ user_rules = self._parse_filter_flag(val)
else:
extra_flag_values[opt] = val
@@ -508,15 +558,20 @@ class ArgumentParser(object):
'allowed output formats are emacs and vs7.' %
output_format)
+ all_categories = style_categories()
+ validate_filter_rules(user_rules, all_categories)
+
verbosity = int(verbosity)
if (verbosity < 1) or (verbosity > 5):
raise ValueError('Invalid --verbose value %s: value must '
'be between 1-5.' % verbosity)
- filter = CategoryFilter(filter_rules)
+ filter_configuration = FilterConfiguration(base_rules=base_rules,
+ path_specific=_PATH_RULES_SPECIFIER,
+ user_rules=user_rules)
options = ProcessorOptions(extra_flag_values=extra_flag_values,
- filter=filter,
+ filter_configuration=filter_configuration,
git_commit=git_commit,
max_reports_per_category=MAX_REPORTS_PER_CATEGORY,
output_format=output_format,
@@ -623,6 +678,18 @@ class ProcessorDispatcher(object):
return processor
+# FIXME: When creating the new CheckWebKitStyleOptions class as
+# described in a FIXME above, add a new class here called
+# something like CheckerConfiguration. The class should contain
+# attributes for options needed to process a file. This includes
+# a subset of the CheckWebKitStyleOptions attributes, a
+# FilterConfiguration attribute, an stderr_write attribute, a
+# max_reports_per_category attribute, etc. It can also include
+# the is_reportable() method. The StyleChecker should accept
+# an instance of this class rather than a ProcessorOptions
+# instance.
+
+
class StyleChecker(object):
"""Supports checking style in files and patches.
diff --git a/WebKitTools/Scripts/webkitpy/style/checker_unittest.py b/WebKitTools/Scripts/webkitpy/style/checker_unittest.py
index 814bd41..e1c9baf 100755
--- a/WebKitTools/Scripts/webkitpy/style/checker_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/style/checker_unittest.py
@@ -37,10 +37,13 @@
import unittest
import checker as style
+from checker import _PATH_RULES_SPECIFIER as PATH_RULES_SPECIFIER
+from checker import style_categories
from checker import ProcessorDispatcher
from checker import ProcessorOptions
from checker import StyleChecker
-from filter import CategoryFilter
+from filter import validate_filter_rules
+from filter import FilterConfiguration
from processors.cpp import CppProcessor
from processors.text import TextProcessor
@@ -54,7 +57,7 @@ class ProcessorOptionsTest(unittest.TestCase):
# Check default parameters.
options = ProcessorOptions()
self.assertEquals(options.extra_flag_values, {})
- self.assertEquals(options.filter, CategoryFilter())
+ self.assertEquals(options.filter_configuration, FilterConfiguration())
self.assertEquals(options.git_commit, None)
self.assertEquals(options.max_reports_per_category, {})
self.assertEquals(options.output_format, "emacs")
@@ -70,14 +73,15 @@ class ProcessorOptionsTest(unittest.TestCase):
ProcessorOptions(verbosity=5) # works
# Check attributes.
+ filter_configuration = FilterConfiguration(base_rules=["+"])
options = ProcessorOptions(extra_flag_values={"extra_value" : 2},
- filter=CategoryFilter(["+"]),
+ filter_configuration=filter_configuration,
git_commit="commit",
max_reports_per_category={"category": 3},
output_format="vs7",
verbosity=3)
self.assertEquals(options.extra_flag_values, {"extra_value" : 2})
- self.assertEquals(options.filter, CategoryFilter(["+"]))
+ self.assertEquals(options.filter_configuration, filter_configuration)
self.assertEquals(options.git_commit, "commit")
self.assertEquals(options.max_reports_per_category, {"category": 3})
self.assertEquals(options.output_format, "vs7")
@@ -88,15 +92,18 @@ class ProcessorOptionsTest(unittest.TestCase):
# == calls __eq__.
self.assertTrue(ProcessorOptions() == ProcessorOptions())
- # Verify that a difference in any argument cause equality to fail.
+ # Verify that a difference in any argument causes equality to fail.
+ filter_configuration = FilterConfiguration(base_rules=["+"])
options = ProcessorOptions(extra_flag_values={"extra_value" : 1},
- filter=CategoryFilter(["+"]),
+ filter_configuration=filter_configuration,
git_commit="commit",
max_reports_per_category={"category": 3},
output_format="vs7",
verbosity=1)
self.assertFalse(options == ProcessorOptions(extra_flag_values={"extra_value" : 2}))
- self.assertFalse(options == ProcessorOptions(filter=CategoryFilter(["-"])))
+ new_config = FilterConfiguration(base_rules=["-"])
+ self.assertFalse(options ==
+ ProcessorOptions(filter_configuration=new_config))
self.assertFalse(options == ProcessorOptions(git_commit="commit2"))
self.assertFalse(options == ProcessorOptions(max_reports_per_category=
{"category": 2}))
@@ -113,36 +120,41 @@ class ProcessorOptionsTest(unittest.TestCase):
def test_is_reportable(self):
"""Test is_reportable()."""
- filter = CategoryFilter(["-xyz"])
- options = ProcessorOptions(filter=filter, verbosity=3)
+ filter_configuration = FilterConfiguration(base_rules=["-xyz"])
+ options = ProcessorOptions(filter_configuration=filter_configuration,
+ verbosity=3)
# Test verbosity
- self.assertTrue(options.is_reportable("abc", 3))
- self.assertFalse(options.is_reportable("abc", 2))
+ self.assertTrue(options.is_reportable("abc", 3, "foo.h"))
+ self.assertFalse(options.is_reportable("abc", 2, "foo.h"))
# Test filter
- self.assertTrue(options.is_reportable("xy", 3))
- self.assertFalse(options.is_reportable("xyz", 3))
+ self.assertTrue(options.is_reportable("xy", 3, "foo.h"))
+ self.assertFalse(options.is_reportable("xyz", 3, "foo.h"))
class GlobalVariablesTest(unittest.TestCase):
"""Tests validity of the global variables."""
+ def _all_categories(self):
+ return style.style_categories()
+
def defaults(self):
return style.webkit_argument_defaults()
def test_filter_rules(self):
defaults = self.defaults()
already_seen = []
- all_categories = style.style_categories()
- for rule in defaults.filter_rules:
+ validate_filter_rules(defaults.base_filter_rules,
+ self._all_categories())
+ # Also do some additional checks.
+ for rule in defaults.base_filter_rules:
# Check no leading or trailing white space.
self.assertEquals(rule, rule.strip())
# All categories are on by default, so defaults should
# begin with -.
self.assertTrue(rule.startswith('-'))
- self.assertTrue(rule[1:] in all_categories)
# Check no rule occurs twice.
self.assertFalse(rule in already_seen)
already_seen.append(rule)
@@ -158,11 +170,29 @@ class GlobalVariablesTest(unittest.TestCase):
# on valid arguments elsewhere.
parser.parse([]) # arguments valid: no error or SystemExit
+ def test_path_rules_specifier(self):
+ all_categories = style_categories()
+ for (sub_paths, path_rules) in PATH_RULES_SPECIFIER:
+ self.assertTrue(isinstance(path_rules, tuple),
+ "Checking: " + str(path_rules))
+ validate_filter_rules(path_rules, self._all_categories())
+
+ # Try using the path specifier (as an "end-to-end" check).
+ config = FilterConfiguration(path_specific=PATH_RULES_SPECIFIER)
+ self.assertTrue(config.should_check("xxx_any_category",
+ "xxx_non_matching_path"))
+ self.assertTrue(config.should_check("xxx_any_category",
+ "WebKitTools/WebKitAPITest/"))
+ self.assertFalse(config.should_check("build/include",
+ "WebKitTools/WebKitAPITest/"))
+ self.assertFalse(config.should_check("readability/naming",
+ "WebKit/qt/tests/qwebelement/tst_qwebelement.cpp"))
+
def test_max_reports_per_category(self):
"""Check that MAX_REPORTS_PER_CATEGORY is valid."""
- categories = style.style_categories()
+ all_categories = self._all_categories()
for category in style.MAX_REPORTS_PER_CATEGORY.iterkeys():
- self.assertTrue(category in categories,
+ self.assertTrue(category in all_categories,
'Key "%s" is not a category' % category)
@@ -172,12 +202,15 @@ class ArgumentPrinterTest(unittest.TestCase):
_printer = style.ArgumentPrinter()
- def _create_options(self, output_format='emacs', verbosity=3,
- filter_rules=[], git_commit=None,
+ def _create_options(self,
+ output_format='emacs',
+ verbosity=3,
+ user_rules=[],
+ git_commit=None,
extra_flag_values={}):
- filter = CategoryFilter(filter_rules)
+ filter_configuration = FilterConfiguration(user_rules=user_rules)
return style.ProcessorOptions(extra_flag_values=extra_flag_values,
- filter=filter,
+ filter_configuration=filter_configuration,
git_commit=git_commit,
output_format=output_format,
verbosity=verbosity)
@@ -255,8 +288,8 @@ class ArgumentParserTest(unittest.TestCase):
parse(['--output=vs7']) # works
# Pass a filter rule not beginning with + or -.
- self.assertRaises(ValueError, parse, ['--filter=foo'])
- parse(['--filter=+foo']) # works
+ self.assertRaises(ValueError, parse, ['--filter=build'])
+ parse(['--filter=+build']) # works
# Pass files and git-commit at the same time.
self.assertRaises(SystemExit, parse, ['--git-commit=', 'file.txt'])
# Pass an extra flag already supported.
@@ -277,8 +310,9 @@ class ArgumentParserTest(unittest.TestCase):
self.assertEquals(options.output_format, 'vs7')
self.assertEquals(options.verbosity, 3)
- self.assertEquals(options.filter,
- CategoryFilter(["-", "+whitespace"]))
+ self.assertEquals(options.filter_configuration,
+ FilterConfiguration(base_rules=["-", "+whitespace"],
+ path_specific=PATH_RULES_SPECIFIER))
self.assertEquals(options.git_commit, None)
def test_parse_explicit_arguments(self):
@@ -291,13 +325,21 @@ class ArgumentParserTest(unittest.TestCase):
self.assertEquals(options.verbosity, 4)
(files, options) = parse(['--git-commit=commit'])
self.assertEquals(options.git_commit, 'commit')
- (files, options) = parse(['--filter=+foo,-bar'])
- self.assertEquals(options.filter,
- CategoryFilter(["-", "+whitespace", "+foo", "-bar"]))
- # Spurious white space in filter rules.
- (files, options) = parse(['--filter=+foo ,-bar'])
- self.assertEquals(options.filter,
- CategoryFilter(["-", "+whitespace", "+foo", "-bar"]))
+
+ # Pass user_rules.
+ (files, options) = parse(['--filter=+build,-whitespace'])
+ config = options.filter_configuration
+ self.assertEquals(options.filter_configuration,
+ FilterConfiguration(base_rules=["-", "+whitespace"],
+ path_specific=PATH_RULES_SPECIFIER,
+ user_rules=["+build", "-whitespace"]))
+
+ # Pass spurious white space in user rules.
+ (files, options) = parse(['--filter=+build, -whitespace'])
+ self.assertEquals(options.filter_configuration,
+ FilterConfiguration(base_rules=["-", "+whitespace"],
+ path_specific=PATH_RULES_SPECIFIER,
+ user_rules=["+build", "-whitespace"]))
# Pass extra flag values.
(files, options) = parse(['--extra'], ['extra'])
diff --git a/WebKitTools/Scripts/webkitpy/style/error_handlers.py b/WebKitTools/Scripts/webkitpy/style/error_handlers.py
index 31140de..1940e03 100644
--- a/WebKitTools/Scripts/webkitpy/style/error_handlers.py
+++ b/WebKitTools/Scripts/webkitpy/style/error_handlers.py
@@ -83,7 +83,7 @@ class DefaultStyleErrorHandler(object):
# A string to integer dictionary cache of the number of reportable
# errors per category passed to this instance.
- self._category_totals = { }
+ self._category_totals = {}
def _add_reportable_error(self, category):
"""Increment the error count and return the new category total."""
@@ -109,7 +109,9 @@ class DefaultStyleErrorHandler(object):
See the docstring of this module for more information.
"""
- if not self._options.is_reportable(category, confidence):
+ if not self._options.is_reportable(category,
+ confidence,
+ self._file_path):
return
category_total = self._add_reportable_error(category)
diff --git a/WebKitTools/Scripts/webkitpy/style/error_handlers_unittest.py b/WebKitTools/Scripts/webkitpy/style/error_handlers_unittest.py
index 83bdbb9..1d7e998 100644
--- a/WebKitTools/Scripts/webkitpy/style/error_handlers_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/style/error_handlers_unittest.py
@@ -48,11 +48,12 @@ class DefaultStyleErrorHandlerTest(StyleErrorHandlerTestBase):
"""Tests DefaultStyleErrorHandler class."""
+ _file_path = "foo.h"
+
_category = "whitespace/tab"
def _error_handler(self, options):
- file_path = "foo.h"
- return DefaultStyleErrorHandler(file_path,
+ return DefaultStyleErrorHandler(self._file_path,
options,
self._mock_increment_error_count,
self._mock_stderr_write)
@@ -81,7 +82,9 @@ class DefaultStyleErrorHandlerTest(StyleErrorHandlerTestBase):
self._check_initialized()
# Confirm the error is not reportable.
- self.assertFalse(options.is_reportable(self._category, confidence))
+ self.assertFalse(options.is_reportable(self._category,
+ confidence,
+ self._file_path))
self._call_error_handler(options, confidence)
@@ -147,9 +150,9 @@ class PatchStyleErrorHandlerTest(StyleErrorHandlerTestBase):
"""Tests PatchStyleErrorHandler class."""
- file_path = "__init__.py"
+ _file_path = "__init__.py"
- patch_string = """diff --git a/__init__.py b/__init__.py
+ _patch_string = """diff --git a/__init__.py b/__init__.py
index ef65bee..e3db70e 100644
--- a/__init__.py
+++ b/__init__.py
@@ -160,13 +163,13 @@ index ef65bee..e3db70e 100644
"""
def test_call(self):
- patch_files = parse_patch(self.patch_string)
- diff = patch_files[self.file_path]
+ patch_files = parse_patch(self._patch_string)
+ diff = patch_files[self._file_path]
options = ProcessorOptions(verbosity=3)
handle_error = PatchStyleErrorHandler(diff,
- self.file_path,
+ self._file_path,
options,
self._mock_increment_error_count,
self._mock_stderr_write)
@@ -176,7 +179,9 @@ index ef65bee..e3db70e 100644
message = "message"
# Confirm error is reportable.
- self.assertTrue(options.is_reportable(category, confidence))
+ self.assertTrue(options.is_reportable(category,
+ confidence,
+ self._file_path))
# Confirm error count initialized to zero.
self.assertEquals(0, self._error_count)
diff --git a/WebKitTools/Scripts/webkitpy/style/filter.py b/WebKitTools/Scripts/webkitpy/style/filter.py
index 1b41424..19c2f4d 100644
--- a/WebKitTools/Scripts/webkitpy/style/filter.py
+++ b/WebKitTools/Scripts/webkitpy/style/filter.py
@@ -23,20 +23,47 @@
"""Contains filter-related code."""
-class CategoryFilter(object):
+def validate_filter_rules(filter_rules, all_categories):
+ """Validate the given filter rules, and raise a ValueError if not valid.
+
+ Args:
+ filter_rules: A list of boolean filter rules, for example--
+ ["-whitespace", "+whitespace/braces"]
+ all_categories: A list of all available category names, for example--
+ ["whitespace/tabs", "whitespace/braces"]
+
+ Raises:
+ ValueError: An error occurs if a filter rule does not begin
+ with "+" or "-" or if a filter rule does not match
+ the beginning of some category name in the list
+ of all available categories.
+
+ """
+ for rule in filter_rules:
+ if not (rule.startswith('+') or rule.startswith('-')):
+ raise ValueError('Invalid filter rule "%s": every rule '
+ "must start with + or -." % rule)
+
+ for category in all_categories:
+ if category.startswith(rule[1:]):
+ break
+ else:
+ raise ValueError('Suspected incorrect filter rule "%s": '
+ "the rule does not match the beginning "
+ "of any category name." % rule)
+
+
+class _CategoryFilter(object):
"""Filters whether to check style categories."""
def __init__(self, filter_rules=None):
"""Create a category filter.
- This method performs argument validation but does not strip
- leading or trailing white space.
-
Args:
filter_rules: A list of strings that are filter rules, which
are strings beginning with the plus or minus
- symbol (+/-). The list should include any
+ symbol (+/-). The list should include any
default filter rules at the beginning.
Defaults to the empty list.
@@ -48,12 +75,6 @@ class CategoryFilter(object):
if filter_rules is None:
filter_rules = []
- for rule in filter_rules:
- if not (rule.startswith('+') or rule.startswith('-')):
- raise ValueError('Invalid filter rule "%s": every rule '
- 'rule in the --filter flag must start '
- 'with + or -.' % rule)
-
self._filter_rules = filter_rules
self._should_check_category = {} # Cached dictionary of category to True/False
@@ -74,13 +95,13 @@ class CategoryFilter(object):
"""Return whether the category should be checked.
The rules for determining whether a category should be checked
- are as follows. By default all categories should be checked.
+ are as follows. By default all categories should be checked.
Then apply the filter rules in order from first to last, with
later flags taking precedence.
A filter rule applies to a category if the string after the
leading plus/minus (+/-) matches the beginning of the category
- name. A plus (+) means the category should be checked, while a
+ name. A plus (+) means the category should be checked, while a
minus (-) means the category should not be checked.
"""
@@ -95,3 +116,159 @@ class CategoryFilter(object):
self._should_check_category[category] = should_check # Update cache.
return should_check
+
+class FilterConfiguration(object):
+
+ """Supports filtering with path-specific and user-specified rules."""
+
+ def __init__(self, base_rules=None, path_specific=None, user_rules=None):
+ """Create a FilterConfiguration instance.
+
+ Args:
+ base_rules: The starting list of filter rules to use for
+ processing. The default is the empty list, which
+ by itself would mean that all categories should be
+ checked.
+
+ path_specific: A list of (sub_paths, path_rules) pairs
+ that stores the path-specific filter rules for
+ appending to the base rules.
+ The "sub_paths" value is a list of path
+ substrings. If a file path contains one of the
+ substrings, then the corresponding path rules
+ are appended. The first substring match takes
+ precedence, i.e. only the first match triggers
+ an append.
+ The "path_rules" value is the tuple of filter
+ rules that can be appended to the base rules.
+ The value is a tuple rather than a list so it
+ can be used as a dictionary key. The dictionary
+ is for caching purposes in the implementation of
+ this class.
+
+ user_rules: A list of filter rules that is always appended
+ to the base rules and any path rules. In other
+ words, the user rules take precedence over the
+ everything. In practice, the user rules are
+ provided by the user from the command line.
+
+ """
+ if base_rules is None:
+ base_rules = []
+ if path_specific is None:
+ path_specific = []
+ if user_rules is None:
+ user_rules = []
+
+ self._base_rules = base_rules
+ self._path_specific = path_specific
+ self._path_specific_lower = None
+ """The backing store for self._get_path_specific_lower()."""
+
+ # FIXME: Make user rules internal after the FilterConfiguration
+ # attribute is removed from ProcessorOptions (since at
+ # that point ArgumentPrinter will no longer need to
+ # access FilterConfiguration.user_rules).
+ self.user_rules = user_rules
+
+ self._path_rules_to_filter = {}
+ """Cached dictionary of path rules to CategoryFilter instance."""
+
+ # The same CategoryFilter instance can be shared across
+ # multiple keys in this dictionary. This allows us to take
+ # greater advantage of the caching done by
+ # CategoryFilter.should_check().
+ self._path_to_filter = {}
+ """Cached dictionary of file path to CategoryFilter instance."""
+
+ # Useful for unit testing.
+ def __eq__(self, other):
+ """Return whether this FilterConfiguration is equal to another."""
+ if self._base_rules != other._base_rules:
+ return False
+ if self._path_specific != other._path_specific:
+ return False
+ if self.user_rules != other.user_rules:
+ return False
+
+ return True
+
+ # Useful for unit testing.
+ def __ne__(self, other):
+ # Python does not automatically deduce this from __eq__().
+ return not self.__eq__(other)
+
+ # We use the prefix "_get" since the name "_path_specific_lower"
+ # is already taken up by the data attribute backing store.
+ def _get_path_specific_lower(self):
+ """Return a copy of self._path_specific with the paths lower-cased."""
+ if self._path_specific_lower is None:
+ self._path_specific_lower = []
+ for (sub_paths, path_rules) in self._path_specific:
+ sub_paths = map(str.lower, sub_paths)
+ self._path_specific_lower.append((sub_paths, path_rules))
+ return self._path_specific_lower
+
+ def _path_rules_from_path(self, path):
+ """Determine the path-specific rules to use, and return as a tuple."""
+ path = path.lower()
+ for (sub_paths, path_rules) in self._get_path_specific_lower():
+ for sub_path in sub_paths:
+ if path.find(sub_path) > -1:
+ return path_rules
+ return () # Default to the empty tuple.
+
+ def _filter_from_path_rules(self, path_rules):
+ """Return the CategoryFilter associated to a path rules tuple."""
+ # We reuse the same CategoryFilter where possible to take
+ # advantage of the caching they do.
+ if path_rules not in self._path_rules_to_filter:
+ rules = list(self._base_rules) # Make a copy
+ rules.extend(path_rules)
+ rules.extend(self.user_rules)
+ self._path_rules_to_filter[path_rules] = _CategoryFilter(rules)
+
+ return self._path_rules_to_filter[path_rules]
+
+ def _filter_from_path(self, path):
+ """Return the CategoryFilter associated to a path."""
+ if path not in self._path_to_filter:
+ path_rules = self._path_rules_from_path(path)
+ filter = self._filter_from_path_rules(path_rules)
+ self._path_to_filter[path] = filter
+
+ return self._path_to_filter[path]
+
+ def should_check(self, category, path):
+ """Return whether the given category should be checked.
+
+ This method determines whether a category should be checked
+ by checking the category name against the filter rules for
+ the given path.
+
+ For a given path, the filter rules are the combination of
+ the base rules, the path-specific rules, and the user-provided
+ rules -- in that order. As we will describe below, later rules
+ in the list take precedence. The path-specific rules are the
+ rules corresponding to the first element of the "path_specific"
+ parameter that contains a string case-insensitively matching
+ some substring of the path. If there is no such element,
+ there are no path-specific rules for that path.
+
+ Given a list of filter rules, the logic for determining whether
+ a category should be checked is as follows. By default all
+ categories should be checked. Then apply the filter rules in
+ order from first to last, with later flags taking precedence.
+
+ A filter rule applies to a category if the string after the
+ leading plus/minus (+/-) matches the beginning of the category
+ name. A plus (+) means the category should be checked, while a
+ minus (-) means the category should not be checked.
+
+ Args:
+ category: The category name.
+ path: The path of the file being checked.
+
+ """
+ return self._filter_from_path(path).should_check(category)
+
diff --git a/WebKitTools/Scripts/webkitpy/style/filter_unittest.py b/WebKitTools/Scripts/webkitpy/style/filter_unittest.py
index 0b12123..84760a5 100644
--- a/WebKitTools/Scripts/webkitpy/style/filter_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/style/filter_unittest.py
@@ -22,10 +22,62 @@
"""Unit tests for filter.py."""
-
import unittest
-from filter import CategoryFilter
+from filter import _CategoryFilter as CategoryFilter
+from filter import validate_filter_rules
+from filter import FilterConfiguration
+
+# On Testing __eq__() and __ne__():
+#
+# In the tests below, we deliberately do not use assertEquals() or
+# assertNotEquals() to test __eq__() or __ne__(). We do this to be
+# very explicit about what we are testing, especially in the case
+# of assertNotEquals().
+#
+# Part of the reason is that it is not immediately clear what
+# expression the unittest module uses to assert "not equals" -- the
+# negation of __eq__() or __ne__(), which are not necessarily
+# equivalent expresions in Python. For example, from Python's "Data
+# Model" documentation--
+#
+# "There are no implied relationships among the comparison
+# operators. The truth of x==y does not imply that x!=y is
+# false. Accordingly, when defining __eq__(), one should
+# also define __ne__() so that the operators will behave as
+# expected."
+#
+# (from http://docs.python.org/reference/datamodel.html#object.__ne__ )
+
+class ValidateFilterRulesTest(unittest.TestCase):
+
+ """Tests validate_filter_rules() function."""
+
+ def test_validate_filter_rules(self):
+ all_categories = ["tabs", "whitespace", "build/include"]
+
+ bad_rules = [
+ "tabs",
+ "*tabs",
+ " tabs",
+ " +tabs",
+ "+whitespace/newline",
+ "+xxx",
+ ]
+
+ good_rules = [
+ "+tabs",
+ "-tabs",
+ "+build"
+ ]
+
+ for rule in bad_rules:
+ self.assertRaises(ValueError, validate_filter_rules,
+ [rule], all_categories)
+
+ for rule in good_rules:
+ # This works: no error.
+ validate_filter_rules([rule], all_categories)
class CategoryFilterTest(unittest.TestCase):
@@ -33,11 +85,15 @@ class CategoryFilterTest(unittest.TestCase):
"""Tests CategoryFilter class."""
def test_init(self):
- """Test __init__ constructor."""
- self.assertRaises(ValueError, CategoryFilter, ["no_prefix"])
- CategoryFilter() # No ValueError: works
- CategoryFilter(["+"]) # No ValueError: works
- CategoryFilter(["-"]) # No ValueError: works
+ """Test __init__ method."""
+ # Test that the attributes are getting set correctly.
+ filter = CategoryFilter(["+"])
+ self.assertEquals(["+"], filter._filter_rules)
+
+ def test_init_default_arguments(self):
+ """Test __init__ method default arguments."""
+ filter = CategoryFilter()
+ self.assertEquals([], filter._filter_rules)
def test_str(self):
"""Test __str__ "to string" operator."""
@@ -50,17 +106,20 @@ class CategoryFilterTest(unittest.TestCase):
filter2 = CategoryFilter(["+a", "+b"])
filter3 = CategoryFilter(["+b", "+a"])
- # == calls __eq__.
- self.assertTrue(filter1 == filter2)
- self.assertFalse(filter1 == filter3) # Cannot test with assertNotEqual.
+ # See the notes at the top of this module about testing
+ # __eq__() and __ne__().
+ self.assertTrue(filter1.__eq__(filter2))
+ self.assertFalse(filter1.__eq__(filter3))
def test_ne(self):
"""Test __ne__ inequality function."""
- # != calls __ne__.
# By default, __ne__ always returns true on different objects.
# Thus, just check the distinguishing case to verify that the
# code defines __ne__.
- self.assertFalse(CategoryFilter() != CategoryFilter())
+ #
+ # Also, see the notes at the top of this module about testing
+ # __eq__() and __ne__().
+ self.assertFalse(CategoryFilter().__ne__(CategoryFilter()))
def test_should_check(self):
"""Test should_check() method."""
@@ -82,3 +141,116 @@ class CategoryFilterTest(unittest.TestCase):
self.assertFalse(filter.should_check("abc"))
self.assertTrue(filter.should_check("a"))
+
+class FilterConfigurationTest(unittest.TestCase):
+
+ """Tests FilterConfiguration class."""
+
+ def _config(self, base_rules, path_specific, user_rules):
+ """Return a FilterConfiguration instance."""
+ return FilterConfiguration(base_rules=base_rules,
+ path_specific=path_specific,
+ user_rules=user_rules)
+
+ def test_init(self):
+ """Test __init__ method."""
+ # Test that the attributes are getting set correctly.
+ # We use parameter values that are different from the defaults.
+ base_rules = ["-"]
+ path_specific = [(["path"], ("+a",))]
+ user_rules = ["+"]
+
+ config = self._config(base_rules, path_specific, user_rules)
+
+ self.assertEquals(base_rules, config._base_rules)
+ self.assertEquals(path_specific, config._path_specific)
+ self.assertEquals(user_rules, config.user_rules)
+
+ def test_default_arguments(self):
+ # Test that the attributes are getting set correctly to the defaults.
+ config = FilterConfiguration()
+
+ self.assertEquals([], config._base_rules)
+ self.assertEquals([], config._path_specific)
+ self.assertEquals([], config.user_rules)
+
+ def test_eq(self):
+ """Test __eq__ method."""
+ # See the notes at the top of this module about testing
+ # __eq__() and __ne__().
+ self.assertTrue(FilterConfiguration().__eq__(FilterConfiguration()))
+
+ # Verify that a difference in any argument causes equality to fail.
+ config = FilterConfiguration()
+
+ # These parameter values are different from the defaults.
+ base_rules = ["-"]
+ path_specific = [(["path"], ("+a",))]
+ user_rules = ["+"]
+
+ self.assertFalse(config.__eq__(FilterConfiguration(
+ base_rules=base_rules)))
+ self.assertFalse(config.__eq__(FilterConfiguration(
+ path_specific=path_specific)))
+ self.assertFalse(config.__eq__(FilterConfiguration(
+ user_rules=user_rules)))
+
+ def test_ne(self):
+ """Test __ne__ method."""
+ # By default, __ne__ always returns true on different objects.
+ # Thus, just check the distinguishing case to verify that the
+ # code defines __ne__.
+ #
+ # Also, see the notes at the top of this module about testing
+ # __eq__() and __ne__().
+ self.assertFalse(FilterConfiguration().__ne__(FilterConfiguration()))
+
+ def test_base_rules(self):
+ """Test effect of base_rules on should_check()."""
+ base_rules = ["-b"]
+ path_specific = []
+ user_rules = []
+
+ config = self._config(base_rules, path_specific, user_rules)
+
+ self.assertTrue(config.should_check("a", "path"))
+ self.assertFalse(config.should_check("b", "path"))
+
+ def test_path_specific(self):
+ """Test effect of path_rules_specifier on should_check()."""
+ base_rules = ["-"]
+ path_specific = [(["path1"], ("+b",)),
+ (["path2"], ("+c",))]
+ user_rules = []
+
+ config = self._config(base_rules, path_specific, user_rules)
+
+ self.assertFalse(config.should_check("c", "path1"))
+ self.assertTrue(config.should_check("c", "path2"))
+ # Test that first match takes precedence.
+ self.assertFalse(config.should_check("c", "path2/path1"))
+
+ def test_path_with_different_case(self):
+ """Test a path that differs only in case."""
+ base_rules = ["-"]
+ path_specific = [(["Foo/"], ("+whitespace",))]
+ user_rules = []
+
+ config = self._config(base_rules, path_specific, user_rules)
+
+ self.assertFalse(config.should_check("whitespace", "Fooo/bar.txt"))
+ self.assertTrue(config.should_check("whitespace", "Foo/bar.txt"))
+ # Test different case.
+ self.assertTrue(config.should_check("whitespace", "FOO/bar.txt"))
+
+ def test_user_rules(self):
+ """Test effect of user_rules on should_check()."""
+ base_rules = ["-"]
+ path_specific = []
+ user_rules = ["+b"]
+
+ config = self._config(base_rules, path_specific, user_rules)
+
+ self.assertFalse(config.should_check("a", "path"))
+ self.assertTrue(config.should_check("b", "path"))
+
diff --git a/WebKitTools/Scripts/webkitpy/style/processors/cpp.py b/WebKitTools/Scripts/webkitpy/style/processors/cpp.py
index e1f41a4..182c967 100644
--- a/WebKitTools/Scripts/webkitpy/style/processors/cpp.py
+++ b/WebKitTools/Scripts/webkitpy/style/processors/cpp.py
@@ -2030,22 +2030,6 @@ def _drop_common_suffixes(filename):
return os.path.splitext(filename)[0]
-def _is_test_filename(filename):
- """Determines if the given filename has a suffix that identifies it as a test.
-
- Args:
- filename: The input filename.
-
- Returns:
- True if 'filename' looks like a test, False otherwise.
- """
- if (filename.endswith('_test.cpp')
- or filename.endswith('_unittest.cpp')
- or filename.endswith('_regtest.cpp')):
- return True
- return False
-
-
def _classify_include(filename, include, is_system, include_state):
"""Figures out what kind of header 'include' is.
@@ -2110,7 +2094,6 @@ def _classify_include(filename, include, is_system, include_state):
return _OTHER_HEADER
-
def check_include_line(filename, file_extension, clean_lines, line_number, include_state, error):
"""Check rules that are applicable to #include lines.
@@ -2126,14 +2109,12 @@ def check_include_line(filename, file_extension, clean_lines, line_number, inclu
include_state: An _IncludeState instance in which the headers are inserted.
error: The function to call with any errors found.
"""
-
- if (filename.find('WebKitTools/WebKitAPITest/') >= 0
- or filename.find('WebKit/qt/QGVLauncher/') >= 0):
- # Files in this directory are consumers of the WebKit API and
- # therefore do not follow the same header including discipline as
- # WebCore.
- return
-
+ # FIXME: For readability or as a possible optimization, consider
+ # exiting early here by checking whether the "build/include"
+ # category should be checked for the given filename. This
+ # may involve having the error handler classes expose a
+ # should_check() method, in addition to the usual __call__
+ # method.
line = clean_lines.lines[line_number]
matched = _RE_PATTERN_INCLUDE.search(line)
@@ -2145,10 +2126,8 @@ def check_include_line(filename, file_extension, clean_lines, line_number, inclu
# Look for any of the stream classes that are part of standard C++.
if match(r'(f|ind|io|i|o|parse|pf|stdio|str|)?stream$', include):
- # Many unit tests use cout, so we exempt them.
- if not _is_test_filename(filename):
- error(line_number, 'readability/streams', 3,
- 'Streams are highly discouraged.')
+ error(line_number, 'readability/streams', 3,
+ 'Streams are highly discouraged.')
# Look for specific includes to fix.
if include.startswith('wtf/') and not is_system:
@@ -2291,7 +2270,7 @@ def check_language(filename, clean_lines, line_number, file_extension, include_s
(matched.group(1), matched.group(2)))
# Check that we're not using RTTI outside of testing code.
- if search(r'\bdynamic_cast<', line) and not _is_test_filename(filename):
+ if search(r'\bdynamic_cast<', line):
error(line_number, 'runtime/rtti', 5,
'Do not use dynamic_cast<>. If you need to cast within a class '
"hierarchy, use static_cast<> to upcast. Google doesn't support "
@@ -2502,7 +2481,6 @@ def check_identifier_name_in_declaration(filename, line_number, line, error):
if modified_identifier.find('_') >= 0:
# Various exceptions to the rule: JavaScript op codes functions, const_iterator.
if (not (filename.find('JavaScriptCore') >= 0 and modified_identifier.find('_op_') >= 0)
- and not filename.find('WebKit/gtk/webkit/') >= 0
and not modified_identifier.startswith('tst_')
and not modified_identifier.startswith('webkit_dom_object_')
and not modified_identifier.startswith('qt_')
diff --git a/WebKitTools/Scripts/webkitpy/style/processors/cpp_unittest.py b/WebKitTools/Scripts/webkitpy/style/processors/cpp_unittest.py
index e556cd3..fb5a487 100644
--- a/WebKitTools/Scripts/webkitpy/style/processors/cpp_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/style/processors/cpp_unittest.py
@@ -381,10 +381,6 @@ class CppStyleTest(CppStyleTestBase):
# dynamic_cast is disallowed in most files.
self.assert_language_rules_check('foo.cpp', statement, error_message)
self.assert_language_rules_check('foo.h', statement, error_message)
- # It is explicitly allowed in tests, however.
- self.assert_language_rules_check('foo_test.cpp', statement, '')
- self.assert_language_rules_check('foo_unittest.cpp', statement, '')
- self.assert_language_rules_check('foo_regtest.cpp', statement, '')
# We cannot test this functionality because of difference of
# function definitions. Anyway, we may never enable this.
@@ -2056,16 +2052,6 @@ class OrderOfIncludesTest(CppStyleTestBase):
'#include <assert.h>\n',
'')
- def test_webkit_api_test_excluded(self):
- self.assert_language_rules_check('WebKitTools/WebKitAPITest/Test.h',
- '#include "foo.h"\n',
- '')
-
- def test_webkit_api_test_excluded(self):
- self.assert_language_rules_check('WebKit/qt/QGVLauncher/main.cpp',
- '#include "foo.h"\n',
- '')
-
def test_check_line_break_after_own_header(self):
self.assert_language_rules_check('foo.cpp',
'#include "config.h"\n'
@@ -3603,9 +3589,6 @@ class WebKitStyleTest(CppStyleTestBase):
self.assert_lint('void webkit_dom_object_init();', '')
self.assert_lint('void webkit_dom_object_class_init();', '')
- # The GTK+ APIs use GTK+ naming style, which includes lower-cased, _-separated values.
- self.assert_lint('void this_is_a_gtk_style_name(int var1, int var2)', '', 'WebKit/gtk/webkit/foo.cpp')
-
# There is an exception for some unit tests that begin with "tst_".
self.assert_lint('void tst_QWebFrame::arrayObjectEnumerable(int var1, int var2)', '')
diff --git a/WebKitTools/Scripts/webkitpy/user.py b/WebKitTools/Scripts/webkitpy/user.py
index 8dbf74c..b2ec19e 100644
--- a/WebKitTools/Scripts/webkitpy/user.py
+++ b/WebKitTools/Scripts/webkitpy/user.py
@@ -32,8 +32,13 @@ import subprocess
import webbrowser
class User(object):
- def prompt(self, message):
- return raw_input(message)
+ @staticmethod
+ def prompt(message, repeat=1, raw_input=raw_input):
+ response = None
+ while (repeat and not response):
+ repeat -= 1
+ response = raw_input(message)
+ return response
def edit(self, files):
editor = os.environ.get("EDITOR") or "vi"
diff --git a/WebKitTools/Scripts/webkitpy/user_unittest.py b/WebKitTools/Scripts/webkitpy/user_unittest.py
new file mode 100644
index 0000000..34d9983
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/user_unittest.py
@@ -0,0 +1,53 @@
+# Copyright (C) 2010 Research in Motion Ltd. 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 Research in Motion Ltd. 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.
+
+import unittest
+from webkitpy.user import User
+
+class UserTest(unittest.TestCase):
+
+ example_user_response = "example user response"
+
+ def test_prompt_repeat(self):
+ self.repeatsRemaining = 2
+ def mock_raw_input(message):
+ self.repeatsRemaining -= 1
+ if not self.repeatsRemaining:
+ return UserTest.example_user_response
+ return None
+ self.assertEqual(User.prompt("input", repeat=self.repeatsRemaining, raw_input=mock_raw_input), UserTest.example_user_response)
+
+ def test_prompt_when_exceeded_repeats(self):
+ self.repeatsRemaining = 2
+ def mock_raw_input(message):
+ self.repeatsRemaining -= 1
+ return None
+ self.assertEqual(User.prompt("input", repeat=self.repeatsRemaining, raw_input=mock_raw_input), None)
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/WebKitTools/pywebsocket/mod_pywebsocket/standalone.py b/WebKitTools/pywebsocket/mod_pywebsocket/standalone.py
index 0e6a349..8628ff9 100644
--- a/WebKitTools/pywebsocket/mod_pywebsocket/standalone.py
+++ b/WebKitTools/pywebsocket/mod_pywebsocket/standalone.py
@@ -58,6 +58,7 @@ used for each request.
"""
import BaseHTTPServer
+import CGIHTTPServer
import SimpleHTTPServer
import SocketServer
import logging
@@ -202,8 +203,8 @@ class WebSocketServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer):
# trailing comma.
-class WebSocketRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
- """SimpleHTTPRequestHandler specialized for Web Socket."""
+class WebSocketRequestHandler(CGIHTTPServer.CGIHTTPRequestHandler):
+ """CGIHTTPRequestHandler specialized for Web Socket."""
def setup(self):
"""Override SocketServer.StreamRequestHandler.setup."""
@@ -222,7 +223,7 @@ class WebSocketRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
self._handshaker = handshake.Handshaker(
self._request, self._dispatcher,
WebSocketRequestHandler.options.strict)
- SimpleHTTPServer.SimpleHTTPRequestHandler.__init__(
+ CGIHTTPServer.CGIHTTPRequestHandler.__init__(
self, *args, **keywords)
def _print_warnings_if_any(self):
@@ -236,7 +237,7 @@ class WebSocketRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
Return True to continue processing for HTTP(S), False otherwise.
"""
- result = SimpleHTTPServer.SimpleHTTPRequestHandler.parse_request(self)
+ result = CGIHTTPServer.CGIHTTPRequestHandler.parse_request(self)
if result:
try:
self._handshaker.do_handshake()
@@ -268,6 +269,16 @@ class WebSocketRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
# For example, HTTP status code is logged by this method.
logging.warn('%s - %s' % (self.address_string(), (args[0] % args[1:])))
+ def is_cgi(self):
+ """Test whether self.path corresponds to a CGI script.
+
+ Add extra check that self.path doesn't contains .."""
+ if CGIHTTPServer.CGIHTTPRequestHandler.is_cgi(self):
+ if '..' in self.path:
+ return False
+ return True
+ return False
+
def _configure_logging(options):
logger = logging.getLogger()
@@ -329,6 +340,12 @@ def _main():
parser.add_option('-d', '--document_root', dest='document_root',
default='.',
help='Document root directory.')
+ parser.add_option('-x', '--cgi_paths', dest='cgi_paths',
+ default=None,
+ help=('CGI paths relative to document_root.'
+ 'Comma-separated. (e.g -x /cgi,/htbin) '
+ 'Files under document_root/cgi_path are handled '
+ 'as CGI programs. Must be executable.'))
parser.add_option('-t', '--tls', dest='use_tls', action='store_true',
default=False, help='use TLS (wss://)')
parser.add_option('-k', '--private_key', dest='private_key',
@@ -359,6 +376,11 @@ def _main():
_configure_logging(options)
SocketServer.TCPServer.request_queue_size = options.request_queue_size
+ CGIHTTPServer.CGIHTTPRequestHandler.cgi_directories = []
+
+ if options.cgi_paths:
+ CGIHTTPServer.CGIHTTPRequestHandler.cgi_directories = \
+ options.cgi_paths.split(',')
if options.use_tls:
if not _HAS_OPEN_SSL:
diff --git a/WebKitTools/pywebsocket/setup.py b/WebKitTools/pywebsocket/setup.py
index a49c943..9729322 100644
--- a/WebKitTools/pywebsocket/setup.py
+++ b/WebKitTools/pywebsocket/setup.py
@@ -56,7 +56,7 @@ setup(author='Yuzo Fujishima',
name=_PACKAGE_NAME,
packages=[_PACKAGE_NAME],
url='http://code.google.com/p/pywebsocket/',
- version='0.4.7.1',
+ version='0.4.8',
)
diff --git a/WebKitTools/wx/build/settings.py b/WebKitTools/wx/build/settings.py
index 60a4db6..d3b7b2c 100644
--- a/WebKitTools/wx/build/settings.py
+++ b/WebKitTools/wx/build/settings.py
@@ -276,7 +276,9 @@ def common_configure(conf):
if sys.platform.startswith('darwin'):
conf.env['LIB_ICU'] = ['icucore']
# Apple does not ship the ICU headers with Mac OS X, so WebKit includes a copy of 3.2 headers
- conf.env['CPPPATH_ICU'] = [os.path.join(jscore_dir, 'icu'), os.path.join(webcore_dir, 'icu')]
+ conf.env.append_value('CPPPATH_JSCORE', os.path.join(jscore_dir, 'icu'))
+
+ conf.env.append_value('CPPPATH_WEBCORE', os.path.join(webcore_dir, 'icu'))
conf.env.append_value('CPPPATH', wklibs_dir)
conf.env.append_value('LIBPATH', wklibs_dir)
@@ -335,7 +337,7 @@ def common_configure(conf):
conf.env.append_value('LIB', [
'kernel32', 'user32','gdi32','comdlg32','winspool','winmm',
'shell32', 'shlwapi', 'comctl32', 'ole32', 'oleaut32', 'uuid', 'advapi32',
- 'wsock32', 'gdiplus', 'version'])
+ 'wsock32', 'gdiplus', 'usp10','version'])
conf.env['LIB_ICU'] = ['icudt', 'icule', 'iculx', 'icuuc', 'icuin', 'icuio', 'icutu']