From 545e470e52f0ac6a3a072bf559c796b42c6066b6 Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Tue, 15 Jun 2010 19:36:43 +0100 Subject: Merge webkit.org at r61121: Initial merge by git. Change-Id: Icd6db395c62285be384d137164d95d7466c98760 --- JavaScriptCore/API/JSCallbackConstructor.cpp | 14 +- JavaScriptCore/API/JSCallbackFunction.cpp | 7 +- JavaScriptCore/API/JSCallbackFunction.h | 2 +- JavaScriptCore/API/JSCallbackObject.h | 4 +- JavaScriptCore/API/JSCallbackObjectFunctions.h | 48 +- JavaScriptCore/API/JSObjectRef.cpp | 7 +- JavaScriptCore/CMakeLists.txt | 5 +- JavaScriptCore/ChangeLog | 1118 +++ .../Configurations/FeatureDefines.xcconfig | 4 +- .../Configurations/JavaScriptCore.xcconfig | 18 +- JavaScriptCore/DerivedSources.make | 12 + JavaScriptCore/JavaScriptCore.JSVALUE32_64only.exp | 2 + JavaScriptCore/JavaScriptCore.JSVALUE32only.exp | 2 + JavaScriptCore/JavaScriptCore.JSVALUE64only.exp | 2 + JavaScriptCore/JavaScriptCore.exp | 20 +- .../JavaScriptCore/JavaScriptCore.def | 23 +- .../JavaScriptCore.xcodeproj/project.pbxproj | 23 +- JavaScriptCore/assembler/MacroAssemblerARMv7.h | 8 +- JavaScriptCore/bytecompiler/BytecodeGenerator.cpp | 113 +- JavaScriptCore/bytecompiler/BytecodeGenerator.h | 32 +- JavaScriptCore/bytecompiler/NodesCodegen.cpp | 164 +- JavaScriptCore/interpreter/CallFrame.h | 1 - JavaScriptCore/interpreter/Interpreter.cpp | 140 +- JavaScriptCore/interpreter/Interpreter.h | 2 +- JavaScriptCore/jit/JITArithmetic32_64.cpp | 4 +- JavaScriptCore/jit/JITOpcodes.cpp | 1 + JavaScriptCore/jit/JITOpcodes32_64.cpp | 4 +- JavaScriptCore/jit/JITStubs.cpp | 38 +- JavaScriptCore/jit/JITStubs.h | 1 + JavaScriptCore/jsc.cpp | 77 +- JavaScriptCore/jsc/CMakeListsEfl.txt | 5 + JavaScriptCore/parser/Nodes.h | 6 +- JavaScriptCore/pcre/pcre_exec.cpp | 2 +- JavaScriptCore/qt/api/qscriptengine.cpp | 13 + JavaScriptCore/qt/api/qscriptengine.h | 1 + JavaScriptCore/qt/api/qscriptengine_p.cpp | 9 +- JavaScriptCore/qt/api/qscriptengine_p.h | 6 +- JavaScriptCore/qt/api/qscriptprogram_p.h | 8 +- JavaScriptCore/qt/api/qscriptsyntaxcheckresult.cpp | 8 +- JavaScriptCore/qt/api/qscriptvalue.cpp | 18 +- JavaScriptCore/qt/api/qscriptvalue.h | 1 + JavaScriptCore/qt/api/qscriptvalue_p.h | 185 +- .../qt/tests/qscriptengine/tst_qscriptengine.cpp | 14 +- .../qt/tests/qscriptvalue/qscriptvalue.pro | 1 + .../qt/tests/qscriptvalue/tst_qscriptvalue.h | 21 + .../tst_qscriptvalue_generated_comparison.cpp | 1742 +++++ JavaScriptCore/runtime/ArrayConstructor.cpp | 18 +- JavaScriptCore/runtime/ArrayPrototype.cpp | 212 +- JavaScriptCore/runtime/BooleanConstructor.cpp | 9 +- JavaScriptCore/runtime/BooleanPrototype.cpp | 25 +- JavaScriptCore/runtime/CallData.h | 4 +- JavaScriptCore/runtime/ConstructData.cpp | 23 +- JavaScriptCore/runtime/ConstructData.h | 5 +- JavaScriptCore/runtime/DateConstructor.cpp | 29 +- JavaScriptCore/runtime/DatePrototype.cpp | 390 +- JavaScriptCore/runtime/Error.cpp | 206 +- JavaScriptCore/runtime/Error.h | 66 +- JavaScriptCore/runtime/ErrorConstructor.cpp | 20 +- JavaScriptCore/runtime/ErrorConstructor.h | 2 - JavaScriptCore/runtime/ErrorInstance.cpp | 18 + JavaScriptCore/runtime/ErrorInstance.h | 8 +- JavaScriptCore/runtime/ErrorPrototype.cpp | 16 +- JavaScriptCore/runtime/ExceptionHelpers.cpp | 42 +- JavaScriptCore/runtime/ExceptionHelpers.h | 5 +- JavaScriptCore/runtime/Executable.cpp | 18 +- JavaScriptCore/runtime/FunctionConstructor.cpp | 17 +- JavaScriptCore/runtime/FunctionPrototype.cpp | 40 +- JavaScriptCore/runtime/Identifier.cpp | 15 + JavaScriptCore/runtime/Identifier.h | 3 + JavaScriptCore/runtime/JSArray.cpp | 2 +- JavaScriptCore/runtime/JSCell.h | 14 +- JavaScriptCore/runtime/JSFunction.cpp | 5 +- JavaScriptCore/runtime/JSFunction.h | 2 +- JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp | 70 +- JavaScriptCore/runtime/JSGlobalObjectFunctions.h | 26 +- JavaScriptCore/runtime/JSONObject.cpp | 60 +- JavaScriptCore/runtime/JSObject.cpp | 39 +- JavaScriptCore/runtime/JSObject.h | 3 + JavaScriptCore/runtime/JSValue.cpp | 7 +- JavaScriptCore/runtime/JSValue.h | 6 +- JavaScriptCore/runtime/MathObject.cpp | 112 +- JavaScriptCore/runtime/NativeErrorConstructor.cpp | 22 +- JavaScriptCore/runtime/NativeErrorConstructor.h | 2 +- JavaScriptCore/runtime/NumberConstructor.cpp | 10 +- JavaScriptCore/runtime/NumberPrototype.cpp | 84 +- JavaScriptCore/runtime/ObjectConstructor.cpp | 96 +- JavaScriptCore/runtime/ObjectPrototype.cpp | 70 +- JavaScriptCore/runtime/ObjectPrototype.h | 2 +- JavaScriptCore/runtime/RegExpConstructor.cpp | 14 +- JavaScriptCore/runtime/RegExpObject.cpp | 7 +- JavaScriptCore/runtime/RegExpPrototype.cpp | 40 +- JavaScriptCore/runtime/StringConstructor.cpp | 20 +- JavaScriptCore/runtime/StringPrototype.cpp | 268 +- JavaScriptCore/wtf/CMakeLists.txt | 4 + JavaScriptCore/wtf/Deque.h | 9 + JavaScriptCore/wtf/MainThread.cpp | 3 +- JavaScriptCore/wtf/MathExtras.h | 2 +- JavaScriptCore/wtf/MessageQueue.h | 4 +- JavaScriptCore/wtf/OwnPtrCommon.h | 4 + JavaScriptCore/wtf/Platform.h | 17 +- JavaScriptCore/wtf/RandomNumber.cpp | 14 - JavaScriptCore/wtf/RandomNumber.h | 6 - JavaScriptCore/wtf/ThreadingPthreads.cpp | 16 +- JavaScriptCore/wtf/Vector.h | 10 +- JavaScriptCore/wtf/brew/OwnPtrBrew.cpp | 14 + JavaScriptCore/wtf/gtk/ThreadingGtk.cpp | 11 +- JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h | 1 + JavaScriptCore/wtf/unicode/wince/UnicodeWince.h | 1 + JavaScriptGlue/ChangeLog | 10 + JavaScriptGlue/JSObject.cpp | 6 +- .../dom/Geolocation/argument-types-expected.txt | 2 - .../Geolocation/callback-exception-expected.txt | 2 +- .../callback-to-deleted-context-expected.txt | 11 + .../Geolocation/callback-to-deleted-context.html | 13 + .../callback-to-remote-context-expected.txt | 10 + .../Geolocation/callback-to-remote-context.html | 13 + .../callback-to-remote-context2-expected.txt | 10 + .../Geolocation/callback-to-remote-context2.html | 13 + .../dom/Geolocation/multiple-requests-expected.txt | 17 + .../fast/dom/Geolocation/multiple-requests.html | 13 + .../reentrant-permission-denied-expected.txt | 13 + .../Geolocation/reentrant-permission-denied.html | 13 + .../callback-to-deleted-context-inner1.html | 28 + .../callback-to-deleted-context-inner2.html | 7 + .../callback-to-remote-context-inner.html | 16 + .../dom/Geolocation/script-tests/argument-types.js | 4 +- .../Geolocation/script-tests/callback-exception.js | 15 +- .../script-tests/callback-to-deleted-context.js | 20 + .../script-tests/callback-to-remote-context.js | 19 + .../script-tests/callback-to-remote-context2.js | 21 + .../fast/dom/Geolocation/script-tests/error.js | 11 +- .../dom/Geolocation/script-tests/maximum-age.js | 17 +- .../Geolocation/script-tests/multiple-requests.js | 47 + .../script-tests/notimer-after-unload.js | 2 - .../permission-denied-already-clear-watch.js | 13 +- .../permission-denied-already-error.js | 15 +- .../permission-denied-already-success.js | 12 +- .../permission-denied-stops-watches.js | 13 +- .../Geolocation/script-tests/permission-denied.js | 10 +- .../Geolocation/script-tests/position-string.js | 14 +- .../Geolocation/script-tests/reentrant-error.js | 13 +- .../script-tests/reentrant-permission-denied.js | 41 + .../Geolocation/script-tests/reentrant-success.js | 19 +- .../fast/dom/Geolocation/script-tests/success.js | 14 +- .../script-tests/timeout-clear-watch.js | 6 +- .../dom/Geolocation/script-tests/timeout-zero.js | 6 +- .../fast/dom/Geolocation/script-tests/timeout.js | 12 +- .../fast/dom/Geolocation/script-tests/watch.js | 19 +- .../indexeddb/idb-database-request-expected.txt | 2 +- .../storage/indexeddb/idb-keyrange-expected.txt | 119 + LayoutTests/storage/indexeddb/idb-keyrange.html | 13 + .../indexeddb/idb-objectstore-request-expected.txt | 49 + .../storage/indexeddb/idb-objectstore-request.html | 13 + .../storage/indexeddb/script-tests/idb-keyrange.js | 75 + .../script-tests/idb-objectstore-request.js | 42 + WebCore/Android.derived.jscbindings.mk | 1 + WebCore/Android.derived.v8bindings.mk | 4 + WebCore/Android.jscbindings.mk | 1 - WebCore/Android.mk | 22 +- WebCore/CMakeLists.txt | 38 +- WebCore/CMakeListsEfl.txt | 8 +- WebCore/ChangeLog | 8231 ++++++++++++++++++++ WebCore/Configurations/FeatureDefines.xcconfig | 4 +- WebCore/DerivedSources.cpp | 2 + WebCore/DerivedSources.make | 27 +- WebCore/English.lproj/localizedStrings.js | Bin 40428 -> 40700 bytes WebCore/GNUmakefile.am | 91 +- WebCore/WebCore.base.exp | 1 + WebCore/WebCore.gyp/WebCore.gyp | 22 +- WebCore/WebCore.gyp/scripts/rule_gperf.py | 85 - WebCore/WebCore.gypi | 65 +- WebCore/WebCore.pri | 67 +- WebCore/WebCore.pro | 102 +- WebCore/WebCore.vcproj/WebCore.vcproj | 3170 +++++++- WebCore/WebCore.xcodeproj/project.pbxproj | 377 +- WebCore/WebCorePrefix.h | 8 + .../accessibility/AccessibilityRenderObject.cpp | 21 +- .../mac/AccessibilityObjectWrapper.mm | 11 +- WebCore/bindings/cpp/WebDOMCString.cpp | 113 + WebCore/bindings/cpp/WebDOMCString.h | 89 + WebCore/bindings/cpp/WebDOMEventListenerCustom.cpp | 39 + WebCore/bindings/cpp/WebDOMEventTarget.cpp | 155 + WebCore/bindings/cpp/WebDOMEventTarget.h | 49 + WebCore/bindings/cpp/WebDOMHTMLDocumentCustom.cpp | 50 + WebCore/bindings/cpp/WebDOMNodeCustom.cpp | 96 + WebCore/bindings/cpp/WebDOMObject.h | 32 + WebCore/bindings/cpp/WebDOMString.cpp | 124 + WebCore/bindings/cpp/WebDOMString.h | 99 + WebCore/bindings/cpp/WebExceptionHandler.cpp | 41 + WebCore/bindings/cpp/WebExceptionHandler.h | 40 + WebCore/bindings/cpp/WebNativeEventListener.cpp | 53 + WebCore/bindings/cpp/WebNativeEventListener.h | 54 + WebCore/bindings/generic/BindingSecurity.h | 1 + WebCore/bindings/generic/RuntimeEnabledFeatures.h | 2 +- WebCore/bindings/js/JSArrayBufferConstructor.cpp | 12 +- WebCore/bindings/js/JSArrayBufferConstructor.h | 2 +- WebCore/bindings/js/JSArrayBufferViewCustom.cpp | 4 +- WebCore/bindings/js/JSArrayBufferViewHelper.h | 4 +- WebCore/bindings/js/JSAudioConstructor.cpp | 18 +- WebCore/bindings/js/JSBindingsAllInOne.cpp | 2 +- WebCore/bindings/js/JSCallbackData.cpp | 9 +- .../js/JSCanvasRenderingContext2DCustom.cpp | 24 +- WebCore/bindings/js/JSClipboardCustom.cpp | 10 +- WebCore/bindings/js/JSConsoleCustom.cpp | 7 + WebCore/bindings/js/JSCustomPositionCallback.cpp | 7 +- .../bindings/js/JSCustomPositionErrorCallback.cpp | 7 +- WebCore/bindings/js/JSCustomXPathNSResolver.cpp | 2 +- WebCore/bindings/js/JSDOMBinding.cpp | 6 +- WebCore/bindings/js/JSDOMWindowCustom.cpp | 10 +- WebCore/bindings/js/JSDOMWrapper.cpp | 2 +- .../bindings/js/JSDesktopNotificationsCustom.cpp | 4 +- WebCore/bindings/js/JSEventListener.cpp | 2 +- WebCore/bindings/js/JSEventSourceConstructor.cpp | 18 +- WebCore/bindings/js/JSFloat32ArrayConstructor.cpp | 86 + WebCore/bindings/js/JSFloat32ArrayConstructor.h | 57 + WebCore/bindings/js/JSFloat32ArrayCustom.cpp | 56 + WebCore/bindings/js/JSFloatArrayConstructor.cpp | 71 - WebCore/bindings/js/JSFloatArrayConstructor.h | 46 - WebCore/bindings/js/JSFloatArrayCustom.cpp | 56 - WebCore/bindings/js/JSGeolocationCustom.cpp | 13 +- WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp | 13 +- WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp | 18 +- WebCore/bindings/js/JSHTMLCollectionCustom.cpp | 12 +- WebCore/bindings/js/JSHTMLDocumentCustom.cpp | 7 +- WebCore/bindings/js/JSHTMLInputElementCustom.cpp | 10 +- WebCore/bindings/js/JSImageConstructor.cpp | 18 +- WebCore/bindings/js/JSInjectedScriptHostCustom.cpp | 2 +- WebCore/bindings/js/JSInt16ArrayConstructor.cpp | 27 +- WebCore/bindings/js/JSInt16ArrayConstructor.h | 11 + WebCore/bindings/js/JSInt32ArrayConstructor.cpp | 27 +- WebCore/bindings/js/JSInt32ArrayConstructor.h | 11 + WebCore/bindings/js/JSInt8ArrayConstructor.cpp | 27 +- WebCore/bindings/js/JSInt8ArrayConstructor.h | 11 + .../bindings/js/JSJavaScriptCallFrameCustom.cpp | 3 +- .../bindings/js/JSMessageChannelConstructor.cpp | 8 +- WebCore/bindings/js/JSMessageChannelConstructor.h | 2 +- WebCore/bindings/js/JSMessagePortCustom.cpp | 2 +- WebCore/bindings/js/JSNodeFilterCondition.cpp | 2 +- WebCore/bindings/js/JSNodeListCustom.cpp | 6 +- WebCore/bindings/js/JSOptionConstructor.cpp | 22 +- WebCore/bindings/js/JSPluginElementFunctions.cpp | 4 +- WebCore/bindings/js/JSSVGMatrixCustom.cpp | 4 +- WebCore/bindings/js/JSSharedWorkerConstructor.cpp | 18 +- WebCore/bindings/js/JSUint16ArrayConstructor.cpp | 27 +- WebCore/bindings/js/JSUint16ArrayConstructor.h | 11 + WebCore/bindings/js/JSUint32ArrayConstructor.cpp | 27 +- WebCore/bindings/js/JSUint32ArrayConstructor.h | 11 + WebCore/bindings/js/JSUint8ArrayConstructor.cpp | 27 +- WebCore/bindings/js/JSUint8ArrayConstructor.h | 11 + .../bindings/js/JSWebGLRenderingContextCustom.cpp | 272 +- .../bindings/js/JSWebKitCSSMatrixConstructor.cpp | 10 +- WebCore/bindings/js/JSWebKitPointConstructor.cpp | 12 +- WebCore/bindings/js/JSWebSocketConstructor.cpp | 22 +- WebCore/bindings/js/JSWebSocketCustom.cpp | 4 +- WebCore/bindings/js/JSWorkerConstructor.cpp | 16 +- WebCore/bindings/js/JSWorkerContextCustom.cpp | 2 +- .../bindings/js/JSXMLHttpRequestConstructor.cpp | 59 - WebCore/bindings/js/JSXMLHttpRequestConstructor.h | 38 - WebCore/bindings/js/JSXMLHttpRequestCustom.cpp | 13 +- WebCore/bindings/js/JSXSLTProcessorConstructor.cpp | 6 +- WebCore/bindings/js/ScheduledAction.cpp | 4 +- WebCore/bindings/js/ScriptController.cpp | 17 + WebCore/bindings/js/ScriptController.h | 8 +- WebCore/bindings/js/ScriptDebugServer.cpp | 40 +- WebCore/bindings/js/ScriptDebugServer.h | 11 +- WebCore/bindings/js/ScriptFunctionCall.cpp | 2 +- WebCore/bindings/js/SerializedScriptValue.cpp | 11 +- WebCore/bindings/js/WorkerScriptController.cpp | 3 +- WebCore/bindings/objc/WebScriptObject.mm | 2 +- WebCore/bindings/scripts/CodeGenerator.pm | 4 +- WebCore/bindings/scripts/CodeGeneratorCPP.pm | 975 +++ WebCore/bindings/scripts/CodeGeneratorGObject.pm | 27 +- WebCore/bindings/scripts/CodeGeneratorJS.pm | 208 +- WebCore/bindings/scripts/CodeGeneratorObjC.pm | 9 +- WebCore/bindings/scripts/CodeGeneratorV8.pm | 70 +- WebCore/bindings/scripts/IDLParser.pm | 16 +- WebCore/bindings/scripts/IDLStructure.pm | 40 +- .../scripts/test/CPP/WebDOMTestCallback.cpp | 113 + .../bindings/scripts/test/CPP/WebDOMTestCallback.h | 65 + .../scripts/test/CPP/WebDOMTestInterface.cpp | 75 + .../scripts/test/CPP/WebDOMTestInterface.h | 52 + .../bindings/scripts/test/CPP/WebDOMTestObj.cpp | 441 ++ WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h | 105 + .../scripts/test/GObject/WebKitDOMTestCallback.cpp | 17 +- .../scripts/test/GObject/WebKitDOMTestCallback.h | 6 +- .../test/GObject/WebKitDOMTestInterface.cpp | 8 +- .../scripts/test/GObject/WebKitDOMTestObj.cpp | 325 +- .../scripts/test/GObject/WebKitDOMTestObj.h | 99 +- .../bindings/scripts/test/JS/JSTestInterface.cpp | 8 +- WebCore/bindings/scripts/test/JS/JSTestObj.cpp | 303 +- WebCore/bindings/scripts/test/JS/JSTestObj.h | 61 +- WebCore/bindings/scripts/test/ObjC/DOMTestObj.h | 5 + WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm | 30 + WebCore/bindings/scripts/test/TestObj.idl | 6 + .../bindings/scripts/test/V8/V8TestCallback.cpp | 25 +- WebCore/bindings/scripts/test/V8/V8TestObj.cpp | 48 + WebCore/bindings/v8/NPV8Object.cpp | 1 - WebCore/bindings/v8/ScriptArray.cpp | 2 - WebCore/bindings/v8/ScriptCallStack.cpp | 1 - WebCore/bindings/v8/ScriptController.cpp | 2 + WebCore/bindings/v8/ScriptDebugServer.cpp | 42 +- WebCore/bindings/v8/ScriptDebugServer.h | 4 + WebCore/bindings/v8/ScriptEventListener.cpp | 14 +- WebCore/bindings/v8/ScriptProfiler.cpp | 4 +- WebCore/bindings/v8/SerializedScriptValue.cpp | 48 +- WebCore/bindings/v8/SerializedScriptValue.h | 63 +- WebCore/bindings/v8/V8Binding.cpp | 2 - WebCore/bindings/v8/V8DOMWindowShell.cpp | 44 + WebCore/bindings/v8/V8DOMWindowShell.h | 5 + WebCore/bindings/v8/V8DOMWrapper.cpp | 3 +- WebCore/bindings/v8/V8GCController.cpp | 1 - WebCore/bindings/v8/V8IsolatedContext.cpp | 1 - WebCore/bindings/v8/V8NPObject.cpp | 8 +- WebCore/bindings/v8/V8Proxy.cpp | 1 - .../bindings/v8/custom/V8ArrayBufferViewCustom.cpp | 4 +- WebCore/bindings/v8/custom/V8ConsoleCustom.cpp | 20 +- .../v8/custom/V8CustomPositionCallback.cpp | 27 +- .../bindings/v8/custom/V8CustomPositionCallback.h | 9 +- .../v8/custom/V8CustomPositionErrorCallback.cpp | 27 +- .../v8/custom/V8CustomPositionErrorCallback.h | 9 +- .../custom/V8CustomSQLStatementErrorCallback.cpp | 12 +- .../bindings/v8/custom/V8CustomVoidCallback.cpp | 3 +- WebCore/bindings/v8/custom/V8CustomVoidCallback.h | 2 + WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp | 4 +- .../bindings/v8/custom/V8Float32ArrayCustom.cpp | 71 + WebCore/bindings/v8/custom/V8FloatArrayCustom.cpp | 71 - WebCore/bindings/v8/custom/V8GeolocationCustom.cpp | 8 +- .../v8/custom/V8HTMLCanvasElementCustom.cpp | 2 +- .../bindings/v8/custom/V8HTMLDocumentCustom.cpp | 78 +- .../bindings/v8/custom/V8NamedNodesCollection.cpp | 2 +- WebCore/bindings/v8/custom/V8NodeListCustom.cpp | 2 +- .../bindings/v8/custom/V8PopStateEventCustom.cpp | 2 - WebCore/bindings/v8/custom/V8StorageCustom.cpp | 13 + .../v8/custom/V8WebGLRenderingContextCustom.cpp | 34 +- WebCore/bridge/NP_jsobject.cpp | 6 +- WebCore/bridge/c/c_instance.cpp | 10 +- WebCore/bridge/jni/jni_jsobject.mm | 2 +- WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp | 4 +- WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp | 4 +- WebCore/bridge/objc/objc_instance.mm | 4 +- WebCore/bridge/objc/objc_runtime.mm | 22 +- WebCore/bridge/objc/objc_utility.h | 2 +- WebCore/bridge/objc/objc_utility.mm | 4 +- WebCore/bridge/qt/qt_instance.cpp | 4 +- WebCore/bridge/qt/qt_pixmapruntime.cpp | 11 +- WebCore/bridge/qt/qt_pixmapruntime.h | 3 +- WebCore/bridge/qt/qt_runtime.cpp | 52 +- WebCore/bridge/qt/qt_runtime.h | 4 +- WebCore/bridge/runtime_array.cpp | 4 +- WebCore/bridge/runtime_method.cpp | 10 +- WebCore/bridge/runtime_object.cpp | 14 +- WebCore/config.h | 4 + WebCore/css/CSSComputedStyleDeclaration.cpp | 3 +- WebCore/css/CSSCursorImageValue.cpp | 9 +- WebCore/css/CSSCursorImageValue.h | 10 +- WebCore/css/CSSOMUtils.cpp | 121 + WebCore/css/CSSOMUtils.h | 53 + WebCore/css/CSSParser.cpp | 19 +- WebCore/css/CSSParser.h | 2 +- WebCore/css/CSSPrimitiveValueMappings.h | 41 + WebCore/css/CSSSelector.cpp | 13 +- WebCore/css/CSSStyleSelector.cpp | 36 +- WebCore/css/CSSStyleSheet.cpp | 5 +- WebCore/css/CSSValueKeywords.in | 6 +- WebCore/css/MediaQuery.cpp | 122 +- WebCore/css/MediaQuery.h | 11 +- WebCore/css/MediaQueryEvaluator.cpp | 3 + WebCore/css/MediaQueryExp.cpp | 20 + WebCore/css/MediaQueryExp.h | 5 + WebCore/css/SVGCSSComputedStyleDeclaration.cpp | 2 + WebCore/css/SVGCSSParser.cpp | 11 +- WebCore/css/SVGCSSPropertyNames.in | 1 + WebCore/css/SVGCSSStyleSelector.cpp | 8 + WebCore/css/SVGCSSValueKeywords.in | 5 + WebCore/css/StyleSheet.idl | 6 + WebCore/css/makeprop.pl | 18 +- WebCore/css/makevalues.pl | 22 +- WebCore/dom/Attr.cpp | 6 +- WebCore/dom/CanvasSurface.cpp | 2 +- WebCore/dom/CanvasSurface.h | 5 +- WebCore/dom/ContainerNode.cpp | 1 + WebCore/dom/CustomEvent.idl | 2 + WebCore/dom/Document.cpp | 74 +- WebCore/dom/Document.h | 15 +- WebCore/dom/Document.idl | 8 + WebCore/dom/DocumentParser.h | 87 + WebCore/dom/DynamicNodeList.cpp | 5 +- WebCore/dom/Element.cpp | 55 +- WebCore/dom/Element.h | 52 +- WebCore/dom/ElementRareData.h | 6 +- WebCore/dom/Event.idl | 7 + WebCore/dom/EventListener.h | 19 +- WebCore/dom/EventTarget.h | 2 + WebCore/dom/NamedNodeMap.cpp | 4 +- WebCore/dom/NamedNodeMap.h | 16 +- WebCore/dom/Node.cpp | 2 +- WebCore/dom/Node.idl | 14 + WebCore/dom/PopStateEvent.idl | 2 + WebCore/dom/ProcessingInstruction.cpp | 2 +- WebCore/dom/StaticNodeList.cpp | 5 +- WebCore/dom/StyledElement.cpp | 12 +- WebCore/dom/Tokenizer.h | 89 - WebCore/dom/ViewportArguments.cpp | 6 +- WebCore/dom/XMLDocumentParser.cpp | 356 + WebCore/dom/XMLDocumentParser.h | 326 + WebCore/dom/XMLDocumentParserLibxml2.cpp | 1456 ++++ WebCore/dom/XMLDocumentParserQt.cpp | 717 ++ WebCore/dom/XMLDocumentParserScope.cpp | 68 + WebCore/dom/XMLDocumentParserScope.h | 62 + WebCore/dom/XMLTokenizer.cpp | 356 - WebCore/dom/XMLTokenizer.h | 326 - WebCore/dom/XMLTokenizerLibxml2.cpp | 1457 ---- WebCore/dom/XMLTokenizerQt.cpp | 717 -- WebCore/dom/XMLTokenizerScope.cpp | 68 - WebCore/dom/XMLTokenizerScope.h | 62 - WebCore/dom/make_names.pl | 2 +- WebCore/editing/DeleteButtonController.cpp | 6 +- WebCore/editing/EditingAllInOne.cpp | 74 + WebCore/editing/EditingBehavior.h | 58 + WebCore/editing/EditingBehaviorTypes.h | 46 + WebCore/editing/Editor.cpp | 10 + WebCore/editing/Editor.h | 3 + WebCore/editing/EditorCommand.cpp | 5 +- WebCore/editing/InsertListCommand.cpp | 265 +- WebCore/editing/InsertListCommand.h | 2 + WebCore/editing/SelectionController.cpp | 10 +- WebCore/editing/SetNodeAttributeCommand.h | 1 - WebCore/editing/htmlediting.cpp | 30 +- WebCore/editing/markup.cpp | 2 - WebCore/history/BackForwardList.cpp | 20 +- WebCore/history/PageCache.cpp | 270 +- WebCore/history/PageCache.h | 10 +- WebCore/html/AsyncImageResizer.cpp | 77 + WebCore/html/AsyncImageResizer.h | 107 + WebCore/html/Blob.cpp | 91 +- WebCore/html/Blob.h | 60 +- WebCore/html/DocTypeStrings.gperf | 10 + WebCore/html/File.cpp | 11 +- WebCore/html/File.h | 8 +- WebCore/html/FileReader.cpp | 2 + WebCore/html/FileStream.cpp | 41 +- WebCore/html/FormDataList.cpp | 60 +- WebCore/html/FormDataList.h | 24 +- WebCore/html/HTML5DocumentParser.cpp | 310 + WebCore/html/HTML5DocumentParser.h | 192 + WebCore/html/HTML5EntityParser.cpp | 242 + WebCore/html/HTML5EntityParser.h | 38 + WebCore/html/HTML5Lexer.cpp | 2580 +++--- WebCore/html/HTML5Lexer.h | 67 +- WebCore/html/HTML5ScriptRunner.cpp | 50 +- WebCore/html/HTML5ScriptRunner.h | 7 +- WebCore/html/HTML5ScriptRunnerHost.h | 3 + WebCore/html/HTML5Token.h | 59 +- WebCore/html/HTML5Tokenizer.cpp | 182 - WebCore/html/HTML5Tokenizer.h | 87 - WebCore/html/HTML5TreeBuilder.cpp | 60 +- WebCore/html/HTML5TreeBuilder.h | 38 +- WebCore/html/HTMLAppletElement.cpp | 4 +- WebCore/html/HTMLAttributeNames.in | 1 + WebCore/html/HTMLCanvasElement.cpp | 6 +- WebCore/html/HTMLCanvasElement.idl | 5 +- WebCore/html/HTMLCollection.cpp | 6 +- WebCore/html/HTMLDataGridColElement.cpp | 6 +- WebCore/html/HTMLDocument.cpp | 10 +- WebCore/html/HTMLDocument.h | 2 +- WebCore/html/HTMLDocument.idl | 2 +- WebCore/html/HTMLDocumentParser.cpp | 2136 +++++ WebCore/html/HTMLDocumentParser.h | 448 ++ WebCore/html/HTMLElement.cpp | 6 +- WebCore/html/HTMLEntityNames.gperf | 13 +- WebCore/html/HTMLFormCollection.cpp | 15 +- WebCore/html/HTMLFormControlElement.cpp | 15 +- WebCore/html/HTMLFormElement.cpp | 4 +- WebCore/html/HTMLFrameElementBase.cpp | 4 +- WebCore/html/HTMLImageElement.cpp | 2 +- WebCore/html/HTMLImageElement.idl | 4 +- WebCore/html/HTMLInputElement.cpp | 30 +- WebCore/html/HTMLInputElement.h | 4 + WebCore/html/HTMLInputElement.idl | 2 + WebCore/html/HTMLMapElement.cpp | 48 +- WebCore/html/HTMLMapElement.h | 3 + WebCore/html/HTMLMediaElement.cpp | 7 +- WebCore/html/HTMLMeterElement.cpp | 36 +- WebCore/html/HTMLMeterElement.h | 7 + WebCore/html/HTMLMeterElement.idl | 1 + WebCore/html/HTMLNameCollection.cpp | 8 +- WebCore/html/HTMLObjectElement.cpp | 2 +- WebCore/html/HTMLParamElement.cpp | 2 +- WebCore/html/HTMLParser.cpp | 1743 ----- WebCore/html/HTMLParser.h | 214 - WebCore/html/HTMLProgressElement.cpp | 3 +- WebCore/html/HTMLTokenizer.cpp | 2134 ----- WebCore/html/HTMLTokenizer.h | 446 -- WebCore/html/HTMLVideoElement.idl | 5 +- WebCore/html/HTMLViewSourceDocument.cpp | 14 +- WebCore/html/HTMLViewSourceDocument.h | 8 +- WebCore/html/ImageResizerThread.cpp | 97 + WebCore/html/ImageResizerThread.h | 70 + WebCore/html/LegacyHTMLTreeConstructor.cpp | 1744 +++++ WebCore/html/LegacyHTMLTreeConstructor.h | 214 + WebCore/html/PreloadScanner.cpp | 2 +- WebCore/html/StepRange.cpp | 2 +- WebCore/html/TextMetrics.h | 1 + WebCore/html/ValidityState.cpp | 2 +- WebCore/html/canvas/CanvasGradient.idl | 3 +- WebCore/html/canvas/CanvasPattern.idl | 3 +- WebCore/html/canvas/CanvasRenderingContext2D.cpp | 10 +- WebCore/html/canvas/CanvasRenderingContext2D.idl | 2 + WebCore/html/canvas/Float32Array.cpp | 62 + WebCore/html/canvas/Float32Array.h | 79 + WebCore/html/canvas/Float32Array.idl | 42 + WebCore/html/canvas/FloatArray.cpp | 62 - WebCore/html/canvas/FloatArray.h | 79 - WebCore/html/canvas/FloatArray.idl | 40 - WebCore/html/canvas/Int16Array.idl | 2 + WebCore/html/canvas/Int32Array.idl | 2 + WebCore/html/canvas/Int8Array.idl | 2 + WebCore/html/canvas/Uint16Array.idl | 2 + WebCore/html/canvas/Uint32Array.idl | 2 + WebCore/html/canvas/Uint8Array.idl | 2 + WebCore/html/canvas/WebGLFramebuffer.cpp | 18 + WebCore/html/canvas/WebGLFramebuffer.h | 2 + WebCore/html/canvas/WebGLGetInfo.cpp | 6 +- WebCore/html/canvas/WebGLGetInfo.h | 8 +- WebCore/html/canvas/WebGLRenderingContext.cpp | 731 +- WebCore/html/canvas/WebGLRenderingContext.h | 96 +- WebCore/html/canvas/WebGLRenderingContext.idl | 63 +- WebCore/html/canvas/WebGLTexture.cpp | 1 + WebCore/html/canvas/WebGLTexture.h | 5 + WebCore/inspector/InjectedScriptHost.cpp | 6 - WebCore/inspector/InjectedScriptHost.h | 1 - WebCore/inspector/InjectedScriptHost.idl | 1 - WebCore/inspector/InspectorBackend.cpp | 32 +- WebCore/inspector/InspectorBackend.h | 12 +- WebCore/inspector/InspectorBackend.idl | 9 +- WebCore/inspector/InspectorClient.h | 2 + WebCore/inspector/InspectorController.cpp | 132 +- WebCore/inspector/InspectorController.h | 17 +- WebCore/inspector/InspectorDOMAgent.cpp | 253 + WebCore/inspector/InspectorDOMAgent.h | 15 +- WebCore/inspector/InspectorFrontend.cpp | 45 +- WebCore/inspector/InspectorFrontend.h | 20 +- WebCore/inspector/InspectorFrontendClientLocal.cpp | 2 +- WebCore/inspector/InspectorResource.cpp | 1 - WebCore/inspector/InspectorTimelineAgent.h | 4 +- WebCore/inspector/InspectorValues.cpp | 531 +- WebCore/inspector/InspectorValues.h | 51 +- WebCore/inspector/ScriptDebugListener.h | 7 +- WebCore/inspector/front-end/Breakpoint.js | 0 WebCore/inspector/front-end/BreakpointManager.js | 22 + WebCore/inspector/front-end/CSSStyleModel.js | 111 + WebCore/inspector/front-end/ConsoleView.js | 6 +- WebCore/inspector/front-end/ElementsPanel.js | 11 +- .../front-end/EventListenersSidebarPane.js | 8 +- WebCore/inspector/front-end/HAREntry.js | 135 + WebCore/inspector/front-end/InjectedScript.js | 280 +- .../inspector/front-end/InjectedScriptAccess.js | 11 - .../inspector/front-end/InspectorBackendStub.js | 24 +- WebCore/inspector/front-end/KeyboardShortcut.js | 28 +- WebCore/inspector/front-end/Resource.js | 81 +- WebCore/inspector/front-end/ResourceView.js | 54 +- WebCore/inspector/front-end/ResourcesPanel.js | 10 +- WebCore/inspector/front-end/Script.js | 13 +- WebCore/inspector/front-end/ScriptView.js | 30 +- WebCore/inspector/front-end/ScriptsPanel.js | 36 +- WebCore/inspector/front-end/Settings.js | 47 +- WebCore/inspector/front-end/SourceFrame.js | 8 +- WebCore/inspector/front-end/SourceView.js | 19 +- WebCore/inspector/front-end/StylesSidebarPane.js | 100 +- WebCore/inspector/front-end/TextPrompt.js | 2 +- WebCore/inspector/front-end/TextViewer.js | 8 +- WebCore/inspector/front-end/TimelinePanel.js | 2 +- .../front-end/WatchExpressionsSidebarPane.js | 8 +- WebCore/inspector/front-end/WebKit.qrc | 2 + WebCore/inspector/front-end/inspector.css | 7 +- WebCore/inspector/front-end/inspector.html | 2 + WebCore/inspector/front-end/inspector.js | 18 +- WebCore/inspector/front-end/utilities.js | 9 +- WebCore/loader/CachedFont.cpp | 8 +- WebCore/loader/DocumentLoader.cpp | 8 +- WebCore/loader/DocumentLoader.h | 6 +- WebCore/loader/DocumentWriter.cpp | 20 +- WebCore/loader/EmptyClients.h | 1 + WebCore/loader/FTPDirectoryDocument.cpp | 34 +- WebCore/loader/FTPDirectoryDocument.h | 2 +- WebCore/loader/FrameLoader.cpp | 293 +- WebCore/loader/FrameLoader.h | 13 +- WebCore/loader/ImageDocument.cpp | 6 +- WebCore/loader/ImageDocument.h | 2 +- WebCore/loader/MediaDocument.cpp | 28 +- WebCore/loader/MediaDocument.h | 2 +- WebCore/loader/PluginDocument.cpp | 32 +- WebCore/loader/PluginDocument.h | 2 +- WebCore/loader/SinkDocument.cpp | 18 +- WebCore/loader/SinkDocument.h | 2 +- WebCore/loader/TextDocument.cpp | 32 +- WebCore/loader/TextDocument.h | 4 +- WebCore/loader/TextResourceDecoder.cpp | 2 +- .../loader/appcache/ApplicationCacheStorage.cpp | 12 +- WebCore/make-hash-tools.pl | 62 + WebCore/manual-tests/cur-hotspot.html | 12 + .../manual-tests/localstorage-empty-database.html | 13 + WebCore/manual-tests/resources/cur-hotspot.cur | Bin 0 -> 4286 bytes WebCore/notifications/Notification.cpp | 110 +- WebCore/notifications/Notification.h | 41 +- WebCore/notifications/NotificationCenter.h | 4 +- WebCore/page/AbstractView.idl | 2 +- WebCore/page/Console.h | 1 + WebCore/page/Console.idl | 2 + WebCore/page/DOMWindow.cpp | 4 +- WebCore/page/DOMWindow.idl | 7 +- WebCore/page/DragController.cpp | 5 +- WebCore/page/EventHandler.cpp | 8 +- WebCore/page/FocusController.cpp | 21 +- WebCore/page/Frame.cpp | 3 +- WebCore/page/Frame.h | 2 +- WebCore/page/FrameView.cpp | 5 + WebCore/page/FrameView.h | 11 +- WebCore/page/Geolocation.h | 5 +- WebCore/page/GeolocationController.cpp | 5 +- WebCore/page/Location.idl | 4 + WebCore/page/MemoryInfo.cpp | 47 + WebCore/page/MemoryInfo.h | 55 + WebCore/page/MemoryInfo.idl | 40 + WebCore/page/PositionCallback.h | 4 +- WebCore/page/PositionErrorCallback.h | 4 +- WebCore/page/PrintContext.cpp | 1 + WebCore/page/Settings.cpp | 6 +- WebCore/page/Settings.h | 32 +- WebCore/page/SpatialNavigation.cpp | 1 + WebCore/page/WebKitPoint.h | 1 + WebCore/page/XSSAuditor.cpp | 4 +- WebCore/page/XSSAuditor.h | 4 +- WebCore/page/qt/EventHandlerQt.cpp | 4 +- WebCore/platform/BlobItem.cpp | 243 + WebCore/platform/BlobItem.h | 209 + WebCore/platform/ColorData.gperf | 14 +- WebCore/platform/ContextMenu.cpp | 1 + WebCore/platform/Cursor.cpp | 49 + WebCore/platform/Cursor.h | 4 +- WebCore/platform/DragData.h | 6 +- WebCore/platform/FileSystem.cpp | 40 - WebCore/platform/FileSystem.h | 2 - WebCore/platform/PlatformMouseEvent.h | 1 + WebCore/platform/PopupMenuClient.h | 2 + WebCore/platform/ScrollView.cpp | 2 +- WebCore/platform/ScrollView.h | 2 +- WebCore/platform/ThemeTypes.h | 4 +- WebCore/platform/android/DragDataAndroid.cpp | 4 +- WebCore/platform/animation/Animation.h | 3 +- WebCore/platform/animation/AnimationList.cpp | 6 + WebCore/platform/animation/AnimationList.h | 5 + WebCore/platform/brew/ClipboardBrew.cpp | 117 + WebCore/platform/brew/ClipboardBrew.h | 65 + WebCore/platform/brew/ContextMenuBrew.cpp | 107 + WebCore/platform/brew/ContextMenuItemBrew.cpp | 139 + WebCore/platform/brew/EventLoopBrew.cpp | 36 + WebCore/platform/brew/SearchPopupMenuBrew.cpp | 52 + WebCore/platform/chromium/DragDataChromium.cpp | 8 +- WebCore/platform/chromium/KeyCodeConversionGtk.cpp | 2 + WebCore/platform/chromium/PasteboardChromium.cpp | 5 +- WebCore/platform/chromium/PopupMenuChromium.cpp | 2 + WebCore/platform/efl/DragDataEfl.cpp | 4 +- WebCore/platform/efl/FileSystemEfl.cpp | 12 +- WebCore/platform/graphics/BitmapImage.cpp | 5 + WebCore/platform/graphics/BitmapImage.h | 1 + WebCore/platform/graphics/Color.cpp | 2 +- WebCore/platform/graphics/Font.cpp | 87 +- WebCore/platform/graphics/Font.h | 8 +- WebCore/platform/graphics/FontFastPath.cpp | 70 - WebCore/platform/graphics/Gradient.cpp | 4 + WebCore/platform/graphics/Gradient.h | 4 +- WebCore/platform/graphics/GraphicsContext.cpp | 4 +- WebCore/platform/graphics/GraphicsContext.h | 8 +- WebCore/platform/graphics/GraphicsContext3D.cpp | 3 +- WebCore/platform/graphics/GraphicsContext3D.h | 14 +- WebCore/platform/graphics/GraphicsContextPrivate.h | 2 +- WebCore/platform/graphics/Image.h | 1 + WebCore/platform/graphics/ImageBuffer.h | 6 +- WebCore/platform/graphics/ImageSource.cpp | 16 +- WebCore/platform/graphics/ImageSource.h | 13 + WebCore/platform/graphics/cairo/FontCacheCairo.cpp | 51 + WebCore/platform/graphics/cairo/FontCairo.cpp | 2 +- WebCore/platform/graphics/cairo/GOwnPtrCairo.cpp | 50 + WebCore/platform/graphics/cairo/GOwnPtrCairo.h | 41 + WebCore/platform/graphics/cairo/GradientCairo.cpp | 9 + .../graphics/cairo/GraphicsContextCairo.cpp | 8 +- .../platform/graphics/cairo/ImageBufferCairo.cpp | 2 +- WebCore/platform/graphics/cairo/ImageCairo.cpp | 2 +- WebCore/platform/graphics/cg/GraphicsContextCG.cpp | 2 +- WebCore/platform/graphics/cg/ImageBufferCG.cpp | 29 +- WebCore/platform/graphics/cg/ImageSourceCG.cpp | 23 + .../platform/graphics/chromium/FontChromiumWin.cpp | 4 +- .../graphics/chromium/FontPlatformDataLinux.cpp | 1 + .../graphics/chromium/FontUtilsChromiumWin.cpp | 104 +- .../graphics/chromium/GraphicsLayerChromium.cpp | 48 +- .../platform/graphics/chromium/LayerChromium.cpp | 7 +- WebCore/platform/graphics/chromium/LayerChromium.h | 12 + .../graphics/chromium/LayerRendererChromium.cpp | 155 +- .../graphics/chromium/LayerRendererChromium.h | 6 +- WebCore/platform/graphics/gtk/FontGtk.cpp | 2 +- .../graphics/haiku/GraphicsContextHaiku.cpp | 2 +- .../platform/graphics/haiku/ImageBufferHaiku.cpp | 2 +- WebCore/platform/graphics/mac/FontMac.mm | 2 +- .../platform/graphics/mac/GraphicsContext3DMac.cpp | 2 +- .../graphics/openvg/GraphicsContextOpenVG.cpp | 2 +- WebCore/platform/graphics/qt/FontQt.cpp | 187 +- .../platform/graphics/qt/GraphicsContext3DQt.cpp | 11 +- WebCore/platform/graphics/qt/GraphicsContextQt.cpp | 19 +- WebCore/platform/graphics/qt/GraphicsLayerQt.cpp | 15 +- WebCore/platform/graphics/qt/ImageBufferQt.cpp | 16 +- WebCore/platform/graphics/qt/ImageQt.cpp | 17 + WebCore/platform/graphics/qt/PathQt.cpp | 56 +- .../platform/graphics/skia/GraphicsContextSkia.cpp | 6 +- WebCore/platform/graphics/skia/ImageBufferSkia.cpp | 2 +- WebCore/platform/graphics/skia/ImageSkia.cpp | 12 +- .../platform/graphics/skia/PlatformContextSkia.cpp | 40 +- .../platform/graphics/skia/PlatformContextSkia.h | 9 + WebCore/platform/graphics/skia/SkiaFontWin.cpp | 2 +- WebCore/platform/graphics/win/FontCGWin.cpp | 4 +- .../win/MediaPlayerPrivateFullscreenWindow.cpp | 2 +- .../win/MediaPlayerPrivateFullscreenWindow.h | 2 +- WebCore/platform/graphics/win/QTCFDictionary.cpp | 5 +- WebCore/platform/graphics/win/WKCAImageQueue.cpp | 2 +- WebCore/platform/graphics/win/WKCAImageQueue.h | 2 +- .../graphics/wince/GraphicsContextWince.cpp | 6 +- .../platform/graphics/wince/ImageBufferWince.cpp | 2 +- WebCore/platform/graphics/wx/GraphicsContextWx.cpp | 2 +- WebCore/platform/graphics/wx/ImageBufferWx.cpp | 2 +- WebCore/platform/gtk/CursorGtk.cpp | 3 +- WebCore/platform/gtk/DragDataGtk.cpp | 4 +- WebCore/platform/gtk/FileChooserGtk.cpp | 5 +- WebCore/platform/gtk/FileSystemGtk.cpp | 77 +- WebCore/platform/gtk/GOwnPtrGtk.cpp | 33 + WebCore/platform/gtk/GOwnPtrGtk.h | 33 + WebCore/platform/gtk/GtkPluginWidget.cpp | 2 +- WebCore/platform/gtk/GtkVersioning.h | 4 + WebCore/platform/gtk/PlatformScreenGtk.cpp | 4 +- WebCore/platform/gtk/PopupMenuGtk.cpp | 3 +- WebCore/platform/gtk/RenderThemeGtk.cpp | 65 +- WebCore/platform/gtk/RenderThemeGtk.h | 8 +- WebCore/platform/gtk/SharedBufferGtk.cpp | 6 +- WebCore/platform/gtk/WidgetGtk.cpp | 5 +- WebCore/platform/haiku/DragDataHaiku.cpp | 4 +- WebCore/platform/haiku/SharedBufferHaiku.cpp | 11 +- WebCore/platform/mac/CursorMac.mm | 8 +- WebCore/platform/mac/DragDataMac.mm | 8 +- WebCore/platform/mac/WebCoreSystemInterface.h | 2 +- WebCore/platform/mac/WebCoreSystemInterface.mm | 2 +- WebCore/platform/mac/WheelEventMac.mm | 11 +- WebCore/platform/network/FormData.cpp | 124 +- WebCore/platform/network/FormData.h | 29 +- .../platform/network/chromium/ResourceResponse.h | 8 + WebCore/platform/network/mac/FormDataStreamMac.mm | 21 +- .../platform/network/soup/ResourceHandleSoup.cpp | 6 +- WebCore/platform/posix/SharedBufferPOSIX.cpp | 5 +- WebCore/platform/qt/ClipboardQt.cpp | 14 +- WebCore/platform/qt/ContextMenuItemQt.cpp | 3 +- WebCore/platform/qt/ContextMenuQt.cpp | 8 +- WebCore/platform/qt/CursorQt.cpp | 7 +- WebCore/platform/qt/DragDataQt.cpp | 12 +- WebCore/platform/qt/FileChooserQt.cpp | 2 +- WebCore/platform/qt/FileSystemQt.cpp | 14 +- WebCore/platform/qt/GeolocationServiceQt.cpp | 109 + WebCore/platform/qt/GeolocationServiceQt.h | 70 + WebCore/platform/qt/KURLQt.cpp | 4 +- WebCore/platform/qt/Localizations.cpp | 19 +- WebCore/platform/qt/LoggingQt.cpp | 2 +- WebCore/platform/qt/PasteboardQt.cpp | 4 +- WebCore/platform/qt/PlatformKeyboardEventQt.cpp | 820 +- WebCore/platform/qt/PlatformMouseEventQt.cpp | 23 +- WebCore/platform/qt/RenderThemeQt.cpp | 7 +- WebCore/platform/qt/ScreenQt.cpp | 8 +- WebCore/platform/qt/ScrollbarQt.cpp | 4 +- WebCore/platform/qt/ScrollbarThemeQt.cpp | 64 +- WebCore/platform/qt/SharedTimerQt.cpp | 5 +- WebCore/platform/qt/SoundQt.cpp | 3 +- WebCore/platform/qt/TemporaryLinkStubsQt.cpp | 16 +- WebCore/platform/qt/WheelEventQt.cpp | 31 +- WebCore/platform/qt/WidgetQt.cpp | 9 +- WebCore/platform/text/SegmentedString.cpp | 4 +- WebCore/platform/text/qt/TextBreakIteratorQt.cpp | 64 +- WebCore/platform/win/ClipboardUtilitiesWin.cpp | 61 +- WebCore/platform/win/ClipboardUtilitiesWin.h | 5 +- WebCore/platform/win/ClipboardWin.cpp | 2 +- WebCore/platform/win/CursorWin.cpp | 13 +- WebCore/platform/win/DragDataWin.cpp | 11 +- WebCore/platform/wince/DragDataWince.cpp | 4 +- WebCore/platform/wx/DragDataWx.cpp | 4 +- WebCore/plugins/mac/PluginViewMac.cpp | 834 -- WebCore/plugins/mac/PluginViewMac.mm | 837 ++ WebCore/rendering/HitTestRequest.h | 12 +- WebCore/rendering/InlineTextBox.cpp | 14 +- WebCore/rendering/LayoutState.cpp | 7 + WebCore/rendering/PointerEventsHitRules.cpp | 5 +- WebCore/rendering/PointerEventsHitRules.h | 3 +- WebCore/rendering/RenderApplet.cpp | 2 +- WebCore/rendering/RenderBlock.cpp | 340 +- WebCore/rendering/RenderBlock.h | 10 + WebCore/rendering/RenderBlockLineLayout.cpp | 1 + WebCore/rendering/RenderBox.cpp | 2 +- WebCore/rendering/RenderDataGrid.cpp | 2 +- WebCore/rendering/RenderFileUploadControl.cpp | 25 +- WebCore/rendering/RenderFrameSet.cpp | 4 +- WebCore/rendering/RenderIFrame.cpp | 1 + WebCore/rendering/RenderImage.cpp | 3 +- WebCore/rendering/RenderInline.cpp | 5 +- WebCore/rendering/RenderLayer.cpp | 14 +- WebCore/rendering/RenderLayerBacking.cpp | 9 +- WebCore/rendering/RenderLayerCompositor.cpp | 14 +- WebCore/rendering/RenderLineBoxList.cpp | 3 +- WebCore/rendering/RenderListBox.cpp | 10 +- WebCore/rendering/RenderMenuList.h | 2 + WebCore/rendering/RenderMeter.cpp | 15 + WebCore/rendering/RenderMeter.h | 2 + WebCore/rendering/RenderObject.cpp | 19 +- WebCore/rendering/RenderObject.h | 5 +- WebCore/rendering/RenderPath.cpp | 62 +- WebCore/rendering/RenderPath.h | 2 +- WebCore/rendering/RenderProgress.cpp | 32 +- WebCore/rendering/RenderProgress.h | 4 +- WebCore/rendering/RenderSVGContainer.cpp | 18 +- WebCore/rendering/RenderSVGImage.cpp | 25 +- WebCore/rendering/RenderSVGResource.h | 2 +- WebCore/rendering/RenderSVGResourceClipper.cpp | 41 +- WebCore/rendering/RenderSVGResourceClipper.h | 4 +- WebCore/rendering/RenderSVGResourceContainer.h | 19 +- WebCore/rendering/RenderSVGResourceFilter.cpp | 4 +- WebCore/rendering/RenderSVGResourceFilter.h | 2 +- WebCore/rendering/RenderSVGResourceGradient.cpp | 42 +- WebCore/rendering/RenderSVGResourceGradient.h | 3 +- WebCore/rendering/RenderSVGResourceMarker.h | 2 +- WebCore/rendering/RenderSVGResourceMasker.cpp | 16 +- WebCore/rendering/RenderSVGResourceMasker.h | 2 +- WebCore/rendering/RenderSVGResourcePattern.cpp | 43 +- WebCore/rendering/RenderSVGResourcePattern.h | 8 +- WebCore/rendering/RenderSVGResourceSolidColor.h | 2 +- WebCore/rendering/RenderSVGText.cpp | 41 +- WebCore/rendering/RenderSVGText.h | 3 + WebCore/rendering/RenderSlider.cpp | 23 +- WebCore/rendering/RenderTextControl.cpp | 10 +- WebCore/rendering/RenderTextControlMultiLine.cpp | 2 +- WebCore/rendering/RenderTextControlSingleLine.cpp | 5 +- WebCore/rendering/RenderTextControlSingleLine.h | 2 + WebCore/rendering/RenderTheme.cpp | 24 + WebCore/rendering/RenderTheme.h | 7 + WebCore/rendering/RenderThemeChromiumSkia.cpp | 111 + WebCore/rendering/RenderThemeChromiumSkia.h | 14 + WebCore/rendering/RenderThemeChromiumWin.cpp | 20 +- WebCore/rendering/RenderThemeMac.h | 11 + WebCore/rendering/RenderThemeMac.mm | 103 +- WebCore/rendering/RenderTreeAsText.cpp | 1 + WebCore/rendering/RenderWidget.cpp | 3 +- WebCore/rendering/RootInlineBox.cpp | 4 +- WebCore/rendering/SVGRenderSupport.cpp | 126 +- WebCore/rendering/SVGRenderSupport.h | 10 +- WebCore/rendering/SVGRenderTreeAsText.cpp | 11 +- WebCore/rendering/SVGRootInlineBox.cpp | 8 +- WebCore/rendering/ShadowElement.cpp | 48 + WebCore/rendering/ShadowElement.h | 68 + WebCore/rendering/style/RenderStyle.cpp | 3 +- WebCore/rendering/style/SVGRenderStyle.cpp | 33 +- WebCore/rendering/style/SVGRenderStyle.h | 8 +- WebCore/rendering/style/SVGRenderStyleDefs.h | 5 + WebCore/storage/ChangeVersionWrapper.cpp | 3 + WebCore/storage/ChangeVersionWrapper.h | 3 + WebCore/storage/Database.cpp | 72 +- WebCore/storage/Database.h | 67 +- WebCore/storage/DatabaseAuthorizer.cpp | 44 +- WebCore/storage/DatabaseAuthorizer.h | 4 + WebCore/storage/DatabaseTask.cpp | 7 +- WebCore/storage/DatabaseTask.h | 8 +- WebCore/storage/IDBCallbacks.h | 2 + WebCore/storage/IDBDatabase.h | 17 +- WebCore/storage/IDBDatabaseImpl.cpp | 40 +- WebCore/storage/IDBDatabaseImpl.h | 18 +- WebCore/storage/IDBDatabaseRequest.cpp | 31 +- WebCore/storage/IDBDatabaseRequest.h | 24 +- WebCore/storage/IDBDatabaseRequest.idl | 12 +- WebCore/storage/IDBKeyRange.cpp | 47 + WebCore/storage/IDBKeyRange.h | 73 + WebCore/storage/IDBKeyRange.idl | 43 + WebCore/storage/IDBObjectStore.cpp | 86 - WebCore/storage/IDBObjectStore.h | 31 +- WebCore/storage/IDBObjectStoreImpl.cpp | 89 + WebCore/storage/IDBObjectStoreImpl.h | 68 + WebCore/storage/IDBObjectStoreRequest.cpp | 43 +- WebCore/storage/IDBObjectStoreRequest.h | 26 +- WebCore/storage/IDBObjectStoreRequest.idl | 18 +- WebCore/storage/IDBRequest.cpp | 7 + WebCore/storage/IDBRequest.h | 2 +- WebCore/storage/IndexedDatabase.h | 2 +- WebCore/storage/IndexedDatabaseImpl.cpp | 2 +- WebCore/storage/IndexedDatabaseImpl.h | 2 +- WebCore/storage/IndexedDatabaseRequest.cpp | 42 +- WebCore/storage/IndexedDatabaseRequest.h | 20 +- WebCore/storage/IndexedDatabaseRequest.idl | 8 +- WebCore/storage/SQLResultSet.idl | 6 + WebCore/storage/SQLStatement.cpp | 6 +- WebCore/storage/SQLStatement.h | 15 +- WebCore/storage/SQLTransaction.cpp | 63 +- WebCore/storage/SQLTransaction.h | 10 +- WebCore/storage/SQLTransactionCoordinator.cpp | 3 +- WebCore/storage/StorageAreaSync.cpp | 27 +- WebCore/storage/StorageAreaSync.h | 7 + WebCore/svg/SVGColor.cpp | 3 - WebCore/svg/SVGDocumentExtensions.cpp | 6 +- WebCore/svg/SVGElement.cpp | 2 +- WebCore/svg/SVGFEColorMatrixElement.cpp | 2 +- WebCore/svg/SVGFitToViewBox.cpp | 50 +- WebCore/svg/SVGFitToViewBox.h | 7 +- WebCore/svg/SVGLocatable.cpp | 10 +- WebCore/svg/SVGStyledElement.cpp | 5 +- WebCore/svg/SVGUseElement.cpp | 5 +- WebCore/svg/SVGViewSpec.cpp | 22 +- WebCore/svg/animation/SMILTimeContainer.cpp | 3 +- WebCore/svg/graphics/SVGImage.cpp | 2 +- WebCore/svg/svgattrs.in | 1 + WebCore/wml/WMLDocument.cpp | 6 +- WebCore/wml/WMLElement.cpp | 2 +- WebCore/wml/WMLErrorHandling.cpp | 10 +- WebCore/wml/WMLTemplateElement.cpp | 2 +- WebCore/workers/DedicatedWorkerContext.idl | 3 + WebCore/workers/WorkerContext.idl | 2 + WebCore/workers/WorkerScriptLoaderClient.h | 2 + WebCore/wscript | 3 +- WebCore/xml/XMLHttpRequest.cpp | 8 +- WebCore/xml/XMLHttpRequest.idl | 4 +- WebCore/xml/XSLStyleSheetLibxslt.cpp | 6 +- WebCore/xml/XSLTProcessor.cpp | 4 +- WebCore/xml/XSLTProcessorLibxslt.cpp | 2 +- WebKit/ChangeLog | 53 + WebKit/WebKit.xcodeproj/project.pbxproj | 8 - WebKit/cf/ChangeLog | 42 + WebKit/cf/WebCoreSupport/WebInspectorClientCF.cpp | 27 + WebKit/chromium/ChangeLog | 800 ++ WebKit/chromium/DEPS | 27 +- WebKit/chromium/WebKit.grd | 1 + WebKit/chromium/WebKit.gyp | 86 +- WebKit/chromium/WebKit.gypi | 1 - WebKit/chromium/features.gypi | 1 + WebKit/chromium/gyp_webkit | 8 +- WebKit/chromium/public/WebDevToolsAgentClient.h | 1 + WebKit/chromium/public/WebIDBCallbacks.h | 2 + WebKit/chromium/public/WebIDBDatabase.h | 42 +- WebKit/chromium/public/WebIDBObjectStore.h | 75 + WebKit/chromium/public/WebIndexedDatabase.h | 10 +- WebKit/chromium/public/WebInputElement.h | 5 +- WebKit/chromium/public/WebURLResponse.h | 4 + WebKit/chromium/public/WebView.h | 5 + WebKit/chromium/public/WebViewClient.h | 28 +- WebKit/chromium/src/AutoFillPopupMenuClient.cpp | 77 +- WebKit/chromium/src/AutoFillPopupMenuClient.h | 12 +- WebKit/chromium/src/ChromeClientImpl.cpp | 83 +- WebKit/chromium/src/ChromeClientImpl.h | 4 + WebKit/chromium/src/DebuggerAgent.h | 5 +- WebKit/chromium/src/DebuggerAgentImpl.cpp | 5 - WebKit/chromium/src/DebuggerAgentImpl.h | 1 - WebKit/chromium/src/GraphicsContext3D.cpp | 2 +- WebKit/chromium/src/IDBCallbacksProxy.cpp | 7 + WebKit/chromium/src/IDBCallbacksProxy.h | 3 + WebKit/chromium/src/IDBDatabaseProxy.cpp | 31 +- WebKit/chromium/src/IDBDatabaseProxy.h | 14 +- WebKit/chromium/src/IDBObjectStoreProxy.cpp | 89 + WebKit/chromium/src/IDBObjectStoreProxy.h | 67 + WebKit/chromium/src/IndexedDatabaseProxy.cpp | 6 +- WebKit/chromium/src/IndexedDatabaseProxy.h | 2 +- WebKit/chromium/src/InspectorClientImpl.cpp | 18 + WebKit/chromium/src/InspectorClientImpl.h | 13 +- WebKit/chromium/src/NotificationPresenterImpl.cpp | 5 +- WebKit/chromium/src/SuggestionsPopupMenuClient.h | 2 + WebKit/chromium/src/WebDevToolsAgentImpl.cpp | 8 +- WebKit/chromium/src/WebEntities.cpp | 4 +- WebKit/chromium/src/WebFormControlElement.cpp | 2 +- WebKit/chromium/src/WebIDBCallbacksImpl.cpp | 8 + WebKit/chromium/src/WebIDBCallbacksImpl.h | 1 + WebKit/chromium/src/WebIDBDatabaseImpl.cpp | 41 +- WebKit/chromium/src/WebIDBDatabaseImpl.h | 18 +- WebKit/chromium/src/WebIDBObjectStoreImpl.cpp | 84 + WebKit/chromium/src/WebIDBObjectStoreImpl.h | 60 + WebKit/chromium/src/WebImageCG.cpp | 10 +- WebKit/chromium/src/WebIndexedDatabaseImpl.cpp | 4 +- WebKit/chromium/src/WebIndexedDatabaseImpl.h | 2 +- WebKit/chromium/src/WebInputElement.cpp | 15 + WebKit/chromium/src/WebPluginContainerImpl.cpp | 1 + WebKit/chromium/src/WebSearchableFormData.cpp | 14 +- WebKit/chromium/src/WebSettingsImpl.cpp | 2 +- WebKit/chromium/src/WebURLResponse.cpp | 10 + WebKit/chromium/src/WebViewImpl.cpp | 60 +- WebKit/chromium/src/WebViewImpl.h | 8 +- WebKit/chromium/src/gtk/WebInputEventFactory.cpp | 54 + WebKit/chromium/src/js/DebuggerAgent.js | 72 +- WebKit/chromium/src/js/DebuggerScript.js | 46 +- WebKit/chromium/src/js/DevTools.js | 71 +- WebKit/chromium/src/js/DevToolsHostStub.js | 4 - WebKit/chromium/src/js/InspectorControllerImpl.js | 21 +- WebKit/chromium/src/js/Tests.js | 4 +- WebKit/chromium/src/js/devTools.css | 4 - WebKit/chromium/tests/PopupMenuTest.cpp | 2 + WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp | 7 + WebKit/efl/WebCoreSupport/InspectorClientEfl.h | 2 + WebKit/gtk/ChangeLog | 240 + WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp | 6 +- WebKit/gtk/WebCoreSupport/DragClientGtk.cpp | 16 +- WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp | 5 +- WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp | 50 +- WebKit/gtk/WebCoreSupport/InspectorClientGtk.h | 16 +- WebKit/gtk/docs/webkitgtk-docs.sgml | 6 +- WebKit/gtk/docs/webkitgtk-sections.txt | 13 +- WebKit/gtk/tests/testdomnode.c | 147 + WebKit/gtk/tests/testhittestresult.c | 22 + WebKit/gtk/webkit/webkithittestresult.cpp | 33 +- WebKit/gtk/webkit/webkitprivate.cpp | 20 +- WebKit/gtk/webkit/webkitprivate.h | 4 +- WebKit/gtk/webkit/webkitwebinspector.cpp | 1 + WebKit/gtk/webkit/webkitwebview.cpp | 147 +- WebKit/haiku/ChangeLog | 42 + .../haiku/WebCoreSupport/InspectorClientHaiku.cpp | 6 + WebKit/haiku/WebCoreSupport/InspectorClientHaiku.h | 2 + WebKit/mac/ChangeLog | 184 + WebKit/mac/Configurations/FeatureDefines.xcconfig | 4 +- .../Plugins/Hosted/NetscapePluginInstanceProxy.h | 1 + .../Plugins/Hosted/NetscapePluginInstanceProxy.mm | 4 +- WebKit/mac/Plugins/Hosted/ProxyInstance.mm | 2 +- WebKit/mac/Plugins/WebBaseNetscapePluginView.mm | 10 +- WebKit/mac/WebCoreSupport/WebContextMenuClient.mm | 2 + WebKit/mac/WebCoreSupport/WebGeolocationMock.mm | 63 - .../mac/WebCoreSupport/WebGeolocationMockPrivate.h | 33 - WebKit/mac/WebCoreSupport/WebInspectorClient.h | 20 +- WebKit/mac/WebCoreSupport/WebInspectorClient.mm | 16 +- WebKit/mac/WebKit.exp | 1 - WebKit/mac/WebView/WebDynamicScrollBarsView.mm | 4 +- WebKit/mac/WebView/WebFrame.mm | 2 +- WebKit/mac/WebView/WebFrameInternal.h | 2 +- WebKit/mac/WebView/WebPreferenceKeysPrivate.h | 1 + WebKit/mac/WebView/WebPreferences.mm | 10 + WebKit/mac/WebView/WebPreferencesPrivate.h | 3 + WebKit/mac/WebView/WebView.mm | 3 +- WebKit/qt/Api/qwebframe.cpp | 8 +- WebKit/qt/Api/qwebhistory.cpp | 5 + WebKit/qt/Api/qwebhistory.h | 1 + WebKit/qt/Api/qwebhistory_p.h | 2 + WebKit/qt/Api/qwebkitplatformplugin.h | 31 +- WebKit/qt/Api/qwebpage.cpp | 55 +- WebKit/qt/Api/qwebpage.h | 1 + WebKit/qt/Api/qwebpage_p.h | 5 +- WebKit/qt/Api/qwebpluginfactory.cpp | 4 +- WebKit/qt/Api/qwebsettings.cpp | 18 +- WebKit/qt/Api/qwebsettings.h | 6 +- WebKit/qt/ChangeLog | 686 ++ WebKit/qt/WebCoreSupport/ChromeClientQt.cpp | 45 +- WebKit/qt/WebCoreSupport/ContextMenuClientQt.h | 33 +- WebKit/qt/WebCoreSupport/DragClientQt.cpp | 2 +- .../qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp | 77 +- WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h | 16 +- WebKit/qt/WebCoreSupport/EditCommandQt.cpp | 25 +- WebKit/qt/WebCoreSupport/EditCommandQt.h | 16 +- WebKit/qt/WebCoreSupport/EditorClientQt.cpp | 36 +- WebKit/qt/WebCoreSupport/EditorClientQt.h | 4 +- WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp | 12 +- WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h | 378 +- WebKit/qt/WebCoreSupport/InspectorClientQt.cpp | 57 +- WebKit/qt/WebCoreSupport/InspectorClientQt.h | 8 +- .../NotificationPresenterClientQt.cpp | 253 +- .../WebCoreSupport/NotificationPresenterClientQt.h | 64 +- WebKit/qt/WebCoreSupport/PageClientQt.h | 4 +- WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp | 64 +- WebKit/qt/WebCoreSupport/QtPlatformPlugin.h | 10 +- WebKit/qt/docs/qtwebkit-bridge.qdoc | 427 + WebKit/qt/docs/qtwebkit.qdoc | 5 +- .../webkitsnippets/qtwebkit_bridge_snippets.cpp | 177 + .../platformplugin/WebNotificationPresenter.cpp | 66 + .../platformplugin/WebNotificationPresenter.h | 59 + WebKit/qt/examples/platformplugin/WebPlugin.cpp | 10 +- WebKit/qt/examples/platformplugin/WebPlugin.h | 6 +- .../qt/examples/platformplugin/platformplugin.pro | 8 +- .../platformplugin/qwebkitplatformplugin.h | 31 +- WebKit/qt/qt_webkit_version.pri | 4 + WebKit/qt/qtwebkit_version.pri | 4 - WebKit/qt/symbian/eabi/QtWebKitu.def | 6 + .../qgraphicswebview/resources/input_types.html | 8 + .../qgraphicswebview/tst_qgraphicswebview.cpp | 76 + .../qgraphicswebview/tst_qgraphicswebview.qrc | 6 + WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 58 +- .../qt/tests/qwebview/resources/input_types.html | 8 + WebKit/qt/tests/qwebview/tst_qwebview.cpp | 63 +- WebKit/qt/tests/qwebview/tst_qwebview.qrc | 1 + WebKit/win/ChangeLog | 96 + WebKit/win/Interfaces/IWebFramePrivate.idl | 2 +- WebKit/win/Interfaces/IWebViewPrivate.idl | 2 +- WebKit/win/Interfaces/WebKit.idl | 1 - WebKit/win/WebCoreSupport/WebInspectorClient.cpp | 7 +- WebKit/win/WebCoreSupport/WebInspectorClient.h | 16 +- WebKit/win/WebFrame.cpp | 7 +- WebKit/win/WebFrame.h | 2 +- WebKit/win/WebView.cpp | 7 +- WebKit/win/WebView.h | 2 +- WebKit/wx/ChangeLog | 42 + WebKit/wx/WebKitSupport/InspectorClientWx.cpp | 6 + WebKit/wx/WebKitSupport/InspectorClientWx.h | 2 + WebKitExamplePlugins/ChangeLog | 12 + .../NetscapeCocoaPlugin.xcodeproj/project.pbxproj | 8 +- WebKitExamplePlugins/NetscapeCocoaPlugin/main.m | 20 +- WebKitLibraries/ChangeLog | 10 + WebKitLibraries/WebKitSystemInterface.h | 8 +- WebKitLibraries/libWebKitSystemInterfaceLeopard.a | Bin 1574648 -> 1574632 bytes .../libWebKitSystemInterfaceSnowLeopard.a | Bin 1295892 -> 1296060 bytes WebKitLibraries/libWebKitSystemInterfaceTiger.a | Bin 603600 -> 603488 bytes .../win/tools/vsprops/FeatureDefines.vsprops | 7 +- .../win/tools/vsprops/FeatureDefinesCairo.vsprops | 7 +- WebKitTools/ChangeLog | 934 +++ .../DumpRenderTree/AccessibilityUIElement.cpp | 10 + .../DumpRenderTree/AccessibilityUIElement.h | 2 + WebKitTools/DumpRenderTree/DumpRenderTree.gypi | 10 + .../DumpRenderTree.xcodeproj/project.pbxproj | 8 + .../DumpRenderTree/chromium/EventSender.cpp | 3 +- .../chromium/LayoutTestController.cpp | 6 +- .../DumpRenderTree/chromium/TestShellWin.cpp | 7 + .../DumpRenderTree/chromium/WebThemeControlDRT.cpp | 518 ++ .../DumpRenderTree/chromium/WebThemeControlDRT.h | 202 + .../DumpRenderTree/chromium/WebThemeEngineDRT.cpp | 674 ++ .../DumpRenderTree/chromium/WebThemeEngineDRT.h | 93 + .../gtk/AccessibilityUIElementGtk.cpp | 6 + WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp | 18 +- WebKitTools/DumpRenderTree/gtk/EventSender.cpp | 384 +- WebKitTools/DumpRenderTree/gtk/EventSender.h | 2 +- .../mac/AccessibilityUIElementMac.mm | 11 + .../mac/Configurations/Base.xcconfig | 1 + WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm | 8 +- .../DumpRenderTree/mac/EventSendingController.mm | 31 +- .../DumpRenderTree/mac/LayoutTestControllerMac.mm | 11 +- .../DumpRenderTree/mac/MockGeolocationProvider.h | 47 + .../DumpRenderTree/mac/MockGeolocationProvider.mm | 109 + WebKitTools/DumpRenderTree/mac/UIDelegate.mm | 11 +- WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp | 62 +- WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h | 23 +- WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp | 72 +- WebKitTools/DumpRenderTree/qt/EventSenderQt.h | 8 + .../DumpRenderTree/qt/LayoutTestControllerQt.cpp | 23 +- .../DumpRenderTree/qt/LayoutTestControllerQt.h | 11 + .../win/AccessibilityUIElementWin.cpp | 6 + WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp | 4 +- WebKitTools/GtkLauncher/main.c | 23 +- WebKitTools/QtTestBrowser/main.cpp | 36 + WebKitTools/Scripts/build-webkit | 5 +- WebKitTools/Scripts/do-webcore-rename | 68 +- WebKitTools/Scripts/ensure-valid-python | 23 +- WebKitTools/Scripts/old-run-webkit-tests | 18 + WebKitTools/Scripts/run-bindings-tests | 3 +- WebKitTools/Scripts/update-webkit-auxiliary-libs | 21 +- WebKitTools/Scripts/webkitdirs.pm | 15 +- .../Scripts/webkitpy/common/checkout/changelog.py | 10 + .../webkitpy/common/checkout/changelog_unittest.py | 14 +- .../Scripts/webkitpy/common/checkout/scm.py | 55 +- .../webkitpy/common/checkout/scm_unittest.py | 60 +- .../Scripts/webkitpy/common/config/committers.py | 7 +- .../Scripts/webkitpy/common/net/bugzilla.py | 39 +- .../webkitpy/common/net/bugzilla_unittest.py | 19 +- .../Scripts/webkitpy/common/net/buildbot.py | 7 +- .../webkitpy/common/net/buildbot_unittest.py | 12 + .../Scripts/webkitpy/common/net/rietveld.py | 6 +- .../webkitpy/common/system/outputcapture.py | 7 +- WebKitTools/Scripts/webkitpy/common/system/user.py | 9 + .../json_layout_results_generator.py | 1 + .../layout_package/json_results_generator.py | 28 +- .../Scripts/webkitpy/layout_tests/port/base.py | 8 + .../Scripts/webkitpy/layout_tests/port/chromium.py | 7 + .../webkitpy/layout_tests/port/chromium_linux.py | 12 +- .../webkitpy/layout_tests/port/chromium_mac.py | 9 +- .../webkitpy/layout_tests/port/chromium_win.py | 9 +- .../webkitpy/layout_tests/port/websocket_server.py | 9 +- .../Scripts/webkitpy/thirdparty/__init__.py | 7 +- .../thirdparty/autoinstalled/.mechanize.url | 1 - .../webkitpy/thirdparty/autoinstalled/.pep8.py.url | 1 - .../webkitpy/thirdparty/autoinstalled/README | 2 - .../webkitpy/thirdparty/autoinstalled/__init__.py | 1 - .../autoinstalled/clientform/.ClientForm.py.url | 1 - .../autoinstalled/clientform/ClientForm.py | 3401 -------- .../autoinstalled/clientform/__init__.py | 1 - .../thirdparty/autoinstalled/irc/.ircbot.py.url | 1 - .../thirdparty/autoinstalled/irc/.irclib.py.url | 1 - .../thirdparty/autoinstalled/irc/__init__.py | 1 - .../thirdparty/autoinstalled/irc/ircbot.py | 438 -- .../thirdparty/autoinstalled/irc/irclib.py | 1560 ---- .../thirdparty/autoinstalled/mechanize/__init__.py | 140 - .../thirdparty/autoinstalled/mechanize/_auth.py | 522 -- .../autoinstalled/mechanize/_beautifulsoup.py | 1080 --- .../autoinstalled/mechanize/_clientcookie.py | 1707 ---- .../thirdparty/autoinstalled/mechanize/_debug.py | 28 - .../thirdparty/autoinstalled/mechanize/_file.py | 60 - .../autoinstalled/mechanize/_firefox3cookiejar.py | 249 - .../thirdparty/autoinstalled/mechanize/_gzip.py | 103 - .../autoinstalled/mechanize/_headersutil.py | 232 - .../thirdparty/autoinstalled/mechanize/_html.py | 631 -- .../thirdparty/autoinstalled/mechanize/_http.py | 758 -- .../autoinstalled/mechanize/_lwpcookiejar.py | 185 - .../autoinstalled/mechanize/_mechanize.py | 676 -- .../autoinstalled/mechanize/_mozillacookiejar.py | 161 - .../autoinstalled/mechanize/_msiecookiejar.py | 388 - .../thirdparty/autoinstalled/mechanize/_opener.py | 436 -- .../autoinstalled/mechanize/_pullparser.py | 390 - .../thirdparty/autoinstalled/mechanize/_request.py | 87 - .../autoinstalled/mechanize/_response.py | 527 -- .../thirdparty/autoinstalled/mechanize/_rfc3986.py | 241 - .../thirdparty/autoinstalled/mechanize/_seek.py | 16 - .../autoinstalled/mechanize/_sockettimeout.py | 6 - .../autoinstalled/mechanize/_testcase.py | 73 - .../thirdparty/autoinstalled/mechanize/_upgrade.py | 40 - .../thirdparty/autoinstalled/mechanize/_urllib2.py | 55 - .../autoinstalled/mechanize/_useragent.py | 352 - .../thirdparty/autoinstalled/mechanize/_util.py | 291 - .../webkitpy/thirdparty/autoinstalled/pep8.py | 1254 --- .../autoinstalled/rietveld/.upload.py.url | 1 - .../thirdparty/autoinstalled/rietveld/__init__.py | 1 - .../thirdparty/autoinstalled/rietveld/upload.py | 1702 ---- .../Scripts/webkitpy/tool/bot/irc_command.py | 27 + .../webkitpy/tool/bot/irc_command_unittest.py | 38 + .../Scripts/webkitpy/tool/bot/queueengine.py | 2 +- .../Scripts/webkitpy/tool/bot/sheriffircbot.py | 22 +- .../webkitpy/tool/bot/sheriffircbot_unittest.py | 6 +- .../Scripts/webkitpy/tool/commands/download.py | 12 + .../webkitpy/tool/commands/download_unittest.py | 4 + .../tool/commands/earlywarningsystem_unittest.py | 13 +- .../Scripts/webkitpy/tool/commands/queues.py | 48 +- .../webkitpy/tool/commands/queues_unittest.py | 27 +- .../Scripts/webkitpy/tool/commands/queuestest.py | 67 +- .../Scripts/webkitpy/tool/commands/upload.py | 2 - .../webkitpy/tool/commands/upload_unittest.py | 4 - WebKitTools/Scripts/webkitpy/tool/mocktool.py | 35 +- .../Scripts/webkitpy/tool/steps/abstractstep.py | 7 +- .../Scripts/webkitpy/tool/steps/confirmdiff.py | 3 + WebKitTools/Scripts/webkitpy/tool/steps/options.py | 1 - .../Scripts/webkitpy/tool/steps/postcodereview.py | 42 +- .../webkitpy/tool/steps/preparechangelog.py | 16 +- .../tool/steps/preparechangelog_unittest.py | 55 + .../WebKitAPITest/WebKitAPITestCommon.vsprops | 2 +- WebKitTools/WinLauncher/WinLauncher.vcproj | 8 +- 1237 files changed, 52358 insertions(+), 37520 deletions(-) create mode 100644 JavaScriptCore/JavaScriptCore.JSVALUE32_64only.exp create mode 100644 JavaScriptCore/JavaScriptCore.JSVALUE32only.exp create mode 100644 JavaScriptCore/JavaScriptCore.JSVALUE64only.exp create mode 100644 JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp create mode 100644 LayoutTests/fast/dom/Geolocation/callback-to-deleted-context-expected.txt create mode 100644 LayoutTests/fast/dom/Geolocation/callback-to-deleted-context.html create mode 100644 LayoutTests/fast/dom/Geolocation/callback-to-remote-context-expected.txt create mode 100644 LayoutTests/fast/dom/Geolocation/callback-to-remote-context.html create mode 100644 LayoutTests/fast/dom/Geolocation/callback-to-remote-context2-expected.txt create mode 100644 LayoutTests/fast/dom/Geolocation/callback-to-remote-context2.html create mode 100644 LayoutTests/fast/dom/Geolocation/multiple-requests-expected.txt create mode 100644 LayoutTests/fast/dom/Geolocation/multiple-requests.html create mode 100644 LayoutTests/fast/dom/Geolocation/reentrant-permission-denied-expected.txt create mode 100644 LayoutTests/fast/dom/Geolocation/reentrant-permission-denied.html create mode 100644 LayoutTests/fast/dom/Geolocation/resources/callback-to-deleted-context-inner1.html create mode 100644 LayoutTests/fast/dom/Geolocation/resources/callback-to-deleted-context-inner2.html create mode 100644 LayoutTests/fast/dom/Geolocation/resources/callback-to-remote-context-inner.html create mode 100644 LayoutTests/fast/dom/Geolocation/script-tests/callback-to-deleted-context.js create mode 100644 LayoutTests/fast/dom/Geolocation/script-tests/callback-to-remote-context.js create mode 100644 LayoutTests/fast/dom/Geolocation/script-tests/callback-to-remote-context2.js create mode 100644 LayoutTests/fast/dom/Geolocation/script-tests/multiple-requests.js create mode 100644 LayoutTests/fast/dom/Geolocation/script-tests/reentrant-permission-denied.js create mode 100644 LayoutTests/storage/indexeddb/idb-keyrange-expected.txt create mode 100644 LayoutTests/storage/indexeddb/idb-keyrange.html create mode 100644 LayoutTests/storage/indexeddb/idb-objectstore-request-expected.txt create mode 100644 LayoutTests/storage/indexeddb/idb-objectstore-request.html create mode 100644 LayoutTests/storage/indexeddb/script-tests/idb-keyrange.js create mode 100644 LayoutTests/storage/indexeddb/script-tests/idb-objectstore-request.js delete mode 100644 WebCore/WebCore.gyp/scripts/rule_gperf.py create mode 100644 WebCore/bindings/cpp/WebDOMCString.cpp create mode 100644 WebCore/bindings/cpp/WebDOMCString.h create mode 100644 WebCore/bindings/cpp/WebDOMEventListenerCustom.cpp create mode 100644 WebCore/bindings/cpp/WebDOMEventTarget.cpp create mode 100644 WebCore/bindings/cpp/WebDOMEventTarget.h create mode 100644 WebCore/bindings/cpp/WebDOMHTMLDocumentCustom.cpp create mode 100644 WebCore/bindings/cpp/WebDOMNodeCustom.cpp create mode 100644 WebCore/bindings/cpp/WebDOMObject.h create mode 100644 WebCore/bindings/cpp/WebDOMString.cpp create mode 100644 WebCore/bindings/cpp/WebDOMString.h create mode 100644 WebCore/bindings/cpp/WebExceptionHandler.cpp create mode 100644 WebCore/bindings/cpp/WebExceptionHandler.h create mode 100644 WebCore/bindings/cpp/WebNativeEventListener.cpp create mode 100644 WebCore/bindings/cpp/WebNativeEventListener.h create mode 100644 WebCore/bindings/js/JSFloat32ArrayConstructor.cpp create mode 100644 WebCore/bindings/js/JSFloat32ArrayConstructor.h create mode 100644 WebCore/bindings/js/JSFloat32ArrayCustom.cpp delete mode 100644 WebCore/bindings/js/JSFloatArrayConstructor.cpp delete mode 100644 WebCore/bindings/js/JSFloatArrayConstructor.h delete mode 100644 WebCore/bindings/js/JSFloatArrayCustom.cpp delete mode 100644 WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp delete mode 100644 WebCore/bindings/js/JSXMLHttpRequestConstructor.h create mode 100644 WebCore/bindings/scripts/CodeGeneratorCPP.pm create mode 100644 WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp create mode 100644 WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h create mode 100644 WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp create mode 100644 WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h create mode 100644 WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp create mode 100644 WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h create mode 100644 WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp delete mode 100644 WebCore/bindings/v8/custom/V8FloatArrayCustom.cpp create mode 100644 WebCore/css/CSSOMUtils.cpp create mode 100644 WebCore/css/CSSOMUtils.h create mode 100644 WebCore/dom/DocumentParser.h delete mode 100644 WebCore/dom/Tokenizer.h create mode 100644 WebCore/dom/XMLDocumentParser.cpp create mode 100644 WebCore/dom/XMLDocumentParser.h create mode 100644 WebCore/dom/XMLDocumentParserLibxml2.cpp create mode 100644 WebCore/dom/XMLDocumentParserQt.cpp create mode 100644 WebCore/dom/XMLDocumentParserScope.cpp create mode 100644 WebCore/dom/XMLDocumentParserScope.h delete mode 100644 WebCore/dom/XMLTokenizer.cpp delete mode 100644 WebCore/dom/XMLTokenizer.h delete mode 100644 WebCore/dom/XMLTokenizerLibxml2.cpp delete mode 100644 WebCore/dom/XMLTokenizerQt.cpp delete mode 100644 WebCore/dom/XMLTokenizerScope.cpp delete mode 100644 WebCore/dom/XMLTokenizerScope.h create mode 100644 WebCore/editing/EditingAllInOne.cpp create mode 100644 WebCore/editing/EditingBehavior.h create mode 100644 WebCore/editing/EditingBehaviorTypes.h create mode 100644 WebCore/html/AsyncImageResizer.cpp create mode 100644 WebCore/html/AsyncImageResizer.h create mode 100644 WebCore/html/HTML5DocumentParser.cpp create mode 100644 WebCore/html/HTML5DocumentParser.h create mode 100644 WebCore/html/HTML5EntityParser.cpp create mode 100644 WebCore/html/HTML5EntityParser.h delete mode 100644 WebCore/html/HTML5Tokenizer.cpp delete mode 100644 WebCore/html/HTML5Tokenizer.h create mode 100644 WebCore/html/HTMLDocumentParser.cpp create mode 100644 WebCore/html/HTMLDocumentParser.h delete mode 100644 WebCore/html/HTMLParser.cpp delete mode 100644 WebCore/html/HTMLParser.h delete mode 100644 WebCore/html/HTMLTokenizer.cpp delete mode 100644 WebCore/html/HTMLTokenizer.h create mode 100644 WebCore/html/ImageResizerThread.cpp create mode 100644 WebCore/html/ImageResizerThread.h create mode 100644 WebCore/html/LegacyHTMLTreeConstructor.cpp create mode 100644 WebCore/html/LegacyHTMLTreeConstructor.h create mode 100644 WebCore/html/canvas/Float32Array.cpp create mode 100644 WebCore/html/canvas/Float32Array.h create mode 100644 WebCore/html/canvas/Float32Array.idl delete mode 100644 WebCore/html/canvas/FloatArray.cpp delete mode 100644 WebCore/html/canvas/FloatArray.h delete mode 100644 WebCore/html/canvas/FloatArray.idl delete mode 100644 WebCore/inspector/front-end/Breakpoint.js create mode 100644 WebCore/inspector/front-end/CSSStyleModel.js create mode 100644 WebCore/inspector/front-end/HAREntry.js create mode 100644 WebCore/make-hash-tools.pl create mode 100644 WebCore/manual-tests/cur-hotspot.html create mode 100644 WebCore/manual-tests/localstorage-empty-database.html create mode 100644 WebCore/manual-tests/resources/cur-hotspot.cur create mode 100644 WebCore/page/MemoryInfo.cpp create mode 100644 WebCore/page/MemoryInfo.h create mode 100644 WebCore/page/MemoryInfo.idl create mode 100644 WebCore/platform/BlobItem.cpp create mode 100644 WebCore/platform/BlobItem.h create mode 100644 WebCore/platform/Cursor.cpp delete mode 100644 WebCore/platform/FileSystem.cpp create mode 100644 WebCore/platform/brew/ClipboardBrew.cpp create mode 100644 WebCore/platform/brew/ClipboardBrew.h create mode 100644 WebCore/platform/brew/ContextMenuBrew.cpp create mode 100644 WebCore/platform/brew/ContextMenuItemBrew.cpp create mode 100644 WebCore/platform/brew/EventLoopBrew.cpp create mode 100644 WebCore/platform/brew/SearchPopupMenuBrew.cpp create mode 100644 WebCore/platform/graphics/cairo/GOwnPtrCairo.cpp create mode 100644 WebCore/platform/graphics/cairo/GOwnPtrCairo.h create mode 100644 WebCore/platform/gtk/GOwnPtrGtk.cpp create mode 100644 WebCore/platform/gtk/GOwnPtrGtk.h create mode 100644 WebCore/platform/qt/GeolocationServiceQt.cpp create mode 100644 WebCore/platform/qt/GeolocationServiceQt.h delete mode 100644 WebCore/plugins/mac/PluginViewMac.cpp create mode 100644 WebCore/plugins/mac/PluginViewMac.mm create mode 100644 WebCore/rendering/ShadowElement.cpp create mode 100644 WebCore/rendering/ShadowElement.h create mode 100644 WebCore/storage/IDBKeyRange.cpp create mode 100644 WebCore/storage/IDBKeyRange.h create mode 100644 WebCore/storage/IDBKeyRange.idl delete mode 100644 WebCore/storage/IDBObjectStore.cpp create mode 100755 WebCore/storage/IDBObjectStoreImpl.cpp create mode 100755 WebCore/storage/IDBObjectStoreImpl.h create mode 100755 WebKit/chromium/public/WebIDBObjectStore.h create mode 100755 WebKit/chromium/src/IDBObjectStoreProxy.cpp create mode 100755 WebKit/chromium/src/IDBObjectStoreProxy.h create mode 100755 WebKit/chromium/src/WebIDBObjectStoreImpl.cpp create mode 100755 WebKit/chromium/src/WebIDBObjectStoreImpl.h create mode 100644 WebKit/gtk/tests/testdomnode.c delete mode 100644 WebKit/mac/WebCoreSupport/WebGeolocationMock.mm delete mode 100644 WebKit/mac/WebCoreSupport/WebGeolocationMockPrivate.h create mode 100644 WebKit/qt/docs/qtwebkit-bridge.qdoc create mode 100644 WebKit/qt/docs/webkitsnippets/qtwebkit_bridge_snippets.cpp create mode 100644 WebKit/qt/examples/platformplugin/WebNotificationPresenter.cpp create mode 100644 WebKit/qt/examples/platformplugin/WebNotificationPresenter.h create mode 100644 WebKit/qt/qt_webkit_version.pri delete mode 100644 WebKit/qt/qtwebkit_version.pri create mode 100644 WebKit/qt/tests/qgraphicswebview/resources/input_types.html create mode 100644 WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc create mode 100644 WebKit/qt/tests/qwebview/resources/input_types.html create mode 100755 WebKitTools/DumpRenderTree/chromium/WebThemeControlDRT.cpp create mode 100755 WebKitTools/DumpRenderTree/chromium/WebThemeControlDRT.h create mode 100755 WebKitTools/DumpRenderTree/chromium/WebThemeEngineDRT.cpp create mode 100755 WebKitTools/DumpRenderTree/chromium/WebThemeEngineDRT.h create mode 100644 WebKitTools/DumpRenderTree/mac/MockGeolocationProvider.h create mode 100644 WebKitTools/DumpRenderTree/mac/MockGeolocationProvider.mm mode change 100644 => 100755 WebKitTools/Scripts/ensure-valid-python delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/.mechanize.url delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/.pep8.py.url delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/README delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/__init__.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/clientform/.ClientForm.py.url delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/clientform/ClientForm.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/clientform/__init__.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/irc/.ircbot.py.url delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/irc/.irclib.py.url delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/irc/__init__.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/irc/ircbot.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/irc/irclib.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/__init__.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_auth.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_beautifulsoup.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_clientcookie.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_debug.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_file.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_firefox3cookiejar.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_gzip.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_headersutil.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_html.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_http.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_lwpcookiejar.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_mechanize.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_mozillacookiejar.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_msiecookiejar.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_opener.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_pullparser.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_request.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_response.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_rfc3986.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_seek.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_sockettimeout.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_testcase.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_upgrade.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_urllib2.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_useragent.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_util.py delete mode 100755 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/pep8.py delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/rietveld/.upload.py.url delete mode 100644 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/rietveld/__init__.py delete mode 100755 WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/rietveld/upload.py create mode 100644 WebKitTools/Scripts/webkitpy/tool/bot/irc_command_unittest.py create mode 100644 WebKitTools/Scripts/webkitpy/tool/steps/preparechangelog_unittest.py diff --git a/JavaScriptCore/API/JSCallbackConstructor.cpp b/JavaScriptCore/API/JSCallbackConstructor.cpp index 2948932..66c6b88 100644 --- a/JavaScriptCore/API/JSCallbackConstructor.cpp +++ b/JavaScriptCore/API/JSCallbackConstructor.cpp @@ -28,6 +28,7 @@ #include "APIShims.h" #include "APICast.h" +#include #include #include #include @@ -52,17 +53,18 @@ JSCallbackConstructor::~JSCallbackConstructor() JSClassRelease(m_class); } -static JSObject* constructJSCallback(ExecState* exec, JSObject* constructor, const ArgList& args) +static EncodedJSValue JSC_HOST_CALL constructJSCallback(ExecState* exec) { + JSObject* constructor = exec->callee(); JSContextRef ctx = toRef(exec); JSObjectRef constructorRef = toRef(constructor); JSObjectCallAsConstructorCallback callback = static_cast(constructor)->callback(); if (callback) { - int argumentCount = static_cast(args.size()); + int argumentCount = static_cast(exec->argumentCount()); Vector arguments(argumentCount); for (int i = 0; i < argumentCount; i++) - arguments[i] = toRef(exec, args.at(i)); + arguments[i] = toRef(exec, exec->argument(i)); JSValueRef exception = 0; JSObjectRef result; @@ -71,11 +73,11 @@ static JSObject* constructJSCallback(ExecState* exec, JSObject* constructor, con result = callback(ctx, constructorRef, argumentCount, arguments.data(), &exception); } if (exception) - exec->setException(toJS(exec, exception)); - return toJS(result); + throwError(exec, toJS(exec, exception)); + return JSValue::encode(toJS(result)); } - return toJS(JSObjectMake(ctx, static_cast(constructor)->classRef(), 0)); + return JSValue::encode(toJS(JSObjectMake(ctx, static_cast(constructor)->classRef(), 0))); } ConstructType JSCallbackConstructor::getConstructData(ConstructData& constructData) diff --git a/JavaScriptCore/API/JSCallbackFunction.cpp b/JavaScriptCore/API/JSCallbackFunction.cpp index 9db9983..c488aa6 100644 --- a/JavaScriptCore/API/JSCallbackFunction.cpp +++ b/JavaScriptCore/API/JSCallbackFunction.cpp @@ -29,6 +29,7 @@ #include "APIShims.h" #include "APICast.h" #include "CodeBlock.h" +#include "ExceptionHelpers.h" #include "JSFunction.h" #include "FunctionPrototype.h" #include @@ -47,7 +48,7 @@ JSCallbackFunction::JSCallbackFunction(ExecState* exec, JSGlobalObject* globalOb { } -JSValue JSCallbackFunction::call(ExecState* exec) +EncodedJSValue JSCallbackFunction::call(ExecState* exec) { JSContextRef execRef = toRef(exec); JSObjectRef functionRef = toRef(exec->callee()); @@ -65,9 +66,9 @@ JSValue JSCallbackFunction::call(ExecState* exec) result = static_cast(toJS(functionRef))->m_callback(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception); } if (exception) - exec->setException(toJS(exec, exception)); + throwError(exec, toJS(exec, exception)); - return toJS(exec, result); + return JSValue::encode(toJS(exec, result)); } CallType JSCallbackFunction::getCallData(CallData& callData) diff --git a/JavaScriptCore/API/JSCallbackFunction.h b/JavaScriptCore/API/JSCallbackFunction.h index 3940e7d..b119b97 100644 --- a/JavaScriptCore/API/JSCallbackFunction.h +++ b/JavaScriptCore/API/JSCallbackFunction.h @@ -48,7 +48,7 @@ private: virtual CallType getCallData(CallData&); virtual const ClassInfo* classInfo() const { return &info; } - static JSValue JSC_HOST_CALL call(ExecState*); + static EncodedJSValue JSC_HOST_CALL call(ExecState*); JSObjectCallAsFunctionCallback m_callback; }; diff --git a/JavaScriptCore/API/JSCallbackObject.h b/JavaScriptCore/API/JSCallbackObject.h index 7216ac5..dfb9fa2 100644 --- a/JavaScriptCore/API/JSCallbackObject.h +++ b/JavaScriptCore/API/JSCallbackObject.h @@ -182,8 +182,8 @@ private: static JSCallbackObject* asCallbackObject(JSValue); - static JSValue JSC_HOST_CALL call(ExecState*); - static JSObject* construct(ExecState*, JSObject* constructor, const ArgList&); + static EncodedJSValue JSC_HOST_CALL call(ExecState*); + static EncodedJSValue JSC_HOST_CALL construct(ExecState*); static JSValue staticValueGetter(ExecState*, JSValue, const Identifier&); static JSValue staticFunctionGetter(ExecState*, JSValue, const Identifier&); diff --git a/JavaScriptCore/API/JSCallbackObjectFunctions.h b/JavaScriptCore/API/JSCallbackObjectFunctions.h index ef1efd2..3a15bbe 100644 --- a/JavaScriptCore/API/JSCallbackObjectFunctions.h +++ b/JavaScriptCore/API/JSCallbackObjectFunctions.h @@ -27,6 +27,7 @@ #include "APIShims.h" #include "APICast.h" #include "Error.h" +#include "ExceptionHelpers.h" #include "JSCallbackFunction.h" #include "JSClassRef.h" #include "JSFunction.h" @@ -134,7 +135,7 @@ bool JSCallbackObject::getOwnPropertySlot(ExecState* exec, const Identifie value = getProperty(ctx, thisRef, propertyNameRef.get(), &exception); } if (exception) { - exec->setException(toJS(exec, exception)); + throwError(exec, toJS(exec, exception)); slot.setValue(jsUndefined()); return true; } @@ -206,7 +207,7 @@ void JSCallbackObject::put(ExecState* exec, const Identifier& propertyName result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception); } if (exception) - exec->setException(toJS(exec, exception)); + throwError(exec, toJS(exec, exception)); if (result || exception) return; } @@ -225,11 +226,11 @@ void JSCallbackObject::put(ExecState* exec, const Identifier& propertyName result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception); } if (exception) - exec->setException(toJS(exec, exception)); + throwError(exec, toJS(exec, exception)); if (result || exception) return; } else - throwError(exec, ReferenceError, "Attempt to set a property that is not settable."); + throwError(exec, createReferenceError(exec, "Attempt to set a property that is not settable.")); } } @@ -264,7 +265,7 @@ bool JSCallbackObject::deleteProperty(ExecState* exec, const Identifier& p result = deleteProperty(ctx, thisRef, propertyNameRef.get(), &exception); } if (exception) - exec->setException(toJS(exec, exception)); + throwError(exec, toJS(exec, exception)); if (result || exception) return true; } @@ -308,17 +309,18 @@ ConstructType JSCallbackObject::getConstructData(ConstructData& constructD } template -JSObject* JSCallbackObject::construct(ExecState* exec, JSObject* constructor, const ArgList& args) +EncodedJSValue JSCallbackObject::construct(ExecState* exec) { + JSObject* constructor = exec->callee(); JSContextRef execRef = toRef(exec); JSObjectRef constructorRef = toRef(constructor); for (JSClassRef jsClass = static_cast*>(constructor)->classRef(); jsClass; jsClass = jsClass->parentClass) { if (JSObjectCallAsConstructorCallback callAsConstructor = jsClass->callAsConstructor) { - int argumentCount = static_cast(args.size()); + int argumentCount = static_cast(exec->argumentCount()); Vector arguments(argumentCount); for (int i = 0; i < argumentCount; i++) - arguments[i] = toRef(exec, args.at(i)); + arguments[i] = toRef(exec, exec->argument(i)); JSValueRef exception = 0; JSObject* result; { @@ -326,13 +328,13 @@ JSObject* JSCallbackObject::construct(ExecState* exec, JSObject* construct result = toJS(callAsConstructor(execRef, constructorRef, argumentCount, arguments.data(), &exception)); } if (exception) - exec->setException(toJS(exec, exception)); - return result; + throwError(exec, toJS(exec, exception)); + return JSValue::encode(result); } } ASSERT_NOT_REACHED(); // getConstructData should prevent us from reaching here - return 0; + return JSValue::encode(JSValue()); } template @@ -351,7 +353,7 @@ bool JSCallbackObject::hasInstance(ExecState* exec, JSValue value, JSValue result = hasInstance(execRef, thisRef, valueRef, &exception); } if (exception) - exec->setException(toJS(exec, exception)); + throwError(exec, toJS(exec, exception)); return result; } } @@ -371,7 +373,7 @@ CallType JSCallbackObject::getCallData(CallData& callData) } template -JSValue JSCallbackObject::call(ExecState* exec) +EncodedJSValue JSCallbackObject::call(ExecState* exec) { JSContextRef execRef = toRef(exec); JSObjectRef functionRef = toRef(exec->callee()); @@ -390,13 +392,13 @@ JSValue JSCallbackObject::call(ExecState* exec) result = toJS(exec, callAsFunction(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception)); } if (exception) - exec->setException(toJS(exec, exception)); - return result; + throwError(exec, toJS(exec, exception)); + return JSValue::encode(result); } } ASSERT_NOT_REACHED(); // getCallData should prevent us from reaching here - return JSValue(); + return JSValue::encode(JSValue()); } template @@ -457,7 +459,7 @@ double JSCallbackObject::toNumber(ExecState* exec) const value = convertToType(ctx, thisRef, kJSTypeNumber, &exception); } if (exception) { - exec->setException(toJS(exec, exception)); + throwError(exec, toJS(exec, exception)); return 0; } @@ -484,7 +486,7 @@ UString JSCallbackObject::toString(ExecState* exec) const value = convertToType(ctx, thisRef, kJSTypeString, &exception); } if (exception) { - exec->setException(toJS(exec, exception)); + throwError(exec, toJS(exec, exception)); return ""; } if (value) @@ -537,14 +539,14 @@ JSValue JSCallbackObject::staticValueGetter(ExecState* exec, JSValue slotB value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception); } if (exception) { - exec->setException(toJS(exec, exception)); + throwError(exec, toJS(exec, exception)); return jsUndefined(); } if (value) return toJS(exec, value); } - return throwError(exec, ReferenceError, "Static value property defined with NULL getProperty callback."); + return throwError(exec, createReferenceError(exec, "Static value property defined with NULL getProperty callback.")); } template @@ -570,7 +572,7 @@ JSValue JSCallbackObject::staticFunctionGetter(ExecState* exec, JSValue sl } } - return throwError(exec, ReferenceError, "Static function property defined with NULL callAsFunction callback."); + return throwError(exec, createReferenceError(exec, "Static function property defined with NULL callAsFunction callback.")); } template @@ -592,14 +594,14 @@ JSValue JSCallbackObject::callbackGetter(ExecState* exec, JSValue slotBase value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception); } if (exception) { - exec->setException(toJS(exec, exception)); + throwError(exec, toJS(exec, exception)); return jsUndefined(); } if (value) return toJS(exec, value); } - return throwError(exec, ReferenceError, "hasProperty callback returned true for a property that doesn't exist."); + return throwError(exec, createReferenceError(exec, "hasProperty callback returned true for a property that doesn't exist.")); } } // namespace JSC diff --git a/JavaScriptCore/API/JSObjectRef.cpp b/JavaScriptCore/API/JSObjectRef.cpp index 70c4e14..5e0536f 100644 --- a/JavaScriptCore/API/JSObjectRef.cpp +++ b/JavaScriptCore/API/JSObjectRef.cpp @@ -184,11 +184,10 @@ JSObjectRef JSObjectMakeError(JSContextRef ctx, size_t argumentCount, const JSVa ExecState* exec = toJS(ctx); APIEntryShim entryShim(exec); - MarkedArgumentBuffer argList; - for (size_t i = 0; i < argumentCount; ++i) - argList.append(toJS(exec, arguments[i])); + JSValue message = argumentCount ? toJS(exec, arguments[0]) : jsUndefined(); + Structure* errorStructure = exec->lexicalGlobalObject()->errorStructure(); + JSObject* result = ErrorInstance::create(exec, errorStructure, message); - JSObject* result = constructError(exec, argList); if (exec->hadException()) { if (exception) *exception = toRef(exec, exec->exception()); diff --git a/JavaScriptCore/CMakeLists.txt b/JavaScriptCore/CMakeLists.txt index da7e119..d4a85d0 100644 --- a/JavaScriptCore/CMakeLists.txt +++ b/JavaScriptCore/CMakeLists.txt @@ -274,5 +274,6 @@ ADD_LIBRARY(${JavaScriptCore_LIBRARY_NAME} ${JavaScriptCore_LIBRARY_TYPE} ${Java TARGET_LINK_LIBRARIES(${JavaScriptCore_LIBRARY_NAME} ${JavaScriptCore_LIBRARIES}) ADD_TARGET_PROPERTIES(${JavaScriptCore_LIBRARY_NAME} LINK_FLAGS ${JavaScriptCore_LINK_FLAGS}) -INSTALL(TARGETS ${JavaScriptCore_LIBRARY_NAME} DESTINATION lib) - +IF (SHARED_CORE) + INSTALL(TARGETS ${JavaScriptCore_LIBRARY_NAME} DESTINATION lib) +ENDIF () diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog index 3687d58..8d5b59e 100644 --- a/JavaScriptCore/ChangeLog +++ b/JavaScriptCore/ChangeLog @@ -1,3 +1,1121 @@ +2010-06-11 Eric Seidel + + Reviewed by Adam Barth. + + Rename the rest of the *Tokenizer classes to *DocumentParser + https://bugs.webkit.org/show_bug.cgi?id=40507 + + * wtf/Platform.h: + - fixed a comment to match new names. + +2010-06-11 Jedrzej Nowacki + + Reviewed by Simon Hausmann. + + [Qt] Explicit conversions from QtScript types to JSC opaque types were removed. + https://bugs.webkit.org/show_bug.cgi?id=40412 + + Conversion between a JSC C types and a QtScript private types, takes + main part of the source code. In most cases a mapping between the types + is one to one. New cast operators were added to simplify the code. + + The QScriptValuePrivate could be casted to the JSValueRef and the JSObjectRef. + The QScriptEnginePrivate could be casted to the JSGlobalContext. + The QScriptProgramPrivate could be casted to the JSStringRef. + + * qt/api/qscriptengine_p.cpp: + (QScriptEnginePrivate::evaluate): + (QScriptEnginePrivate::newObject): + (QScriptEnginePrivate::globalObject): + * qt/api/qscriptengine_p.h: + (QScriptEnginePrivate::operator JSGlobalContextRef): + * qt/api/qscriptprogram_p.h: + (QScriptProgramPrivate::operator JSStringRef): + * qt/api/qscriptsyntaxcheckresult.cpp: + (QScriptSyntaxCheckResultPrivate::~QScriptSyntaxCheckResultPrivate): + (QScriptSyntaxCheckResultPrivate::errorMessage): + (QScriptSyntaxCheckResultPrivate::errorLineNumber): + * qt/api/qscriptvalue_p.h: + (QScriptValuePrivate::~QScriptValuePrivate): + (QScriptValuePrivate::QScriptValuePrivate): + (QScriptValuePrivate::isBool): + (QScriptValuePrivate::isNumber): + (QScriptValuePrivate::isNull): + (QScriptValuePrivate::isString): + (QScriptValuePrivate::isUndefined): + (QScriptValuePrivate::isFunction): + (QScriptValuePrivate::toString): + (QScriptValuePrivate::toNumber): + (QScriptValuePrivate::toBool): + (QScriptValuePrivate::toObject): + (QScriptValuePrivate::equals): + (QScriptValuePrivate::strictlyEquals): + (QScriptValuePrivate::instanceOf): + (QScriptValuePrivate::call): + (QScriptValuePrivate::operator JSValueRef): + (QScriptValuePrivate::operator JSObjectRef): + (QScriptValuePrivate::setValue): + (QScriptValuePrivate::inherits): + (QScriptValuePrivate::refinedJSValue): + +2010-05-31 Jocelyn Turcotte + + Reviewed by Simon Hausmann. + + [Qt] Implement the simple text code path. + https://bugs.webkit.org/show_bug.cgi?id=40077 + + Remove the FONT_FAST_PATH macro and use the Qt's + fast text implementation instead of the one of WebKit. + + The Qt::TextBypassShaping flag is used to tell Qt to + only use the glyph advances. + + Qt 4.7 is needed to get this flag thus the complex path is always + used if QtWebKit is compiled against an earlier version. + + Contrary to the WebKit's implementation, the complex code path + is taken if the text is RightToLeft, justified or is formatted + with non-zero letter or word spacing. + + * wtf/Platform.h: + +2010-06-11 Luiz Agostini + + Reviewed by Kenneth Rohde Christiansen. + + add codePointCompare to JavaScriptCore.exp + https://bugs.webkit.org/show_bug.cgi?id=40426 + + * JavaScriptCore.exp: + +2010-06-10 Oliver Hunt + + Reviewed by Maciej Stachowiak. + + Math Javascript Bug on Safari 5 (webkit 533.16) under "32bit" mode + https://bugs.webkit.org/show_bug.cgi?id=40367 + + If we're in the slow case of right shift we must write the type tag as + the only reason we hit this code path is because we know we're working + with a double. eg. we are guaranteed that the tag cannot be reused. + + * jit/JITArithmetic32_64.cpp: + (JSC::JIT::emitRightShiftSlowCase): + +2010-06-10 Kwang Yul Seo + + Reviewed by Eric Seidel. + + Remove weakRandomNumber + https://bugs.webkit.org/show_bug.cgi?id=40291 + + weakRandomNumber is used nowhere. Currently, WeakRandom is used instead. + + * wtf/RandomNumber.cpp: + * wtf/RandomNumber.h: + +2010-06-09 Alexey Proskuryakov + + Reviewed by Brady Eidson. + + Export StringImpl::ascii(). It might be not very useful, but it's a public function. + + * JavaScriptCore.exp: + +2010-06-09 Leandro Pereira + + Reviewed by Adam Treat. + + [EFL] Allow building core libraries as shared objects to speed up + linking time on machines with small amounts of memory. + http://webkit.org/b/39899 + + * CMakeLists.txt: If building with shared core, install the lib. + * jsc/CMakeListsEfl.txt: Needs Glib and Ecore to link dynamically. + * wtf/CMakeLists.txt: If building with shared core, install the lib. + +2010-06-09 Gabor Loki + + Reviewed by David Levin. + + Remove some unused variable warnings from JITOpcodes + https://bugs.webkit.org/show_bug.cgi?id=40298 + + * jit/JITOpcodes.cpp: + (JSC::JIT::privateCompileCTINativeCall): + * jit/JITOpcodes32_64.cpp: + (JSC::JIT::privateCompileCTINativeCall): + +2010-05-18 Yuzo Fujishima + + Reviewed by Shinichiro Hamaji. + + Fix for Bug 34529 - [CSSOM] issues with cssText and selectorText + Add U16_LENGTH that is needed to implement CSS character serialization. + https://bugs.webkit.org/show_bug.cgi?id=34529 + + * wtf/unicode/qt4/UnicodeQt4.h: + * wtf/unicode/wince/UnicodeWince.h: + +2010-06-08 Sheriff Bot + + Unreviewed, rolling out r60830. + http://trac.webkit.org/changeset/60830 + https://bugs.webkit.org/show_bug.cgi?id=40305 + + Broke the Windows build (Requested by abarth on #webkit). + + * JavaScriptCore.vcproj/WTF/WTF.vcproj: + * wtf/OwnPtrCommon.h: + * wtf/brew/OwnPtrBrew.h: Removed. + * wtf/win/OwnPtrWin.h: Removed. + +2010-06-08 MORITA Hajime + + Unreviewed. An attempt to fix test break. + + * Configurations/FeatureDefines.xcconfig: + +2010-06-08 Kwang Yul Seo + + Reviewed by Adam Barth. + + Change OwnPtrCommon to include platform-specific headers + https://bugs.webkit.org/show_bug.cgi?id=40279 + + Adding new type to OwnPtrCommon needlessly causes all ports to do full rebuilds. + Change OwnPtrCommon to include platform-specific headers to avoid all ports rebuilds. + + * JavaScriptCore.vcproj/WTF/WTF.vcproj: + * wtf/OwnPtrCommon.h: + * wtf/brew/OwnPtrBrew.h: Added. + * wtf/win/OwnPtrWin.h: Added. + +2010-06-07 MORITA Hajime + + Reviewed by Kent Tamura. + + https://bugs.webkit.org/show_bug.cgi?id=40219 + [Mac] ENABLE_METER_TAG should be enabled + + Added ENABLE_METER_TAG. + + * Configurations/FeatureDefines.xcconfig: + +2010-06-07 Kwang Yul Seo + + Reviewed by Eric Seidel. + + [BREWMP] Add more types to OwnPtr + https://bugs.webkit.org/show_bug.cgi?id=39667 + + Add ISSL and ISocket to the list of OwnPtr-ed type. + + * wtf/OwnPtrCommon.h: + * wtf/brew/OwnPtrBrew.cpp: + (WTF::deleteOwnedPtr): + +2010-06-07 Benjamin Poulain + + Reviewed by Simon Hausmann. + + [Qt] Crash when compiling on Snow Leopard and running on Leopard + https://bugs.webkit.org/show_bug.cgi?id=31403 + + Disable the use of pthread_setname_np and other symbols + when targetting Leopard. + + Use the defines TARGETING_XX instead of BUILDING_ON_XX + for features that cannot be used before Snow Leopard. + + * wtf/Platform.h: + +2010-06-07 Gabor Loki + + Reviewed by NOBODY (JSVALUE32_64 build fix). + + * jit/JITOpcodes32_64.cpp: + (JSC::JIT::privateCompileCTINativeCall): + +2010-06-06 Gavin Barraclough + + Reviewed by NOBODY (windows build fix pt 2). + + * JavaScriptCore.exp: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + +2010-06-06 Gavin Barraclough + + Reviewed by NOBODY (windows build fix pt 1). + + * JavaScriptCore.exp: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + +2010-06-06 Gavin Barraclough + + Reviewed by Sam Weinig. + + Bug 40214 - Clean up error construction / throwing in JSC. + + The one egregious insanity here is that creating an error requires + a VM-entry-esqe-host call (the string argument is wrapped as a JS + object & pushed on the RegisterFile, then unwrapped back to a + UString). Changing this also means you only require a global + object, not an ExecState, to create an error. + + The methods to create error objects are also parameterized + requiring a switch on the type, which can be made cleaner and + faster by moving to a separate method per error type. Code to add + divot information to error had been duplicated, and is coalesced + back into a single function. + + Convenience methods added to create & throw type & syntax error + with a default error message, since this is a common case. + + Also, errors are currently thrown either using + "throwError(exec, error)" or "exec->setException(error)" - unify + on the former, since this is more commonly used. Add + "throwVMError(exec, error)" equivalents, as a convenience for + cases where the result was being wrapped in "JSValue::encode(...)". + + * API/JSCallbackConstructor.cpp: + (JSC::constructJSCallback): + * API/JSCallbackFunction.cpp: + (JSC::JSCallbackFunction::call): + * API/JSCallbackObjectFunctions.h: + (JSC::::getOwnPropertySlot): + (JSC::::put): + (JSC::::deleteProperty): + (JSC::::construct): + (JSC::::hasInstance): + (JSC::::call): + (JSC::::toNumber): + (JSC::::toString): + (JSC::::staticValueGetter): + (JSC::::staticFunctionGetter): + (JSC::::callbackGetter): + * API/JSObjectRef.cpp: + (JSObjectMakeError): + * JavaScriptCore.exp: + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::emitNewError): + (JSC::BytecodeGenerator::emitThrowExpressionTooDeepException): + * bytecompiler/BytecodeGenerator.h: + * bytecompiler/NodesCodegen.cpp: + (JSC::ThrowableExpressionData::emitThrowError): + (JSC::RegExpNode::emitBytecode): + (JSC::PostfixErrorNode::emitBytecode): + (JSC::PrefixErrorNode::emitBytecode): + (JSC::AssignErrorNode::emitBytecode): + (JSC::ForInNode::emitBytecode): + (JSC::ContinueNode::emitBytecode): + (JSC::BreakNode::emitBytecode): + (JSC::ReturnNode::emitBytecode): + (JSC::LabelNode::emitBytecode): + * interpreter/CallFrame.h: + * interpreter/Interpreter.cpp: + (JSC::Interpreter::throwException): + (JSC::Interpreter::privateExecute): + * jit/JITStubs.cpp: + (JSC::DEFINE_STUB_FUNCTION): + * jsc.cpp: + (functionRun): + (functionLoad): + (functionCheckSyntax): + * parser/Nodes.h: + * runtime/ArrayConstructor.cpp: + (JSC::constructArrayWithSizeQuirk): + * runtime/ArrayPrototype.cpp: + (JSC::arrayProtoFuncToString): + (JSC::arrayProtoFuncToLocaleString): + (JSC::arrayProtoFuncJoin): + (JSC::arrayProtoFuncFilter): + (JSC::arrayProtoFuncMap): + (JSC::arrayProtoFuncEvery): + (JSC::arrayProtoFuncForEach): + (JSC::arrayProtoFuncSome): + (JSC::arrayProtoFuncReduce): + (JSC::arrayProtoFuncReduceRight): + * runtime/BooleanPrototype.cpp: + (JSC::booleanProtoFuncToString): + (JSC::booleanProtoFuncValueOf): + * runtime/DatePrototype.cpp: + (JSC::dateProtoFuncToString): + (JSC::dateProtoFuncToUTCString): + (JSC::dateProtoFuncToISOString): + (JSC::dateProtoFuncToDateString): + (JSC::dateProtoFuncToTimeString): + (JSC::dateProtoFuncToLocaleString): + (JSC::dateProtoFuncToLocaleDateString): + (JSC::dateProtoFuncToLocaleTimeString): + (JSC::dateProtoFuncGetTime): + (JSC::dateProtoFuncGetFullYear): + (JSC::dateProtoFuncGetUTCFullYear): + (JSC::dateProtoFuncToGMTString): + (JSC::dateProtoFuncGetMonth): + (JSC::dateProtoFuncGetUTCMonth): + (JSC::dateProtoFuncGetDate): + (JSC::dateProtoFuncGetUTCDate): + (JSC::dateProtoFuncGetDay): + (JSC::dateProtoFuncGetUTCDay): + (JSC::dateProtoFuncGetHours): + (JSC::dateProtoFuncGetUTCHours): + (JSC::dateProtoFuncGetMinutes): + (JSC::dateProtoFuncGetUTCMinutes): + (JSC::dateProtoFuncGetSeconds): + (JSC::dateProtoFuncGetUTCSeconds): + (JSC::dateProtoFuncGetMilliSeconds): + (JSC::dateProtoFuncGetUTCMilliseconds): + (JSC::dateProtoFuncGetTimezoneOffset): + (JSC::dateProtoFuncSetTime): + (JSC::setNewValueFromTimeArgs): + (JSC::setNewValueFromDateArgs): + (JSC::dateProtoFuncSetMilliSeconds): + (JSC::dateProtoFuncSetUTCMilliseconds): + (JSC::dateProtoFuncSetSeconds): + (JSC::dateProtoFuncSetUTCSeconds): + (JSC::dateProtoFuncSetMinutes): + (JSC::dateProtoFuncSetUTCMinutes): + (JSC::dateProtoFuncSetHours): + (JSC::dateProtoFuncSetUTCHours): + (JSC::dateProtoFuncSetDate): + (JSC::dateProtoFuncSetUTCDate): + (JSC::dateProtoFuncSetMonth): + (JSC::dateProtoFuncSetUTCMonth): + (JSC::dateProtoFuncSetFullYear): + (JSC::dateProtoFuncSetUTCFullYear): + (JSC::dateProtoFuncSetYear): + (JSC::dateProtoFuncGetYear): + (JSC::dateProtoFuncToJSON): + * runtime/Error.cpp: + (JSC::createError): + (JSC::createEvalError): + (JSC::createRangeError): + (JSC::createReferenceError): + (JSC::createSyntaxError): + (JSC::createTypeError): + (JSC::createURIError): + (JSC::addErrorSourceInfo): + (JSC::addErrorDivotInfo): + (JSC::addErrorInfo): + (JSC::hasErrorInfo): + (JSC::throwError): + (JSC::throwTypeError): + (JSC::throwSyntaxError): + * runtime/Error.h: + (JSC::throwVMError): + (JSC::throwVMTypeError): + * runtime/ErrorConstructor.cpp: + (JSC::constructWithErrorConstructor): + (JSC::callErrorConstructor): + * runtime/ErrorConstructor.h: + * runtime/ErrorInstance.cpp: + (JSC::ErrorInstance::ErrorInstance): + (JSC::ErrorInstance::create): + * runtime/ErrorInstance.h: + * runtime/ErrorPrototype.cpp: + (JSC::ErrorPrototype::ErrorPrototype): + * runtime/ExceptionHelpers.cpp: + (JSC::createStackOverflowError): + (JSC::createUndefinedVariableError): + (JSC::createInvalidParamError): + (JSC::createNotAConstructorError): + (JSC::createNotAFunctionError): + (JSC::createNotAnObjectError): + (JSC::throwOutOfMemoryError): + * runtime/ExceptionHelpers.h: + * runtime/Executable.cpp: + (JSC::EvalExecutable::compile): + (JSC::ProgramExecutable::checkSyntax): + (JSC::ProgramExecutable::compile): + * runtime/FunctionConstructor.cpp: + (JSC::constructFunction): + * runtime/FunctionPrototype.cpp: + (JSC::functionProtoFuncToString): + (JSC::functionProtoFuncApply): + (JSC::functionProtoFuncCall): + * runtime/Identifier.cpp: + (JSC::Identifier::from): + * runtime/Identifier.h: + * runtime/JSArray.cpp: + (JSC::JSArray::put): + * runtime/JSFunction.cpp: + (JSC::callHostFunctionAsConstructor): + * runtime/JSGlobalObjectFunctions.cpp: + (JSC::encode): + (JSC::decode): + (JSC::globalFuncEval): + * runtime/JSONObject.cpp: + (JSC::Stringifier::appendStringifiedValue): + (JSC::Walker::walk): + (JSC::JSONProtoFuncParse): + (JSC::JSONProtoFuncStringify): + * runtime/JSObject.cpp: + (JSC::throwSetterError): + (JSC::JSObject::put): + (JSC::JSObject::putWithAttributes): + (JSC::JSObject::defaultValue): + (JSC::JSObject::hasInstance): + (JSC::JSObject::defineOwnProperty): + * runtime/JSObject.h: + * runtime/JSValue.cpp: + (JSC::JSValue::toObjectSlowCase): + (JSC::JSValue::synthesizeObject): + (JSC::JSValue::synthesizePrototype): + * runtime/NativeErrorConstructor.cpp: + (JSC::constructWithNativeErrorConstructor): + (JSC::callNativeErrorConstructor): + * runtime/NativeErrorConstructor.h: + * runtime/NumberPrototype.cpp: + (JSC::numberProtoFuncToString): + (JSC::numberProtoFuncToLocaleString): + (JSC::numberProtoFuncValueOf): + (JSC::numberProtoFuncToFixed): + (JSC::numberProtoFuncToExponential): + (JSC::numberProtoFuncToPrecision): + * runtime/ObjectConstructor.cpp: + (JSC::objectConstructorGetPrototypeOf): + (JSC::objectConstructorGetOwnPropertyDescriptor): + (JSC::objectConstructorGetOwnPropertyNames): + (JSC::objectConstructorKeys): + (JSC::toPropertyDescriptor): + (JSC::objectConstructorDefineProperty): + (JSC::objectConstructorDefineProperties): + (JSC::objectConstructorCreate): + * runtime/ObjectPrototype.cpp: + (JSC::objectProtoFuncDefineGetter): + (JSC::objectProtoFuncDefineSetter): + * runtime/RegExpConstructor.cpp: + (JSC::constructRegExp): + * runtime/RegExpObject.cpp: + (JSC::RegExpObject::match): + * runtime/RegExpPrototype.cpp: + (JSC::regExpProtoFuncTest): + (JSC::regExpProtoFuncExec): + (JSC::regExpProtoFuncCompile): + (JSC::regExpProtoFuncToString): + * runtime/StringPrototype.cpp: + (JSC::stringProtoFuncToString): + +2010-06-05 Kwang Yul Seo + + Reviewed by Eric Seidel. + + [BREWMP] Add PLATFORM(BREWMP) guard for using std::xxx + https://bugs.webkit.org/show_bug.cgi?id=39710 + + Build fix for BREW MP. + + * wtf/MathExtras.h: + +2010-06-04 Adam Barth + + Reviewed by Darin Adler. + + HTML5 parser should be within 1% of old parser performance + https://bugs.webkit.org/show_bug.cgi?id=40172 + + Fix cast in this operator= to allow for assignment between vectors with + different inline capacities (as clearly intended by its author). + + * wtf/Vector.h: + (WTF::::operator): + +2010-06-04 Jedrzej Nowacki + + Reviewed by Kenneth Rohde Christiansen. + + New QtScript API; QScriptValue::instanceOf. + + New function create an easy way to check value's prototype hierarchy. + + [Qt] QScriptValue should have an instanceOf method + https://bugs.webkit.org/show_bug.cgi?id=40120 + + * qt/api/qscriptvalue.cpp: + (QScriptValue::instanceOf): + * qt/api/qscriptvalue.h: + * qt/api/qscriptvalue_p.h: + (QScriptValuePrivate::instanceOf): + * qt/tests/qscriptvalue/tst_qscriptvalue.h: + * qt/tests/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp: + (tst_QScriptValue::instanceOf_initData): + (tst_QScriptValue::instanceOf_makeData): + (tst_QScriptValue::instanceOf_test): + +2010-06-04 Gavin Barraclough + + Reviewed by NOBODY (interpreter build fix). + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): + +2010-06-04 Mark Rowe + + Silence some warnings seen on the build bot. + + * JavaScriptCore.JSVALUE32_64only.exp: Add a trailing newline. + * JavaScriptCore.JSVALUE32only.exp: Ditto. + * JavaScriptCore.JSVALUE64only.exp: Ditto. + * JavaScriptCore.xcodeproj/project.pbxproj: Remove the .exp files from all targets so that Xcode doesn't + complain about not knowing how to compile them. + +2010-06-04 Gavin Barraclough + + Reviewed by Oliver Hunt. + + Bug 40187 - Change function signature of NativeConstructor to match NativeFunction + + Mostly for consistency, but constructor & args arguments are redundant, + and this will help if we wish to be able to JIT calls to more constructors. + + * API/JSCallbackConstructor.cpp: + (JSC::constructJSCallback): + * API/JSCallbackObject.h: + * API/JSCallbackObjectFunctions.h: + (JSC::::construct): + * interpreter/Interpreter.cpp: + (JSC::Interpreter::executeConstruct): + * interpreter/Interpreter.h: + * jit/JITStubs.cpp: + (JSC::DEFINE_STUB_FUNCTION): + * runtime/ArrayConstructor.cpp: + (JSC::constructWithArrayConstructor): + * runtime/BooleanConstructor.cpp: + (JSC::constructWithBooleanConstructor): + * runtime/ConstructData.cpp: + (JSC::construct): + * runtime/ConstructData.h: + * runtime/DateConstructor.cpp: + (JSC::constructWithDateConstructor): + * runtime/Error.cpp: + (JSC::constructNativeError): + (JSC::Error::create): + * runtime/ErrorConstructor.cpp: + (JSC::constructWithErrorConstructor): + * runtime/FunctionConstructor.cpp: + (JSC::constructWithFunctionConstructor): + * runtime/NativeErrorConstructor.cpp: + (JSC::constructWithNativeErrorConstructor): + * runtime/NativeErrorConstructor.h: + (JSC::NativeErrorConstructor::errorStructure): + * runtime/NumberConstructor.cpp: + (JSC::constructWithNumberConstructor): + * runtime/ObjectConstructor.cpp: + (JSC::constructWithObjectConstructor): + * runtime/RegExpConstructor.cpp: + (JSC::constructWithRegExpConstructor): + * runtime/StringConstructor.cpp: + (JSC::constructWithStringConstructor): + +2010-06-04 Tony Gentilcore + + Reviewed by Adam Barth. + + Add a takeFirst() method to Deque and use it where appropriate. + https://bugs.webkit.org/show_bug.cgi?id=40089 + + * wtf/Deque.h: + (WTF::::takeFirst): + * wtf/MainThread.cpp: + (WTF::dispatchFunctionsFromMainThread): + * wtf/MessageQueue.h: + (WTF::::tryGetMessage): + +2010-06-04 Jedrzej Nowacki + + Reviewed by Kenneth Rohde Christiansen. + + Remove a QEXPECT_FAIL flag from an autotest. + + Test tst_QScriptEngine::globalObject pass after 36600 bug + fix have been applied. + + [Qt] Expected fail in the tst_QScriptEngine::globalObject should be removed. + https://bugs.webkit.org/show_bug.cgi?id=40114 + + * qt/tests/qscriptengine/tst_qscriptengine.cpp: + (tst_QScriptEngine::globalObject): + +2010-06-04 Jedrzej Nowacki + + Reviewed by Kenneth Rohde Christiansen. + + Fix QScriptValue::equals. + + Handling for a few edge cases were added. Now comparison between + NaN, an invalid objects should works as supposed. + + [Qt] QScriptValue::equals problems + https://bugs.webkit.org/show_bug.cgi?id=40110 + + * qt/api/qscriptvalue.cpp: + (QScriptValue::equals): + * qt/api/qscriptvalue_p.h: + (QScriptValuePrivate::equals): + * qt/tests/qscriptvalue/tst_qscriptvalue.h: + * qt/tests/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp: + (tst_QScriptValue::equals_initData): + (tst_QScriptValue::equals_makeData): + (tst_QScriptValue::equals_test): + +2010-06-03 Jedrzej Nowacki + + Reviewed by Kenneth Rohde Christiansen. + + New states in QScriptValuePrivate. + + The CSpecial state was divided into CNull and CUndefined. It simplify + the QScriptValue code by avoiding a few "cast" and "if". + Moreover the MSVS compiler didn't like casting between a double and an + enum which is avoided now. + + [Qt] The QScriptValuePrivate::CSpecial is too generic. + https://bugs.webkit.org/show_bug.cgi?id=40067 + + * qt/api/qscriptvalue_p.h: + (QScriptValuePrivate::): + (QScriptValuePrivate::QScriptValuePrivate): + (QScriptValuePrivate::isNull): + (QScriptValuePrivate::isUndefined): + (QScriptValuePrivate::toString): + (QScriptValuePrivate::toNumber): + (QScriptValuePrivate::toBool): + (QScriptValuePrivate::toObject): + (QScriptValuePrivate::assignEngine): + (QScriptValuePrivate::isNumberBased): + +2010-06-03 Gavin Barraclough + + Reviewed by NOBODY (Qt build fix). + + * wtf/Platform.h: + +2010-06-03 Gavin Barraclough + + Reviewed by Mark Rowe. + + Bug 40150 - ENABLE_JIT_OPTIMIZE_NATIVE_CALL on all x86/x86_64 platforms + This was fixed in bug #40094. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * wtf/Platform.h: + +2010-06-03 Gavin Barraclough + + Reviewed by NOBODY (Interpreter build fix). + + * JavaScriptCore.JSVALUE32_64only.exp: + * JavaScriptCore.JSVALUE32only.exp: + * JavaScriptCore.JSVALUE64only.exp: + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): + +2010-06-03 Gavin Barraclough + + Reviewed by NOBODY (windows build fix II). + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + +2010-06-03 Gavin Barraclough + + Reviewed by NOBODY (windows build fix). + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + +2010-06-02 Gavin Barraclough + + Reviewed by Oliver Hunt. + + Bug 40094 - The return type of NativeFunction should be EncodedJSValue + On Windows & Linux, using JSVALUE32_64, EncodedJSValue is returned in registers, but JSValue is not. + + * API/JSCallbackFunction.cpp: + (JSC::JSCallbackFunction::call): + * API/JSCallbackFunction.h: + * API/JSCallbackObject.h: + * API/JSCallbackObjectFunctions.h: + (JSC::::call): + * JavaScriptCore.exp: + * interpreter/Interpreter.cpp: + (JSC::Interpreter::executeCall): + * jit/JITStubs.cpp: + (JSC::DEFINE_STUB_FUNCTION): + * jit/JITStubs.h: + * jsc.cpp: + (functionPrint): + (functionDebug): + (functionGC): + (functionVersion): + (functionRun): + (functionLoad): + (functionCheckSyntax): + (functionSetSamplingFlags): + (functionClearSamplingFlags): + (functionReadline): + (functionQuit): + * runtime/ArrayConstructor.cpp: + (JSC::callArrayConstructor): + (JSC::arrayConstructorIsArray): + * runtime/ArrayPrototype.cpp: + (JSC::arrayProtoFuncToString): + (JSC::arrayProtoFuncToLocaleString): + (JSC::arrayProtoFuncJoin): + (JSC::arrayProtoFuncConcat): + (JSC::arrayProtoFuncPop): + (JSC::arrayProtoFuncPush): + (JSC::arrayProtoFuncReverse): + (JSC::arrayProtoFuncShift): + (JSC::arrayProtoFuncSlice): + (JSC::arrayProtoFuncSort): + (JSC::arrayProtoFuncSplice): + (JSC::arrayProtoFuncUnShift): + (JSC::arrayProtoFuncFilter): + (JSC::arrayProtoFuncMap): + (JSC::arrayProtoFuncEvery): + (JSC::arrayProtoFuncForEach): + (JSC::arrayProtoFuncSome): + (JSC::arrayProtoFuncReduce): + (JSC::arrayProtoFuncReduceRight): + (JSC::arrayProtoFuncIndexOf): + (JSC::arrayProtoFuncLastIndexOf): + * runtime/BooleanConstructor.cpp: + (JSC::callBooleanConstructor): + * runtime/BooleanPrototype.cpp: + (JSC::booleanProtoFuncToString): + (JSC::booleanProtoFuncValueOf): + * runtime/CallData.h: + * runtime/DateConstructor.cpp: + (JSC::callDate): + (JSC::dateParse): + (JSC::dateNow): + (JSC::dateUTC): + * runtime/DatePrototype.cpp: + (JSC::dateProtoFuncToString): + (JSC::dateProtoFuncToUTCString): + (JSC::dateProtoFuncToISOString): + (JSC::dateProtoFuncToDateString): + (JSC::dateProtoFuncToTimeString): + (JSC::dateProtoFuncToLocaleString): + (JSC::dateProtoFuncToLocaleDateString): + (JSC::dateProtoFuncToLocaleTimeString): + (JSC::dateProtoFuncGetTime): + (JSC::dateProtoFuncGetFullYear): + (JSC::dateProtoFuncGetUTCFullYear): + (JSC::dateProtoFuncToGMTString): + (JSC::dateProtoFuncGetMonth): + (JSC::dateProtoFuncGetUTCMonth): + (JSC::dateProtoFuncGetDate): + (JSC::dateProtoFuncGetUTCDate): + (JSC::dateProtoFuncGetDay): + (JSC::dateProtoFuncGetUTCDay): + (JSC::dateProtoFuncGetHours): + (JSC::dateProtoFuncGetUTCHours): + (JSC::dateProtoFuncGetMinutes): + (JSC::dateProtoFuncGetUTCMinutes): + (JSC::dateProtoFuncGetSeconds): + (JSC::dateProtoFuncGetUTCSeconds): + (JSC::dateProtoFuncGetMilliSeconds): + (JSC::dateProtoFuncGetUTCMilliseconds): + (JSC::dateProtoFuncGetTimezoneOffset): + (JSC::dateProtoFuncSetTime): + (JSC::dateProtoFuncSetMilliSeconds): + (JSC::dateProtoFuncSetUTCMilliseconds): + (JSC::dateProtoFuncSetSeconds): + (JSC::dateProtoFuncSetUTCSeconds): + (JSC::dateProtoFuncSetMinutes): + (JSC::dateProtoFuncSetUTCMinutes): + (JSC::dateProtoFuncSetHours): + (JSC::dateProtoFuncSetUTCHours): + (JSC::dateProtoFuncSetDate): + (JSC::dateProtoFuncSetUTCDate): + (JSC::dateProtoFuncSetMonth): + (JSC::dateProtoFuncSetUTCMonth): + (JSC::dateProtoFuncSetFullYear): + (JSC::dateProtoFuncSetUTCFullYear): + (JSC::dateProtoFuncSetYear): + (JSC::dateProtoFuncGetYear): + (JSC::dateProtoFuncToJSON): + * runtime/ErrorConstructor.cpp: + (JSC::callErrorConstructor): + * runtime/ErrorPrototype.cpp: + (JSC::errorProtoFuncToString): + * runtime/FunctionConstructor.cpp: + (JSC::callFunctionConstructor): + * runtime/FunctionPrototype.cpp: + (JSC::callFunctionPrototype): + (JSC::functionProtoFuncToString): + (JSC::functionProtoFuncApply): + (JSC::functionProtoFuncCall): + * runtime/JSCell.h: + (JSC::getCallData): + (JSC::getConstructData): + * runtime/JSFunction.cpp: + (JSC::callHostFunctionAsConstructor): + * runtime/JSFunction.h: + * runtime/JSGlobalObjectFunctions.cpp: + (JSC::globalFuncEval): + (JSC::globalFuncParseInt): + (JSC::globalFuncParseFloat): + (JSC::globalFuncIsNaN): + (JSC::globalFuncIsFinite): + (JSC::globalFuncDecodeURI): + (JSC::globalFuncDecodeURIComponent): + (JSC::globalFuncEncodeURI): + (JSC::globalFuncEncodeURIComponent): + (JSC::globalFuncEscape): + (JSC::globalFuncUnescape): + (JSC::globalFuncJSCPrint): + * runtime/JSGlobalObjectFunctions.h: + * runtime/JSONObject.cpp: + (JSC::JSONProtoFuncParse): + (JSC::JSONProtoFuncStringify): + * runtime/JSObject.cpp: + (JSC::callDefaultValueFunction): + * runtime/JSValue.h: + * runtime/MathObject.cpp: + (JSC::mathProtoFuncAbs): + (JSC::mathProtoFuncACos): + (JSC::mathProtoFuncASin): + (JSC::mathProtoFuncATan): + (JSC::mathProtoFuncATan2): + (JSC::mathProtoFuncCeil): + (JSC::mathProtoFuncCos): + (JSC::mathProtoFuncExp): + (JSC::mathProtoFuncFloor): + (JSC::mathProtoFuncLog): + (JSC::mathProtoFuncMax): + (JSC::mathProtoFuncMin): + (JSC::mathProtoFuncPow): + (JSC::mathProtoFuncRandom): + (JSC::mathProtoFuncRound): + (JSC::mathProtoFuncSin): + (JSC::mathProtoFuncSqrt): + (JSC::mathProtoFuncTan): + * runtime/NativeErrorConstructor.cpp: + (JSC::callNativeErrorConstructor): + * runtime/NumberConstructor.cpp: + (JSC::callNumberConstructor): + * runtime/NumberPrototype.cpp: + (JSC::numberProtoFuncToString): + (JSC::numberProtoFuncToLocaleString): + (JSC::numberProtoFuncValueOf): + (JSC::numberProtoFuncToFixed): + (JSC::numberProtoFuncToExponential): + (JSC::numberProtoFuncToPrecision): + * runtime/ObjectConstructor.cpp: + (JSC::callObjectConstructor): + (JSC::objectConstructorGetPrototypeOf): + (JSC::objectConstructorGetOwnPropertyDescriptor): + (JSC::objectConstructorGetOwnPropertyNames): + (JSC::objectConstructorKeys): + (JSC::toPropertyDescriptor): + (JSC::objectConstructorDefineProperty): + (JSC::objectConstructorDefineProperties): + (JSC::objectConstructorCreate): + * runtime/ObjectPrototype.cpp: + (JSC::objectProtoFuncValueOf): + (JSC::objectProtoFuncHasOwnProperty): + (JSC::objectProtoFuncIsPrototypeOf): + (JSC::objectProtoFuncDefineGetter): + (JSC::objectProtoFuncDefineSetter): + (JSC::objectProtoFuncLookupGetter): + (JSC::objectProtoFuncLookupSetter): + (JSC::objectProtoFuncPropertyIsEnumerable): + (JSC::objectProtoFuncToLocaleString): + (JSC::objectProtoFuncToString): + * runtime/ObjectPrototype.h: + * runtime/RegExpConstructor.cpp: + (JSC::callRegExpConstructor): + * runtime/RegExpObject.cpp: + (JSC::callRegExpObject): + * runtime/RegExpPrototype.cpp: + (JSC::regExpProtoFuncTest): + (JSC::regExpProtoFuncExec): + (JSC::regExpProtoFuncCompile): + (JSC::regExpProtoFuncToString): + * runtime/StringConstructor.cpp: + (JSC::stringFromCharCode): + (JSC::callStringConstructor): + * runtime/StringPrototype.cpp: + (JSC::stringProtoFuncReplace): + (JSC::stringProtoFuncToString): + (JSC::stringProtoFuncCharAt): + (JSC::stringProtoFuncCharCodeAt): + (JSC::stringProtoFuncConcat): + (JSC::stringProtoFuncIndexOf): + (JSC::stringProtoFuncLastIndexOf): + (JSC::stringProtoFuncMatch): + (JSC::stringProtoFuncSearch): + (JSC::stringProtoFuncSlice): + (JSC::stringProtoFuncSplit): + (JSC::stringProtoFuncSubstr): + (JSC::stringProtoFuncSubstring): + (JSC::stringProtoFuncToLowerCase): + (JSC::stringProtoFuncToUpperCase): + (JSC::stringProtoFuncLocaleCompare): + (JSC::stringProtoFuncBig): + (JSC::stringProtoFuncSmall): + (JSC::stringProtoFuncBlink): + (JSC::stringProtoFuncBold): + (JSC::stringProtoFuncFixed): + (JSC::stringProtoFuncItalics): + (JSC::stringProtoFuncStrike): + (JSC::stringProtoFuncSub): + (JSC::stringProtoFuncSup): + (JSC::stringProtoFuncFontcolor): + (JSC::stringProtoFuncFontsize): + (JSC::stringProtoFuncAnchor): + (JSC::stringProtoFuncLink): + (JSC::stringProtoFuncTrim): + (JSC::stringProtoFuncTrimLeft): + (JSC::stringProtoFuncTrimRight): + +2010-06-02 Mark Rowe + + Reviewed by Gavin Barraclough. + + Add value-representation specific sections to the mac export file. + + * Configurations/JavaScriptCore.xcconfig: + * DerivedSources.make: + * JavaScriptCore.JSVALUE32_64only.exp: Added. + * JavaScriptCore.JSVALUE32only.exp: Added. + * JavaScriptCore.JSVALUE64only.exp: Added. + * JavaScriptCore.xcodeproj/project.pbxproj: + +2010-06-02 Mark Rowe + + Reviewed by Gavin Barraclough. + + Work around an LLVM GCC code generation bug that results in crashes inside PCRE. + + * pcre/pcre_exec.cpp: + (repeatInformationFromInstructionOffset): Change the type of instructionOffset to int. There's no good + reason for it to be a short, and using int prevents this code from triggering the LLVM GCC bug. + +2010-06-02 Jedrzej Nowacki + + Reviewed by Kenneth Rohde Christiansen. + + Fix the QScriptValue::strictlyEquals function. + + Handling for a few edge cases was added. + + New autotest that covers the QScriptValue::strictlyEquals function. + + [Qt] QScriptValue::strictlyEquals is broken + https://bugs.webkit.org/show_bug.cgi?id=36600 + + * qt/api/qscriptvalue.cpp: + (QScriptValue::strictlyEquals): + * qt/api/qscriptvalue_p.h: + (QScriptValuePrivate::strictlyEquals): + * qt/tests/qscriptvalue/qscriptvalue.pro: + * qt/tests/qscriptvalue/tst_qscriptvalue.h: + * qt/tests/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp: Added. + (tst_QScriptValue::strictlyEquals_initData): + (tst_QScriptValue::strictlyEquals_makeData): + (tst_QScriptValue::strictlyEquals_test): + +2010-06-02 Jedrzej Nowacki + + Reviewed by Kenneth Rohde Christiansen. + + New function QScriptEngine::newObject. + + The function creates a object of class Object and returns it + as a QScriptValue. + + [Qt] QScriptEngine API should contain a newObject function + https://bugs.webkit.org/show_bug.cgi?id=39114 + + * qt/api/qscriptengine.cpp: + (QScriptEngine::newObject): + * qt/api/qscriptengine.h: + * qt/api/qscriptengine_p.cpp: + (QScriptEnginePrivate::newObject): + * qt/api/qscriptengine_p.h: + * qt/tests/qscriptengine/tst_qscriptengine.cpp: + (tst_QScriptEngine::newObject): + +2010-06-02 Gabor Loki + + Reviewed by Gavin Barraclough. + https://bugs.webkit.org/show_bug.cgi?id=40011 + + Thumb-2 build fix: The offset parameter of ldrh should be encoded as an + imm12 immediate constant in load16. If it is not fit in the instruction + a temporary register has to be used. + + * assembler/MacroAssemblerARMv7.h: + (JSC::MacroAssemblerARMv7::load16): + +2010-06-02 Sterling Swigart + + Reviewed by David Levin. + + Image Resizer Patch 0: Added compilation argument to conditionally compile pending patches. + https://bugs.webkit.org/show_bug.cgi?id=39906 + + * Configurations/FeatureDefines.xcconfig: + +2010-06-01 Gavin Barraclough + + Reviewed by Sam Weinig. + + Bug 40021 - Refactor bytecode generation for calls so that register for this & args are allocated together + + This is a useful stepping stone towards reversing argument order. + + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::BytecodeGenerator): + (JSC::BytecodeGenerator::addParameter): + (JSC::BytecodeGenerator::emitCall): + (JSC::BytecodeGenerator::emitCallEval): + (JSC::BytecodeGenerator::emitConstruct): + * bytecompiler/BytecodeGenerator.h: + (JSC::CallArguments::thisRegister): + (JSC::CallArguments::argumentRegister): + (JSC::CallArguments::callFrame): + (JSC::CallArguments::count): + (JSC::BytecodeGenerator::shouldEmitProfileHooks): + * bytecompiler/NodesCodegen.cpp: + (JSC::NewExprNode::emitBytecode): + (JSC::CallArguments::CallArguments): + (JSC::EvalFunctionCallNode::emitBytecode): + (JSC::FunctionCallValueNode::emitBytecode): + (JSC::FunctionCallResolveNode::emitBytecode): + (JSC::FunctionCallBracketNode::emitBytecode): + (JSC::FunctionCallDotNode::emitBytecode): + (JSC::CallFunctionCallDotNode::emitBytecode): + (JSC::ApplyFunctionCallDotNode::emitBytecode): + +2010-06-01 Yong Li + + Reviewed by Darin Adler. + + Explicitly use PTHREAD_MUTEX_NORMAL to create pthread mutex. + https://bugs.webkit.org/show_bug.cgi?id=39893 + + * wtf/ThreadingPthreads.cpp: + (WTF::Mutex::Mutex): + +2010-06-01 Kwang Yul Seo + + Reviewed by Xan Lopez. + + [GTK] Use DEFINE_STATIC_LOCAL for threadMapMutex and threadMap + https://bugs.webkit.org/show_bug.cgi?id=39831 + + Use DEFINE_STATIC_LOCAL for static local variables. + + * wtf/gtk/ThreadingGtk.cpp: + (WTF::threadMapMutex): + (WTF::threadMap): + (WTF::identifierByGthreadHandle): + 2010-06-01 Kent Tamura Reviewed by Shinichiro Hamaji. diff --git a/JavaScriptCore/Configurations/FeatureDefines.xcconfig b/JavaScriptCore/Configurations/FeatureDefines.xcconfig index c64d94c..5b52793 100644 --- a/JavaScriptCore/Configurations/FeatureDefines.xcconfig +++ b/JavaScriptCore/Configurations/FeatureDefines.xcconfig @@ -55,9 +55,11 @@ ENABLE_FILE_READER = ENABLE_FILE_READER; ENABLE_FILE_WRITER = ; ENABLE_GEOLOCATION = ENABLE_GEOLOCATION; ENABLE_ICONDATABASE = ENABLE_ICONDATABASE; +ENABLE_IMAGE_RESIZER = ; ENABLE_INDEXED_DATABASE = ; ENABLE_JAVASCRIPT_DEBUGGER = ENABLE_JAVASCRIPT_DEBUGGER; ENABLE_MATHML = ; +ENABLE_METER_TAG = ENABLE_METER_TAG; ENABLE_NOTIFICATIONS = ; ENABLE_OFFLINE_WEB_APPLICATIONS = ENABLE_OFFLINE_WEB_APPLICATIONS; ENABLE_PROGRESS_TAG = ENABLE_PROGRESS_TAG; @@ -79,4 +81,4 @@ ENABLE_XHTMLMP = ; ENABLE_XPATH = ENABLE_XPATH; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(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_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(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/JavaScriptCore.xcconfig b/JavaScriptCore/Configurations/JavaScriptCore.xcconfig index b6ba560..8c2f26d 100644 --- a/JavaScriptCore/Configurations/JavaScriptCore.xcconfig +++ b/JavaScriptCore/Configurations/JavaScriptCore.xcconfig @@ -24,14 +24,16 @@ #include "FeatureDefines.xcconfig" #include "Version.xcconfig" -EXPORTED_SYMBOLS_FILE = $(EXPORTED_SYMBOLS_FILE_$(CURRENT_ARCH)); -EXPORTED_SYMBOLS_FILE_ = JavaScriptCore.exp; -EXPORTED_SYMBOLS_FILE_armv6 = JavaScriptCore.exp; -EXPORTED_SYMBOLS_FILE_armv7 = JavaScriptCore.exp; -EXPORTED_SYMBOLS_FILE_i386 = JavaScriptCore.exp; -EXPORTED_SYMBOLS_FILE_ppc = JavaScriptCore.exp; -EXPORTED_SYMBOLS_FILE_ppc64 = $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/JavaScriptCore.LP64.exp; -EXPORTED_SYMBOLS_FILE_x86_64 = $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/JavaScriptCore.LP64.exp; +JSVALUE_MODEL = $(JSVALUE_MODEL_$(CURRENT_ARCH)); +JSVALUE_MODEL_ = UNKNOWN_JSVALUE_MODEL; +JSVALUE_MODEL_armv6 = 32; +JSVALUE_MODEL_armv7 = 32; +JSVALUE_MODEL_i386 = 32_64; +JSVALUE_MODEL_ppc = 32_64; +JSVALUE_MODEL_ppc64 = 32; +JSVALUE_MODEL_x86_64 = 64; + +EXPORTED_SYMBOLS_FILE = $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/JavaScriptCore.JSVALUE$(JSVALUE_MODEL).exp; OTHER_LDFLAGS_BASE = -lobjc -Wl,-Y,3; OTHER_LDFLAGS = $(OTHER_LDFLAGS_$(REAL_PLATFORM_NAME)); OTHER_LDFLAGS_iphoneos = $(OTHER_LDFLAGS_BASE); diff --git a/JavaScriptCore/DerivedSources.make b/JavaScriptCore/DerivedSources.make index 4fc9cad..37020f1 100644 --- a/JavaScriptCore/DerivedSources.make +++ b/JavaScriptCore/DerivedSources.make @@ -49,6 +49,9 @@ all : \ StringPrototype.lut.h \ docs/bytecode.html \ RegExpJitTables.h \ + JavaScriptCore.JSVALUE32.exp \ + JavaScriptCore.JSVALUE32_64.exp \ + JavaScriptCore.JSVALUE64.exp \ # # lookup tables for classes @@ -79,3 +82,12 @@ docs/bytecode.html: make-bytecode-docs.pl Interpreter.cpp #character tables for Yarr RegExpJitTables.h: create_regex_tables python $^ > $@ + +JavaScriptCore.JSVALUE32.exp: JavaScriptCore.exp JavaScriptCore.JSVALUE32only.exp + cat $^ > $@ + +JavaScriptCore.JSVALUE32_64.exp: JavaScriptCore.exp JavaScriptCore.JSVALUE32_64only.exp + cat $^ > $@ + +JavaScriptCore.JSVALUE64.exp: JavaScriptCore.exp JavaScriptCore.JSVALUE64only.exp + cat $^ > $@ diff --git a/JavaScriptCore/JavaScriptCore.JSVALUE32_64only.exp b/JavaScriptCore/JavaScriptCore.JSVALUE32_64only.exp new file mode 100644 index 0000000..7e520ae --- /dev/null +++ b/JavaScriptCore/JavaScriptCore.JSVALUE32_64only.exp @@ -0,0 +1,2 @@ +__ZN3JSC10JSFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFxS2_E +__ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFxS2_E diff --git a/JavaScriptCore/JavaScriptCore.JSVALUE32only.exp b/JavaScriptCore/JavaScriptCore.JSVALUE32only.exp new file mode 100644 index 0000000..73efb9d --- /dev/null +++ b/JavaScriptCore/JavaScriptCore.JSVALUE32only.exp @@ -0,0 +1,2 @@ +__ZN3JSC10JSFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFPvS2_E +__ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFPvS2_E diff --git a/JavaScriptCore/JavaScriptCore.JSVALUE64only.exp b/JavaScriptCore/JavaScriptCore.JSVALUE64only.exp new file mode 100644 index 0000000..73efb9d --- /dev/null +++ b/JavaScriptCore/JavaScriptCore.JSVALUE64only.exp @@ -0,0 +1,2 @@ +__ZN3JSC10JSFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFPvS2_E +__ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFPvS2_E diff --git a/JavaScriptCore/JavaScriptCore.exp b/JavaScriptCore/JavaScriptCore.exp index 3985d4e..93e01e2 100644 --- a/JavaScriptCore/JavaScriptCore.exp +++ b/JavaScriptCore/JavaScriptCore.exp @@ -109,14 +109,13 @@ __ZN3JSC10Identifier4fromEPNS_9ExecStateEj __ZN3JSC10Identifier5equalEPKN7WebCore10StringImplEPKc __ZN3JSC10JSFunction4infoE __ZN3JSC10JSFunction4nameEPNS_9ExecStateE -__ZN3JSC10JSFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFNS_7JSValueES2_E -__ZN3JSC10throwErrorEPNS_9ExecStateENS_9ErrorTypeE -__ZN3JSC10throwErrorEPNS_9ExecStateENS_9ErrorTypeEPKc -__ZN3JSC10throwErrorEPNS_9ExecStateENS_9ErrorTypeERKNS_7UStringE +__ZN3JSC10throwErrorEPNS_9ExecStateENS_7JSValueE +__ZN3JSC10throwErrorEPNS_9ExecStateEPNS_8JSObjectE __ZN3JSC11JSByteArray15createStructureENS_7JSValueE __ZN3JSC11JSByteArrayC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPNS3_9ByteArrayEPKNS_9ClassInfoE __ZN3JSC11ParserArena5resetEv __ZN3JSC11checkSyntaxEPNS_9ExecStateERKNS_10SourceCodeE +__ZN3JSC11createErrorEPNS_9ExecStateERKNS_7UStringE __ZN3JSC12DateInstance4infoE __ZN3JSC12DateInstanceC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEd __ZN3JSC12DateInstanceC1EPNS_9ExecStateEd @@ -162,8 +161,9 @@ __ZN3JSC14SamplingThread4stopEv __ZN3JSC14SamplingThread5startEj __ZN3JSC14TimeoutChecker10didTimeOutEPNS_9ExecStateE __ZN3JSC14TimeoutChecker5resetEv +__ZN3JSC14throwTypeErrorEPNS_9ExecStateE __ZN3JSC15JSWrapperObject12markChildrenERNS_9MarkStackE -__ZN3JSC15createTypeErrorEPNS_9ExecStateEPKc +__ZN3JSC15createTypeErrorEPNS_9ExecStateERKNS_7UStringE __ZN3JSC15toInt32SlowCaseEdRb __ZN3JSC16InternalFunction4infoE __ZN3JSC16InternalFunction4nameEPNS_9ExecStateE @@ -171,11 +171,13 @@ __ZN3JSC16InternalFunctionC2EPNS_12JSGlobalDataEPNS_14JSGlobalObjectEN3WTF17NonN __ZN3JSC16JSVariableObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE __ZN3JSC16JSVariableObject14symbolTableGetERKNS_10IdentifierERNS_18PropertyDescriptorE __ZN3JSC16JSVariableObject19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE +__ZN3JSC16createRangeErrorEPNS_9ExecStateERKNS_7UStringE +__ZN3JSC16throwSyntaxErrorEPNS_9ExecStateE __ZN3JSC16toUInt32SlowCaseEdRb __ZN3JSC17BytecodeGenerator21setDumpsGeneratedCodeEb __ZN3JSC17PropertyNameArray3addEPN7WebCore10StringImplE -__ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFNS_7JSValueES2_E __ZN3JSC17constructFunctionEPNS_9ExecStateERKNS_7ArgListERKNS_10IdentifierERKNS_7UStringEi +__ZN3JSC17createSyntaxErrorEPNS_9ExecStateERKNS_7UStringE __ZN3JSC18DebuggerActivationC1EPNS_8JSObjectE __ZN3JSC18PropertyDescriptor11setWritableEb __ZN3JSC18PropertyDescriptor12setUndefinedEv @@ -188,6 +190,7 @@ __ZN3JSC18PropertyDescriptor9setGetterENS_7JSValueE __ZN3JSC18PropertyDescriptor9setSetterENS_7JSValueE __ZN3JSC19initializeThreadingEv __ZN3JSC20MarkedArgumentBuffer10slowAppendENS_7JSValueE +__ZN3JSC20createReferenceErrorEPNS_9ExecStateERKNS_7UStringE __ZN3JSC23AbstractSamplingCounter4dumpEv __ZN3JSC23objectProtoFuncToStringEPNS_9ExecStateE __ZN3JSC23setUpStaticFunctionSlotEPNS_9ExecStateEPKNS_9HashEntryEPNS_8JSObjectERKNS_10IdentifierERNS_12PropertySlotE @@ -268,6 +271,9 @@ __ZN3JSC8JSObject17createInheritorIDEv __ZN3JSC8JSObject17defineOwnPropertyEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorEb __ZN3JSC8JSObject17putDirectFunctionEPNS_9ExecStateEPNS_10JSFunctionEj __ZN3JSC8JSObject17putDirectFunctionEPNS_9ExecStateEPNS_16InternalFunctionEj +__ZN3JSC8JSObject17putWithAttributesEPNS_12JSGlobalDataERKNS_10IdentifierENS_7JSValueEj +__ZN3JSC8JSObject17putWithAttributesEPNS_12JSGlobalDataERKNS_10IdentifierENS_7JSValueEjbRNS_15PutPropertySlotE +__ZN3JSC8JSObject17putWithAttributesEPNS_12JSGlobalDataEjNS_7JSValueEj __ZN3JSC8JSObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueEj __ZN3JSC8JSObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueEjbRNS_15PutPropertySlotE __ZN3JSC8JSObject17putWithAttributesEPNS_9ExecStateEjNS_7JSValueEj @@ -390,6 +396,7 @@ __ZN7WebCore10StringImpl4findEPKcib __ZN7WebCore10StringImpl4findEPS0_ib __ZN7WebCore10StringImpl4findEti __ZN7WebCore10StringImpl5adoptERNS_12StringBufferE +__ZN7WebCore10StringImpl5asciiEv __ZN7WebCore10StringImpl5emptyEv __ZN7WebCore10StringImpl5lowerEv __ZN7WebCore10StringImpl5toIntEPb @@ -415,6 +422,7 @@ __ZN7WebCore12AtomicString3addEPKtjj __ZN7WebCore12AtomicString4findEPKtjj __ZN7WebCore12AtomicString4initEv __ZN7WebCore15charactersToIntEPKtmPb +__ZN7WebCore16codePointCompareERKNS_6StringES2_ __ZN7WebCore17charactersToFloatEPKtmPb __ZN7WebCore17equalIgnoringCaseEPKtPKcj __ZN7WebCore17equalIgnoringCaseEPNS_10StringImplEPKc diff --git a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def index 1176bcf..a6ff1c2 100644 --- a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def +++ b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def @@ -10,11 +10,11 @@ EXPORTS ??0JSArray@JSC@@QAE@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@@Z ??0JSArray@JSC@@QAE@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@ABVArgList@1@@Z ??0JSByteArray@JSC@@QAE@PAVExecState@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@PAVByteArray@4@PBUClassInfo@1@@Z - ??0JSFunction@JSC@@QAE@PAVExecState@1@PAVJSGlobalObject@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@HABVIdentifier@1@P6I?AVJSValue@1@0@Z@Z + ??0JSFunction@JSC@@QAE@PAVExecState@1@PAVJSGlobalObject@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@HABVIdentifier@1@P6I_J0@Z@Z ??0JSObjectWithGlobalObject@JSC@@IAE@PAVJSGlobalObject@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@@Z ??0MD5@WTF@@QAE@XZ ??0Mutex@WTF@@QAE@XZ - ??0PrototypeFunction@JSC@@QAE@PAVExecState@1@PAVJSGlobalObject@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@HABVIdentifier@1@P6I?AVJSValue@1@0@Z@Z + ??0PrototypeFunction@JSC@@QAE@PAVExecState@1@PAVJSGlobalObject@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@HABVIdentifier@1@P6I_J0@Z@Z ??0RefCountedLeakCounter@WTF@@QAE@PBD@Z ??0StringObject@JSC@@QAE@PAVExecState@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@ABVUString@1@@Z ??0Structure@JSC@@AAE@VJSValue@1@ABVTypeInfo@1@I@Z @@ -78,16 +78,19 @@ EXPORTS ?create@JSGlobalData@JSC@@SA?AV?$PassRefPtr@VJSGlobalData@JSC@@@WTF@@W4ThreadStackType@2@@Z ?create@OpaqueJSString@@SA?AV?$PassRefPtr@UOpaqueJSString@@@WTF@@ABVUString@JSC@@@Z ?createEmptyString@SmallStrings@JSC@@AAEXPAVJSGlobalData@2@@Z + ?createError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z ?createInheritorID@JSObject@JSC@@AAEPAVStructure@2@XZ ?createInterruptedExecutionException@JSC@@YA?AVJSValue@1@PAVJSGlobalData@1@@Z ?createLeaked@JSGlobalData@JSC@@SA?AV?$PassRefPtr@VJSGlobalData@JSC@@@WTF@@W4ThreadStackType@2@@Z + ?createReferenceError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z ?createSingleCharacterString@SmallStrings@JSC@@AAEXPAVJSGlobalData@2@E@Z - ?createStackOverflowError@JSC@@YA?AVJSValue@1@PAVExecState@1@@Z + ?createStackOverflowError@JSC@@YAPAVJSObject@1@PAVExecState@1@@Z ?createStructure@JSByteArray@JSC@@SA?AV?$PassRefPtr@VStructure@JSC@@@WTF@@VJSValue@2@@Z + ?createSyntaxError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z ?createTable@HashTable@JSC@@ABEXPAVJSGlobalData@2@@Z ?createThread@WTF@@YAIP6APAXPAX@Z0@Z ?createThread@WTF@@YAIP6APAXPAX@Z0PBD@Z - ?createTypeError@JSC@@YA?AVJSValue@1@PAVExecState@1@PBD@Z + ?createTypeError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z ?currentThread@WTF@@YAIXZ ?currentTime@WTF@@YANXZ ?data@CString@WTF@@QBEPBDXZ @@ -220,7 +223,7 @@ EXPORTS ?newUninitialized@CString@WTF@@SA?AV12@IAAPAD@Z ?nonInlineNaN@JSC@@YANXZ ?objectCount@Heap@JSC@@QBEIXZ - ?objectProtoFuncToString@JSC@@YI?AVJSValue@1@PAVExecState@1@@Z + ?objectProtoFuncToString@JSC@@YI_JPAVExecState@1@@Z ?parse@Parser@JSC@@AAEXPAVJSGlobalData@2@PAHPAVUString@2@@Z ?parseDateFromNullTerminatedCharacters@WTF@@YANPBD@Z ?profiler@Profiler@JSC@@SAPAV12@XZ @@ -240,6 +243,9 @@ EXPORTS ?putWithAttributes@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@VJSValue@2@I@Z ?putWithAttributes@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@VJSValue@2@I_NAAVPutPropertySlot@2@@Z ?putWithAttributes@JSObject@JSC@@UAEXPAVExecState@2@IVJSValue@2@I@Z + ?putWithAttributes@JSObject@JSC@@UAEXPAVJSGlobalData@2@ABVIdentifier@2@VJSValue@2@I@Z + ?putWithAttributes@JSObject@JSC@@UAEXPAVJSGlobalData@2@ABVIdentifier@2@VJSValue@2@I_NAAVPutPropertySlot@2@@Z + ?putWithAttributes@JSObject@JSC@@UAEXPAVJSGlobalData@2@IVJSValue@2@I@Z ?randomNumber@WTF@@YANXZ ?recompileAllJSFunctions@Debugger@JSC@@QAEXPAVJSGlobalData@2@@Z ?recordExtraCost@Heap@JSC@@AAEXI@Z @@ -280,9 +286,10 @@ EXPORTS ?symbolTableGet@JSVariableObject@JSC@@IAE_NABVIdentifier@2@AAVPropertyDescriptor@2@@Z ?synthesizePrototype@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z ?thisObject@DebuggerCallFrame@JSC@@QBEPAVJSObject@2@XZ - ?throwError@JSC@@YAPAVJSObject@1@PAVExecState@1@W4ErrorType@1@@Z - ?throwError@JSC@@YAPAVJSObject@1@PAVExecState@1@W4ErrorType@1@ABVUString@1@@Z - ?throwError@JSC@@YAPAVJSObject@1@PAVExecState@1@W4ErrorType@1@PBD@Z + ?throwError@JSC@@YA?AVJSValue@1@PAVExecState@1@V21@@Z + ?throwError@JSC@@YAPAVJSObject@1@PAVExecState@1@PAV21@@Z + ?throwSyntaxError@JSC@@YAPAVJSObject@1@PAVExecState@1@@Z + ?throwTypeError@JSC@@YAPAVJSObject@1@PAVExecState@1@@Z ?timedWait@ThreadCondition@WTF@@QAE_NAAVMutex@2@N@Z ?tlsKeyCount@WTF@@YAAAJXZ ?tlsKeys@WTF@@YAPAKXZ diff --git a/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj index 8d10ab3..3b448c5 100644 --- a/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj +++ b/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj @@ -766,6 +766,9 @@ 86565740115BE3DA00291F40 /* CString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CString.cpp; path = text/CString.cpp; sourceTree = ""; }; 86565741115BE3DA00291F40 /* CString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CString.h; path = text/CString.h; sourceTree = ""; }; 865F408710E7D56300947361 /* APIShims.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIShims.h; sourceTree = ""; }; + 867FC35F11B763950025105E /* JavaScriptCore.JSVALUE32_64only.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; path = JavaScriptCore.JSVALUE32_64only.exp; sourceTree = ""; }; + 867FC36011B763950025105E /* JavaScriptCore.JSVALUE32only.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; path = JavaScriptCore.JSVALUE32only.exp; sourceTree = ""; }; + 867FC36111B763950025105E /* JavaScriptCore.JSVALUE64only.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; path = JavaScriptCore.JSVALUE64only.exp; sourceTree = ""; }; 868BFA00117CEFD100B908B1 /* AtomicString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AtomicString.cpp; path = text/AtomicString.cpp; sourceTree = ""; }; 868BFA01117CEFD100B908B1 /* AtomicString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AtomicString.h; path = text/AtomicString.h; sourceTree = ""; }; 868BFA02117CEFD100B908B1 /* AtomicStringImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AtomicStringImpl.h; path = text/AtomicStringImpl.h; sourceTree = ""; }; @@ -1162,6 +1165,9 @@ 937B63CC09E766D200A671DD /* DerivedSources.make */, F692A8540255597D01FF60F7 /* create_hash_table */, 14B8ECA60A5653980062BE54 /* JavaScriptCore.exp */, + 867FC36011B763950025105E /* JavaScriptCore.JSVALUE32only.exp */, + 867FC35F11B763950025105E /* JavaScriptCore.JSVALUE32_64only.exp */, + 867FC36111B763950025105E /* JavaScriptCore.JSVALUE64only.exp */, F5C290E60284F98E018635CA /* JavaScriptCorePrefix.h */, 45E12D8806A49B0F00E9DF84 /* jsc.cpp */, F68EBB8C0255D4C601FF60F7 /* config.h */, @@ -2210,7 +2216,6 @@ 5D2F7CF90C6875BB00B5B72B /* Update Info.plist with version information */, 932F5B3F0822A1C700736975 /* Headers */, 932F5B910822A1C700736975 /* Sources */, - 1C395CBC0C6BCC16000D1E52 /* Generate 64-bit Export File */, 932F5BD20822A1C700736975 /* Frameworks */, 9319586B09D9F91A00A56FD4 /* Check For Global Initializers */, 933457200EBFDC3F00B80894 /* Check For Exit Time Destructors */, @@ -2297,22 +2302,6 @@ shellPath = /bin/sh; shellScript = "cp \"${SRCROOT}/API/tests/testapi.js\" \"${BUILT_PRODUCTS_DIR}\""; }; - 1C395CBC0C6BCC16000D1E52 /* Generate 64-bit Export File */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "$(SRCROOT)/JavaScriptCore.exp", - ); - name = "Generate 64-bit Export File"; - outputPaths = ( - "$(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/JavaScriptCore.LP64.exp", - ); - runOnlyForDeploymentPostprocessing = 0; - 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 and Externals */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; diff --git a/JavaScriptCore/assembler/MacroAssemblerARMv7.h b/JavaScriptCore/assembler/MacroAssemblerARMv7.h index 31a68d9..380d5f8 100644 --- a/JavaScriptCore/assembler/MacroAssemblerARMv7.h +++ b/JavaScriptCore/assembler/MacroAssemblerARMv7.h @@ -459,7 +459,13 @@ public: void load16(ImplicitAddress address, RegisterID dest) { - m_assembler.ldrh(dest, address.base, address.offset); + ARMThumbImmediate armImm = ARMThumbImmediate::makeUInt12(address.offset); + if (armImm.isValid()) + m_assembler.ldrh(dest, address.base, armImm); + else { + move(Imm32(address.offset), dataTempRegister); + m_assembler.ldrh(dest, address.base, dataTempRegister); + } } DataLabel32 store32WithAddressOffsetPatch(RegisterID src, Address address) diff --git a/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp index bebfdbb..777e1e6 100644 --- a/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp +++ b/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp @@ -357,16 +357,15 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, const Debug FunctionParameters& parameters = *functionBody->parameters(); size_t parameterCount = parameters.size(); - m_nextParameterIndex = -RegisterFile::CallFrameHeaderSize - parameterCount - 1; + int nextParameterIndex = -RegisterFile::CallFrameHeaderSize - parameterCount - 1; m_parameters.grow(1 + parameterCount); // reserve space for "this" // Add "this" as a parameter - m_thisRegister.setIndex(m_nextParameterIndex); - ++m_nextParameterIndex; + m_thisRegister.setIndex(nextParameterIndex); ++m_codeBlock->m_numParameters; for (size_t i = 0; i < parameterCount; ++i) - addParameter(parameters[i]); + addParameter(parameters[i], ++nextParameterIndex); preserveLastVar(); @@ -431,23 +430,19 @@ BytecodeGenerator::BytecodeGenerator(EvalNode* evalNode, const Debugger* debugge preserveLastVar(); } -RegisterID* BytecodeGenerator::addParameter(const Identifier& ident) +void BytecodeGenerator::addParameter(const Identifier& ident, int parameterIndex) { // Parameters overwrite var declarations, but not function declarations. - RegisterID* result = 0; UString::Rep* rep = ident.ustring().rep(); if (!m_functions.contains(rep)) { - symbolTable().set(rep, m_nextParameterIndex); - RegisterID& parameter = registerFor(m_nextParameterIndex); - parameter.setIndex(m_nextParameterIndex); - result = ¶meter; + symbolTable().set(rep, parameterIndex); + RegisterID& parameter = registerFor(parameterIndex); + parameter.setIndex(parameterIndex); } // To maintain the calling convention, we have to allocate unique space for // each parameter, even if the parameter doesn't make it into the symbol table. - ++m_nextParameterIndex; ++m_codeBlock->m_numParameters; - return result; } RegisterID* BytecodeGenerator::registerFor(const Identifier& ident) @@ -1415,9 +1410,9 @@ RegisterID* BytecodeGenerator::emitNewFunctionExpression(RegisterID* r0, FuncExp return r0; } -RegisterID* BytecodeGenerator::emitCall(RegisterID* dst, RegisterID* func, RegisterID* thisRegister, ArgumentsNode* argumentsNode, unsigned divot, unsigned startOffset, unsigned endOffset) +RegisterID* BytecodeGenerator::emitCall(RegisterID* dst, RegisterID* func, CallArguments& callArguments, unsigned divot, unsigned startOffset, unsigned endOffset) { - return emitCall(op_call, dst, func, thisRegister, argumentsNode, divot, startOffset, endOffset); + return emitCall(op_call, dst, func, callArguments, divot, startOffset, endOffset); } void BytecodeGenerator::createArgumentsIfNecessary() @@ -1430,40 +1425,23 @@ void BytecodeGenerator::createArgumentsIfNecessary() instructions().append(m_codeBlock->argumentsRegister()); } -RegisterID* BytecodeGenerator::emitCallEval(RegisterID* dst, RegisterID* func, RegisterID* thisRegister, ArgumentsNode* argumentsNode, unsigned divot, unsigned startOffset, unsigned endOffset) +RegisterID* BytecodeGenerator::emitCallEval(RegisterID* dst, RegisterID* func, CallArguments& callArguments, unsigned divot, unsigned startOffset, unsigned endOffset) { - return emitCall(op_call_eval, dst, func, thisRegister, argumentsNode, divot, startOffset, endOffset); + return emitCall(op_call_eval, dst, func, callArguments, divot, startOffset, endOffset); } -RegisterID* BytecodeGenerator::emitCall(OpcodeID opcodeID, RegisterID* dst, RegisterID* func, RegisterID* thisRegister, ArgumentsNode* argumentsNode, unsigned divot, unsigned startOffset, unsigned endOffset) +RegisterID* BytecodeGenerator::emitCall(OpcodeID opcodeID, RegisterID* dst, RegisterID* func, CallArguments& callArguments, unsigned divot, unsigned startOffset, unsigned endOffset) { ASSERT(opcodeID == op_call || opcodeID == op_call_eval); ASSERT(func->refCount()); - ASSERT(thisRegister->refCount()); - RegisterID* originalFunc = func; - if (m_shouldEmitProfileHooks) { - // If codegen decided to recycle func as this call's destination register, - // we need to undo that optimization here so that func will still be around - // for the sake of op_profile_did_call. - if (dst == func) { - RefPtr movedThisRegister = emitMove(newTemporary(), thisRegister); - RefPtr movedFunc = emitMove(thisRegister, func); - - thisRegister = movedThisRegister.release().releaseRef(); - func = movedFunc.release().releaseRef(); - } - } + if (m_shouldEmitProfileHooks) + emitMove(callArguments.profileHookRegister(), func); // Generate code for arguments. - Vector, 16> argv; - argv.append(thisRegister); - for (ArgumentListNode* n = argumentsNode->m_listNode; n; n = n->m_next) { - argv.append(newTemporary()); - // op_call requires the arguments to be a sequential range of registers - ASSERT(argv[argv.size() - 1]->index() == argv[argv.size() - 2]->index() + 1); - emitNode(argv.last().get(), n); - } + unsigned argumentIndex = 0; + for (ArgumentListNode* n = callArguments.argumentsNode()->m_listNode; n; n = n->m_next) + emitNode(callArguments.argumentRegister(argumentIndex++), n); // Reserve space for call frame. Vector, RegisterFile::CallFrameHeaderSize> callFrame; @@ -1472,10 +1450,10 @@ RegisterID* BytecodeGenerator::emitCall(OpcodeID opcodeID, RegisterID* dst, Regi if (m_shouldEmitProfileHooks) { emitOpcode(op_profile_will_call); - instructions().append(func->index()); + instructions().append(callArguments.profileHookRegister()->index()); #if ENABLE(JIT) - m_codeBlock->addFunctionRegisterInfo(instructions().size(), func->index()); + m_codeBlock->addFunctionRegisterInfo(instructions().size(), callArguments.profileHookRegister()->index()); #endif } @@ -1488,8 +1466,8 @@ RegisterID* BytecodeGenerator::emitCall(OpcodeID opcodeID, RegisterID* dst, Regi // Emit call. emitOpcode(opcodeID); instructions().append(func->index()); // func - instructions().append(argv.size()); // argCount - instructions().append(argv[0]->index() + argv.size() + RegisterFile::CallFrameHeaderSize); // registerOffset + instructions().append(callArguments.count()); // argCount + instructions().append(callArguments.callFrame()); // registerOffset if (dst != ignoredResult()) { emitOpcode(op_call_put_result); instructions().append(dst->index()); // dst @@ -1497,12 +1475,7 @@ RegisterID* BytecodeGenerator::emitCall(OpcodeID opcodeID, RegisterID* dst, Regi if (m_shouldEmitProfileHooks) { emitOpcode(op_profile_did_call); - instructions().append(func->index()); - - if (dst == originalFunc) { - thisRegister->deref(); - func->deref(); - } + instructions().append(callArguments.profileHookRegister()->index()); } return dst; @@ -1579,34 +1552,23 @@ RegisterID* BytecodeGenerator::emitUnaryNoDstOp(OpcodeID opcodeID, RegisterID* s return src; } -RegisterID* BytecodeGenerator::emitConstruct(RegisterID* dst, RegisterID* func, ArgumentsNode* argumentsNode, unsigned divot, unsigned startOffset, unsigned endOffset) +RegisterID* BytecodeGenerator::emitConstruct(RegisterID* dst, RegisterID* func, CallArguments& callArguments, unsigned divot, unsigned startOffset, unsigned endOffset) { ASSERT(func->refCount()); - RegisterID* originalFunc = func; - if (m_shouldEmitProfileHooks) { - // If codegen decided to recycle func as this call's destination register, - // we need to undo that optimization here so that func will still be around - // for the sake of op_profile_did_call. - if (dst == func) { - RefPtr movedFunc = emitMove(newTemporary(), func); - func = movedFunc.release().releaseRef(); - } - } + if (m_shouldEmitProfileHooks) + emitMove(callArguments.profileHookRegister(), func); // Generate code for arguments. - Vector, 16> argv; - argv.append(newTemporary()); // reserve space for "this" - for (ArgumentListNode* n = argumentsNode ? argumentsNode->m_listNode : 0; n; n = n->m_next) { - argv.append(newTemporary()); - // op_construct requires the arguments to be a sequential range of registers - ASSERT(argv[argv.size() - 1]->index() == argv[argv.size() - 2]->index() + 1); - emitNode(argv.last().get(), n); + unsigned argumentIndex = 0; + if (ArgumentsNode* argumentsNode = callArguments.argumentsNode()) { + for (ArgumentListNode* n = argumentsNode->m_listNode; n; n = n->m_next) + emitNode(callArguments.argumentRegister(argumentIndex++), n); } if (m_shouldEmitProfileHooks) { emitOpcode(op_profile_will_call); - instructions().append(func->index()); + instructions().append(callArguments.profileHookRegister()->index()); } // Reserve space for call frame. @@ -1622,8 +1584,8 @@ RegisterID* BytecodeGenerator::emitConstruct(RegisterID* dst, RegisterID* func, emitOpcode(op_construct); instructions().append(func->index()); // func - instructions().append(argv.size()); // argCount - instructions().append(argv[0]->index() + argv.size() + RegisterFile::CallFrameHeaderSize); // registerOffset + instructions().append(callArguments.count()); // argCount + instructions().append(callArguments.callFrame()); // registerOffset if (dst != ignoredResult()) { emitOpcode(op_call_put_result); instructions().append(dst->index()); // dst @@ -1631,10 +1593,7 @@ RegisterID* BytecodeGenerator::emitConstruct(RegisterID* dst, RegisterID* func, if (m_shouldEmitProfileHooks) { emitOpcode(op_profile_did_call); - instructions().append(func->index()); - - if (dst == originalFunc) - func->deref(); + instructions().append(callArguments.profileHookRegister()->index()); } return dst; @@ -1895,11 +1854,11 @@ RegisterID* BytecodeGenerator::emitCatch(RegisterID* targetRegister, Label* star return targetRegister; } -RegisterID* BytecodeGenerator::emitNewError(RegisterID* dst, ErrorType type, JSValue message) +RegisterID* BytecodeGenerator::emitNewError(RegisterID* dst, bool isReferenceError, JSValue message) { emitOpcode(op_new_error); instructions().append(dst->index()); - instructions().append(static_cast(type)); + instructions().append(isReferenceError); instructions().append(addConstantValue(message)->index()); return dst; } @@ -2056,7 +2015,7 @@ RegisterID* BytecodeGenerator::emitThrowExpressionTooDeepException() // that from an arbitrary node. However, calling emitExpressionInfo without any useful data // is still good enough to get us an accurate line number. emitExpressionInfo(0, 0, 0); - RegisterID* exception = emitNewError(newTemporary(), SyntaxError, jsString(globalData(), "Expression too deep")); + RegisterID* exception = emitNewError(newTemporary(), false, jsString(globalData(), "Expression too deep")); emitThrow(exception); return exception; } diff --git a/JavaScriptCore/bytecompiler/BytecodeGenerator.h b/JavaScriptCore/bytecompiler/BytecodeGenerator.h index 398d666..8f0ce34 100644 --- a/JavaScriptCore/bytecompiler/BytecodeGenerator.h +++ b/JavaScriptCore/bytecompiler/BytecodeGenerator.h @@ -51,6 +51,23 @@ namespace JSC { class ScopeChain; class ScopeNode; + class CallArguments { + public: + CallArguments(BytecodeGenerator& generator, ArgumentsNode* argumentsNode); + + RegisterID* thisRegister() { return m_argv[0].get(); } + RegisterID* argumentRegister(unsigned i) { return m_argv[i + 1].get(); } + unsigned callFrame() { return thisRegister()->index() + count() + RegisterFile::CallFrameHeaderSize; } + unsigned count() { return m_argv.size(); } + RegisterID* profileHookRegister() { return m_profileHookRegister.get(); } + ArgumentsNode* argumentsNode() { return m_argumentsNode; } + + private: + RefPtr m_profileHookRegister; + ArgumentsNode* m_argumentsNode; + Vector, 16> m_argv; + }; + struct FinallyContext { Label* finallyAddr; RegisterID* retAddrDst; @@ -319,15 +336,15 @@ namespace JSC { RegisterID* emitPutGetter(RegisterID* base, const Identifier& property, RegisterID* value); RegisterID* emitPutSetter(RegisterID* base, const Identifier& property, RegisterID* value); - RegisterID* emitCall(RegisterID* dst, RegisterID* func, RegisterID* thisRegister, ArgumentsNode*, unsigned divot, unsigned startOffset, unsigned endOffset); - RegisterID* emitCallEval(RegisterID* dst, RegisterID* func, RegisterID* thisRegister, ArgumentsNode*, unsigned divot, unsigned startOffset, unsigned endOffset); + RegisterID* emitCall(RegisterID* dst, RegisterID* func, CallArguments&, unsigned divot, unsigned startOffset, unsigned endOffset); + RegisterID* emitCallEval(RegisterID* dst, RegisterID* func, CallArguments&, unsigned divot, unsigned startOffset, unsigned endOffset); RegisterID* emitCallVarargs(RegisterID* dst, RegisterID* func, RegisterID* thisRegister, RegisterID* argCount, unsigned divot, unsigned startOffset, unsigned endOffset); RegisterID* emitLoadVarargs(RegisterID* argCountDst, RegisterID* args); RegisterID* emitReturn(RegisterID* src); RegisterID* emitEnd(RegisterID* src) { return emitUnaryNoDstOp(op_end, src); } - RegisterID* emitConstruct(RegisterID* dst, RegisterID* func, ArgumentsNode*, unsigned divot, unsigned startOffset, unsigned endOffset); + RegisterID* emitConstruct(RegisterID* dst, RegisterID* func, CallArguments&, unsigned divot, unsigned startOffset, unsigned endOffset); RegisterID* emitStrcat(RegisterID* dst, RegisterID* src, int count); void emitToPrimitive(RegisterID* dst, RegisterID* src); @@ -347,7 +364,7 @@ namespace JSC { RegisterID* emitCatch(RegisterID*, Label* start, Label* end); void emitThrow(RegisterID* exc) { emitUnaryNoDstOp(op_throw, exc); } - RegisterID* emitNewError(RegisterID* dst, ErrorType type, JSValue message); + RegisterID* emitNewError(RegisterID* dst, bool isReferenceError, JSValue message); void emitPushNewScope(RegisterID* dst, const Identifier& property, RegisterID* value); RegisterID* emitPushScope(RegisterID* scope); @@ -386,6 +403,8 @@ namespace JSC { m_codeBlockBeingRegeneratedFrom = originalCodeBlock; } + bool shouldEmitProfileHooks() { return m_shouldEmitProfileHooks; } + private: void emitOpcode(OpcodeID); void retrieveLastBinaryOp(int& dstIndex, int& src1Index, int& src2Index); @@ -410,7 +429,7 @@ namespace JSC { typedef HashMap NumberMap; typedef HashMap IdentifierStringMap; - RegisterID* emitCall(OpcodeID, RegisterID* dst, RegisterID* func, RegisterID* thisRegister, ArgumentsNode*, unsigned divot, unsigned startOffset, unsigned endOffset); + RegisterID* emitCall(OpcodeID, RegisterID* dst, RegisterID* func, CallArguments&, unsigned divot, unsigned startOffset, unsigned endOffset); RegisterID* newRegister(); @@ -442,7 +461,7 @@ namespace JSC { // Returns true if a new RegisterID was added, false if a pre-existing RegisterID was re-used. bool addGlobalVar(const Identifier&, bool isConstant, RegisterID*&); - RegisterID* addParameter(const Identifier&); + void addParameter(const Identifier&, int parameterIndex); void preserveLastVar(); @@ -515,7 +534,6 @@ namespace JSC { Vector m_forInContextStack; int m_nextGlobalIndex; - int m_nextParameterIndex; int m_firstConstantIndex; int m_nextConstantOffset; unsigned m_globalConstantIndex; diff --git a/JavaScriptCore/bytecompiler/NodesCodegen.cpp b/JavaScriptCore/bytecompiler/NodesCodegen.cpp index c514b7a..765230e 100644 --- a/JavaScriptCore/bytecompiler/NodesCodegen.cpp +++ b/JavaScriptCore/bytecompiler/NodesCodegen.cpp @@ -81,27 +81,27 @@ static void substitute(UString& string, const UString& substring) string = makeString(string.substr(0, position), substring, string.substr(position + 2)); } -RegisterID* ThrowableExpressionData::emitThrowError(BytecodeGenerator& generator, ErrorType type, const char* message) +RegisterID* ThrowableExpressionData::emitThrowError(BytecodeGenerator& generator, bool isReferenceError, const char* message) { generator.emitExpressionInfo(divot(), startOffset(), endOffset()); - RegisterID* exception = generator.emitNewError(generator.newTemporary(), type, jsString(generator.globalData(), message)); + RegisterID* exception = generator.emitNewError(generator.newTemporary(), isReferenceError, jsString(generator.globalData(), message)); generator.emitThrow(exception); return exception; } -RegisterID* ThrowableExpressionData::emitThrowError(BytecodeGenerator& generator, ErrorType type, const char* messageTemplate, const UString& label) +RegisterID* ThrowableExpressionData::emitThrowError(BytecodeGenerator& generator, bool isReferenceError, const char* messageTemplate, const UString& label) { UString message = messageTemplate; substitute(message, label); generator.emitExpressionInfo(divot(), startOffset(), endOffset()); - RegisterID* exception = generator.emitNewError(generator.newTemporary(), type, jsString(generator.globalData(), message)); + RegisterID* exception = generator.emitNewError(generator.newTemporary(), isReferenceError, jsString(generator.globalData(), message)); generator.emitThrow(exception); return exception; } -inline RegisterID* ThrowableExpressionData::emitThrowError(BytecodeGenerator& generator, ErrorType type, const char* messageTemplate, const Identifier& label) +inline RegisterID* ThrowableExpressionData::emitThrowError(BytecodeGenerator& generator, bool isReferenceError, const char* messageTemplate, const Identifier& label) { - return emitThrowError(generator, type, messageTemplate, label.ustring()); + return emitThrowError(generator, isReferenceError, messageTemplate, label.ustring()); } // ------------------------------ NullNode ------------------------------------- @@ -146,7 +146,7 @@ RegisterID* RegExpNode::emitBytecode(BytecodeGenerator& generator, RegisterID* d { RefPtr regExp = RegExp::create(generator.globalData(), m_pattern.ustring(), m_flags.ustring()); if (!regExp->isValid()) - return emitThrowError(generator, SyntaxError, "Invalid regular expression: %s", regExp->errorMessage()); + return emitThrowError(generator, false, "Invalid regular expression: %s", regExp->errorMessage()); if (dst == generator.ignoredResult()) return 0; return generator.emitNewRegExp(generator.finalDestination(dst), regExp.get()); @@ -316,7 +316,23 @@ RegisterID* ArgumentListNode::emitBytecode(BytecodeGenerator& generator, Registe RegisterID* NewExprNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst) { RefPtr func = generator.emitNode(m_expr); - return generator.emitConstruct(generator.finalDestinationOrIgnored(dst), func.get(), m_args, divot(), startOffset(), endOffset()); + CallArguments callArguments(generator, m_args); + return generator.emitConstruct(generator.finalDestinationOrIgnored(dst), func.get(), callArguments, divot(), startOffset(), endOffset()); +} + +CallArguments::CallArguments(BytecodeGenerator& generator, ArgumentsNode* argumentsNode) + : m_argumentsNode(argumentsNode) +{ + if (generator.shouldEmitProfileHooks()) + m_profileHookRegister = generator.newTemporary(); + m_argv.append(generator.newTemporary()); + if (argumentsNode) { + for (ArgumentListNode* n = argumentsNode->m_listNode; n; n = n->m_next) { + m_argv.append(generator.newTemporary()); + // op_call requires the arguments to be a sequential range of registers + ASSERT(m_argv[m_argv.size() - 1]->index() == m_argv[m_argv.size() - 2]->index() + 1); + } + } } // ------------------------------ EvalFunctionCallNode ---------------------------------- @@ -324,10 +340,10 @@ RegisterID* NewExprNode::emitBytecode(BytecodeGenerator& generator, RegisterID* RegisterID* EvalFunctionCallNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst) { RefPtr func = generator.tempDestination(dst); - RefPtr thisRegister = generator.newTemporary(); + CallArguments callArguments(generator, m_args); generator.emitExpressionInfo(divot() - startOffset() + 4, 4, 0); - generator.emitResolveWithBase(thisRegister.get(), func.get(), generator.propertyNames().eval); - return generator.emitCallEval(generator.finalDestination(dst, func.get()), func.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset()); + generator.emitResolveWithBase(callArguments.thisRegister(), func.get(), generator.propertyNames().eval); + return generator.emitCallEval(generator.finalDestination(dst, func.get()), func.get(), callArguments, divot(), startOffset(), endOffset()); } // ------------------------------ FunctionCallValueNode ---------------------------------- @@ -335,8 +351,9 @@ RegisterID* EvalFunctionCallNode::emitBytecode(BytecodeGenerator& generator, Reg RegisterID* FunctionCallValueNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst) { RefPtr func = generator.emitNode(m_expr); - RefPtr thisRegister = generator.emitLoad(generator.newTemporary(), jsNull()); - return generator.emitCall(generator.finalDestinationOrIgnored(dst, func.get()), func.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset()); + CallArguments callArguments(generator, m_args); + generator.emitLoad(callArguments.thisRegister(), jsNull()); + return generator.emitCall(generator.finalDestinationOrIgnored(dst, func.get()), func.get(), callArguments, divot(), startOffset(), endOffset()); } // ------------------------------ FunctionCallResolveNode ---------------------------------- @@ -344,8 +361,9 @@ RegisterID* FunctionCallValueNode::emitBytecode(BytecodeGenerator& generator, Re RegisterID* FunctionCallResolveNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst) { if (RefPtr local = generator.registerFor(m_ident)) { - RefPtr thisRegister = generator.emitLoad(generator.newTemporary(), jsNull()); - return generator.emitCall(generator.finalDestinationOrIgnored(dst, thisRegister.get()), local.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset()); + CallArguments callArguments(generator, m_args); + generator.emitLoad(callArguments.thisRegister(), jsNull()); + return generator.emitCall(generator.finalDestinationOrIgnored(dst, callArguments.thisRegister()), local.get(), callArguments, divot(), startOffset(), endOffset()); } int index = 0; @@ -354,16 +372,17 @@ RegisterID* FunctionCallResolveNode::emitBytecode(BytecodeGenerator& generator, bool requiresDynamicChecks = false; if (generator.findScopedProperty(m_ident, index, depth, false, requiresDynamicChecks, globalObject) && index != missingSymbolMarker() && !requiresDynamicChecks) { RefPtr func = generator.emitGetScopedVar(generator.newTemporary(), depth, index, globalObject); - RefPtr thisRegister = generator.emitLoad(generator.newTemporary(), jsNull()); - return generator.emitCall(generator.finalDestinationOrIgnored(dst, func.get()), func.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset()); + CallArguments callArguments(generator, m_args); + generator.emitLoad(callArguments.thisRegister(), jsNull()); + return generator.emitCall(generator.finalDestinationOrIgnored(dst, func.get()), func.get(), callArguments, divot(), startOffset(), endOffset()); } RefPtr func = generator.newTemporary(); - RefPtr thisRegister = generator.newTemporary(); + CallArguments callArguments(generator, m_args); int identifierStart = divot() - startOffset(); generator.emitExpressionInfo(identifierStart + m_ident.size(), m_ident.size(), 0); - generator.emitResolveWithBase(thisRegister.get(), func.get(), m_ident); - return generator.emitCall(generator.finalDestinationOrIgnored(dst, func.get()), func.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset()); + generator.emitResolveWithBase(callArguments.thisRegister(), func.get(), m_ident); + return generator.emitCall(generator.finalDestinationOrIgnored(dst, func.get()), func.get(), callArguments, divot(), startOffset(), endOffset()); } // ------------------------------ FunctionCallBracketNode ---------------------------------- @@ -374,8 +393,9 @@ RegisterID* FunctionCallBracketNode::emitBytecode(BytecodeGenerator& generator, RegisterID* property = generator.emitNode(m_subscript); generator.emitExpressionInfo(divot() - m_subexpressionDivotOffset, startOffset() - m_subexpressionDivotOffset, m_subexpressionEndOffset); RefPtr function = generator.emitGetByVal(generator.tempDestination(dst), base.get(), property); - RefPtr thisRegister = generator.emitMove(generator.newTemporary(), base.get()); - return generator.emitCall(generator.finalDestinationOrIgnored(dst, function.get()), function.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset()); + CallArguments callArguments(generator, m_args); + generator.emitMove(callArguments.thisRegister(), base.get()); + return generator.emitCall(generator.finalDestinationOrIgnored(dst, function.get()), function.get(), callArguments, divot(), startOffset(), endOffset()); } // ------------------------------ FunctionCallDotNode ---------------------------------- @@ -383,12 +403,12 @@ RegisterID* FunctionCallBracketNode::emitBytecode(BytecodeGenerator& generator, RegisterID* FunctionCallDotNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst) { RefPtr function = generator.tempDestination(dst); - RefPtr thisRegister = generator.newTemporary(); - generator.emitNode(thisRegister.get(), m_base); + CallArguments callArguments(generator, m_args); + generator.emitNode(callArguments.thisRegister(), m_base); generator.emitExpressionInfo(divot() - m_subexpressionDivotOffset, startOffset() - m_subexpressionDivotOffset, m_subexpressionEndOffset); generator.emitMethodCheck(); - generator.emitGetById(function.get(), thisRegister.get(), m_ident); - return generator.emitCall(generator.finalDestinationOrIgnored(dst, function.get()), function.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset()); + generator.emitGetById(function.get(), callArguments.thisRegister(), m_ident); + return generator.emitCall(generator.finalDestinationOrIgnored(dst, function.get()), function.get(), callArguments, divot(), startOffset(), endOffset()); } RegisterID* CallFunctionCallDotNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst) @@ -401,28 +421,36 @@ RegisterID* CallFunctionCallDotNode::emitBytecode(BytecodeGenerator& generator, RefPtr finalDestinationOrIgnored = generator.finalDestinationOrIgnored(dst, function.get()); generator.emitJumpIfNotFunctionCall(function.get(), realCall.get()); { - RefPtr realFunction = generator.emitMove(generator.tempDestination(dst), base.get()); - RefPtr thisRegister = generator.newTemporary(); - ArgumentListNode* oldList = m_args->m_listNode; if (m_args->m_listNode && m_args->m_listNode->m_expr) { - generator.emitNode(thisRegister.get(), m_args->m_listNode->m_expr); + ArgumentListNode* oldList = m_args->m_listNode; m_args->m_listNode = m_args->m_listNode->m_next; - } else - generator.emitLoad(thisRegister.get(), jsNull()); - generator.emitCall(finalDestinationOrIgnored.get(), realFunction.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset()); - generator.emitJump(end.get()); - m_args->m_listNode = oldList; + RefPtr realFunction = generator.emitMove(generator.tempDestination(dst), base.get()); + CallArguments callArguments(generator, m_args); + generator.emitNode(callArguments.thisRegister(), oldList->m_expr); + generator.emitCall(finalDestinationOrIgnored.get(), realFunction.get(), callArguments, divot(), startOffset(), endOffset()); + generator.emitJump(end.get()); + + m_args->m_listNode = oldList; + + } else { + RefPtr realFunction = generator.emitMove(generator.tempDestination(dst), base.get()); + CallArguments callArguments(generator, m_args); + generator.emitLoad(callArguments.thisRegister(), jsNull()); + generator.emitCall(finalDestinationOrIgnored.get(), realFunction.get(), callArguments, divot(), startOffset(), endOffset()); + generator.emitJump(end.get()); + } } generator.emitLabel(realCall.get()); { - RefPtr thisRegister = generator.emitMove(generator.newTemporary(), base.get()); - generator.emitCall(finalDestinationOrIgnored.get(), function.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset()); + CallArguments callArguments(generator, m_args); + generator.emitMove(callArguments.thisRegister(), base.get()); + generator.emitCall(finalDestinationOrIgnored.get(), function.get(), callArguments, divot(), startOffset(), endOffset()); } generator.emitLabel(end.get()); return finalDestinationOrIgnored.get(); } - + static bool areTrivialApplyArguments(ArgumentsNode* args) { return !args->m_listNode || !args->m_listNode->m_expr || !args->m_listNode->m_next @@ -445,21 +473,30 @@ RegisterID* ApplyFunctionCallDotNode::emitBytecode(BytecodeGenerator& generator, generator.emitJumpIfNotFunctionApply(function.get(), realCall.get()); { if (mayBeCall) { - RefPtr realFunction = generator.emitMove(generator.tempDestination(dst), base.get()); - RefPtr thisRegister = generator.newTemporary(); - ArgumentListNode* oldList = m_args->m_listNode; if (m_args->m_listNode && m_args->m_listNode->m_expr) { - generator.emitNode(thisRegister.get(), m_args->m_listNode->m_expr); - m_args->m_listNode = m_args->m_listNode->m_next; - if (m_args->m_listNode) { - ASSERT(m_args->m_listNode->m_expr->isSimpleArray()); - ASSERT(!m_args->m_listNode->m_next); - m_args->m_listNode = static_cast(m_args->m_listNode->m_expr)->toArgumentList(generator.globalData()); + ArgumentListNode* oldList = m_args->m_listNode; + if (m_args->m_listNode->m_next) { + ASSERT(m_args->m_listNode->m_next->m_expr->isSimpleArray()); + ASSERT(!m_args->m_listNode->m_next->m_next); + m_args->m_listNode = static_cast(m_args->m_listNode->m_next->m_expr)->toArgumentList(generator.globalData()); + RefPtr realFunction = generator.emitMove(generator.tempDestination(dst), base.get()); + CallArguments callArguments(generator, m_args); + generator.emitNode(callArguments.thisRegister(), oldList->m_expr); + generator.emitCall(finalDestinationOrIgnored.get(), realFunction.get(), callArguments, divot(), startOffset(), endOffset()); + } else { + m_args->m_listNode = m_args->m_listNode->m_next; + RefPtr realFunction = generator.emitMove(generator.tempDestination(dst), base.get()); + CallArguments callArguments(generator, m_args); + generator.emitNode(callArguments.thisRegister(), oldList->m_expr); + generator.emitCall(finalDestinationOrIgnored.get(), realFunction.get(), callArguments, divot(), startOffset(), endOffset()); } - } else - generator.emitLoad(thisRegister.get(), jsNull()); - generator.emitCall(finalDestinationOrIgnored.get(), realFunction.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset()); - m_args->m_listNode = oldList; + m_args->m_listNode = oldList; + } else { + RefPtr realFunction = generator.emitMove(generator.tempDestination(dst), base.get()); + CallArguments callArguments(generator, m_args); + generator.emitLoad(callArguments.thisRegister(), jsNull()); + generator.emitCall(finalDestinationOrIgnored.get(), realFunction.get(), callArguments, divot(), startOffset(), endOffset()); + } } else { ASSERT(m_args->m_listNode && m_args->m_listNode->m_next); RefPtr realFunction = generator.emitMove(generator.newTemporary(), base.get()); @@ -487,8 +524,9 @@ RegisterID* ApplyFunctionCallDotNode::emitBytecode(BytecodeGenerator& generator, } generator.emitLabel(realCall.get()); { - RefPtr thisRegister = generator.emitMove(generator.newTemporary(), base.get()); - generator.emitCall(finalDestinationOrIgnored.get(), function.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset()); + CallArguments callArguments(generator, m_args); + generator.emitMove(callArguments.thisRegister(), base.get()); + generator.emitCall(finalDestinationOrIgnored.get(), function.get(), callArguments, divot(), startOffset(), endOffset()); } generator.emitLabel(end.get()); return finalDestinationOrIgnored.get(); @@ -604,7 +642,7 @@ RegisterID* PostfixDotNode::emitBytecode(BytecodeGenerator& generator, RegisterI RegisterID* PostfixErrorNode::emitBytecode(BytecodeGenerator& generator, RegisterID*) { - return emitThrowError(generator, ReferenceError, m_operator == OpPlusPlus + return emitThrowError(generator, true, m_operator == OpPlusPlus ? "Postfix ++ operator applied to value that is not a reference." : "Postfix -- operator applied to value that is not a reference."); } @@ -769,7 +807,7 @@ RegisterID* PrefixDotNode::emitBytecode(BytecodeGenerator& generator, RegisterID RegisterID* PrefixErrorNode::emitBytecode(BytecodeGenerator& generator, RegisterID*) { - return emitThrowError(generator, ReferenceError, m_operator == OpPlusPlus + return emitThrowError(generator, true, m_operator == OpPlusPlus ? "Prefix ++ operator applied to value that is not a reference." : "Prefix -- operator applied to value that is not a reference."); } @@ -1212,7 +1250,7 @@ RegisterID* ReadModifyDotNode::emitBytecode(BytecodeGenerator& generator, Regist RegisterID* AssignErrorNode::emitBytecode(BytecodeGenerator& generator, RegisterID*) { - return emitThrowError(generator, ReferenceError, "Left side of assignment is not a reference."); + return emitThrowError(generator, true, "Left side of assignment is not a reference."); } // ------------------------------ AssignBracketNode ----------------------------------- @@ -1517,7 +1555,7 @@ RegisterID* ForInNode::emitBytecode(BytecodeGenerator& generator, RegisterID* ds RefPtr scope = generator.newLabelScope(LabelScope::Loop); if (!m_lexpr->isLocation()) - return emitThrowError(generator, ReferenceError, "Left side of for-in statement is not a reference."); + return emitThrowError(generator, true, "Left side of for-in statement is not a reference."); generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine()); @@ -1596,8 +1634,8 @@ RegisterID* ContinueNode::emitBytecode(BytecodeGenerator& generator, RegisterID* if (!scope) return m_ident.isEmpty() - ? emitThrowError(generator, SyntaxError, "Invalid continue statement.") - : emitThrowError(generator, SyntaxError, "Undefined label: '%s'.", m_ident); + ? emitThrowError(generator, false, "Invalid continue statement.") + : emitThrowError(generator, false, "Undefined label: '%s'.", m_ident); generator.emitJumpScopes(scope->continueTarget(), scope->scopeDepth()); return dst; @@ -1614,8 +1652,8 @@ RegisterID* BreakNode::emitBytecode(BytecodeGenerator& generator, RegisterID* ds if (!scope) return m_ident.isEmpty() - ? emitThrowError(generator, SyntaxError, "Invalid break statement.") - : emitThrowError(generator, SyntaxError, "Undefined label: '%s'.", m_ident); + ? emitThrowError(generator, false, "Invalid break statement.") + : emitThrowError(generator, false, "Undefined label: '%s'.", m_ident); generator.emitJumpScopes(scope->breakTarget(), scope->scopeDepth()); return dst; @@ -1627,7 +1665,7 @@ RegisterID* ReturnNode::emitBytecode(BytecodeGenerator& generator, RegisterID* d { generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine()); if (generator.codeType() != FunctionCode) - return emitThrowError(generator, SyntaxError, "Invalid return statement."); + return emitThrowError(generator, false, "Invalid return statement."); if (dst == generator.ignoredResult()) dst = 0; @@ -1833,7 +1871,7 @@ RegisterID* LabelNode::emitBytecode(BytecodeGenerator& generator, RegisterID* ds generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine()); if (generator.breakTarget(m_name)) - return emitThrowError(generator, SyntaxError, "Duplicate label: %s.", m_name); + return emitThrowError(generator, false, "Duplicate label: %s.", m_name); RefPtr scope = generator.newLabelScope(LabelScope::NamedLabel, &m_name); RegisterID* r0 = generator.emitNode(dst, m_statement); diff --git a/JavaScriptCore/interpreter/CallFrame.h b/JavaScriptCore/interpreter/CallFrame.h index 2a7bce2..723d4ae 100644 --- a/JavaScriptCore/interpreter/CallFrame.h +++ b/JavaScriptCore/interpreter/CallFrame.h @@ -77,7 +77,6 @@ namespace JSC { // pointer, so these are inefficient, and should be used sparingly in new code. // But they're used in many places in legacy code, so they're not going away any time soon. - void setException(JSValue exception) { globalData().exception = exception; } void clearException() { globalData().exception = JSValue(); } JSValue exception() const { return globalData().exception; } JSValue* exceptionSlot() { return &globalData().exception; } diff --git a/JavaScriptCore/interpreter/Interpreter.cpp b/JavaScriptCore/interpreter/Interpreter.cpp index 12ac323..91f5c0a 100644 --- a/JavaScriptCore/interpreter/Interpreter.cpp +++ b/JavaScriptCore/interpreter/Interpreter.cpp @@ -564,27 +564,15 @@ NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSV exception = createNotAnObjectError(callFrame, static_cast(exception), bytecodeOffset, codeBlock); exceptionValue = exception; } else { - if (!exception->hasProperty(callFrame, Identifier(callFrame, "line")) && - !exception->hasProperty(callFrame, Identifier(callFrame, "sourceId")) && - !exception->hasProperty(callFrame, Identifier(callFrame, "sourceURL")) && - !exception->hasProperty(callFrame, Identifier(callFrame, expressionBeginOffsetPropertyName)) && - !exception->hasProperty(callFrame, Identifier(callFrame, expressionCaretOffsetPropertyName)) && - !exception->hasProperty(callFrame, Identifier(callFrame, expressionEndOffsetPropertyName))) { + if (!hasErrorInfo(callFrame, exception)) { if (explicitThrow) { int startOffset = 0; int endOffset = 0; int divotPoint = 0; int line = codeBlock->expressionRangeForBytecodeOffset(callFrame, bytecodeOffset, divotPoint, startOffset, endOffset); - exception->putWithAttributes(callFrame, Identifier(callFrame, "line"), jsNumber(callFrame, line), ReadOnly | DontDelete); - - // We only hit this path for error messages and throw statements, which don't have a specific failure position - // So we just give the full range of the error/throw statement. - exception->putWithAttributes(callFrame, Identifier(callFrame, expressionBeginOffsetPropertyName), jsNumber(callFrame, divotPoint - startOffset), ReadOnly | DontDelete); - exception->putWithAttributes(callFrame, Identifier(callFrame, expressionEndOffsetPropertyName), jsNumber(callFrame, divotPoint + endOffset), ReadOnly | DontDelete); + addErrorInfo(callFrame, exception, line, codeBlock->ownerExecutable()->source(), divotPoint, startOffset, endOffset, false); } else - exception->putWithAttributes(callFrame, Identifier(callFrame, "line"), jsNumber(callFrame, codeBlock->lineNumberForBytecodeOffset(callFrame, bytecodeOffset)), ReadOnly | DontDelete); - exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceId"), jsNumber(callFrame, codeBlock->ownerExecutable()->sourceID()), ReadOnly | DontDelete); - exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceURL"), jsOwnedString(callFrame, codeBlock->ownerExecutable()->sourceURL()), ReadOnly | DontDelete); + addErrorInfo(callFrame, exception, codeBlock->lineNumberForBytecodeOffset(callFrame, bytecodeOffset), codeBlock->ownerExecutable()->source()); } ComplType exceptionType = exception->exceptionType(); @@ -785,7 +773,7 @@ JSValue Interpreter::executeCall(CallFrame* callFrame, JSObject* function, CallT JSValue result; { SamplingTool::HostCallRecord callRecord(m_sampler.get()); - result = callData.native.function(newCallFrame); + result = JSValue::decode(callData.native.function(newCallFrame)); } if (*profiler) @@ -795,66 +783,99 @@ JSValue Interpreter::executeCall(CallFrame* callFrame, JSObject* function, CallT return result; } -JSValue Interpreter::executeConstruct(FunctionExecutable* functionExecutable, CallFrame* callFrame, JSFunction* function, JSObject* thisObj, const ArgList& args, ScopeChainNode* scopeChain, JSValue* exception) +JSObject* Interpreter::executeConstruct(CallFrame* callFrame, JSObject* constructor, ConstructType constructType, const ConstructData& constructData, const ArgList& args, JSValue* exception) { - ASSERT(!scopeChain->globalData->exception); + ASSERT(!callFrame->hadException()); if (m_reentryDepth >= MaxSmallThreadReentryDepth) { if (m_reentryDepth >= callFrame->globalData().maxReentryDepth) { *exception = createStackOverflowError(callFrame); - return jsNull(); + return 0; } } Register* oldEnd = m_registerFile.end(); - int argc = 1 + args.size(); // implicit "this" parameter + int argCount = 1 + args.size(); // implicit "this" parameter + size_t registerOffset = argCount + RegisterFile::CallFrameHeaderSize; - if (!m_registerFile.grow(oldEnd + argc)) { + if (!m_registerFile.grow(oldEnd + registerOffset)) { *exception = createStackOverflowError(callFrame); - return jsNull(); + return 0; } CallFrame* newCallFrame = CallFrame::create(oldEnd); size_t dst = 0; - newCallFrame->r(0) = JSValue(thisObj); ArgList::const_iterator end = args.end(); for (ArgList::const_iterator it = args.begin(); it != end; ++it) newCallFrame->r(++dst) = *it; - CodeBlock* codeBlock = &functionExecutable->bytecodeForConstruct(callFrame, scopeChain); - newCallFrame = slideRegisterWindowForCall(codeBlock, &m_registerFile, newCallFrame, argc + RegisterFile::CallFrameHeaderSize, argc); - if (UNLIKELY(!newCallFrame)) { - *exception = createStackOverflowError(callFrame); + if (constructType == ConstructTypeJS) { + ScopeChainNode* constructDataScopeChain = constructData.js.scopeChain; + CodeBlock* newCodeBlock = &constructData.js.functionExecutable->bytecodeForConstruct(callFrame, constructDataScopeChain); + + newCallFrame = slideRegisterWindowForCall(newCodeBlock, &m_registerFile, newCallFrame, registerOffset, argCount); + if (UNLIKELY(!newCallFrame)) { + *exception = createStackOverflowError(callFrame); + m_registerFile.shrink(oldEnd); + return 0; + } + + newCallFrame->init(newCodeBlock, 0, constructDataScopeChain, callFrame->addHostCallFrameFlag(), argCount, constructor); + + DynamicGlobalObjectScope globalObjectScope(newCallFrame, constructDataScopeChain->globalObject); + + Profiler** profiler = Profiler::enabledProfilerReference(); + if (*profiler) + (*profiler)->willExecute(newCallFrame, constructor); + + JSValue result; + { + SamplingTool::CallRecord callRecord(m_sampler.get()); + + m_reentryDepth++; + #if ENABLE(JIT) + result = constructData.js.functionExecutable->jitCodeForConstruct(newCallFrame, constructDataScopeChain).execute(&m_registerFile, newCallFrame, constructDataScopeChain->globalData, exception); + #else + result = privateExecute(Normal, &m_registerFile, newCallFrame, exception); + #endif + m_reentryDepth--; + } + + if (*profiler) + (*profiler)->didExecute(newCallFrame, constructor); + m_registerFile.shrink(oldEnd); - return jsNull(); + if (callFrame->hadException()) + return 0; + ASSERT(result.isObject()); + return asObject(result); } - // a 0 codeBlock indicates a built-in caller - newCallFrame->init(codeBlock, 0, scopeChain, callFrame->addHostCallFrameFlag(), argc, function); - DynamicGlobalObjectScope globalObjectScope(callFrame, scopeChain->globalObject); + ASSERT(constructType == ConstructTypeHost); + ScopeChainNode* scopeChain = callFrame->scopeChain(); + newCallFrame = CallFrame::create(newCallFrame->registers() + registerOffset); + newCallFrame->init(0, 0, scopeChain, callFrame->addHostCallFrameFlag(), argCount, constructor); + + DynamicGlobalObjectScope globalObjectScope(newCallFrame, scopeChain->globalObject); Profiler** profiler = Profiler::enabledProfilerReference(); if (*profiler) - (*profiler)->willExecute(callFrame, function); + (*profiler)->willExecute(newCallFrame, constructor); JSValue result; { - SamplingTool::CallRecord callRecord(m_sampler.get()); - - m_reentryDepth++; -#if ENABLE(JIT) - result = functionExecutable->jitCodeForConstruct(newCallFrame, scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception); -#else - result = privateExecute(Normal, &m_registerFile, newCallFrame, exception); -#endif - m_reentryDepth--; + SamplingTool::HostCallRecord callRecord(m_sampler.get()); + result = JSValue::decode(constructData.native.function(newCallFrame)); } if (*profiler) - (*profiler)->didExecute(callFrame, function); + (*profiler)->didExecute(newCallFrame, constructor); m_registerFile.shrink(oldEnd); - return result; + if (callFrame->hadException()) + return 0; + ASSERT(result.isObject()); + return asObject(result); } CallFrameClosure Interpreter::prepareForRepeatCall(FunctionExecutable* FunctionExecutable, CallFrame* callFrame, JSFunction* function, int argCount, ScopeChainNode* scopeChain, JSValue* exception) @@ -3594,7 +3615,7 @@ skip_id_custom_self: JSValue v = callFrame->r(func).jsValue(); CallData callData; - CallType callType = v.getCallData(callData); + CallType callType = getCallData(v, callData); if (callType == CallTypeJS) { ScopeChainNode* callDataScopeChain = callData.js.scopeChain; @@ -3626,13 +3647,10 @@ skip_id_custom_self: CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + registerOffset); newCallFrame->init(0, vPC + OPCODE_LENGTH(op_call), scopeChain, callFrame, argCount, asObject(v)); - Register* thisRegister = newCallFrame->registers() - RegisterFile::CallFrameHeaderSize - argCount; - ArgList args(thisRegister + 1, argCount - 1); - JSValue returnValue; { SamplingTool::HostCallRecord callRecord(m_sampler.get()); - returnValue = callData.native.function(newCallFrame); + returnValue = JSValue::decode(callData.native.function(newCallFrame)); } CHECK_FOR_EXCEPTION(); @@ -3744,7 +3762,7 @@ skip_id_custom_self: int argCount = callFrame->r(argCountReg).i(); registerOffset += argCount; CallData callData; - CallType callType = v.getCallData(callData); + CallType callType = getCallData(v, callData); if (callType == CallTypeJS) { ScopeChainNode* callDataScopeChain = callData.js.scopeChain; @@ -3776,13 +3794,10 @@ skip_id_custom_self: CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + registerOffset); newCallFrame->init(0, vPC + OPCODE_LENGTH(op_call_varargs), scopeChain, callFrame, argCount, asObject(v)); - Register* thisRegister = newCallFrame->registers() - RegisterFile::CallFrameHeaderSize - argCount; - ArgList args(thisRegister + 1, argCount - 1); - JSValue returnValue; { SamplingTool::HostCallRecord callRecord(m_sampler.get()); - returnValue = callData.native.function(newCallFrame); + returnValue = JSValue::decode(callData.native.function(newCallFrame)); } CHECK_FOR_EXCEPTION(); @@ -4066,7 +4081,7 @@ skip_id_custom_self: JSValue v = callFrame->r(func).jsValue(); ConstructData constructData; - ConstructType constructType = v.getConstructData(constructData); + ConstructType constructType = getConstructData(v, constructData); if (constructType == ConstructTypeJS) { ScopeChainNode* callDataScopeChain = constructData.js.scopeChain; @@ -4095,18 +4110,15 @@ skip_id_custom_self: if (constructType == ConstructTypeHost) { ScopeChainNode* scopeChain = callFrame->scopeChain(); CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + registerOffset); - newCallFrame->init(0, vPC + OPCODE_LENGTH(op_construct), scopeChain, callFrame, argCount, 0); - - Register* thisRegister = newCallFrame->registers() - RegisterFile::CallFrameHeaderSize - argCount; - ArgList args(thisRegister + 1, argCount - 1); + newCallFrame->init(0, vPC + OPCODE_LENGTH(op_construct), scopeChain, callFrame, argCount, asObject(v)); JSValue returnValue; { SamplingTool::HostCallRecord callRecord(m_sampler.get()); - returnValue = constructData.native.function(newCallFrame, asObject(v), args); + returnValue = JSValue::decode(constructData.native.function(newCallFrame)); } CHECK_FOR_EXCEPTION(); - functionReturnValue = JSValue(returnValue); + functionReturnValue = returnValue; vPC += OPCODE_LENGTH(op_construct); NEXT_INSTRUCTION(); @@ -4314,10 +4326,12 @@ skip_id_custom_self: written to register dst. */ int dst = vPC[1].u.operand; - int type = vPC[2].u.operand; - int message = vPC[3].u.operand; + int isReference = vPC[2].u.operand; + UString message = callFrame->r(vPC[3].u.operand).jsValue().toString(callFrame); - callFrame->r(dst) = JSValue(Error::create(callFrame, (ErrorType)type, callFrame->r(message).jsValue().toString(callFrame), codeBlock->lineNumberForBytecodeOffset(callFrame, vPC - codeBlock->instructions().begin()), codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL())); + JSObject* error = isReference ? createReferenceError(callFrame, message) : createSyntaxError(callFrame, message); + addErrorInfo(globalData, error, codeBlock->lineNumberForBytecodeOffset(callFrame, vPC - codeBlock->instructions().begin()), codeBlock->ownerExecutable()->source()); + callFrame->r(dst) = JSValue(error); vPC += OPCODE_LENGTH(op_new_error); NEXT_INSTRUCTION(); diff --git a/JavaScriptCore/interpreter/Interpreter.h b/JavaScriptCore/interpreter/Interpreter.h index 13df468..555bbf9 100644 --- a/JavaScriptCore/interpreter/Interpreter.h +++ b/JavaScriptCore/interpreter/Interpreter.h @@ -96,7 +96,7 @@ namespace JSC { JSValue execute(ProgramExecutable*, CallFrame*, ScopeChainNode*, JSObject* thisObj, JSValue* exception); JSValue executeCall(CallFrame*, JSObject* function, CallType, const CallData&, JSValue thisValue, const ArgList&, JSValue* exception); - JSValue executeConstruct(FunctionExecutable*, CallFrame*, JSFunction*, JSObject* thisObj, const ArgList& args, ScopeChainNode*, JSValue* exception); + JSObject* executeConstruct(CallFrame*, JSObject* function, ConstructType, const ConstructData&, const ArgList&, JSValue* exception); JSValue execute(EvalExecutable* evalNode, CallFrame* exec, JSObject* thisObj, ScopeChainNode* scopeChain, JSValue* exception); JSValue retrieveArguments(CallFrame*, JSFunction*) const; diff --git a/JavaScriptCore/jit/JITArithmetic32_64.cpp b/JavaScriptCore/jit/JITArithmetic32_64.cpp index 023426e..4f36d66 100644 --- a/JavaScriptCore/jit/JITArithmetic32_64.cpp +++ b/JavaScriptCore/jit/JITArithmetic32_64.cpp @@ -460,7 +460,7 @@ void JIT::emitRightShiftSlowCase(Instruction* currentInstruction, Vector executablePool, JSGlobalData* globalData, NativeFunction func) { + Call nativeCall; Label nativeCallThunk = align(); #if CPU(X86) @@ -252,7 +254,7 @@ JIT::CodePtr JIT::privateCompileCTINativeCall(PassRefPtr executa move(regT0, callFrameRegister); // Eagerly restore caller frame register to avoid loading from stack. // call the function - Call nativeCall = call(); + nativeCall = call(); addPtr(Imm32(16 - sizeof(void*)), stackPointerRegister); diff --git a/JavaScriptCore/jit/JITStubs.cpp b/JavaScriptCore/jit/JITStubs.cpp index 9da3c40..ff0dc3f 100644 --- a/JavaScriptCore/jit/JITStubs.cpp +++ b/JavaScriptCore/jit/JITStubs.cpp @@ -1750,7 +1750,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_instanceof) return JSValue::encode(jsBoolean(false)); if (!proto.isObject()) { - throwError(callFrame, TypeError, "instanceof called on an object with an invalid prototype property."); + throwError(callFrame, createTypeError(callFrame, "instanceof called on an object with an invalid prototype property.")); VM_THROW_EXCEPTION(); } } @@ -2031,7 +2031,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_call_NotJSFunction) JSValue funcVal = stackFrame.args[0].jsValue(); CallData callData; - CallType callType = funcVal.getCallData(callData); + CallType callType = getCallData(funcVal, callData); ASSERT(callType != CallTypeJS); @@ -2044,7 +2044,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_call_NotJSFunction) callFrame->init(0, static_cast((STUB_RETURN_ADDRESS).value()), previousCallFrame->scopeChain(), previousCallFrame, argCount, asObject(funcVal)); stackFrame.callFrame = callFrame; - JSValue returnValue; + EncodedJSValue returnValue; { SamplingTool::HostCallRecord callRecord(CTI_SAMPLER); returnValue = callData.native.function(callFrame); @@ -2052,7 +2052,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_call_NotJSFunction) stackFrame.callFrame = previousCallFrame; CHECK_FOR_EXCEPTION(); - return JSValue::encode(returnValue); + return returnValue; } ASSERT(callType == CallTypeNone); @@ -2163,31 +2163,36 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_construct_NotJSConstruct) { STUB_INIT_STACK_FRAME(stackFrame); - CallFrame* callFrame = stackFrame.callFrame; - JSValue constrVal = stackFrame.args[0].jsValue(); - int argCount = stackFrame.args[2].int32(); ConstructData constructData; - ConstructType constructType = constrVal.getConstructData(constructData); + ConstructType constructType = getConstructData(constrVal, constructData); + + ASSERT(constructType != ConstructTypeJS); if (constructType == ConstructTypeHost) { int registerOffset = stackFrame.args[1].int32(); - Register* thisRegister = callFrame->registers() + registerOffset - RegisterFile::CallFrameHeaderSize - argCount; - ArgList argList(thisRegister + 1, argCount - 1); + int argCount = stackFrame.args[2].int32(); + CallFrame* previousCallFrame = stackFrame.callFrame; + CallFrame* callFrame = CallFrame::create(previousCallFrame->registers() + registerOffset); + + callFrame->init(0, static_cast((STUB_RETURN_ADDRESS).value()), previousCallFrame->scopeChain(), previousCallFrame, argCount, asObject(constrVal)); + stackFrame.callFrame = callFrame; - JSValue returnValue; + EncodedJSValue returnValue; { SamplingTool::HostCallRecord callRecord(CTI_SAMPLER); - returnValue = constructData.native.function(callFrame, asObject(constrVal), argList); + returnValue = constructData.native.function(callFrame); } + stackFrame.callFrame = previousCallFrame; CHECK_FOR_EXCEPTION(); - return JSValue::encode(returnValue); + return returnValue; } ASSERT(constructType == ConstructTypeNone); + CallFrame* callFrame = stackFrame.callFrame; CodeBlock* codeBlock = callFrame->codeBlock(); unsigned vPCIndex = codeBlock->bytecodeOffset(callFrame, STUB_RETURN_ADDRESS); stackFrame.globalData->exception = createNotAConstructorError(callFrame, constrVal, vPCIndex, codeBlock); @@ -3389,12 +3394,13 @@ DEFINE_STUB_FUNCTION(JSObject*, op_new_error) CallFrame* callFrame = stackFrame.callFrame; CodeBlock* codeBlock = callFrame->codeBlock(); - unsigned type = stackFrame.args[0].int32(); - JSValue message = stackFrame.args[1].jsValue(); + unsigned isReference = stackFrame.args[0].int32(); + UString message = stackFrame.args[1].jsValue().toString(callFrame); unsigned bytecodeOffset = stackFrame.args[2].int32(); + JSObject* error = isReference ? createReferenceError(callFrame, message) : createSyntaxError(callFrame, message); unsigned lineNumber = codeBlock->lineNumberForBytecodeOffset(callFrame, bytecodeOffset); - return Error::create(callFrame, static_cast(type), message.toString(callFrame), lineNumber, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL()); + return addErrorInfo(stackFrame.globalData, error, lineNumber, codeBlock->ownerExecutable()->source()); } DEFINE_STUB_FUNCTION(void, op_debug) diff --git a/JavaScriptCore/jit/JITStubs.h b/JavaScriptCore/jit/JITStubs.h index bfed811..6d627a1 100644 --- a/JavaScriptCore/jit/JITStubs.h +++ b/JavaScriptCore/jit/JITStubs.h @@ -29,6 +29,7 @@ #ifndef JITStubs_h #define JITStubs_h +#include "CallData.h" #include "MacroAssemblerCodeRef.h" #include "Register.h" #include "ThunkGenerators.h" diff --git a/JavaScriptCore/jsc.cpp b/JavaScriptCore/jsc.cpp index 35ac7f4..c91bcb3 100644 --- a/JavaScriptCore/jsc.cpp +++ b/JavaScriptCore/jsc.cpp @@ -25,6 +25,7 @@ #include "BytecodeGenerator.h" #include "Completion.h" #include "CurrentTime.h" +#include "ExceptionHelpers.h" #include "InitializeThreading.h" #include "JSArray.h" #include "JSFunction.h" @@ -71,19 +72,19 @@ using namespace WTF; static void cleanupGlobalData(JSGlobalData*); static bool fillBufferWithContentsOfFile(const UString& fileName, Vector& buffer); -static JSValue JSC_HOST_CALL functionPrint(ExecState*); -static JSValue JSC_HOST_CALL functionDebug(ExecState*); -static JSValue JSC_HOST_CALL functionGC(ExecState*); -static JSValue JSC_HOST_CALL functionVersion(ExecState*); -static JSValue JSC_HOST_CALL functionRun(ExecState*); -static JSValue JSC_HOST_CALL functionLoad(ExecState*); -static JSValue JSC_HOST_CALL functionCheckSyntax(ExecState*); -static JSValue JSC_HOST_CALL functionReadline(ExecState*); -static NO_RETURN_WITH_VALUE JSValue JSC_HOST_CALL functionQuit(ExecState*); +static EncodedJSValue JSC_HOST_CALL functionPrint(ExecState*); +static EncodedJSValue JSC_HOST_CALL functionDebug(ExecState*); +static EncodedJSValue JSC_HOST_CALL functionGC(ExecState*); +static EncodedJSValue JSC_HOST_CALL functionVersion(ExecState*); +static EncodedJSValue JSC_HOST_CALL functionRun(ExecState*); +static EncodedJSValue JSC_HOST_CALL functionLoad(ExecState*); +static EncodedJSValue JSC_HOST_CALL functionCheckSyntax(ExecState*); +static EncodedJSValue JSC_HOST_CALL functionReadline(ExecState*); +static NO_RETURN_WITH_VALUE EncodedJSValue JSC_HOST_CALL functionQuit(ExecState*); #if ENABLE(SAMPLING_FLAGS) -static JSValue JSC_HOST_CALL functionSetSamplingFlags(ExecState*); -static JSValue JSC_HOST_CALL functionClearSamplingFlags(ExecState*); +static EncodedJSValue JSC_HOST_CALL functionSetSamplingFlags(ExecState*); +static EncodedJSValue JSC_HOST_CALL functionClearSamplingFlags(ExecState*); #endif struct Script { @@ -171,7 +172,7 @@ GlobalObject::GlobalObject(const Vector& arguments) putDirect(Identifier(globalExec(), "arguments"), array); } -JSValue JSC_HOST_CALL functionPrint(ExecState* exec) +EncodedJSValue JSC_HOST_CALL functionPrint(ExecState* exec) { for (unsigned i = 0; i < exec->argumentCount(); ++i) { if (i) @@ -182,36 +183,36 @@ JSValue JSC_HOST_CALL functionPrint(ExecState* exec) putchar('\n'); fflush(stdout); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL functionDebug(ExecState* exec) +EncodedJSValue JSC_HOST_CALL functionDebug(ExecState* exec) { fprintf(stderr, "--> %s\n", exec->argument(0).toString(exec).UTF8String().data()); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL functionGC(ExecState* exec) +EncodedJSValue JSC_HOST_CALL functionGC(ExecState* exec) { JSLock lock(SilenceAssertionsOnly); exec->heap()->collectAllGarbage(); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL functionVersion(ExecState*) +EncodedJSValue JSC_HOST_CALL functionVersion(ExecState*) { // We need this function for compatibility with the Mozilla JS tests but for now // we don't actually do any version-specific handling - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL functionRun(ExecState* exec) +EncodedJSValue JSC_HOST_CALL functionRun(ExecState* exec) { StopWatch stopWatch; UString fileName = exec->argument(0).toString(exec); Vector script; if (!fillBufferWithContentsOfFile(fileName, script)) - return throwError(exec, GeneralError, "Could not open file."); + return JSValue::encode(throwError(exec, createError(exec, "Could not open file."))); JSGlobalObject* globalObject = exec->lexicalGlobalObject(); @@ -219,60 +220,60 @@ JSValue JSC_HOST_CALL functionRun(ExecState* exec) evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(script.data(), fileName)); stopWatch.stop(); - return jsNumber(globalObject->globalExec(), stopWatch.getElapsedMS()); + return JSValue::encode(jsNumber(globalObject->globalExec(), stopWatch.getElapsedMS())); } -JSValue JSC_HOST_CALL functionLoad(ExecState* exec) +EncodedJSValue JSC_HOST_CALL functionLoad(ExecState* exec) { UString fileName = exec->argument(0).toString(exec); Vector script; if (!fillBufferWithContentsOfFile(fileName, script)) - return throwError(exec, GeneralError, "Could not open file."); + return JSValue::encode(throwError(exec, createError(exec, "Could not open file."))); JSGlobalObject* globalObject = exec->lexicalGlobalObject(); Completion result = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(script.data(), fileName)); if (result.complType() == Throw) - exec->setException(result.value()); - return result.value(); + throwError(exec, result.value()); + return JSValue::encode(result.value()); } -JSValue JSC_HOST_CALL functionCheckSyntax(ExecState* exec) +EncodedJSValue JSC_HOST_CALL functionCheckSyntax(ExecState* exec) { UString fileName = exec->argument(0).toString(exec); Vector script; if (!fillBufferWithContentsOfFile(fileName, script)) - return throwError(exec, GeneralError, "Could not open file."); + return JSValue::encode(throwError(exec, createError(exec, "Could not open file."))); JSGlobalObject* globalObject = exec->lexicalGlobalObject(); Completion result = checkSyntax(globalObject->globalExec(), makeSource(script.data(), fileName)); if (result.complType() == Throw) - exec->setException(result.value()); - return result.value(); + throwError(exec, result.value()); + return JSValue::encode(result.value()); } #if ENABLE(SAMPLING_FLAGS) -JSValue JSC_HOST_CALL functionSetSamplingFlags(ExecState* exec) +EncodedJSValue JSC_HOST_CALL functionSetSamplingFlags(ExecState* exec) { for (unsigned i = 0; i < exec->argumentCount(); ++i) { unsigned flag = static_cast(exec->argument(i).toNumber(exec)); if ((flag >= 1) && (flag <= 32)) SamplingFlags::setFlag(flag); } - return jsNull(); + return JSValue::encode(jsNull()); } -JSValue JSC_HOST_CALL functionClearSamplingFlags(ExecState* exec) +EncodedJSValue JSC_HOST_CALL functionClearSamplingFlags(ExecState* exec) { for (unsigned i = 0; i < exec->argumentCount(); ++i) { unsigned flag = static_cast(exec->argument(i).toNumber(exec)); if ((flag >= 1) && (flag <= 32)) SamplingFlags::clearFlag(flag); } - return jsNull(); + return JSValue::encode(jsNull()); } #endif -JSValue JSC_HOST_CALL functionReadline(ExecState* exec) +EncodedJSValue JSC_HOST_CALL functionReadline(ExecState* exec) { Vector line; int c; @@ -283,10 +284,10 @@ JSValue JSC_HOST_CALL functionReadline(ExecState* exec) line.append(c); } line.append('\0'); - return jsString(exec, line.data()); + return JSValue::encode(jsString(exec, line.data())); } -JSValue JSC_HOST_CALL functionQuit(ExecState* exec) +EncodedJSValue JSC_HOST_CALL functionQuit(ExecState* exec) { // Technically, destroying the heap in the middle of JS execution is a no-no, // but we want to maintain compatibility with the Mozilla test suite, so @@ -298,7 +299,7 @@ JSValue JSC_HOST_CALL functionQuit(ExecState* exec) #if COMPILER(MSVC) && OS(WINCE) // Without this, Visual Studio will complain that this method does not return a value. - return jsUndefined(); + return JSValue::encode(jsUndefined()); #endif } diff --git a/JavaScriptCore/jsc/CMakeListsEfl.txt b/JavaScriptCore/jsc/CMakeListsEfl.txt index ab1a013..58d44f4 100644 --- a/JavaScriptCore/jsc/CMakeListsEfl.txt +++ b/JavaScriptCore/jsc/CMakeListsEfl.txt @@ -1,3 +1,8 @@ +LIST(APPEND JSC_LIBRARIES + ${Glib_LIBRARIES} + ${ECORE_LIBRARIES} +) + LIST(APPEND JSC_LINK_FLAGS ${ECORE_LDFLAGS} ) diff --git a/JavaScriptCore/parser/Nodes.h b/JavaScriptCore/parser/Nodes.h index 7852165..57c8f4f 100644 --- a/JavaScriptCore/parser/Nodes.h +++ b/JavaScriptCore/parser/Nodes.h @@ -265,9 +265,9 @@ namespace JSC { uint16_t endOffset() const { return m_endOffset; } protected: - RegisterID* emitThrowError(BytecodeGenerator&, ErrorType, const char* message); - RegisterID* emitThrowError(BytecodeGenerator&, ErrorType, const char* message, const UString&); - RegisterID* emitThrowError(BytecodeGenerator&, ErrorType, const char* message, const Identifier&); + RegisterID* emitThrowError(BytecodeGenerator&, bool isReferenceError, const char* message); + RegisterID* emitThrowError(BytecodeGenerator&, bool isReferenceError, const char* message, const UString&); + RegisterID* emitThrowError(BytecodeGenerator&, bool isReferenceError, const char* message, const Identifier&); private: uint32_t m_divot; diff --git a/JavaScriptCore/pcre/pcre_exec.cpp b/JavaScriptCore/pcre/pcre_exec.cpp index 50973d0..994ec57 100644 --- a/JavaScriptCore/pcre/pcre_exec.cpp +++ b/JavaScriptCore/pcre/pcre_exec.cpp @@ -427,7 +427,7 @@ static inline void startNewGroup(MatchFrame* currentFrame) } // FIXME: "minimize" means "not greedy", we should invert the callers to ask for "greedy" to be less confusing -static inline void repeatInformationFromInstructionOffset(short instructionOffset, bool& minimize, int& minimumRepeats, int& maximumRepeats) +static inline void repeatInformationFromInstructionOffset(int instructionOffset, bool& minimize, int& minimumRepeats, int& maximumRepeats) { // Instruction offsets are based off of OP_CRSTAR, OP_STAR, OP_TYPESTAR, OP_NOTSTAR static const char minimumRepeatsFromInstructionOffset[] = { 0, 0, 1, 1, 0, 0 }; diff --git a/JavaScriptCore/qt/api/qscriptengine.cpp b/JavaScriptCore/qt/api/qscriptengine.cpp index dc08cd9..e1bdf77 100644 --- a/JavaScriptCore/qt/api/qscriptengine.cpp +++ b/JavaScriptCore/qt/api/qscriptengine.cpp @@ -193,6 +193,19 @@ QScriptValue QScriptEngine::undefinedValue() } /*! + Creates a QtScript object of class Object. + + The prototype of the created object will be the Object + prototype object. + + \sa newArray(), QScriptValue::setProperty() +*/ +QScriptValue QScriptEngine::newObject() +{ + return QScriptValuePrivate::get(d_ptr->newObject()); +} + +/*! Returns this engine's Global Object. By default, the Global Object contains the built-in objects that are diff --git a/JavaScriptCore/qt/api/qscriptengine.h b/JavaScriptCore/qt/api/qscriptengine.h index e19ebda..653dffe 100644 --- a/JavaScriptCore/qt/api/qscriptengine.h +++ b/JavaScriptCore/qt/api/qscriptengine.h @@ -50,6 +50,7 @@ public: QScriptValue nullValue(); QScriptValue undefinedValue(); + QScriptValue newObject(); QScriptValue globalObject() const; private: friend class QScriptEnginePrivate; diff --git a/JavaScriptCore/qt/api/qscriptengine_p.cpp b/JavaScriptCore/qt/api/qscriptengine_p.cpp index 38185ab..a6cf4a4 100644 --- a/JavaScriptCore/qt/api/qscriptengine_p.cpp +++ b/JavaScriptCore/qt/api/qscriptengine_p.cpp @@ -74,11 +74,16 @@ QScriptValuePrivate* QScriptEnginePrivate::evaluate(const QScriptProgramPrivate* { if (program->isNull()) return new QScriptValuePrivate; - return new QScriptValuePrivate(this, evaluate(program->program(), program->file(), program->line())); + return new QScriptValuePrivate(this, evaluate(*program, program->file(), program->line())); +} + +QScriptValuePrivate* QScriptEnginePrivate::newObject() const +{ + return new QScriptValuePrivate(this, JSObjectMake(m_context, /* jsClass */ 0, /* userData */ 0)); } QScriptValuePrivate* QScriptEnginePrivate::globalObject() const { - JSObjectRef globalObject = JSContextGetGlobalObject(context()); + JSObjectRef globalObject = JSContextGetGlobalObject(m_context); return new QScriptValuePrivate(this, globalObject, globalObject); } diff --git a/JavaScriptCore/qt/api/qscriptengine_p.h b/JavaScriptCore/qt/api/qscriptengine_p.h index c6c64dd..9083f7d 100644 --- a/JavaScriptCore/qt/api/qscriptengine_p.h +++ b/JavaScriptCore/qt/api/qscriptengine_p.h @@ -56,11 +56,12 @@ public: inline JSValueRef makeJSValue(bool number) const; inline JSValueRef makeJSValue(QScriptValue::SpecialValue value) const; + QScriptValuePrivate* newObject() const; QScriptValuePrivate* globalObject() const; inline QScriptStringPrivate* toStringHandle(const QString& str) const; - inline JSGlobalContextRef context() const; + inline operator JSGlobalContextRef() const; private: QScriptEngine* q_ptr; JSGlobalContextRef m_context; @@ -132,8 +133,9 @@ QScriptStringPrivate* QScriptEnginePrivate::toStringHandle(const QString& str) c return new QScriptStringPrivate(str); } -JSGlobalContextRef QScriptEnginePrivate::context() const +QScriptEnginePrivate::operator JSGlobalContextRef() const { + Q_ASSERT(this); return m_context; } diff --git a/JavaScriptCore/qt/api/qscriptprogram_p.h b/JavaScriptCore/qt/api/qscriptprogram_p.h index 6e80e85..f6882c5 100644 --- a/JavaScriptCore/qt/api/qscriptprogram_p.h +++ b/JavaScriptCore/qt/api/qscriptprogram_p.h @@ -52,7 +52,7 @@ public: inline bool operator==(const QScriptProgramPrivate& other) const; inline bool operator!=(const QScriptProgramPrivate& other) const; - inline JSStringRef program() const; + inline operator JSStringRef() const; inline JSStringRef file() const; inline int line() const; private: @@ -122,7 +122,11 @@ bool QScriptProgramPrivate::operator!=(const QScriptProgramPrivate& other) const || !JSStringIsEqual(m_program, other.m_program); } -JSStringRef QScriptProgramPrivate::program() const { return m_program; } +QScriptProgramPrivate::operator JSStringRef() const +{ + return m_program; +} + JSStringRef QScriptProgramPrivate::file() const {return m_fileName; } int QScriptProgramPrivate::line() const { return m_line; } diff --git a/JavaScriptCore/qt/api/qscriptsyntaxcheckresult.cpp b/JavaScriptCore/qt/api/qscriptsyntaxcheckresult.cpp index 5cf02ef..3948c5d 100644 --- a/JavaScriptCore/qt/api/qscriptsyntaxcheckresult.cpp +++ b/JavaScriptCore/qt/api/qscriptsyntaxcheckresult.cpp @@ -119,7 +119,7 @@ QString QScriptSyntaxCheckResult::errorMessage() const QScriptSyntaxCheckResultPrivate::~QScriptSyntaxCheckResultPrivate() { if (m_exception) - JSValueUnprotect(m_engine->context(), m_exception); + JSValueUnprotect(*m_engine, m_exception); } QString QScriptSyntaxCheckResultPrivate::errorMessage() const @@ -127,7 +127,7 @@ QString QScriptSyntaxCheckResultPrivate::errorMessage() const if (!m_exception) return QString(); - JSStringRef tmp = JSValueToStringCopy(m_engine->context(), m_exception, /* exception */ 0); + JSStringRef tmp = JSValueToStringCopy(*m_engine, m_exception, /* exception */ 0); QString message = QScriptConverter::toString(tmp); JSStringRelease(tmp); return message; @@ -139,10 +139,10 @@ int QScriptSyntaxCheckResultPrivate::errorLineNumber() const return -1; // m_exception is an instance of the Exception so it has "line" attribute. JSStringRef lineAttrName = QScriptConverter::toString("line"); - JSValueRef line = JSObjectGetProperty(m_engine->context(), + JSValueRef line = JSObjectGetProperty(*m_engine, m_exception, lineAttrName, /* exceptions */0); JSStringRelease(lineAttrName); - return JSValueToNumber(m_engine->context(), line, /* exceptions */0); + return JSValueToNumber(*m_engine, line, /* exceptions */0); } diff --git a/JavaScriptCore/qt/api/qscriptvalue.cpp b/JavaScriptCore/qt/api/qscriptvalue.cpp index a53a2fe..22ff8be 100644 --- a/JavaScriptCore/qt/api/qscriptvalue.cpp +++ b/JavaScriptCore/qt/api/qscriptvalue.cpp @@ -556,7 +556,7 @@ QScriptValue& QScriptValue::operator=(const QScriptValue& other) */ bool QScriptValue::equals(const QScriptValue& other) const { - return d_ptr == other.d_ptr || d_ptr->equals(QScriptValuePrivate::get(other)); + return d_ptr->equals(QScriptValuePrivate::get(other)); } /*! @@ -583,5 +583,19 @@ bool QScriptValue::equals(const QScriptValue& other) const */ bool QScriptValue::strictlyEquals(const QScriptValue& other) const { - return d_ptr == other.d_ptr || d_ptr->strictlyEquals(QScriptValuePrivate::get(other)); + return d_ptr->strictlyEquals(QScriptValuePrivate::get(other)); +} + +/*! + Returns true if this QScriptValue is an instance of + \a other; otherwise returns false. + + This QScriptValue is considered to be an instance of \a other if + \a other is a function and the value of the \c{prototype} + property of \a other is in the prototype chain of this + QScriptValue. +*/ +bool QScriptValue::instanceOf(const QScriptValue& other) const +{ + return d_ptr->instanceOf(QScriptValuePrivate::get(other)); } diff --git a/JavaScriptCore/qt/api/qscriptvalue.h b/JavaScriptCore/qt/api/qscriptvalue.h index 182f311..6c42429 100644 --- a/JavaScriptCore/qt/api/qscriptvalue.h +++ b/JavaScriptCore/qt/api/qscriptvalue.h @@ -61,6 +61,7 @@ public: QScriptValue& operator=(const QScriptValue& other); bool equals(const QScriptValue& other) const; bool strictlyEquals(const QScriptValue& other) const; + bool instanceOf(const QScriptValue& other) const; QScriptEngine* engine() const; diff --git a/JavaScriptCore/qt/api/qscriptvalue_p.h b/JavaScriptCore/qt/api/qscriptvalue_p.h index 5959c03..1bb8a77 100644 --- a/JavaScriptCore/qt/api/qscriptvalue_p.h +++ b/JavaScriptCore/qt/api/qscriptvalue_p.h @@ -50,8 +50,8 @@ class QScriptValue; value is kept in m_number CBool -> QSVP is created from bool and no JSC engine has been associated yet. Current value is kept in m_number - CSpecial -> QSVP is Undefined or Null, but a JSC engine hasn't been associated yet, current value - is kept in m_number (cast of QScriptValue::SpecialValue) + CNull -> QSVP is null, but a JSC engine hasn't been associated yet. + CUndefined -> QSVP is undefined, but a JSC engine hasn't been associated yet. JSValue -> QSVP is associated with engine, but there is no information about real type, the state have really short live cycle. Normally it is created as a function call result. JSPrimitive -> QSVP is associated with engine, and it is sure that it isn't a JavaScript object. @@ -59,6 +59,10 @@ class QScriptValue; Each state keep all necessary information to invoke all methods, if not it should be changed to a proper state. Changed state shouldn't be reverted. + + The QScriptValuePrivate use the JSC C API directly. The QSVP type is equal to combination of + the JSValueRef and the JSObjectRef, and it could be automatically casted to these types by cast + operators. */ class QScriptValuePrivate : public QSharedData { @@ -108,14 +112,15 @@ public: inline QScriptValuePrivate* toObject(); inline bool equals(QScriptValuePrivate* other); - inline bool strictlyEquals(const QScriptValuePrivate* other) const; + inline bool strictlyEquals(QScriptValuePrivate* other); + inline bool instanceOf(QScriptValuePrivate* other); inline bool assignEngine(QScriptEnginePrivate* engine); inline QScriptValuePrivate* call(const QScriptValuePrivate* , const QScriptValueList& args); - inline JSGlobalContextRef context() const; - inline JSValueRef value() const; - inline JSObjectRef object() const; + inline operator JSValueRef() const; + inline operator JSObjectRef() const; + inline QScriptEnginePrivate* engine() const; private: @@ -125,7 +130,8 @@ private: CString = 0x1000, CNumber, CBool, - CSpecial, + CNull, + CUndefined, JSValue = 0x2000, // JS values are equal or higher then this value. JSPrimitive, JSObject @@ -161,7 +167,7 @@ QScriptValue QScriptValuePrivate::get(QScriptValuePrivate* d) QScriptValuePrivate::~QScriptValuePrivate() { if (m_value) - JSValueUnprotect(context(), m_value); + JSValueUnprotect(*m_engine, m_value); } QScriptValuePrivate::QScriptValuePrivate() @@ -206,8 +212,7 @@ QScriptValuePrivate::QScriptValuePrivate(qsreal number) } QScriptValuePrivate::QScriptValuePrivate(QScriptValue::SpecialValue value) - : m_state(CSpecial) - , m_number(value) + : m_state(value == QScriptValue::NullValue ? CNull : CUndefined) , m_value(0) { } @@ -218,7 +223,7 @@ QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, boo , m_value(engine->makeJSValue(value)) { Q_ASSERT(engine); - JSValueProtect(context(), m_value); + JSValueProtect(*m_engine, m_value); } QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, int value) @@ -227,7 +232,7 @@ QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, int , m_value(m_engine->makeJSValue(value)) { Q_ASSERT(engine); - JSValueProtect(context(), m_value); + JSValueProtect(*m_engine, m_value); } QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, uint value) @@ -236,7 +241,7 @@ QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, uin , m_value(m_engine->makeJSValue(value)) { Q_ASSERT(engine); - JSValueProtect(context(), m_value); + JSValueProtect(*m_engine, m_value); } QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, qsreal value) @@ -245,7 +250,7 @@ QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, qsr , m_value(m_engine->makeJSValue(value)) { Q_ASSERT(engine); - JSValueProtect(context(), m_value); + JSValueProtect(*m_engine, m_value); } QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, const QString& value) @@ -254,7 +259,7 @@ QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, con , m_value(m_engine->makeJSValue(value)) { Q_ASSERT(engine); - JSValueProtect(context(), m_value); + JSValueProtect(*m_engine, m_value); } QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, QScriptValue::SpecialValue value) @@ -263,7 +268,7 @@ QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, QSc , m_value(m_engine->makeJSValue(value)) { Q_ASSERT(engine); - JSValueProtect(context(), m_value); + JSValueProtect(*m_engine, m_value); } QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, JSValueRef value) @@ -273,7 +278,7 @@ QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, JSV { Q_ASSERT(engine); Q_ASSERT(value); - JSValueProtect(context(), m_value); + JSValueProtect(*m_engine, m_value); } QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, JSValueRef value, JSObjectRef object) @@ -285,7 +290,7 @@ QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, JSV Q_ASSERT(engine); Q_ASSERT(value); Q_ASSERT(object); - JSValueProtect(context(), m_value); + JSValueProtect(*m_engine, m_value); } bool QScriptValuePrivate::isValid() const { return m_state != Invalid; } @@ -300,7 +305,7 @@ bool QScriptValuePrivate::isBool() return false; // Fall-through. case JSPrimitive: - return JSValueIsBoolean(context(), value()); + return JSValueIsBoolean(*m_engine, *this); default: return false; } @@ -316,7 +321,7 @@ bool QScriptValuePrivate::isNumber() return false; // Fall-through. case JSPrimitive: - return JSValueIsNumber(context(), value()); + return JSValueIsNumber(*m_engine, *this); default: return false; } @@ -325,14 +330,14 @@ bool QScriptValuePrivate::isNumber() bool QScriptValuePrivate::isNull() { switch (m_state) { - case CSpecial: - return m_number == static_cast(QScriptValue::NullValue); + case CNull: + return true; case JSValue: if (refinedJSValue() != JSPrimitive) return false; // Fall-through. case JSPrimitive: - return JSValueIsNull(context(), value()); + return JSValueIsNull(*m_engine, *this); default: return false; } @@ -348,7 +353,7 @@ bool QScriptValuePrivate::isString() return false; // Fall-through. case JSPrimitive: - return JSValueIsString(context(), value()); + return JSValueIsString(*m_engine, *this); default: return false; } @@ -357,14 +362,14 @@ bool QScriptValuePrivate::isString() bool QScriptValuePrivate::isUndefined() { switch (m_state) { - case CSpecial: - return m_number == static_cast(QScriptValue::UndefinedValue); + case CUndefined: + return true; case JSValue: if (refinedJSValue() != JSPrimitive) return false; // Fall-through. case JSPrimitive: - return JSValueIsUndefined(context(), value()); + return JSValueIsUndefined(*m_engine, *this); default: return false; } @@ -405,7 +410,7 @@ bool QScriptValuePrivate::isFunction() return false; // Fall-through. case JSObject: - return JSObjectIsFunction(context(), object()); + return JSObjectIsFunction(*m_engine, *this); default: return false; } @@ -422,12 +427,14 @@ QString QScriptValuePrivate::toString() const return m_string; case CNumber: return QScriptConverter::toString(m_number); - case CSpecial: - return m_number == QScriptValue::NullValue ? QString::fromLatin1("null") : QString::fromLatin1("undefined"); + case CNull: + return QString::fromLatin1("null"); + case CUndefined: + return QString::fromLatin1("undefined"); case JSValue: case JSPrimitive: case JSObject: - JSRetainPtr ptr(Adopt, JSValueToStringCopy(context(), value(), /* exception */ 0)); + JSRetainPtr ptr(Adopt, JSValueToStringCopy(*m_engine, *this, /* exception */ 0)); return QScriptConverter::toString(ptr.get()); } @@ -441,15 +448,16 @@ qsreal QScriptValuePrivate::toNumber() const case JSValue: case JSPrimitive: case JSObject: - return JSValueToNumber(context(), value(), /* exception */ 0); + return JSValueToNumber(*m_engine, *this, /* exception */ 0); case CNumber: return m_number; case CBool: return m_number ? 1 : 0; + case CNull: case Invalid: return 0; - case CSpecial: - return m_number == QScriptValue::NullValue ? 0 : qQNaN(); + case CUndefined: + return qQNaN(); case CString: bool ok; qsreal result = m_string.toDouble(&ok); @@ -472,7 +480,7 @@ bool QScriptValuePrivate::toBool() const switch (m_state) { case JSValue: case JSPrimitive: - return JSValueToBoolean(context(), value()); + return JSValueToBoolean(*m_engine, *this); case JSObject: return true; case CNumber: @@ -480,7 +488,8 @@ bool QScriptValuePrivate::toBool() const case CBool: return m_number; case Invalid: - case CSpecial: + case CNull: + case CUndefined: return false; case CString: return m_string.length(); @@ -536,26 +545,27 @@ QScriptValuePrivate* QScriptValuePrivate::toObject(QScriptEnginePrivate* engine) { switch (m_state) { case Invalid: - case CSpecial: + case CNull: + case CUndefined: return new QScriptValuePrivate; case CString: { // Exception can't occur here. - JSObjectRef object = JSValueToObject(engine->context(), engine->makeJSValue(m_string), /* exception */ 0); + JSObjectRef object = JSValueToObject(*engine, engine->makeJSValue(m_string), /* exception */ 0); Q_ASSERT(object); return new QScriptValuePrivate(engine, object, object); } case CNumber: { // Exception can't occur here. - JSObjectRef object = JSValueToObject(engine->context(), engine->makeJSValue(m_number), /* exception */ 0); + JSObjectRef object = JSValueToObject(*engine, engine->makeJSValue(m_number), /* exception */ 0); Q_ASSERT(object); return new QScriptValuePrivate(engine, object, object); } case CBool: { // Exception can't occure here. - JSObjectRef object = JSValueToObject(engine->context(), engine->makeJSValue(static_cast(m_number)), /* exception */ 0); + JSObjectRef object = JSValueToObject(*engine, engine->makeJSValue(static_cast(m_number)), /* exception */ 0); Q_ASSERT(object); return new QScriptValuePrivate(engine, object, object); } @@ -567,7 +577,7 @@ QScriptValuePrivate* QScriptValuePrivate::toObject(QScriptEnginePrivate* engine) { if (engine != this->engine()) qWarning("QScriptEngine::toObject: cannot convert value created in a different engine"); - JSObjectRef object = JSValueToObject(context(), value(), /* exception */ 0); + JSObjectRef object = JSValueToObject(*m_engine, *this, /* exception */ 0); if (object) return new QScriptValuePrivate(m_engine.constData(), object); } @@ -597,47 +607,79 @@ QScriptValuePrivate* QScriptValuePrivate::toObject() bool QScriptValuePrivate::equals(QScriptValuePrivate* other) { - if (!isValid() || !other->isValid()) + if (!isValid()) + return !other->isValid(); + + if (!other->isValid()) return false; if ((m_state == other->m_state) && !isJSBased()) { if (isNumberBased()) return m_number == other->m_number; + Q_ASSERT(isStringBased()); return m_string == other->m_string; } + if (!isJSBased() && !other->isJSBased()) + return false; + if (isJSBased() && !other->isJSBased()) { if (!other->assignEngine(engine())) { qWarning("equals(): Cannot compare to a value created in a different engine"); return false; } } else if (!isJSBased() && other->isJSBased()) { - if (!other->assignEngine(other->engine())) { + if (!assignEngine(other->engine())) { qWarning("equals(): Cannot compare to a value created in a different engine"); return false; } } - return JSValueIsEqual(context(), value(), other->value(), /* exception */ 0); + return JSValueIsEqual(*m_engine, *this, *other, /* exception */ 0); } -bool QScriptValuePrivate::strictlyEquals(const QScriptValuePrivate* other) const +bool QScriptValuePrivate::strictlyEquals(QScriptValuePrivate* other) { - if (m_state != other->m_state) - return false; if (isJSBased()) { + // We can't compare these two values without binding to the same engine. + if (!other->isJSBased()) { + if (other->assignEngine(engine())) + return JSValueIsStrictEqual(*m_engine, *this, *other); + return false; + } if (other->engine() != engine()) { qWarning("strictlyEquals(): Cannot compare to a value created in a different engine"); return false; } - return JSValueIsStrictEqual(context(), value(), other->value()); + return JSValueIsStrictEqual(*m_engine, *this, *other); } - if (isStringBased()) - return m_string == other->m_string; - if (isNumberBased()) - return m_number == other->m_number; + if (isStringBased()) { + if (other->isStringBased()) + return m_string == other->m_string; + if (other->isJSBased()) { + assignEngine(other->engine()); + return JSValueIsStrictEqual(*m_engine, *this, *other); + } + } + if (isNumberBased()) { + if (other->isNumberBased()) + return m_number == other->m_number; + if (other->isJSBased()) { + assignEngine(other->engine()); + return JSValueIsStrictEqual(*m_engine, *this, *other); + } + } + if (!isValid() && !other->isValid()) + return true; - return false; // Invalid state. + return false; +} + +inline bool QScriptValuePrivate::instanceOf(QScriptValuePrivate* other) +{ + if (!isJSBased() || !other->isObject()) + return false; + return JSValueIsInstanceOfConstructor(*m_engine, *this, *other, /* exception */ 0); } /*! @@ -656,8 +698,11 @@ bool QScriptValuePrivate::assignEngine(QScriptEnginePrivate* engine) case CNumber: value = engine->makeJSValue(m_number); break; - case CSpecial: - value = engine->makeJSValue(static_cast(m_number)); + case CNull: + value = engine->makeJSValue(QScriptValue::NullValue); + break; + case CUndefined: + value = engine->makeJSValue(QScriptValue::UndefinedValue); break; default: if (!isJSBased()) @@ -691,12 +736,12 @@ QScriptValuePrivate* QScriptValuePrivate::call(const QScriptValuePrivate*, const qWarning("QScriptValue::call() failed: cannot call function with values created in a different engine"); return new QScriptValuePrivate; } - argv[j] = value->value(); + argv[j] = *value; } // Make the call JSValueRef exception = 0; - JSValueRef result = JSObjectCallAsFunction(context(), object(), /* thisObject */ 0, argc, argv.constData(), &exception); + JSValueRef result = JSObjectCallAsFunction(*m_engine, *this, /* thisObject */ 0, argc, argv.constData(), &exception); if (!result && exception) return new QScriptValuePrivate(engine(), exception); if (result && !exception) @@ -715,19 +760,13 @@ QScriptEnginePrivate* QScriptValuePrivate::engine() const return m_engine.data(); } -JSGlobalContextRef QScriptValuePrivate::context() const -{ - Q_ASSERT(isJSBased()); - return m_engine->context(); -} - -JSValueRef QScriptValuePrivate::value() const +QScriptValuePrivate::operator JSValueRef() const { Q_ASSERT(isJSBased()); return m_value; } -JSObjectRef QScriptValuePrivate::object() const +QScriptValuePrivate::operator JSObjectRef() const { Q_ASSERT(m_state == JSObject); return m_object; @@ -736,9 +775,9 @@ JSObjectRef QScriptValuePrivate::object() const void QScriptValuePrivate::setValue(JSValueRef value) { if (m_value) - JSValueUnprotect(context(), m_value); + JSValueUnprotect(*m_engine, m_value); if (value) - JSValueProtect(context(), value); + JSValueProtect(*m_engine, value); m_value = value; } @@ -750,11 +789,11 @@ void QScriptValuePrivate::setValue(JSValueRef value) bool QScriptValuePrivate::inherits(const char* name) { Q_ASSERT(isJSBased()); - JSObjectRef globalObject = JSContextGetGlobalObject(context()); + JSObjectRef globalObject = JSContextGetGlobalObject(*m_engine); JSStringRef errorAttrName = QScriptConverter::toString(name); - JSValueRef error = JSObjectGetProperty(context(), globalObject, errorAttrName, /* exception */ 0); + JSValueRef error = JSObjectGetProperty(*m_engine, globalObject, errorAttrName, /* exception */ 0); JSStringRelease(errorAttrName); - return JSValueIsInstanceOfConstructor(context(), value(), JSValueToObject(context(), error, /* exception */ 0), /* exception */ 0); + return JSValueIsInstanceOfConstructor(*m_engine, *this, JSValueToObject(*m_engine, error, /* exception */ 0), /* exception */ 0); } /*! @@ -764,12 +803,12 @@ bool QScriptValuePrivate::inherits(const char* name) QScriptValuePrivate::State QScriptValuePrivate::refinedJSValue() { Q_ASSERT(m_state == JSValue); - if (!JSValueIsObject(context(), value())) { + if (!JSValueIsObject(*m_engine, *this)) { m_state = JSPrimitive; } else { m_state = JSObject; // We are sure that value is an JSObject, so we can const_cast safely without - // calling JSC C API (JSValueToObject(context(), value(), /* exceptions */ 0)). + // calling JSC C API (JSValueToObject(*m_engine, *this, /* exceptions */ 0)). m_object = const_cast(m_value); } return m_state; @@ -785,7 +824,7 @@ bool QScriptValuePrivate::isJSBased() const { return m_state >= JSValue; } \internal Returns true if current value of QSV is placed in m_number. */ -bool QScriptValuePrivate::isNumberBased() const { return !isJSBased() && !isStringBased() && m_state != Invalid; } +bool QScriptValuePrivate::isNumberBased() const { return m_state == CNumber || m_state == CBool; } /*! \internal diff --git a/JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp b/JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp index 38243d2..d545f37 100644 --- a/JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp +++ b/JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp @@ -35,6 +35,7 @@ public slots: void cleanup() {} private slots: + void newObject(); void globalObject(); void evaluate(); void collectGarbage(); @@ -56,6 +57,18 @@ void tst_QScriptEngine::evaluate() QVERIFY2(engine.evaluate("ping").isValid(), "Script throwing an unhandled exception should return an exception value"); } +void tst_QScriptEngine::newObject() +{ + QScriptEngine engine; + QScriptValue object = engine.newObject(); + QVERIFY(object.isObject()); + QVERIFY(object.engine() == &engine); + QVERIFY(!object.isError()); + QVERIFY(!object.equals(engine.newObject())); + QVERIFY(!object.strictlyEquals(engine.newObject())); + QCOMPARE(object.toString(), QString::fromAscii("[object Object]")); +} + void tst_QScriptEngine::globalObject() { QScriptEngine engine; @@ -63,7 +76,6 @@ void tst_QScriptEngine::globalObject() QScriptValue self = engine.evaluate("this"); QVERIFY(global.isObject()); QVERIFY(engine.globalObject().equals(engine.evaluate("this"))); - QEXPECT_FAIL("", "strictlyEquals is broken - bug 36600 in bugs.webkit.org", Continue); QVERIFY(engine.globalObject().strictlyEquals(self)); } diff --git a/JavaScriptCore/qt/tests/qscriptvalue/qscriptvalue.pro b/JavaScriptCore/qt/tests/qscriptvalue/qscriptvalue.pro index 532d430..02e94ec 100644 --- a/JavaScriptCore/qt/tests/qscriptvalue/qscriptvalue.pro +++ b/JavaScriptCore/qt/tests/qscriptvalue/qscriptvalue.pro @@ -7,6 +7,7 @@ include(../tests.pri) SOURCES += \ tst_qscriptvalue.cpp \ tst_qscriptvalue_generated_init.cpp \ + tst_qscriptvalue_generated_comparison.cpp \ tst_qscriptvalue_generated_istype.cpp \ tst_qscriptvalue_generated_totype.cpp \ diff --git a/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h b/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h index 3d33f8e..0565b6f 100644 --- a/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h +++ b/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h @@ -103,6 +103,15 @@ private slots: void toUInt16_data(); void toUInt16(); + void equals_data(); + void equals(); + + void strictlyEquals_data(); + void strictlyEquals(); + + void instanceOf_data(); + void instanceOf(); + private: typedef void (tst_QScriptValue::*InitDataFunction)(); typedef void (tst_QScriptValue::*DefineDataFunction)(const char*); @@ -184,6 +193,18 @@ private: void toUInt16_makeData(const char*); void toUInt16_test(const char*, const QScriptValue&); + void equals_initData(); + void equals_makeData(const char*); + void equals_test(const char*, const QScriptValue&); + + void strictlyEquals_initData(); + void strictlyEquals_makeData(const char*); + void strictlyEquals_test(const char*, const QScriptValue&); + + void instanceOf_initData(); + void instanceOf_makeData(const char*); + void instanceOf_test(const char*, const QScriptValue&); + private: QScriptEngine* engine; QHash m_values; diff --git a/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp b/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp new file mode 100644 index 0000000..7586b15 --- /dev/null +++ b/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp @@ -0,0 +1,1742 @@ +/* + Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + + 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. +*/ + +/**************************************************************************** +*************** This file has been generated. DO NOT MODIFY! **************** +****************************************************************************/ + +#include "tst_qscriptvalue.h" + +void tst_QScriptValue::equals_initData() +{ + QTest::addColumn("other"); + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString equals_array[] = { + "QScriptValue() <=> QScriptValue()", + "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::NullValue)", + "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")", + "QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")", + "QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"null\")", + "QScriptValue(QScriptValue::UndefinedValue) <=> engine->nullValue()", + "QScriptValue(QScriptValue::UndefinedValue) <=> engine->undefinedValue()", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"{}\")", + "QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"undefined\")", + "QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"null\")", + "QScriptValue(QScriptValue::NullValue) <=> engine->nullValue()", + "QScriptValue(QScriptValue::NullValue) <=> engine->undefinedValue()", + "QScriptValue(true) <=> QScriptValue(true)", + "QScriptValue(true) <=> QScriptValue(0, true)", + "QScriptValue(true) <=> QScriptValue(engine, true)", + "QScriptValue(true) <=> engine->evaluate(\"true\")", + "QScriptValue(false) <=> QScriptValue(false)", + "QScriptValue(false) <=> QScriptValue(0)", + "QScriptValue(false) <=> QScriptValue(0.0)", + "QScriptValue(false) <=> QScriptValue(QString(\"\"))", + "QScriptValue(false) <=> QScriptValue(QString())", + "QScriptValue(false) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(false) <=> QScriptValue(0, false)", + "QScriptValue(false) <=> QScriptValue(0, 0)", + "QScriptValue(false) <=> QScriptValue(0, 0.0)", + "QScriptValue(false) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(false) <=> QScriptValue(0, QString())", + "QScriptValue(false) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(false) <=> QScriptValue(engine, false)", + "QScriptValue(false) <=> QScriptValue(engine, 0)", + "QScriptValue(false) <=> QScriptValue(engine, 0.0)", + "QScriptValue(false) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(false) <=> QScriptValue(engine, QString())", + "QScriptValue(false) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(false) <=> engine->evaluate(\"[]\")", + "QScriptValue(false) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(false) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(false) <=> engine->evaluate(\"false\")", + "QScriptValue(false) <=> engine->evaluate(\"0\")", + "QScriptValue(false) <=> engine->evaluate(\"0.0\")", + "QScriptValue(false) <=> engine->evaluate(\"''\")", + "QScriptValue(false) <=> engine->evaluate(\"'0'\")", + "QScriptValue(int(122)) <=> QScriptValue(int(122))", + "QScriptValue(int(122)) <=> QScriptValue(0, int(122))", + "QScriptValue(int(122)) <=> QScriptValue(engine, int(122))", + "QScriptValue(int(122)) <=> engine->evaluate(\"122\")", + "QScriptValue(uint(124)) <=> QScriptValue(uint(124))", + "QScriptValue(uint(124)) <=> QScriptValue(0, uint(124))", + "QScriptValue(uint(124)) <=> QScriptValue(engine, uint(124))", + "QScriptValue(uint(124)) <=> engine->evaluate(\"124\")", + "QScriptValue(0) <=> QScriptValue(false)", + "QScriptValue(0) <=> QScriptValue(0)", + "QScriptValue(0) <=> QScriptValue(0.0)", + "QScriptValue(0) <=> QScriptValue(QString(\"\"))", + "QScriptValue(0) <=> QScriptValue(QString())", + "QScriptValue(0) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(0) <=> QScriptValue(0, false)", + "QScriptValue(0) <=> QScriptValue(0, 0)", + "QScriptValue(0) <=> QScriptValue(0, 0.0)", + "QScriptValue(0) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(0) <=> QScriptValue(0, QString())", + "QScriptValue(0) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(0) <=> QScriptValue(engine, false)", + "QScriptValue(0) <=> QScriptValue(engine, 0)", + "QScriptValue(0) <=> QScriptValue(engine, 0.0)", + "QScriptValue(0) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(0) <=> QScriptValue(engine, QString())", + "QScriptValue(0) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(0) <=> engine->evaluate(\"[]\")", + "QScriptValue(0) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(0) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(0) <=> engine->evaluate(\"false\")", + "QScriptValue(0) <=> engine->evaluate(\"0\")", + "QScriptValue(0) <=> engine->evaluate(\"0.0\")", + "QScriptValue(0) <=> engine->evaluate(\"''\")", + "QScriptValue(0) <=> engine->evaluate(\"'0'\")", + "QScriptValue(0.0) <=> QScriptValue(false)", + "QScriptValue(0.0) <=> QScriptValue(0)", + "QScriptValue(0.0) <=> QScriptValue(0.0)", + "QScriptValue(0.0) <=> QScriptValue(QString(\"\"))", + "QScriptValue(0.0) <=> QScriptValue(QString())", + "QScriptValue(0.0) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(0.0) <=> QScriptValue(0, false)", + "QScriptValue(0.0) <=> QScriptValue(0, 0)", + "QScriptValue(0.0) <=> QScriptValue(0, 0.0)", + "QScriptValue(0.0) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(0.0) <=> QScriptValue(0, QString())", + "QScriptValue(0.0) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(0.0) <=> QScriptValue(engine, false)", + "QScriptValue(0.0) <=> QScriptValue(engine, 0)", + "QScriptValue(0.0) <=> QScriptValue(engine, 0.0)", + "QScriptValue(0.0) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(0.0) <=> QScriptValue(engine, QString())", + "QScriptValue(0.0) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(0.0) <=> engine->evaluate(\"[]\")", + "QScriptValue(0.0) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(0.0) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(0.0) <=> engine->evaluate(\"false\")", + "QScriptValue(0.0) <=> engine->evaluate(\"0\")", + "QScriptValue(0.0) <=> engine->evaluate(\"0.0\")", + "QScriptValue(0.0) <=> engine->evaluate(\"''\")", + "QScriptValue(0.0) <=> engine->evaluate(\"'0'\")", + "QScriptValue(123.0) <=> QScriptValue(123.0)", + "QScriptValue(123.0) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(123.0) <=> QScriptValue(0, 123.0)", + "QScriptValue(123.0) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(123.0) <=> QScriptValue(engine, 123.0)", + "QScriptValue(123.0) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(123.0) <=> engine->evaluate(\"123.0\")", + "QScriptValue(123.0) <=> engine->evaluate(\"'123'\")", + "QScriptValue(6.37e-8) <=> QScriptValue(6.37e-8)", + "QScriptValue(6.37e-8) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(6.37e-8) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(6.37e-8) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(-6.37e-8) <=> QScriptValue(-6.37e-8)", + "QScriptValue(-6.37e-8) <=> QScriptValue(0, -6.37e-8)", + "QScriptValue(-6.37e-8) <=> QScriptValue(engine, -6.37e-8)", + "QScriptValue(-6.37e-8) <=> engine->evaluate(\"-6.37e-8\")", + "QScriptValue(0x43211234) <=> QScriptValue(0x43211234)", + "QScriptValue(0x43211234) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0x43211234) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0x43211234) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0x10000) <=> QScriptValue(0x10000)", + "QScriptValue(0x10000) <=> QScriptValue(0, 0x10000)", + "QScriptValue(0x10000) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(0x10000) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(0x10001) <=> QScriptValue(0x10001)", + "QScriptValue(0x10001) <=> QScriptValue(0, 0x10001)", + "QScriptValue(0x10001) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0x10001) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(qInf()) <=> QScriptValue(qInf())", + "QScriptValue(qInf()) <=> QScriptValue(\"Infinity\")", + "QScriptValue(qInf()) <=> QScriptValue(0, qInf())", + "QScriptValue(qInf()) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(qInf()) <=> QScriptValue(engine, qInf())", + "QScriptValue(qInf()) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(qInf()) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(-qInf()) <=> QScriptValue(-qInf())", + "QScriptValue(-qInf()) <=> QScriptValue(\"-Infinity\")", + "QScriptValue(-qInf()) <=> QScriptValue(0, -qInf())", + "QScriptValue(-qInf()) <=> QScriptValue(0, \"-Infinity\")", + "QScriptValue(-qInf()) <=> QScriptValue(engine, -qInf())", + "QScriptValue(-qInf()) <=> QScriptValue(engine, \"-Infinity\")", + "QScriptValue(-qInf()) <=> engine->evaluate(\"-Infinity\")", + "QScriptValue(\"NaN\") <=> QScriptValue(\"NaN\")", + "QScriptValue(\"NaN\") <=> QScriptValue(0, \"NaN\")", + "QScriptValue(\"NaN\") <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(\"Infinity\") <=> QScriptValue(qInf())", + "QScriptValue(\"Infinity\") <=> QScriptValue(\"Infinity\")", + "QScriptValue(\"Infinity\") <=> QScriptValue(0, qInf())", + "QScriptValue(\"Infinity\") <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(\"Infinity\") <=> QScriptValue(engine, qInf())", + "QScriptValue(\"Infinity\") <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(\"Infinity\") <=> engine->evaluate(\"Infinity\")", + "QScriptValue(\"-Infinity\") <=> QScriptValue(-qInf())", + "QScriptValue(\"-Infinity\") <=> QScriptValue(\"-Infinity\")", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0, -qInf())", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0, \"-Infinity\")", + "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, -qInf())", + "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"-Infinity\")", + "QScriptValue(\"ciao\") <=> QScriptValue(\"ciao\")", + "QScriptValue(\"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(\"ciao\") <=> QScriptValue(0, \"ciao\")", + "QScriptValue(\"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(\"ciao\") <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(\"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(\"ciao\") <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(QString(\"\")) <=> QScriptValue(false)", + "QScriptValue(QString(\"\")) <=> QScriptValue(0)", + "QScriptValue(QString(\"\")) <=> QScriptValue(0.0)", + "QScriptValue(QString(\"\")) <=> QScriptValue(QString(\"\"))", + "QScriptValue(QString(\"\")) <=> QScriptValue(QString())", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, false)", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, 0)", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, 0.0)", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, QString())", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, false)", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, 0)", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, 0.0)", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, QString())", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"[]\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"false\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"0\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"0.0\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"''\")", + "QScriptValue(QString()) <=> QScriptValue(false)", + "QScriptValue(QString()) <=> QScriptValue(0)", + "QScriptValue(QString()) <=> QScriptValue(0.0)", + "QScriptValue(QString()) <=> QScriptValue(QString(\"\"))", + "QScriptValue(QString()) <=> QScriptValue(QString())", + "QScriptValue(QString()) <=> QScriptValue(0, false)", + "QScriptValue(QString()) <=> QScriptValue(0, 0)", + "QScriptValue(QString()) <=> QScriptValue(0, 0.0)", + "QScriptValue(QString()) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(QString()) <=> QScriptValue(0, QString())", + "QScriptValue(QString()) <=> QScriptValue(engine, false)", + "QScriptValue(QString()) <=> QScriptValue(engine, 0)", + "QScriptValue(QString()) <=> QScriptValue(engine, 0.0)", + "QScriptValue(QString()) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(QString()) <=> QScriptValue(engine, QString())", + "QScriptValue(QString()) <=> engine->evaluate(\"[]\")", + "QScriptValue(QString()) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(QString()) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(QString()) <=> engine->evaluate(\"false\")", + "QScriptValue(QString()) <=> engine->evaluate(\"0\")", + "QScriptValue(QString()) <=> engine->evaluate(\"0.0\")", + "QScriptValue(QString()) <=> engine->evaluate(\"''\")", + "QScriptValue(QString(\"0\")) <=> QScriptValue(false)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0.0)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0, false)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0, 0)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0, 0.0)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, false)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, 0)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, 0.0)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"false\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"0\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"0.0\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"'0'\")", + "QScriptValue(QString(\"123\")) <=> QScriptValue(123.0)", + "QScriptValue(QString(\"123\")) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(QString(\"123\")) <=> QScriptValue(0, 123.0)", + "QScriptValue(QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(QString(\"123\")) <=> QScriptValue(engine, 123.0)", + "QScriptValue(QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"123.0\")", + "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"'123'\")", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::NullValue)", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"null\")", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->nullValue()", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->undefinedValue()", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"{}\")", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"undefined\")", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"null\")", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->nullValue()", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->undefinedValue()", + "QScriptValue(0, true) <=> QScriptValue(true)", + "QScriptValue(0, true) <=> QScriptValue(0, true)", + "QScriptValue(0, true) <=> QScriptValue(engine, true)", + "QScriptValue(0, true) <=> engine->evaluate(\"true\")", + "QScriptValue(0, false) <=> QScriptValue(false)", + "QScriptValue(0, false) <=> QScriptValue(0)", + "QScriptValue(0, false) <=> QScriptValue(0.0)", + "QScriptValue(0, false) <=> QScriptValue(QString(\"\"))", + "QScriptValue(0, false) <=> QScriptValue(QString())", + "QScriptValue(0, false) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(0, false) <=> QScriptValue(0, false)", + "QScriptValue(0, false) <=> QScriptValue(0, 0)", + "QScriptValue(0, false) <=> QScriptValue(0, 0.0)", + "QScriptValue(0, false) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(0, false) <=> QScriptValue(0, QString())", + "QScriptValue(0, false) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, false) <=> QScriptValue(engine, false)", + "QScriptValue(0, false) <=> QScriptValue(engine, 0)", + "QScriptValue(0, false) <=> QScriptValue(engine, 0.0)", + "QScriptValue(0, false) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(0, false) <=> QScriptValue(engine, QString())", + "QScriptValue(0, false) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(0, false) <=> engine->evaluate(\"[]\")", + "QScriptValue(0, false) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(0, false) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(0, false) <=> engine->evaluate(\"false\")", + "QScriptValue(0, false) <=> engine->evaluate(\"0\")", + "QScriptValue(0, false) <=> engine->evaluate(\"0.0\")", + "QScriptValue(0, false) <=> engine->evaluate(\"''\")", + "QScriptValue(0, false) <=> engine->evaluate(\"'0'\")", + "QScriptValue(0, int(122)) <=> QScriptValue(int(122))", + "QScriptValue(0, int(122)) <=> QScriptValue(0, int(122))", + "QScriptValue(0, int(122)) <=> QScriptValue(engine, int(122))", + "QScriptValue(0, int(122)) <=> engine->evaluate(\"122\")", + "QScriptValue(0, uint(124)) <=> QScriptValue(uint(124))", + "QScriptValue(0, uint(124)) <=> QScriptValue(0, uint(124))", + "QScriptValue(0, uint(124)) <=> QScriptValue(engine, uint(124))", + "QScriptValue(0, uint(124)) <=> engine->evaluate(\"124\")", + "QScriptValue(0, 0) <=> QScriptValue(false)", + "QScriptValue(0, 0) <=> QScriptValue(0)", + "QScriptValue(0, 0) <=> QScriptValue(0.0)", + "QScriptValue(0, 0) <=> QScriptValue(QString(\"\"))", + "QScriptValue(0, 0) <=> QScriptValue(QString())", + "QScriptValue(0, 0) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(0, 0) <=> QScriptValue(0, false)", + "QScriptValue(0, 0) <=> QScriptValue(0, 0)", + "QScriptValue(0, 0) <=> QScriptValue(0, 0.0)", + "QScriptValue(0, 0) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(0, 0) <=> QScriptValue(0, QString())", + "QScriptValue(0, 0) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, 0) <=> QScriptValue(engine, false)", + "QScriptValue(0, 0) <=> QScriptValue(engine, 0)", + "QScriptValue(0, 0) <=> QScriptValue(engine, 0.0)", + "QScriptValue(0, 0) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(0, 0) <=> QScriptValue(engine, QString())", + "QScriptValue(0, 0) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(0, 0) <=> engine->evaluate(\"[]\")", + "QScriptValue(0, 0) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(0, 0) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(0, 0) <=> engine->evaluate(\"false\")", + "QScriptValue(0, 0) <=> engine->evaluate(\"0\")", + "QScriptValue(0, 0) <=> engine->evaluate(\"0.0\")", + "QScriptValue(0, 0) <=> engine->evaluate(\"''\")", + "QScriptValue(0, 0) <=> engine->evaluate(\"'0'\")", + "QScriptValue(0, 0.0) <=> QScriptValue(false)", + "QScriptValue(0, 0.0) <=> QScriptValue(0)", + "QScriptValue(0, 0.0) <=> QScriptValue(0.0)", + "QScriptValue(0, 0.0) <=> QScriptValue(QString(\"\"))", + "QScriptValue(0, 0.0) <=> QScriptValue(QString())", + "QScriptValue(0, 0.0) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(0, 0.0) <=> QScriptValue(0, false)", + "QScriptValue(0, 0.0) <=> QScriptValue(0, 0)", + "QScriptValue(0, 0.0) <=> QScriptValue(0, 0.0)", + "QScriptValue(0, 0.0) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(0, 0.0) <=> QScriptValue(0, QString())", + "QScriptValue(0, 0.0) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, 0.0) <=> QScriptValue(engine, false)", + "QScriptValue(0, 0.0) <=> QScriptValue(engine, 0)", + "QScriptValue(0, 0.0) <=> QScriptValue(engine, 0.0)", + "QScriptValue(0, 0.0) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(0, 0.0) <=> QScriptValue(engine, QString())", + "QScriptValue(0, 0.0) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"[]\")", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"false\")", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"0\")", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"0.0\")", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"''\")", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"'0'\")", + "QScriptValue(0, 123.0) <=> QScriptValue(123.0)", + "QScriptValue(0, 123.0) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(0, 123.0) <=> QScriptValue(0, 123.0)", + "QScriptValue(0, 123.0) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, 123.0) <=> QScriptValue(engine, 123.0)", + "QScriptValue(0, 123.0) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(0, 123.0) <=> engine->evaluate(\"123.0\")", + "QScriptValue(0, 123.0) <=> engine->evaluate(\"'123'\")", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(6.37e-8)", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(-6.37e-8)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(0, -6.37e-8)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, -6.37e-8)", + "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"-6.37e-8\")", + "QScriptValue(0, 0x43211234) <=> QScriptValue(0x43211234)", + "QScriptValue(0, 0x43211234) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0, 0x43211234) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0, 0x43211234) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0, 0x10000) <=> QScriptValue(0x10000)", + "QScriptValue(0, 0x10000) <=> QScriptValue(0, 0x10000)", + "QScriptValue(0, 0x10000) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(0, 0x10000) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(0, 0x10001) <=> QScriptValue(0x10001)", + "QScriptValue(0, 0x10001) <=> QScriptValue(0, 0x10001)", + "QScriptValue(0, 0x10001) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0, 0x10001) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(0, qInf()) <=> QScriptValue(qInf())", + "QScriptValue(0, qInf()) <=> QScriptValue(\"Infinity\")", + "QScriptValue(0, qInf()) <=> QScriptValue(0, qInf())", + "QScriptValue(0, qInf()) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0, qInf()) <=> QScriptValue(engine, qInf())", + "QScriptValue(0, qInf()) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0, qInf()) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0, -qInf()) <=> QScriptValue(-qInf())", + "QScriptValue(0, -qInf()) <=> QScriptValue(\"-Infinity\")", + "QScriptValue(0, -qInf()) <=> QScriptValue(0, -qInf())", + "QScriptValue(0, -qInf()) <=> QScriptValue(0, \"-Infinity\")", + "QScriptValue(0, -qInf()) <=> QScriptValue(engine, -qInf())", + "QScriptValue(0, -qInf()) <=> QScriptValue(engine, \"-Infinity\")", + "QScriptValue(0, -qInf()) <=> engine->evaluate(\"-Infinity\")", + "QScriptValue(0, \"NaN\") <=> QScriptValue(\"NaN\")", + "QScriptValue(0, \"NaN\") <=> QScriptValue(0, \"NaN\")", + "QScriptValue(0, \"NaN\") <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(0, \"Infinity\") <=> QScriptValue(qInf())", + "QScriptValue(0, \"Infinity\") <=> QScriptValue(\"Infinity\")", + "QScriptValue(0, \"Infinity\") <=> QScriptValue(0, qInf())", + "QScriptValue(0, \"Infinity\") <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0, \"Infinity\") <=> QScriptValue(engine, qInf())", + "QScriptValue(0, \"Infinity\") <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(-qInf())", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(\"-Infinity\")", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, -qInf())", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, \"-Infinity\")", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, -qInf())", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"-Infinity\")", + "QScriptValue(0, \"ciao\") <=> QScriptValue(\"ciao\")", + "QScriptValue(0, \"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, \"ciao\") <=> QScriptValue(0, \"ciao\")", + "QScriptValue(0, \"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, \"ciao\") <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(0, \"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, \"ciao\") <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(false)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0.0)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(QString(\"\"))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(QString())", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, false)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, 0)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, 0.0)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, QString())", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, false)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, 0)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, 0.0)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, QString())", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"[]\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"false\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"0\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"0.0\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"''\")", + "QScriptValue(0, QString()) <=> QScriptValue(false)", + "QScriptValue(0, QString()) <=> QScriptValue(0)", + "QScriptValue(0, QString()) <=> QScriptValue(0.0)", + "QScriptValue(0, QString()) <=> QScriptValue(QString(\"\"))", + "QScriptValue(0, QString()) <=> QScriptValue(QString())", + "QScriptValue(0, QString()) <=> QScriptValue(0, false)", + "QScriptValue(0, QString()) <=> QScriptValue(0, 0)", + "QScriptValue(0, QString()) <=> QScriptValue(0, 0.0)", + "QScriptValue(0, QString()) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(0, QString()) <=> QScriptValue(0, QString())", + "QScriptValue(0, QString()) <=> QScriptValue(engine, false)", + "QScriptValue(0, QString()) <=> QScriptValue(engine, 0)", + "QScriptValue(0, QString()) <=> QScriptValue(engine, 0.0)", + "QScriptValue(0, QString()) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(0, QString()) <=> QScriptValue(engine, QString())", + "QScriptValue(0, QString()) <=> engine->evaluate(\"[]\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"false\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"0\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"0.0\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"''\")", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(false)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0.0)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, false)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, 0)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, 0.0)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, false)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, 0)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, 0.0)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"false\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"0\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"0.0\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"'0'\")", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(123.0)", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, 123.0)", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, 123.0)", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"123.0\")", + "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"'123'\")", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::NullValue)", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->evaluate(\"null\")", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->nullValue()", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->undefinedValue()", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"{}\")", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"undefined\")", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"null\")", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->nullValue()", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->undefinedValue()", + "QScriptValue(engine, true) <=> QScriptValue(true)", + "QScriptValue(engine, true) <=> QScriptValue(0, true)", + "QScriptValue(engine, true) <=> QScriptValue(engine, true)", + "QScriptValue(engine, true) <=> engine->evaluate(\"true\")", + "QScriptValue(engine, false) <=> QScriptValue(false)", + "QScriptValue(engine, false) <=> QScriptValue(0)", + "QScriptValue(engine, false) <=> QScriptValue(0.0)", + "QScriptValue(engine, false) <=> QScriptValue(QString(\"\"))", + "QScriptValue(engine, false) <=> QScriptValue(QString())", + "QScriptValue(engine, false) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(engine, false) <=> QScriptValue(0, false)", + "QScriptValue(engine, false) <=> QScriptValue(0, 0)", + "QScriptValue(engine, false) <=> QScriptValue(0, 0.0)", + "QScriptValue(engine, false) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(engine, false) <=> QScriptValue(0, QString())", + "QScriptValue(engine, false) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(engine, false) <=> QScriptValue(engine, false)", + "QScriptValue(engine, false) <=> QScriptValue(engine, 0)", + "QScriptValue(engine, false) <=> QScriptValue(engine, 0.0)", + "QScriptValue(engine, false) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, false) <=> QScriptValue(engine, QString())", + "QScriptValue(engine, false) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, false) <=> engine->evaluate(\"[]\")", + "QScriptValue(engine, false) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(engine, false) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(engine, false) <=> engine->evaluate(\"false\")", + "QScriptValue(engine, false) <=> engine->evaluate(\"0\")", + "QScriptValue(engine, false) <=> engine->evaluate(\"0.0\")", + "QScriptValue(engine, false) <=> engine->evaluate(\"''\")", + "QScriptValue(engine, false) <=> engine->evaluate(\"'0'\")", + "QScriptValue(engine, int(122)) <=> QScriptValue(int(122))", + "QScriptValue(engine, int(122)) <=> QScriptValue(0, int(122))", + "QScriptValue(engine, int(122)) <=> QScriptValue(engine, int(122))", + "QScriptValue(engine, int(122)) <=> engine->evaluate(\"122\")", + "QScriptValue(engine, uint(124)) <=> QScriptValue(uint(124))", + "QScriptValue(engine, uint(124)) <=> QScriptValue(0, uint(124))", + "QScriptValue(engine, uint(124)) <=> QScriptValue(engine, uint(124))", + "QScriptValue(engine, uint(124)) <=> engine->evaluate(\"124\")", + "QScriptValue(engine, 0) <=> QScriptValue(false)", + "QScriptValue(engine, 0) <=> QScriptValue(0)", + "QScriptValue(engine, 0) <=> QScriptValue(0.0)", + "QScriptValue(engine, 0) <=> QScriptValue(QString(\"\"))", + "QScriptValue(engine, 0) <=> QScriptValue(QString())", + "QScriptValue(engine, 0) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(engine, 0) <=> QScriptValue(0, false)", + "QScriptValue(engine, 0) <=> QScriptValue(0, 0)", + "QScriptValue(engine, 0) <=> QScriptValue(0, 0.0)", + "QScriptValue(engine, 0) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(engine, 0) <=> QScriptValue(0, QString())", + "QScriptValue(engine, 0) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(engine, 0) <=> QScriptValue(engine, false)", + "QScriptValue(engine, 0) <=> QScriptValue(engine, 0)", + "QScriptValue(engine, 0) <=> QScriptValue(engine, 0.0)", + "QScriptValue(engine, 0) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, 0) <=> QScriptValue(engine, QString())", + "QScriptValue(engine, 0) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, 0) <=> engine->evaluate(\"[]\")", + "QScriptValue(engine, 0) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(engine, 0) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(engine, 0) <=> engine->evaluate(\"false\")", + "QScriptValue(engine, 0) <=> engine->evaluate(\"0\")", + "QScriptValue(engine, 0) <=> engine->evaluate(\"0.0\")", + "QScriptValue(engine, 0) <=> engine->evaluate(\"''\")", + "QScriptValue(engine, 0) <=> engine->evaluate(\"'0'\")", + "QScriptValue(engine, 0.0) <=> QScriptValue(false)", + "QScriptValue(engine, 0.0) <=> QScriptValue(0)", + "QScriptValue(engine, 0.0) <=> QScriptValue(0.0)", + "QScriptValue(engine, 0.0) <=> QScriptValue(QString(\"\"))", + "QScriptValue(engine, 0.0) <=> QScriptValue(QString())", + "QScriptValue(engine, 0.0) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(engine, 0.0) <=> QScriptValue(0, false)", + "QScriptValue(engine, 0.0) <=> QScriptValue(0, 0)", + "QScriptValue(engine, 0.0) <=> QScriptValue(0, 0.0)", + "QScriptValue(engine, 0.0) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(engine, 0.0) <=> QScriptValue(0, QString())", + "QScriptValue(engine, 0.0) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(engine, 0.0) <=> QScriptValue(engine, false)", + "QScriptValue(engine, 0.0) <=> QScriptValue(engine, 0)", + "QScriptValue(engine, 0.0) <=> QScriptValue(engine, 0.0)", + "QScriptValue(engine, 0.0) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, 0.0) <=> QScriptValue(engine, QString())", + "QScriptValue(engine, 0.0) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"[]\")", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"false\")", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"0\")", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"0.0\")", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"''\")", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"'0'\")", + "QScriptValue(engine, 123.0) <=> QScriptValue(123.0)", + "QScriptValue(engine, 123.0) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(engine, 123.0) <=> QScriptValue(0, 123.0)", + "QScriptValue(engine, 123.0) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(engine, 123.0) <=> QScriptValue(engine, 123.0)", + "QScriptValue(engine, 123.0) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, 123.0) <=> engine->evaluate(\"123.0\")", + "QScriptValue(engine, 123.0) <=> engine->evaluate(\"'123'\")", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(6.37e-8)", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(-6.37e-8)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, -6.37e-8)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, -6.37e-8)", + "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"-6.37e-8\")", + "QScriptValue(engine, 0x43211234) <=> QScriptValue(0x43211234)", + "QScriptValue(engine, 0x43211234) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(engine, 0x43211234) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, 0x43211234) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(engine, 0x10000) <=> QScriptValue(0x10000)", + "QScriptValue(engine, 0x10000) <=> QScriptValue(0, 0x10000)", + "QScriptValue(engine, 0x10000) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(engine, 0x10000) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(engine, 0x10001) <=> QScriptValue(0x10001)", + "QScriptValue(engine, 0x10001) <=> QScriptValue(0, 0x10001)", + "QScriptValue(engine, 0x10001) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(engine, 0x10001) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(engine, qInf()) <=> QScriptValue(qInf())", + "QScriptValue(engine, qInf()) <=> QScriptValue(\"Infinity\")", + "QScriptValue(engine, qInf()) <=> QScriptValue(0, qInf())", + "QScriptValue(engine, qInf()) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(engine, qInf()) <=> QScriptValue(engine, qInf())", + "QScriptValue(engine, qInf()) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, qInf()) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(engine, -qInf()) <=> QScriptValue(-qInf())", + "QScriptValue(engine, -qInf()) <=> QScriptValue(\"-Infinity\")", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0, -qInf())", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0, \"-Infinity\")", + "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, -qInf())", + "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, \"-Infinity\")", + "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"-Infinity\")", + "QScriptValue(engine, \"NaN\") <=> QScriptValue(\"NaN\")", + "QScriptValue(engine, \"NaN\") <=> QScriptValue(0, \"NaN\")", + "QScriptValue(engine, \"NaN\") <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(engine, \"Infinity\") <=> QScriptValue(qInf())", + "QScriptValue(engine, \"Infinity\") <=> QScriptValue(\"Infinity\")", + "QScriptValue(engine, \"Infinity\") <=> QScriptValue(0, qInf())", + "QScriptValue(engine, \"Infinity\") <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(engine, \"Infinity\") <=> QScriptValue(engine, qInf())", + "QScriptValue(engine, \"Infinity\") <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"Infinity\")", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(-qInf())", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(\"-Infinity\")", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, -qInf())", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, \"-Infinity\")", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, -qInf())", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"-Infinity\")", + "QScriptValue(engine, \"ciao\") <=> QScriptValue(\"ciao\")", + "QScriptValue(engine, \"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, \"ciao\") <=> QScriptValue(0, \"ciao\")", + "QScriptValue(engine, \"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, \"ciao\") <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, \"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(false)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0.0)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(QString(\"\"))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(QString())", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, false)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, 0)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, 0.0)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, QString())", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, false)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, 0)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, 0.0)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, QString())", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"[]\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"false\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"0\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"0.0\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"''\")", + "QScriptValue(engine, QString()) <=> QScriptValue(false)", + "QScriptValue(engine, QString()) <=> QScriptValue(0)", + "QScriptValue(engine, QString()) <=> QScriptValue(0.0)", + "QScriptValue(engine, QString()) <=> QScriptValue(QString(\"\"))", + "QScriptValue(engine, QString()) <=> QScriptValue(QString())", + "QScriptValue(engine, QString()) <=> QScriptValue(0, false)", + "QScriptValue(engine, QString()) <=> QScriptValue(0, 0)", + "QScriptValue(engine, QString()) <=> QScriptValue(0, 0.0)", + "QScriptValue(engine, QString()) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(engine, QString()) <=> QScriptValue(0, QString())", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, false)", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, 0)", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, 0.0)", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, QString())", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"[]\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"false\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"0\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"0.0\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"''\")", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(false)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0.0)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, false)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, 0)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, 0.0)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, false)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, 0)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, 0.0)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"false\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"0\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"0.0\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"'0'\")", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(123.0)", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, 123.0)", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, 123.0)", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"123.0\")", + "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"'123'\")", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"[]\") <=> QScriptValue(false)", + "engine->evaluate(\"[]\") <=> QScriptValue(0)", + "engine->evaluate(\"[]\") <=> QScriptValue(0.0)", + "engine->evaluate(\"[]\") <=> QScriptValue(QString(\"\"))", + "engine->evaluate(\"[]\") <=> QScriptValue(QString())", + "engine->evaluate(\"[]\") <=> QScriptValue(0, false)", + "engine->evaluate(\"[]\") <=> QScriptValue(0, 0)", + "engine->evaluate(\"[]\") <=> QScriptValue(0, 0.0)", + "engine->evaluate(\"[]\") <=> QScriptValue(0, QString(\"\"))", + "engine->evaluate(\"[]\") <=> QScriptValue(0, QString())", + "engine->evaluate(\"[]\") <=> QScriptValue(engine, false)", + "engine->evaluate(\"[]\") <=> QScriptValue(engine, 0)", + "engine->evaluate(\"[]\") <=> QScriptValue(engine, 0.0)", + "engine->evaluate(\"[]\") <=> QScriptValue(engine, QString(\"\"))", + "engine->evaluate(\"[]\") <=> QScriptValue(engine, QString())", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"[]\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"false\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"0\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"0.0\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"''\")", + "engine->evaluate(\"{}\") <=> QScriptValue(QScriptValue::UndefinedValue)", + "engine->evaluate(\"{}\") <=> QScriptValue(QScriptValue::NullValue)", + "engine->evaluate(\"{}\") <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "engine->evaluate(\"{}\") <=> QScriptValue(0, QScriptValue::NullValue)", + "engine->evaluate(\"{}\") <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "engine->evaluate(\"{}\") <=> QScriptValue(engine, QScriptValue::NullValue)", + "engine->evaluate(\"{}\") <=> engine->evaluate(\"{}\")", + "engine->evaluate(\"{}\") <=> engine->evaluate(\"undefined\")", + "engine->evaluate(\"{}\") <=> engine->evaluate(\"null\")", + "engine->evaluate(\"{}\") <=> engine->nullValue()", + "engine->evaluate(\"{}\") <=> engine->undefinedValue()", + "engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"Date.prototype\") <=> engine->evaluate(\"Date.prototype\")", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(false)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0.0)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(QString(\"\"))", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(QString())", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, false)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, 0)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, 0.0)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, QString(\"\"))", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, QString())", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, false)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, 0)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, 0.0)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, QString(\"\"))", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, QString())", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"false\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"0\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"0.0\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"''\")", + "engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"Object\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Array\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"Number\") <=> engine->evaluate(\"Number\")", + "engine->evaluate(\"Function\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { return 1; })\") <=> engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"(function() { throw new Error('foo' })\") <=> engine->evaluate(\"(function() { throw new Error('foo' })\")", + "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"/foo/\")", + "engine->evaluate(\"new Object()\") <=> engine->evaluate(\"new Object()\")", + "engine->evaluate(\"new Array()\") <=> QScriptValue(false)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0.0)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(QString(\"\"))", + "engine->evaluate(\"new Array()\") <=> QScriptValue(QString())", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0, false)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0, 0)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0, 0.0)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0, QString(\"\"))", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0, QString())", + "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, false)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, 0)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, 0.0)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, QString(\"\"))", + "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, QString())", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"new Array()\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"false\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"0\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"0.0\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"''\")", + "engine->evaluate(\"new Error()\") <=> engine->evaluate(\"new Error()\")", + "engine->evaluate(\"a = new Object( a.foo = 22; a.foo\") <=> engine->evaluate(\"a = new Object( a.foo = 22; a.foo\")", + "engine->evaluate(\"Undefined\") <=> engine->evaluate(\"Undefined\")", + "engine->evaluate(\"Null\") <=> engine->evaluate(\"Null\")", + "engine->evaluate(\"True\") <=> engine->evaluate(\"True\")", + "engine->evaluate(\"False\") <=> engine->evaluate(\"False\")", + "engine->evaluate(\"undefined\") <=> QScriptValue(QScriptValue::UndefinedValue)", + "engine->evaluate(\"undefined\") <=> QScriptValue(QScriptValue::NullValue)", + "engine->evaluate(\"undefined\") <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "engine->evaluate(\"undefined\") <=> QScriptValue(0, QScriptValue::NullValue)", + "engine->evaluate(\"undefined\") <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "engine->evaluate(\"undefined\") <=> QScriptValue(engine, QScriptValue::NullValue)", + "engine->evaluate(\"undefined\") <=> engine->evaluate(\"{}\")", + "engine->evaluate(\"undefined\") <=> engine->evaluate(\"undefined\")", + "engine->evaluate(\"undefined\") <=> engine->evaluate(\"null\")", + "engine->evaluate(\"undefined\") <=> engine->nullValue()", + "engine->evaluate(\"undefined\") <=> engine->undefinedValue()", + "engine->evaluate(\"null\") <=> QScriptValue(QScriptValue::UndefinedValue)", + "engine->evaluate(\"null\") <=> QScriptValue(QScriptValue::NullValue)", + "engine->evaluate(\"null\") <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "engine->evaluate(\"null\") <=> QScriptValue(0, QScriptValue::NullValue)", + "engine->evaluate(\"null\") <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "engine->evaluate(\"null\") <=> QScriptValue(engine, QScriptValue::NullValue)", + "engine->evaluate(\"null\") <=> engine->evaluate(\"{}\")", + "engine->evaluate(\"null\") <=> engine->evaluate(\"undefined\")", + "engine->evaluate(\"null\") <=> engine->evaluate(\"null\")", + "engine->evaluate(\"null\") <=> engine->nullValue()", + "engine->evaluate(\"null\") <=> engine->undefinedValue()", + "engine->evaluate(\"true\") <=> QScriptValue(true)", + "engine->evaluate(\"true\") <=> QScriptValue(0, true)", + "engine->evaluate(\"true\") <=> QScriptValue(engine, true)", + "engine->evaluate(\"true\") <=> engine->evaluate(\"true\")", + "engine->evaluate(\"false\") <=> QScriptValue(false)", + "engine->evaluate(\"false\") <=> QScriptValue(0)", + "engine->evaluate(\"false\") <=> QScriptValue(0.0)", + "engine->evaluate(\"false\") <=> QScriptValue(QString(\"\"))", + "engine->evaluate(\"false\") <=> QScriptValue(QString())", + "engine->evaluate(\"false\") <=> QScriptValue(QString(\"0\"))", + "engine->evaluate(\"false\") <=> QScriptValue(0, false)", + "engine->evaluate(\"false\") <=> QScriptValue(0, 0)", + "engine->evaluate(\"false\") <=> QScriptValue(0, 0.0)", + "engine->evaluate(\"false\") <=> QScriptValue(0, QString(\"\"))", + "engine->evaluate(\"false\") <=> QScriptValue(0, QString())", + "engine->evaluate(\"false\") <=> QScriptValue(0, QString(\"0\"))", + "engine->evaluate(\"false\") <=> QScriptValue(engine, false)", + "engine->evaluate(\"false\") <=> QScriptValue(engine, 0)", + "engine->evaluate(\"false\") <=> QScriptValue(engine, 0.0)", + "engine->evaluate(\"false\") <=> QScriptValue(engine, QString(\"\"))", + "engine->evaluate(\"false\") <=> QScriptValue(engine, QString())", + "engine->evaluate(\"false\") <=> QScriptValue(engine, QString(\"0\"))", + "engine->evaluate(\"false\") <=> engine->evaluate(\"[]\")", + "engine->evaluate(\"false\") <=> engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"false\") <=> engine->evaluate(\"new Array()\")", + "engine->evaluate(\"false\") <=> engine->evaluate(\"false\")", + "engine->evaluate(\"false\") <=> engine->evaluate(\"0\")", + "engine->evaluate(\"false\") <=> engine->evaluate(\"0.0\")", + "engine->evaluate(\"false\") <=> engine->evaluate(\"''\")", + "engine->evaluate(\"false\") <=> engine->evaluate(\"'0'\")", + "engine->evaluate(\"122\") <=> QScriptValue(int(122))", + "engine->evaluate(\"122\") <=> QScriptValue(0, int(122))", + "engine->evaluate(\"122\") <=> QScriptValue(engine, int(122))", + "engine->evaluate(\"122\") <=> engine->evaluate(\"122\")", + "engine->evaluate(\"124\") <=> QScriptValue(uint(124))", + "engine->evaluate(\"124\") <=> QScriptValue(0, uint(124))", + "engine->evaluate(\"124\") <=> QScriptValue(engine, uint(124))", + "engine->evaluate(\"124\") <=> engine->evaluate(\"124\")", + "engine->evaluate(\"0\") <=> QScriptValue(false)", + "engine->evaluate(\"0\") <=> QScriptValue(0)", + "engine->evaluate(\"0\") <=> QScriptValue(0.0)", + "engine->evaluate(\"0\") <=> QScriptValue(QString(\"\"))", + "engine->evaluate(\"0\") <=> QScriptValue(QString())", + "engine->evaluate(\"0\") <=> QScriptValue(QString(\"0\"))", + "engine->evaluate(\"0\") <=> QScriptValue(0, false)", + "engine->evaluate(\"0\") <=> QScriptValue(0, 0)", + "engine->evaluate(\"0\") <=> QScriptValue(0, 0.0)", + "engine->evaluate(\"0\") <=> QScriptValue(0, QString(\"\"))", + "engine->evaluate(\"0\") <=> QScriptValue(0, QString())", + "engine->evaluate(\"0\") <=> QScriptValue(0, QString(\"0\"))", + "engine->evaluate(\"0\") <=> QScriptValue(engine, false)", + "engine->evaluate(\"0\") <=> QScriptValue(engine, 0)", + "engine->evaluate(\"0\") <=> QScriptValue(engine, 0.0)", + "engine->evaluate(\"0\") <=> QScriptValue(engine, QString(\"\"))", + "engine->evaluate(\"0\") <=> QScriptValue(engine, QString())", + "engine->evaluate(\"0\") <=> QScriptValue(engine, QString(\"0\"))", + "engine->evaluate(\"0\") <=> engine->evaluate(\"[]\")", + "engine->evaluate(\"0\") <=> engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"0\") <=> engine->evaluate(\"new Array()\")", + "engine->evaluate(\"0\") <=> engine->evaluate(\"false\")", + "engine->evaluate(\"0\") <=> engine->evaluate(\"0\")", + "engine->evaluate(\"0\") <=> engine->evaluate(\"0.0\")", + "engine->evaluate(\"0\") <=> engine->evaluate(\"''\")", + "engine->evaluate(\"0\") <=> engine->evaluate(\"'0'\")", + "engine->evaluate(\"0.0\") <=> QScriptValue(false)", + "engine->evaluate(\"0.0\") <=> QScriptValue(0)", + "engine->evaluate(\"0.0\") <=> QScriptValue(0.0)", + "engine->evaluate(\"0.0\") <=> QScriptValue(QString(\"\"))", + "engine->evaluate(\"0.0\") <=> QScriptValue(QString())", + "engine->evaluate(\"0.0\") <=> QScriptValue(QString(\"0\"))", + "engine->evaluate(\"0.0\") <=> QScriptValue(0, false)", + "engine->evaluate(\"0.0\") <=> QScriptValue(0, 0)", + "engine->evaluate(\"0.0\") <=> QScriptValue(0, 0.0)", + "engine->evaluate(\"0.0\") <=> QScriptValue(0, QString(\"\"))", + "engine->evaluate(\"0.0\") <=> QScriptValue(0, QString())", + "engine->evaluate(\"0.0\") <=> QScriptValue(0, QString(\"0\"))", + "engine->evaluate(\"0.0\") <=> QScriptValue(engine, false)", + "engine->evaluate(\"0.0\") <=> QScriptValue(engine, 0)", + "engine->evaluate(\"0.0\") <=> QScriptValue(engine, 0.0)", + "engine->evaluate(\"0.0\") <=> QScriptValue(engine, QString(\"\"))", + "engine->evaluate(\"0.0\") <=> QScriptValue(engine, QString())", + "engine->evaluate(\"0.0\") <=> QScriptValue(engine, QString(\"0\"))", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"[]\")", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"new Array()\")", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"false\")", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"0\")", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"0.0\")", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"''\")", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"'0'\")", + "engine->evaluate(\"123.0\") <=> QScriptValue(123.0)", + "engine->evaluate(\"123.0\") <=> QScriptValue(QString(\"123\"))", + "engine->evaluate(\"123.0\") <=> QScriptValue(0, 123.0)", + "engine->evaluate(\"123.0\") <=> QScriptValue(0, QString(\"123\"))", + "engine->evaluate(\"123.0\") <=> QScriptValue(engine, 123.0)", + "engine->evaluate(\"123.0\") <=> QScriptValue(engine, QString(\"123\"))", + "engine->evaluate(\"123.0\") <=> engine->evaluate(\"123.0\")", + "engine->evaluate(\"123.0\") <=> engine->evaluate(\"'123'\")", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(6.37e-8)", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, 6.37e-8)", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, 6.37e-8)", + "engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(-6.37e-8)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, -6.37e-8)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, -6.37e-8)", + "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"-6.37e-8\")", + "engine->evaluate(\"0x43211234\") <=> QScriptValue(0x43211234)", + "engine->evaluate(\"0x43211234\") <=> QScriptValue(0, 0x43211234)", + "engine->evaluate(\"0x43211234\") <=> QScriptValue(engine, 0x43211234)", + "engine->evaluate(\"0x43211234\") <=> engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"0x10000\") <=> QScriptValue(0x10000)", + "engine->evaluate(\"0x10000\") <=> QScriptValue(0, 0x10000)", + "engine->evaluate(\"0x10000\") <=> QScriptValue(engine, 0x10000)", + "engine->evaluate(\"0x10000\") <=> engine->evaluate(\"0x10000\")", + "engine->evaluate(\"0x10001\") <=> QScriptValue(0x10001)", + "engine->evaluate(\"0x10001\") <=> QScriptValue(0, 0x10001)", + "engine->evaluate(\"0x10001\") <=> QScriptValue(engine, 0x10001)", + "engine->evaluate(\"0x10001\") <=> engine->evaluate(\"0x10001\")", + "engine->evaluate(\"Infinity\") <=> QScriptValue(qInf())", + "engine->evaluate(\"Infinity\") <=> QScriptValue(\"Infinity\")", + "engine->evaluate(\"Infinity\") <=> QScriptValue(0, qInf())", + "engine->evaluate(\"Infinity\") <=> QScriptValue(0, \"Infinity\")", + "engine->evaluate(\"Infinity\") <=> QScriptValue(engine, qInf())", + "engine->evaluate(\"Infinity\") <=> QScriptValue(engine, \"Infinity\")", + "engine->evaluate(\"Infinity\") <=> engine->evaluate(\"Infinity\")", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(-qInf())", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(\"-Infinity\")", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, -qInf())", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, \"-Infinity\")", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, -qInf())", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")", + "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"-Infinity\")", + "engine->evaluate(\"'ciao'\") <=> QScriptValue(\"ciao\")", + "engine->evaluate(\"'ciao'\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"'ciao'\") <=> QScriptValue(0, \"ciao\")", + "engine->evaluate(\"'ciao'\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"'ciao'\") <=> QScriptValue(engine, \"ciao\")", + "engine->evaluate(\"'ciao'\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"'ciao'\") <=> engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"''\") <=> QScriptValue(false)", + "engine->evaluate(\"''\") <=> QScriptValue(0)", + "engine->evaluate(\"''\") <=> QScriptValue(0.0)", + "engine->evaluate(\"''\") <=> QScriptValue(QString(\"\"))", + "engine->evaluate(\"''\") <=> QScriptValue(QString())", + "engine->evaluate(\"''\") <=> QScriptValue(0, false)", + "engine->evaluate(\"''\") <=> QScriptValue(0, 0)", + "engine->evaluate(\"''\") <=> QScriptValue(0, 0.0)", + "engine->evaluate(\"''\") <=> QScriptValue(0, QString(\"\"))", + "engine->evaluate(\"''\") <=> QScriptValue(0, QString())", + "engine->evaluate(\"''\") <=> QScriptValue(engine, false)", + "engine->evaluate(\"''\") <=> QScriptValue(engine, 0)", + "engine->evaluate(\"''\") <=> QScriptValue(engine, 0.0)", + "engine->evaluate(\"''\") <=> QScriptValue(engine, QString(\"\"))", + "engine->evaluate(\"''\") <=> QScriptValue(engine, QString())", + "engine->evaluate(\"''\") <=> engine->evaluate(\"[]\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"new Array()\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"false\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"0\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"0.0\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"''\")", + "engine->evaluate(\"'0'\") <=> QScriptValue(false)", + "engine->evaluate(\"'0'\") <=> QScriptValue(0)", + "engine->evaluate(\"'0'\") <=> QScriptValue(0.0)", + "engine->evaluate(\"'0'\") <=> QScriptValue(QString(\"0\"))", + "engine->evaluate(\"'0'\") <=> QScriptValue(0, false)", + "engine->evaluate(\"'0'\") <=> QScriptValue(0, 0)", + "engine->evaluate(\"'0'\") <=> QScriptValue(0, 0.0)", + "engine->evaluate(\"'0'\") <=> QScriptValue(0, QString(\"0\"))", + "engine->evaluate(\"'0'\") <=> QScriptValue(engine, false)", + "engine->evaluate(\"'0'\") <=> QScriptValue(engine, 0)", + "engine->evaluate(\"'0'\") <=> QScriptValue(engine, 0.0)", + "engine->evaluate(\"'0'\") <=> QScriptValue(engine, QString(\"0\"))", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"false\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"0\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"0.0\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"'0'\")", + "engine->evaluate(\"'123'\") <=> QScriptValue(123.0)", + "engine->evaluate(\"'123'\") <=> QScriptValue(QString(\"123\"))", + "engine->evaluate(\"'123'\") <=> QScriptValue(0, 123.0)", + "engine->evaluate(\"'123'\") <=> QScriptValue(0, QString(\"123\"))", + "engine->evaluate(\"'123'\") <=> QScriptValue(engine, 123.0)", + "engine->evaluate(\"'123'\") <=> QScriptValue(engine, QString(\"123\"))", + "engine->evaluate(\"'123'\") <=> engine->evaluate(\"123.0\")", + "engine->evaluate(\"'123'\") <=> engine->evaluate(\"'123'\")", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(QString(\"12.4\"))", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"'12.4'\")", + "engine->nullValue() <=> QScriptValue(QScriptValue::UndefinedValue)", + "engine->nullValue() <=> QScriptValue(QScriptValue::NullValue)", + "engine->nullValue() <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "engine->nullValue() <=> QScriptValue(0, QScriptValue::NullValue)", + "engine->nullValue() <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "engine->nullValue() <=> QScriptValue(engine, QScriptValue::NullValue)", + "engine->nullValue() <=> engine->evaluate(\"{}\")", + "engine->nullValue() <=> engine->evaluate(\"undefined\")", + "engine->nullValue() <=> engine->evaluate(\"null\")", + "engine->nullValue() <=> engine->nullValue()", + "engine->nullValue() <=> engine->undefinedValue()", + "engine->undefinedValue() <=> QScriptValue(QScriptValue::UndefinedValue)", + "engine->undefinedValue() <=> QScriptValue(QScriptValue::NullValue)", + "engine->undefinedValue() <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "engine->undefinedValue() <=> QScriptValue(0, QScriptValue::NullValue)", + "engine->undefinedValue() <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "engine->undefinedValue() <=> QScriptValue(engine, QScriptValue::NullValue)", + "engine->undefinedValue() <=> engine->evaluate(\"{}\")", + "engine->undefinedValue() <=> engine->evaluate(\"undefined\")", + "engine->undefinedValue() <=> engine->evaluate(\"null\")", + "engine->undefinedValue() <=> engine->nullValue()", + "engine->undefinedValue() <=> engine->undefinedValue()"}; + +void tst_QScriptValue::equals_makeData(const char *expr) +{ + static QSet equals; + if (equals.isEmpty()) { + equals.reserve(1085); + for (unsigned i = 0; i < 1085; ++i) + equals.insert(equals_array[i]); + } + QHash::const_iterator it; + for (it = m_values.constBegin(); it != m_values.constEnd(); ++it) { + QString tag = QString::fromLatin1("%20 <=> %21").arg(expr).arg(it.key()); + newRow(tag.toLatin1()) << it.value() << equals.contains(tag); + } +} + +void tst_QScriptValue::equals_test(const char *, const QScriptValue& value) +{ + QFETCH(QScriptValue, other); + QFETCH(bool, expected); + QCOMPARE(value.equals(other), expected); +} + +DEFINE_TEST_FUNCTION(equals) + + +void tst_QScriptValue::strictlyEquals_initData() +{ + QTest::addColumn("other"); + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString strictlyEquals_array[] = { + "QScriptValue() <=> QScriptValue()", + "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")", + "QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")", + "QScriptValue(QScriptValue::UndefinedValue) <=> engine->undefinedValue()", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"null\")", + "QScriptValue(QScriptValue::NullValue) <=> engine->nullValue()", + "QScriptValue(true) <=> QScriptValue(true)", + "QScriptValue(true) <=> QScriptValue(0, true)", + "QScriptValue(true) <=> QScriptValue(engine, true)", + "QScriptValue(true) <=> engine->evaluate(\"true\")", + "QScriptValue(false) <=> QScriptValue(false)", + "QScriptValue(false) <=> QScriptValue(0, false)", + "QScriptValue(false) <=> QScriptValue(engine, false)", + "QScriptValue(false) <=> engine->evaluate(\"false\")", + "QScriptValue(int(122)) <=> QScriptValue(int(122))", + "QScriptValue(int(122)) <=> QScriptValue(0, int(122))", + "QScriptValue(int(122)) <=> QScriptValue(engine, int(122))", + "QScriptValue(int(122)) <=> engine->evaluate(\"122\")", + "QScriptValue(uint(124)) <=> QScriptValue(uint(124))", + "QScriptValue(uint(124)) <=> QScriptValue(0, uint(124))", + "QScriptValue(uint(124)) <=> QScriptValue(engine, uint(124))", + "QScriptValue(uint(124)) <=> engine->evaluate(\"124\")", + "QScriptValue(0) <=> QScriptValue(0)", + "QScriptValue(0) <=> QScriptValue(0.0)", + "QScriptValue(0) <=> QScriptValue(0, 0)", + "QScriptValue(0) <=> QScriptValue(0, 0.0)", + "QScriptValue(0) <=> QScriptValue(engine, 0)", + "QScriptValue(0) <=> QScriptValue(engine, 0.0)", + "QScriptValue(0) <=> engine->evaluate(\"0\")", + "QScriptValue(0) <=> engine->evaluate(\"0.0\")", + "QScriptValue(0.0) <=> QScriptValue(0)", + "QScriptValue(0.0) <=> QScriptValue(0.0)", + "QScriptValue(0.0) <=> QScriptValue(0, 0)", + "QScriptValue(0.0) <=> QScriptValue(0, 0.0)", + "QScriptValue(0.0) <=> QScriptValue(engine, 0)", + "QScriptValue(0.0) <=> QScriptValue(engine, 0.0)", + "QScriptValue(0.0) <=> engine->evaluate(\"0\")", + "QScriptValue(0.0) <=> engine->evaluate(\"0.0\")", + "QScriptValue(123.0) <=> QScriptValue(123.0)", + "QScriptValue(123.0) <=> QScriptValue(0, 123.0)", + "QScriptValue(123.0) <=> QScriptValue(engine, 123.0)", + "QScriptValue(123.0) <=> engine->evaluate(\"123.0\")", + "QScriptValue(6.37e-8) <=> QScriptValue(6.37e-8)", + "QScriptValue(6.37e-8) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(6.37e-8) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(6.37e-8) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(-6.37e-8) <=> QScriptValue(-6.37e-8)", + "QScriptValue(-6.37e-8) <=> QScriptValue(0, -6.37e-8)", + "QScriptValue(-6.37e-8) <=> QScriptValue(engine, -6.37e-8)", + "QScriptValue(-6.37e-8) <=> engine->evaluate(\"-6.37e-8\")", + "QScriptValue(0x43211234) <=> QScriptValue(0x43211234)", + "QScriptValue(0x43211234) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0x43211234) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0x43211234) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0x10000) <=> QScriptValue(0x10000)", + "QScriptValue(0x10000) <=> QScriptValue(0, 0x10000)", + "QScriptValue(0x10000) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(0x10000) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(0x10001) <=> QScriptValue(0x10001)", + "QScriptValue(0x10001) <=> QScriptValue(0, 0x10001)", + "QScriptValue(0x10001) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0x10001) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(qInf()) <=> QScriptValue(qInf())", + "QScriptValue(qInf()) <=> QScriptValue(0, qInf())", + "QScriptValue(qInf()) <=> QScriptValue(engine, qInf())", + "QScriptValue(qInf()) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(-qInf()) <=> QScriptValue(-qInf())", + "QScriptValue(-qInf()) <=> QScriptValue(0, -qInf())", + "QScriptValue(-qInf()) <=> QScriptValue(engine, -qInf())", + "QScriptValue(-qInf()) <=> engine->evaluate(\"-Infinity\")", + "QScriptValue(\"NaN\") <=> QScriptValue(\"NaN\")", + "QScriptValue(\"NaN\") <=> QScriptValue(0, \"NaN\")", + "QScriptValue(\"NaN\") <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(\"Infinity\") <=> QScriptValue(\"Infinity\")", + "QScriptValue(\"Infinity\") <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(\"Infinity\") <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(\"-Infinity\") <=> QScriptValue(\"-Infinity\")", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0, \"-Infinity\")", + "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")", + "QScriptValue(\"ciao\") <=> QScriptValue(\"ciao\")", + "QScriptValue(\"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(\"ciao\") <=> QScriptValue(0, \"ciao\")", + "QScriptValue(\"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(\"ciao\") <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(\"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(\"ciao\") <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(QString(\"\")) <=> QScriptValue(QString(\"\"))", + "QScriptValue(QString(\"\")) <=> QScriptValue(QString())", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, QString())", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, QString())", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"''\")", + "QScriptValue(QString()) <=> QScriptValue(QString(\"\"))", + "QScriptValue(QString()) <=> QScriptValue(QString())", + "QScriptValue(QString()) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(QString()) <=> QScriptValue(0, QString())", + "QScriptValue(QString()) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(QString()) <=> QScriptValue(engine, QString())", + "QScriptValue(QString()) <=> engine->evaluate(\"''\")", + "QScriptValue(QString(\"0\")) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"'0'\")", + "QScriptValue(QString(\"123\")) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"'123'\")", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->undefinedValue()", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"null\")", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->nullValue()", + "QScriptValue(0, true) <=> QScriptValue(true)", + "QScriptValue(0, true) <=> QScriptValue(0, true)", + "QScriptValue(0, true) <=> QScriptValue(engine, true)", + "QScriptValue(0, true) <=> engine->evaluate(\"true\")", + "QScriptValue(0, false) <=> QScriptValue(false)", + "QScriptValue(0, false) <=> QScriptValue(0, false)", + "QScriptValue(0, false) <=> QScriptValue(engine, false)", + "QScriptValue(0, false) <=> engine->evaluate(\"false\")", + "QScriptValue(0, int(122)) <=> QScriptValue(int(122))", + "QScriptValue(0, int(122)) <=> QScriptValue(0, int(122))", + "QScriptValue(0, int(122)) <=> QScriptValue(engine, int(122))", + "QScriptValue(0, int(122)) <=> engine->evaluate(\"122\")", + "QScriptValue(0, uint(124)) <=> QScriptValue(uint(124))", + "QScriptValue(0, uint(124)) <=> QScriptValue(0, uint(124))", + "QScriptValue(0, uint(124)) <=> QScriptValue(engine, uint(124))", + "QScriptValue(0, uint(124)) <=> engine->evaluate(\"124\")", + "QScriptValue(0, 0) <=> QScriptValue(0)", + "QScriptValue(0, 0) <=> QScriptValue(0.0)", + "QScriptValue(0, 0) <=> QScriptValue(0, 0)", + "QScriptValue(0, 0) <=> QScriptValue(0, 0.0)", + "QScriptValue(0, 0) <=> QScriptValue(engine, 0)", + "QScriptValue(0, 0) <=> QScriptValue(engine, 0.0)", + "QScriptValue(0, 0) <=> engine->evaluate(\"0\")", + "QScriptValue(0, 0) <=> engine->evaluate(\"0.0\")", + "QScriptValue(0, 0.0) <=> QScriptValue(0)", + "QScriptValue(0, 0.0) <=> QScriptValue(0.0)", + "QScriptValue(0, 0.0) <=> QScriptValue(0, 0)", + "QScriptValue(0, 0.0) <=> QScriptValue(0, 0.0)", + "QScriptValue(0, 0.0) <=> QScriptValue(engine, 0)", + "QScriptValue(0, 0.0) <=> QScriptValue(engine, 0.0)", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"0\")", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"0.0\")", + "QScriptValue(0, 123.0) <=> QScriptValue(123.0)", + "QScriptValue(0, 123.0) <=> QScriptValue(0, 123.0)", + "QScriptValue(0, 123.0) <=> QScriptValue(engine, 123.0)", + "QScriptValue(0, 123.0) <=> engine->evaluate(\"123.0\")", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(6.37e-8)", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(-6.37e-8)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(0, -6.37e-8)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, -6.37e-8)", + "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"-6.37e-8\")", + "QScriptValue(0, 0x43211234) <=> QScriptValue(0x43211234)", + "QScriptValue(0, 0x43211234) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0, 0x43211234) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0, 0x43211234) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0, 0x10000) <=> QScriptValue(0x10000)", + "QScriptValue(0, 0x10000) <=> QScriptValue(0, 0x10000)", + "QScriptValue(0, 0x10000) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(0, 0x10000) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(0, 0x10001) <=> QScriptValue(0x10001)", + "QScriptValue(0, 0x10001) <=> QScriptValue(0, 0x10001)", + "QScriptValue(0, 0x10001) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0, 0x10001) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(0, qInf()) <=> QScriptValue(qInf())", + "QScriptValue(0, qInf()) <=> QScriptValue(0, qInf())", + "QScriptValue(0, qInf()) <=> QScriptValue(engine, qInf())", + "QScriptValue(0, qInf()) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0, -qInf()) <=> QScriptValue(-qInf())", + "QScriptValue(0, -qInf()) <=> QScriptValue(0, -qInf())", + "QScriptValue(0, -qInf()) <=> QScriptValue(engine, -qInf())", + "QScriptValue(0, -qInf()) <=> engine->evaluate(\"-Infinity\")", + "QScriptValue(0, \"NaN\") <=> QScriptValue(\"NaN\")", + "QScriptValue(0, \"NaN\") <=> QScriptValue(0, \"NaN\")", + "QScriptValue(0, \"NaN\") <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(0, \"Infinity\") <=> QScriptValue(\"Infinity\")", + "QScriptValue(0, \"Infinity\") <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0, \"Infinity\") <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(\"-Infinity\")", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, \"-Infinity\")", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")", + "QScriptValue(0, \"ciao\") <=> QScriptValue(\"ciao\")", + "QScriptValue(0, \"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, \"ciao\") <=> QScriptValue(0, \"ciao\")", + "QScriptValue(0, \"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, \"ciao\") <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(0, \"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, \"ciao\") <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(QString(\"\"))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(QString())", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, QString())", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, QString())", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"''\")", + "QScriptValue(0, QString()) <=> QScriptValue(QString(\"\"))", + "QScriptValue(0, QString()) <=> QScriptValue(QString())", + "QScriptValue(0, QString()) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(0, QString()) <=> QScriptValue(0, QString())", + "QScriptValue(0, QString()) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(0, QString()) <=> QScriptValue(engine, QString())", + "QScriptValue(0, QString()) <=> engine->evaluate(\"''\")", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"'0'\")", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"'123'\")", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->undefinedValue()", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"null\")", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->nullValue()", + "QScriptValue(engine, true) <=> QScriptValue(true)", + "QScriptValue(engine, true) <=> QScriptValue(0, true)", + "QScriptValue(engine, true) <=> QScriptValue(engine, true)", + "QScriptValue(engine, true) <=> engine->evaluate(\"true\")", + "QScriptValue(engine, false) <=> QScriptValue(false)", + "QScriptValue(engine, false) <=> QScriptValue(0, false)", + "QScriptValue(engine, false) <=> QScriptValue(engine, false)", + "QScriptValue(engine, false) <=> engine->evaluate(\"false\")", + "QScriptValue(engine, int(122)) <=> QScriptValue(int(122))", + "QScriptValue(engine, int(122)) <=> QScriptValue(0, int(122))", + "QScriptValue(engine, int(122)) <=> QScriptValue(engine, int(122))", + "QScriptValue(engine, int(122)) <=> engine->evaluate(\"122\")", + "QScriptValue(engine, uint(124)) <=> QScriptValue(uint(124))", + "QScriptValue(engine, uint(124)) <=> QScriptValue(0, uint(124))", + "QScriptValue(engine, uint(124)) <=> QScriptValue(engine, uint(124))", + "QScriptValue(engine, uint(124)) <=> engine->evaluate(\"124\")", + "QScriptValue(engine, 0) <=> QScriptValue(0)", + "QScriptValue(engine, 0) <=> QScriptValue(0.0)", + "QScriptValue(engine, 0) <=> QScriptValue(0, 0)", + "QScriptValue(engine, 0) <=> QScriptValue(0, 0.0)", + "QScriptValue(engine, 0) <=> QScriptValue(engine, 0)", + "QScriptValue(engine, 0) <=> QScriptValue(engine, 0.0)", + "QScriptValue(engine, 0) <=> engine->evaluate(\"0\")", + "QScriptValue(engine, 0) <=> engine->evaluate(\"0.0\")", + "QScriptValue(engine, 0.0) <=> QScriptValue(0)", + "QScriptValue(engine, 0.0) <=> QScriptValue(0.0)", + "QScriptValue(engine, 0.0) <=> QScriptValue(0, 0)", + "QScriptValue(engine, 0.0) <=> QScriptValue(0, 0.0)", + "QScriptValue(engine, 0.0) <=> QScriptValue(engine, 0)", + "QScriptValue(engine, 0.0) <=> QScriptValue(engine, 0.0)", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"0\")", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"0.0\")", + "QScriptValue(engine, 123.0) <=> QScriptValue(123.0)", + "QScriptValue(engine, 123.0) <=> QScriptValue(0, 123.0)", + "QScriptValue(engine, 123.0) <=> QScriptValue(engine, 123.0)", + "QScriptValue(engine, 123.0) <=> engine->evaluate(\"123.0\")", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(6.37e-8)", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(-6.37e-8)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, -6.37e-8)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, -6.37e-8)", + "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"-6.37e-8\")", + "QScriptValue(engine, 0x43211234) <=> QScriptValue(0x43211234)", + "QScriptValue(engine, 0x43211234) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(engine, 0x43211234) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, 0x43211234) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(engine, 0x10000) <=> QScriptValue(0x10000)", + "QScriptValue(engine, 0x10000) <=> QScriptValue(0, 0x10000)", + "QScriptValue(engine, 0x10000) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(engine, 0x10000) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(engine, 0x10001) <=> QScriptValue(0x10001)", + "QScriptValue(engine, 0x10001) <=> QScriptValue(0, 0x10001)", + "QScriptValue(engine, 0x10001) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(engine, 0x10001) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(engine, qInf()) <=> QScriptValue(qInf())", + "QScriptValue(engine, qInf()) <=> QScriptValue(0, qInf())", + "QScriptValue(engine, qInf()) <=> QScriptValue(engine, qInf())", + "QScriptValue(engine, qInf()) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(engine, -qInf()) <=> QScriptValue(-qInf())", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0, -qInf())", + "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, -qInf())", + "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"-Infinity\")", + "QScriptValue(engine, \"NaN\") <=> QScriptValue(\"NaN\")", + "QScriptValue(engine, \"NaN\") <=> QScriptValue(0, \"NaN\")", + "QScriptValue(engine, \"NaN\") <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(engine, \"Infinity\") <=> QScriptValue(\"Infinity\")", + "QScriptValue(engine, \"Infinity\") <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(engine, \"Infinity\") <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(\"-Infinity\")", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, \"-Infinity\")", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")", + "QScriptValue(engine, \"ciao\") <=> QScriptValue(\"ciao\")", + "QScriptValue(engine, \"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, \"ciao\") <=> QScriptValue(0, \"ciao\")", + "QScriptValue(engine, \"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, \"ciao\") <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, \"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(QString(\"\"))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(QString())", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, QString())", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, QString())", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"''\")", + "QScriptValue(engine, QString()) <=> QScriptValue(QString(\"\"))", + "QScriptValue(engine, QString()) <=> QScriptValue(QString())", + "QScriptValue(engine, QString()) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(engine, QString()) <=> QScriptValue(0, QString())", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, QString())", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"''\")", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"'0'\")", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"'123'\")", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"[]\")", + "engine->evaluate(\"{}\") <=> QScriptValue(QScriptValue::UndefinedValue)", + "engine->evaluate(\"{}\") <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "engine->evaluate(\"{}\") <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "engine->evaluate(\"{}\") <=> engine->evaluate(\"{}\")", + "engine->evaluate(\"{}\") <=> engine->evaluate(\"undefined\")", + "engine->evaluate(\"{}\") <=> engine->undefinedValue()", + "engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"Date.prototype\") <=> engine->evaluate(\"Date.prototype\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"Object\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Array\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"Number\") <=> engine->evaluate(\"Number\")", + "engine->evaluate(\"Function\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { return 1; })\") <=> engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"(function() { throw new Error('foo' })\") <=> engine->evaluate(\"(function() { throw new Error('foo' })\")", + "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"/foo/\")", + "engine->evaluate(\"new Object()\") <=> engine->evaluate(\"new Object()\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"new Array()\")", + "engine->evaluate(\"new Error()\") <=> engine->evaluate(\"new Error()\")", + "engine->evaluate(\"a = new Object( a.foo = 22; a.foo\") <=> engine->evaluate(\"a = new Object( a.foo = 22; a.foo\")", + "engine->evaluate(\"Undefined\") <=> engine->evaluate(\"Undefined\")", + "engine->evaluate(\"Null\") <=> engine->evaluate(\"Null\")", + "engine->evaluate(\"True\") <=> engine->evaluate(\"True\")", + "engine->evaluate(\"False\") <=> engine->evaluate(\"False\")", + "engine->evaluate(\"undefined\") <=> QScriptValue(QScriptValue::UndefinedValue)", + "engine->evaluate(\"undefined\") <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "engine->evaluate(\"undefined\") <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "engine->evaluate(\"undefined\") <=> engine->evaluate(\"{}\")", + "engine->evaluate(\"undefined\") <=> engine->evaluate(\"undefined\")", + "engine->evaluate(\"undefined\") <=> engine->undefinedValue()", + "engine->evaluate(\"null\") <=> QScriptValue(QScriptValue::NullValue)", + "engine->evaluate(\"null\") <=> QScriptValue(0, QScriptValue::NullValue)", + "engine->evaluate(\"null\") <=> QScriptValue(engine, QScriptValue::NullValue)", + "engine->evaluate(\"null\") <=> engine->evaluate(\"null\")", + "engine->evaluate(\"null\") <=> engine->nullValue()", + "engine->evaluate(\"true\") <=> QScriptValue(true)", + "engine->evaluate(\"true\") <=> QScriptValue(0, true)", + "engine->evaluate(\"true\") <=> QScriptValue(engine, true)", + "engine->evaluate(\"true\") <=> engine->evaluate(\"true\")", + "engine->evaluate(\"false\") <=> QScriptValue(false)", + "engine->evaluate(\"false\") <=> QScriptValue(0, false)", + "engine->evaluate(\"false\") <=> QScriptValue(engine, false)", + "engine->evaluate(\"false\") <=> engine->evaluate(\"false\")", + "engine->evaluate(\"122\") <=> QScriptValue(int(122))", + "engine->evaluate(\"122\") <=> QScriptValue(0, int(122))", + "engine->evaluate(\"122\") <=> QScriptValue(engine, int(122))", + "engine->evaluate(\"122\") <=> engine->evaluate(\"122\")", + "engine->evaluate(\"124\") <=> QScriptValue(uint(124))", + "engine->evaluate(\"124\") <=> QScriptValue(0, uint(124))", + "engine->evaluate(\"124\") <=> QScriptValue(engine, uint(124))", + "engine->evaluate(\"124\") <=> engine->evaluate(\"124\")", + "engine->evaluate(\"0\") <=> QScriptValue(0)", + "engine->evaluate(\"0\") <=> QScriptValue(0.0)", + "engine->evaluate(\"0\") <=> QScriptValue(0, 0)", + "engine->evaluate(\"0\") <=> QScriptValue(0, 0.0)", + "engine->evaluate(\"0\") <=> QScriptValue(engine, 0)", + "engine->evaluate(\"0\") <=> QScriptValue(engine, 0.0)", + "engine->evaluate(\"0\") <=> engine->evaluate(\"0\")", + "engine->evaluate(\"0\") <=> engine->evaluate(\"0.0\")", + "engine->evaluate(\"0.0\") <=> QScriptValue(0)", + "engine->evaluate(\"0.0\") <=> QScriptValue(0.0)", + "engine->evaluate(\"0.0\") <=> QScriptValue(0, 0)", + "engine->evaluate(\"0.0\") <=> QScriptValue(0, 0.0)", + "engine->evaluate(\"0.0\") <=> QScriptValue(engine, 0)", + "engine->evaluate(\"0.0\") <=> QScriptValue(engine, 0.0)", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"0\")", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"0.0\")", + "engine->evaluate(\"123.0\") <=> QScriptValue(123.0)", + "engine->evaluate(\"123.0\") <=> QScriptValue(0, 123.0)", + "engine->evaluate(\"123.0\") <=> QScriptValue(engine, 123.0)", + "engine->evaluate(\"123.0\") <=> engine->evaluate(\"123.0\")", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(6.37e-8)", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, 6.37e-8)", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, 6.37e-8)", + "engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(-6.37e-8)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, -6.37e-8)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, -6.37e-8)", + "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"-6.37e-8\")", + "engine->evaluate(\"0x43211234\") <=> QScriptValue(0x43211234)", + "engine->evaluate(\"0x43211234\") <=> QScriptValue(0, 0x43211234)", + "engine->evaluate(\"0x43211234\") <=> QScriptValue(engine, 0x43211234)", + "engine->evaluate(\"0x43211234\") <=> engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"0x10000\") <=> QScriptValue(0x10000)", + "engine->evaluate(\"0x10000\") <=> QScriptValue(0, 0x10000)", + "engine->evaluate(\"0x10000\") <=> QScriptValue(engine, 0x10000)", + "engine->evaluate(\"0x10000\") <=> engine->evaluate(\"0x10000\")", + "engine->evaluate(\"0x10001\") <=> QScriptValue(0x10001)", + "engine->evaluate(\"0x10001\") <=> QScriptValue(0, 0x10001)", + "engine->evaluate(\"0x10001\") <=> QScriptValue(engine, 0x10001)", + "engine->evaluate(\"0x10001\") <=> engine->evaluate(\"0x10001\")", + "engine->evaluate(\"Infinity\") <=> QScriptValue(qInf())", + "engine->evaluate(\"Infinity\") <=> QScriptValue(0, qInf())", + "engine->evaluate(\"Infinity\") <=> QScriptValue(engine, qInf())", + "engine->evaluate(\"Infinity\") <=> engine->evaluate(\"Infinity\")", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(-qInf())", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, -qInf())", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, -qInf())", + "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"-Infinity\")", + "engine->evaluate(\"'ciao'\") <=> QScriptValue(\"ciao\")", + "engine->evaluate(\"'ciao'\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"'ciao'\") <=> QScriptValue(0, \"ciao\")", + "engine->evaluate(\"'ciao'\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"'ciao'\") <=> QScriptValue(engine, \"ciao\")", + "engine->evaluate(\"'ciao'\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"'ciao'\") <=> engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"''\") <=> QScriptValue(QString(\"\"))", + "engine->evaluate(\"''\") <=> QScriptValue(QString())", + "engine->evaluate(\"''\") <=> QScriptValue(0, QString(\"\"))", + "engine->evaluate(\"''\") <=> QScriptValue(0, QString())", + "engine->evaluate(\"''\") <=> QScriptValue(engine, QString(\"\"))", + "engine->evaluate(\"''\") <=> QScriptValue(engine, QString())", + "engine->evaluate(\"''\") <=> engine->evaluate(\"''\")", + "engine->evaluate(\"'0'\") <=> QScriptValue(QString(\"0\"))", + "engine->evaluate(\"'0'\") <=> QScriptValue(0, QString(\"0\"))", + "engine->evaluate(\"'0'\") <=> QScriptValue(engine, QString(\"0\"))", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"'0'\")", + "engine->evaluate(\"'123'\") <=> QScriptValue(QString(\"123\"))", + "engine->evaluate(\"'123'\") <=> QScriptValue(0, QString(\"123\"))", + "engine->evaluate(\"'123'\") <=> QScriptValue(engine, QString(\"123\"))", + "engine->evaluate(\"'123'\") <=> engine->evaluate(\"'123'\")", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(QString(\"12.4\"))", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"'12.4'\")", + "engine->nullValue() <=> QScriptValue(QScriptValue::NullValue)", + "engine->nullValue() <=> QScriptValue(0, QScriptValue::NullValue)", + "engine->nullValue() <=> QScriptValue(engine, QScriptValue::NullValue)", + "engine->nullValue() <=> engine->evaluate(\"null\")", + "engine->nullValue() <=> engine->nullValue()", + "engine->undefinedValue() <=> QScriptValue(QScriptValue::UndefinedValue)", + "engine->undefinedValue() <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "engine->undefinedValue() <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "engine->undefinedValue() <=> engine->evaluate(\"{}\")", + "engine->undefinedValue() <=> engine->evaluate(\"undefined\")", + "engine->undefinedValue() <=> engine->undefinedValue()"}; + +void tst_QScriptValue::strictlyEquals_makeData(const char* expr) +{ + static QSet equals; + if (equals.isEmpty()) { + equals.reserve(503); + for (unsigned i = 0; i < 503; ++i) + equals.insert(strictlyEquals_array[i]); + } + QHash::const_iterator it; + for (it = m_values.constBegin(); it != m_values.constEnd(); ++it) { + QString tag = QString::fromLatin1("%20 <=> %21").arg(expr).arg(it.key()); + newRow(tag.toLatin1()) << it.value() << equals.contains(tag); + } +} + +void tst_QScriptValue::strictlyEquals_test(const char*, const QScriptValue& value) +{ + QFETCH(QScriptValue, other); + QFETCH(bool, expected); + QCOMPARE(value.strictlyEquals(other), expected); +} + +DEFINE_TEST_FUNCTION(strictlyEquals) + + +void tst_QScriptValue::instanceOf_initData() +{ + QTest::addColumn("other"); + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString instanceOf_array[] = { + "engine->evaluate(\"[]\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"Date.prototype\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Object\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Object\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"Array\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Array\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"Number\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Number\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"Function\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Function\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { return 1; })\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"(function() { return 1; })\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { throw new Error('foo' })\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"new Object()\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"new Error()\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"a = new Object( a.foo = 22; a.foo\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Undefined\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Null\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"True\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"False\") <=> engine->evaluate(\"Object\")"}; + +void tst_QScriptValue::instanceOf_makeData(const char *expr) +{ + static QSet equals; + if (equals.isEmpty()) { + equals.reserve(29); + for (unsigned i = 0; i < 29; ++i) + equals.insert(instanceOf_array[i]); + } + QHash::const_iterator it; + for (it = m_values.constBegin(); it != m_values.constEnd(); ++it) { + QString tag = QString::fromLatin1("%20 <=> %21").arg(expr).arg(it.key()); + newRow(tag.toLatin1()) << it.value() << equals.contains(tag); + } +} + +void tst_QScriptValue::instanceOf_test(const char *, const QScriptValue& value) +{ + QFETCH(QScriptValue, other); + QFETCH(bool, expected); + QCOMPARE(value.instanceOf(other), expected); +} + +DEFINE_TEST_FUNCTION(instanceOf) diff --git a/JavaScriptCore/runtime/ArrayConstructor.cpp b/JavaScriptCore/runtime/ArrayConstructor.cpp index 674d00a..589739a 100644 --- a/JavaScriptCore/runtime/ArrayConstructor.cpp +++ b/JavaScriptCore/runtime/ArrayConstructor.cpp @@ -26,6 +26,7 @@ #include "ArrayPrototype.h" #include "Error.h" +#include "ExceptionHelpers.h" #include "JSArray.h" #include "JSFunction.h" #include "Lookup.h" @@ -35,7 +36,7 @@ namespace JSC { ASSERT_CLASS_FITS_IN_CELL(ArrayConstructor); -static JSValue JSC_HOST_CALL arrayConstructorIsArray(ExecState*); +static EncodedJSValue JSC_HOST_CALL arrayConstructorIsArray(ExecState*); ArrayConstructor::ArrayConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr structure, ArrayPrototype* arrayPrototype, Structure* prototypeFunctionStructure) : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, arrayPrototype->classInfo()->className)) @@ -56,7 +57,7 @@ static inline JSObject* constructArrayWithSizeQuirk(ExecState* exec, const ArgLi if (args.size() == 1 && args.at(0).isNumber()) { uint32_t n = args.at(0).toUInt32(exec); if (n != args.at(0).toNumber(exec)) - return throwError(exec, RangeError, "Array size is not a small enough positive integer."); + return throwError(exec, createRangeError(exec, "Array size is not a small enough positive integer.")); return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), n); } @@ -64,9 +65,10 @@ static inline JSObject* constructArrayWithSizeQuirk(ExecState* exec, const ArgLi return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), args); } -static JSObject* constructWithArrayConstructor(ExecState* exec, JSObject*, const ArgList& args) +static EncodedJSValue JSC_HOST_CALL constructWithArrayConstructor(ExecState* exec) { - return constructArrayWithSizeQuirk(exec, args); + ArgList args(exec); + return JSValue::encode(constructArrayWithSizeQuirk(exec, args)); } // ECMA 15.4.2 @@ -76,10 +78,10 @@ ConstructType ArrayConstructor::getConstructData(ConstructData& constructData) return ConstructTypeHost; } -static JSValue JSC_HOST_CALL callArrayConstructor(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL callArrayConstructor(ExecState* exec) { ArgList args(exec); - return constructArrayWithSizeQuirk(exec, args); + return JSValue::encode(constructArrayWithSizeQuirk(exec, args)); } // ECMA 15.6.1 @@ -90,9 +92,9 @@ CallType ArrayConstructor::getCallData(CallData& callData) return CallTypeHost; } -JSValue JSC_HOST_CALL arrayConstructorIsArray(ExecState* exec) +EncodedJSValue JSC_HOST_CALL arrayConstructorIsArray(ExecState* exec) { - return jsBoolean(exec->argument(0).inherits(&JSArray::info)); + return JSValue::encode(jsBoolean(exec->argument(0).inherits(&JSArray::info))); } } // namespace JSC diff --git a/JavaScriptCore/runtime/ArrayPrototype.cpp b/JavaScriptCore/runtime/ArrayPrototype.cpp index c7dea3b..699fbe6 100644 --- a/JavaScriptCore/runtime/ArrayPrototype.cpp +++ b/JavaScriptCore/runtime/ArrayPrototype.cpp @@ -40,27 +40,27 @@ namespace JSC { ASSERT_CLASS_FITS_IN_CELL(ArrayPrototype); -static JSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState*); -static JSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState*); -static JSValue JSC_HOST_CALL arrayProtoFuncConcat(ExecState*); -static JSValue JSC_HOST_CALL arrayProtoFuncJoin(ExecState*); -static JSValue JSC_HOST_CALL arrayProtoFuncPop(ExecState*); -static JSValue JSC_HOST_CALL arrayProtoFuncPush(ExecState*); -static JSValue JSC_HOST_CALL arrayProtoFuncReverse(ExecState*); -static JSValue JSC_HOST_CALL arrayProtoFuncShift(ExecState*); -static JSValue JSC_HOST_CALL arrayProtoFuncSlice(ExecState*); -static JSValue JSC_HOST_CALL arrayProtoFuncSort(ExecState*); -static JSValue JSC_HOST_CALL arrayProtoFuncSplice(ExecState*); -static JSValue JSC_HOST_CALL arrayProtoFuncUnShift(ExecState*); -static JSValue JSC_HOST_CALL arrayProtoFuncEvery(ExecState*); -static JSValue JSC_HOST_CALL arrayProtoFuncForEach(ExecState*); -static JSValue JSC_HOST_CALL arrayProtoFuncSome(ExecState*); -static JSValue JSC_HOST_CALL arrayProtoFuncIndexOf(ExecState*); -static JSValue JSC_HOST_CALL arrayProtoFuncFilter(ExecState*); -static JSValue JSC_HOST_CALL arrayProtoFuncMap(ExecState*); -static JSValue JSC_HOST_CALL arrayProtoFuncReduce(ExecState*); -static JSValue JSC_HOST_CALL arrayProtoFuncReduceRight(ExecState*); -static JSValue JSC_HOST_CALL arrayProtoFuncLastIndexOf(ExecState*); +static EncodedJSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState*); +static EncodedJSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState*); +static EncodedJSValue JSC_HOST_CALL arrayProtoFuncConcat(ExecState*); +static EncodedJSValue JSC_HOST_CALL arrayProtoFuncJoin(ExecState*); +static EncodedJSValue JSC_HOST_CALL arrayProtoFuncPop(ExecState*); +static EncodedJSValue JSC_HOST_CALL arrayProtoFuncPush(ExecState*); +static EncodedJSValue JSC_HOST_CALL arrayProtoFuncReverse(ExecState*); +static EncodedJSValue JSC_HOST_CALL arrayProtoFuncShift(ExecState*); +static EncodedJSValue JSC_HOST_CALL arrayProtoFuncSlice(ExecState*); +static EncodedJSValue JSC_HOST_CALL arrayProtoFuncSort(ExecState*); +static EncodedJSValue JSC_HOST_CALL arrayProtoFuncSplice(ExecState*); +static EncodedJSValue JSC_HOST_CALL arrayProtoFuncUnShift(ExecState*); +static EncodedJSValue JSC_HOST_CALL arrayProtoFuncEvery(ExecState*); +static EncodedJSValue JSC_HOST_CALL arrayProtoFuncForEach(ExecState*); +static EncodedJSValue JSC_HOST_CALL arrayProtoFuncSome(ExecState*); +static EncodedJSValue JSC_HOST_CALL arrayProtoFuncIndexOf(ExecState*); +static EncodedJSValue JSC_HOST_CALL arrayProtoFuncFilter(ExecState*); +static EncodedJSValue JSC_HOST_CALL arrayProtoFuncMap(ExecState*); +static EncodedJSValue JSC_HOST_CALL arrayProtoFuncReduce(ExecState*); +static EncodedJSValue JSC_HOST_CALL arrayProtoFuncReduceRight(ExecState*); +static EncodedJSValue JSC_HOST_CALL arrayProtoFuncLastIndexOf(ExecState*); } @@ -149,23 +149,23 @@ static void putProperty(ExecState* exec, JSObject* obj, const Identifier& proper obj->put(exec, propertyName, value, slot); } -JSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec) +EncodedJSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); bool isRealArray = isJSArray(&exec->globalData(), thisValue); if (!isRealArray && !thisValue.inherits(&JSArray::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSArray* thisObj = asArray(thisValue); HashSet& arrayVisitedElements = exec->globalData().arrayVisitedElements; if (arrayVisitedElements.size() >= MaxSmallThreadReentryDepth) { if (arrayVisitedElements.size() >= exec->globalData().maxReentryDepth) - return throwError(exec, RangeError, "Maximum call stack size exceeded."); + return throwVMError(exec, createStackOverflowError(exec)); } bool alreadyVisited = !arrayVisitedElements.add(thisObj).second; if (alreadyVisited) - return jsEmptyString(exec); // return an empty string, avoiding infinite recursion. + return JSValue::encode(jsEmptyString(exec)); // return an empty string, avoiding infinite recursion. unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec); unsigned totalSize = length ? length - 1 : 0; @@ -193,11 +193,11 @@ JSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec) } arrayVisitedElements.remove(thisObj); if (!totalSize) - return jsEmptyString(exec); + return JSValue::encode(jsEmptyString(exec)); Vector buffer; buffer.reserveCapacity(totalSize); if (!buffer.data()) - return throwOutOfMemoryError(exec); + return JSValue::encode(throwOutOfMemoryError(exec)); for (unsigned i = 0; i < length; i++) { if (i) @@ -206,25 +206,25 @@ JSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec) buffer.append(rep->characters(), rep->length()); } ASSERT(buffer.size() == totalSize); - return jsString(exec, UString::adopt(buffer)); + return JSValue::encode(jsString(exec, UString::adopt(buffer))); } -JSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState* exec) +EncodedJSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSArray::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSObject* thisObj = asArray(thisValue); HashSet& arrayVisitedElements = exec->globalData().arrayVisitedElements; if (arrayVisitedElements.size() >= MaxSmallThreadReentryDepth) { if (arrayVisitedElements.size() >= exec->globalData().maxReentryDepth) - return throwError(exec, RangeError, "Maximum call stack size exceeded."); + return throwVMError(exec, createStackOverflowError(exec)); } bool alreadyVisited = !arrayVisitedElements.add(thisObj).second; if (alreadyVisited) - return jsEmptyString(exec); // return an empty string, avoding infinite recursion. + return JSValue::encode(jsEmptyString(exec)); // return an empty string, avoding infinite recursion. JSStringBuilder strBuffer; unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec); @@ -238,7 +238,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState* exec) JSValue conversionFunction = o->get(exec, exec->propertyNames().toLocaleString); UString str; CallData callData; - CallType callType = conversionFunction.getCallData(callData); + CallType callType = getCallData(conversionFunction, callData); if (callType != CallTypeNone) str = call(exec, conversionFunction, callType, callData, element, exec->emptyList()).toString(exec); else @@ -247,10 +247,10 @@ JSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState* exec) } } arrayVisitedElements.remove(thisObj); - return strBuffer.build(exec); + return JSValue::encode(strBuffer.build(exec)); } -JSValue JSC_HOST_CALL arrayProtoFuncJoin(ExecState* exec) +EncodedJSValue JSC_HOST_CALL arrayProtoFuncJoin(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSObject* thisObj = thisValue.toThisObject(exec); @@ -258,12 +258,12 @@ JSValue JSC_HOST_CALL arrayProtoFuncJoin(ExecState* exec) HashSet& arrayVisitedElements = exec->globalData().arrayVisitedElements; if (arrayVisitedElements.size() >= MaxSmallThreadReentryDepth) { if (arrayVisitedElements.size() >= exec->globalData().maxReentryDepth) - return throwError(exec, RangeError, "Maximum call stack size exceeded."); + return throwVMError(exec, createStackOverflowError(exec)); } bool alreadyVisited = !arrayVisitedElements.add(thisObj).second; if (alreadyVisited) - return jsEmptyString(exec); // return an empty string, avoding infinite recursion. + return JSValue::encode(jsEmptyString(exec)); // return an empty string, avoding infinite recursion. JSStringBuilder strBuffer; @@ -319,10 +319,10 @@ JSValue JSC_HOST_CALL arrayProtoFuncJoin(ExecState* exec) strBuffer.append(element.toString(exec)); } arrayVisitedElements.remove(thisObj); - return strBuffer.build(exec); + return JSValue::encode(strBuffer.build(exec)); } -JSValue JSC_HOST_CALL arrayProtoFuncConcat(ExecState* exec) +EncodedJSValue JSC_HOST_CALL arrayProtoFuncConcat(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSArray* arr = constructEmptyArray(exec); @@ -349,14 +349,14 @@ JSValue JSC_HOST_CALL arrayProtoFuncConcat(ExecState* exec) ++i; } arr->setLength(n); - return arr; + return JSValue::encode(arr); } -JSValue JSC_HOST_CALL arrayProtoFuncPop(ExecState* exec) +EncodedJSValue JSC_HOST_CALL arrayProtoFuncPop(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (isJSArray(&exec->globalData(), thisValue)) - return asArray(thisValue)->pop(); + return JSValue::encode(asArray(thisValue)->pop()); JSObject* thisObj = thisValue.toThisObject(exec); JSValue result; @@ -369,16 +369,16 @@ JSValue JSC_HOST_CALL arrayProtoFuncPop(ExecState* exec) thisObj->deleteProperty(exec, length - 1); putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(exec, length - 1)); } - return result; + return JSValue::encode(result); } -JSValue JSC_HOST_CALL arrayProtoFuncPush(ExecState* exec) +EncodedJSValue JSC_HOST_CALL arrayProtoFuncPush(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (isJSArray(&exec->globalData(), thisValue) && exec->argumentCount() == 1) { JSArray* array = asArray(thisValue); array->push(exec, exec->argument(0)); - return jsNumber(exec, array->length()); + return JSValue::encode(jsNumber(exec, array->length())); } JSObject* thisObj = thisValue.toThisObject(exec); @@ -387,10 +387,10 @@ JSValue JSC_HOST_CALL arrayProtoFuncPush(ExecState* exec) thisObj->put(exec, length + n, exec->argument(n)); length += exec->argumentCount(); putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(exec, length)); - return jsNumber(exec, length); + return JSValue::encode(jsNumber(exec, length)); } -JSValue JSC_HOST_CALL arrayProtoFuncReverse(ExecState* exec) +EncodedJSValue JSC_HOST_CALL arrayProtoFuncReverse(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSObject* thisObj = thisValue.toThisObject(exec); @@ -412,10 +412,10 @@ JSValue JSC_HOST_CALL arrayProtoFuncReverse(ExecState* exec) else thisObj->deleteProperty(exec, lk1); } - return thisObj; + return JSValue::encode(thisObj); } -JSValue JSC_HOST_CALL arrayProtoFuncShift(ExecState* exec) +EncodedJSValue JSC_HOST_CALL arrayProtoFuncShift(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSObject* thisObj = thisValue.toThisObject(exec); @@ -436,10 +436,10 @@ JSValue JSC_HOST_CALL arrayProtoFuncShift(ExecState* exec) thisObj->deleteProperty(exec, length - 1); putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(exec, length - 1)); } - return result; + return JSValue::encode(result); } -JSValue JSC_HOST_CALL arrayProtoFuncSlice(ExecState* exec) +EncodedJSValue JSC_HOST_CALL arrayProtoFuncSlice(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); // http://developer.netscape.com/docs/manuals/js/client/jsref/array.htm#1193713 or 15.4.4.10 @@ -482,17 +482,17 @@ JSValue JSC_HOST_CALL arrayProtoFuncSlice(ExecState* exec) resObj->put(exec, n, v); } resObj->setLength(n); - return result; + return JSValue::encode(result); } -JSValue JSC_HOST_CALL arrayProtoFuncSort(ExecState* exec) +EncodedJSValue JSC_HOST_CALL arrayProtoFuncSort(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSObject* thisObj = thisValue.toThisObject(exec); JSValue function = exec->argument(0); CallData callData; - CallType callType = function.getCallData(callData); + CallType callType = getCallData(function, callData); if (thisObj->classInfo() == &JSArray::info) { if (isNumericCompareFunction(exec, callType, callData)) @@ -501,13 +501,13 @@ JSValue JSC_HOST_CALL arrayProtoFuncSort(ExecState* exec) asArray(thisObj)->sort(exec, function, callType, callData); else asArray(thisObj)->sort(exec); - return thisObj; + return JSValue::encode(thisObj); } unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec); if (!length) - return thisObj; + return JSValue::encode(thisObj); // "Min" sort. Not the fastest, but definitely less code than heapsort // or quicksort, and much less swapping than bubblesort/insertionsort. @@ -541,10 +541,10 @@ JSValue JSC_HOST_CALL arrayProtoFuncSort(ExecState* exec) thisObj->put(exec, themin, iObj); } } - return thisObj; + return JSValue::encode(thisObj); } -JSValue JSC_HOST_CALL arrayProtoFuncSplice(ExecState* exec) +EncodedJSValue JSC_HOST_CALL arrayProtoFuncSplice(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSObject* thisObj = thisValue.toThisObject(exec); @@ -555,7 +555,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncSplice(ExecState* exec) // FIXME: Firefox returns an empty array. if (!exec->argumentCount()) - return jsUndefined(); + return JSValue::encode(jsUndefined()); unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec); double relativeBegin = exec->argument(0).toInteger(exec); @@ -602,10 +602,10 @@ JSValue JSC_HOST_CALL arrayProtoFuncSplice(ExecState* exec) thisObj->put(exec, k + begin, exec->argument(k + 2)); putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(exec, length - deleteCount + additionalArgs)); - return result; + return JSValue::encode(result); } -JSValue JSC_HOST_CALL arrayProtoFuncUnShift(ExecState* exec) +EncodedJSValue JSC_HOST_CALL arrayProtoFuncUnShift(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSObject* thisObj = thisValue.toThisObject(exec); @@ -625,19 +625,19 @@ JSValue JSC_HOST_CALL arrayProtoFuncUnShift(ExecState* exec) thisObj->put(exec, k, exec->argument(k)); JSValue result = jsNumber(exec, length + nrArgs); putProperty(exec, thisObj, exec->propertyNames().length, result); - return result; + return JSValue::encode(result); } -JSValue JSC_HOST_CALL arrayProtoFuncFilter(ExecState* exec) +EncodedJSValue JSC_HOST_CALL arrayProtoFuncFilter(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSObject* thisObj = thisValue.toThisObject(exec); JSValue function = exec->argument(0); CallData callData; - CallType callType = function.getCallData(callData); + CallType callType = getCallData(function, callData); if (callType == CallTypeNone) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSObject* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec); JSArray* resultArray = constructEmptyArray(exec); @@ -663,7 +663,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncFilter(ExecState* exec) resultArray->put(exec, filterIndex++, v); } if (k == length) - return resultArray; + return JSValue::encode(resultArray); } for (; k < length && !exec->hadException(); ++k) { PropertySlot slot(thisObj); @@ -684,19 +684,19 @@ JSValue JSC_HOST_CALL arrayProtoFuncFilter(ExecState* exec) if (result.toBoolean(exec)) resultArray->put(exec, filterIndex++, v); } - return resultArray; + return JSValue::encode(resultArray); } -JSValue JSC_HOST_CALL arrayProtoFuncMap(ExecState* exec) +EncodedJSValue JSC_HOST_CALL arrayProtoFuncMap(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSObject* thisObj = thisValue.toThisObject(exec); JSValue function = exec->argument(0); CallData callData; - CallType callType = function.getCallData(callData); + CallType callType = getCallData(function, callData); if (callType == CallTypeNone) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSObject* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec); @@ -737,7 +737,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncMap(ExecState* exec) resultArray->put(exec, k, result); } - return resultArray; + return JSValue::encode(resultArray); } // Documentation for these three is available at: @@ -745,16 +745,16 @@ JSValue JSC_HOST_CALL arrayProtoFuncMap(ExecState* exec) // http://developer-test.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Array:forEach // http://developer-test.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Array:some -JSValue JSC_HOST_CALL arrayProtoFuncEvery(ExecState* exec) +EncodedJSValue JSC_HOST_CALL arrayProtoFuncEvery(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSObject* thisObj = thisValue.toThisObject(exec); JSValue function = exec->argument(0); CallData callData; - CallType callType = function.getCallData(callData); + CallType callType = getCallData(function, callData); if (callType == CallTypeNone) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSObject* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec); @@ -776,7 +776,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncEvery(ExecState* exec) cachedCall.setArgument(2, thisObj); JSValue result = cachedCall.call(); if (!result.toBoolean(cachedCall.newCallFrame(exec))) - return jsBoolean(false); + return JSValue::encode(jsBoolean(false)); } } for (; k < length && !exec->hadException(); ++k) { @@ -799,19 +799,19 @@ JSValue JSC_HOST_CALL arrayProtoFuncEvery(ExecState* exec) } } - return result; + return JSValue::encode(result); } -JSValue JSC_HOST_CALL arrayProtoFuncForEach(ExecState* exec) +EncodedJSValue JSC_HOST_CALL arrayProtoFuncForEach(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSObject* thisObj = thisValue.toThisObject(exec); JSValue function = exec->argument(0); CallData callData; - CallType callType = function.getCallData(callData); + CallType callType = getCallData(function, callData); if (callType == CallTypeNone) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSObject* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec); @@ -845,19 +845,19 @@ JSValue JSC_HOST_CALL arrayProtoFuncForEach(ExecState* exec) call(exec, function, callType, callData, applyThis, eachArguments); } - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL arrayProtoFuncSome(ExecState* exec) +EncodedJSValue JSC_HOST_CALL arrayProtoFuncSome(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSObject* thisObj = thisValue.toThisObject(exec); JSValue function = exec->argument(0); CallData callData; - CallType callType = function.getCallData(callData); + CallType callType = getCallData(function, callData); if (callType == CallTypeNone) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSObject* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec); @@ -879,7 +879,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncSome(ExecState* exec) cachedCall.setArgument(2, thisObj); JSValue result = cachedCall.call(); if (result.toBoolean(cachedCall.newCallFrame(exec))) - return jsBoolean(true); + return JSValue::encode(jsBoolean(true)); } } for (; k < length && !exec->hadException(); ++k) { @@ -899,25 +899,25 @@ JSValue JSC_HOST_CALL arrayProtoFuncSome(ExecState* exec) break; } } - return result; + return JSValue::encode(result); } -JSValue JSC_HOST_CALL arrayProtoFuncReduce(ExecState* exec) +EncodedJSValue JSC_HOST_CALL arrayProtoFuncReduce(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSObject* thisObj = thisValue.toThisObject(exec); JSValue function = exec->argument(0); CallData callData; - CallType callType = function.getCallData(callData); + CallType callType = getCallData(function, callData); if (callType == CallTypeNone) - return throwError(exec, TypeError); + return throwVMTypeError(exec); unsigned i = 0; JSValue rv; unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec); if (!length && exec->argumentCount() == 1) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSArray* array = 0; if (isJSArray(&exec->globalData(), thisObj)) array = asArray(thisObj); @@ -934,7 +934,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncReduce(ExecState* exec) break; } if (!rv) - return throwError(exec, TypeError); + return throwVMTypeError(exec); i++; } @@ -954,7 +954,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncReduce(ExecState* exec) rv = cachedCall.call(); } if (i == length) // only return if we reached the end of the array - return rv; + return JSValue::encode(rv); } for (; i < length && !exec->hadException(); ++i) { @@ -970,25 +970,25 @@ JSValue JSC_HOST_CALL arrayProtoFuncReduce(ExecState* exec) rv = call(exec, function, callType, callData, jsNull(), eachArguments); } - return rv; + return JSValue::encode(rv); } -JSValue JSC_HOST_CALL arrayProtoFuncReduceRight(ExecState* exec) +EncodedJSValue JSC_HOST_CALL arrayProtoFuncReduceRight(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSObject* thisObj = thisValue.toThisObject(exec); JSValue function = exec->argument(0); CallData callData; - CallType callType = function.getCallData(callData); + CallType callType = getCallData(function, callData); if (callType == CallTypeNone) - return throwError(exec, TypeError); + return throwVMTypeError(exec); unsigned i = 0; JSValue rv; unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec); if (!length && exec->argumentCount() == 1) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSArray* array = 0; if (isJSArray(&exec->globalData(), thisObj)) array = asArray(thisObj); @@ -1005,7 +1005,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncReduceRight(ExecState* exec) break; } if (!rv) - return throwError(exec, TypeError); + return throwVMTypeError(exec); i++; } @@ -1023,7 +1023,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncReduceRight(ExecState* exec) rv = cachedCall.call(); } if (i == length) // only return if we reached the end of the array - return rv; + return JSValue::encode(rv); } for (; i < length && !exec->hadException(); ++i) { @@ -1040,10 +1040,10 @@ JSValue JSC_HOST_CALL arrayProtoFuncReduceRight(ExecState* exec) rv = call(exec, function, callType, callData, jsNull(), eachArguments); } - return rv; + return JSValue::encode(rv); } -JSValue JSC_HOST_CALL arrayProtoFuncIndexOf(ExecState* exec) +EncodedJSValue JSC_HOST_CALL arrayProtoFuncIndexOf(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); // JavaScript 1.5 Extension by Mozilla @@ -1069,13 +1069,13 @@ JSValue JSC_HOST_CALL arrayProtoFuncIndexOf(ExecState* exec) if (!e) continue; if (JSValue::strictEqual(exec, searchElement, e)) - return jsNumber(exec, index); + return JSValue::encode(jsNumber(exec, index)); } - return jsNumber(exec, -1); + return JSValue::encode(jsNumber(exec, -1)); } -JSValue JSC_HOST_CALL arrayProtoFuncLastIndexOf(ExecState* exec) +EncodedJSValue JSC_HOST_CALL arrayProtoFuncLastIndexOf(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); // JavaScript 1.6 Extension by Mozilla @@ -1090,7 +1090,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncLastIndexOf(ExecState* exec) if (d < 0) { d += length; if (d < 0) - return jsNumber(exec, -1); + return JSValue::encode(jsNumber(exec, -1)); } if (d < length) index = static_cast(d); @@ -1101,10 +1101,10 @@ JSValue JSC_HOST_CALL arrayProtoFuncLastIndexOf(ExecState* exec) if (!e) continue; if (JSValue::strictEqual(exec, searchElement, e)) - return jsNumber(exec, index); + return JSValue::encode(jsNumber(exec, index)); } - return jsNumber(exec, -1); + return JSValue::encode(jsNumber(exec, -1)); } } // namespace JSC diff --git a/JavaScriptCore/runtime/BooleanConstructor.cpp b/JavaScriptCore/runtime/BooleanConstructor.cpp index bc12858..953bddc 100644 --- a/JavaScriptCore/runtime/BooleanConstructor.cpp +++ b/JavaScriptCore/runtime/BooleanConstructor.cpp @@ -45,9 +45,10 @@ JSObject* constructBoolean(ExecState* exec, const ArgList& args) return obj; } -static JSObject* constructWithBooleanConstructor(ExecState* exec, JSObject*, const ArgList& args) +static EncodedJSValue JSC_HOST_CALL constructWithBooleanConstructor(ExecState* exec) { - return constructBoolean(exec, args); + ArgList args(exec); + return JSValue::encode(constructBoolean(exec, args)); } ConstructType BooleanConstructor::getConstructData(ConstructData& constructData) @@ -57,9 +58,9 @@ ConstructType BooleanConstructor::getConstructData(ConstructData& constructData) } // ECMA 15.6.1 -static JSValue JSC_HOST_CALL callBooleanConstructor(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL callBooleanConstructor(ExecState* exec) { - return jsBoolean(exec->argument(0).toBoolean(exec)); + return JSValue::encode(jsBoolean(exec->argument(0).toBoolean(exec))); } CallType BooleanConstructor::getCallData(CallData& callData) diff --git a/JavaScriptCore/runtime/BooleanPrototype.cpp b/JavaScriptCore/runtime/BooleanPrototype.cpp index dbb27b2..7ffd095 100644 --- a/JavaScriptCore/runtime/BooleanPrototype.cpp +++ b/JavaScriptCore/runtime/BooleanPrototype.cpp @@ -22,6 +22,7 @@ #include "BooleanPrototype.h" #include "Error.h" +#include "ExceptionHelpers.h" #include "JSFunction.h" #include "JSString.h" #include "ObjectPrototype.h" @@ -32,8 +33,8 @@ namespace JSC { ASSERT_CLASS_FITS_IN_CELL(BooleanPrototype); // Functions -static JSValue JSC_HOST_CALL booleanProtoFuncToString(ExecState*); -static JSValue JSC_HOST_CALL booleanProtoFuncValueOf(ExecState*); +static EncodedJSValue JSC_HOST_CALL booleanProtoFuncToString(ExecState*); +static EncodedJSValue JSC_HOST_CALL booleanProtoFuncValueOf(ExecState*); // ECMA 15.6.4 @@ -51,35 +52,35 @@ BooleanPrototype::BooleanPrototype(ExecState* exec, JSGlobalObject* globalObject // ECMA 15.6.4.2 + 15.6.4.3 -JSValue JSC_HOST_CALL booleanProtoFuncToString(ExecState* exec) +EncodedJSValue JSC_HOST_CALL booleanProtoFuncToString(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (thisValue == jsBoolean(false)) - return jsNontrivialString(exec, "false"); + return JSValue::encode(jsNontrivialString(exec, "false")); if (thisValue == jsBoolean(true)) - return jsNontrivialString(exec, "true"); + return JSValue::encode(jsNontrivialString(exec, "true")); if (!thisValue.inherits(&BooleanObject::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); if (asBooleanObject(thisValue)->internalValue() == jsBoolean(false)) - return jsNontrivialString(exec, "false"); + return JSValue::encode(jsNontrivialString(exec, "false")); ASSERT(asBooleanObject(thisValue)->internalValue() == jsBoolean(true)); - return jsNontrivialString(exec, "true"); + return JSValue::encode(jsNontrivialString(exec, "true")); } -JSValue JSC_HOST_CALL booleanProtoFuncValueOf(ExecState* exec) +EncodedJSValue JSC_HOST_CALL booleanProtoFuncValueOf(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (thisValue.isBoolean()) - return thisValue; + return JSValue::encode(thisValue); if (!thisValue.inherits(&BooleanObject::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); - return asBooleanObject(thisValue)->internalValue(); + return JSValue::encode(asBooleanObject(thisValue)->internalValue()); } } // namespace JSC diff --git a/JavaScriptCore/runtime/CallData.h b/JavaScriptCore/runtime/CallData.h index 5294e54..32e1094 100644 --- a/JavaScriptCore/runtime/CallData.h +++ b/JavaScriptCore/runtime/CallData.h @@ -29,6 +29,7 @@ #ifndef CallData_h #define CallData_h +#include "JSValue.h" #include "NativeFunctionWrapper.h" namespace JSC { @@ -37,7 +38,6 @@ namespace JSC { class ExecState; class FunctionExecutable; class JSObject; - class JSValue; class ScopeChainNode; enum CallType { @@ -46,7 +46,7 @@ namespace JSC { CallTypeJS }; - typedef JSValue (JSC_HOST_CALL *NativeFunction)(ExecState*); + typedef EncodedJSValue (JSC_HOST_CALL *NativeFunction)(ExecState*); union CallData { struct { diff --git a/JavaScriptCore/runtime/ConstructData.cpp b/JavaScriptCore/runtime/ConstructData.cpp index a7b97e6..0d27e25 100644 --- a/JavaScriptCore/runtime/ConstructData.cpp +++ b/JavaScriptCore/runtime/ConstructData.cpp @@ -33,27 +33,10 @@ namespace JSC { -JSObject* construct(ExecState* exec, JSValue object, ConstructType constructType, const ConstructData& constructData, const ArgList& args) +JSObject* construct(ExecState* exec, JSValue constructorObject, ConstructType constructType, const ConstructData& constructData, const ArgList& args) { - if (constructType == ConstructTypeHost) - return constructData.native.function(exec, asObject(object), args); - - ASSERT(constructType == ConstructTypeJS); - JSFunction* jsFunction = asFunction(object); - - ASSERT(!jsFunction->isHostFunction()); - Structure* structure; - JSValue prototype = jsFunction->get(exec, exec->propertyNames().prototype); - if (prototype.isObject()) - structure = asObject(prototype)->inheritorID(); - else - structure = exec->lexicalGlobalObject()->emptyObjectStructure(); - JSObject* thisObj = new (exec) JSObject(structure); - - JSValue result = exec->interpreter()->executeConstruct(jsFunction->jsExecutable(), exec, jsFunction, thisObj, args, jsFunction->scope().node(), exec->exceptionSlot()); - if (exec->hadException() || !result.isObject()) - return thisObj; - return asObject(result); + ASSERT(constructType == ConstructTypeJS || constructType == ConstructTypeHost); + return exec->interpreter()->executeConstruct(exec, asObject(constructorObject), constructType, constructData, args, exec->exceptionSlot()); } } // namespace JSC diff --git a/JavaScriptCore/runtime/ConstructData.h b/JavaScriptCore/runtime/ConstructData.h index 6b954a6..3d5f732 100644 --- a/JavaScriptCore/runtime/ConstructData.h +++ b/JavaScriptCore/runtime/ConstructData.h @@ -29,13 +29,14 @@ #ifndef ConstructData_h #define ConstructData_h +#include "JSValue.h" + namespace JSC { class ArgList; class ExecState; class FunctionExecutable; class JSObject; - class JSValue; class ScopeChainNode; enum ConstructType { @@ -44,7 +45,7 @@ namespace JSC { ConstructTypeJS }; - typedef JSObject* (*NativeConstructor)(ExecState*, JSObject*, const ArgList&); + typedef EncodedJSValue (JSC_HOST_CALL *NativeConstructor)(ExecState*); union ConstructData { struct { diff --git a/JavaScriptCore/runtime/DateConstructor.cpp b/JavaScriptCore/runtime/DateConstructor.cpp index 015a01a..5b2f916 100644 --- a/JavaScriptCore/runtime/DateConstructor.cpp +++ b/JavaScriptCore/runtime/DateConstructor.cpp @@ -54,9 +54,9 @@ namespace JSC { ASSERT_CLASS_FITS_IN_CELL(DateConstructor); -static JSValue JSC_HOST_CALL dateParse(ExecState*); -static JSValue JSC_HOST_CALL dateNow(ExecState*); -static JSValue JSC_HOST_CALL dateUTC(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateParse(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateNow(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateUTC(ExecState*); DateConstructor::DateConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr structure, Structure* prototypeFunctionStructure, DatePrototype* datePrototype) : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, datePrototype->classInfo()->className)) @@ -116,9 +116,10 @@ JSObject* constructDate(ExecState* exec, const ArgList& args) return new (exec) DateInstance(exec, value); } -static JSObject* constructWithDateConstructor(ExecState* exec, JSObject*, const ArgList& args) +static EncodedJSValue JSC_HOST_CALL constructWithDateConstructor(ExecState* exec) { - return constructDate(exec, args); + ArgList args(exec); + return JSValue::encode(constructDate(exec, args)); } ConstructType DateConstructor::getConstructData(ConstructData& constructData) @@ -128,7 +129,7 @@ ConstructType DateConstructor::getConstructData(ConstructData& constructData) } // ECMA 15.9.2 -static JSValue JSC_HOST_CALL callDate(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL callDate(ExecState* exec) { time_t localTime = time(0); tm localTM; @@ -138,7 +139,7 @@ static JSValue JSC_HOST_CALL callDate(ExecState* exec) DateConversionBuffer time; formatDate(ts, date); formatTime(ts, time); - return jsMakeNontrivialString(exec, date, " ", time); + return JSValue::encode(jsMakeNontrivialString(exec, date, " ", time)); } CallType DateConstructor::getCallData(CallData& callData) @@ -147,17 +148,17 @@ CallType DateConstructor::getCallData(CallData& callData) return CallTypeHost; } -static JSValue JSC_HOST_CALL dateParse(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL dateParse(ExecState* exec) { - return jsNumber(exec, parseDate(exec, exec->argument(0).toString(exec))); + return JSValue::encode(jsNumber(exec, parseDate(exec, exec->argument(0).toString(exec)))); } -static JSValue JSC_HOST_CALL dateNow(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL dateNow(ExecState* exec) { - return jsNumber(exec, jsCurrentTime()); + return JSValue::encode(jsNumber(exec, jsCurrentTime())); } -static JSValue JSC_HOST_CALL dateUTC(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL dateUTC(ExecState* exec) { int n = exec->argumentCount(); if (isnan(exec->argument(0).toNumber(exec)) @@ -167,7 +168,7 @@ static JSValue JSC_HOST_CALL dateUTC(ExecState* exec) || (n >= 5 && isnan(exec->argument(4).toNumber(exec))) || (n >= 6 && isnan(exec->argument(5).toNumber(exec))) || (n >= 7 && isnan(exec->argument(6).toNumber(exec)))) - return jsNaN(exec); + return JSValue::encode(jsNaN(exec)); GregorianDateTime t; int year = exec->argument(0).toInt32(exec); @@ -178,7 +179,7 @@ static JSValue JSC_HOST_CALL dateUTC(ExecState* exec) t.minute = exec->argument(4).toInt32(exec); t.second = exec->argument(5).toInt32(exec); double ms = (n >= 7) ? exec->argument(6).toNumber(exec) : 0; - return jsNumber(exec, timeClip(gregorianDateTimeToMS(exec, t, ms, true))); + return JSValue::encode(jsNumber(exec, timeClip(gregorianDateTimeToMS(exec, t, ms, true)))); } } // namespace JSC diff --git a/JavaScriptCore/runtime/DatePrototype.cpp b/JavaScriptCore/runtime/DatePrototype.cpp index c31a4d0..f8d2224 100644 --- a/JavaScriptCore/runtime/DatePrototype.cpp +++ b/JavaScriptCore/runtime/DatePrototype.cpp @@ -73,51 +73,51 @@ namespace JSC { ASSERT_CLASS_FITS_IN_CELL(DatePrototype); -static JSValue JSC_HOST_CALL dateProtoFuncGetDate(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncGetDay(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncGetHours(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncGetMilliSeconds(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncGetMinutes(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncGetSeconds(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncGetTime(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncGetTimezoneOffset(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncGetUTCDate(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncGetUTCDay(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncGetUTCHours(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncGetUTCMilliseconds(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncGetUTCMinutes(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncGetUTCMonth(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncGetUTCSeconds(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncGetYear(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncSetDate(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncSetFullYear(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncSetHours(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncSetMilliSeconds(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncSetMinutes(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncSetMonth(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncSetSeconds(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncSetTime(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncSetUTCDate(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncSetUTCFullYear(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncSetUTCHours(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncSetUTCMilliseconds(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncSetUTCMinutes(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncSetUTCMonth(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncSetUTCSeconds(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncToLocaleDateString(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncToLocaleString(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncToLocaleTimeString(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncToString(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncToTimeString(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState*); -static JSValue JSC_HOST_CALL dateProtoFuncToJSON(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetDate(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetDay(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetHours(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMilliSeconds(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMinutes(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetSeconds(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetTime(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetTimezoneOffset(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCDate(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCDay(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCHours(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMilliseconds(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMinutes(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMonth(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCSeconds(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetYear(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetDate(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetFullYear(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetHours(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetMilliSeconds(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetMinutes(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetMonth(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetSeconds(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetTime(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCDate(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCFullYear(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCHours(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCMilliseconds(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCMinutes(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCMonth(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCSeconds(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleDateString(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleString(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleTimeString(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncToString(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncToTimeString(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState*); +static EncodedJSValue JSC_HOST_CALL dateProtoFuncToJSON(ExecState*); } @@ -437,411 +437,411 @@ bool DatePrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& // Functions -JSValue JSC_HOST_CALL dateProtoFuncToString(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncToString(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec); if (!gregorianDateTime) - return jsNontrivialString(exec, "Invalid Date"); + return JSValue::encode(jsNontrivialString(exec, "Invalid Date")); DateConversionBuffer date; DateConversionBuffer time; formatDate(*gregorianDateTime, date); formatTime(*gregorianDateTime, time); - return jsMakeNontrivialString(exec, date, " ", time); + return JSValue::encode(jsMakeNontrivialString(exec, date, " ", time)); } -JSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec); if (!gregorianDateTime) - return jsNontrivialString(exec, "Invalid Date"); + return JSValue::encode(jsNontrivialString(exec, "Invalid Date")); DateConversionBuffer date; DateConversionBuffer time; formatDateUTCVariant(*gregorianDateTime, date); formatTimeUTC(*gregorianDateTime, time); - return jsMakeNontrivialString(exec, date, " ", time); + return JSValue::encode(jsMakeNontrivialString(exec, date, " ", time)); } -JSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec); if (!gregorianDateTime) - return jsNontrivialString(exec, "Invalid Date"); + return JSValue::encode(jsNontrivialString(exec, "Invalid Date")); // Maximum amount of space we need in buffer: 6 (max. digits in year) + 2 * 5 (2 characters each for month, day, hour, minute, second) + 4 (. + 3 digits for milliseconds) // 6 for formatting and one for null termination = 27. We add one extra character to allow us to force null termination. char buffer[28]; snprintf(buffer, sizeof(buffer) - 1, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", 1900 + gregorianDateTime->year, gregorianDateTime->month + 1, gregorianDateTime->monthDay, gregorianDateTime->hour, gregorianDateTime->minute, gregorianDateTime->second, static_cast(fmod(thisDateObj->internalNumber(), 1000))); buffer[sizeof(buffer) - 1] = 0; - return jsNontrivialString(exec, buffer); + return JSValue::encode(jsNontrivialString(exec, buffer)); } -JSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec); if (!gregorianDateTime) - return jsNontrivialString(exec, "Invalid Date"); + return JSValue::encode(jsNontrivialString(exec, "Invalid Date")); DateConversionBuffer date; formatDate(*gregorianDateTime, date); - return jsNontrivialString(exec, date); + return JSValue::encode(jsNontrivialString(exec, date)); } -JSValue JSC_HOST_CALL dateProtoFuncToTimeString(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncToTimeString(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec); if (!gregorianDateTime) - return jsNontrivialString(exec, "Invalid Date"); + return JSValue::encode(jsNontrivialString(exec, "Invalid Date")); DateConversionBuffer time; formatTime(*gregorianDateTime, time); - return jsNontrivialString(exec, time); + return JSValue::encode(jsNontrivialString(exec, time)); } -JSValue JSC_HOST_CALL dateProtoFuncToLocaleString(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleString(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); - return formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleDateAndTime); + return JSValue::encode(formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleDateAndTime)); } -JSValue JSC_HOST_CALL dateProtoFuncToLocaleDateString(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleDateString(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); - return formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleDate); + return JSValue::encode(formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleDate)); } -JSValue JSC_HOST_CALL dateProtoFuncToLocaleTimeString(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleTimeString(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); - return formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleTime); + return JSValue::encode(formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleTime)); } -JSValue JSC_HOST_CALL dateProtoFuncGetTime(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncGetTime(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); - return asDateInstance(thisValue)->internalValue(); + return JSValue::encode(asDateInstance(thisValue)->internalValue()); } -JSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec); if (!gregorianDateTime) - return jsNaN(exec); - return jsNumber(exec, 1900 + gregorianDateTime->year); + return JSValue::encode(jsNaN(exec)); + return JSValue::encode(jsNumber(exec, 1900 + gregorianDateTime->year)); } -JSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec); if (!gregorianDateTime) - return jsNaN(exec); - return jsNumber(exec, 1900 + gregorianDateTime->year); + return JSValue::encode(jsNaN(exec)); + return JSValue::encode(jsNumber(exec, 1900 + gregorianDateTime->year)); } -JSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec); if (!gregorianDateTime) - return jsNontrivialString(exec, "Invalid Date"); + return JSValue::encode(jsNontrivialString(exec, "Invalid Date")); DateConversionBuffer date; DateConversionBuffer time; formatDateUTCVariant(*gregorianDateTime, date); formatTimeUTC(*gregorianDateTime, time); - return jsMakeNontrivialString(exec, date, " ", time); + return JSValue::encode(jsMakeNontrivialString(exec, date, " ", time)); } -JSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec); if (!gregorianDateTime) - return jsNaN(exec); - return jsNumber(exec, gregorianDateTime->month); + return JSValue::encode(jsNaN(exec)); + return JSValue::encode(jsNumber(exec, gregorianDateTime->month)); } -JSValue JSC_HOST_CALL dateProtoFuncGetUTCMonth(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMonth(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec); if (!gregorianDateTime) - return jsNaN(exec); - return jsNumber(exec, gregorianDateTime->month); + return JSValue::encode(jsNaN(exec)); + return JSValue::encode(jsNumber(exec, gregorianDateTime->month)); } -JSValue JSC_HOST_CALL dateProtoFuncGetDate(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncGetDate(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec); if (!gregorianDateTime) - return jsNaN(exec); - return jsNumber(exec, gregorianDateTime->monthDay); + return JSValue::encode(jsNaN(exec)); + return JSValue::encode(jsNumber(exec, gregorianDateTime->monthDay)); } -JSValue JSC_HOST_CALL dateProtoFuncGetUTCDate(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCDate(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec); if (!gregorianDateTime) - return jsNaN(exec); - return jsNumber(exec, gregorianDateTime->monthDay); + return JSValue::encode(jsNaN(exec)); + return JSValue::encode(jsNumber(exec, gregorianDateTime->monthDay)); } -JSValue JSC_HOST_CALL dateProtoFuncGetDay(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncGetDay(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec); if (!gregorianDateTime) - return jsNaN(exec); - return jsNumber(exec, gregorianDateTime->weekDay); + return JSValue::encode(jsNaN(exec)); + return JSValue::encode(jsNumber(exec, gregorianDateTime->weekDay)); } -JSValue JSC_HOST_CALL dateProtoFuncGetUTCDay(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCDay(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec); if (!gregorianDateTime) - return jsNaN(exec); - return jsNumber(exec, gregorianDateTime->weekDay); + return JSValue::encode(jsNaN(exec)); + return JSValue::encode(jsNumber(exec, gregorianDateTime->weekDay)); } -JSValue JSC_HOST_CALL dateProtoFuncGetHours(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncGetHours(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec); if (!gregorianDateTime) - return jsNaN(exec); - return jsNumber(exec, gregorianDateTime->hour); + return JSValue::encode(jsNaN(exec)); + return JSValue::encode(jsNumber(exec, gregorianDateTime->hour)); } -JSValue JSC_HOST_CALL dateProtoFuncGetUTCHours(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCHours(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec); if (!gregorianDateTime) - return jsNaN(exec); - return jsNumber(exec, gregorianDateTime->hour); + return JSValue::encode(jsNaN(exec)); + return JSValue::encode(jsNumber(exec, gregorianDateTime->hour)); } -JSValue JSC_HOST_CALL dateProtoFuncGetMinutes(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMinutes(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec); if (!gregorianDateTime) - return jsNaN(exec); - return jsNumber(exec, gregorianDateTime->minute); + return JSValue::encode(jsNaN(exec)); + return JSValue::encode(jsNumber(exec, gregorianDateTime->minute)); } -JSValue JSC_HOST_CALL dateProtoFuncGetUTCMinutes(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMinutes(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec); if (!gregorianDateTime) - return jsNaN(exec); - return jsNumber(exec, gregorianDateTime->minute); + return JSValue::encode(jsNaN(exec)); + return JSValue::encode(jsNumber(exec, gregorianDateTime->minute)); } -JSValue JSC_HOST_CALL dateProtoFuncGetSeconds(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncGetSeconds(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec); if (!gregorianDateTime) - return jsNaN(exec); - return jsNumber(exec, gregorianDateTime->second); + return JSValue::encode(jsNaN(exec)); + return JSValue::encode(jsNumber(exec, gregorianDateTime->second)); } -JSValue JSC_HOST_CALL dateProtoFuncGetUTCSeconds(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCSeconds(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec); if (!gregorianDateTime) - return jsNaN(exec); - return jsNumber(exec, gregorianDateTime->second); + return JSValue::encode(jsNaN(exec)); + return JSValue::encode(jsNumber(exec, gregorianDateTime->second)); } -JSValue JSC_HOST_CALL dateProtoFuncGetMilliSeconds(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMilliSeconds(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); double milli = thisDateObj->internalNumber(); if (isnan(milli)) - return jsNaN(exec); + return JSValue::encode(jsNaN(exec)); double secs = floor(milli / msPerSecond); double ms = milli - secs * msPerSecond; - return jsNumber(exec, ms); + return JSValue::encode(jsNumber(exec, ms)); } -JSValue JSC_HOST_CALL dateProtoFuncGetUTCMilliseconds(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMilliseconds(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); double milli = thisDateObj->internalNumber(); if (isnan(milli)) - return jsNaN(exec); + return JSValue::encode(jsNaN(exec)); double secs = floor(milli / msPerSecond); double ms = milli - secs * msPerSecond; - return jsNumber(exec, ms); + return JSValue::encode(jsNumber(exec, ms)); } -JSValue JSC_HOST_CALL dateProtoFuncGetTimezoneOffset(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncGetTimezoneOffset(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec); if (!gregorianDateTime) - return jsNaN(exec); - return jsNumber(exec, -gregorianDateTime->utcOffset / minutesPerHour); + return JSValue::encode(jsNaN(exec)); + return JSValue::encode(jsNumber(exec, -gregorianDateTime->utcOffset / minutesPerHour)); } -JSValue JSC_HOST_CALL dateProtoFuncSetTime(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncSetTime(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); double milli = timeClip(exec->argument(0).toNumber(exec)); JSValue result = jsNumber(exec, milli); thisDateObj->setInternalValue(result); - return result; + return JSValue::encode(result); } -static JSValue setNewValueFromTimeArgs(ExecState* exec, int numArgsToUse, bool inputIsUTC) +static EncodedJSValue setNewValueFromTimeArgs(ExecState* exec, int numArgsToUse, bool inputIsUTC) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); double milli = thisDateObj->internalNumber(); @@ -849,7 +849,7 @@ static JSValue setNewValueFromTimeArgs(ExecState* exec, int numArgsToUse, bool i if (!exec->argumentCount() || isnan(milli)) { JSValue result = jsNaN(exec); thisDateObj->setInternalValue(result); - return result; + return JSValue::encode(result); } double secs = floor(milli / msPerSecond); @@ -859,32 +859,32 @@ static JSValue setNewValueFromTimeArgs(ExecState* exec, int numArgsToUse, bool i ? thisDateObj->gregorianDateTimeUTC(exec) : thisDateObj->gregorianDateTime(exec); if (!other) - return jsNaN(exec); + return JSValue::encode(jsNaN(exec)); GregorianDateTime gregorianDateTime; gregorianDateTime.copyFrom(*other); if (!fillStructuresUsingTimeArgs(exec, numArgsToUse, &ms, &gregorianDateTime)) { JSValue result = jsNaN(exec); thisDateObj->setInternalValue(result); - return result; + return JSValue::encode(result); } JSValue result = jsNumber(exec, gregorianDateTimeToMS(exec, gregorianDateTime, ms, inputIsUTC)); thisDateObj->setInternalValue(result); - return result; + return JSValue::encode(result); } -static JSValue setNewValueFromDateArgs(ExecState* exec, int numArgsToUse, bool inputIsUTC) +static EncodedJSValue setNewValueFromDateArgs(ExecState* exec, int numArgsToUse, bool inputIsUTC) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); if (!exec->argumentCount()) { JSValue result = jsNaN(exec); thisDateObj->setInternalValue(result); - return result; + return JSValue::encode(result); } double milli = thisDateObj->internalNumber(); @@ -899,116 +899,116 @@ static JSValue setNewValueFromDateArgs(ExecState* exec, int numArgsToUse, bool i ? thisDateObj->gregorianDateTimeUTC(exec) : thisDateObj->gregorianDateTime(exec); if (!other) - return jsNaN(exec); + return JSValue::encode(jsNaN(exec)); gregorianDateTime.copyFrom(*other); } if (!fillStructuresUsingDateArgs(exec, numArgsToUse, &ms, &gregorianDateTime)) { JSValue result = jsNaN(exec); thisDateObj->setInternalValue(result); - return result; + return JSValue::encode(result); } JSValue result = jsNumber(exec, gregorianDateTimeToMS(exec, gregorianDateTime, ms, inputIsUTC)); thisDateObj->setInternalValue(result); - return result; + return JSValue::encode(result); } -JSValue JSC_HOST_CALL dateProtoFuncSetMilliSeconds(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncSetMilliSeconds(ExecState* exec) { const bool inputIsUTC = false; return setNewValueFromTimeArgs(exec, 1, inputIsUTC); } -JSValue JSC_HOST_CALL dateProtoFuncSetUTCMilliseconds(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCMilliseconds(ExecState* exec) { const bool inputIsUTC = true; return setNewValueFromTimeArgs(exec, 1, inputIsUTC); } -JSValue JSC_HOST_CALL dateProtoFuncSetSeconds(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncSetSeconds(ExecState* exec) { const bool inputIsUTC = false; return setNewValueFromTimeArgs(exec, 2, inputIsUTC); } -JSValue JSC_HOST_CALL dateProtoFuncSetUTCSeconds(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCSeconds(ExecState* exec) { const bool inputIsUTC = true; return setNewValueFromTimeArgs(exec, 2, inputIsUTC); } -JSValue JSC_HOST_CALL dateProtoFuncSetMinutes(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncSetMinutes(ExecState* exec) { const bool inputIsUTC = false; return setNewValueFromTimeArgs(exec, 3, inputIsUTC); } -JSValue JSC_HOST_CALL dateProtoFuncSetUTCMinutes(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCMinutes(ExecState* exec) { const bool inputIsUTC = true; return setNewValueFromTimeArgs(exec, 3, inputIsUTC); } -JSValue JSC_HOST_CALL dateProtoFuncSetHours(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncSetHours(ExecState* exec) { const bool inputIsUTC = false; return setNewValueFromTimeArgs(exec, 4, inputIsUTC); } -JSValue JSC_HOST_CALL dateProtoFuncSetUTCHours(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCHours(ExecState* exec) { const bool inputIsUTC = true; return setNewValueFromTimeArgs(exec, 4, inputIsUTC); } -JSValue JSC_HOST_CALL dateProtoFuncSetDate(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncSetDate(ExecState* exec) { const bool inputIsUTC = false; return setNewValueFromDateArgs(exec, 1, inputIsUTC); } -JSValue JSC_HOST_CALL dateProtoFuncSetUTCDate(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCDate(ExecState* exec) { const bool inputIsUTC = true; return setNewValueFromDateArgs(exec, 1, inputIsUTC); } -JSValue JSC_HOST_CALL dateProtoFuncSetMonth(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncSetMonth(ExecState* exec) { const bool inputIsUTC = false; return setNewValueFromDateArgs(exec, 2, inputIsUTC); } -JSValue JSC_HOST_CALL dateProtoFuncSetUTCMonth(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCMonth(ExecState* exec) { const bool inputIsUTC = true; return setNewValueFromDateArgs(exec, 2, inputIsUTC); } -JSValue JSC_HOST_CALL dateProtoFuncSetFullYear(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncSetFullYear(ExecState* exec) { const bool inputIsUTC = false; return setNewValueFromDateArgs(exec, 3, inputIsUTC); } -JSValue JSC_HOST_CALL dateProtoFuncSetUTCFullYear(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCFullYear(ExecState* exec) { const bool inputIsUTC = true; return setNewValueFromDateArgs(exec, 3, inputIsUTC); } -JSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); if (!exec->argumentCount()) { JSValue result = jsNaN(exec); thisDateObj->setInternalValue(result); - return result; + return JSValue::encode(result); } double milli = thisDateObj->internalNumber(); @@ -1031,53 +1031,53 @@ JSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec) if (!ok) { JSValue result = jsNaN(exec); thisDateObj->setInternalValue(result); - return result; + return JSValue::encode(result); } gregorianDateTime.year = (year > 99 || year < 0) ? year - 1900 : year; JSValue result = jsNumber(exec, gregorianDateTimeToMS(exec, gregorianDateTime, ms, false)); thisDateObj->setInternalValue(result); - return result; + return JSValue::encode(result); } -JSValue JSC_HOST_CALL dateProtoFuncGetYear(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncGetYear(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec); if (!gregorianDateTime) - return jsNaN(exec); + return JSValue::encode(jsNaN(exec)); // NOTE: IE returns the full year even in getYear. - return jsNumber(exec, gregorianDateTime->year); + return JSValue::encode(jsNumber(exec, gregorianDateTime->year)); } -JSValue JSC_HOST_CALL dateProtoFuncToJSON(ExecState* exec) +EncodedJSValue JSC_HOST_CALL dateProtoFuncToJSON(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSObject* object = thisValue.toThisObject(exec); if (exec->hadException()) - return jsNull(); + return JSValue::encode(jsNull()); JSValue toISOValue = object->get(exec, exec->globalData().propertyNames->toISOString); if (exec->hadException()) - return jsNull(); + return JSValue::encode(jsNull()); CallData callData; - CallType callType = toISOValue.getCallData(callData); + CallType callType = getCallData(toISOValue, callData); if (callType == CallTypeNone) - return throwError(exec, TypeError, "toISOString is not a function"); + return throwVMError(exec, createTypeError(exec, "toISOString is not a function")); JSValue result = call(exec, asObject(toISOValue), callType, callData, object, exec->emptyList()); if (exec->hadException()) - return jsNull(); + return JSValue::encode(jsNull()); if (result.isObject()) - return throwError(exec, TypeError, "toISOString did not return a primitive value"); - return result; + return throwVMError(exec, createTypeError(exec, "toISOString did not return a primitive value")); + return JSValue::encode(result); } } // namespace JSC diff --git a/JavaScriptCore/runtime/Error.cpp b/JavaScriptCore/runtime/Error.cpp index 69464b7..a2be473 100644 --- a/JavaScriptCore/runtime/Error.cpp +++ b/JavaScriptCore/runtime/Error.cpp @@ -31,104 +31,168 @@ #include "JSObject.h" #include "JSString.h" #include "NativeErrorConstructor.h" +#include "SourceCode.h" namespace JSC { -const char* expressionBeginOffsetPropertyName = "expressionBeginOffset"; -const char* expressionCaretOffsetPropertyName = "expressionCaretOffset"; -const char* expressionEndOffsetPropertyName = "expressionEndOffset"; - -JSObject* Error::create(ExecState* exec, ErrorType type, const UString& message, int lineNumber, intptr_t sourceID, const UString& sourceURL) -{ - JSObject* constructor; - const char* name; - switch (type) { - case EvalError: - constructor = exec->lexicalGlobalObject()->evalErrorConstructor(); - name = "Evaluation error"; - break; - case RangeError: - constructor = exec->lexicalGlobalObject()->rangeErrorConstructor(); - name = "Range error"; - break; - case ReferenceError: - constructor = exec->lexicalGlobalObject()->referenceErrorConstructor(); - name = "Reference error"; - break; - case SyntaxError: - constructor = exec->lexicalGlobalObject()->syntaxErrorConstructor(); - name = "Syntax error"; - break; - case TypeError: - constructor = exec->lexicalGlobalObject()->typeErrorConstructor(); - name = "Type error"; - break; - case URIError: - constructor = exec->lexicalGlobalObject()->URIErrorConstructor(); - name = "URI error"; - break; - default: - constructor = exec->lexicalGlobalObject()->errorConstructor(); - name = "Error"; - break; - } - - MarkedArgumentBuffer args; - if (message.isEmpty()) - args.append(jsString(exec, name)); - else - args.append(jsString(exec, message)); - ConstructData constructData; - ConstructType constructType = constructor->getConstructData(constructData); - JSObject* error = construct(exec, constructor, constructType, constructData, args); - - if (lineNumber != -1) - error->putWithAttributes(exec, Identifier(exec, "line"), jsNumber(exec, lineNumber), ReadOnly | DontDelete); +static const char* linePropertyName = "line"; +static const char* sourceIdPropertyName = "sourceId"; +static const char* sourceURLPropertyName = "sourceURL"; +static const char* expressionBeginOffsetPropertyName = "expressionBeginOffset"; +static const char* expressionCaretOffsetPropertyName = "expressionCaretOffset"; +static const char* expressionEndOffsetPropertyName = "expressionEndOffset"; + +JSObject* createError(JSGlobalObject* globalObject, const UString& message) +{ + ASSERT(!message.isEmpty()); + return ErrorInstance::create(globalObject->globalData(), globalObject->errorStructure(), message); +} + +JSObject* createEvalError(JSGlobalObject* globalObject, const UString& message) +{ + ASSERT(!message.isEmpty()); + return ErrorInstance::create(globalObject->globalData(), globalObject->evalErrorConstructor()->errorStructure(), message); +} + +JSObject* createRangeError(JSGlobalObject* globalObject, const UString& message) +{ + ASSERT(!message.isEmpty()); + return ErrorInstance::create(globalObject->globalData(), globalObject->rangeErrorConstructor()->errorStructure(), message); +} + +JSObject* createReferenceError(JSGlobalObject* globalObject, const UString& message) +{ + ASSERT(!message.isEmpty()); + return ErrorInstance::create(globalObject->globalData(), globalObject->referenceErrorConstructor()->errorStructure(), message); +} + +JSObject* createSyntaxError(JSGlobalObject* globalObject, const UString& message) +{ + ASSERT(!message.isEmpty()); + return ErrorInstance::create(globalObject->globalData(), globalObject->syntaxErrorConstructor()->errorStructure(), message); +} + +JSObject* createTypeError(JSGlobalObject* globalObject, const UString& message) +{ + ASSERT(!message.isEmpty()); + return ErrorInstance::create(globalObject->globalData(), globalObject->typeErrorConstructor()->errorStructure(), message); +} + +JSObject* createURIError(JSGlobalObject* globalObject, const UString& message) +{ + ASSERT(!message.isEmpty()); + return ErrorInstance::create(globalObject->globalData(), globalObject->URIErrorConstructor()->errorStructure(), message); +} + +JSObject* createError(ExecState* exec, const UString& message) +{ + return createError(exec->lexicalGlobalObject(), message); +} + +JSObject* createEvalError(ExecState* exec, const UString& message) +{ + return createEvalError(exec->lexicalGlobalObject(), message); +} + +JSObject* createRangeError(ExecState* exec, const UString& message) +{ + return createRangeError(exec->lexicalGlobalObject(), message); +} + +JSObject* createReferenceError(ExecState* exec, const UString& message) +{ + return createReferenceError(exec->lexicalGlobalObject(), message); +} + +JSObject* createSyntaxError(ExecState* exec, const UString& message) +{ + return createSyntaxError(exec->lexicalGlobalObject(), message); +} + +JSObject* createTypeError(ExecState* exec, const UString& message) +{ + return createTypeError(exec->lexicalGlobalObject(), message); +} + +JSObject* createURIError(ExecState* exec, const UString& message) +{ + return createURIError(exec->lexicalGlobalObject(), message); +} + +static void addErrorSourceInfo(JSGlobalData* globalData, JSObject* error, int line, const SourceCode& source) +{ + intptr_t sourceID = source.provider()->asID(); + const UString& sourceURL = source.provider()->url(); + + if (line != -1) + error->putWithAttributes(globalData, Identifier(globalData, linePropertyName), jsNumber(globalData, line), ReadOnly | DontDelete); if (sourceID != -1) - error->putWithAttributes(exec, Identifier(exec, "sourceId"), jsNumber(exec, sourceID), ReadOnly | DontDelete); + error->putWithAttributes(globalData, Identifier(globalData, sourceIdPropertyName), jsNumber(globalData, (double)sourceID), ReadOnly | DontDelete); if (!sourceURL.isNull()) - error->putWithAttributes(exec, Identifier(exec, "sourceURL"), jsString(exec, sourceURL), ReadOnly | DontDelete); - - return error; + error->putWithAttributes(globalData, Identifier(globalData, sourceURLPropertyName), jsString(globalData, sourceURL), ReadOnly | DontDelete); } -JSObject* Error::create(ExecState* exec, ErrorType type, const char* message) +static void addErrorDivotInfo(JSGlobalData* globalData, JSObject* error, int divotPoint, int startOffset, int endOffset, bool withCaret) { - return create(exec, type, message, -1, -1, UString()); + error->putWithAttributes(globalData, Identifier(globalData, expressionBeginOffsetPropertyName), jsNumber(globalData, divotPoint - startOffset), ReadOnly | DontDelete); + error->putWithAttributes(globalData, Identifier(globalData, expressionEndOffsetPropertyName), jsNumber(globalData, divotPoint + endOffset), ReadOnly | DontDelete); + if (withCaret) + error->putWithAttributes(globalData, Identifier(globalData, expressionCaretOffsetPropertyName), jsNumber(globalData, divotPoint), ReadOnly | DontDelete); } -JSObject* throwError(ExecState* exec, JSObject* error) +JSObject* addErrorInfo(JSGlobalData* globalData, JSObject* error, int line, const SourceCode& source) { - exec->setException(error); + addErrorSourceInfo(globalData, error, line, source); return error; } -JSObject* throwError(ExecState* exec, ErrorType type) +JSObject* addErrorInfo(JSGlobalData* globalData, JSObject* error, int line, const SourceCode& source, int divotPoint, int startOffset, int endOffset, bool withCaret) { - JSObject* error = Error::create(exec, type, UString(), -1, -1, UString()); - exec->setException(error); + addErrorSourceInfo(globalData, error, line, source); + addErrorDivotInfo(globalData, error, divotPoint, startOffset, endOffset, withCaret); return error; } -JSObject* throwError(ExecState* exec, ErrorType type, const UString& message) +JSObject* addErrorInfo(ExecState* exec, JSObject* error, int line, const SourceCode& source) { - JSObject* error = Error::create(exec, type, message, -1, -1, UString()); - exec->setException(error); - return error; + return addErrorInfo(&exec->globalData(), error, line, source); +} + +JSObject* addErrorInfo(ExecState* exec, JSObject* error, int line, const SourceCode& source, int divotPoint, int startOffset, int endOffset, bool withCaret) +{ + return addErrorInfo(&exec->globalData(), error, line, source, divotPoint, startOffset, endOffset, withCaret); +} + +bool hasErrorInfo(ExecState* exec, JSObject* error) +{ + return error->hasProperty(exec, Identifier(exec, linePropertyName)) + || error->hasProperty(exec, Identifier(exec, sourceIdPropertyName)) + || error->hasProperty(exec, Identifier(exec, sourceURLPropertyName)) + || error->hasProperty(exec, Identifier(exec, expressionBeginOffsetPropertyName)) + || error->hasProperty(exec, Identifier(exec, expressionCaretOffsetPropertyName)) + || error->hasProperty(exec, Identifier(exec, expressionEndOffsetPropertyName)); } -JSObject* throwError(ExecState* exec, ErrorType type, const char* message) +JSValue throwError(ExecState* exec, JSValue error) { - JSObject* error = Error::create(exec, type, message, -1, -1, UString()); - exec->setException(error); + exec->globalData().exception = error; return error; } -JSObject* throwError(ExecState* exec, ErrorType type, const UString& message, int line, intptr_t sourceID, const UString& sourceURL) +JSObject* throwError(ExecState* exec, JSObject* error) { - JSObject* error = Error::create(exec, type, message, line, sourceID, sourceURL); - exec->setException(error); + exec->globalData().exception = error; return error; } +JSObject* throwTypeError(ExecState* exec) +{ + return throwError(exec, createTypeError(exec, "Type error")); +} + +JSObject* throwSyntaxError(ExecState* exec) +{ + return throwError(exec, createSyntaxError(exec, "Syntax error")); +} + } // namespace JSC diff --git a/JavaScriptCore/runtime/Error.h b/JavaScriptCore/runtime/Error.h index e959cff..1a0ece5 100644 --- a/JavaScriptCore/runtime/Error.h +++ b/JavaScriptCore/runtime/Error.h @@ -23,44 +23,56 @@ #ifndef Error_h #define Error_h +#include "JSObject.h" #include namespace JSC { class ExecState; + class JSGlobalData; + class JSGlobalObject; class JSObject; + class SourceCode; + class Structure; class UString; - /** - * Types of Native Errors available. For custom errors, GeneralError - * should be used. - */ - enum ErrorType { - GeneralError = 0, - EvalError = 1, - RangeError = 2, - ReferenceError = 3, - SyntaxError = 4, - TypeError = 5, - URIError = 6 - }; - - extern const char* expressionBeginOffsetPropertyName; - extern const char* expressionCaretOffsetPropertyName; - extern const char* expressionEndOffsetPropertyName; - - class Error { - public: - static JSObject* create(ExecState*, ErrorType, const UString& message, int lineNumber, intptr_t sourceID, const UString& sourceURL); - static JSObject* create(ExecState*, ErrorType, const char* message); - }; + // Methods to create a range of internal errors. + JSObject* createError(JSGlobalObject*, const UString&); + JSObject* createEvalError(JSGlobalObject*, const UString&); + JSObject* createRangeError(JSGlobalObject*, const UString&); + JSObject* createReferenceError(JSGlobalObject*, const UString&); + JSObject* createSyntaxError(JSGlobalObject*, const UString&); + JSObject* createTypeError(JSGlobalObject*, const UString&); + JSObject* createURIError(JSGlobalObject*, const UString&); + // ExecState wrappers. + JSObject* createError(ExecState*, const UString&); + JSObject* createEvalError(ExecState*, const UString&); + JSObject* createRangeError(ExecState*, const UString&); + JSObject* createReferenceError(ExecState*, const UString&); + JSObject* createSyntaxError(ExecState*, const UString&); + JSObject* createTypeError(ExecState*, const UString&); + JSObject* createURIError(ExecState*, const UString&); - JSObject* throwError(ExecState*, ErrorType, const UString& message, int lineNumber, intptr_t sourceID, const UString& sourceURL); - JSObject* throwError(ExecState*, ErrorType, const UString& message); - JSObject* throwError(ExecState*, ErrorType, const char* message); - JSObject* throwError(ExecState*, ErrorType); + // Methods to add + bool hasErrorInfo(ExecState*, JSObject* error); + JSObject* addErrorInfo(JSGlobalData*, JSObject* error, int line, const SourceCode&); + JSObject* addErrorInfo(JSGlobalData*, JSObject* error, int line, const SourceCode&, int divotPoint, int startOffset, int endOffset, bool withCaret = true); + // ExecState wrappers. + JSObject* addErrorInfo(ExecState*, JSObject* error, int line, const SourceCode&); + JSObject* addErrorInfo(ExecState*, JSObject* error, int line, const SourceCode&, int divotPoint, int startOffset, int endOffset, bool withCaret = true); + + // Methods to throw Errors. + JSValue throwError(ExecState*, JSValue); JSObject* throwError(ExecState*, JSObject*); + // Convenience wrappers, create an throw an exception with a default message. + JSObject* throwTypeError(ExecState*); + JSObject* throwSyntaxError(ExecState*); + + // Convenience wrappers, wrap result as an EncodedJSValue. + inline EncodedJSValue throwVMError(ExecState* exec, JSValue error) { return JSValue::encode(throwError(exec, error)); } + inline EncodedJSValue throwVMTypeError(ExecState* exec) { return JSValue::encode(throwTypeError(exec)); } + } // namespace JSC #endif // Error_h diff --git a/JavaScriptCore/runtime/ErrorConstructor.cpp b/JavaScriptCore/runtime/ErrorConstructor.cpp index b4b0ba2..a0874d4 100644 --- a/JavaScriptCore/runtime/ErrorConstructor.cpp +++ b/JavaScriptCore/runtime/ErrorConstructor.cpp @@ -38,17 +38,12 @@ ErrorConstructor::ErrorConstructor(ExecState* exec, JSGlobalObject* globalObject } // ECMA 15.9.3 -ErrorInstance* constructError(ExecState* exec, const ArgList& args) -{ - ErrorInstance* obj = new (exec) ErrorInstance(exec->lexicalGlobalObject()->errorStructure()); - if (!args.at(0).isUndefined()) - obj->putDirect(exec->propertyNames().message, jsString(exec, args.at(0).toString(exec))); - return obj; -} -static JSObject* constructWithErrorConstructor(ExecState* exec, JSObject*, const ArgList& args) +static EncodedJSValue JSC_HOST_CALL constructWithErrorConstructor(ExecState* exec) { - return constructError(exec, args); + JSValue message = exec->argumentCount() ? exec->argument(0) : jsUndefined(); + Structure* errorStructure = exec->lexicalGlobalObject()->errorStructure(); + return JSValue::encode(ErrorInstance::create(exec, errorStructure, message)); } ConstructType ErrorConstructor::getConstructData(ConstructData& constructData) @@ -57,10 +52,11 @@ ConstructType ErrorConstructor::getConstructData(ConstructData& constructData) return ConstructTypeHost; } -static JSValue JSC_HOST_CALL callErrorConstructor(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL callErrorConstructor(ExecState* exec) { - ArgList args(exec); - return constructError(exec, args); + JSValue message = exec->argumentCount() ? exec->argument(0) : jsUndefined(); + Structure* errorStructure = exec->lexicalGlobalObject()->errorStructure(); + return JSValue::encode(ErrorInstance::create(exec, errorStructure, message)); } CallType ErrorConstructor::getCallData(CallData& callData) diff --git a/JavaScriptCore/runtime/ErrorConstructor.h b/JavaScriptCore/runtime/ErrorConstructor.h index c0e3323..3d0d706 100644 --- a/JavaScriptCore/runtime/ErrorConstructor.h +++ b/JavaScriptCore/runtime/ErrorConstructor.h @@ -37,8 +37,6 @@ namespace JSC { virtual CallType getCallData(CallData&); }; - ErrorInstance* constructError(ExecState*, const ArgList&); - } // namespace JSC #endif // ErrorConstructor_h diff --git a/JavaScriptCore/runtime/ErrorInstance.cpp b/JavaScriptCore/runtime/ErrorInstance.cpp index 1cdb87a..be6d0fb 100644 --- a/JavaScriptCore/runtime/ErrorInstance.cpp +++ b/JavaScriptCore/runtime/ErrorInstance.cpp @@ -30,4 +30,22 @@ ErrorInstance::ErrorInstance(NonNullPassRefPtr structure) { } +ErrorInstance::ErrorInstance(JSGlobalData* globalData, NonNullPassRefPtr structure, const UString& message) + : JSObject(structure) +{ + putDirect(globalData->propertyNames->message, jsString(globalData, message)); +} + +ErrorInstance* ErrorInstance::create(JSGlobalData* globalData, NonNullPassRefPtr structure, const UString& message) +{ + return new (globalData) ErrorInstance(globalData, structure, message); +} + +ErrorInstance* ErrorInstance::create(ExecState* exec, NonNullPassRefPtr structure, JSValue message) +{ + if (message.isUndefined()) + return new (exec) ErrorInstance(structure); + return new (exec) ErrorInstance(&exec->globalData(), structure, message.toString(exec)); +} + } // namespace JSC diff --git a/JavaScriptCore/runtime/ErrorInstance.h b/JavaScriptCore/runtime/ErrorInstance.h index 9f53b51..35edcb0 100644 --- a/JavaScriptCore/runtime/ErrorInstance.h +++ b/JavaScriptCore/runtime/ErrorInstance.h @@ -27,10 +27,16 @@ namespace JSC { class ErrorInstance : public JSObject { public: - explicit ErrorInstance(NonNullPassRefPtr); virtual const ClassInfo* classInfo() const { return &info; } static const ClassInfo info; + + static ErrorInstance* create(JSGlobalData*, NonNullPassRefPtr, const UString&); + static ErrorInstance* create(ExecState* exec, NonNullPassRefPtr, JSValue message); + + protected: + explicit ErrorInstance(NonNullPassRefPtr); + explicit ErrorInstance(JSGlobalData*, NonNullPassRefPtr, const UString&); }; } // namespace JSC diff --git a/JavaScriptCore/runtime/ErrorPrototype.cpp b/JavaScriptCore/runtime/ErrorPrototype.cpp index 4c895fa..0e14a30 100644 --- a/JavaScriptCore/runtime/ErrorPrototype.cpp +++ b/JavaScriptCore/runtime/ErrorPrototype.cpp @@ -32,21 +32,19 @@ namespace JSC { ASSERT_CLASS_FITS_IN_CELL(ErrorPrototype); -static JSValue JSC_HOST_CALL errorProtoFuncToString(ExecState*); +static EncodedJSValue JSC_HOST_CALL errorProtoFuncToString(ExecState*); // ECMA 15.9.4 ErrorPrototype::ErrorPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr structure, Structure* prototypeFunctionStructure) - : ErrorInstance(structure) + : ErrorInstance(&exec->globalData(), structure, "Unknown error") { // The constructor will be added later in ErrorConstructor's constructor putDirectWithoutTransition(exec->propertyNames().name, jsNontrivialString(exec, "Error"), DontEnum); - putDirectWithoutTransition(exec->propertyNames().message, jsNontrivialString(exec, "Unknown error"), DontEnum); - putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().toString, errorProtoFuncToString), DontEnum); } -JSValue JSC_HOST_CALL errorProtoFuncToString(ExecState* exec) +EncodedJSValue JSC_HOST_CALL errorProtoFuncToString(ExecState* exec) { JSObject* thisObj = exec->hostThisValue().toThisObject(exec); JSValue name = thisObj->get(exec, exec->propertyNames().name); @@ -56,12 +54,12 @@ JSValue JSC_HOST_CALL errorProtoFuncToString(ExecState* exec) if (!name.isUndefined()) { if (!message.isUndefined()) - return jsMakeNontrivialString(exec, name.toString(exec), ": ", message.toString(exec)); - return jsNontrivialString(exec, name.toString(exec)); + return JSValue::encode(jsMakeNontrivialString(exec, name.toString(exec), ": ", message.toString(exec))); + return JSValue::encode(jsNontrivialString(exec, name.toString(exec))); } if (!message.isUndefined()) - return jsMakeNontrivialString(exec, "Error: ", message.toString(exec)); - return jsNontrivialString(exec, "Error"); + return JSValue::encode(jsMakeNontrivialString(exec, "Error: ", message.toString(exec))); + return JSValue::encode(jsNontrivialString(exec, "Error")); } } // namespace JSC diff --git a/JavaScriptCore/runtime/ExceptionHelpers.cpp b/JavaScriptCore/runtime/ExceptionHelpers.cpp index b76c226..0647e81 100644 --- a/JavaScriptCore/runtime/ExceptionHelpers.cpp +++ b/JavaScriptCore/runtime/ExceptionHelpers.cpp @@ -73,19 +73,9 @@ JSValue createTerminatedExecutionException(JSGlobalData* globalData) return new (globalData) TerminatedExecutionError(globalData); } -static JSValue createError(ExecState* exec, ErrorType e, const char* msg) +JSObject* createStackOverflowError(ExecState* exec) { - return Error::create(exec, e, msg, -1, -1, UString()); -} - -JSValue createStackOverflowError(ExecState* exec) -{ - return createError(exec, RangeError, "Maximum call stack size exceeded."); -} - -JSValue createTypeError(ExecState* exec, const char* message) -{ - return createError(exec, TypeError, message); + return createRangeError(exec, "Maximum call stack size exceeded."); } JSValue createUndefinedVariableError(ExecState* exec, const Identifier& ident, unsigned bytecodeOffset, CodeBlock* codeBlock) @@ -94,10 +84,8 @@ JSValue createUndefinedVariableError(ExecState* exec, const Identifier& ident, u int endOffset = 0; int divotPoint = 0; int line = codeBlock->expressionRangeForBytecodeOffset(exec, bytecodeOffset, divotPoint, startOffset, endOffset); - JSObject* exception = Error::create(exec, ReferenceError, makeString("Can't find variable: ", ident.ustring()), line, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL()); - exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete); - exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete); - exception->putWithAttributes(exec, Identifier(exec, expressionEndOffsetPropertyName), jsNumber(exec, divotPoint + endOffset), ReadOnly | DontDelete); + UString message(makeString("Can't find variable: ", ident.ustring())); + JSObject* exception = addErrorInfo(exec, createReferenceError(exec, message), line, codeBlock->ownerExecutable()->source(), divotPoint, startOffset, endOffset); return exception; } @@ -133,10 +121,7 @@ JSObject* createInvalidParamError(ExecState* exec, const char* op, JSValue value int divotPoint = 0; int line = codeBlock->expressionRangeForBytecodeOffset(exec, bytecodeOffset, divotPoint, startOffset, endOffset); UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint, divotPoint + endOffset, value, makeString("not a valid argument for '", op, "'")); - JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL()); - exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete); - exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete); - exception->putWithAttributes(exec, Identifier(exec, expressionEndOffsetPropertyName), jsNumber(exec, divotPoint + endOffset), ReadOnly | DontDelete); + JSObject* exception = addErrorInfo(exec, createTypeError(exec, errorMessage), line, codeBlock->ownerExecutable()->source(), divotPoint, startOffset, endOffset); return exception; } @@ -154,10 +139,7 @@ JSObject* createNotAConstructorError(ExecState* exec, JSValue value, unsigned by startPoint++; UString errorMessage = createErrorMessage(exec, codeBlock, line, startPoint, divotPoint, value, "not a constructor"); - JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL()); - exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete); - exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete); - exception->putWithAttributes(exec, Identifier(exec, expressionEndOffsetPropertyName), jsNumber(exec, divotPoint + endOffset), ReadOnly | DontDelete); + JSObject* exception = addErrorInfo(exec, createTypeError(exec, errorMessage), line, codeBlock->ownerExecutable()->source(), divotPoint, startOffset, endOffset); return exception; } @@ -168,10 +150,7 @@ JSValue createNotAFunctionError(ExecState* exec, JSValue value, unsigned bytecod int divotPoint = 0; int line = codeBlock->expressionRangeForBytecodeOffset(exec, bytecodeOffset, divotPoint, startOffset, endOffset); UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint - startOffset, divotPoint, value, "not a function"); - JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL()); - exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete); - exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete); - exception->putWithAttributes(exec, Identifier(exec, expressionEndOffsetPropertyName), jsNumber(exec, divotPoint + endOffset), ReadOnly | DontDelete); + JSObject* exception = addErrorInfo(exec, createTypeError(exec, errorMessage), line, codeBlock->ownerExecutable()->source(), divotPoint, startOffset, endOffset); return exception; } @@ -198,16 +177,13 @@ JSObject* createNotAnObjectError(ExecState* exec, JSNotAnObjectErrorStub* error, int divotPoint = 0; int line = codeBlock->expressionRangeForBytecodeOffset(exec, bytecodeOffset, divotPoint, startOffset, endOffset); UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint - startOffset, divotPoint, error->isNull() ? jsNull() : jsUndefined(), "not an object"); - JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL()); - exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete); - exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete); - exception->putWithAttributes(exec, Identifier(exec, expressionEndOffsetPropertyName), jsNumber(exec, divotPoint + endOffset), ReadOnly | DontDelete); + JSObject* exception = addErrorInfo(exec, createTypeError(exec, errorMessage), line, codeBlock->ownerExecutable()->source(), divotPoint, startOffset, endOffset); return exception; } JSValue throwOutOfMemoryError(ExecState* exec) { - return throwError(exec, GeneralError, "Out of memory"); + return throwError(exec, createError(exec, "Out of memory")); } } // namespace JSC diff --git a/JavaScriptCore/runtime/ExceptionHelpers.h b/JavaScriptCore/runtime/ExceptionHelpers.h index b152439..906465f 100644 --- a/JavaScriptCore/runtime/ExceptionHelpers.h +++ b/JavaScriptCore/runtime/ExceptionHelpers.h @@ -29,6 +29,7 @@ #ifndef ExceptionHelpers_h #define ExceptionHelpers_h +#include "JSValue.h" namespace JSC { @@ -38,14 +39,12 @@ namespace JSC { class JSGlobalData; class JSNotAnObjectErrorStub; class JSObject; - class JSValue; class Node; struct Instruction; JSValue createInterruptedExecutionException(JSGlobalData*); JSValue createTerminatedExecutionException(JSGlobalData*); - JSValue createStackOverflowError(ExecState*); - JSValue createTypeError(ExecState*, const char* message); + JSObject* createStackOverflowError(ExecState*); JSValue createUndefinedVariableError(ExecState*, const Identifier&, unsigned bytecodeOffset, CodeBlock*); JSNotAnObjectErrorStub* createNotAnObjectErrorStub(ExecState*, bool isNull); JSObject* createInvalidParamError(ExecState*, const char* op, JSValue, unsigned bytecodeOffset, CodeBlock*); diff --git a/JavaScriptCore/runtime/Executable.cpp b/JavaScriptCore/runtime/Executable.cpp index 2176e36..a18e80c 100644 --- a/JavaScriptCore/runtime/Executable.cpp +++ b/JavaScriptCore/runtime/Executable.cpp @@ -65,9 +65,11 @@ JSObject* EvalExecutable::compile(ExecState* exec, ScopeChainNode* scopeChainNod { int errLine; UString errMsg; - RefPtr evalNode = exec->globalData().parser->parse(&exec->globalData(), exec->lexicalGlobalObject()->debugger(), exec, m_source, &errLine, &errMsg); + JSGlobalData* globalData = &exec->globalData(); + JSGlobalObject* lexicalGlobalObject = exec->lexicalGlobalObject(); + RefPtr evalNode = globalData->parser->parse(globalData, lexicalGlobalObject->debugger(), exec, m_source, &errLine, &errMsg); if (!evalNode) - return Error::create(exec, SyntaxError, errMsg, errLine, m_source.provider()->asID(), m_source.provider()->url()); + return addErrorInfo(globalData, createSyntaxError(lexicalGlobalObject, errMsg), errLine, m_source); recordParse(evalNode->features(), evalNode->lineNo(), evalNode->lastLine()); ScopeChain scopeChain(scopeChainNode); @@ -86,9 +88,11 @@ JSObject* ProgramExecutable::checkSyntax(ExecState* exec) { int errLine; UString errMsg; - RefPtr programNode = exec->globalData().parser->parse(&exec->globalData(), exec->lexicalGlobalObject()->debugger(), exec, m_source, &errLine, &errMsg); + JSGlobalData* globalData = &exec->globalData(); + JSGlobalObject* lexicalGlobalObject = exec->lexicalGlobalObject(); + RefPtr programNode = globalData->parser->parse(globalData, lexicalGlobalObject->debugger(), exec, m_source, &errLine, &errMsg); if (!programNode) - return Error::create(exec, SyntaxError, errMsg, errLine, m_source.provider()->asID(), m_source.provider()->url()); + return addErrorInfo(globalData, createSyntaxError(lexicalGlobalObject, errMsg), errLine, m_source); return 0; } @@ -96,9 +100,11 @@ JSObject* ProgramExecutable::compile(ExecState* exec, ScopeChainNode* scopeChain { int errLine; UString errMsg; - RefPtr programNode = exec->globalData().parser->parse(&exec->globalData(), exec->lexicalGlobalObject()->debugger(), exec, m_source, &errLine, &errMsg); + JSGlobalData* globalData = &exec->globalData(); + JSGlobalObject* lexicalGlobalObject = exec->lexicalGlobalObject(); + RefPtr programNode = globalData->parser->parse(globalData, lexicalGlobalObject->debugger(), exec, m_source, &errLine, &errMsg); if (!programNode) - return Error::create(exec, SyntaxError, errMsg, errLine, m_source.provider()->asID(), m_source.provider()->url()); + return addErrorInfo(globalData, createSyntaxError(lexicalGlobalObject, errMsg), errLine, m_source); recordParse(programNode->features(), programNode->lineNo(), programNode->lastLine()); ScopeChain scopeChain(scopeChainNode); diff --git a/JavaScriptCore/runtime/FunctionConstructor.cpp b/JavaScriptCore/runtime/FunctionConstructor.cpp index de9fff1..a5ff28c 100644 --- a/JavaScriptCore/runtime/FunctionConstructor.cpp +++ b/JavaScriptCore/runtime/FunctionConstructor.cpp @@ -22,6 +22,7 @@ #include "FunctionConstructor.h" #include "Debugger.h" +#include "ExceptionHelpers.h" #include "FunctionPrototype.h" #include "JSFunction.h" #include "JSGlobalObject.h" @@ -44,9 +45,10 @@ FunctionConstructor::FunctionConstructor(ExecState* exec, JSGlobalObject* global putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontDelete | DontEnum); } -static JSObject* constructWithFunctionConstructor(ExecState* exec, JSObject*, const ArgList& args) +static EncodedJSValue JSC_HOST_CALL constructWithFunctionConstructor(ExecState* exec) { - return constructFunction(exec, args); + ArgList args(exec); + return JSValue::encode(constructFunction(exec, args)); } ConstructType FunctionConstructor::getConstructData(ConstructData& constructData) @@ -55,10 +57,10 @@ ConstructType FunctionConstructor::getConstructData(ConstructData& constructData return ConstructTypeHost; } -static JSValue JSC_HOST_CALL callFunctionConstructor(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL callFunctionConstructor(ExecState* exec) { ArgList args(exec); - return constructFunction(exec, args); + return JSValue::encode(constructFunction(exec, args)); } // ECMA 15.3.1 The Function Constructor Called as a Function @@ -95,13 +97,14 @@ JSObject* constructFunction(ExecState* exec, const ArgList& args, const Identifi int errLine; UString errMsg; + JSGlobalObject* globalObject = exec->lexicalGlobalObject(); + JSGlobalData* globalData = globalObject->globalData(); SourceCode source = makeSource(program, sourceURL, lineNumber); RefPtr function = FunctionExecutable::fromGlobalCode(functionName, exec, exec->dynamicGlobalObject()->debugger(), source, &errLine, &errMsg); if (!function) - return throwError(exec, SyntaxError, errMsg, errLine, source.provider()->asID(), source.provider()->url()); + return throwError(exec, addErrorInfo(globalData, createSyntaxError(globalObject, errMsg), errLine, source)); - JSGlobalObject* globalObject = exec->lexicalGlobalObject(); - ScopeChain scopeChain(globalObject, globalObject->globalData(), globalObject, exec->globalThisValue()); + ScopeChain scopeChain(globalObject, globalData, globalObject, exec->globalThisValue()); return new (exec) JSFunction(exec, function, scopeChain.node()); } diff --git a/JavaScriptCore/runtime/FunctionPrototype.cpp b/JavaScriptCore/runtime/FunctionPrototype.cpp index 15392cf..fb2f627 100644 --- a/JavaScriptCore/runtime/FunctionPrototype.cpp +++ b/JavaScriptCore/runtime/FunctionPrototype.cpp @@ -34,9 +34,9 @@ namespace JSC { ASSERT_CLASS_FITS_IN_CELL(FunctionPrototype); -static JSValue JSC_HOST_CALL functionProtoFuncToString(ExecState*); -static JSValue JSC_HOST_CALL functionProtoFuncApply(ExecState*); -static JSValue JSC_HOST_CALL functionProtoFuncCall(ExecState*); +static EncodedJSValue JSC_HOST_CALL functionProtoFuncToString(ExecState*); +static EncodedJSValue JSC_HOST_CALL functionProtoFuncApply(ExecState*); +static EncodedJSValue JSC_HOST_CALL functionProtoFuncCall(ExecState*); FunctionPrototype::FunctionPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr structure) : InternalFunction(&exec->globalData(), globalObject, structure, exec->propertyNames().nullIdentifier) @@ -53,9 +53,9 @@ void FunctionPrototype::addFunctionProperties(ExecState* exec, JSGlobalObject* g putDirectFunctionWithoutTransition(exec, *callFunction, DontEnum); } -static JSValue JSC_HOST_CALL callFunctionPrototype(ExecState*) +static EncodedJSValue JSC_HOST_CALL callFunctionPrototype(ExecState*) { - return jsUndefined(); + return JSValue::encode(jsUndefined()); } // ECMA 15.3.4 @@ -83,41 +83,41 @@ static inline void insertSemicolonIfNeeded(UString& functionBody) } } -JSValue JSC_HOST_CALL functionProtoFuncToString(ExecState* exec) +EncodedJSValue JSC_HOST_CALL functionProtoFuncToString(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (thisValue.inherits(&JSFunction::info)) { JSFunction* function = asFunction(thisValue); if (function->isHostFunction()) - return jsMakeNontrivialString(exec, "function ", function->name(exec), "() {\n [native code]\n}"); + return JSValue::encode(jsMakeNontrivialString(exec, "function ", function->name(exec), "() {\n [native code]\n}")); FunctionExecutable* executable = function->jsExecutable(); UString sourceString = executable->source().toString(); insertSemicolonIfNeeded(sourceString); - return jsMakeNontrivialString(exec, "function ", function->name(exec), "(", executable->paramString(), ") ", sourceString); + return JSValue::encode(jsMakeNontrivialString(exec, "function ", function->name(exec), "(", executable->paramString(), ") ", sourceString)); } if (thisValue.inherits(&InternalFunction::info)) { InternalFunction* function = asInternalFunction(thisValue); - return jsMakeNontrivialString(exec, "function ", function->name(exec), "() {\n [native code]\n}"); + return JSValue::encode(jsMakeNontrivialString(exec, "function ", function->name(exec), "() {\n [native code]\n}")); } - return throwError(exec, TypeError); + return throwVMTypeError(exec); } -JSValue JSC_HOST_CALL functionProtoFuncApply(ExecState* exec) +EncodedJSValue JSC_HOST_CALL functionProtoFuncApply(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); CallData callData; - CallType callType = thisValue.getCallData(callData); + CallType callType = getCallData(thisValue, callData); if (callType == CallTypeNone) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSValue array = exec->argument(1); MarkedArgumentBuffer applyArgs; if (!array.isUndefinedOrNull()) { if (!array.isObject()) - return throwError(exec, TypeError); + return throwVMTypeError(exec); if (asObject(array)->classInfo() == &Arguments::info) asArguments(array)->fillArgList(exec, applyArgs); else if (isJSArray(&exec->globalData(), array)) @@ -127,24 +127,24 @@ JSValue JSC_HOST_CALL functionProtoFuncApply(ExecState* exec) for (unsigned i = 0; i < length; ++i) applyArgs.append(asArray(array)->get(exec, i)); } else - return throwError(exec, TypeError); + return throwVMTypeError(exec); } - return call(exec, thisValue, callType, callData, exec->argument(0), applyArgs); + return JSValue::encode(call(exec, thisValue, callType, callData, exec->argument(0), applyArgs)); } -JSValue JSC_HOST_CALL functionProtoFuncCall(ExecState* exec) +EncodedJSValue JSC_HOST_CALL functionProtoFuncCall(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); CallData callData; - CallType callType = thisValue.getCallData(callData); + CallType callType = getCallData(thisValue, callData); if (callType == CallTypeNone) - return throwError(exec, TypeError); + return throwVMTypeError(exec); ArgList args(exec); ArgList callArgs; args.getSlice(1, callArgs); - return call(exec, thisValue, callType, callData, exec->argument(0), callArgs); + return JSValue::encode(call(exec, thisValue, callType, callData, exec->argument(0), callArgs)); } } // namespace JSC diff --git a/JavaScriptCore/runtime/Identifier.cpp b/JavaScriptCore/runtime/Identifier.cpp index f2642a9..46772d0 100644 --- a/JavaScriptCore/runtime/Identifier.cpp +++ b/JavaScriptCore/runtime/Identifier.cpp @@ -228,6 +228,21 @@ Identifier Identifier::from(ExecState* exec, double value) return Identifier(exec, exec->globalData().numericStrings.add(value)); } +Identifier Identifier::from(JSGlobalData* globalData, unsigned value) +{ + return Identifier(globalData, globalData->numericStrings.add(value)); +} + +Identifier Identifier::from(JSGlobalData* globalData, int value) +{ + return Identifier(globalData, globalData->numericStrings.add(value)); +} + +Identifier Identifier::from(JSGlobalData* globalData, double value) +{ + return Identifier(globalData, globalData->numericStrings.add(value)); +} + #ifndef NDEBUG void Identifier::checkCurrentIdentifierTable(JSGlobalData* globalData) diff --git a/JavaScriptCore/runtime/Identifier.h b/JavaScriptCore/runtime/Identifier.h index 2f16bbf..2db0716 100644 --- a/JavaScriptCore/runtime/Identifier.h +++ b/JavaScriptCore/runtime/Identifier.h @@ -57,6 +57,9 @@ namespace JSC { static Identifier from(ExecState* exec, unsigned y); static Identifier from(ExecState* exec, int y); static Identifier from(ExecState* exec, double y); + static Identifier from(JSGlobalData*, unsigned y); + static Identifier from(JSGlobalData*, int y); + static Identifier from(JSGlobalData*, double y); bool isNull() const { return _ustring.isNull(); } bool isEmpty() const { return _ustring.isEmpty(); } diff --git a/JavaScriptCore/runtime/JSArray.cpp b/JavaScriptCore/runtime/JSArray.cpp index cf32e07..05623f5 100644 --- a/JavaScriptCore/runtime/JSArray.cpp +++ b/JavaScriptCore/runtime/JSArray.cpp @@ -283,7 +283,7 @@ void JSArray::put(ExecState* exec, const Identifier& propertyName, JSValue value if (propertyName == exec->propertyNames().length) { unsigned newLength = value.toUInt32(exec); if (value.toNumber(exec) != static_cast(newLength)) { - throwError(exec, RangeError, "Invalid array length."); + throwError(exec, createRangeError(exec, "Invalid array length.")); return; } setLength(newLength); diff --git a/JavaScriptCore/runtime/JSCell.h b/JavaScriptCore/runtime/JSCell.h index c083825..72f81df 100644 --- a/JavaScriptCore/runtime/JSCell.h +++ b/JavaScriptCore/runtime/JSCell.h @@ -23,6 +23,8 @@ #ifndef JSCell_h #define JSCell_h +#include "CallData.h" +#include "ConstructData.h" #include "Collector.h" #include "JSImmediate.h" #include "JSValue.h" @@ -205,17 +207,17 @@ namespace JSC { return isCell() ? asCell()->getObject() : 0; } - inline CallType JSValue::getCallData(CallData& callData) + inline CallType getCallData(JSValue value, CallData& callData) { - CallType result = isCell() ? asCell()->getCallData(callData) : CallTypeNone; - ASSERT(result == CallTypeNone || isValidCallee()); + CallType result = value.isCell() ? asCell(value)->getCallData(callData) : CallTypeNone; + ASSERT(result == CallTypeNone || value.isValidCallee()); return result; } - inline ConstructType JSValue::getConstructData(ConstructData& constructData) + inline ConstructType getConstructData(JSValue value, ConstructData& constructData) { - ConstructType result = isCell() ? asCell()->getConstructData(constructData) : ConstructTypeNone; - ASSERT(result == ConstructTypeNone || isValidCallee()); + ConstructType result = value.isCell() ? asCell(value)->getConstructData(constructData) : ConstructTypeNone; + ASSERT(result == ConstructTypeNone || value.isValidCallee()); return result; } diff --git a/JavaScriptCore/runtime/JSFunction.cpp b/JavaScriptCore/runtime/JSFunction.cpp index f44ca2f..7fcd037 100644 --- a/JavaScriptCore/runtime/JSFunction.cpp +++ b/JavaScriptCore/runtime/JSFunction.cpp @@ -43,12 +43,11 @@ using namespace Unicode; namespace JSC { -JSValue JSC_HOST_CALL callHostFunctionAsConstructor(ExecState* exec) +EncodedJSValue JSC_HOST_CALL callHostFunctionAsConstructor(ExecState* exec) { CodeBlock* codeBlock = exec->callerFrame()->codeBlock(); unsigned vPCIndex = codeBlock->bytecodeOffset(exec, exec->returnPC()); - exec->setException(createNotAConstructorError(exec, exec->callee(), vPCIndex, codeBlock)); - return JSValue(); + return throwVMError(exec, createNotAConstructorError(exec, exec->callee(), vPCIndex, codeBlock)); } ASSERT_CLASS_FITS_IN_CELL(JSFunction); diff --git a/JavaScriptCore/runtime/JSFunction.h b/JavaScriptCore/runtime/JSFunction.h index a906b2e..3a2fe30 100644 --- a/JavaScriptCore/runtime/JSFunction.h +++ b/JavaScriptCore/runtime/JSFunction.h @@ -35,7 +35,7 @@ namespace JSC { class JSGlobalObject; class NativeExecutable; - JSValue JSC_HOST_CALL callHostFunctionAsConstructor(ExecState*); + EncodedJSValue JSC_HOST_CALL callHostFunctionAsConstructor(ExecState*); class JSFunction : public JSObjectWithGlobalObject { friend class JIT; diff --git a/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp b/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp index 21d06b7..04cb7cf 100644 --- a/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp +++ b/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp @@ -56,7 +56,7 @@ static JSValue encode(ExecState* exec, const char* doNotEscape) UString str = exec->argument(0).toString(exec); CString cstr = str.UTF8String(true); if (!cstr.data()) - return throwError(exec, URIError, "String contained an illegal UTF-16 sequence."); + return throwError(exec, createURIError(exec, "String contained an illegal UTF-16 sequence.")); JSStringBuilder builder; const char* p = cstr.data(); @@ -118,7 +118,7 @@ static JSValue decode(ExecState* exec, const char* doNotUnescape, bool strict) } if (charLen == 0) { if (strict) - return throwError(exec, URIError); + return throwError(exec, createURIError(exec, "URI error")); // The only case where we don't use "strict" mode is the "unescape" function. // For that, it's good to support the wonky "%u" syntax for compatibility with WinIE. if (k <= len - 6 && p[1] == 'u' @@ -272,84 +272,84 @@ static double parseFloat(const UString& s) return s.toDouble(true /*tolerant*/, false /* NaN for empty string */); } -JSValue JSC_HOST_CALL globalFuncEval(ExecState* exec) +EncodedJSValue JSC_HOST_CALL globalFuncEval(ExecState* exec) { JSObject* thisObject = exec->hostThisValue().toThisObject(exec); JSObject* unwrappedObject = thisObject->unwrappedObject(); if (!unwrappedObject->isGlobalObject() || static_cast(unwrappedObject)->evalFunction() != exec->callee()) - return throwError(exec, EvalError, "The \"this\" value passed to eval must be the global object from which eval originated"); + return throwVMError(exec, createEvalError(exec, "The \"this\" value passed to eval must be the global object from which eval originated")); JSValue x = exec->argument(0); if (!x.isString()) - return x; + return JSValue::encode(x); UString s = x.toString(exec); LiteralParser preparser(exec, s, LiteralParser::NonStrictJSON); if (JSValue parsedObject = preparser.tryLiteralParse()) - return parsedObject; + return JSValue::encode(parsedObject); RefPtr eval = EvalExecutable::create(exec, makeSource(s)); JSObject* error = eval->compile(exec, static_cast(unwrappedObject)->globalScopeChain().node()); if (error) - return throwError(exec, error); + return throwVMError(exec, error); - return exec->interpreter()->execute(eval.get(), exec, thisObject, static_cast(unwrappedObject)->globalScopeChain().node(), exec->exceptionSlot()); + return JSValue::encode(exec->interpreter()->execute(eval.get(), exec, thisObject, static_cast(unwrappedObject)->globalScopeChain().node(), exec->exceptionSlot())); } -JSValue JSC_HOST_CALL globalFuncParseInt(ExecState* exec) +EncodedJSValue JSC_HOST_CALL globalFuncParseInt(ExecState* exec) { JSValue value = exec->argument(0); int32_t radix = exec->argument(1).toInt32(exec); if (radix != 0 && radix != 10) - return jsNumber(exec, parseInt(value.toString(exec), radix)); + return JSValue::encode(jsNumber(exec, parseInt(value.toString(exec), radix))); if (value.isInt32()) - return value; + return JSValue::encode(value); if (value.isDouble()) { double d = value.asDouble(); if (isfinite(d)) - return jsNumber(exec, (d > 0) ? floor(d) : ceil(d)); + return JSValue::encode(jsNumber(exec, (d > 0) ? floor(d) : ceil(d))); if (isnan(d) || isinf(d)) - return jsNaN(exec); - return jsNumber(exec, 0); + return JSValue::encode(jsNaN(exec)); + return JSValue::encode(jsNumber(exec, 0)); } - return jsNumber(exec, parseInt(value.toString(exec), radix)); + return JSValue::encode(jsNumber(exec, parseInt(value.toString(exec), radix))); } -JSValue JSC_HOST_CALL globalFuncParseFloat(ExecState* exec) +EncodedJSValue JSC_HOST_CALL globalFuncParseFloat(ExecState* exec) { - return jsNumber(exec, parseFloat(exec->argument(0).toString(exec))); + return JSValue::encode(jsNumber(exec, parseFloat(exec->argument(0).toString(exec)))); } -JSValue JSC_HOST_CALL globalFuncIsNaN(ExecState* exec) +EncodedJSValue JSC_HOST_CALL globalFuncIsNaN(ExecState* exec) { - return jsBoolean(isnan(exec->argument(0).toNumber(exec))); + return JSValue::encode(jsBoolean(isnan(exec->argument(0).toNumber(exec)))); } -JSValue JSC_HOST_CALL globalFuncIsFinite(ExecState* exec) +EncodedJSValue JSC_HOST_CALL globalFuncIsFinite(ExecState* exec) { double n = exec->argument(0).toNumber(exec); - return jsBoolean(!isnan(n) && !isinf(n)); + return JSValue::encode(jsBoolean(!isnan(n) && !isinf(n))); } -JSValue JSC_HOST_CALL globalFuncDecodeURI(ExecState* exec) +EncodedJSValue JSC_HOST_CALL globalFuncDecodeURI(ExecState* exec) { static const char do_not_unescape_when_decoding_URI[] = "#$&+,/:;=?@"; - return decode(exec, do_not_unescape_when_decoding_URI, true); + return JSValue::encode(decode(exec, do_not_unescape_when_decoding_URI, true)); } -JSValue JSC_HOST_CALL globalFuncDecodeURIComponent(ExecState* exec) +EncodedJSValue JSC_HOST_CALL globalFuncDecodeURIComponent(ExecState* exec) { - return decode(exec, "", true); + return JSValue::encode(decode(exec, "", true)); } -JSValue JSC_HOST_CALL globalFuncEncodeURI(ExecState* exec) +EncodedJSValue JSC_HOST_CALL globalFuncEncodeURI(ExecState* exec) { static const char do_not_escape_when_encoding_URI[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" @@ -357,10 +357,10 @@ JSValue JSC_HOST_CALL globalFuncEncodeURI(ExecState* exec) "0123456789" "!#$&'()*+,-./:;=?@_~"; - return encode(exec, do_not_escape_when_encoding_URI); + return JSValue::encode(encode(exec, do_not_escape_when_encoding_URI)); } -JSValue JSC_HOST_CALL globalFuncEncodeURIComponent(ExecState* exec) +EncodedJSValue JSC_HOST_CALL globalFuncEncodeURIComponent(ExecState* exec) { static const char do_not_escape_when_encoding_URI_component[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" @@ -368,10 +368,10 @@ JSValue JSC_HOST_CALL globalFuncEncodeURIComponent(ExecState* exec) "0123456789" "!'()*-._~"; - return encode(exec, do_not_escape_when_encoding_URI_component); + return JSValue::encode(encode(exec, do_not_escape_when_encoding_URI_component)); } -JSValue JSC_HOST_CALL globalFuncEscape(ExecState* exec) +EncodedJSValue JSC_HOST_CALL globalFuncEscape(ExecState* exec) { static const char do_not_escape[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" @@ -397,10 +397,10 @@ JSValue JSC_HOST_CALL globalFuncEscape(ExecState* exec) } } - return builder.build(exec); + return JSValue::encode(builder.build(exec)); } -JSValue JSC_HOST_CALL globalFuncUnescape(ExecState* exec) +EncodedJSValue JSC_HOST_CALL globalFuncUnescape(ExecState* exec) { StringBuilder builder; UString str = exec->argument(0).toString(exec); @@ -424,15 +424,15 @@ JSValue JSC_HOST_CALL globalFuncUnescape(ExecState* exec) builder.append(*c); } - return jsString(exec, builder.build()); + return JSValue::encode(jsString(exec, builder.build())); } #ifndef NDEBUG -JSValue JSC_HOST_CALL globalFuncJSCPrint(ExecState* exec) +EncodedJSValue JSC_HOST_CALL globalFuncJSCPrint(ExecState* exec) { CString string = exec->argument(0).toString(exec).UTF8String(); puts(string.data()); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } #endif diff --git a/JavaScriptCore/runtime/JSGlobalObjectFunctions.h b/JavaScriptCore/runtime/JSGlobalObjectFunctions.h index b1dada4..91dfca8 100644 --- a/JavaScriptCore/runtime/JSGlobalObjectFunctions.h +++ b/JavaScriptCore/runtime/JSGlobalObjectFunctions.h @@ -24,6 +24,7 @@ #ifndef JSGlobalObjectFunctions_h #define JSGlobalObjectFunctions_h +#include "JSValue.h" #include namespace JSC { @@ -31,24 +32,23 @@ namespace JSC { class ArgList; class ExecState; class JSObject; - class JSValue; // FIXME: These functions should really be in JSGlobalObject.cpp, but putting them there // is a 0.5% reduction. - JSValue JSC_HOST_CALL globalFuncEval(ExecState*); - JSValue JSC_HOST_CALL globalFuncParseInt(ExecState*); - JSValue JSC_HOST_CALL globalFuncParseFloat(ExecState*); - JSValue JSC_HOST_CALL globalFuncIsNaN(ExecState*); - JSValue JSC_HOST_CALL globalFuncIsFinite(ExecState*); - JSValue JSC_HOST_CALL globalFuncDecodeURI(ExecState*); - JSValue JSC_HOST_CALL globalFuncDecodeURIComponent(ExecState*); - JSValue JSC_HOST_CALL globalFuncEncodeURI(ExecState*); - JSValue JSC_HOST_CALL globalFuncEncodeURIComponent(ExecState*); - JSValue JSC_HOST_CALL globalFuncEscape(ExecState*); - JSValue JSC_HOST_CALL globalFuncUnescape(ExecState*); + EncodedJSValue JSC_HOST_CALL globalFuncEval(ExecState*); + EncodedJSValue JSC_HOST_CALL globalFuncParseInt(ExecState*); + EncodedJSValue JSC_HOST_CALL globalFuncParseFloat(ExecState*); + EncodedJSValue JSC_HOST_CALL globalFuncIsNaN(ExecState*); + EncodedJSValue JSC_HOST_CALL globalFuncIsFinite(ExecState*); + EncodedJSValue JSC_HOST_CALL globalFuncDecodeURI(ExecState*); + EncodedJSValue JSC_HOST_CALL globalFuncDecodeURIComponent(ExecState*); + EncodedJSValue JSC_HOST_CALL globalFuncEncodeURI(ExecState*); + EncodedJSValue JSC_HOST_CALL globalFuncEncodeURIComponent(ExecState*); + EncodedJSValue JSC_HOST_CALL globalFuncEscape(ExecState*); + EncodedJSValue JSC_HOST_CALL globalFuncUnescape(ExecState*); #ifndef NDEBUG - JSValue JSC_HOST_CALL globalFuncJSCPrint(ExecState*); + EncodedJSValue JSC_HOST_CALL globalFuncJSCPrint(ExecState*); #endif static const double mantissaOverflowLowerBound = 9007199254740992.0; diff --git a/JavaScriptCore/runtime/JSONObject.cpp b/JavaScriptCore/runtime/JSONObject.cpp index 86604d8..ccfd43a 100644 --- a/JavaScriptCore/runtime/JSONObject.cpp +++ b/JavaScriptCore/runtime/JSONObject.cpp @@ -41,8 +41,8 @@ namespace JSC { ASSERT_CLASS_FITS_IN_CELL(JSONObject); -static JSValue JSC_HOST_CALL JSONProtoFuncParse(ExecState*); -static JSValue JSC_HOST_CALL JSONProtoFuncStringify(ExecState*); +static EncodedJSValue JSC_HOST_CALL JSONProtoFuncParse(ExecState*); +static EncodedJSValue JSC_HOST_CALL JSONProtoFuncStringify(ExecState*); } @@ -425,7 +425,7 @@ Stringifier::StringifyResult Stringifier::appendStringifiedValue(StringBuilder& // Handle cycle detection, and put the holder on the stack. if (!m_holderCycleDetector.add(object).second) { - throwError(m_exec, TypeError, "JSON.stringify cannot serialize cyclic structures."); + throwError(m_exec, createTypeError(m_exec, "JSON.stringify cannot serialize cyclic structures.")); return StringifyFailed; } bool holderStackWasEmpty = m_holderStack.isEmpty(); @@ -443,7 +443,7 @@ Stringifier::StringifyResult Stringifier::appendStringifiedValue(StringBuilder& return StringifyFailed; if (!--tickCount) { if (localTimeoutChecker.didTimeOut(m_exec)) { - m_exec->setException(createInterruptedExecutionException(&m_exec->globalData())); + throwError(m_exec, createInterruptedExecutionException(&m_exec->globalData())); return StringifyFailed; } tickCount = localTimeoutChecker.ticksUntilNextCheck(); @@ -679,10 +679,8 @@ NEVER_INLINE JSValue Walker::walk(JSValue unfiltered) case ArrayStartState: { ASSERT(inValue.isObject()); ASSERT(isJSArray(&m_exec->globalData(), asObject(inValue)) || asObject(inValue)->inherits(&JSArray::info)); - if (objectStack.size() + arrayStack.size() > maximumFilterRecursion) { - m_exec->setException(createStackOverflowError(m_exec)); - return jsUndefined(); - } + if (objectStack.size() + arrayStack.size() > maximumFilterRecursion) + return throwError(m_exec, createStackOverflowError(m_exec)); JSArray* array = asArray(inValue); arrayStack.append(array); @@ -692,10 +690,8 @@ NEVER_INLINE JSValue Walker::walk(JSValue unfiltered) arrayStartVisitMember: case ArrayStartVisitMember: { if (!--tickCount) { - if (localTimeoutChecker.didTimeOut(m_exec)) { - m_exec->setException(createInterruptedExecutionException(&m_exec->globalData())); - return jsUndefined(); - } + if (localTimeoutChecker.didTimeOut(m_exec)) + return throwError(m_exec, createInterruptedExecutionException(&m_exec->globalData())); tickCount = localTimeoutChecker.ticksUntilNextCheck(); } @@ -744,10 +740,8 @@ NEVER_INLINE JSValue Walker::walk(JSValue unfiltered) case ObjectStartState: { ASSERT(inValue.isObject()); ASSERT(!isJSArray(&m_exec->globalData(), asObject(inValue)) && !asObject(inValue)->inherits(&JSArray::info)); - if (objectStack.size() + arrayStack.size() > maximumFilterRecursion) { - m_exec->setException(createStackOverflowError(m_exec)); - return jsUndefined(); - } + if (objectStack.size() + arrayStack.size() > maximumFilterRecursion) + return throwError(m_exec, createStackOverflowError(m_exec)); JSObject* object = asObject(inValue); objectStack.append(object); @@ -759,10 +753,8 @@ NEVER_INLINE JSValue Walker::walk(JSValue unfiltered) objectStartVisitMember: case ObjectStartVisitMember: { if (!--tickCount) { - if (localTimeoutChecker.didTimeOut(m_exec)) { - m_exec->setException(createInterruptedExecutionException(&m_exec->globalData())); - return jsUndefined(); - } + if (localTimeoutChecker.didTimeOut(m_exec)) + return throwError(m_exec, createInterruptedExecutionException(&m_exec->globalData())); tickCount = localTimeoutChecker.ticksUntilNextCheck(); } @@ -825,10 +817,8 @@ NEVER_INLINE JSValue Walker::walk(JSValue unfiltered) stateStack.removeLast(); if (!--tickCount) { - if (localTimeoutChecker.didTimeOut(m_exec)) { - m_exec->setException(createInterruptedExecutionException(&m_exec->globalData())); - return jsUndefined(); - } + if (localTimeoutChecker.didTimeOut(m_exec)) + return throwError(m_exec, createInterruptedExecutionException(&m_exec->globalData())); tickCount = localTimeoutChecker.ticksUntilNextCheck(); } } @@ -839,40 +829,40 @@ NEVER_INLINE JSValue Walker::walk(JSValue unfiltered) } // ECMA-262 v5 15.12.2 -JSValue JSC_HOST_CALL JSONProtoFuncParse(ExecState* exec) +EncodedJSValue JSC_HOST_CALL JSONProtoFuncParse(ExecState* exec) { if (!exec->argumentCount()) - return throwError(exec, GeneralError, "JSON.parse requires at least one parameter"); + return throwVMError(exec, createError(exec, "JSON.parse requires at least one parameter")); JSValue value = exec->argument(0); UString source = value.toString(exec); if (exec->hadException()) - return jsNull(); + return JSValue::encode(jsNull()); LiteralParser jsonParser(exec, source, LiteralParser::StrictJSON); JSValue unfiltered = jsonParser.tryLiteralParse(); if (!unfiltered) - return throwError(exec, SyntaxError, "Unable to parse JSON string"); + return throwVMError(exec, createSyntaxError(exec, "Unable to parse JSON string")); if (exec->argumentCount() < 2) - return unfiltered; + return JSValue::encode(unfiltered); JSValue function = exec->argument(1); CallData callData; - CallType callType = function.getCallData(callData); + CallType callType = getCallData(function, callData); if (callType == CallTypeNone) - return unfiltered; - return Walker(exec, asObject(function), callType, callData).walk(unfiltered); + return JSValue::encode(unfiltered); + return JSValue::encode(Walker(exec, asObject(function), callType, callData).walk(unfiltered)); } // ECMA-262 v5 15.12.3 -JSValue JSC_HOST_CALL JSONProtoFuncStringify(ExecState* exec) +EncodedJSValue JSC_HOST_CALL JSONProtoFuncStringify(ExecState* exec) { if (!exec->argumentCount()) - return throwError(exec, GeneralError, "No input to stringify"); + return throwVMError(exec, createError(exec, "No input to stringify")); JSValue value = exec->argument(0); JSValue replacer = exec->argument(1); JSValue space = exec->argument(2); - return Stringifier(exec, replacer, space).stringify(value); + return JSValue::encode(Stringifier(exec, replacer, space).stringify(value)); } UString JSONStringify(ExecState* exec, JSValue value, unsigned indent) diff --git a/JavaScriptCore/runtime/JSObject.cpp b/JavaScriptCore/runtime/JSObject.cpp index 5cff4fa..cabc428 100644 --- a/JavaScriptCore/runtime/JSObject.cpp +++ b/JavaScriptCore/runtime/JSObject.cpp @@ -91,7 +91,7 @@ bool JSObject::getOwnPropertySlot(ExecState* exec, unsigned propertyName, Proper static void throwSetterError(ExecState* exec) { - throwError(exec, TypeError, "setting a property that has only a getter"); + throwError(exec, createTypeError(exec, "setting a property that has only a getter")); } // ECMA 8.6.2.2 @@ -105,7 +105,7 @@ void JSObject::put(ExecState* exec, const Identifier& propertyName, JSValue valu if (!value.isObject() && !value.isNull()) return; if (!setPrototypeWithCycleCheck(value)) - throwError(exec, GeneralError, "cyclic __proto__ value"); + throwError(exec, createError(exec, "cyclic __proto__ value")); return; } @@ -161,6 +161,21 @@ void JSObject::put(ExecState* exec, unsigned propertyName, JSValue value) put(exec, Identifier::from(exec, propertyName), value, slot); } +void JSObject::putWithAttributes(JSGlobalData* globalData, const Identifier& propertyName, JSValue value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot) +{ + putDirectInternal(*globalData, propertyName, value, attributes, checkReadOnly, slot); +} + +void JSObject::putWithAttributes(JSGlobalData* globalData, const Identifier& propertyName, JSValue value, unsigned attributes) +{ + putDirectInternal(*globalData, propertyName, value, attributes); +} + +void JSObject::putWithAttributes(JSGlobalData* globalData, unsigned propertyName, JSValue value, unsigned attributes) +{ + putWithAttributes(globalData, Identifier::from(globalData, propertyName), value, attributes); +} + void JSObject::putWithAttributes(ExecState* exec, const Identifier& propertyName, JSValue value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot) { putDirectInternal(exec->globalData(), propertyName, value, attributes, checkReadOnly, slot); @@ -224,7 +239,7 @@ static ALWAYS_INLINE JSValue callDefaultValueFunction(ExecState* exec, const JSO { JSValue function = object->get(exec, propertyName); CallData callData; - CallType callType = function.getCallData(callData); + CallType callType = getCallData(function, callData); if (callType == CallTypeNone) return exec->exception(); @@ -271,7 +286,7 @@ JSValue JSObject::defaultValue(ExecState* exec, PreferredPrimitiveType hint) con ASSERT(!exec->hadException()); - return throwError(exec, TypeError, "No default value"); + return throwError(exec, createTypeError(exec, "No default value")); } const HashEntry* JSObject::findPropertyHashEntry(ExecState* exec, const Identifier& propertyName) const @@ -383,7 +398,7 @@ bool JSObject::hasInstance(ExecState* exec, JSValue value, JSValue proto) return false; if (!proto.isObject()) { - throwError(exec, TypeError, "instanceof called on an object with an invalid prototype property."); + throwError(exec, createTypeError(exec, "instanceof called on an object with an invalid prototype property.")); return false; } @@ -594,12 +609,12 @@ bool JSObject::defineOwnProperty(ExecState* exec, const Identifier& propertyName if (!current.configurable()) { if (descriptor.configurable()) { if (throwException) - throwError(exec, TypeError, "Attempting to configurable attribute of unconfigurable property."); + throwError(exec, createTypeError(exec, "Attempting to configurable attribute of unconfigurable property.")); return false; } if (descriptor.enumerablePresent() && descriptor.enumerable() != current.enumerable()) { if (throwException) - throwError(exec, TypeError, "Attempting to change enumerable attribute of unconfigurable property."); + throwError(exec, createTypeError(exec, "Attempting to change enumerable attribute of unconfigurable property.")); return false; } } @@ -617,7 +632,7 @@ bool JSObject::defineOwnProperty(ExecState* exec, const Identifier& propertyName if (descriptor.isDataDescriptor() != current.isDataDescriptor()) { if (!current.configurable()) { if (throwException) - throwError(exec, TypeError, "Attempting to change access mechanism for an unconfigurable property."); + throwError(exec, createTypeError(exec, "Attempting to change access mechanism for an unconfigurable property.")); return false; } deleteProperty(exec, propertyName); @@ -629,13 +644,13 @@ bool JSObject::defineOwnProperty(ExecState* exec, const Identifier& propertyName if (!current.configurable()) { if (!current.writable() && descriptor.writable()) { if (throwException) - throwError(exec, TypeError, "Attempting to change writable attribute of unconfigurable property."); + throwError(exec, createTypeError(exec, "Attempting to change writable attribute of unconfigurable property.")); return false; } if (!current.writable()) { if (descriptor.value() || !JSValue::strictEqual(exec, current.value(), descriptor.value())) { if (throwException) - throwError(exec, TypeError, "Attempting to change value of a readonly property."); + throwError(exec, createTypeError(exec, "Attempting to change value of a readonly property.")); return false; } } @@ -657,12 +672,12 @@ bool JSObject::defineOwnProperty(ExecState* exec, const Identifier& propertyName if (!current.configurable()) { if (descriptor.setterPresent() && !(current.setter() && JSValue::strictEqual(exec, current.setter(), descriptor.setter()))) { if (throwException) - throwError(exec, TypeError, "Attempting to change the setter of an unconfigurable property."); + throwError(exec, createTypeError(exec, "Attempting to change the setter of an unconfigurable property.")); return false; } if (descriptor.getterPresent() && !(current.getter() && JSValue::strictEqual(exec, current.getter(), descriptor.getter()))) { if (throwException) - throwError(exec, TypeError, "Attempting to change the getter of an unconfigurable property."); + throwError(exec, createTypeError(exec, "Attempting to change the getter of an unconfigurable property.")); return false; } } diff --git a/JavaScriptCore/runtime/JSObject.h b/JavaScriptCore/runtime/JSObject.h index 0738d60..edd376c 100644 --- a/JavaScriptCore/runtime/JSObject.h +++ b/JavaScriptCore/runtime/JSObject.h @@ -109,6 +109,9 @@ namespace JSC { virtual void put(ExecState*, const Identifier& propertyName, JSValue value, PutPropertySlot&); virtual void put(ExecState*, unsigned propertyName, JSValue value); + virtual void putWithAttributes(JSGlobalData*, const Identifier& propertyName, JSValue value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot); + virtual void putWithAttributes(JSGlobalData*, const Identifier& propertyName, JSValue value, unsigned attributes); + virtual void putWithAttributes(JSGlobalData*, unsigned propertyName, JSValue value, unsigned attributes); virtual void putWithAttributes(ExecState*, const Identifier& propertyName, JSValue value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot); virtual void putWithAttributes(ExecState*, const Identifier& propertyName, JSValue value, unsigned attributes); virtual void putWithAttributes(ExecState*, unsigned propertyName, JSValue value, unsigned attributes); diff --git a/JavaScriptCore/runtime/JSValue.cpp b/JavaScriptCore/runtime/JSValue.cpp index 3a2d713..728cbcf 100644 --- a/JavaScriptCore/runtime/JSValue.cpp +++ b/JavaScriptCore/runtime/JSValue.cpp @@ -25,6 +25,7 @@ #include "BooleanConstructor.h" #include "BooleanPrototype.h" +#include "Error.h" #include "ExceptionHelpers.h" #include "JSGlobalObject.h" #include "JSFunction.h" @@ -63,7 +64,7 @@ JSObject* JSValue::toObjectSlowCase(ExecState* exec) const return constructBooleanFromImmediateBoolean(exec, asValue()); ASSERT(isUndefinedOrNull()); JSNotAnObjectErrorStub* exception = createNotAnObjectErrorStub(exec, isNull()); - exec->setException(exception); + throwError(exec, exception); return new (exec) JSNotAnObject(exec, exception); } @@ -88,7 +89,7 @@ JSObject* JSValue::synthesizeObject(ExecState* exec) const return constructBooleanFromImmediateBoolean(exec, asValue()); JSNotAnObjectErrorStub* exception = createNotAnObjectErrorStub(exec, isNull()); - exec->setException(exception); + throwError(exec, exception); return new (exec) JSNotAnObject(exec, exception); } @@ -101,7 +102,7 @@ JSObject* JSValue::synthesizePrototype(ExecState* exec) const return exec->lexicalGlobalObject()->booleanPrototype(); JSNotAnObjectErrorStub* exception = createNotAnObjectErrorStub(exec, isNull()); - exec->setException(exception); + throwError(exec, exception); return new (exec) JSNotAnObject(exec, exception); } diff --git a/JavaScriptCore/runtime/JSValue.h b/JavaScriptCore/runtime/JSValue.h index 914e2d5..9190f70 100644 --- a/JavaScriptCore/runtime/JSValue.h +++ b/JavaScriptCore/runtime/JSValue.h @@ -23,8 +23,6 @@ #ifndef JSValue_h #define JSValue_h -#include "CallData.h" -#include "ConstructData.h" #include #include // for size_t #include @@ -35,6 +33,7 @@ namespace JSC { + class ExecState; class Identifier; class JSCell; class JSGlobalData; @@ -143,9 +142,6 @@ namespace JSC { UString getString(ExecState* exec) const; // null string if not a string JSObject* getObject() const; // 0 if not an object - CallType getCallData(CallData&); - ConstructType getConstructData(ConstructData&); - // Extracting integer values. bool getUInt32(uint32_t&) const; diff --git a/JavaScriptCore/runtime/MathObject.cpp b/JavaScriptCore/runtime/MathObject.cpp index 28997db..cfbaab2 100644 --- a/JavaScriptCore/runtime/MathObject.cpp +++ b/JavaScriptCore/runtime/MathObject.cpp @@ -34,24 +34,24 @@ namespace JSC { ASSERT_CLASS_FITS_IN_CELL(MathObject); -static JSValue JSC_HOST_CALL mathProtoFuncAbs(ExecState*); -static JSValue JSC_HOST_CALL mathProtoFuncACos(ExecState*); -static JSValue JSC_HOST_CALL mathProtoFuncASin(ExecState*); -static JSValue JSC_HOST_CALL mathProtoFuncATan(ExecState*); -static JSValue JSC_HOST_CALL mathProtoFuncATan2(ExecState*); -static JSValue JSC_HOST_CALL mathProtoFuncCeil(ExecState*); -static JSValue JSC_HOST_CALL mathProtoFuncCos(ExecState*); -static JSValue JSC_HOST_CALL mathProtoFuncExp(ExecState*); -static JSValue JSC_HOST_CALL mathProtoFuncFloor(ExecState*); -static JSValue JSC_HOST_CALL mathProtoFuncLog(ExecState*); -static JSValue JSC_HOST_CALL mathProtoFuncMax(ExecState*); -static JSValue JSC_HOST_CALL mathProtoFuncMin(ExecState*); -static JSValue JSC_HOST_CALL mathProtoFuncPow(ExecState*); -static JSValue JSC_HOST_CALL mathProtoFuncRandom(ExecState*); -static JSValue JSC_HOST_CALL mathProtoFuncRound(ExecState*); -static JSValue JSC_HOST_CALL mathProtoFuncSin(ExecState*); -static JSValue JSC_HOST_CALL mathProtoFuncSqrt(ExecState*); -static JSValue JSC_HOST_CALL mathProtoFuncTan(ExecState*); +static EncodedJSValue JSC_HOST_CALL mathProtoFuncAbs(ExecState*); +static EncodedJSValue JSC_HOST_CALL mathProtoFuncACos(ExecState*); +static EncodedJSValue JSC_HOST_CALL mathProtoFuncASin(ExecState*); +static EncodedJSValue JSC_HOST_CALL mathProtoFuncATan(ExecState*); +static EncodedJSValue JSC_HOST_CALL mathProtoFuncATan2(ExecState*); +static EncodedJSValue JSC_HOST_CALL mathProtoFuncCeil(ExecState*); +static EncodedJSValue JSC_HOST_CALL mathProtoFuncCos(ExecState*); +static EncodedJSValue JSC_HOST_CALL mathProtoFuncExp(ExecState*); +static EncodedJSValue JSC_HOST_CALL mathProtoFuncFloor(ExecState*); +static EncodedJSValue JSC_HOST_CALL mathProtoFuncLog(ExecState*); +static EncodedJSValue JSC_HOST_CALL mathProtoFuncMax(ExecState*); +static EncodedJSValue JSC_HOST_CALL mathProtoFuncMin(ExecState*); +static EncodedJSValue JSC_HOST_CALL mathProtoFuncPow(ExecState*); +static EncodedJSValue JSC_HOST_CALL mathProtoFuncRandom(ExecState*); +static EncodedJSValue JSC_HOST_CALL mathProtoFuncRound(ExecState*); +static EncodedJSValue JSC_HOST_CALL mathProtoFuncSin(ExecState*); +static EncodedJSValue JSC_HOST_CALL mathProtoFuncSqrt(ExecState*); +static EncodedJSValue JSC_HOST_CALL mathProtoFuncTan(ExecState*); } @@ -113,57 +113,57 @@ bool MathObject::getOwnPropertyDescriptor(ExecState* exec, const Identifier& pro // ------------------------------ Functions -------------------------------- -JSValue JSC_HOST_CALL mathProtoFuncAbs(ExecState* exec) +EncodedJSValue JSC_HOST_CALL mathProtoFuncAbs(ExecState* exec) { - return jsNumber(exec, fabs(exec->argument(0).toNumber(exec))); + return JSValue::encode(jsNumber(exec, fabs(exec->argument(0).toNumber(exec)))); } -JSValue JSC_HOST_CALL mathProtoFuncACos(ExecState* exec) +EncodedJSValue JSC_HOST_CALL mathProtoFuncACos(ExecState* exec) { - return jsDoubleNumber(exec, acos(exec->argument(0).toNumber(exec))); + return JSValue::encode(jsDoubleNumber(exec, acos(exec->argument(0).toNumber(exec)))); } -JSValue JSC_HOST_CALL mathProtoFuncASin(ExecState* exec) +EncodedJSValue JSC_HOST_CALL mathProtoFuncASin(ExecState* exec) { - return jsDoubleNumber(exec, asin(exec->argument(0).toNumber(exec))); + return JSValue::encode(jsDoubleNumber(exec, asin(exec->argument(0).toNumber(exec)))); } -JSValue JSC_HOST_CALL mathProtoFuncATan(ExecState* exec) +EncodedJSValue JSC_HOST_CALL mathProtoFuncATan(ExecState* exec) { - return jsDoubleNumber(exec, atan(exec->argument(0).toNumber(exec))); + return JSValue::encode(jsDoubleNumber(exec, atan(exec->argument(0).toNumber(exec)))); } -JSValue JSC_HOST_CALL mathProtoFuncATan2(ExecState* exec) +EncodedJSValue JSC_HOST_CALL mathProtoFuncATan2(ExecState* exec) { - return jsDoubleNumber(exec, atan2(exec->argument(0).toNumber(exec), exec->argument(1).toNumber(exec))); + return JSValue::encode(jsDoubleNumber(exec, atan2(exec->argument(0).toNumber(exec), exec->argument(1).toNumber(exec)))); } -JSValue JSC_HOST_CALL mathProtoFuncCeil(ExecState* exec) +EncodedJSValue JSC_HOST_CALL mathProtoFuncCeil(ExecState* exec) { - return jsNumber(exec, ceil(exec->argument(0).toNumber(exec))); + return JSValue::encode(jsNumber(exec, ceil(exec->argument(0).toNumber(exec)))); } -JSValue JSC_HOST_CALL mathProtoFuncCos(ExecState* exec) +EncodedJSValue JSC_HOST_CALL mathProtoFuncCos(ExecState* exec) { - return jsDoubleNumber(exec, cos(exec->argument(0).toNumber(exec))); + return JSValue::encode(jsDoubleNumber(exec, cos(exec->argument(0).toNumber(exec)))); } -JSValue JSC_HOST_CALL mathProtoFuncExp(ExecState* exec) +EncodedJSValue JSC_HOST_CALL mathProtoFuncExp(ExecState* exec) { - return jsDoubleNumber(exec, exp(exec->argument(0).toNumber(exec))); + return JSValue::encode(jsDoubleNumber(exec, exp(exec->argument(0).toNumber(exec)))); } -JSValue JSC_HOST_CALL mathProtoFuncFloor(ExecState* exec) +EncodedJSValue JSC_HOST_CALL mathProtoFuncFloor(ExecState* exec) { - return jsNumber(exec, floor(exec->argument(0).toNumber(exec))); + return JSValue::encode(jsNumber(exec, floor(exec->argument(0).toNumber(exec)))); } -JSValue JSC_HOST_CALL mathProtoFuncLog(ExecState* exec) +EncodedJSValue JSC_HOST_CALL mathProtoFuncLog(ExecState* exec) { - return jsDoubleNumber(exec, log(exec->argument(0).toNumber(exec))); + return JSValue::encode(jsDoubleNumber(exec, log(exec->argument(0).toNumber(exec)))); } -JSValue JSC_HOST_CALL mathProtoFuncMax(ExecState* exec) +EncodedJSValue JSC_HOST_CALL mathProtoFuncMax(ExecState* exec) { unsigned argsCount = exec->argumentCount(); double result = -Inf; @@ -176,10 +176,10 @@ JSValue JSC_HOST_CALL mathProtoFuncMax(ExecState* exec) if (val > result || (val == 0 && result == 0 && !signbit(val))) result = val; } - return jsNumber(exec, result); + return JSValue::encode(jsNumber(exec, result)); } -JSValue JSC_HOST_CALL mathProtoFuncMin(ExecState* exec) +EncodedJSValue JSC_HOST_CALL mathProtoFuncMin(ExecState* exec) { unsigned argsCount = exec->argumentCount(); double result = +Inf; @@ -192,10 +192,10 @@ JSValue JSC_HOST_CALL mathProtoFuncMin(ExecState* exec) if (val < result || (val == 0 && result == 0 && signbit(val))) result = val; } - return jsNumber(exec, result); + return JSValue::encode(jsNumber(exec, result)); } -JSValue JSC_HOST_CALL mathProtoFuncPow(ExecState* exec) +EncodedJSValue JSC_HOST_CALL mathProtoFuncPow(ExecState* exec) { // ECMA 15.8.2.1.13 @@ -203,37 +203,37 @@ JSValue JSC_HOST_CALL mathProtoFuncPow(ExecState* exec) double arg2 = exec->argument(1).toNumber(exec); if (isnan(arg2)) - return jsNaN(exec); + return JSValue::encode(jsNaN(exec)); if (isinf(arg2) && fabs(arg) == 1) - return jsNaN(exec); - return jsNumber(exec, pow(arg, arg2)); + return JSValue::encode(jsNaN(exec)); + return JSValue::encode(jsNumber(exec, pow(arg, arg2))); } -JSValue JSC_HOST_CALL mathProtoFuncRandom(ExecState* exec) +EncodedJSValue JSC_HOST_CALL mathProtoFuncRandom(ExecState* exec) { - return jsDoubleNumber(exec, exec->globalData().weakRandom.get()); + return JSValue::encode(jsDoubleNumber(exec, exec->globalData().weakRandom.get())); } -JSValue JSC_HOST_CALL mathProtoFuncRound(ExecState* exec) +EncodedJSValue JSC_HOST_CALL mathProtoFuncRound(ExecState* exec) { double arg = exec->argument(0).toNumber(exec); double integer = ceil(arg); - return jsNumber(exec, integer - (integer - arg > 0.5)); + return JSValue::encode(jsNumber(exec, integer - (integer - arg > 0.5))); } -JSValue JSC_HOST_CALL mathProtoFuncSin(ExecState* exec) +EncodedJSValue JSC_HOST_CALL mathProtoFuncSin(ExecState* exec) { - return exec->globalData().cachedSin(exec, exec->argument(0).toNumber(exec)); + return JSValue::encode(exec->globalData().cachedSin(exec, exec->argument(0).toNumber(exec))); } -JSValue JSC_HOST_CALL mathProtoFuncSqrt(ExecState* exec) +EncodedJSValue JSC_HOST_CALL mathProtoFuncSqrt(ExecState* exec) { - return jsDoubleNumber(exec, sqrt(exec->argument(0).toNumber(exec))); + return JSValue::encode(jsDoubleNumber(exec, sqrt(exec->argument(0).toNumber(exec)))); } -JSValue JSC_HOST_CALL mathProtoFuncTan(ExecState* exec) +EncodedJSValue JSC_HOST_CALL mathProtoFuncTan(ExecState* exec) { - return jsDoubleNumber(exec, tan(exec->argument(0).toNumber(exec))); + return JSValue::encode(jsDoubleNumber(exec, tan(exec->argument(0).toNumber(exec)))); } } // namespace JSC diff --git a/JavaScriptCore/runtime/NativeErrorConstructor.cpp b/JavaScriptCore/runtime/NativeErrorConstructor.cpp index 32ae6b8..31f9bc3 100644 --- a/JavaScriptCore/runtime/NativeErrorConstructor.cpp +++ b/JavaScriptCore/runtime/NativeErrorConstructor.cpp @@ -42,18 +42,11 @@ NativeErrorConstructor::NativeErrorConstructor(ExecState* exec, JSGlobalObject* m_errorStructure = ErrorInstance::createStructure(prototype); } - -ErrorInstance* NativeErrorConstructor::construct(ExecState* exec, const ArgList& args) -{ - ErrorInstance* object = new (exec) ErrorInstance(m_errorStructure); - if (!args.at(0).isUndefined()) - object->putDirect(exec->propertyNames().message, jsString(exec, args.at(0).toString(exec))); - return object; -} - -static JSObject* constructWithNativeErrorConstructor(ExecState* exec, JSObject* constructor, const ArgList& args) +static EncodedJSValue JSC_HOST_CALL constructWithNativeErrorConstructor(ExecState* exec) { - return static_cast(constructor)->construct(exec, args); + JSValue message = exec->argumentCount() ? exec->argument(0) : jsUndefined(); + Structure* errorStructure = static_cast(exec->callee())->errorStructure(); + return JSValue::encode(ErrorInstance::create(exec, errorStructure, message)); } ConstructType NativeErrorConstructor::getConstructData(ConstructData& constructData) @@ -62,10 +55,11 @@ ConstructType NativeErrorConstructor::getConstructData(ConstructData& constructD return ConstructTypeHost; } -static JSValue JSC_HOST_CALL callNativeErrorConstructor(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL callNativeErrorConstructor(ExecState* exec) { - ArgList args(exec); - return static_cast(exec->callee())->construct(exec, args); + JSValue message = exec->argumentCount() ? exec->argument(0) : jsUndefined(); + Structure* errorStructure = static_cast(exec->callee())->errorStructure(); + return JSValue::encode(ErrorInstance::create(exec, errorStructure, message)); } CallType NativeErrorConstructor::getCallData(CallData& callData) diff --git a/JavaScriptCore/runtime/NativeErrorConstructor.h b/JavaScriptCore/runtime/NativeErrorConstructor.h index 0153309..1ff8207 100644 --- a/JavaScriptCore/runtime/NativeErrorConstructor.h +++ b/JavaScriptCore/runtime/NativeErrorConstructor.h @@ -35,7 +35,7 @@ namespace JSC { static const ClassInfo info; - ErrorInstance* construct(ExecState*, const ArgList&); + Structure* errorStructure() { return m_errorStructure.get(); } private: virtual ConstructType getConstructData(ConstructData&); diff --git a/JavaScriptCore/runtime/NumberConstructor.cpp b/JavaScriptCore/runtime/NumberConstructor.cpp index fe91f2e..a197952 100644 --- a/JavaScriptCore/runtime/NumberConstructor.cpp +++ b/JavaScriptCore/runtime/NumberConstructor.cpp @@ -100,12 +100,12 @@ static JSValue numberConstructorMinValue(ExecState* exec, JSValue, const Identif } // ECMA 15.7.1 -static JSObject* constructWithNumberConstructor(ExecState* exec, JSObject*, const ArgList& args) +static EncodedJSValue JSC_HOST_CALL constructWithNumberConstructor(ExecState* exec) { NumberObject* object = new (exec) NumberObject(exec->lexicalGlobalObject()->numberObjectStructure()); - double n = args.isEmpty() ? 0 : args.at(0).toNumber(exec); + double n = exec->argumentCount() ? exec->argument(0).toNumber(exec) : 0; object->setInternalValue(jsNumber(exec, n)); - return object; + return JSValue::encode(object); } ConstructType NumberConstructor::getConstructData(ConstructData& constructData) @@ -115,9 +115,9 @@ ConstructType NumberConstructor::getConstructData(ConstructData& constructData) } // ECMA 15.7.2 -static JSValue JSC_HOST_CALL callNumberConstructor(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL callNumberConstructor(ExecState* exec) { - return jsNumber(exec, !exec->argumentCount() ? 0 : exec->argument(0).toNumber(exec)); + return JSValue::encode(jsNumber(exec, !exec->argumentCount() ? 0 : exec->argument(0).toNumber(exec))); } CallType NumberConstructor::getCallData(CallData& callData) diff --git a/JavaScriptCore/runtime/NumberPrototype.cpp b/JavaScriptCore/runtime/NumberPrototype.cpp index 0f1590c..e338d7c 100644 --- a/JavaScriptCore/runtime/NumberPrototype.cpp +++ b/JavaScriptCore/runtime/NumberPrototype.cpp @@ -38,12 +38,12 @@ namespace JSC { ASSERT_CLASS_FITS_IN_CELL(NumberPrototype); -static JSValue JSC_HOST_CALL numberProtoFuncToString(ExecState*); -static JSValue JSC_HOST_CALL numberProtoFuncToLocaleString(ExecState*); -static JSValue JSC_HOST_CALL numberProtoFuncValueOf(ExecState*); -static JSValue JSC_HOST_CALL numberProtoFuncToFixed(ExecState*); -static JSValue JSC_HOST_CALL numberProtoFuncToExponential(ExecState*); -static JSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState*); +static EncodedJSValue JSC_HOST_CALL numberProtoFuncToString(ExecState*); +static EncodedJSValue JSC_HOST_CALL numberProtoFuncToLocaleString(ExecState*); +static EncodedJSValue JSC_HOST_CALL numberProtoFuncValueOf(ExecState*); +static EncodedJSValue JSC_HOST_CALL numberProtoFuncToFixed(ExecState*); +static EncodedJSValue JSC_HOST_CALL numberProtoFuncToExponential(ExecState*); +static EncodedJSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState*); // ECMA 15.7.4 @@ -137,12 +137,12 @@ static double intPow10(int e) return static_cast(result); } -JSValue JSC_HOST_CALL numberProtoFuncToString(ExecState* exec) +EncodedJSValue JSC_HOST_CALL numberProtoFuncToString(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSValue v = thisValue.getJSNumber(); if (!v) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSValue radixValue = exec->argument(0); int radix; @@ -154,7 +154,7 @@ JSValue JSC_HOST_CALL numberProtoFuncToString(ExecState* exec) radix = static_cast(radixValue.toInteger(exec)); // nan -> 0 if (radix == 10) - return jsString(exec, v.toString(exec)); + return JSValue::encode(jsString(exec, v.toString(exec))); static const char* const digits = "0123456789abcdefghijklmnopqrstuvwxyz"; @@ -164,13 +164,13 @@ JSValue JSC_HOST_CALL numberProtoFuncToString(ExecState* exec) int x = v.asInt32(); if (static_cast(x) < 36) { // Exclude negatives JSGlobalData* globalData = &exec->globalData(); - return globalData->smallStrings.singleCharacterString(globalData, digits[x]); + return JSValue::encode(globalData->smallStrings.singleCharacterString(globalData, digits[x])); } } } if (radix < 2 || radix > 36) - return throwError(exec, RangeError, "toString() radix argument must be between 2 and 36"); + return throwVMError(exec, createRangeError(exec, "toString() radix argument must be between 2 and 36")); // INT_MAX results in 1024 characters left of the dot with radix 2 // give the same space on the right side. safety checks are in place @@ -179,7 +179,7 @@ JSValue JSC_HOST_CALL numberProtoFuncToString(ExecState* exec) const char* lastCharInString = s + sizeof(s) - 1; double x = v.uncheckedGetNumber(); if (isnan(x) || isinf(x)) - return jsString(exec, UString::from(x)); + return JSValue::encode(jsString(exec, UString::from(x))); bool isNegative = x < 0.0; if (isNegative) @@ -218,47 +218,47 @@ JSValue JSC_HOST_CALL numberProtoFuncToString(ExecState* exec) *p = '\0'; ASSERT(p < s + sizeof(s)); - return jsString(exec, startOfResultString); + return JSValue::encode(jsString(exec, startOfResultString)); } -JSValue JSC_HOST_CALL numberProtoFuncToLocaleString(ExecState* exec) +EncodedJSValue JSC_HOST_CALL numberProtoFuncToLocaleString(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); // FIXME: Not implemented yet. JSValue v = thisValue.getJSNumber(); if (!v) - return throwError(exec, TypeError); + return throwVMTypeError(exec); - return jsString(exec, v.toString(exec)); + return JSValue::encode(jsString(exec, v.toString(exec))); } -JSValue JSC_HOST_CALL numberProtoFuncValueOf(ExecState* exec) +EncodedJSValue JSC_HOST_CALL numberProtoFuncValueOf(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSValue v = thisValue.getJSNumber(); if (!v) - return throwError(exec, TypeError); + return throwVMTypeError(exec); - return v; + return JSValue::encode(v); } -JSValue JSC_HOST_CALL numberProtoFuncToFixed(ExecState* exec) +EncodedJSValue JSC_HOST_CALL numberProtoFuncToFixed(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSValue v = thisValue.getJSNumber(); if (!v) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSValue fractionDigits = exec->argument(0); double df = fractionDigits.toInteger(exec); if (!(df >= 0 && df <= 20)) - return throwError(exec, RangeError, "toFixed() digits argument must be between 0 and 20"); + return throwVMError(exec, createRangeError(exec, "toFixed() digits argument must be between 0 and 20")); int f = static_cast(df); double x = v.uncheckedGetNumber(); if (isnan(x)) - return jsNontrivialString(exec, "NaN"); + return JSValue::encode(jsNontrivialString(exec, "NaN")); UString s; if (x < 0) { @@ -271,7 +271,7 @@ JSValue JSC_HOST_CALL numberProtoFuncToFixed(ExecState* exec) } if (x >= pow(10.0, 21.0)) - return jsString(exec, makeString(s, UString::from(x))); + return JSValue::encode(jsString(exec, makeString(s, UString::from(x)))); const double tenToTheF = pow(10.0, f); double n = floor(x * tenToTheF); @@ -293,8 +293,8 @@ JSValue JSC_HOST_CALL numberProtoFuncToFixed(ExecState* exec) int kMinusf = k - f; if (kMinusf < static_cast(m.size())) - return jsString(exec, makeString(s, m.substr(0, kMinusf), ".", m.substr(kMinusf))); - return jsString(exec, makeString(s, m.substr(0, kMinusf))); + return JSValue::encode(jsString(exec, makeString(s, m.substr(0, kMinusf), ".", m.substr(kMinusf)))); + return JSValue::encode(jsString(exec, makeString(s, m.substr(0, kMinusf)))); } static void fractionalPartToString(char* buf, int& i, const char* result, int resultLength, int fractionalDigits) @@ -335,22 +335,22 @@ static void exponentialPartToString(char* buf, int& i, int decimalPoint) buf[i++] = static_cast('0' + exponential % 10); } -JSValue JSC_HOST_CALL numberProtoFuncToExponential(ExecState* exec) +EncodedJSValue JSC_HOST_CALL numberProtoFuncToExponential(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSValue v = thisValue.getJSNumber(); if (!v) - return throwError(exec, TypeError); + return throwVMTypeError(exec); double x = v.uncheckedGetNumber(); if (isnan(x) || isinf(x)) - return jsString(exec, UString::from(x)); + return JSValue::encode(jsString(exec, UString::from(x))); JSValue fractionalDigitsValue = exec->argument(0); double df = fractionalDigitsValue.toInteger(exec); if (!(df >= 0 && df <= 20)) - return throwError(exec, RangeError, "toExponential() argument must between 0 and 20"); + return throwVMError(exec, createRangeError(exec, "toExponential() argument must between 0 and 20")); int fractionalDigits = static_cast(df); bool includeAllDigits = fractionalDigitsValue.isUndefined(); @@ -371,7 +371,7 @@ JSValue JSC_HOST_CALL numberProtoFuncToExponential(ExecState* exec) } if (isnan(x)) - return jsNontrivialString(exec, "NaN"); + return JSValue::encode(jsNontrivialString(exec, "NaN")); if (x == -0.0) // (-0.0).toExponential() should print as 0 instead of -0 x = 0; @@ -405,20 +405,20 @@ JSValue JSC_HOST_CALL numberProtoFuncToExponential(ExecState* exec) } ASSERT(i <= 80); - return jsString(exec, buf); + return JSValue::encode(jsString(exec, buf)); } -JSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState* exec) +EncodedJSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSValue v = thisValue.getJSNumber(); if (!v) - return throwError(exec, TypeError); + return throwVMTypeError(exec); double doublePrecision = exec->argument(0).toIntegerPreserveNaN(exec); double x = v.uncheckedGetNumber(); if (exec->argument(0).isUndefined() || isnan(x) || isinf(x)) - return jsString(exec, v.toString(exec)); + return JSValue::encode(jsString(exec, v.toString(exec))); UString s; if (x < 0) { @@ -428,7 +428,7 @@ JSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState* exec) s = ""; if (!(doublePrecision >= 1 && doublePrecision <= 21)) // true for NaN - return throwError(exec, RangeError, "toPrecision() argument must be between 1 and 21"); + return throwVMError(exec, createRangeError(exec, "toPrecision() argument must be between 1 and 21")); int precision = static_cast(doublePrecision); int e = 0; @@ -458,8 +458,8 @@ JSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState* exec) if (m.size() > 1) m = makeString(m.substr(0, 1), ".", m.substr(1)); if (e >= 0) - return jsMakeNontrivialString(exec, s, m, "e+", UString::from(e)); - return jsMakeNontrivialString(exec, s, m, "e-", UString::from(-e)); + return JSValue::encode(jsMakeNontrivialString(exec, s, m, "e+", UString::from(e))); + return JSValue::encode(jsMakeNontrivialString(exec, s, m, "e-", UString::from(-e))); } } else { m = charSequence('0', precision); @@ -467,13 +467,13 @@ JSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState* exec) } if (e == precision - 1) - return jsString(exec, makeString(s, m)); + return JSValue::encode(jsString(exec, makeString(s, m))); if (e >= 0) { if (e + 1 < static_cast(m.size())) - return jsString(exec, makeString(s, m.substr(0, e + 1), ".", m.substr(e + 1))); - return jsString(exec, makeString(s, m)); + return JSValue::encode(jsString(exec, makeString(s, m.substr(0, e + 1), ".", m.substr(e + 1)))); + return JSValue::encode(jsString(exec, makeString(s, m))); } - return jsMakeNontrivialString(exec, s, "0.", charSequence('0', -(e + 1)), m); + return JSValue::encode(jsMakeNontrivialString(exec, s, "0.", charSequence('0', -(e + 1)), m)); } } // namespace JSC diff --git a/JavaScriptCore/runtime/ObjectConstructor.cpp b/JavaScriptCore/runtime/ObjectConstructor.cpp index c373f87..b1f9d70 100644 --- a/JavaScriptCore/runtime/ObjectConstructor.cpp +++ b/JavaScriptCore/runtime/ObjectConstructor.cpp @@ -22,6 +22,7 @@ #include "ObjectConstructor.h" #include "Error.h" +#include "ExceptionHelpers.h" #include "JSFunction.h" #include "JSArray.h" #include "JSGlobalObject.h" @@ -34,13 +35,13 @@ namespace JSC { ASSERT_CLASS_FITS_IN_CELL(ObjectConstructor); -static JSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState*); -static JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState*); -static JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState*); -static JSValue JSC_HOST_CALL objectConstructorKeys(ExecState*); -static JSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState*); -static JSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState*); -static JSValue JSC_HOST_CALL objectConstructorCreate(ExecState*); +static EncodedJSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState*); +static EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState*); +static EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState*); +static EncodedJSValue JSC_HOST_CALL objectConstructorKeys(ExecState*); +static EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState*); +static EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState*); +static EncodedJSValue JSC_HOST_CALL objectConstructorCreate(ExecState*); ObjectConstructor::ObjectConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr structure, ObjectPrototype* objectPrototype, Structure* prototypeFunctionStructure) : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, "Object")) @@ -69,9 +70,10 @@ static ALWAYS_INLINE JSObject* constructObject(ExecState* exec, const ArgList& a return arg.toObject(exec); } -static JSObject* constructWithObjectConstructor(ExecState* exec, JSObject*, const ArgList& args) +static EncodedJSValue JSC_HOST_CALL constructWithObjectConstructor(ExecState* exec) { - return constructObject(exec, args); + ArgList args(exec); + return JSValue::encode(constructObject(exec, args)); } ConstructType ObjectConstructor::getConstructData(ConstructData& constructData) @@ -80,10 +82,10 @@ ConstructType ObjectConstructor::getConstructData(ConstructData& constructData) return ConstructTypeHost; } -static JSValue JSC_HOST_CALL callObjectConstructor(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL callObjectConstructor(ExecState* exec) { ArgList args(exec); - return constructObject(exec, args); + return JSValue::encode(constructObject(exec, args)); } CallType ObjectConstructor::getCallData(CallData& callData) @@ -92,26 +94,26 @@ CallType ObjectConstructor::getCallData(CallData& callData) return CallTypeHost; } -JSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState* exec) +EncodedJSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState* exec) { if (!exec->argument(0).isObject()) - return throwError(exec, TypeError, "Requested prototype of a value that is not an object."); - return asObject(exec->argument(0))->prototype(); + return throwVMError(exec, createTypeError(exec, "Requested prototype of a value that is not an object.")); + return JSValue::encode(asObject(exec->argument(0))->prototype()); } -JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState* exec) +EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState* exec) { if (!exec->argument(0).isObject()) - return throwError(exec, TypeError, "Requested property descriptor of a value that is not an object."); + return throwVMError(exec, createTypeError(exec, "Requested property descriptor of a value that is not an object.")); UString propertyName = exec->argument(1).toString(exec); if (exec->hadException()) - return jsNull(); + return JSValue::encode(jsNull()); JSObject* object = asObject(exec->argument(0)); PropertyDescriptor descriptor; if (!object->getOwnPropertyDescriptor(exec, Identifier(exec, propertyName), descriptor)) - return jsUndefined(); + return JSValue::encode(jsUndefined()); if (exec->hadException()) - return jsUndefined(); + return JSValue::encode(jsUndefined()); JSObject* description = constructEmptyObject(exec); if (!descriptor.isAccessorDescriptor()) { @@ -125,42 +127,42 @@ JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState* exec) description->putDirect(exec->propertyNames().enumerable, jsBoolean(descriptor.enumerable()), 0); description->putDirect(exec->propertyNames().configurable, jsBoolean(descriptor.configurable()), 0); - return description; + return JSValue::encode(description); } // FIXME: Use the enumeration cache. -JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState* exec) +EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState* exec) { if (!exec->argument(0).isObject()) - return throwError(exec, TypeError, "Requested property names of a value that is not an object."); + return throwVMError(exec, createTypeError(exec, "Requested property names of a value that is not an object.")); PropertyNameArray properties(exec); asObject(exec->argument(0))->getOwnPropertyNames(exec, properties, IncludeDontEnumProperties); JSArray* names = constructEmptyArray(exec); size_t numProperties = properties.size(); for (size_t i = 0; i < numProperties; i++) names->push(exec, jsOwnedString(exec, properties[i].ustring())); - return names; + return JSValue::encode(names); } // FIXME: Use the enumeration cache. -JSValue JSC_HOST_CALL objectConstructorKeys(ExecState* exec) +EncodedJSValue JSC_HOST_CALL objectConstructorKeys(ExecState* exec) { if (!exec->argument(0).isObject()) - return throwError(exec, TypeError, "Requested keys of a value that is not an object."); + return throwVMError(exec, createTypeError(exec, "Requested keys of a value that is not an object.")); PropertyNameArray properties(exec); asObject(exec->argument(0))->getOwnPropertyNames(exec, properties); JSArray* keys = constructEmptyArray(exec); size_t numProperties = properties.size(); for (size_t i = 0; i < numProperties; i++) keys->push(exec, jsOwnedString(exec, properties[i].ustring())); - return keys; + return JSValue::encode(keys); } // ES5 8.10.5 ToPropertyDescriptor static bool toPropertyDescriptor(ExecState* exec, JSValue in, PropertyDescriptor& desc) { if (!in.isObject()) { - throwError(exec, TypeError, "Property description must be an object."); + throwError(exec, createTypeError(exec, "Property description must be an object.")); return false; } JSObject* description = asObject(in); @@ -201,8 +203,8 @@ static bool toPropertyDescriptor(ExecState* exec, JSValue in, PropertyDescriptor return false; if (!get.isUndefined()) { CallData callData; - if (get.getCallData(callData) == CallTypeNone) { - throwError(exec, TypeError, "Getter must be a function."); + if (getCallData(get, callData) == CallTypeNone) { + throwError(exec, createTypeError(exec, "Getter must be a function.")); return false; } } else @@ -217,8 +219,8 @@ static bool toPropertyDescriptor(ExecState* exec, JSValue in, PropertyDescriptor return false; if (!set.isUndefined()) { CallData callData; - if (set.getCallData(callData) == CallTypeNone) { - throwError(exec, TypeError, "Setter must be a function."); + if (getCallData(set, callData) == CallTypeNone) { + throwError(exec, createTypeError(exec, "Setter must be a function.")); return false; } } else @@ -231,32 +233,32 @@ static bool toPropertyDescriptor(ExecState* exec, JSValue in, PropertyDescriptor return true; if (desc.value()) { - throwError(exec, TypeError, "Invalid property. 'value' present on property with getter or setter."); + throwError(exec, createTypeError(exec, "Invalid property. 'value' present on property with getter or setter.")); return false; } if (desc.writablePresent()) { - throwError(exec, TypeError, "Invalid property. 'writable' present on property with getter or setter."); + throwError(exec, createTypeError(exec, "Invalid property. 'writable' present on property with getter or setter.")); return false; } return true; } -JSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState* exec) +EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState* exec) { if (!exec->argument(0).isObject()) - return throwError(exec, TypeError, "Properties can only be defined on Objects."); + return throwVMError(exec, createTypeError(exec, "Properties can only be defined on Objects.")); JSObject* O = asObject(exec->argument(0)); UString propertyName = exec->argument(1).toString(exec); if (exec->hadException()) - return jsNull(); + return JSValue::encode(jsNull()); PropertyDescriptor descriptor; if (!toPropertyDescriptor(exec, exec->argument(2), descriptor)) - return jsNull(); + return JSValue::encode(jsNull()); ASSERT((descriptor.attributes() & (Getter | Setter)) || (!descriptor.isAccessorDescriptor())); ASSERT(!exec->hadException()); O->defineOwnProperty(exec, Identifier(exec, propertyName), descriptor, true); - return O; + return JSValue::encode(O); } static JSValue defineProperties(ExecState* exec, JSObject* object, JSObject* properties) @@ -293,26 +295,26 @@ static JSValue defineProperties(ExecState* exec, JSObject* object, JSObject* pro return object; } -JSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState* exec) +EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState* exec) { if (!exec->argument(0).isObject()) - return throwError(exec, TypeError, "Properties can only be defined on Objects."); + return throwVMError(exec, createTypeError(exec, "Properties can only be defined on Objects.")); if (!exec->argument(1).isObject()) - return throwError(exec, TypeError, "Property descriptor list must be an Object."); - return defineProperties(exec, asObject(exec->argument(0)), asObject(exec->argument(1))); + return throwVMError(exec, createTypeError(exec, "Property descriptor list must be an Object.")); + return JSValue::encode(defineProperties(exec, asObject(exec->argument(0)), asObject(exec->argument(1)))); } -JSValue JSC_HOST_CALL objectConstructorCreate(ExecState* exec) +EncodedJSValue JSC_HOST_CALL objectConstructorCreate(ExecState* exec) { if (!exec->argument(0).isObject() && !exec->argument(0).isNull()) - return throwError(exec, TypeError, "Object prototype may only be an Object or null."); + return throwVMError(exec, createTypeError(exec, "Object prototype may only be an Object or null.")); JSObject* newObject = constructEmptyObject(exec); newObject->setPrototype(exec->argument(0)); if (exec->argument(1).isUndefined()) - return newObject; + return JSValue::encode(newObject); if (!exec->argument(1).isObject()) - return throwError(exec, TypeError, "Property descriptor list must be an Object."); - return defineProperties(exec, newObject, asObject(exec->argument(1))); + return throwVMError(exec, createTypeError(exec, "Property descriptor list must be an Object.")); + return JSValue::encode(defineProperties(exec, newObject, asObject(exec->argument(1)))); } } // namespace JSC diff --git a/JavaScriptCore/runtime/ObjectPrototype.cpp b/JavaScriptCore/runtime/ObjectPrototype.cpp index 87212da..6197f75 100644 --- a/JavaScriptCore/runtime/ObjectPrototype.cpp +++ b/JavaScriptCore/runtime/ObjectPrototype.cpp @@ -31,15 +31,15 @@ namespace JSC { ASSERT_CLASS_FITS_IN_CELL(ObjectPrototype); -static JSValue JSC_HOST_CALL objectProtoFuncValueOf(ExecState*); -static JSValue JSC_HOST_CALL objectProtoFuncHasOwnProperty(ExecState*); -static JSValue JSC_HOST_CALL objectProtoFuncIsPrototypeOf(ExecState*); -static JSValue JSC_HOST_CALL objectProtoFuncDefineGetter(ExecState*); -static JSValue JSC_HOST_CALL objectProtoFuncDefineSetter(ExecState*); -static JSValue JSC_HOST_CALL objectProtoFuncLookupGetter(ExecState*); -static JSValue JSC_HOST_CALL objectProtoFuncLookupSetter(ExecState*); -static JSValue JSC_HOST_CALL objectProtoFuncPropertyIsEnumerable(ExecState*); -static JSValue JSC_HOST_CALL objectProtoFuncToLocaleString(ExecState*); +static EncodedJSValue JSC_HOST_CALL objectProtoFuncValueOf(ExecState*); +static EncodedJSValue JSC_HOST_CALL objectProtoFuncHasOwnProperty(ExecState*); +static EncodedJSValue JSC_HOST_CALL objectProtoFuncIsPrototypeOf(ExecState*); +static EncodedJSValue JSC_HOST_CALL objectProtoFuncDefineGetter(ExecState*); +static EncodedJSValue JSC_HOST_CALL objectProtoFuncDefineSetter(ExecState*); +static EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupGetter(ExecState*); +static EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupSetter(ExecState*); +static EncodedJSValue JSC_HOST_CALL objectProtoFuncPropertyIsEnumerable(ExecState*); +static EncodedJSValue JSC_HOST_CALL objectProtoFuncToLocaleString(ExecState*); ObjectPrototype::ObjectPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr stucture, Structure* prototypeFunctionStructure) : JSObject(stucture) @@ -81,85 +81,85 @@ bool ObjectPrototype::getOwnPropertySlot(ExecState* exec, unsigned propertyName, // ECMA 15.2.4.2, 15.2.4.4, 15.2.4.5, 15.2.4.7 -JSValue JSC_HOST_CALL objectProtoFuncValueOf(ExecState* exec) +EncodedJSValue JSC_HOST_CALL objectProtoFuncValueOf(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); - return thisValue.toThisObject(exec); + return JSValue::encode(thisValue.toThisObject(exec)); } -JSValue JSC_HOST_CALL objectProtoFuncHasOwnProperty(ExecState* exec) +EncodedJSValue JSC_HOST_CALL objectProtoFuncHasOwnProperty(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); - return jsBoolean(thisValue.toThisObject(exec)->hasOwnProperty(exec, Identifier(exec, exec->argument(0).toString(exec)))); + return JSValue::encode(jsBoolean(thisValue.toThisObject(exec)->hasOwnProperty(exec, Identifier(exec, exec->argument(0).toString(exec))))); } -JSValue JSC_HOST_CALL objectProtoFuncIsPrototypeOf(ExecState* exec) +EncodedJSValue JSC_HOST_CALL objectProtoFuncIsPrototypeOf(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSObject* thisObj = thisValue.toThisObject(exec); if (!exec->argument(0).isObject()) - return jsBoolean(false); + return JSValue::encode(jsBoolean(false)); JSValue v = asObject(exec->argument(0))->prototype(); while (true) { if (!v.isObject()) - return jsBoolean(false); + return JSValue::encode(jsBoolean(false)); if (v == thisObj) - return jsBoolean(true); + return JSValue::encode(jsBoolean(true)); v = asObject(v)->prototype(); } } -JSValue JSC_HOST_CALL objectProtoFuncDefineGetter(ExecState* exec) +EncodedJSValue JSC_HOST_CALL objectProtoFuncDefineGetter(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); CallData callData; - if (exec->argument(1).getCallData(callData) == CallTypeNone) - return throwError(exec, SyntaxError, "invalid getter usage"); + if (getCallData(exec->argument(1), callData) == CallTypeNone) + return throwVMError(exec, createSyntaxError(exec, "invalid getter usage")); thisValue.toThisObject(exec)->defineGetter(exec, Identifier(exec, exec->argument(0).toString(exec)), asObject(exec->argument(1))); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL objectProtoFuncDefineSetter(ExecState* exec) +EncodedJSValue JSC_HOST_CALL objectProtoFuncDefineSetter(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); CallData callData; - if (exec->argument(1).getCallData(callData) == CallTypeNone) - return throwError(exec, SyntaxError, "invalid setter usage"); + if (getCallData(exec->argument(1), callData) == CallTypeNone) + return throwVMError(exec, createSyntaxError(exec, "invalid setter usage")); thisValue.toThisObject(exec)->defineSetter(exec, Identifier(exec, exec->argument(0).toString(exec)), asObject(exec->argument(1))); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL objectProtoFuncLookupGetter(ExecState* exec) +EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupGetter(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); - return thisValue.toThisObject(exec)->lookupGetter(exec, Identifier(exec, exec->argument(0).toString(exec))); + return JSValue::encode(thisValue.toThisObject(exec)->lookupGetter(exec, Identifier(exec, exec->argument(0).toString(exec)))); } -JSValue JSC_HOST_CALL objectProtoFuncLookupSetter(ExecState* exec) +EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupSetter(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); - return thisValue.toThisObject(exec)->lookupSetter(exec, Identifier(exec, exec->argument(0).toString(exec))); + return JSValue::encode(thisValue.toThisObject(exec)->lookupSetter(exec, Identifier(exec, exec->argument(0).toString(exec)))); } -JSValue JSC_HOST_CALL objectProtoFuncPropertyIsEnumerable(ExecState* exec) +EncodedJSValue JSC_HOST_CALL objectProtoFuncPropertyIsEnumerable(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); - return jsBoolean(thisValue.toThisObject(exec)->propertyIsEnumerable(exec, Identifier(exec, exec->argument(0).toString(exec)))); + return JSValue::encode(jsBoolean(thisValue.toThisObject(exec)->propertyIsEnumerable(exec, Identifier(exec, exec->argument(0).toString(exec))))); } -JSValue JSC_HOST_CALL objectProtoFuncToLocaleString(ExecState* exec) +EncodedJSValue JSC_HOST_CALL objectProtoFuncToLocaleString(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); - return thisValue.toThisJSString(exec); + return JSValue::encode(thisValue.toThisJSString(exec)); } -JSValue JSC_HOST_CALL objectProtoFuncToString(ExecState* exec) +EncodedJSValue JSC_HOST_CALL objectProtoFuncToString(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); - return jsMakeNontrivialString(exec, "[object ", thisValue.toThisObject(exec)->className(), "]"); + return JSValue::encode(jsMakeNontrivialString(exec, "[object ", thisValue.toThisObject(exec)->className(), "]")); } } // namespace JSC diff --git a/JavaScriptCore/runtime/ObjectPrototype.h b/JavaScriptCore/runtime/ObjectPrototype.h index 8865d6b..0382ae4 100644 --- a/JavaScriptCore/runtime/ObjectPrototype.h +++ b/JavaScriptCore/runtime/ObjectPrototype.h @@ -36,7 +36,7 @@ namespace JSC { bool m_hasNoPropertiesWithUInt32Names; }; - JSValue JSC_HOST_CALL objectProtoFuncToString(ExecState*); + EncodedJSValue JSC_HOST_CALL objectProtoFuncToString(ExecState*); } // namespace JSC diff --git a/JavaScriptCore/runtime/RegExpConstructor.cpp b/JavaScriptCore/runtime/RegExpConstructor.cpp index c79d5f8..24476d6 100644 --- a/JavaScriptCore/runtime/RegExpConstructor.cpp +++ b/JavaScriptCore/runtime/RegExpConstructor.cpp @@ -24,6 +24,7 @@ #include "ArrayPrototype.h" #include "Error.h" +#include "ExceptionHelpers.h" #include "JSArray.h" #include "JSFunction.h" #include "JSString.h" @@ -294,7 +295,7 @@ JSObject* constructRegExp(ExecState* exec, const ArgList& args) if (arg0.inherits(&RegExpObject::info)) { if (!arg1.isUndefined()) - return throwError(exec, TypeError, "Cannot supply flags when constructing one RegExp from another."); + return throwError(exec, createTypeError(exec, "Cannot supply flags when constructing one RegExp from another.")); return asObject(arg0); } @@ -303,13 +304,14 @@ JSObject* constructRegExp(ExecState* exec, const ArgList& args) RefPtr regExp = RegExp::create(&exec->globalData(), pattern, flags); if (!regExp->isValid()) - return throwError(exec, SyntaxError, makeString("Invalid regular expression: ", regExp->errorMessage())); + return throwError(exec, createSyntaxError(exec, makeString("Invalid regular expression: ", regExp->errorMessage()))); return new (exec) RegExpObject(exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->regExpStructure(), regExp.release()); } -static JSObject* constructWithRegExpConstructor(ExecState* exec, JSObject*, const ArgList& args) +static EncodedJSValue JSC_HOST_CALL constructWithRegExpConstructor(ExecState* exec) { - return constructRegExp(exec, args); + ArgList args(exec); + return JSValue::encode(constructRegExp(exec, args)); } ConstructType RegExpConstructor::getConstructData(ConstructData& constructData) @@ -319,10 +321,10 @@ ConstructType RegExpConstructor::getConstructData(ConstructData& constructData) } // ECMA 15.10.3 -static JSValue JSC_HOST_CALL callRegExpConstructor(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL callRegExpConstructor(ExecState* exec) { ArgList args(exec); - return constructRegExp(exec, args); + return JSValue::encode(constructRegExp(exec, args)); } CallType RegExpConstructor::getCallData(CallData& callData) diff --git a/JavaScriptCore/runtime/RegExpObject.cpp b/JavaScriptCore/runtime/RegExpObject.cpp index acec966..4824944 100644 --- a/JavaScriptCore/runtime/RegExpObject.cpp +++ b/JavaScriptCore/runtime/RegExpObject.cpp @@ -22,6 +22,7 @@ #include "RegExpObject.h" #include "Error.h" +#include "ExceptionHelpers.h" #include "JSArray.h" #include "JSGlobalObject.h" #include "JSString.h" @@ -125,9 +126,9 @@ JSValue RegExpObject::exec(ExecState* exec) return jsNull(); } -static JSValue JSC_HOST_CALL callRegExpObject(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL callRegExpObject(ExecState* exec) { - return asRegExpObject(exec->callee())->exec(exec); + return JSValue::encode(asRegExpObject(exec->callee())->exec(exec)); } CallType RegExpObject::getCallData(CallData& callData) @@ -143,7 +144,7 @@ bool RegExpObject::match(ExecState* exec) UString input = !exec->argumentCount() ? regExpConstructor->input() : exec->argument(0).toString(exec); if (input.isNull()) { - throwError(exec, GeneralError, makeString("No input to ", toString(exec), ".")); + throwError(exec, createError(exec, makeString("No input to ", toString(exec), "."))); return false; } diff --git a/JavaScriptCore/runtime/RegExpPrototype.cpp b/JavaScriptCore/runtime/RegExpPrototype.cpp index 0a531ac..9d78f59 100644 --- a/JavaScriptCore/runtime/RegExpPrototype.cpp +++ b/JavaScriptCore/runtime/RegExpPrototype.cpp @@ -38,10 +38,10 @@ namespace JSC { ASSERT_CLASS_FITS_IN_CELL(RegExpPrototype); -static JSValue JSC_HOST_CALL regExpProtoFuncTest(ExecState*); -static JSValue JSC_HOST_CALL regExpProtoFuncExec(ExecState*); -static JSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState*); -static JSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState*); +static EncodedJSValue JSC_HOST_CALL regExpProtoFuncTest(ExecState*); +static EncodedJSValue JSC_HOST_CALL regExpProtoFuncExec(ExecState*); +static EncodedJSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState*); +static EncodedJSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState*); // ECMA 15.10.5 @@ -57,28 +57,28 @@ RegExpPrototype::RegExpPrototype(ExecState* exec, JSGlobalObject* globalObject, } // ------------------------------ Functions --------------------------- - -JSValue JSC_HOST_CALL regExpProtoFuncTest(ExecState* exec) + +EncodedJSValue JSC_HOST_CALL regExpProtoFuncTest(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&RegExpObject::info)) - return throwError(exec, TypeError); - return asRegExpObject(thisValue)->test(exec); + return throwVMTypeError(exec); + return JSValue::encode(asRegExpObject(thisValue)->test(exec)); } -JSValue JSC_HOST_CALL regExpProtoFuncExec(ExecState* exec) +EncodedJSValue JSC_HOST_CALL regExpProtoFuncExec(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&RegExpObject::info)) - return throwError(exec, TypeError); - return asRegExpObject(thisValue)->exec(exec); + return throwVMTypeError(exec); + return JSValue::encode(asRegExpObject(thisValue)->exec(exec)); } -JSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState* exec) +EncodedJSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&RegExpObject::info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); RefPtr regExp; JSValue arg0 = exec->argument(0); @@ -86,7 +86,7 @@ JSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState* exec) if (arg0.inherits(&RegExpObject::info)) { if (!arg1.isUndefined()) - return throwError(exec, TypeError, "Cannot supply flags when constructing one RegExp from another."); + return throwVMError(exec, createTypeError(exec, "Cannot supply flags when constructing one RegExp from another.")); regExp = asRegExpObject(arg0)->regExp(); } else { UString pattern = !exec->argumentCount() ? UString("") : arg0.toString(exec); @@ -95,20 +95,20 @@ JSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState* exec) } if (!regExp->isValid()) - return throwError(exec, SyntaxError, makeString("Invalid regular expression: ", regExp->errorMessage())); + return throwVMError(exec, createSyntaxError(exec, makeString("Invalid regular expression: ", regExp->errorMessage()))); asRegExpObject(thisValue)->setRegExp(regExp.release()); asRegExpObject(thisValue)->setLastIndex(0); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState* exec) +EncodedJSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&RegExpObject::info)) { if (thisValue.inherits(&RegExpPrototype::info)) - return jsNontrivialString(exec, "//"); - return throwError(exec, TypeError); + return JSValue::encode(jsNontrivialString(exec, "//")); + return throwVMTypeError(exec); } char postfix[5] = { '/', 0, 0, 0, 0 }; @@ -121,7 +121,7 @@ JSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState* exec) 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 jsMakeNontrivialString(exec, "/", source.size() ? source : UString("(?:)"), postfix); + return JSValue::encode(jsMakeNontrivialString(exec, "/", source.size() ? source : UString("(?:)"), postfix)); } } // namespace JSC diff --git a/JavaScriptCore/runtime/StringConstructor.cpp b/JavaScriptCore/runtime/StringConstructor.cpp index c1484c5..f02ab09 100644 --- a/JavaScriptCore/runtime/StringConstructor.cpp +++ b/JavaScriptCore/runtime/StringConstructor.cpp @@ -40,11 +40,11 @@ static NEVER_INLINE JSValue stringFromCharCodeSlowCase(ExecState* exec) return jsString(exec, impl); } -static JSValue JSC_HOST_CALL stringFromCharCode(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL stringFromCharCode(ExecState* exec) { if (LIKELY(exec->argumentCount() == 1)) - return jsSingleCharacterString(exec, exec->argument(0).toUInt32(exec)); - return stringFromCharCodeSlowCase(exec); + return JSValue::encode(jsSingleCharacterString(exec, exec->argument(0).toUInt32(exec))); + return JSValue::encode(stringFromCharCodeSlowCase(exec)); } ASSERT_CLASS_FITS_IN_CELL(StringConstructor); @@ -66,11 +66,11 @@ StringConstructor::StringConstructor(ExecState* exec, JSGlobalObject* globalObje } // ECMA 15.5.2 -static JSObject* constructWithStringConstructor(ExecState* exec, JSObject*, const ArgList& args) +static EncodedJSValue JSC_HOST_CALL constructWithStringConstructor(ExecState* exec) { - if (args.isEmpty()) - return new (exec) StringObject(exec, exec->lexicalGlobalObject()->stringObjectStructure()); - return new (exec) StringObject(exec, exec->lexicalGlobalObject()->stringObjectStructure(), args.at(0).toString(exec)); + if (!exec->argumentCount()) + return JSValue::encode(new (exec) StringObject(exec, exec->lexicalGlobalObject()->stringObjectStructure())); + return JSValue::encode(new (exec) StringObject(exec, exec->lexicalGlobalObject()->stringObjectStructure(), exec->argument(0).toString(exec))); } ConstructType StringConstructor::getConstructData(ConstructData& constructData) @@ -80,11 +80,11 @@ ConstructType StringConstructor::getConstructData(ConstructData& constructData) } // ECMA 15.5.1 -static JSValue JSC_HOST_CALL callStringConstructor(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL callStringConstructor(ExecState* exec) { if (!exec->argumentCount()) - return jsEmptyString(exec); - return jsString(exec, exec->argument(0).toString(exec)); + return JSValue::encode(jsEmptyString(exec)); + return JSValue::encode(jsString(exec, exec->argument(0).toString(exec))); } CallType StringConstructor::getCallData(CallData& callData) diff --git a/JavaScriptCore/runtime/StringPrototype.cpp b/JavaScriptCore/runtime/StringPrototype.cpp index f90d908..5b90456 100644 --- a/JavaScriptCore/runtime/StringPrototype.cpp +++ b/JavaScriptCore/runtime/StringPrototype.cpp @@ -45,38 +45,38 @@ namespace JSC { ASSERT_CLASS_FITS_IN_CELL(StringPrototype); -static JSValue JSC_HOST_CALL stringProtoFuncToString(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncCharAt(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncCharCodeAt(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncConcat(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncIndexOf(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncLastIndexOf(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncMatch(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncSearch(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncSlice(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncSplit(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncSubstr(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncSubstring(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncToLowerCase(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncToUpperCase(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncLocaleCompare(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncBig(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncSmall(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncBlink(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncBold(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncFixed(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncItalics(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncStrike(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncSub(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncSup(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncFontcolor(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncFontsize(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncAnchor(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncLink(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncTrim(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncTrimLeft(ExecState*); -static JSValue JSC_HOST_CALL stringProtoFuncTrimRight(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncToString(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncCharAt(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncCharCodeAt(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncConcat(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncIndexOf(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncLastIndexOf(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncMatch(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncSearch(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncSlice(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncSplit(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncSubstr(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncSubstring(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncToLowerCase(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncToUpperCase(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncLocaleCompare(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncBig(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncSmall(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncBlink(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncBold(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncFixed(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncItalics(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncStrike(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncSub(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncSup(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncFontcolor(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncFontsize(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncAnchor(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncLink(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncTrim(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncTrimLeft(ExecState*); +static EncodedJSValue JSC_HOST_CALL stringProtoFuncTrimRight(ExecState*); } @@ -286,7 +286,7 @@ static ALWAYS_INLINE JSValue jsSpliceSubstringsWithSeparators(ExecState* exec, J return jsString(exec, impl); } -JSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSString* sourceVal = thisValue.toThisJSString(exec); @@ -295,14 +295,14 @@ JSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec) UString replacementString; CallData callData; - CallType callType = replacement.getCallData(callData); + CallType callType = getCallData(replacement, callData); if (callType == CallTypeNone) replacementString = replacement.toString(exec); if (pattern.inherits(&RegExpObject::info)) { const UString& source = sourceVal->value(exec); if (exec->hadException()) - return JSValue(); + return JSValue::encode(JSValue()); RegExp* reg = asRegExpObject(pattern)->regExp(); bool global = reg->global(); @@ -321,7 +321,7 @@ JSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec) JSFunction* func = asFunction(replacement); CachedCall cachedCall(exec, func, argCount, exec->exceptionSlot()); if (exec->hadException()) - return jsNull(); + return JSValue::encode(jsNull()); while (true) { int matchIndex; int matchLen = 0; @@ -413,25 +413,25 @@ JSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec) } if (!lastIndex && replacements.isEmpty()) - return sourceVal; + return JSValue::encode(sourceVal); if (static_cast(lastIndex) < source.size()) sourceRanges.append(StringRange(lastIndex, source.size() - lastIndex)); - return jsSpliceSubstringsWithSeparators(exec, sourceVal, source, sourceRanges.data(), sourceRanges.size(), replacements.data(), replacements.size()); + return JSValue::encode(jsSpliceSubstringsWithSeparators(exec, sourceVal, source, sourceRanges.data(), sourceRanges.size(), replacements.data(), replacements.size())); } // Not a regular expression, so treat the pattern as a string. UString patternString = pattern.toString(exec); if (patternString.size() == 1 && callType == CallTypeNone) - return sourceVal->replaceCharacter(exec, patternString[0], replacementString); + return JSValue::encode(sourceVal->replaceCharacter(exec, patternString[0], replacementString)); const UString& source = sourceVal->value(exec); unsigned matchPos = source.find(patternString); if (matchPos == UString::NotFound) - return sourceVal; + return JSValue::encode(sourceVal); int matchLen = patternString.size(); if (callType != CallTypeNone) { @@ -445,24 +445,24 @@ JSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec) size_t matchEnd = matchPos + matchLen; int ovector[2] = { matchPos, matchEnd }; - return jsString(exec, source.substr(0, matchPos), substituteBackreferences(replacementString, source, ovector, 0), source.substr(matchEnd)); + return JSValue::encode(jsString(exec, source.substr(0, matchPos), substituteBackreferences(replacementString, source, ovector, 0), source.substr(matchEnd))); } -JSValue JSC_HOST_CALL stringProtoFuncToString(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncToString(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); // Also used for valueOf. if (thisValue.isString()) - return thisValue; + return JSValue::encode(thisValue); if (thisValue.inherits(&StringObject::info)) - return asStringObject(thisValue)->internalValue(); + return JSValue::encode(asStringObject(thisValue)->internalValue()); - return throwError(exec, TypeError); + return throwVMTypeError(exec); } -JSValue JSC_HOST_CALL stringProtoFuncCharAt(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncCharAt(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); UString s = thisValue.toThisString(exec); @@ -471,16 +471,16 @@ JSValue JSC_HOST_CALL stringProtoFuncCharAt(ExecState* exec) if (a0.isUInt32()) { uint32_t i = a0.asUInt32(); if (i < len) - return jsSingleCharacterSubstring(exec, s, i); - return jsEmptyString(exec); + return JSValue::encode(jsSingleCharacterSubstring(exec, s, i)); + return JSValue::encode(jsEmptyString(exec)); } double dpos = a0.toInteger(exec); if (dpos >= 0 && dpos < len) - return jsSingleCharacterSubstring(exec, s, static_cast(dpos)); - return jsEmptyString(exec); + return JSValue::encode(jsSingleCharacterSubstring(exec, s, static_cast(dpos))); + return JSValue::encode(jsEmptyString(exec)); } -JSValue JSC_HOST_CALL stringProtoFuncCharCodeAt(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncCharCodeAt(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); UString s = thisValue.toThisString(exec); @@ -489,29 +489,29 @@ JSValue JSC_HOST_CALL stringProtoFuncCharCodeAt(ExecState* exec) if (a0.isUInt32()) { uint32_t i = a0.asUInt32(); if (i < len) - return jsNumber(exec, s.data()[i]); - return jsNaN(exec); + return JSValue::encode(jsNumber(exec, s.data()[i])); + return JSValue::encode(jsNaN(exec)); } double dpos = a0.toInteger(exec); if (dpos >= 0 && dpos < len) - return jsNumber(exec, s[static_cast(dpos)]); - return jsNaN(exec); + return JSValue::encode(jsNumber(exec, s[static_cast(dpos)])); + return JSValue::encode(jsNaN(exec)); } -JSValue JSC_HOST_CALL stringProtoFuncConcat(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncConcat(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (thisValue.isString() && (exec->argumentCount() == 1)) { JSValue v = exec->argument(0); - return v.isString() + return JSValue::encode(v.isString() ? jsString(exec, asString(thisValue), asString(v)) - : jsString(exec, asString(thisValue), v.toString(exec)); + : jsString(exec, asString(thisValue), v.toString(exec))); } - return jsString(exec, thisValue); + return JSValue::encode(jsString(exec, thisValue)); } -JSValue JSC_HOST_CALL stringProtoFuncIndexOf(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncIndexOf(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); UString s = thisValue.toThisString(exec); @@ -536,11 +536,11 @@ JSValue JSC_HOST_CALL stringProtoFuncIndexOf(ExecState* exec) unsigned result = s.find(u2, pos); if (result == UString::NotFound) - return jsNumber(exec, -1); - return jsNumber(exec, result); + return JSValue::encode(jsNumber(exec, -1)); + return JSValue::encode(jsNumber(exec, result)); } -JSValue JSC_HOST_CALL stringProtoFuncLastIndexOf(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncLastIndexOf(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); UString s = thisValue.toThisString(exec); @@ -563,11 +563,11 @@ JSValue JSC_HOST_CALL stringProtoFuncLastIndexOf(ExecState* exec) unsigned result = s.rfind(u2, static_cast(dpos)); if (result == UString::NotFound) - return jsNumber(exec, -1); - return jsNumber(exec, result); + return JSValue::encode(jsNumber(exec, -1)); + return JSValue::encode(jsNumber(exec, result)); } -JSValue JSC_HOST_CALL stringProtoFuncMatch(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncMatch(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); UString s = thisValue.toThisString(exec); @@ -594,8 +594,8 @@ JSValue JSC_HOST_CALL stringProtoFuncMatch(ExecState* exec) if (!(reg->global())) { // case without 'g' flag is handled like RegExp.prototype.exec if (pos < 0) - return jsNull(); - return regExpConstructor->arrayOfMatches(exec); + return JSValue::encode(jsNull()); + return JSValue::encode(regExpConstructor->arrayOfMatches(exec)); } // return array of matches @@ -613,13 +613,13 @@ JSValue JSC_HOST_CALL stringProtoFuncMatch(ExecState* exec) // if there are no matches at all, it's important to return // Null instead of an empty array, because this matches // other browsers and because Null is a false value. - return jsNull(); + return JSValue::encode(jsNull()); } - return constructArray(exec, list); + return JSValue::encode(constructArray(exec, list)); } -JSValue JSC_HOST_CALL stringProtoFuncSearch(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncSearch(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); UString s = thisValue.toThisString(exec); @@ -642,10 +642,10 @@ JSValue JSC_HOST_CALL stringProtoFuncSearch(ExecState* exec) int pos; int matchLength = 0; regExpConstructor->performMatch(reg.get(), u, 0, pos, matchLength); - return jsNumber(exec, pos); + return JSValue::encode(jsNumber(exec, pos)); } -JSValue JSC_HOST_CALL stringProtoFuncSlice(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncSlice(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); UString s = thisValue.toThisString(exec); @@ -664,13 +664,13 @@ JSValue JSC_HOST_CALL stringProtoFuncSlice(ExecState* exec) from = 0; if (to > len) to = len; - return jsSubstring(exec, s, static_cast(from), static_cast(to) - static_cast(from)); + return JSValue::encode(jsSubstring(exec, s, static_cast(from), static_cast(to) - static_cast(from))); } - return jsEmptyString(exec); + return JSValue::encode(jsEmptyString(exec)); } -JSValue JSC_HOST_CALL stringProtoFuncSplit(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncSplit(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); UString s = thisValue.toThisString(exec); @@ -686,7 +686,7 @@ JSValue JSC_HOST_CALL stringProtoFuncSplit(ExecState* exec) RegExp* reg = asRegExpObject(a0)->regExp(); if (s.isEmpty() && reg->match(s, 0) >= 0) { // empty string matched by regexp -> empty array - return result; + return JSValue::encode(result); } unsigned pos = 0; while (i != limit && pos < s.size()) { @@ -713,7 +713,7 @@ JSValue JSC_HOST_CALL stringProtoFuncSplit(ExecState* exec) if (u2.isEmpty()) { if (s.isEmpty()) { // empty separator matches empty string -> empty array - return result; + return JSValue::encode(result); } while (i != limit && p0 < s.size() - 1) result->put(exec, i++, jsSingleCharacterSubstring(exec, s, p0++)); @@ -731,10 +731,10 @@ JSValue JSC_HOST_CALL stringProtoFuncSplit(ExecState* exec) if (i != limit) result->put(exec, i++, jsSubstring(exec, s, p0, s.size() - p0)); - return result; + return JSValue::encode(result); } -JSValue JSC_HOST_CALL stringProtoFuncSubstr(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncSubstr(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); UString s = thisValue.toThisString(exec); @@ -746,7 +746,7 @@ JSValue JSC_HOST_CALL stringProtoFuncSubstr(ExecState* exec) double start = a0.toInteger(exec); double length = a1.isUndefined() ? len : a1.toInteger(exec); if (start >= len || length <= 0) - return jsEmptyString(exec); + return JSValue::encode(jsEmptyString(exec)); if (start < 0) { start += len; if (start < 0) @@ -754,10 +754,10 @@ JSValue JSC_HOST_CALL stringProtoFuncSubstr(ExecState* exec) } if (start + length > len) length = len - start; - return jsSubstring(exec, s, static_cast(start), static_cast(length)); + return JSValue::encode(jsSubstring(exec, s, static_cast(start), static_cast(length))); } -JSValue JSC_HOST_CALL stringProtoFuncSubstring(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncSubstring(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); UString s = thisValue.toThisString(exec); @@ -786,10 +786,10 @@ JSValue JSC_HOST_CALL stringProtoFuncSubstring(ExecState* exec) end = start; start = temp; } - return jsSubstring(exec, s, static_cast(start), static_cast(end) - static_cast(start)); + return JSValue::encode(jsSubstring(exec, s, static_cast(start), static_cast(end) - static_cast(start))); } -JSValue JSC_HOST_CALL stringProtoFuncToLowerCase(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncToLowerCase(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSString* sVal = thisValue.toThisJSString(exec); @@ -797,7 +797,7 @@ JSValue JSC_HOST_CALL stringProtoFuncToLowerCase(ExecState* exec) int sSize = s.size(); if (!sSize) - return sVal; + return JSValue::encode(sVal); const UChar* sData = s.data(); Vector buffer(sSize); @@ -809,7 +809,7 @@ JSValue JSC_HOST_CALL stringProtoFuncToLowerCase(ExecState* exec) buffer[i] = toASCIILower(c); } if (!(ored & ~0x7f)) - return jsString(exec, UString::adopt(buffer)); + return JSValue::encode(jsString(exec, UString::adopt(buffer))); bool error; int length = Unicode::toLower(buffer.data(), sSize, sData, sSize, &error); @@ -817,17 +817,17 @@ JSValue JSC_HOST_CALL stringProtoFuncToLowerCase(ExecState* exec) buffer.resize(length); length = Unicode::toLower(buffer.data(), length, sData, sSize, &error); if (error) - return sVal; + return JSValue::encode(sVal); } if (length == sSize) { if (memcmp(buffer.data(), sData, length * sizeof(UChar)) == 0) - return sVal; + return JSValue::encode(sVal); } else buffer.resize(length); - return jsString(exec, UString::adopt(buffer)); + return JSValue::encode(jsString(exec, UString::adopt(buffer))); } -JSValue JSC_HOST_CALL stringProtoFuncToUpperCase(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncToUpperCase(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSString* sVal = thisValue.toThisJSString(exec); @@ -835,7 +835,7 @@ JSValue JSC_HOST_CALL stringProtoFuncToUpperCase(ExecState* exec) int sSize = s.size(); if (!sSize) - return sVal; + return JSValue::encode(sVal); const UChar* sData = s.data(); Vector buffer(sSize); @@ -847,7 +847,7 @@ JSValue JSC_HOST_CALL stringProtoFuncToUpperCase(ExecState* exec) buffer[i] = toASCIIUpper(c); } if (!(ored & ~0x7f)) - return jsString(exec, UString::adopt(buffer)); + return JSValue::encode(jsString(exec, UString::adopt(buffer))); bool error; int length = Unicode::toUpper(buffer.data(), sSize, sData, sSize, &error); @@ -855,99 +855,99 @@ JSValue JSC_HOST_CALL stringProtoFuncToUpperCase(ExecState* exec) buffer.resize(length); length = Unicode::toUpper(buffer.data(), length, sData, sSize, &error); if (error) - return sVal; + return JSValue::encode(sVal); } if (length == sSize) { if (memcmp(buffer.data(), sData, length * sizeof(UChar)) == 0) - return sVal; + return JSValue::encode(sVal); } else buffer.resize(length); - return jsString(exec, UString::adopt(buffer)); + return JSValue::encode(jsString(exec, UString::adopt(buffer))); } -JSValue JSC_HOST_CALL stringProtoFuncLocaleCompare(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncLocaleCompare(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (exec->argumentCount() < 1) - return jsNumber(exec, 0); + return JSValue::encode(jsNumber(exec, 0)); UString s = thisValue.toThisString(exec); JSValue a0 = exec->argument(0); - return jsNumber(exec, localeCompare(s, a0.toString(exec))); + return JSValue::encode(jsNumber(exec, localeCompare(s, a0.toString(exec)))); } -JSValue JSC_HOST_CALL stringProtoFuncBig(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncBig(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); UString s = thisValue.toThisString(exec); - return jsMakeNontrivialString(exec, "", s, ""); + return JSValue::encode(jsMakeNontrivialString(exec, "", s, "")); } -JSValue JSC_HOST_CALL stringProtoFuncSmall(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncSmall(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); UString s = thisValue.toThisString(exec); - return jsMakeNontrivialString(exec, "", s, ""); + return JSValue::encode(jsMakeNontrivialString(exec, "", s, "")); } -JSValue JSC_HOST_CALL stringProtoFuncBlink(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncBlink(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); UString s = thisValue.toThisString(exec); - return jsMakeNontrivialString(exec, "", s, ""); + return JSValue::encode(jsMakeNontrivialString(exec, "", s, "")); } -JSValue JSC_HOST_CALL stringProtoFuncBold(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncBold(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); UString s = thisValue.toThisString(exec); - return jsMakeNontrivialString(exec, "", s, ""); + return JSValue::encode(jsMakeNontrivialString(exec, "", s, "")); } -JSValue JSC_HOST_CALL stringProtoFuncFixed(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncFixed(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); UString s = thisValue.toThisString(exec); - return jsMakeNontrivialString(exec, "", s, ""); + return JSValue::encode(jsMakeNontrivialString(exec, "", s, "")); } -JSValue JSC_HOST_CALL stringProtoFuncItalics(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncItalics(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); UString s = thisValue.toThisString(exec); - return jsMakeNontrivialString(exec, "", s, ""); + return JSValue::encode(jsMakeNontrivialString(exec, "", s, "")); } -JSValue JSC_HOST_CALL stringProtoFuncStrike(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncStrike(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); UString s = thisValue.toThisString(exec); - return jsMakeNontrivialString(exec, "", s, ""); + return JSValue::encode(jsMakeNontrivialString(exec, "", s, "")); } -JSValue JSC_HOST_CALL stringProtoFuncSub(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncSub(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); UString s = thisValue.toThisString(exec); - return jsMakeNontrivialString(exec, "", s, ""); + return JSValue::encode(jsMakeNontrivialString(exec, "", s, "")); } -JSValue JSC_HOST_CALL stringProtoFuncSup(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncSup(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); UString s = thisValue.toThisString(exec); - return jsMakeNontrivialString(exec, "", s, ""); + return JSValue::encode(jsMakeNontrivialString(exec, "", s, "")); } -JSValue JSC_HOST_CALL stringProtoFuncFontcolor(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncFontcolor(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); UString s = thisValue.toThisString(exec); JSValue a0 = exec->argument(0); - return jsMakeNontrivialString(exec, "", s, ""); + return JSValue::encode(jsMakeNontrivialString(exec, "", s, "")); } -JSValue JSC_HOST_CALL stringProtoFuncFontsize(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncFontsize(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); UString s = thisValue.toThisString(exec); @@ -960,7 +960,7 @@ JSValue JSC_HOST_CALL stringProtoFuncFontsize(ExecState* exec) UChar* buffer; PassRefPtr impl = UStringImpl::tryCreateUninitialized(bufferSize, buffer); if (!impl) - return jsUndefined(); + return JSValue::encode(jsUndefined()); buffer[0] = '<'; buffer[1] = 'f'; buffer[2] = 'o'; @@ -984,21 +984,21 @@ JSValue JSC_HOST_CALL stringProtoFuncFontsize(ExecState* exec) buffer[19 + stringSize] = 'n'; buffer[20 + stringSize] = 't'; buffer[21 + stringSize] = '>'; - return jsNontrivialString(exec, impl); + return JSValue::encode(jsNontrivialString(exec, impl)); } - return jsMakeNontrivialString(exec, "", s, ""); + return JSValue::encode(jsMakeNontrivialString(exec, "", s, "")); } -JSValue JSC_HOST_CALL stringProtoFuncAnchor(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncAnchor(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); UString s = thisValue.toThisString(exec); JSValue a0 = exec->argument(0); - return jsMakeNontrivialString(exec, "", s, ""); + return JSValue::encode(jsMakeNontrivialString(exec, "", s, "")); } -JSValue JSC_HOST_CALL stringProtoFuncLink(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncLink(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); UString s = thisValue.toThisString(exec); @@ -1011,7 +1011,7 @@ JSValue JSC_HOST_CALL stringProtoFuncLink(ExecState* exec) UChar* buffer; PassRefPtr impl = UStringImpl::tryCreateUninitialized(bufferSize, buffer); if (!impl) - return jsUndefined(); + return JSValue::encode(jsUndefined()); buffer[0] = '<'; buffer[1] = 'a'; buffer[2] = ' '; @@ -1029,7 +1029,7 @@ JSValue JSC_HOST_CALL stringProtoFuncLink(ExecState* exec) buffer[12 + linkTextSize + stringSize] = '/'; buffer[13 + linkTextSize + stringSize] = 'a'; buffer[14 + linkTextSize + stringSize] = '>'; - return jsNontrivialString(exec, impl); + return JSValue::encode(jsNontrivialString(exec, impl)); } enum { @@ -1063,22 +1063,22 @@ static inline JSValue trimString(ExecState* exec, JSValue thisValue, int trimKin return jsString(exec, str.substr(left, right - left)); } -JSValue JSC_HOST_CALL stringProtoFuncTrim(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncTrim(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); - return trimString(exec, thisValue, TrimLeft | TrimRight); + return JSValue::encode(trimString(exec, thisValue, TrimLeft | TrimRight)); } -JSValue JSC_HOST_CALL stringProtoFuncTrimLeft(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncTrimLeft(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); - return trimString(exec, thisValue, TrimLeft); + return JSValue::encode(trimString(exec, thisValue, TrimLeft)); } -JSValue JSC_HOST_CALL stringProtoFuncTrimRight(ExecState* exec) +EncodedJSValue JSC_HOST_CALL stringProtoFuncTrimRight(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); - return trimString(exec, thisValue, TrimRight); + return JSValue::encode(trimString(exec, thisValue, TrimRight)); } diff --git a/JavaScriptCore/wtf/CMakeLists.txt b/JavaScriptCore/wtf/CMakeLists.txt index f4d90ce..db69117 100644 --- a/JavaScriptCore/wtf/CMakeLists.txt +++ b/JavaScriptCore/wtf/CMakeLists.txt @@ -39,3 +39,7 @@ ADD_LIBRARY(${WTF_LIBRARY_NAME} ${WTF_LIBRARY_TYPE} ${WTF_SOURCES}) TARGET_LINK_LIBRARIES(${WTF_LIBRARY_NAME} ${WTF_LIBRARIES}) ADD_TARGET_PROPERTIES(${WTF_LIBRARY_NAME} LINK_FLAGS ${WTF_LINK_FLAGS}) + +IF (SHARED_CORE) + INSTALL(TARGETS ${WTF_LIBRARY_NAME} DESTINATION lib) +ENDIF () diff --git a/JavaScriptCore/wtf/Deque.h b/JavaScriptCore/wtf/Deque.h index 3c3d378..745e0b6 100644 --- a/JavaScriptCore/wtf/Deque.h +++ b/JavaScriptCore/wtf/Deque.h @@ -72,6 +72,7 @@ namespace WTF { T& first() { ASSERT(m_start != m_end); return m_buffer.buffer()[m_start]; } const T& first() const { ASSERT(m_start != m_end); return m_buffer.buffer()[m_start]; } + T takeFirst(); template void append(const U&); template void prepend(const U&); @@ -427,6 +428,14 @@ namespace WTF { checkValidity(); } + template + inline T Deque::takeFirst() + { + T oldFirst = first(); + removeFirst(); + return oldFirst; + } + template template inline void Deque::append(const U& value) { diff --git a/JavaScriptCore/wtf/MainThread.cpp b/JavaScriptCore/wtf/MainThread.cpp index 6178420..a5f2346 100644 --- a/JavaScriptCore/wtf/MainThread.cpp +++ b/JavaScriptCore/wtf/MainThread.cpp @@ -149,8 +149,7 @@ void dispatchFunctionsFromMainThread() MutexLocker locker(mainThreadFunctionQueueMutex()); if (!functionQueue().size()) break; - invocation = functionQueue().first(); - functionQueue().removeFirst(); + invocation = functionQueue().takeFirst(); } invocation.function(invocation.context); diff --git a/JavaScriptCore/wtf/MathExtras.h b/JavaScriptCore/wtf/MathExtras.h index 1f77b61..0222a10 100644 --- a/JavaScriptCore/wtf/MathExtras.h +++ b/JavaScriptCore/wtf/MathExtras.h @@ -190,7 +190,7 @@ 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(WINSCW) && !(COMPILER(RVCT) && OS(SYMBIAN)) +#if !COMPILER(MSVC) && !COMPILER(WINSCW) && !(COMPILER(RVCT) && (OS(SYMBIAN) || PLATFORM(BREWMP))) using std::isfinite; using std::isinf; using std::isnan; diff --git a/JavaScriptCore/wtf/MessageQueue.h b/JavaScriptCore/wtf/MessageQueue.h index 48bd10a..13ce1e8 100644 --- a/JavaScriptCore/wtf/MessageQueue.h +++ b/JavaScriptCore/wtf/MessageQueue.h @@ -163,9 +163,7 @@ namespace WTF { if (m_queue.isEmpty()) return 0; - DataType* message = m_queue.first(); - m_queue.removeFirst(); - return message; + return m_queue.takeFirst(); } template diff --git a/JavaScriptCore/wtf/OwnPtrCommon.h b/JavaScriptCore/wtf/OwnPtrCommon.h index c59fdc5..37c135d 100644 --- a/JavaScriptCore/wtf/OwnPtrCommon.h +++ b/JavaScriptCore/wtf/OwnPtrCommon.h @@ -41,9 +41,11 @@ typedef struct HRGN__* HRGN; #if PLATFORM(BREWMP) // Forward delcarations at this point avoid the need to include BREW includes // in WTF headers. +typedef struct _ISocket ISocket; typedef struct _IFileMgr IFileMgr; typedef struct _IFile IFile; typedef struct IBitmap IBitmap; +typedef struct ISSL ISSL; #endif namespace WTF { @@ -69,6 +71,8 @@ namespace WTF { void deleteOwnedPtr(IFileMgr*); void deleteOwnedPtr(IFile*); void deleteOwnedPtr(IBitmap*); + void deleteOwnedPtr(ISSL*); + void deleteOwnedPtr(ISocket*); #endif } // namespace WTF diff --git a/JavaScriptCore/wtf/Platform.h b/JavaScriptCore/wtf/Platform.h index 4321943..8c125c1 100644 --- a/JavaScriptCore/wtf/Platform.h +++ b/JavaScriptCore/wtf/Platform.h @@ -713,11 +713,11 @@ #define HAVE_SYS_TIME_H 1 #define HAVE_SYS_TIMEB_H 1 -#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) +#if !defined(TARGETING_TIGER) && !defined(TARGETING_LEOPARD) #define HAVE_DISPATCH_H 1 -#if !PLATFORM(IPHONE) && !PLATFORM(QT) +#if !PLATFORM(IPHONE) #define HAVE_MADV_FREE_REUSE 1 #define HAVE_MADV_FREE 1 #define HAVE_PTHREAD_SETNAME_NP 1 @@ -982,15 +982,16 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */ #define ENABLE_JIT_OPTIMIZE_MOD 1 #endif #endif +#if (CPU(X86) && USE(JSVALUE32_64)) || (CPU(X86_64) && USE(JSVALUE64)) +#define ENABLE_JIT_OPTIMIZE_NATIVE_CALL 1 +#endif #if ENABLE(JIT) #ifndef ENABLE_JIT_OPTIMIZE_CALL #define ENABLE_JIT_OPTIMIZE_CALL 1 #endif #ifndef ENABLE_JIT_OPTIMIZE_NATIVE_CALL -#if PLATFORM(MAC) -#define ENABLE_JIT_OPTIMIZE_NATIVE_CALL 1 -#endif +#define ENABLE_JIT_OPTIMIZE_NATIVE_CALL 0 #endif #ifndef ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS #define ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS 1 @@ -1046,17 +1047,13 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */ #define ENABLE_PAN_SCROLLING 1 #endif -/* Use the QXmlStreamReader implementation for XMLTokenizer */ +/* Use the QXmlStreamReader implementation for XMLDocumentParser */ /* Use the QXmlQuery implementation for XSLTProcessor */ #if PLATFORM(QT) #define WTF_USE_QXMLSTREAM 1 #define WTF_USE_QXMLQUERY 1 #endif -#if !PLATFORM(QT) -#define WTF_USE_FONT_FAST_PATH 1 -#endif - /* Accelerated compositing */ #if PLATFORM(MAC) #if !defined(BUILDING_ON_TIGER) diff --git a/JavaScriptCore/wtf/RandomNumber.cpp b/JavaScriptCore/wtf/RandomNumber.cpp index fc48263..b20652b 100644 --- a/JavaScriptCore/wtf/RandomNumber.cpp +++ b/JavaScriptCore/wtf/RandomNumber.cpp @@ -48,20 +48,6 @@ extern "C" { namespace WTF { -double weakRandomNumber() -{ -#if COMPILER(MSVC) && defined(_CRT_RAND_S) - // rand_s is incredibly slow on windows so we fall back on rand for Math.random - return (rand() + (rand() / (RAND_MAX + 1.0))) / (RAND_MAX + 1.0); -#elif PLATFORM(BREWMP) - uint32_t bits; - GETRAND(reinterpret_cast(&bits), sizeof(uint32_t)); - return static_cast(bits) / (static_cast(std::numeric_limits::max()) + 1.0); -#else - return randomNumber(); -#endif -} - double randomNumber() { #if !ENABLE(JSC_MULTIPLE_THREADS) diff --git a/JavaScriptCore/wtf/RandomNumber.h b/JavaScriptCore/wtf/RandomNumber.h index e54e9ae..f2e7e8f 100644 --- a/JavaScriptCore/wtf/RandomNumber.h +++ b/JavaScriptCore/wtf/RandomNumber.h @@ -32,14 +32,8 @@ namespace WTF { // cryptographically secure if possible on the target platform double randomNumber(); - // Returns a pseudo-random number in the range [0, 1), attempts to - // produce a reasonable "random" number fast. - // We only need this because rand_s is so slow on windows. - double weakRandomNumber(); - } using WTF::randomNumber; -using WTF::weakRandomNumber; #endif diff --git a/JavaScriptCore/wtf/ThreadingPthreads.cpp b/JavaScriptCore/wtf/ThreadingPthreads.cpp index 7ff9266..d01cc4a 100644 --- a/JavaScriptCore/wtf/ThreadingPthreads.cpp +++ b/JavaScriptCore/wtf/ThreadingPthreads.cpp @@ -235,7 +235,21 @@ ThreadIdentifier currentThread() Mutex::Mutex() { - pthread_mutex_init(&m_mutex, NULL); +#if PTHREAD_MUTEX_NORMAL == PTHREAD_MUTEX_DEFAULT + + pthread_mutex_init(&m_mutex, 0); + +#else + + pthread_mutexattr_t attr; + pthread_mutexattr_init(&attr); + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL); + + pthread_mutex_init(&m_mutex, &attr); + + pthread_mutexattr_destroy(&attr); + +#endif } Mutex::~Mutex() diff --git a/JavaScriptCore/wtf/Vector.h b/JavaScriptCore/wtf/Vector.h index 4d9ea61..b653001 100644 --- a/JavaScriptCore/wtf/Vector.h +++ b/JavaScriptCore/wtf/Vector.h @@ -699,13 +699,17 @@ namespace WTF { return *this; } + inline bool typelessPointersAreEqual(const void* a, const void* b) { return a == b; } + template template Vector& Vector::operator=(const Vector& other) { - if (&other == this) - return *this; - + // If the inline capacities match, we should call the more specific + // template. If the inline capacities don't match, the two objects + // shouldn't be allocated the same address. + ASSERT(!typelessPointersAreEqual(&other, this)); + if (size() > other.size()) shrink(other.size()); else if (other.size() > capacity()) { diff --git a/JavaScriptCore/wtf/brew/OwnPtrBrew.cpp b/JavaScriptCore/wtf/brew/OwnPtrBrew.cpp index c8384e1..28046bd 100644 --- a/JavaScriptCore/wtf/brew/OwnPtrBrew.cpp +++ b/JavaScriptCore/wtf/brew/OwnPtrBrew.cpp @@ -28,6 +28,8 @@ #include #include +#include +#include #include namespace WTF { @@ -50,4 +52,16 @@ void deleteOwnedPtr(IBitmap* ptr) IBitmap_Release(ptr); } +void deleteOwnedPtr(ISSL* ptr) +{ + if (ptr) + ISSL_Release(ptr); +} + +void deleteOwnedPtr(ISocket* ptr) +{ + if (ptr) + ISOCKET_Release(ptr); +} + } diff --git a/JavaScriptCore/wtf/gtk/ThreadingGtk.cpp b/JavaScriptCore/wtf/gtk/ThreadingGtk.cpp index 0c5cf0c..981eacb 100644 --- a/JavaScriptCore/wtf/gtk/ThreadingGtk.cpp +++ b/JavaScriptCore/wtf/gtk/ThreadingGtk.cpp @@ -36,17 +36,20 @@ #include "HashMap.h" #include "MainThread.h" #include "RandomNumberSeed.h" +#include #include #include namespace WTF { +typedef HashMap ThreadMap; + static Mutex* atomicallyInitializedStaticMutex; static Mutex& threadMapMutex() { - static Mutex mutex; + DEFINE_STATIC_LOCAL(Mutex, mutex, ()); return mutex; } @@ -74,9 +77,9 @@ void unlockAtomicallyInitializedStaticMutex() atomicallyInitializedStaticMutex->unlock(); } -static HashMap& threadMap() +static ThreadMap& threadMap() { - static HashMap map; + DEFINE_STATIC_LOCAL(ThreadMap, map, ()); return map; } @@ -84,7 +87,7 @@ static ThreadIdentifier identifierByGthreadHandle(GThread*& thread) { MutexLocker locker(threadMapMutex()); - HashMap::iterator i = threadMap().begin(); + ThreadMap::iterator i = threadMap().begin(); for (; i != threadMap().end(); ++i) { if (i->second == thread) return i->first; diff --git a/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h b/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h index 97c42b7..aa203a2 100644 --- a/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h +++ b/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h @@ -73,6 +73,7 @@ typedef uint32_t UChar32; #define U16_LEAD(supplementary) (UChar)(((supplementary)>>10)+0xd7c0) #define U16_TRAIL(supplementary) (UChar)(((supplementary)&0x3ff)|0xdc00) +#define U16_LENGTH(c) ((uint32_t)(c) <= 0xffff ? 1 : 2) #define U_IS_SURROGATE(c) (((c)&0xfffff800)==0xd800) #define U16_IS_SINGLE(c) !U_IS_SURROGATE(c) diff --git a/JavaScriptCore/wtf/unicode/wince/UnicodeWince.h b/JavaScriptCore/wtf/unicode/wince/UnicodeWince.h index db656ec..5bed9e8 100644 --- a/JavaScriptCore/wtf/unicode/wince/UnicodeWince.h +++ b/JavaScriptCore/wtf/unicode/wince/UnicodeWince.h @@ -38,6 +38,7 @@ #define U16_LEAD(supplementary) (UChar)(((supplementary) >> 10) + 0xd7c0) #define U16_TRAIL(supplementary) (UChar)(((supplementary) & 0x3ff) | 0xdc00) +#define U16_LENGTH(c) ((uint32_t)(c) <= 0xffff ? 1 : 2) #define U_IS_SURROGATE(c) (((c) & 0xfffff800) == 0xd800) #define U16_IS_SURROGATE(c) U_IS_SURROGATE(c) diff --git a/JavaScriptGlue/ChangeLog b/JavaScriptGlue/ChangeLog index 353d9b0..a1f0d48 100644 --- a/JavaScriptGlue/ChangeLog +++ b/JavaScriptGlue/ChangeLog @@ -1,3 +1,13 @@ +2010-06-02 Gavin Barraclough + + Reviewed by Oliver Hunt. + + Bug 40094 - The return type of NativeFunction should be EncodedJSValue + On Windows & Linux, using JSVALUE32_64, EncodedJSValue is returned in registers, but JSValue is not. + + * JSObject.cpp: + (nativeCallFunction): + 2010-05-28 Geoffrey Garen Reviewed by Sam Weinig, Gavin Barraclough, Oliver Hunt. diff --git a/JavaScriptGlue/JSObject.cpp b/JavaScriptGlue/JSObject.cpp index e1d1b15..d7305cb 100644 --- a/JavaScriptGlue/JSObject.cpp +++ b/JavaScriptGlue/JSObject.cpp @@ -73,10 +73,10 @@ void JSUserObject::SetProperty(CFStringRef propertyName, JSUserObject* value) } -static JSValue JSC_HOST_CALL nativeCallFunction(ExecState* exec); -static JSValue nativeCallFunction(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL nativeCallFunction(ExecState* exec); +static EncodedJSValue nativeCallFunction(ExecState* exec) { - return static_cast(exec->callee())->callAsFunction(exec); + return JSValue::encode(static_cast(exec->callee())->callAsFunction(exec)); } CallType JSUserObject::getCallData(CallData& callData) diff --git a/LayoutTests/fast/dom/Geolocation/argument-types-expected.txt b/LayoutTests/fast/dom/Geolocation/argument-types-expected.txt index 0c80a85..23ea685 100644 --- a/LayoutTests/fast/dom/Geolocation/argument-types-expected.txt +++ b/LayoutTests/fast/dom/Geolocation/argument-types-expected.txt @@ -9,7 +9,6 @@ PASS navigator.geolocation.getCurrentPosition(null) threw exception Error: TYPE_ PASS navigator.geolocation.getCurrentPosition({}) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS navigator.geolocation.getCurrentPosition(objectThrowingException) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS navigator.geolocation.getCurrentPosition(emptyFunction) did not throw exception. -PASS navigator.geolocation.getCurrentPosition(Math.abs) did not throw exception. PASS navigator.geolocation.getCurrentPosition(true) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS navigator.geolocation.getCurrentPosition(42) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS navigator.geolocation.getCurrentPosition(Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. @@ -20,7 +19,6 @@ PASS navigator.geolocation.getCurrentPosition(emptyFunction, null) did not throw PASS navigator.geolocation.getCurrentPosition(emptyFunction, {}) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS navigator.geolocation.getCurrentPosition(emptyFunction, objectThrowingException) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS navigator.geolocation.getCurrentPosition(emptyFunction, emptyFunction) did not throw exception. -PASS navigator.geolocation.getCurrentPosition(emptyFunction, Math.abs) did not throw exception. PASS navigator.geolocation.getCurrentPosition(emptyFunction, true) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS navigator.geolocation.getCurrentPosition(emptyFunction, 42) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS navigator.geolocation.getCurrentPosition(emptyFunction, Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. diff --git a/LayoutTests/fast/dom/Geolocation/callback-exception-expected.txt b/LayoutTests/fast/dom/Geolocation/callback-exception-expected.txt index 17ab503..ecf5084 100644 --- a/LayoutTests/fast/dom/Geolocation/callback-exception-expected.txt +++ b/LayoutTests/fast/dom/Geolocation/callback-exception-expected.txt @@ -1,4 +1,4 @@ -CONSOLE MESSAGE: line 22: Error: Exception in success callback +CONSOLE MESSAGE: line 25: Error: Exception in success callback Tests that when an exception is thrown in the success callback, the error callback is not invoked. Note that this test throws an exception which is not caught. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". diff --git a/LayoutTests/fast/dom/Geolocation/callback-to-deleted-context-expected.txt b/LayoutTests/fast/dom/Geolocation/callback-to-deleted-context-expected.txt new file mode 100644 index 0000000..1b0a1b1 --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/callback-to-deleted-context-expected.txt @@ -0,0 +1,11 @@ +frame "-->" - has 1 onunload handler(s) +Tests that when a Geolocation request is made from a remote frame, and that frame's script context goes away before the Geolocation callback is made, the callback is not made. If the callback is attempted, a crash will occur. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS No callbacks invoked +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/Geolocation/callback-to-deleted-context.html b/LayoutTests/fast/dom/Geolocation/callback-to-deleted-context.html new file mode 100644 index 0000000..b9df281 --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/callback-to-deleted-context.html @@ -0,0 +1,13 @@ + + + + + + + +

+
+ + + + diff --git a/LayoutTests/fast/dom/Geolocation/callback-to-remote-context-expected.txt b/LayoutTests/fast/dom/Geolocation/callback-to-remote-context-expected.txt new file mode 100644 index 0000000..1660ca6 --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/callback-to-remote-context-expected.txt @@ -0,0 +1,10 @@ +Tests that when a Geolocation request is made from a remote frame, callbacks are made as usual. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS Success callback invoked +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/Geolocation/callback-to-remote-context.html b/LayoutTests/fast/dom/Geolocation/callback-to-remote-context.html new file mode 100644 index 0000000..131fca3 --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/callback-to-remote-context.html @@ -0,0 +1,13 @@ + + + + + + + +

+
+ + + + diff --git a/LayoutTests/fast/dom/Geolocation/callback-to-remote-context2-expected.txt b/LayoutTests/fast/dom/Geolocation/callback-to-remote-context2-expected.txt new file mode 100644 index 0000000..55d5b08 --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/callback-to-remote-context2-expected.txt @@ -0,0 +1,10 @@ +Tests that when a Geolocation request is made from a remote frame, and the JavaScript call chain starts from that remote frame, callbacks are made as usual. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS Success callback invoked +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/Geolocation/callback-to-remote-context2.html b/LayoutTests/fast/dom/Geolocation/callback-to-remote-context2.html new file mode 100644 index 0000000..f17f2e2 --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/callback-to-remote-context2.html @@ -0,0 +1,13 @@ + + + + + + + +

+
+ + + + diff --git a/LayoutTests/fast/dom/Geolocation/multiple-requests-expected.txt b/LayoutTests/fast/dom/Geolocation/multiple-requests-expected.txt new file mode 100644 index 0000000..6ed5dc4 --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/multiple-requests-expected.txt @@ -0,0 +1,17 @@ +Tests that Geolocation correctly handles multiple concurrent requests. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS oneShotCallbackInvoked is false +PASS position.coords.latitude is mockLatitude +PASS position.coords.longitude is mockLongitude +PASS position.coords.accuracy is mockAccuracy +PASS watchCallbackInvoked is false +PASS position.coords.latitude is mockLatitude +PASS position.coords.longitude is mockLongitude +PASS position.coords.accuracy is mockAccuracy +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/Geolocation/multiple-requests.html b/LayoutTests/fast/dom/Geolocation/multiple-requests.html new file mode 100644 index 0000000..fc47617 --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/multiple-requests.html @@ -0,0 +1,13 @@ + + + + + + + +

+
+ + + + diff --git a/LayoutTests/fast/dom/Geolocation/reentrant-permission-denied-expected.txt b/LayoutTests/fast/dom/Geolocation/reentrant-permission-denied-expected.txt new file mode 100644 index 0000000..8bf9590 --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/reentrant-permission-denied-expected.txt @@ -0,0 +1,13 @@ +Tests that reentrant calls to Geolocation methods from the error callback due to a PERMISSION_DENIED error are OK. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS error.code is error.PERMISSION_DENIED +PASS error.message is "User denied Geolocation" +PASS error.code is error.PERMISSION_DENIED +PASS error.message is "User denied Geolocation" +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/Geolocation/reentrant-permission-denied.html b/LayoutTests/fast/dom/Geolocation/reentrant-permission-denied.html new file mode 100644 index 0000000..1b7a968 --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/reentrant-permission-denied.html @@ -0,0 +1,13 @@ + + + + + + + +

+
+ + + + diff --git a/LayoutTests/fast/dom/Geolocation/resources/callback-to-deleted-context-inner1.html b/LayoutTests/fast/dom/Geolocation/resources/callback-to-deleted-context-inner1.html new file mode 100644 index 0000000..a5ca5e0 --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/resources/callback-to-deleted-context-inner1.html @@ -0,0 +1,28 @@ + + + + + + +

This frame should be replaced before the test ends

+ + diff --git a/LayoutTests/fast/dom/Geolocation/resources/callback-to-deleted-context-inner2.html b/LayoutTests/fast/dom/Geolocation/resources/callback-to-deleted-context-inner2.html new file mode 100644 index 0000000..05d14af --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/resources/callback-to-deleted-context-inner2.html @@ -0,0 +1,7 @@ + + + + + + + diff --git a/LayoutTests/fast/dom/Geolocation/resources/callback-to-remote-context-inner.html b/LayoutTests/fast/dom/Geolocation/resources/callback-to-remote-context-inner.html new file mode 100644 index 0000000..0547943 --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/resources/callback-to-remote-context-inner.html @@ -0,0 +1,16 @@ + + + + + + + + diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/argument-types.js b/LayoutTests/fast/dom/Geolocation/script-tests/argument-types.js index 2b559d8..01c77f5 100644 --- a/LayoutTests/fast/dom/Geolocation/script-tests/argument-types.js +++ b/LayoutTests/fast/dom/Geolocation/script-tests/argument-types.js @@ -40,7 +40,7 @@ test('navigator.geolocation.getCurrentPosition(null)', true); test('navigator.geolocation.getCurrentPosition({})', true); test('navigator.geolocation.getCurrentPosition(objectThrowingException)', true); test('navigator.geolocation.getCurrentPosition(emptyFunction)', false); -test('navigator.geolocation.getCurrentPosition(Math.abs)', false); +//test('navigator.geolocation.getCurrentPosition(Math.abs)', false); test('navigator.geolocation.getCurrentPosition(true)', true); test('navigator.geolocation.getCurrentPosition(42)', true); test('navigator.geolocation.getCurrentPosition(Infinity)', true); @@ -52,7 +52,7 @@ test('navigator.geolocation.getCurrentPosition(emptyFunction, null)', false); test('navigator.geolocation.getCurrentPosition(emptyFunction, {})', true); test('navigator.geolocation.getCurrentPosition(emptyFunction, objectThrowingException)', true); test('navigator.geolocation.getCurrentPosition(emptyFunction, emptyFunction)', false); -test('navigator.geolocation.getCurrentPosition(emptyFunction, Math.abs)', false); +//test('navigator.geolocation.getCurrentPosition(emptyFunction, Math.abs)', false); test('navigator.geolocation.getCurrentPosition(emptyFunction, true)', true); test('navigator.geolocation.getCurrentPosition(emptyFunction, 42)', true); test('navigator.geolocation.getCurrentPosition(emptyFunction, Infinity)', true); diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/callback-exception.js b/LayoutTests/fast/dom/Geolocation/script-tests/callback-exception.js index 7a86648..3a092b1 100644 --- a/LayoutTests/fast/dom/Geolocation/script-tests/callback-exception.js +++ b/LayoutTests/fast/dom/Geolocation/script-tests/callback-exception.js @@ -4,14 +4,17 @@ var mockLatitude = 51.478; var mockLongitude = -0.166; var mockAccuracy = 100; -window.layoutTestController.setGeolocationPermission(true); -window.layoutTestController.setMockGeolocationPosition(mockLatitude, - mockLongitude, - mockAccuracy); +if (window.layoutTestController) { + layoutTestController.setGeolocationPermission(true); + layoutTestController.setMockGeolocationPosition(mockLatitude, + mockLongitude, + mockAccuracy); +} else + debug('This test can not be run without the LayoutTestController'); var position; navigator.geolocation.getCurrentPosition(function(p) { - position = p + position = p; shouldBe('position.coords.latitude', 'mockLatitude'); shouldBe('position.coords.longitude', 'mockLongitude'); shouldBe('position.coords.accuracy', 'mockAccuracy'); @@ -25,7 +28,5 @@ navigator.geolocation.getCurrentPosition(function(p) { finishJSTest(); }); -window.layoutTestController.waitUntilDone(); - window.jsTestIsAsync = true; window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/callback-to-deleted-context.js b/LayoutTests/fast/dom/Geolocation/script-tests/callback-to-deleted-context.js new file mode 100644 index 0000000..6494995 --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/script-tests/callback-to-deleted-context.js @@ -0,0 +1,20 @@ +description("Tests that when a Geolocation request is made from a remote frame, and that frame's script context goes away before the Geolocation callback is made, the callback is not made. If the callback is attempted, a crash will occur."); + +function onFirstIframeLoaded() { + iframe.src = 'resources/callback-to-deleted-context-inner2.html'; +} + +function onSecondIframeLoaded() { + // Wait for the callbacks to be invoked + window.setTimeout(function() { + testPassed('No callbacks invoked'); + finishJSTest(); + }, 100); +} + +var iframe = document.createElement('iframe'); +iframe.src = 'resources/callback-to-deleted-context-inner1.html'; +document.body.appendChild(iframe); + +window.jsTestIsAsync = true; +window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/callback-to-remote-context.js b/LayoutTests/fast/dom/Geolocation/script-tests/callback-to-remote-context.js new file mode 100644 index 0000000..70acab7 --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/script-tests/callback-to-remote-context.js @@ -0,0 +1,19 @@ +description("Tests that when a Geolocation request is made from a remote frame, callbacks are made as usual."); + +function onIframeReady() { + // Make request from remote frame + iframe.contentWindow.navigator.geolocation.getCurrentPosition(function() { + testPassed('Success callback invoked'); + finishJSTest(); + }, function() { + testFailed('Error callback invoked unexpectedly'); + finishJSTest(); + }); +} + +var iframe = document.createElement('iframe'); +iframe.src = 'resources/callback-to-remote-context-inner.html'; +document.body.appendChild(iframe); + +window.jsTestIsAsync = true; +window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/callback-to-remote-context2.js b/LayoutTests/fast/dom/Geolocation/script-tests/callback-to-remote-context2.js new file mode 100644 index 0000000..115b4ed --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/script-tests/callback-to-remote-context2.js @@ -0,0 +1,21 @@ +description("Tests that when a Geolocation request is made from a remote frame, and the JavaScript call chain starts from that remote frame, callbacks are made as usual."); + +function onIframeReady() { + // Make request from remote frame, with call chain starting here + window.setTimeout(function() { + iframe.contentWindow.navigator.geolocation.getCurrentPosition(function() { + testPassed('Success callback invoked'); + finishJSTest(); + }, function() { + testFailed('Error callback invoked unexpectedly'); + finishJSTest(); + }); + }, 0); +} + +var iframe = document.createElement('iframe'); +iframe.src = 'resources/callback-to-remote-context-inner.html'; +document.body.appendChild(iframe); + +window.jsTestIsAsync = true; +window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/error.js b/LayoutTests/fast/dom/Geolocation/script-tests/error.js index 4c818ca..6c9570e 100644 --- a/LayoutTests/fast/dom/Geolocation/script-tests/error.js +++ b/LayoutTests/fast/dom/Geolocation/script-tests/error.js @@ -1,16 +1,20 @@ description("Tests Geolocation error callback using the mock service."); -var mockCode = 0; +var mockCode = 2; var mockMessage = "debug"; -window.layoutTestController.setMockGeolocationError(mockCode, mockMessage); +if (window.layoutTestController) { + layoutTestController.setGeolocationPermission(true); + layoutTestController.setMockGeolocationError(mockCode, mockMessage); +} else + debug('This test can not be run without the LayoutTestController'); var error; navigator.geolocation.getCurrentPosition(function(p) { testFailed('Success callback invoked unexpectedly'); finishJSTest(); }, function(e) { - error = e + error = e; shouldBe('error.code', 'mockCode'); shouldBe('error.message', 'mockMessage'); shouldBe('error.UNKNOWN_ERROR', 'undefined'); @@ -19,7 +23,6 @@ navigator.geolocation.getCurrentPosition(function(p) { shouldBe('error.TIMEOUT', '3'); finishJSTest(); }); -window.layoutTestController.waitUntilDone(); window.jsTestIsAsync = true; window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/maximum-age.js b/LayoutTests/fast/dom/Geolocation/script-tests/maximum-age.js index 207fb64..f3d8f5f 100644 --- a/LayoutTests/fast/dom/Geolocation/script-tests/maximum-age.js +++ b/LayoutTests/fast/dom/Geolocation/script-tests/maximum-age.js @@ -4,7 +4,7 @@ var mockLatitude = 51.478; var mockLongitude = -0.166; var mockAccuracy = 100.0; -var mockCode = 1; +var mockCode = 2; var mockMessage = 'test'; var position; @@ -25,8 +25,11 @@ function checkError(e) { shouldBe('error.message', 'mockMessage'); } -window.layoutTestController.setGeolocationPermission(true); -window.layoutTestController.setMockGeolocationPosition(mockLatitude, mockLongitude, mockAccuracy); +if (window.layoutTestController) { + layoutTestController.setGeolocationPermission(true); + layoutTestController.setMockGeolocationPosition(mockLatitude, mockLongitude, mockAccuracy); +} else + debug('This test can not be run without the LayoutTestController'); // Initialize the cached Position navigator.geolocation.getCurrentPosition(function(p) { @@ -39,7 +42,8 @@ navigator.geolocation.getCurrentPosition(function(p) { function testZeroMaximumAge() { // Update the position provided by the mock service. - window.layoutTestController.setMockGeolocationPosition(++mockLatitude, ++mockLongitude, ++mockAccuracy); + if (window.layoutTestController) + layoutTestController.setMockGeolocationPosition(++mockLatitude, ++mockLongitude, ++mockAccuracy); // The default maximumAge is zero, so we expect the updated position from the service. navigator.geolocation.getCurrentPosition(function(p) { checkPosition(p); @@ -52,7 +56,8 @@ function testZeroMaximumAge() { function testNonZeroMaximumAge() { // Update the mock service to report an error. - window.layoutTestController.setMockGeolocationError(mockCode, mockMessage); + if (window.layoutTestController) + layoutTestController.setMockGeolocationError(mockCode, mockMessage); // The maximumAge is non-zero, so we expect the cached position, not the error from the service. navigator.geolocation.getCurrentPosition(function(p) { checkPosition(p); @@ -74,7 +79,5 @@ function testZeroMaximumAgeError() { }); } -window.layoutTestController.waitUntilDone(); - window.jsTestIsAsync = true; window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/multiple-requests.js b/LayoutTests/fast/dom/Geolocation/script-tests/multiple-requests.js new file mode 100644 index 0000000..4115a97 --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/script-tests/multiple-requests.js @@ -0,0 +1,47 @@ +description("Tests that Geolocation correctly handles multiple concurrent requests."); + +var mockLatitude = 51.478; +var mockLongitude = -0.166; +var mockAccuracy = 100; + +if (window.layoutTestController) { + layoutTestController.setGeolocationPermission(true); + layoutTestController.setMockGeolocationPosition(mockLatitude, + mockLongitude, + mockAccuracy); +} else + debug('This test can not be run without the LayoutTestController'); + +var watchCallbackInvoked = false; +var oneShotCallbackInvoked = false; + +navigator.geolocation.watchPosition(function(p) { + shouldBeFalse('watchCallbackInvoked'); + watchCallbackInvoked = true; + maybeFinishTest(p); +}, function() { + testFailed('Error callback invoked unexpectedly'); + finishJSTest(); +}); + +navigator.geolocation.getCurrentPosition(function(p) { + shouldBeFalse('oneShotCallbackInvoked'); + oneShotCallbackInvoked = true; + maybeFinishTest(p); +}, function() { + testFailed('Error callback invoked unexpectedly'); + finishJSTest(); +}); + +var position; +function maybeFinishTest(p) { + position = p; + shouldBe('position.coords.latitude', 'mockLatitude'); + shouldBe('position.coords.longitude', 'mockLongitude'); + shouldBe('position.coords.accuracy', 'mockAccuracy'); + if (watchCallbackInvoked && oneShotCallbackInvoked) + finishJSTest(); +} + +window.jsTestIsAsync = true; +window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/notimer-after-unload.js b/LayoutTests/fast/dom/Geolocation/script-tests/notimer-after-unload.js index 278e027..4f789f6 100644 --- a/LayoutTests/fast/dom/Geolocation/script-tests/notimer-after-unload.js +++ b/LayoutTests/fast/dom/Geolocation/script-tests/notimer-after-unload.js @@ -17,5 +17,3 @@ document.body.onunload = function() { window.jsTestIsAsync = true; window.successfullyParsed = true; - -if (window.layoutTestController) layoutTestController.waitUntilDone(); diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-clear-watch.js b/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-clear-watch.js index 410f042..8e8b4cc 100644 --- a/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-clear-watch.js +++ b/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-clear-watch.js @@ -1,15 +1,18 @@ description("Tests that when Geolocation permission has been denied prior to a call to watchPosition, and the watch is cleared in the error callback, there is no crash. This a regression test for https://bugs.webkit.org/show_bug.cgi?id=32111."); // Prime the Geolocation instance by denying permission. -window.layoutTestController.setGeolocationPermission(false); -window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100); +if (window.layoutTestController) { + layoutTestController.setGeolocationPermission(false); + layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100); +} else + debug('This test can not be run without the LayoutTestController'); var error; navigator.geolocation.getCurrentPosition(function(p) { testFailed('Success callback invoked unexpectedly'); finishJSTest(); }, function(e) { - error = e + error = e; shouldBe('error.code', 'error.PERMISSION_DENIED'); shouldBe('error.message', '"User denied Geolocation"'); debug(''); @@ -23,7 +26,7 @@ function continueTest() testFailed('Success callback invoked unexpectedly'); finishJSTest(); }, function(e) { - error = e + error = e; shouldBe('error.code', 'error.PERMISSION_DENIED'); shouldBe('error.message', '"User denied Geolocation"'); navigator.geolocation.clearWatch(watchId); @@ -31,7 +34,5 @@ function continueTest() }); } -window.layoutTestController.waitUntilDone(); - window.jsTestIsAsync = true; window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-error.js b/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-error.js index 9cea5ba..cce57ce 100644 --- a/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-error.js +++ b/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-error.js @@ -1,15 +1,18 @@ description("Tests that when Geolocation permission has been denied prior to a call to a Geolocation method, the error callback is invoked with code PERMISSION_DENIED, when the Geolocation service encounters an error."); // Prime the Geolocation instance by denying permission. -window.layoutTestController.setGeolocationPermission(false); -window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100); +if (window.layoutTestController) { + layoutTestController.setGeolocationPermission(false); + layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100); +} else + debug('This test can not be run without the LayoutTestController'); var error; navigator.geolocation.getCurrentPosition(function(p) { testFailed('Success callback invoked unexpectedly'); finishJSTest(); }, function(e) { - error = e + error = e; shouldBe('error.code', 'error.PERMISSION_DENIED'); shouldBe('error.message', '"User denied Geolocation"'); debug(''); @@ -19,19 +22,19 @@ navigator.geolocation.getCurrentPosition(function(p) { function continueTest() { // Make another request, with permission already denied. - window.layoutTestController.setMockGeolocationError(0, 'test'); + if (window.layoutTestController) + layoutTestController.setMockGeolocationError(0, 'test'); navigator.geolocation.getCurrentPosition(function(p) { testFailed('Success callback invoked unexpectedly'); finishJSTest(); }, function(e) { - error = e + error = e; shouldBe('error.code', 'error.PERMISSION_DENIED'); shouldBe('error.message', '"User denied Geolocation"'); finishJSTest(); }); } -window.layoutTestController.waitUntilDone(); window.jsTestIsAsync = true; window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-success.js b/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-success.js index fdc74e6..4a25367 100644 --- a/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-success.js +++ b/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-already-success.js @@ -1,15 +1,18 @@ description("Tests that when Geolocation permission has been denied prior to a call to a Geolocation method, the error callback is invoked with code PERMISSION_DENIED, when the Geolocation service has a good position."); // Prime the Geolocation instance by denying permission. -window.layoutTestController.setGeolocationPermission(false); -window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100); +if (window.layoutTestController) { + layoutTestController.setGeolocationPermission(false); + layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100); +} else + debug('This test can not be run without the LayoutTestController'); var error; navigator.geolocation.getCurrentPosition(function(p) { testFailed('Success callback invoked unexpectedly'); finishJSTest(); }, function(e) { - error = e + error = e; shouldBe('error.code', 'error.PERMISSION_DENIED'); shouldBe('error.message', '"User denied Geolocation"'); debug(''); @@ -23,13 +26,12 @@ function continueTest() testFailed('Success callback invoked unexpectedly'); finishJSTest(); }, function(e) { - error = e + error = e; shouldBe('error.code', 'error.PERMISSION_DENIED'); shouldBe('error.message', '"User denied Geolocation"'); finishJSTest(); }); } -window.layoutTestController.waitUntilDone(); window.jsTestIsAsync = true; window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-stops-watches.js b/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-stops-watches.js index 244deda..9cdb40e 100644 --- a/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-stops-watches.js +++ b/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-stops-watches.js @@ -2,8 +2,11 @@ description("Tests that when Geolocation permission is denied, watches are stopp // Configure the mock Geolocation service to report a position to cause permission // to be requested, then deny it. -window.layoutTestController.setGeolocationPermission(false); -window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100.0); +if (window.layoutTestController) { + layoutTestController.setGeolocationPermission(false); + layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100.0); +} else + debug('This test can not be run without the LayoutTestController'); var error; var errorCallbackInvoked = false; @@ -17,17 +20,17 @@ navigator.geolocation.watchPosition(function(p) { } errorCallbackInvoked = true; - error = e + error = e; shouldBe('error.code', 'error.PERMISSION_DENIED'); shouldBe('error.message', '"User denied Geolocation"'); // Update the mock Geolocation service to report a new position, then // yield to allow a chance for the success callback to be invoked. - window.layoutTestController.setMockGeolocationPosition(55.478, -0.166, 100); + if (window.layoutTestController) + layoutTestController.setMockGeolocationPosition(55.478, -0.166, 100); window.setTimeout(finishJSTest, 0); }); -window.layoutTestController.waitUntilDone(); window.jsTestIsAsync = true; window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied.js b/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied.js index aafcaf1..e7114d3 100644 --- a/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied.js +++ b/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied.js @@ -1,19 +1,21 @@ description("Tests Geolocation when permission is denied, using the mock service."); -window.layoutTestController.setGeolocationPermission(false); -window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100); +if (window.layoutTestController) { + layoutTestController.setGeolocationPermission(false); + layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100.0); +} else + debug('This test can not be run without the LayoutTestController'); var error; navigator.geolocation.getCurrentPosition(function(p) { testFailed('Success callback invoked unexpectedly'); finishJSTest(); }, function(e) { - error = e + error = e; shouldBe('error.code', 'error.PERMISSION_DENIED'); shouldBe('error.message', '"User denied Geolocation"'); finishJSTest(); }); -window.layoutTestController.waitUntilDone(); window.jsTestIsAsync = true; window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/position-string.js b/LayoutTests/fast/dom/Geolocation/script-tests/position-string.js index d4931ee..0984f7d 100644 --- a/LayoutTests/fast/dom/Geolocation/script-tests/position-string.js +++ b/LayoutTests/fast/dom/Geolocation/script-tests/position-string.js @@ -4,15 +4,18 @@ var mockLatitude = 51.478; var mockLongitude = -0.166; var mockAccuracy = 100.0; -window.layoutTestController.setGeolocationPermission(true); -window.layoutTestController.setMockGeolocationPosition(mockLatitude, - mockLongitude, - mockAccuracy); +if (window.layoutTestController) { + layoutTestController.setGeolocationPermission(true); + layoutTestController.setMockGeolocationPosition(mockLatitude, + mockLongitude, + mockAccuracy); +} else + debug('This test can not be run without the LayoutTestController'); var position; navigator.geolocation.getCurrentPosition(function(p) { // shouldBe can't use local variables yet. - position = p + position = p; shouldBe('position.coords.latitude', 'mockLatitude'); shouldBe('position.coords.longitude', 'mockLongitude'); shouldBe('position.coords.accuracy', 'mockAccuracy'); @@ -23,7 +26,6 @@ navigator.geolocation.getCurrentPosition(function(p) { testFailed('Error callback invoked unexpectedly'); finishJSTest(); }); -window.layoutTestController.waitUntilDone(); window.jsTestIsAsync = true; window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/reentrant-error.js b/LayoutTests/fast/dom/Geolocation/script-tests/reentrant-error.js index e3361de..d28a66a 100644 --- a/LayoutTests/fast/dom/Geolocation/script-tests/reentrant-error.js +++ b/LayoutTests/fast/dom/Geolocation/script-tests/reentrant-error.js @@ -1,9 +1,13 @@ description("Tests that reentrant calls to Geolocation methods from the error callback are OK."); -var mockCode = 0; +var mockCode = 2; var mockMessage = 'test'; -window.layoutTestController.setMockGeolocationError(mockCode, mockMessage); +if (window.layoutTestController) { + layoutTestController.setGeolocationPermission(true); + layoutTestController.setMockGeolocationError(mockCode, mockMessage); +} else + debug('This test can not be run without the LayoutTestController'); var error; var errorCallbackInvoked = false; @@ -25,10 +29,10 @@ navigator.geolocation.getCurrentPosition(function(p) { }); function continueTest() { - mockCode += 1; mockMessage += ' repeat'; - window.layoutTestController.setMockGeolocationError(mockCode, mockMessage); + if (window.layoutTestController) + layoutTestController.setMockGeolocationError(mockCode, mockMessage); navigator.geolocation.getCurrentPosition(function(p) { testFailed('Success callback invoked unexpectedly'); @@ -40,7 +44,6 @@ function continueTest() { finishJSTest(); }); } -window.layoutTestController.waitUntilDone(); window.jsTestIsAsync = true; window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/reentrant-permission-denied.js b/LayoutTests/fast/dom/Geolocation/script-tests/reentrant-permission-denied.js new file mode 100644 index 0000000..744bc9e --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/script-tests/reentrant-permission-denied.js @@ -0,0 +1,41 @@ +description("Tests that reentrant calls to Geolocation methods from the error callback due to a PERMISSION_DENIED error are OK."); + +if (window.layoutTestController) { + layoutTestController.setGeolocationPermission(false); + layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100.0); +} else + debug('This test can not be run without the LayoutTestController'); + +var error; +function checkPermissionError(e) { + error = e; + shouldBe('error.code', 'error.PERMISSION_DENIED'); + shouldBe('error.message', '"User denied Geolocation"'); +} + +var errorCallbackInvoked = false; +navigator.geolocation.getCurrentPosition(function(p) { + testFailed('Success callback invoked unexpectedly'); + finishJSTest(); +}, function(e) { + if (errorCallbackInvoked) { + testFailed('Error callback invoked unexpectedly'); + finishJSTest(); + } + errorCallbackInvoked = true; + checkPermissionError(e); + continueTest(); +}); + +function continueTest() { + navigator.geolocation.getCurrentPosition(function(p) { + testFailed('Success callback invoked unexpectedly'); + finishJSTest(); + }, function(e) { + checkPermissionError(e); + finishJSTest(); + }); +} + +window.jsTestIsAsync = true; +window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/reentrant-success.js b/LayoutTests/fast/dom/Geolocation/script-tests/reentrant-success.js index 4b83ea7..f7b3c78 100644 --- a/LayoutTests/fast/dom/Geolocation/script-tests/reentrant-success.js +++ b/LayoutTests/fast/dom/Geolocation/script-tests/reentrant-success.js @@ -4,10 +4,13 @@ var mockLatitude = 51.478; var mockLongitude = -0.166; var mockAccuracy = 100.0; -window.layoutTestController.setGeolocationPermission(true); -window.layoutTestController.setMockGeolocationPosition(mockLatitude, - mockLongitude, - mockAccuracy); +if (window.layoutTestController) { + layoutTestController.setGeolocationPermission(true); + layoutTestController.setMockGeolocationPosition(mockLatitude, + mockLongitude, + mockAccuracy); +} else + debug('This test can not be run without the LayoutTestController'); var position; var successCallbackInvoked = false; @@ -30,9 +33,10 @@ navigator.geolocation.getCurrentPosition(function(p) { }); function continueTest() { - window.layoutTestController.setMockGeolocationPosition(++mockLatitude, - ++mockLongitude, - ++mockAccuracy); + if (window.layoutTestController) + layoutTestController.setMockGeolocationPosition(++mockLatitude, + ++mockLongitude, + ++mockAccuracy); navigator.geolocation.getCurrentPosition(function(p) { position = p; @@ -45,7 +49,6 @@ function continueTest() { finishJSTest(); }); } -window.layoutTestController.waitUntilDone(); window.jsTestIsAsync = true; window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/success.js b/LayoutTests/fast/dom/Geolocation/script-tests/success.js index acb6b8d..0baf19a 100644 --- a/LayoutTests/fast/dom/Geolocation/script-tests/success.js +++ b/LayoutTests/fast/dom/Geolocation/script-tests/success.js @@ -4,14 +4,17 @@ var mockLatitude = 51.478; var mockLongitude = -0.166; var mockAccuracy = 100; -window.layoutTestController.setGeolocationPermission(true); -window.layoutTestController.setMockGeolocationPosition(mockLatitude, - mockLongitude, - mockAccuracy); +if (window.layoutTestController) { + layoutTestController.setGeolocationPermission(true); + layoutTestController.setMockGeolocationPosition(mockLatitude, + mockLongitude, + mockAccuracy); +} else + debug('This test can not be run without the LayoutTestController'); var position; navigator.geolocation.getCurrentPosition(function(p) { - position = p + position = p; shouldBe('position.coords.latitude', 'mockLatitude'); shouldBe('position.coords.longitude', 'mockLongitude'); shouldBe('position.coords.accuracy', 'mockAccuracy'); @@ -20,7 +23,6 @@ navigator.geolocation.getCurrentPosition(function(p) { testFailed('Error callback invoked unexpectedly'); finishJSTest(); }); -window.layoutTestController.waitUntilDone(); window.jsTestIsAsync = true; window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/timeout-clear-watch.js b/LayoutTests/fast/dom/Geolocation/script-tests/timeout-clear-watch.js index 63e0569..fe26735 100644 --- a/LayoutTests/fast/dom/Geolocation/script-tests/timeout-clear-watch.js +++ b/LayoutTests/fast/dom/Geolocation/script-tests/timeout-clear-watch.js @@ -1,13 +1,14 @@ description("Tests that when a watch times out and is cleared from the error callback, there is no crash. This a regression test for https://bugs.webkit.org/show_bug.cgi?id=32111."); -window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100.0); +if (window.layoutTestController) + layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100.0); var error; var watchId = navigator.geolocation.watchPosition(function() { testFailed('Success callback invoked unexpectedly'); finishJSTest(); }, function(e) { - error = e + error = e; shouldBe('error.code', 'error.TIMEOUT'); shouldBe('error.message', '"Timeout expired"'); navigator.geolocation.clearWatch(watchId); @@ -16,7 +17,6 @@ var watchId = navigator.geolocation.watchPosition(function() { timeout: 0 }); -window.layoutTestController.waitUntilDone(); window.jsTestIsAsync = true; window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/timeout-zero.js b/LayoutTests/fast/dom/Geolocation/script-tests/timeout-zero.js index 9867084..03076bc 100644 --- a/LayoutTests/fast/dom/Geolocation/script-tests/timeout-zero.js +++ b/LayoutTests/fast/dom/Geolocation/script-tests/timeout-zero.js @@ -1,20 +1,20 @@ description("Tests that when timeout is zero (and maximumAge is too), the error callback is called immediately with code TIMEOUT."); -layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100.0); +if (window.layoutTestController) + layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100.0); var error; navigator.geolocation.getCurrentPosition(function(p) { testFailed('Success callback invoked unexpectedly'); finishJSTest(); }, function(e) { - error = e + error = e; shouldBe('error.code', 'error.TIMEOUT'); shouldBe('error.message', '"Timeout expired"'); finishJSTest(); }, { timeout: 0 }); -window.layoutTestController.waitUntilDone(); window.jsTestIsAsync = true; window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/timeout.js b/LayoutTests/fast/dom/Geolocation/script-tests/timeout.js index 49cab29..0a027d9 100644 --- a/LayoutTests/fast/dom/Geolocation/script-tests/timeout.js +++ b/LayoutTests/fast/dom/Geolocation/script-tests/timeout.js @@ -4,10 +4,13 @@ var mockLatitude = 51.478; var mockLongitude = -0.166; var mockAccuracy = 100.0; -window.layoutTestController.setGeolocationPermission(true); -window.layoutTestController.setMockGeolocationPosition(mockLatitude, - mockLongitude, - mockAccuracy); +if (window.layoutTestController) { + layoutTestController.setGeolocationPermission(true); + layoutTestController.setMockGeolocationPosition(mockLatitude, + mockLongitude, + mockAccuracy); +} else + debug('This test can not be run without the LayoutTestController'); var position; navigator.geolocation.getCurrentPosition(function(p) { @@ -22,7 +25,6 @@ navigator.geolocation.getCurrentPosition(function(p) { }, { timeout: 1000 }); -window.layoutTestController.waitUntilDone(); window.jsTestIsAsync = true; window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/watch.js b/LayoutTests/fast/dom/Geolocation/script-tests/watch.js index 8249f2e..9b356bb 100644 --- a/LayoutTests/fast/dom/Geolocation/script-tests/watch.js +++ b/LayoutTests/fast/dom/Geolocation/script-tests/watch.js @@ -4,7 +4,7 @@ var mockLatitude = 51.478; var mockLongitude = -0.166; var mockAccuracy = 100.0; -var mockCode = 1; +var mockCode = 2; var mockMessage = 'test'; var position; @@ -25,19 +25,24 @@ function checkError(e) { debug(''); } -window.layoutTestController.setGeolocationPermission(true); -window.layoutTestController.setMockGeolocationPosition(mockLatitude, mockLongitude, mockAccuracy); +if (window.layoutTestController) { + layoutTestController.setGeolocationPermission(true); + layoutTestController.setMockGeolocationPosition(mockLatitude, mockLongitude, mockAccuracy); +} else + debug('This test can not be run without the LayoutTestController'); var state = 0; navigator.geolocation.watchPosition(function(p) { switch (state++) { case 0: checkPosition(p); - window.layoutTestController.setMockGeolocationPosition(++mockLatitude, ++mockLongitude, ++mockAccuracy); + if (window.layoutTestController) + layoutTestController.setMockGeolocationPosition(++mockLatitude, ++mockLongitude, ++mockAccuracy); break; case 1: checkPosition(p); - window.layoutTestController.setMockGeolocationError(mockCode, mockMessage); + if (window.layoutTestController) + layoutTestController.setMockGeolocationError(mockCode, mockMessage); break; case 3: checkPosition(p); @@ -51,14 +56,14 @@ navigator.geolocation.watchPosition(function(p) { switch (state++) { case 2: checkError(e); - window.layoutTestController.setMockGeolocationPosition(++mockLatitude, ++mockLongitude, ++mockAccuracy); + if (window.layoutTestController) + layoutTestController.setMockGeolocationPosition(++mockLatitude, ++mockLongitude, ++mockAccuracy); break; default: testFailed('Error callback invoked unexpectedly'); finishJSTest(); } }); -window.layoutTestController.waitUntilDone(); window.jsTestIsAsync = true; window.successfullyParsed = true; diff --git a/LayoutTests/storage/indexeddb/idb-database-request-expected.txt b/LayoutTests/storage/indexeddb/idb-database-request-expected.txt index 70ec252..2651dd8 100644 --- a/LayoutTests/storage/indexeddb/idb-database-request-expected.txt +++ b/LayoutTests/storage/indexeddb/idb-database-request-expected.txt @@ -24,7 +24,7 @@ PASS event.target.readyState is event.target.DONE db = event.result PASS db.name is "name" -FAIL db.description should be description (of type string). Was undefined (of type undefined). +PASS db.description is "description" PASS db.version is "" PASS db.objectStores is [] PASS db.objectStores.length is 0 diff --git a/LayoutTests/storage/indexeddb/idb-keyrange-expected.txt b/LayoutTests/storage/indexeddb/idb-keyrange-expected.txt new file mode 100644 index 0000000..316a97b --- /dev/null +++ b/LayoutTests/storage/indexeddb/idb-keyrange-expected.txt @@ -0,0 +1,119 @@ +Test IndexedDB's KeyRange. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +indexedDB.makeSingleKeyRange(1) +PASS keyRange.left is 1 +PASS keyRange.right is 1 +PASS keyRange.flags is keyRange.SINGLE +indexedDB.makeSingleKeyRange('a') +PASS keyRange.left is 'a' +PASS keyRange.right is 'a' +PASS keyRange.flags is keyRange.SINGLE +indexedDB.makeLeftBoundKeyRange(10,true) +PASS keyRange.left is 10 +PASS keyRange.right is null +PASS keyRange.flags is keyRange.LEFT_OPEN +indexedDB.makeLeftBoundKeyRange(11,false) +PASS keyRange.left is 11 +PASS keyRange.right is null +PASS keyRange.flags is keyRange.LEFT_BOUND +indexedDB.makeLeftBoundKeyRange(12,undefined) +PASS keyRange.left is 12 +PASS keyRange.right is null +PASS keyRange.flags is keyRange.LEFT_BOUND +indexedDB.makeLeftBoundKeyRange('aa',true) +PASS keyRange.left is 'aa' +PASS keyRange.right is null +PASS keyRange.flags is keyRange.LEFT_OPEN +indexedDB.makeLeftBoundKeyRange('ab',false) +PASS keyRange.left is 'ab' +PASS keyRange.right is null +PASS keyRange.flags is keyRange.LEFT_BOUND +indexedDB.makeLeftBoundKeyRange('ac',undefined) +PASS keyRange.left is 'ac' +PASS keyRange.right is null +PASS keyRange.flags is keyRange.LEFT_BOUND +indexedDB.makeRightBoundKeyRange(20,true) +PASS keyRange.right is 20 +PASS keyRange.left is null +PASS keyRange.flags is keyRange.RIGHT_OPEN +indexedDB.makeRightBoundKeyRange(21,false) +PASS keyRange.right is 21 +PASS keyRange.left is null +PASS keyRange.flags is keyRange.RIGHT_BOUND +indexedDB.makeRightBoundKeyRange(22,undefined) +PASS keyRange.right is 22 +PASS keyRange.left is null +PASS keyRange.flags is keyRange.RIGHT_BOUND +indexedDB.makeRightBoundKeyRange('ba',true) +PASS keyRange.right is 'ba' +PASS keyRange.left is null +PASS keyRange.flags is keyRange.RIGHT_OPEN +indexedDB.makeRightBoundKeyRange('bb',false) +PASS keyRange.right is 'bb' +PASS keyRange.left is null +PASS keyRange.flags is keyRange.RIGHT_BOUND +indexedDB.makeRightBoundKeyRange('bc',undefined) +PASS keyRange.right is 'bc' +PASS keyRange.left is null +PASS keyRange.flags is keyRange.RIGHT_BOUND +indexedDB.makeBoundKeyRange(30,40,undefined,undefined) +PASS keyRange.left is 30 +PASS keyRange.right is 40 +PASS leftFlags is keyRange.LEFT_BOUND +PASS rightFlags is keyRange.RIGHT_BOUND +indexedDB.makeBoundKeyRange(31,41,false,false) +PASS keyRange.left is 31 +PASS keyRange.right is 41 +PASS leftFlags is keyRange.LEFT_BOUND +PASS rightFlags is keyRange.RIGHT_BOUND +indexedDB.makeBoundKeyRange(32,42,false,true) +PASS keyRange.left is 32 +PASS keyRange.right is 42 +PASS leftFlags is keyRange.LEFT_BOUND +PASS rightFlags is keyRange.RIGHT_OPEN +indexedDB.makeBoundKeyRange(33,43,true,false) +PASS keyRange.left is 33 +PASS keyRange.right is 43 +PASS leftFlags is keyRange.LEFT_OPEN +PASS rightFlags is keyRange.RIGHT_BOUND +indexedDB.makeBoundKeyRange(34,44,true,true) +PASS keyRange.left is 34 +PASS keyRange.right is 44 +PASS leftFlags is keyRange.LEFT_OPEN +PASS rightFlags is keyRange.RIGHT_OPEN +indexedDB.makeBoundKeyRange('aaa','aba',false,false) +PASS keyRange.left is 'aaa' +PASS keyRange.right is 'aba' +PASS leftFlags is keyRange.LEFT_BOUND +PASS rightFlags is keyRange.RIGHT_BOUND +indexedDB.makeBoundKeyRange('aab','abb',undefined,undefined) +PASS keyRange.left is 'aab' +PASS keyRange.right is 'abb' +PASS leftFlags is keyRange.LEFT_BOUND +PASS rightFlags is keyRange.RIGHT_BOUND +indexedDB.makeBoundKeyRange('aac','abc',false,false) +PASS keyRange.left is 'aac' +PASS keyRange.right is 'abc' +PASS leftFlags is keyRange.LEFT_BOUND +PASS rightFlags is keyRange.RIGHT_BOUND +indexedDB.makeBoundKeyRange('aad','abd',false,true) +PASS keyRange.left is 'aad' +PASS keyRange.right is 'abd' +PASS leftFlags is keyRange.LEFT_BOUND +PASS rightFlags is keyRange.RIGHT_OPEN +indexedDB.makeBoundKeyRange('aae','abe',true,false) +PASS keyRange.left is 'aae' +PASS keyRange.right is 'abe' +PASS leftFlags is keyRange.LEFT_OPEN +PASS rightFlags is keyRange.RIGHT_BOUND +indexedDB.makeBoundKeyRange('aaf','abf',true,true) +PASS keyRange.left is 'aaf' +PASS keyRange.right is 'abf' +PASS leftFlags is keyRange.LEFT_OPEN +PASS rightFlags is keyRange.RIGHT_OPEN +PASS successfullyParsed is true + +TEST COMPLETE diff --git a/LayoutTests/storage/indexeddb/idb-keyrange.html b/LayoutTests/storage/indexeddb/idb-keyrange.html new file mode 100644 index 0000000..800a8cc --- /dev/null +++ b/LayoutTests/storage/indexeddb/idb-keyrange.html @@ -0,0 +1,13 @@ + + + + + + + + +

+
+ + + diff --git a/LayoutTests/storage/indexeddb/idb-objectstore-request-expected.txt b/LayoutTests/storage/indexeddb/idb-objectstore-request-expected.txt new file mode 100644 index 0000000..bcf1d63 --- /dev/null +++ b/LayoutTests/storage/indexeddb/idb-objectstore-request-expected.txt @@ -0,0 +1,49 @@ +Test IndexedDB's IDBObjectStoreRequest. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS 'onsuccess' in result is true +PASS 'onerror' in result is true +PASS 'abort' in result is true +PASS 'readyState' in result is true +An event should fire shortly... + +Success event fired: +PASS 'result' in event is true +PASS 'code' in event is false +PASS 'message' in event is false +PASS 'source' in event is true +PASS event.source != null is true +PASS 'onsuccess' in event.target is true +PASS 'onerror' in event.target is true +PASS 'abort' in event.target is true +PASS 'readyState' in event.target is true +PASS event.target.readyState is event.target.DONE + +db = event.result +PASS 'onsuccess' in result is true +PASS 'onerror' in result is true +PASS 'abort' in result is true +PASS 'readyState' in result is true +An event should fire shortly... + +Success event fired: +PASS 'result' in event is true +PASS 'code' in event is false +PASS 'message' in event is false +PASS 'source' in event is true +PASS event.source != null is true +PASS 'onsuccess' in event.target is true +PASS 'onerror' in event.target is true +PASS 'abort' in event.target is true +PASS 'readyState' in event.target is true +PASS event.target.readyState is event.target.DONE + +store = event.result +PASS store.name is "storeName" +PASS store.keyPath is "keyPath" +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/storage/indexeddb/idb-objectstore-request.html b/LayoutTests/storage/indexeddb/idb-objectstore-request.html new file mode 100644 index 0000000..87c34ea --- /dev/null +++ b/LayoutTests/storage/indexeddb/idb-objectstore-request.html @@ -0,0 +1,13 @@ + + + + + + + + +

+
+ + + diff --git a/LayoutTests/storage/indexeddb/script-tests/idb-keyrange.js b/LayoutTests/storage/indexeddb/script-tests/idb-keyrange.js new file mode 100644 index 0000000..2951876 --- /dev/null +++ b/LayoutTests/storage/indexeddb/script-tests/idb-keyrange.js @@ -0,0 +1,75 @@ +description("Test IndexedDB's KeyRange."); +if (window.layoutTestController) + layoutTestController.waitUntilDone(); + +function checkSingleKeyRange(value) +{ + keyRange = evalAndLog("indexedDB.makeSingleKeyRange(" + value + ")"); + shouldBe("keyRange.left", "" + value); + shouldBe("keyRange.right", "" + value); + shouldBe("keyRange.flags", "keyRange.SINGLE"); +} + +function checkLeftBoundKeyRange(value, open) +{ + keyRange = evalAndLog("indexedDB.makeLeftBoundKeyRange(" + value + "," + open + ")"); + shouldBe("keyRange.left", "" + value); + shouldBeNull("keyRange.right"); + shouldBe("keyRange.flags", open ? "keyRange.LEFT_OPEN" : "keyRange.LEFT_BOUND"); +} + +function checkRightBoundKeyRange(value, open) +{ + keyRange = evalAndLog("indexedDB.makeRightBoundKeyRange(" + value + "," + open + ")"); + shouldBe("keyRange.right", "" + value); + shouldBeNull("keyRange.left"); + shouldBe("keyRange.flags", open ? "keyRange.RIGHT_OPEN" : "keyRange.RIGHT_BOUND"); +} + +function checkBoundKeyRange(left, right, openLeft, openRight) +{ + keyRange = evalAndLog("indexedDB.makeBoundKeyRange(" + left + "," + right + "," + openLeft + "," + openRight + ")"); + shouldBe("keyRange.left", "" + left); + shouldBe("keyRange.right", "" + right); + leftFlags = keyRange.flags & (keyRange.LEFT_OPEN | keyRange.LEFT_BOUND); + shouldBe("leftFlags", openLeft ? "keyRange.LEFT_OPEN" : "keyRange.LEFT_BOUND"); + rightFlags = keyRange.flags & (keyRange.RIGHT_OPEN | keyRange.RIGHT_BOUND); + shouldBe("rightFlags", openRight ? "keyRange.RIGHT_OPEN" : "keyRange.RIGHT_BOUND"); +} + +function test() +{ + checkSingleKeyRange(1); + checkSingleKeyRange("'a'"); + + checkLeftBoundKeyRange(10, true); + checkLeftBoundKeyRange(11, false); + checkLeftBoundKeyRange(12); + checkLeftBoundKeyRange("'aa'", true); + checkLeftBoundKeyRange("'ab'", false); + checkLeftBoundKeyRange("'ac'"); + + checkRightBoundKeyRange(20, true); + checkRightBoundKeyRange(21, false); + checkRightBoundKeyRange(22); + checkRightBoundKeyRange("'ba'", true); + checkRightBoundKeyRange("'bb'", false); + checkRightBoundKeyRange("'bc'"); + + checkBoundKeyRange(30, 40); + checkBoundKeyRange(31, 41, false, false); + checkBoundKeyRange(32, 42, false, true); + checkBoundKeyRange(33, 43, true, false); + checkBoundKeyRange(34, 44, true, true); + + checkBoundKeyRange("'aaa'", "'aba'", false, false); + checkBoundKeyRange("'aab'", "'abb'"); + checkBoundKeyRange("'aac'", "'abc'", false, false); + checkBoundKeyRange("'aad'", "'abd'", false, true); + checkBoundKeyRange("'aae'", "'abe'", true, false); + checkBoundKeyRange("'aaf'", "'abf'", true, true); + + done(); +} + +test(); diff --git a/LayoutTests/storage/indexeddb/script-tests/idb-objectstore-request.js b/LayoutTests/storage/indexeddb/script-tests/idb-objectstore-request.js new file mode 100644 index 0000000..031ece6 --- /dev/null +++ b/LayoutTests/storage/indexeddb/script-tests/idb-objectstore-request.js @@ -0,0 +1,42 @@ +description("Test IndexedDB's IDBObjectStoreRequest."); +if (window.layoutTestController) + layoutTestController.waitUntilDone(); + +function test() +{ + result = indexedDB.open('name', 'description'); + verifyResult(result); + result.onsuccess = openSuccess; + result.onerror = unexpectedErrorCallback; +} + +function openSuccess() +{ + verifySuccessEvent(event); + + var db = evalAndLog("db = event.result"); + createObjectStore(db); +} + +function createObjectStore(db) +{ + // FIXME: remove any previously created object stores. + // This requires IDBDatabaseRequest::removeObjectStore to be implemented. + result = db.createObjectStore('storeName', 'keyPath'); + verifyResult(result); + result.onsuccess = createSuccess; + result.onerror = unexpectedErrorCallback; +} + +function createSuccess() +{ + verifySuccessEvent(event); + var store = evalAndLog("store = event.result"); + shouldBeEqualToString("store.name", "storeName"); + shouldBeEqualToString("store.keyPath", "keyPath"); + // FIXME: test store.indexNames, as well as all object store's methods. + + done(); +} + +test(); diff --git a/WebCore/Android.derived.jscbindings.mk b/WebCore/Android.derived.jscbindings.mk index dc45dc2..1c0555c 100644 --- a/WebCore/Android.derived.jscbindings.mk +++ b/WebCore/Android.derived.jscbindings.mk @@ -388,6 +388,7 @@ GEN := \ $(intermediates)/storage/JSIDBErrorEvent.h \ $(intermediates)/storage/JSIDBEvent.h \ $(intermediates)/storage/JSIDBIndexRequest.h \ + $(intermediates)/storage/JSIDBKeyRange.h \ $(intermediates)/storage/JSIDBRequest.h \ $(intermediates)/storage/JSIDBSuccessEvent.h \ $(intermediates)/storage/JSIndexedDatabaseRequest.h diff --git a/WebCore/Android.derived.v8bindings.mk b/WebCore/Android.derived.v8bindings.mk index 7519ff0..f1d3d03 100644 --- a/WebCore/Android.derived.v8bindings.mk +++ b/WebCore/Android.derived.v8bindings.mk @@ -382,6 +382,10 @@ GEN := \ $(intermediates)/bindings/V8IDBErrorEvent.h \ $(intermediates)/bindings/V8IDBEvent.h \ $(intermediates)/bindings/V8IDBIndexRequest.h \ +<<<<<<< HEAD:WebCore/Android.derived.v8bindings.mk +======= + $(intermediates)/bindings/V8IDBKeyRange.h \ +>>>>>>> Webkit.org at r61121:WebCore/Android.derived.v8bindings.mk $(intermediates)/bindings/V8IDBRequest.h \ $(intermediates)/bindings/V8IDBSuccessEvent.h \ $(intermediates)/bindings/V8IndexedDatabaseRequest.h diff --git a/WebCore/Android.jscbindings.mk b/WebCore/Android.jscbindings.mk index 79b88e6..f8b086a 100644 --- a/WebCore/Android.jscbindings.mk +++ b/WebCore/Android.jscbindings.mk @@ -162,7 +162,6 @@ LOCAL_SRC_FILES += \ bindings/js/JSWorkerContextCustom.cpp \ bindings/js/JSWorkerContextErrorHandler.cpp \ bindings/js/JSWorkerCustom.cpp \ - bindings/js/JSXMLHttpRequestConstructor.cpp \ bindings/js/JSXMLHttpRequestCustom.cpp \ bindings/js/JSXMLHttpRequestUploadCustom.cpp \ bindings/js/JSXSLTProcessorConstructor.cpp \ diff --git a/WebCore/Android.mk b/WebCore/Android.mk index 8f7c749..0bd4b1d 100644 --- a/WebCore/Android.mk +++ b/WebCore/Android.mk @@ -46,6 +46,7 @@ LOCAL_SRC_FILES := \ css/CSSInitialValue.cpp \ css/CSSMediaRule.cpp \ css/CSSMutableStyleDeclaration.cpp \ + css/CSSOMUtils.cpp \ css/CSSPageRule.cpp \ css/CSSParser.cpp \ css/CSSParserValues.cpp \ @@ -185,9 +186,9 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ dom/WebKitAnimationEvent.cpp \ dom/WebKitTransitionEvent.cpp \ dom/WheelEvent.cpp \ - dom/XMLTokenizer.cpp \ - dom/XMLTokenizerLibxml2.cpp \ - dom/XMLTokenizerScope.cpp \ + dom/XMLDocumentParser.cpp \ + dom/XMLDocumentParserLibxml2.cpp \ + dom/XMLDocumentParserScope.cpp \ dom/default/PlatformMessagePortChannel.cpp \ \ editing/AppendNodeCommand.cpp \ @@ -246,6 +247,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ \ history/android/HistoryItemAndroid.cpp \ \ + html/AsyncImageResizer.cpp \ html/Blob.cpp \ html/CollectionCache.cpp \ html/DateComponents.cpp \ @@ -257,8 +259,9 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ html/FileStreamProxy.cpp \ html/FileThread.cpp \ html/FormDataList.cpp \ + html/HTML5EntityParser.cpp \ html/HTML5Lexer.cpp \ - html/HTML5Tokenizer.cpp \ + html/HTML5DocumentParser.cpp \ html/HTML5TreeBuilder.cpp \ html/HTML5ScriptRunner.cpp \ html/HTMLAllCollection.cpp \ @@ -270,13 +273,17 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ html/HTMLImageLoader.cpp \ html/HTMLNameCollection.cpp \ html/HTMLOptionsCollection.cpp \ - html/HTMLParser.cpp \ + html/LegacyHTMLTreeConstructor.cpp \ html/HTMLParserErrorCodes.cpp \ html/HTMLTableRowsCollection.cpp \ - html/HTMLTokenizer.cpp \ + html/HTMLDocumentParser.cpp \ html/HTMLViewSourceDocument.cpp \ html/ImageData.cpp \ +<<<<<<< HEAD:WebCore/Android.mk html/LabelsNodeList.cpp \ +======= + html/ImageResizerThread.cpp \ +>>>>>>> Webkit.org at r61121:WebCore/Android.mk html/PreloadScanner.cpp \ html/StepRange.cpp \ html/TimeRanges.cpp \ @@ -772,7 +779,8 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ storage/IDBEvent.cpp \ storage/IDBIndexImpl.cpp \ storage/IDBIndexRequest.cpp \ - storage/IDBObjectStore.cpp \ + storage/IDBKeyRange.cpp \ + storage/IDBObjectStoreImpl.cpp \ storage/IDBObjectStoreRequest.cpp \ storage/IDBRequest.cpp \ storage/IDBSuccessEvent.cpp \ diff --git a/WebCore/CMakeLists.txt b/WebCore/CMakeLists.txt index aa3a320..2c0e6e0 100644 --- a/WebCore/CMakeLists.txt +++ b/WebCore/CMakeLists.txt @@ -277,7 +277,7 @@ SET(WebCore_IDL_FILES html/canvas/ArrayBuffer.idl html/canvas/ArrayBufferView.idl - html/canvas/FloatArray.idl + html/canvas/Float32Array.idl html/canvas/Int16Array.idl html/canvas/Int32Array.idl html/canvas/Int8Array.idl @@ -307,6 +307,7 @@ SET(WebCore_IDL_FILES page/Geoposition.idl page/History.idl page/Location.idl + page/MemoryInfo.idl page/Navigator.idl page/PositionError.idl page/Screen.idl @@ -328,6 +329,7 @@ SET(WebCore_IDL_FILES storage/IDBErrorEvent.idl storage/IDBEvent.idl storage/IDBIndexRequest.idl + storage/IDBKeyRange.idl storage/IDBObjectStoreRequest.idl storage/IDBRequest.idl storage/IDBSuccessEvent.idl @@ -645,7 +647,6 @@ SET(WebCore_SOURCES bindings/js/JSWorkerContextCustom.cpp bindings/js/JSWorkerContextErrorHandler.cpp bindings/js/JSWorkerCustom.cpp - bindings/js/JSXMLHttpRequestConstructor.cpp bindings/js/JSXMLHttpRequestCustom.cpp bindings/js/JSXMLHttpRequestUploadCustom.cpp bindings/js/JSXSLTProcessorConstructor.cpp @@ -704,6 +705,7 @@ SET(WebCore_SOURCES css/CSSInitialValue.cpp css/CSSMediaRule.cpp css/CSSMutableStyleDeclaration.cpp + css/CSSOMUtils.cpp css/CSSPageRule.cpp css/CSSParser.cpp css/CSSParserValues.cpp @@ -832,9 +834,9 @@ SET(WebCore_SOURCES dom/WebKitAnimationEvent.cpp dom/WebKitTransitionEvent.cpp dom/WheelEvent.cpp - dom/XMLTokenizer.cpp - dom/XMLTokenizerLibxml2.cpp - dom/XMLTokenizerScope.cpp + dom/XMLDocumentParser.cpp + dom/XMLDocumentParserLibxml2.cpp + dom/XMLDocumentParserScope.cpp dom/default/PlatformMessagePortChannel.cpp @@ -891,6 +893,7 @@ SET(WebCore_SOURCES history/HistoryItem.cpp history/PageCache.cpp + html/AsyncImageResizer.cpp html/Blob.cpp html/CollectionCache.cpp html/DOMDataGridDataSource.cpp @@ -901,8 +904,9 @@ SET(WebCore_SOURCES html/File.cpp html/FileList.cpp html/FormDataList.cpp + html/HTML5EntityParser.cpp html/HTML5Lexer.cpp - html/HTML5Tokenizer.cpp + html/HTML5DocumentParser.cpp html/HTML5TreeBuilder.cpp html/HTML5ScriptRunner.cpp html/HTMLAllCollection.cpp @@ -965,7 +969,7 @@ SET(WebCore_SOURCES html/HTMLOptionsCollection.cpp html/HTMLParagraphElement.cpp html/HTMLParamElement.cpp - html/HTMLParser.cpp + html/LegacyHTMLTreeConstructor.cpp html/HTMLParserErrorCodes.cpp html/HTMLPlugInElement.cpp html/HTMLPlugInImageElement.cpp @@ -985,10 +989,11 @@ SET(WebCore_SOURCES html/HTMLTableSectionElement.cpp html/HTMLTextAreaElement.cpp html/HTMLTitleElement.cpp - html/HTMLTokenizer.cpp + html/HTMLDocumentParser.cpp html/HTMLUListElement.cpp html/HTMLViewSourceDocument.cpp html/ImageData.cpp + html/ImageResizerThread.cpp html/LabelsNodeList.cpp html/PreloadScanner.cpp html/StepRange.cpp @@ -1095,6 +1100,7 @@ SET(WebCore_SOURCES page/GeolocationPositionCache.cpp page/History.cpp page/Location.cpp + page/MemoryInfo.cpp page/MouseEventWithHitTestResults.cpp page/Navigator.cpp page/NavigatorBase.cpp @@ -1121,6 +1127,7 @@ SET(WebCore_SOURCES page/animation/KeyframeAnimation.cpp platform/Arena.cpp + platform/BlobItem.cpp platform/ContentType.cpp platform/ContextMenu.cpp platform/CrossThreadCopier.cpp @@ -1130,6 +1137,7 @@ SET(WebCore_SOURCES platform/FileChooser.cpp platform/GeolocationService.cpp platform/KURL.cpp + platform/KillRingNone.cpp platform/Length.cpp platform/LinkHash.cpp platform/Logging.cpp @@ -1257,7 +1265,6 @@ SET(WebCore_SOURCES plugins/PluginDataNone.cpp plugins/PluginMainThreadScheduler.cpp plugins/PluginViewNone.cpp - plugins/npapi.cpp rendering/AutoTableLayout.cpp rendering/BidiRun.cpp @@ -1330,6 +1337,7 @@ SET(WebCore_SOURCES rendering/RenderWordBreak.cpp rendering/RootInlineBox.cpp rendering/ScrollBehavior.cpp + rendering/ShadowElement.cpp rendering/TextControlInnerElements.cpp rendering/TransformState.cpp rendering/break_lines.cpp @@ -1364,12 +1372,13 @@ SET(WebCore_SOURCES storage/DatabaseThread.cpp storage/DatabaseTracker.cpp storage/IDBAny.cpp - storage/IDBDatabase.cpp + storage/IDBDatabaseImpl.cpp storage/IDBDatabaseRequest.cpp storage/IDBErrorEvent.cpp storage/IDBEvent.cpp + storage/IDBKeyRange.cpp storage/IDBRequest.cpp - storage/IDBObjectStore.cpp + storage/IDBObjectStoreImpl.cpp storage/IDBObjectStoreRequest.cpp storage/IDBSuccessEvent.cpp storage/IndexedDatabase.cpp @@ -1729,11 +1738,16 @@ SOURCE_GROUP(wml "wml/") SOURCE_GROUP(workers "workers/") SOURCE_GROUP(xml "xml/") +SET(WebCore_LINK_FLAGS "") INCLUDE_IF_EXISTS(${WEBCORE_DIR}/CMakeLists${PORT}.txt) ADD_DEFINITIONS(-DBUILDING_WebCore) INCLUDE_DIRECTORIES(${WebCore_INCLUDE_DIRECTORIES}) ADD_LIBRARY(${WebCore_LIBRARY_NAME} ${WebCore_LIBRARY_TYPE} ${WebCore_SOURCES}) TARGET_LINK_LIBRARIES(${WebCore_LIBRARY_NAME} ${WebCore_LIBRARIES}) +ADD_TARGET_PROPERTIES(${WebCore_LIBRARY_NAME} LINK_FLAGS ${WebCore_LINK_FLAGS}) -INSTALL(TARGETS ${WebCore_LIBRARY_NAME} DESTINATION lib) + +IF (SHARED_CORE) + INSTALL(TARGETS ${WebCore_LIBRARY_NAME} DESTINATION lib) +ENDIF () diff --git a/WebCore/CMakeListsEfl.txt b/WebCore/CMakeListsEfl.txt index b4667af..1cb6e44 100644 --- a/WebCore/CMakeListsEfl.txt +++ b/WebCore/CMakeListsEfl.txt @@ -1,3 +1,8 @@ +LIST(APPEND WebCore_LINK_FLAGS + ${ECORE_X_LDFLAGS} + ${EFLDEPS_LDFLAGS} +) + LIST(APPEND WebCore_INCLUDE_DIRECTORIES "${JAVASCRIPTCORE_DIR}/wtf/gobject" "${JAVASCRIPTCORE_DIR}/wtf/text" @@ -5,7 +10,7 @@ LIST(APPEND WebCore_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/platform/text/efl" "${WEBCORE_DIR}/platform/graphics/efl" "${WEBCORE_DIR}/page/efl" - "${WEBCORE_DIR}/acessibility/efl" + "${WEBCORE_DIR}/accessibility/efl" "${WEBKIT_DIR}/efl/WebCoreSupport" "${WEBKIT_DIR}/efl/ewk" ) @@ -65,6 +70,7 @@ IF (WTF_PLATFORM_CAIRO) platform/graphics/cairo/FontCairo.cpp platform/graphics/cairo/FontCustomPlatformData.cpp platform/graphics/cairo/FontPlatformDataCairo.cpp + platform/graphics/cairo/GOwnPtrCairo.cpp platform/graphics/cairo/GlyphPageTreeNodeCairo.cpp platform/graphics/cairo/GradientCairo.cpp platform/graphics/cairo/GraphicsContextCairo.cpp diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index 5a1a6c4..7ba9026 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,8234 @@ +2010-06-13 Yael Aharon + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Platform plugin support for Notifications UI + https://bugs.webkit.org/show_bug.cgi?id=40005 + + To avoid race condition when GC is run during shutdown, + disconnect the Notification from the NotificationPresenter + when the presenter deletes itself. + This cannot be tested by a layout test, the race condition happens only + when GC is run during shutdown. It can be tested manually by loading + manually any notification test and closing the browser. + + * notifications/Notification.cpp: + (WebCore::Notification::~Notification): + * notifications/Notification.h: + (WebCore::Notification::detachPresenter): + +2010-06-08 Marcus Bulach + + Reviewed by Jeremy Orlow. + + Adds IndexedDB's KeyRange. + https://bugs.webkit.org/show_bug.cgi?id=40250 + + Test: storage/indexeddb/idb-keyrange.html + + * Android.derived.jscbindings.mk: + * Android.derived.v8bindings.mk: + * Android.mk: + * CMakeLists.txt: + * DerivedSources.cpp: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pri: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * storage/IDBKeyRange.cpp: Added. + (WebCore::IDBKeyRange::IDBKeyRange): + * storage/IDBKeyRange.h: Added. + (WebCore::IDBKeyRange::): + (WebCore::IDBKeyRange::create): + (WebCore::IDBKeyRange::~IDBKeyRange): + (WebCore::IDBKeyRange::left): + (WebCore::IDBKeyRange::right): + (WebCore::IDBKeyRange::flags): + * storage/IDBKeyRange.idl: Added. + * storage/IndexedDatabaseRequest.cpp: + (WebCore::IndexedDatabaseRequest::makeSingleKeyRange): + (WebCore::IndexedDatabaseRequest::makeLeftBoundKeyRange): + (WebCore::IndexedDatabaseRequest::makeRightBoundKeyRange): + (WebCore::IndexedDatabaseRequest::makeBoundKeyRange): + * storage/IndexedDatabaseRequest.h: + * storage/IndexedDatabaseRequest.idl: + +2010-06-14 Jeremy Orlow + + And another. + + * storage/IndexedDatabaseRequest.h: + +2010-06-14 Jeremy Orlow + + More build fixes. + + * storage/IndexedDatabaseRequest.h: + +2010-06-14 Mahesh Kulkarni + + Reviewed by Laszlo Gombos. + + [Qt] navigator.geolocation support for Qt port + https://bugs.webkit.org/show_bug.cgi?id=39724 + + Implemetion for Qt port of navigator.gelocation. Using qtmobility location service. + + * WebCore.pri: + * WebCore.pro: + * platform/qt/GeolocationServiceQt.cpp: Added. + (WebCore::GeolocationServiceQt::create): + (WebCore::GeolocationServiceQt::GeolocationServiceQt): + (WebCore::GeolocationServiceQt::~GeolocationServiceQt): + (WebCore::GeolocationServiceQt::positionUpdated): + (WebCore::GeolocationServiceQt::startUpdating): + (WebCore::GeolocationServiceQt::stopUpdating): + * platform/qt/GeolocationServiceQt.h: Added. + (WebCore::GeolocationServiceQt::lastPosition): + (WebCore::GeolocationServiceQt::lastError): + +2010-06-14 Jeremy Orlow + + 2 more build fixes. + + * storage/IDBDatabaseImpl.h: + * storage/IndexedDatabaseRequest.h: + +2010-06-14 Jeremy Orlow + + Unreviewed build fix for my last. + + * workers/WorkerScriptLoaderClient.h: + +2010-06-14 Jeremy Orlow + + Reviewed by Darin Fisher. + + [V8] Clean up SerializedScriptValue + https://bugs.webkit.org/show_bug.cgi?id=40482 + + SerializedScriptValue doesn't follow WebKit's style guidelines very well + and needlessly inlines quite a bit within the .h file. This change cleans + things up. No funcitonal changes. + + No change in behavior. + + * bindings/v8/SerializedScriptValue.cpp: + (WebCore::SerializedScriptValue::deserializeAndSetProperty): + (WebCore::SerializedScriptValue::create): + (WebCore::SerializedScriptValue::createFromWire): + (WebCore::SerializedScriptValue::release): + (WebCore::SerializedScriptValue::SerializedScriptValue): + * bindings/v8/SerializedScriptValue.h: + +2010-06-14 Ilya Tikhonovsky + + Reviewed by Pavel Feldman. + + WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc + data from inspected page to WebInspector as JSON string via http. The native + serialization to JSON string is supported by InspectorValue's classes. This patch + has the implementation of sendMessageToFrontend function. WebKit version of it still + uses ScriptFunctionCall and will be switched to another transport a little bit later. + https://bugs.webkit.org/show_bug.cgi?id=40134 + + * inspector/InspectorClient.h: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::connectFrontend): + (WebCore::InspectorController::disconnectFrontend): + * inspector/InspectorController.h: + * inspector/InspectorFrontend.cpp: + (WebCore::InspectorFrontend::InspectorFrontend): + * inspector/InspectorFrontend.h: + * inspector/InspectorFrontendClientLocal.cpp: + (WebCore::InspectorFrontendClientLocal::frontendLoaded): + * inspector/InspectorValues.cpp: + (WebCore::InspectorObject::writeJSON): + * inspector/front-end/inspector.js: + (WebInspector.dispatchMessageToFrontend): + * loader/EmptyClients.h: + (WebCore::EmptyInspectorClient::sendMessageToFrontend): + +2010-06-14 Jeremy Orlow + + Reviewed by Darin Adler. + + Reenable IDBDatabaseRequest's description attribute + https://bugs.webkit.org/show_bug.cgi?id=39826 + + On the 26th, Beth commented out the description attribute in + IDBDatabaseRequest because it was causing problems with the + objective c bindings. Turns out that this is the same bug as + in http://trac.webkit.org/changeset/19486. (Thanks for the + pointer, Mark!) + + The solution is to change the objective C bindings generator + to change the name in the generated code. id and hash both + just appended "Name" to them in the past. I couldn't think + of anything else particularly better to append, so I just + went with name as well. + + Test: building the world works on the first try. Layout + test verifies description works again. + + * bindings/scripts/CodeGeneratorObjC.pm: + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: + (webkit_dom_test_obj_get_description): + (webkit_dom_test_obj_get_id): + (webkit_dom_test_obj_set_id): + (webkit_dom_test_obj_get_hash): + (webkit_dom_test_obj_set_property): + (webkit_dom_test_obj_get_property): + (webkit_dom_test_obj_class_init): + * bindings/scripts/test/GObject/WebKitDOMTestObj.h: + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore::): + (WebCore::jsTestObjDescription): + (WebCore::jsTestObjId): + (WebCore::jsTestObjHash): + (WebCore::setJSTestObjId): + * bindings/scripts/test/JS/JSTestObj.h: + * bindings/scripts/test/ObjC/DOMTestObj.h: + * bindings/scripts/test/ObjC/DOMTestObj.mm: + (-[DOMTestObj descriptionName]): + (-[DOMTestObj idName]): + (-[DOMTestObj setIdName:]): + (-[DOMTestObj hashName]): + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjInternal::descriptionAttrGetter): + (WebCore::TestObjInternal::idAttrGetter): + (WebCore::TestObjInternal::idAttrSetter): + (WebCore::TestObjInternal::hashAttrGetter): + (WebCore::): + * storage/IDBDatabaseRequest.idl: + +2010-06-13 Anders Bakken + + Reviewed by Eric Seidel. + + [Qt] ScreenQt.cpp has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=39766 + + * platform/qt/ScreenQt.cpp: + +2010-06-13 Eric Seidel + + Reviewed by Adam Barth. + + Rename HTMLParser to LegacyHTMLTreeConstructor + https://bugs.webkit.org/show_bug.cgi?id=40554 + + This makes our old HTML parsing system closer match the + HTML5 spec, and thus easier to compare to the new HTML5 + parsing system. + + This rename was entirely automatic. Done by do-webcore-rename. + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * dom/Document.cpp: + * dom/DocumentParser.h: + (WebCore::DocumentParser::htmlTreeConstructor): + * html/HTML5DocumentParser.cpp: + (WebCore::HTML5DocumentParser::htmlTreeConstructor): + * html/HTML5DocumentParser.h: + * html/HTML5TreeBuilder.cpp: + (WebCore::HTML5TreeBuilder::HTML5TreeBuilder): + * html/HTML5TreeBuilder.h: + (WebCore::HTML5TreeBuilder::legacyTreeConstructor): + * html/HTMLDocumentParser.cpp: + (WebCore::HTMLDocumentParser::HTMLDocumentParser): + * html/HTMLDocumentParser.h: + (WebCore::HTMLDocumentParser::htmlTreeConstructor): + * html/HTMLFormControlElement.cpp: + (WebCore::HTMLFormControlElement::removedFromTree): + * html/HTMLInputElement.cpp: + * html/HTMLMeterElement.cpp: + * html/HTMLProgressElement.cpp: + * html/LegacyHTMLTreeConstructor.cpp: Renamed from WebCore/html/HTMLParser.cpp. + (WebCore::addTags): + (WebCore::HTMLStackElem::HTMLStackElem): + (WebCore::HTMLStackElem::derefNode): + (WebCore::LegacyHTMLTreeConstructor::LegacyHTMLTreeConstructor): + (WebCore::LegacyHTMLTreeConstructor::~LegacyHTMLTreeConstructor): + (WebCore::LegacyHTMLTreeConstructor::reset): + (WebCore::LegacyHTMLTreeConstructor::setCurrent): + (WebCore::tagPriorityOfNode): + (WebCore::LegacyHTMLTreeConstructor::limitDepth): + (WebCore::LegacyHTMLTreeConstructor::insertNodeAfterLimitDepth): + (WebCore::LegacyHTMLTreeConstructor::parseToken): + (WebCore::LegacyHTMLTreeConstructor::parseDoctypeToken): + (WebCore::isTableSection): + (WebCore::isTablePart): + (WebCore::isTableRelated): + (WebCore::isScopingTag): + (WebCore::LegacyHTMLTreeConstructor::insertNode): + (WebCore::LegacyHTMLTreeConstructor::handleError): + (WebCore::LegacyHTMLTreeConstructor::textCreateErrorCheck): + (WebCore::LegacyHTMLTreeConstructor::commentCreateErrorCheck): + (WebCore::LegacyHTMLTreeConstructor::headCreateErrorCheck): + (WebCore::LegacyHTMLTreeConstructor::bodyCreateErrorCheck): + (WebCore::LegacyHTMLTreeConstructor::framesetCreateErrorCheck): + (WebCore::LegacyHTMLTreeConstructor::formCreateErrorCheck): + (WebCore::LegacyHTMLTreeConstructor::isindexCreateErrorCheck): + (WebCore::LegacyHTMLTreeConstructor::selectCreateErrorCheck): + (WebCore::LegacyHTMLTreeConstructor::ddCreateErrorCheck): + (WebCore::LegacyHTMLTreeConstructor::dtCreateErrorCheck): + (WebCore::LegacyHTMLTreeConstructor::rpCreateErrorCheck): + (WebCore::LegacyHTMLTreeConstructor::rtCreateErrorCheck): + (WebCore::LegacyHTMLTreeConstructor::nestedCreateErrorCheck): + (WebCore::LegacyHTMLTreeConstructor::nestedPCloserCreateErrorCheck): + (WebCore::LegacyHTMLTreeConstructor::nestedStyleCreateErrorCheck): + (WebCore::LegacyHTMLTreeConstructor::tableCellCreateErrorCheck): + (WebCore::LegacyHTMLTreeConstructor::tableSectionCreateErrorCheck): + (WebCore::LegacyHTMLTreeConstructor::noembedCreateErrorCheck): + (WebCore::LegacyHTMLTreeConstructor::noframesCreateErrorCheck): + (WebCore::LegacyHTMLTreeConstructor::noscriptCreateErrorCheck): + (WebCore::LegacyHTMLTreeConstructor::pCloserCreateErrorCheck): + (WebCore::LegacyHTMLTreeConstructor::pCloserStrictCreateErrorCheck): + (WebCore::LegacyHTMLTreeConstructor::mapCreateErrorCheck): + (WebCore::mapTagToFunc): + (WebCore::mapTagsToFunc): + (WebCore::LegacyHTMLTreeConstructor::getNode): + (WebCore::LegacyHTMLTreeConstructor::allowNestedRedundantTag): + (WebCore::LegacyHTMLTreeConstructor::processCloseTag): + (WebCore::LegacyHTMLTreeConstructor::isHeadingTag): + (WebCore::LegacyHTMLTreeConstructor::isInline): + (WebCore::LegacyHTMLTreeConstructor::isResidualStyleTag): + (WebCore::LegacyHTMLTreeConstructor::isAffectedByResidualStyle): + (WebCore::LegacyHTMLTreeConstructor::handleResidualStyleCloseTagAcrossBlocks): + (WebCore::LegacyHTMLTreeConstructor::reopenResidualStyleTags): + (WebCore::LegacyHTMLTreeConstructor::pushBlock): + (WebCore::LegacyHTMLTreeConstructor::popBlock): + (WebCore::LegacyHTMLTreeConstructor::popOneBlockCommon): + (WebCore::LegacyHTMLTreeConstructor::popOneBlock): + (WebCore::LegacyHTMLTreeConstructor::moveOneBlockToStack): + (WebCore::LegacyHTMLTreeConstructor::checkIfHasPElementInScope): + (WebCore::LegacyHTMLTreeConstructor::popInlineBlocks): + (WebCore::LegacyHTMLTreeConstructor::freeBlock): + (WebCore::LegacyHTMLTreeConstructor::createHead): + (WebCore::LegacyHTMLTreeConstructor::handleIsindex): + (WebCore::LegacyHTMLTreeConstructor::startBody): + (WebCore::LegacyHTMLTreeConstructor::finished): + (WebCore::LegacyHTMLTreeConstructor::reportErrorToConsole): + (WebCore::shouldCreateImplicitHead): + (WebCore::serializeForNumberType): + (WebCore::parseToDoubleForNumberType): + * html/LegacyHTMLTreeConstructor.h: Renamed from WebCore/html/HTMLParser.h. + (WebCore::LegacyHTMLTreeConstructor::skipMode): + (WebCore::LegacyHTMLTreeConstructor::isHandlingResidualStyleAcrossBlocks): + (WebCore::LegacyHTMLTreeConstructor::setSkipMode): + (WebCore::LegacyHTMLTreeConstructor::popBlock): + (WebCore::LegacyHTMLTreeConstructor::hasPElementInScope): + (WebCore::LegacyHTMLTreeConstructor::reportError): + (WebCore::LegacyHTMLTreeConstructor::): + (WebCore::shouldCreateImplicitHead): + * html/StepRange.cpp: + * html/ValidityState.cpp: + * rendering/RenderSlider.cpp: + +2010-06-13 Eric Seidel + + Reviewed by Darin Adler. + + Rename m_parser, htmlParser() to m_treeConstructor, htmlTreeConstructor() in preparation for renaming HTMLParser + https://bugs.webkit.org/show_bug.cgi?id=40514 + + This rename was done by hand. I realize now I should have + renamed HTMLParser to HTMLTreeConstructor before renaming HTMLTokenizer. + + No functional changes, thus no tests. + + * dom/DocumentParser.h: + (WebCore::DocumentParser::htmlTreeConstructor): + * html/HTML5DocumentParser.cpp: + (WebCore::HTML5DocumentParser::HTML5DocumentParser): + (WebCore::HTML5DocumentParser::pumpLexerIfPossible): + (WebCore::HTML5DocumentParser::pumpLexer): + (WebCore::HTML5DocumentParser::end): + (WebCore::HTML5DocumentParser::htmlTreeConstructor): + (WebCore::HTML5DocumentParser::isWaitingForScripts): + (WebCore::HTML5DocumentParser::resumeParsingAfterScriptExecution): + (WebCore::HTML5DocumentParser::notifyFinished): + (WebCore::HTML5DocumentParser::executeScriptsWaitingForStylesheets): + * html/HTML5DocumentParser.h: + * html/HTML5TreeBuilder.cpp: + (WebCore::HTML5TreeBuilder::HTML5TreeBuilder): + (WebCore::HTML5TreeBuilder::passTokenToLegacyParser): + (WebCore::HTML5TreeBuilder::finished): + * html/HTML5TreeBuilder.h: + (WebCore::HTML5TreeBuilder::legacyTreeConstructor): + * html/HTMLDocumentParser.cpp: + (WebCore::HTMLDocumentParser::HTMLDocumentParser): + (WebCore::HTMLDocumentParser::scriptHandler): + (WebCore::HTMLDocumentParser::parseTag): + (WebCore::HTMLDocumentParser::end): + (WebCore::HTMLDocumentParser::processToken): + (WebCore::HTMLDocumentParser::processDoctypeToken): + * html/HTMLDocumentParser.h: + (WebCore::HTMLDocumentParser::htmlTreeConstructor): + * html/HTMLFormControlElement.cpp: + (WebCore::HTMLFormControlElement::removedFromTree): + +2010-06-13 Eric Seidel + + Reviewed by Darin Adler. + + Rename tok, asHTMLTokenizer to parser, asHTMLDocumentParser + https://bugs.webkit.org/show_bug.cgi?id=40513 + + Last set of Tokenizer related renames, also done via do-webcore-rename: + asHTMLTokenizer => asHTMLDocumentParser + tok => parser + + No functional changes, thus no tests. + + * dom/Document.cpp: + (WebCore::Document::write): + * dom/DocumentParser.h: + (WebCore::DocumentParser::asHTMLDocumentParser): + * html/HTMLDocumentParser.cpp: + (WebCore::parseHTMLDocumentFragment): + * html/HTMLDocumentParser.h: + (WebCore::HTMLDocumentParser::asHTMLDocumentParser): + * loader/DocumentLoader.cpp: + (WebCore::DocumentLoader::isLoadingInAPISense): + +2010-06-13 Eric Seidel + + Reviewed by Darin Adler. + + Fix the rest of the references to the old Tokenizer class (now DocumentParser) + https://bugs.webkit.org/show_bug.cgi?id=40512 + + No functional changes, thus no new tests. + This was mostly done by do-webcore-rename: + tokenizer => parser + m_tokenizer => m_parser + createTextTokenizer => createTextDocumentParser + createTokenizer => createParser + getTokenizer => getParser + + However had to be careful to avoid renaming things related to + css/tokenizer.flex (which we should later rename to CSSTokenizer.flex) + + Still a couple references with "tok" and "asHTMLTokenizer" which I'll + get in the next patch. + + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::isLoaded): + * bindings/v8/ScriptEventListener.cpp: + (WebCore::createAttributeEventListener): + * dom/Document.cpp: + (WebCore::Document::removedLastRef): + (WebCore::Document::~Document): + (WebCore::Document::createParser): + (WebCore::Document::open): + (WebCore::Document::cancelParsing): + (WebCore::Document::implicitOpen): + (WebCore::Document::implicitClose): + (WebCore::Document::write): + (WebCore::Document::finishParsing): + (WebCore::Document::removePendingSheet): + * dom/Document.h: + (WebCore::Document::parser): + * dom/DocumentParser.h: + * dom/ViewportArguments.cpp: + (WebCore::reportViewportWarning): + * dom/XMLDocumentParserLibxml2.cpp: + (WebCore::PendingCallbacks::callAndRemoveFirstCallback): + (WebCore::PendingCallbacks::PendingStartElementNSCallback::call): + (WebCore::PendingCallbacks::PendingEndElementNSCallback::call): + (WebCore::PendingCallbacks::PendingCharactersCallback::call): + (WebCore::PendingCallbacks::PendingProcessingInstructionCallback::call): + (WebCore::PendingCallbacks::PendingCDATABlockCallback::call): + (WebCore::PendingCallbacks::PendingCommentCallback::call): + (WebCore::PendingCallbacks::PendingInternalSubsetCallback::call): + (WebCore::PendingCallbacks::): + (WebCore::getParser): + (WebCore::startElementNsHandler): + (WebCore::endElementNsHandler): + (WebCore::charactersHandler): + (WebCore::processingInstructionHandler): + (WebCore::cdataBlockHandler): + (WebCore::commentHandler): + (WebCore::warningHandler): + (WebCore::fatalErrorHandler): + (WebCore::normalErrorHandler): + (WebCore::getEntityHandler): + (WebCore::startDocumentHandler): + (WebCore::endDocumentHandler): + (WebCore::internalSubsetHandler): + (WebCore::externalSubsetHandler): + (WebCore::parseXMLDocumentFragment): + * dom/XMLDocumentParserQt.cpp: + (WebCore::parseXMLDocumentFragment): + * html/HTML5EntityParser.cpp: + * html/HTMLDocument.cpp: + (WebCore::HTMLDocument::createParser): + * html/HTMLDocument.h: + * html/HTMLDocumentParser.cpp: + (WebCore::HTMLDocumentParser::write): + (WebCore::HTMLDocumentParser::stopParsing): + * html/HTMLFormControlElement.cpp: + (WebCore::HTMLFormControlElement::removedFromTree): + * html/HTMLParser.cpp: + (WebCore::HTMLParser::finished): + (WebCore::HTMLParser::reportErrorToConsole): + * html/HTMLViewSourceDocument.cpp: + (WebCore::HTMLViewSourceDocument::createParser): + (WebCore::HTMLViewSourceDocument::addLine): + * html/HTMLViewSourceDocument.h: + * loader/DocumentLoader.cpp: + (WebCore::DocumentLoader::isLoadingInAPISense): + * loader/DocumentWriter.cpp: + (WebCore::DocumentWriter::begin): + (WebCore::DocumentWriter::addData): + * loader/FTPDirectoryDocument.cpp: + (WebCore::FTPDirectoryDocument::createParser): + * loader/FTPDirectoryDocument.h: + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::stopLoading): + (WebCore::FrameLoader::stop): + * loader/ImageDocument.cpp: + (WebCore::ImageDocument::createParser): + * loader/ImageDocument.h: + * loader/MediaDocument.cpp: + (WebCore::MediaDocument::createParser): + * loader/MediaDocument.h: + * loader/PluginDocument.cpp: + (WebCore::PluginDocument::createParser): + * loader/PluginDocument.h: + * loader/SinkDocument.cpp: + (WebCore::SinkDocument::createParser): + * loader/SinkDocument.h: + * loader/TextDocument.cpp: + (WebCore::TextDocument::createParser): + (WebCore::createTextDocumentParser): + * loader/TextDocument.h: + * svg/SVGDocumentExtensions.cpp: + (WebCore::SVGDocumentExtensions::reportWarning): + (WebCore::SVGDocumentExtensions::reportError): + * wml/WMLDocument.cpp: + (WebCore::WMLDocument::finishedParsing): + * wml/WMLErrorHandling.cpp: + (WebCore::reportWMLError): + * wml/WMLTemplateElement.cpp: + (WebCore::WMLTemplateElement::registerTemplatesInDocument): + +2010-06-13 Chris Fleizach + + Reviewed by Darin Adler. + + AX: link won't return linked element if URL contains # + https://bugs.webkit.org/show_bug.cgi?id=40192 + + Test: platform/mac/accessibility/internal-link-when-document-has-fragment.html + + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::internalLinkElement): + +2010-06-13 Sam Weinig + + Try and fix the chrome build. + + * bindings/scripts/CodeGeneratorV8.pm: + * xml/XMLHttpRequest.idl: + +2010-06-13 Sam Weinig + + Reviewed by Anders Carlsson. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=40550 + XMLHttpRequest constructor object should expose the constants from the IDL. + + Test: fast/dom/XMLHttpRequest-constants.html + + * Android.jscbindings.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSBindingsAllInOne.cpp: + * bindings/js/JSDOMWindowCustom.cpp: + * bindings/js/JSWorkerContextCustom.cpp: + * bindings/js/JSXMLHttpRequestConstructor.cpp: Removed. + * bindings/js/JSXMLHttpRequestConstructor.h: Removed. + * bindings/js/JSXMLHttpRequestCustom.cpp: + (WebCore::JSXMLHttpRequestConstructor::constructJSXMLHttpRequest): + * bindings/scripts/CodeGeneratorJS.pm: + * xml/XMLHttpRequest.idl: + +2010-06-13 Simon Fraser + + Reviewed by Dan Bernstein. + + -webkit-transition font-size and font-family + https://bugs.webkit.org/show_bug.cgi?id=33429 + + When animating font-size, update the font with a saved + version of the font selector to ensure that we don't clobber + the font family. + + Test: transitions/font-family-during-transition.html + + * rendering/style/RenderStyle.cpp: + (WebCore::RenderStyle::setBlendedFontSize): + +2010-06-13 Tony Chang + + Build fix, not reviewed. + + fix chromium compile after r61094 (id attribute refactor) + https://bugs.webkit.org/show_bug.cgi?id=40553 + + * bindings/v8/custom/V8NamedNodesCollection.cpp: + (WebCore::V8NamedNodesCollection::itemWithName): + +2010-06-13 Darin Adler + + Reviewed by Alexey Proskuryakov. + + Partly done support for alternate ID attributes should be removed + https://bugs.webkit.org/show_bug.cgi?id=39692 + + Removed the include of "HTMLNames.h" from "Element.h". This prevents + near-world-rebuilds every time you change HTMLTagNames.in. + + Renamed the getIDAttribute function in the Element class to + idForStyleResolution, since it returns a value of the id attribute + that has been lowercased as appropriate for style matching, not the + actual value of the attribute. With the old name it was easy to + misuse it in non-style contexts. + + Got rid of the idAttributeName function on Element, since it is + easy to use it wrong. Replace it with isIdAttributeName, getIdAttribute, + and setIdAttribute functions, which are a good fit for the needs of + most call sites that were dealing with the id attribute. + + Added an idAttributeName function to Document. This is for a future + where a document can have a custom id attribute name specified in its + doctype. It's possible this will be insufficient because the same + document might have XHTML or SVG elements in it, and it's possible + that on those elements we will want the attribute named "id" with + no namespace to still work. We can deal with that when we implement + the actual feature, though. For now, it seems OK to fetch the name + of the id attribute from the document. + + * dom/DynamicNodeList.cpp: + (WebCore::DynamicNodeList::itemWithName): + * dom/StaticNodeList.cpp: + (WebCore::StaticNodeList::itemWithName): + * rendering/RenderSVGResourceContainer.h: + (WebCore::RenderSVGResourceContainer::RenderSVGResourceContainer): + (WebCore::RenderSVGResourceContainer::idChanged): + * svg/SVGUseElement.cpp: + (WebCore::SVGUseElement::handleDeepUseReferencing): + * svg/animation/SMILTimeContainer.cpp: + (WebCore::SMILTimeContainer::updateAnimations): + Use the new idForStyleResolution function, which is the new name of + the getIDAttribute function. There's a good chance these call sites are + incorrect, which is something we should investigate later, so there's + a FIXME at each call site. + + * dom/Document.cpp: + (WebCore::Document::Document): Initialize m_idAttributeName to the + standard id attribute from HTML. + (WebCore::Document::getElementById): Use Element::getIdAttribute. + * dom/Document.h: Added Document::idAttributeName. + + * dom/Element.cpp: + (WebCore::Element::setAttribute): Use Document::idAttributeName. + (WebCore::Element::setAttributeMap): Use Element::isIdAttributeName. + (WebCore::Element::insertedIntoDocument): Use Document::idAttributeName. + (WebCore::Element::removedFromDocument): Ditto. + (WebCore::Element::formatForDebugger): Use Element::getIdAttribute. + * dom/Element.h: Added isIdAttributeName, getIdAttribute, setIdAttribute, + idForStyleResolution. Removed rareIDAttributeName. + + * dom/ElementRareData.h: Removed m_idAttributeName. + + * dom/NamedNodeMap.cpp: + (WebCore::NamedNodeMap::setAttributes): Use Document::idAttributeName. + * dom/NamedNodeMap.h: Renamed id, setID, and m_id to idForStyleResolution, + setIdForStyleResolution, and m_idForStyleResolution since this is not the + value of the id attribute because it gets lowercased for compatibility-mode + documents. + + * rendering/RenderIFrame.cpp: + * rendering/RenderLayerCompositor.cpp: + * rendering/RenderProgress.cpp: + Added include of HTMLNames.h now that Element.h no longer includes it. + + * editing/SetNodeAttributeCommand.h: + * editing/markup.cpp: + * html/HTMLParser.cpp: + Removed unneeded includes. + + * html/HTMLParser.h: Sorted includes. + + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::matchRules): Use idForStyleResolution. + (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): Use idForStyleResolution. + * dom/Attr.cpp: + (WebCore::Attr::isId): Use Document::idAttributeName. + * dom/StyledElement.cpp: + (WebCore::StyledElement::parseMappedAttribute): Use isIdAttributeName, + and setIdForStyleResolution. + * editing/DeleteButtonController.cpp: + (WebCore::DeleteButtonController::createDeletionUI): Use setIdAttribute. + * editing/EditorCommand.cpp: + (WebCore::executeInsertHorizontalRule): Ditto. + * html/HTMLAppletElement.cpp: + (WebCore::HTMLAppletElement::parseMappedAttribute): Use isIdAttributeName. + (WebCore::HTMLAppletElement::createRenderer): Use getIdAttribute. + * html/HTMLCollection.cpp: + (WebCore::HTMLCollection::checkForNameMatch): Use getIdAttribute. + (WebCore::HTMLCollection::updateNameCache): Use getIdAttribute. + * html/HTMLDataGridColElement.cpp: + (WebCore::HTMLDataGridColElement::ensureColumn): Use getIdAttribute. + (WebCore::HTMLDataGridColElement::parseMappedAttribute): Use isIdAttributeName. + * html/HTMLElement.cpp: + (WebCore::HTMLElement::parseMappedAttribute): Use isIdAttributeName. + * html/HTMLFormCollection.cpp: + (WebCore::HTMLFormCollection::nextNamedItem): Added missing braces. + (WebCore::HTMLFormCollection::updateNameCache): Use getIdAttribute. + * html/HTMLFrameElementBase.cpp: + (WebCore::HTMLFrameElementBase::parseMappedAttribute): Use isIdAttributeName. + (WebCore::HTMLFrameElementBase::setName): Use getIdAttribute. + * html/HTMLImageElement.cpp: + (WebCore::HTMLImageElement::parseMappedAttribute): Use isIdAttributeName. + * html/HTMLMapElement.cpp: + (WebCore::HTMLMapElement::parseMappedAttribute): Use isIdAttributeName. + Also restructured the function a bit to make its structure clearer and added + a comment pointing out that it can't be quite right. + * html/HTMLNameCollection.cpp: + (WebCore::HTMLNameCollection::itemAfter): Use getIdAttribute. + * html/HTMLObjectElement.cpp: + (WebCore::HTMLObjectElement::parseMappedAttribute): Use isIdAttributeName. + * html/HTMLParamElement.cpp: + (WebCore::HTMLParamElement::parseMappedAttribute): Use isIdAttributeName. + * loader/CachedFont.cpp: + (WebCore::CachedFont::getSVGFontById): Use getIdAttribute. + * rendering/RenderLayerBacking.cpp: + (WebCore::RenderLayerBacking::nameForLayer): Use getIdAttribute. + * rendering/SVGRenderTreeAsText.cpp: + (WebCore::writeSVGPaintingResource): Use getIdAttribute. + (WebCore::writeSVGResourceContainer): Ditto. + * svg/SVGElement.cpp: + (WebCore::SVGElement::insertedIntoDocument): Use getIdAttribute. + * svg/SVGStyledElement.cpp: + (WebCore::SVGStyledElement::isKnownAttribute): Use isIdAttributeName. + (WebCore::SVGStyledElement::svgAttributeChanged): Use isIdAttributeName. + * wml/WMLElement.cpp: + (WebCore::WMLElement::parseMappedAttribute): Use isIdAttributeName. + +2010-06-13 Dan Bernstein + + Reviewed by Darin Adler. + + REGRESSION (r60974): Continuous wheel scrolling is too fast in list boxes and in Safari Reader + https://bugs.webkit.org/show_bug.cgi?id=40537 + + * platform/mac/WheelEventMac.mm: + (WebCore::PlatformWheelEvent::PlatformWheelEvent): Only multiply by pixelsPerLineStep() if the + event is not continuous, as was before r56012. + +2010-06-13 Andras Becsi + + Reviewed by Darin Adler. + + Centralize the gperf code generation commands into make-hash-tools.pl + to avoid redundancy across multiple build systems. + Do this in preparation of refactoring the usage of these generated + sources to fix the debug linking error on Linux with gcc >= 4.4.0. + + webkit.org/b/29244 + + No functionality change, so no new tests needed. + + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.gyp/WebCore.gyp: + * WebCore.gyp/scripts/rule_gperf.py: Removed. + * WebCore.pri: + * WebCore.xcodeproj/project.pbxproj: + * css/CSSParser.cpp: + (WebCore::cssPropertyID): + (WebCore::cssValueKeywordID): + * css/makeprop.pl: + * css/makevalues.pl: + * html/DocTypeStrings.gperf: + * html/HTML5EntityParser.cpp: + * html/HTMLDocumentParser.cpp: + * html/HTMLEntityNames.gperf: + * html/PreloadScanner.cpp: + * make-hash-tools.pl: Added. + * platform/ColorData.gperf: + * platform/graphics/Color.cpp: + +2010-06-13 Noam Rosenthal + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] tests/hybridPixmap fails + https://bugs.webkit.org/show_bug.cgi?id=37316 + + The problem was that JSC::Instance::createRuntimeObject was never called. + This is fixed by overloading newRuntimeObject and calling Instance::createRuntimeObject + in between, instead of creating the runtime object directly inside the static function + QtPixmapInstance::createRuntimeObject, which had to be renamed as to not overshadow the virtual function. + + This fixes an existing test, tests/hybridPixmap + + * bridge/qt/qt_pixmapruntime.cpp: + (JSC::Bindings::QtPixmapInstance::newRuntimeObject): + (JSC::Bindings::QtPixmapInstance::createPixmapRuntimeObject): + * bridge/qt/qt_pixmapruntime.h: + * bridge/qt/qt_runtime.cpp: + (JSC::Bindings::convertQVariantToValue): + +2010-06-13 Noam Rosenthal + + Reviewed by Darin Adler. + + GraphicsContext3D.h in the Qt port includes too many unnecessary files + https://bugs.webkit.org/show_bug.cgi?id=40536 + + Removed unncessary includes. + + No new tests; Compilation improvement. + + * platform/graphics/GraphicsContext3D.h: + * platform/graphics/qt/GraphicsContext3DQt.cpp: + +2010-06-13 Noam Rosenthal + + Reviewed by Eric Seidel. + + [Qt] GraphicsLayer: recaching images creates an unnecessary deep copy + https://bugs.webkit.org/show_bug.cgi?id=40535 + + Made sure the painter ends its operation before copying the pixmap. + + No new tests: this is an optimization. + + * platform/graphics/qt/GraphicsLayerQt.cpp: + (WebCore::GraphicsLayerQtImpl::recache): + +2010-06-13 Clemmitt Sigler + + Reviewed by Eric Seidel. + + Patch to fix missing references to RenderMathMLRoot, + RenderMathMLSquareRoot when building GtkLauncher. + https://bugs.webkit.org/show_bug.cgi?id=40326 + + No change in functionality so no new tests. + + * GNUmakefile.am: + +2010-06-12 Brian Weinstein + + Reviewed by Dan Bernstein. + + https://bugs.webkit.org/show_bug.cgi?id=40538 + + Some machines have started to see the return of the dreaded: WebCore.lib : fatal error LNK1106: invalid + file or disk full. Since we don't have the hotfix for VS2005, work around this in the meantime + by creating an EditingAllInOne file, that includes all of the cpp files in the editing subdirectory. + + * WebCore.vcproj/WebCore.vcproj: Prevnt the editing cpp from building, so we only compile EditingAllInOne. + * editing/EditingAllInOne.cpp: Added. Includes all of the editing cpp files. + +2010-06-12 Sheriff Bot + + Unreviewed, rolling out r61031. + http://trac.webkit.org/changeset/61031 + https://bugs.webkit.org/show_bug.cgi?id=40539 + + Crashes Dromaeo jslib test in Release Chromium (Requested by + dimich_ on #webkit). + + * bindings/v8/V8Binding.cpp: + (WebCore::v8ExternalString): + * bindings/v8/V8Binding.h: + +2010-06-12 Eric Seidel + + Reviewed by Adam Barth. + + Rename the last few *Tokenizer classes (which don't have their own files) to *DocumentParser + https://bugs.webkit.org/show_bug.cgi?id=40508 + + This was a very simple do-webcore-rename-generated patch. + + PluginTokenizer => PluginDocumentParser + TextTokenizer => TextDocumentParser + SinkTokenizer => SinkDocumentParser + MediaTokenizer => MediaDocumentParser + FTPDirectoryTokenizer => FTPDirectoryDocumentParser + + No functional changes, thus no tests. + + * html/HTMLViewSourceDocument.cpp: + (WebCore::HTMLViewSourceDocument::createTokenizer): + * html/HTMLViewSourceDocument.h: + * loader/FTPDirectoryDocument.cpp: + (WebCore::FTPDirectoryDocumentParser::FTPDirectoryDocumentParser): + (WebCore::FTPDirectoryDocumentParser::appendEntry): + (WebCore::FTPDirectoryDocumentParser::createTDForFilename): + (WebCore::FTPDirectoryDocumentParser::parseAndAppendOneLine): + (WebCore::FTPDirectoryDocumentParser::loadDocumentTemplate): + (WebCore::FTPDirectoryDocumentParser::createBasicDocument): + (WebCore::FTPDirectoryDocumentParser::write): + (WebCore::FTPDirectoryDocumentParser::finish): + (WebCore::FTPDirectoryDocument::createTokenizer): + * loader/MediaDocument.cpp: + (WebCore::MediaDocumentParser::MediaDocumentParser): + (WebCore::MediaDocumentParser::write): + (WebCore::MediaDocumentParser::createDocumentStructure): + (WebCore::MediaDocumentParser::writeRawData): + (WebCore::MediaDocumentParser::finish): + (WebCore::MediaDocumentParser::isWaitingForScripts): + (WebCore::MediaDocument::createTokenizer): + * loader/PluginDocument.cpp: + (WebCore::PluginDocumentParser::PluginDocumentParser): + (WebCore::PluginDocumentParser::pluginWidgetFromDocument): + (WebCore::PluginDocumentParser::write): + (WebCore::PluginDocumentParser::createDocumentStructure): + (WebCore::PluginDocumentParser::writeRawData): + (WebCore::PluginDocumentParser::finish): + (WebCore::PluginDocumentParser::isWaitingForScripts): + (WebCore::PluginDocument::createTokenizer): + (WebCore::PluginDocument::pluginWidget): + * loader/SinkDocument.cpp: + (WebCore::SinkDocumentParser::SinkDocumentParser): + (WebCore::SinkDocumentParser::finish): + (WebCore::SinkDocument::createTokenizer): + * loader/TextDocument.cpp: + (WebCore::TextDocumentParser::TextDocumentParser): + (WebCore::TextDocumentParser::~TextDocumentParser): + (WebCore::TextDocumentParser::write): + (WebCore::TextDocumentParser::finish): + (WebCore::TextDocumentParser::isWaitingForScripts): + (WebCore::TextDocument::createTokenizer): + (WebCore::createTextTokenizer): + +2010-06-12 Anders Bakken + + Reviewed by Eric Seidel. + + [Qt] EventHandlerQt.cpp has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=40259 + + Coding style change only. + + * page/qt/EventHandlerQt.cpp: + (WebCore::EventHandler::eventActivatedView): + +2010-06-12 Kwang Yul Seo + + Reviewed by Darin Adler. + + Unify fileSystemRepresentation and filenameFromString + https://bugs.webkit.org/show_bug.cgi?id=40201 + + Remove filenameFromString and use fileSystemRepresentation instead + as they do the same job. + + * platform/FileSystem.cpp: Removed. + * platform/FileSystem.h: + * platform/efl/FileSystemEfl.cpp: + (WebCore::fileSystemRepresentation): + * platform/gtk/FileChooserGtk.cpp: + (WebCore::FileChooser::basenameForWidth): + * platform/gtk/FileSystemGtk.cpp: + (WebCore::fileSystemRepresentation): + (WebCore::filenameForDisplay): + (WebCore::fileExists): + (WebCore::deleteFile): + (WebCore::deleteEmptyDirectory): + (WebCore::getFileSize): + (WebCore::getFileModificationTime): + (WebCore::makeAllDirectories): + (WebCore::pathGetFileName): + (WebCore::directoryName): + (WebCore::listDirectory): + * platform/gtk/SharedBufferGtk.cpp: + (WebCore::SharedBuffer::createWithContentsOfFile): + * platform/network/soup/ResourceHandleSoup.cpp: + (WebCore::startHttp): + * platform/posix/SharedBufferPOSIX.cpp: + (WebCore::SharedBuffer::createWithContentsOfFile): + +2010-06-12 Patrick Gansterer + + Reviewed by Eric Seidel. + + [Haiku] Cleanup SharedBuffer::createWithContentsOfFile + https://bugs.webkit.org/show_bug.cgi?id=39003 + + * platform/haiku/SharedBufferHaiku.cpp: + (WebCore::SharedBuffer::createWithContentsOfFile): + +2010-06-12 Anders Bakken + + Reviewed by Eric Seidel. + + [Qt] WheelEventQt.cpp has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=39760 + + * platform/qt/WheelEventQt.cpp: + (WebCore::PlatformWheelEvent::PlatformWheelEvent): + +2010-06-12 Kwang Yul Seo + + Reviewed by Kent Tamura. + + [BREWMP] Don't include POSIX headers in WebCorePrefix.h + https://bugs.webkit.org/show_bug.cgi?id=39411 + + When building for BREW MP, don't include POSIX headers: + , and . + + * WebCorePrefix.h: + +2010-06-11 Eric Seidel + + Reviewed by Adam Barth. + + Rename the rest of the *Tokenizer classes to *DocumentParser + https://bugs.webkit.org/show_bug.cgi?id=40507 + + This search/replace was done by do-webcore-rename. + Just looking for a rubber stamp. + + XMLTokenizer => XMLDocumentParser + XMLTokenizerLibxml2 => XMLDocumentParserLibxml2 + XMLTokenizerQt => XMLDocumentParserQt + XMLTokenizerScope => XMLDocumentParserScope + HTML5Tokenizer => HTML5DocumentParser + HTMLTokenizer => HTMLDocumentParser + + No functional change, thus no tests. + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * css/CSSStyleSheet.cpp: + (WebCore::CSSStyleSheet::checkLoaded): + * dom/Document.cpp: + (WebCore::Document::createTokenizer): + (WebCore::Document::write): + * dom/Document.h: + (WebCore::Document::setXMLEncoding): + * dom/DocumentParser.h: + (WebCore::DocumentParser::asHTMLTokenizer): + * dom/Element.cpp: + * dom/ProcessingInstruction.cpp: + * dom/XMLDocumentParser.cpp: Added. + (WebCore::XMLDocumentParser::isWMLDocument): + (WebCore::XMLDocumentParser::pushCurrentNode): + (WebCore::XMLDocumentParser::popCurrentNode): + (WebCore::XMLDocumentParser::clearCurrentNodeStack): + (WebCore::XMLDocumentParser::write): + (WebCore::XMLDocumentParser::handleError): + (WebCore::XMLDocumentParser::enterText): + (WebCore::toString): + (WebCore::XMLDocumentParser::exitText): + (WebCore::XMLDocumentParser::end): + (WebCore::XMLDocumentParser::finish): + (WebCore::createXHTMLParserErrorHeader): + (WebCore::XMLDocumentParser::insertErrorMessageBlock): + (WebCore::XMLDocumentParser::notifyFinished): + (WebCore::XMLDocumentParser::isWaitingForScripts): + (WebCore::XMLDocumentParser::pauseParsing): + * dom/XMLDocumentParser.h: Added. + (WebCore::XMLParserContext::context): + (WebCore::XMLParserContext::XMLParserContext): + (WebCore::XMLDocumentParser::): + (WebCore::XMLDocumentParser::setIsXHTMLDocument): + (WebCore::XMLDocumentParser::isXHTMLDocument): + (WebCore::XMLDocumentParser::setIsXHTMLMPDocument): + (WebCore::XMLDocumentParser::isXHTMLMPDocument): + (WebCore::XMLDocumentParser::wellFormed): + (WebCore::XMLDocumentParser::context): + * dom/XMLDocumentParserLibxml2.cpp: Added. + (WebCore::PendingCallbacks::~PendingCallbacks): + (WebCore::PendingCallbacks::appendStartElementNSCallback): + (WebCore::PendingCallbacks::appendEndElementNSCallback): + (WebCore::PendingCallbacks::appendCharactersCallback): + (WebCore::PendingCallbacks::appendProcessingInstructionCallback): + (WebCore::PendingCallbacks::appendCDATABlockCallback): + (WebCore::PendingCallbacks::appendCommentCallback): + (WebCore::PendingCallbacks::appendInternalSubsetCallback): + (WebCore::PendingCallbacks::appendErrorCallback): + (WebCore::PendingCallbacks::callAndRemoveFirstCallback): + (WebCore::PendingCallbacks::isEmpty): + (WebCore::PendingCallbacks::PendingCallback::~PendingCallback): + (WebCore::PendingCallbacks::PendingStartElementNSCallback::~PendingStartElementNSCallback): + (WebCore::PendingCallbacks::PendingStartElementNSCallback::call): + (WebCore::PendingCallbacks::PendingEndElementNSCallback::call): + (WebCore::PendingCallbacks::PendingCharactersCallback::~PendingCharactersCallback): + (WebCore::PendingCallbacks::PendingCharactersCallback::call): + (WebCore::PendingCallbacks::PendingProcessingInstructionCallback::~PendingProcessingInstructionCallback): + (WebCore::PendingCallbacks::PendingProcessingInstructionCallback::call): + (WebCore::PendingCallbacks::PendingCDATABlockCallback::~PendingCDATABlockCallback): + (WebCore::PendingCallbacks::PendingCDATABlockCallback::call): + (WebCore::PendingCallbacks::PendingCommentCallback::~PendingCommentCallback): + (WebCore::PendingCallbacks::PendingCommentCallback::call): + (WebCore::PendingCallbacks::PendingInternalSubsetCallback::~PendingInternalSubsetCallback): + (WebCore::PendingCallbacks::PendingInternalSubsetCallback::call): + (WebCore::PendingCallbacks::): + (WebCore::matchFunc): + (WebCore::OffsetBuffer::OffsetBuffer): + (WebCore::OffsetBuffer::readOutBytes): + (WebCore::shouldAllowExternalLoad): + (WebCore::openFunc): + (WebCore::readFunc): + (WebCore::writeFunc): + (WebCore::closeFunc): + (WebCore::errorFunc): + (WebCore::XMLParserContext::createStringParser): + (WebCore::XMLParserContext::createMemoryParser): + (WebCore::XMLDocumentParser::XMLDocumentParser): + (WebCore::XMLParserContext::~XMLParserContext): + (WebCore::XMLDocumentParser::~XMLDocumentParser): + (WebCore::XMLDocumentParser::doWrite): + (WebCore::toString): + (WebCore::handleElementNamespaces): + (WebCore::handleElementAttributes): + (WebCore::XMLDocumentParser::startElementNs): + (WebCore::XMLDocumentParser::endElementNs): + (WebCore::XMLDocumentParser::characters): + (WebCore::XMLDocumentParser::error): + (WebCore::XMLDocumentParser::processingInstruction): + (WebCore::XMLDocumentParser::cdataBlock): + (WebCore::XMLDocumentParser::comment): + (WebCore::XMLDocumentParser::startDocument): + (WebCore::XMLDocumentParser::endDocument): + (WebCore::XMLDocumentParser::internalSubset): + (WebCore::getTokenizer): + (WebCore::hackAroundLibXMLEntityBug): + (WebCore::startElementNsHandler): + (WebCore::endElementNsHandler): + (WebCore::charactersHandler): + (WebCore::processingInstructionHandler): + (WebCore::cdataBlockHandler): + (WebCore::commentHandler): + (WebCore::warningHandler): + (WebCore::fatalErrorHandler): + (WebCore::normalErrorHandler): + (WebCore::): + (WebCore::sharedXHTMLEntity): + (WebCore::getXHTMLEntity): + (WebCore::getEntityHandler): + (WebCore::startDocumentHandler): + (WebCore::endDocumentHandler): + (WebCore::internalSubsetHandler): + (WebCore::externalSubsetHandler): + (WebCore::ignorableWhitespaceHandler): + (WebCore::XMLDocumentParser::initializeParserContext): + (WebCore::XMLDocumentParser::doEnd): + (WebCore::xmlDocPtrForString): + (WebCore::XMLDocumentParser::lineNumber): + (WebCore::XMLDocumentParser::columnNumber): + (WebCore::XMLDocumentParser::stopParsing): + (WebCore::XMLDocumentParser::resumeParsing): + (WebCore::parseXMLDocumentFragment): + (WebCore::attributesStartElementNsHandler): + (WebCore::parseAttributes): + * dom/XMLDocumentParserQt.cpp: Added. + (WebCore::EntityResolver::resolveUndeclaredEntity): + (WebCore::XMLDocumentParser::XMLDocumentParser): + (WebCore::XMLDocumentParser::~XMLDocumentParser): + (WebCore::XMLDocumentParser::doWrite): + (WebCore::XMLDocumentParser::initializeParserContext): + (WebCore::XMLDocumentParser::doEnd): + (WebCore::XMLDocumentParser::lineNumber): + (WebCore::XMLDocumentParser::columnNumber): + (WebCore::XMLDocumentParser::stopParsing): + (WebCore::XMLDocumentParser::resumeParsing): + (WebCore::parseXMLDocumentFragment): + (WebCore::attributesStartElementNsHandler): + (WebCore::parseAttributes): + (WebCore::prefixFromQName): + (WebCore::handleElementNamespaces): + (WebCore::handleElementAttributes): + (WebCore::XMLDocumentParser::parse): + (WebCore::XMLDocumentParser::startDocument): + (WebCore::XMLDocumentParser::parseStartElement): + (WebCore::XMLDocumentParser::parseEndElement): + (WebCore::XMLDocumentParser::parseCharacters): + (WebCore::XMLDocumentParser::parseProcessingInstruction): + (WebCore::XMLDocumentParser::parseCdata): + (WebCore::XMLDocumentParser::parseComment): + (WebCore::XMLDocumentParser::endDocument): + (WebCore::XMLDocumentParser::hasError): + (WebCore::XMLDocumentParser::parseDtd): + * dom/XMLDocumentParserScope.cpp: Added. + (WebCore::XMLDocumentParserScope::XMLDocumentParserScope): + (WebCore::XMLDocumentParserScope::~XMLDocumentParserScope): + * dom/XMLDocumentParserScope.h: Added. + * dom/XMLTokenizer.cpp: Removed. + * dom/XMLTokenizer.h: Removed. + * dom/XMLTokenizerLibxml2.cpp: Removed. + * dom/XMLTokenizerQt.cpp: Removed. + * dom/XMLTokenizerScope.cpp: Removed. + * dom/XMLTokenizerScope.h: Removed. + * html/HTML5DocumentParser.cpp: Added. + (WebCore::): + (WebCore::HTML5DocumentParser::HTML5DocumentParser): + (WebCore::HTML5DocumentParser::~HTML5DocumentParser): + (WebCore::HTML5DocumentParser::begin): + (WebCore::HTML5DocumentParser::pumpLexerIfPossible): + (WebCore::HTML5DocumentParser::pumpLexer): + (WebCore::HTML5DocumentParser::write): + (WebCore::HTML5DocumentParser::end): + (WebCore::HTML5DocumentParser::attemptToEnd): + (WebCore::HTML5DocumentParser::endIfDelayed): + (WebCore::HTML5DocumentParser::finish): + (WebCore::HTML5DocumentParser::executingScript): + (WebCore::HTML5DocumentParser::lineNumber): + (WebCore::HTML5DocumentParser::columnNumber): + (WebCore::HTML5DocumentParser::htmlParser): + (WebCore::HTML5DocumentParser::isWaitingForScripts): + (WebCore::HTML5DocumentParser::resumeParsingAfterScriptExecution): + (WebCore::HTML5DocumentParser::watchForLoad): + (WebCore::HTML5DocumentParser::stopWatchingForLoad): + (WebCore::HTML5DocumentParser::shouldLoadExternalScriptFromSrc): + (WebCore::HTML5DocumentParser::executeScript): + (WebCore::HTML5DocumentParser::notifyFinished): + (WebCore::HTML5DocumentParser::executeScriptsWaitingForStylesheets): + (WebCore::HTML5DocumentParser::script): + * html/HTML5DocumentParser.h: Added. + (WebCore::HTML5DocumentParser::InputStream::InputStream): + (WebCore::HTML5DocumentParser::InputStream::appendToEnd): + (WebCore::HTML5DocumentParser::InputStream::insertAtCurrentInsertionPoint): + (WebCore::HTML5DocumentParser::InputStream::close): + (WebCore::HTML5DocumentParser::InputStream::current): + (WebCore::HTML5DocumentParser::InputStream::splitInto): + (WebCore::HTML5DocumentParser::InputStream::mergeFrom): + (WebCore::HTML5DocumentParser::InsertionPointRecord::InsertionPointRecord): + (WebCore::HTML5DocumentParser::InsertionPointRecord::~InsertionPointRecord): + (WebCore::HTML5DocumentParser::inWrite): + * html/HTML5Lexer.h: + (WebCore::HTML5Lexer::columnNumber): + * html/HTML5Tokenizer.cpp: Removed. + * html/HTML5Tokenizer.h: Removed. + * html/HTML5TreeBuilder.cpp: + * html/HTMLDocument.cpp: + (WebCore::HTMLDocument::createTokenizer): + * html/HTMLDocumentParser.cpp: Added. + (WebCore::): + (WebCore::fixUpChar): + (WebCore::tagMatch): + (WebCore::Token::addAttribute): + (WebCore::HTMLDocumentParser::HTMLDocumentParser): + (WebCore::HTMLDocumentParser::reset): + (WebCore::HTMLDocumentParser::begin): + (WebCore::HTMLDocumentParser::setForceSynchronous): + (WebCore::HTMLDocumentParser::processListing): + (WebCore::HTMLDocumentParser::parseNonHTMLText): + (WebCore::HTMLDocumentParser::scriptHandler): + (WebCore::HTMLDocumentParser::scriptExecution): + (WebCore::HTMLDocumentParser::parseComment): + (WebCore::HTMLDocumentParser::parseServer): + (WebCore::HTMLDocumentParser::parseProcessingInstruction): + (WebCore::HTMLDocumentParser::parseText): + (WebCore::HTMLDocumentParser::parseEntity): + (WebCore::HTMLDocumentParser::parseDoctype): + (WebCore::HTMLDocumentParser::parseTag): + (WebCore::HTMLDocumentParser::continueProcessing): + (WebCore::HTMLDocumentParser::advance): + (WebCore::HTMLDocumentParser::willWriteHTML): + (WebCore::HTMLDocumentParser::didWriteHTML): + (WebCore::HTMLDocumentParser::write): + (WebCore::HTMLDocumentParser::stopParsing): + (WebCore::HTMLDocumentParser::processingData): + (WebCore::HTMLDocumentParser::timerFired): + (WebCore::HTMLDocumentParser::end): + (WebCore::HTMLDocumentParser::finish): + (WebCore::HTMLDocumentParser::processToken): + (WebCore::HTMLDocumentParser::processDoctypeToken): + (WebCore::HTMLDocumentParser::~HTMLDocumentParser): + (WebCore::HTMLDocumentParser::enlargeBuffer): + (WebCore::HTMLDocumentParser::enlargeScriptBuffer): + (WebCore::HTMLDocumentParser::executeScriptsWaitingForStylesheets): + (WebCore::HTMLDocumentParser::notifyFinished): + (WebCore::HTMLDocumentParser::executeExternalScriptsIfReady): + (WebCore::HTMLDocumentParser::executeExternalScriptsTimerFired): + (WebCore::HTMLDocumentParser::continueExecutingExternalScripts): + (WebCore::HTMLDocumentParser::isWaitingForScripts): + (WebCore::HTMLDocumentParser::setSrc): + (WebCore::parseHTMLDocumentFragment): + (WebCore::decodeNamedEntity): + * html/HTMLDocumentParser.h: Added. + (WebCore::Token::Token): + (WebCore::Token::~Token): + (WebCore::Token::isOpenTag): + (WebCore::Token::isCloseTag): + (WebCore::Token::reset): + (WebCore::Token::addViewSourceChar): + (WebCore::): + (WebCore::DoctypeToken::DoctypeToken): + (WebCore::DoctypeToken::reset): + (WebCore::DoctypeToken::state): + (WebCore::DoctypeToken::setState): + (WebCore::HTMLDocumentParser::forceSynchronous): + (WebCore::HTMLDocumentParser::executingScript): + (WebCore::HTMLDocumentParser::lineNumber): + (WebCore::HTMLDocumentParser::columnNumber): + (WebCore::HTMLDocumentParser::processingContentWrittenByScript): + (WebCore::HTMLDocumentParser::htmlParser): + (WebCore::HTMLDocumentParser::asHTMLTokenizer): + (WebCore::HTMLDocumentParser::checkBuffer): + (WebCore::HTMLDocumentParser::checkScriptBuffer): + (WebCore::HTMLDocumentParser::): + (WebCore::HTMLDocumentParser::State::State): + (WebCore::HTMLDocumentParser::State::tagState): + (WebCore::HTMLDocumentParser::State::setTagState): + (WebCore::HTMLDocumentParser::State::entityState): + (WebCore::HTMLDocumentParser::State::setEntityState): + (WebCore::HTMLDocumentParser::State::inScript): + (WebCore::HTMLDocumentParser::State::setInScript): + (WebCore::HTMLDocumentParser::State::inStyle): + (WebCore::HTMLDocumentParser::State::setInStyle): + (WebCore::HTMLDocumentParser::State::inXmp): + (WebCore::HTMLDocumentParser::State::setInXmp): + (WebCore::HTMLDocumentParser::State::inTitle): + (WebCore::HTMLDocumentParser::State::setInTitle): + (WebCore::HTMLDocumentParser::State::inIFrame): + (WebCore::HTMLDocumentParser::State::setInIFrame): + (WebCore::HTMLDocumentParser::State::inPlainText): + (WebCore::HTMLDocumentParser::State::setInPlainText): + (WebCore::HTMLDocumentParser::State::inProcessingInstruction): + (WebCore::HTMLDocumentParser::State::setInProcessingInstruction): + (WebCore::HTMLDocumentParser::State::inComment): + (WebCore::HTMLDocumentParser::State::setInComment): + (WebCore::HTMLDocumentParser::State::inDoctype): + (WebCore::HTMLDocumentParser::State::setInDoctype): + (WebCore::HTMLDocumentParser::State::inTextArea): + (WebCore::HTMLDocumentParser::State::setInTextArea): + (WebCore::HTMLDocumentParser::State::escaped): + (WebCore::HTMLDocumentParser::State::setEscaped): + (WebCore::HTMLDocumentParser::State::inServer): + (WebCore::HTMLDocumentParser::State::setInServer): + (WebCore::HTMLDocumentParser::State::skipLF): + (WebCore::HTMLDocumentParser::State::setSkipLF): + (WebCore::HTMLDocumentParser::State::startTag): + (WebCore::HTMLDocumentParser::State::setStartTag): + (WebCore::HTMLDocumentParser::State::discardLF): + (WebCore::HTMLDocumentParser::State::setDiscardLF): + (WebCore::HTMLDocumentParser::State::allowYield): + (WebCore::HTMLDocumentParser::State::setAllowYield): + (WebCore::HTMLDocumentParser::State::loadingExtScript): + (WebCore::HTMLDocumentParser::State::setLoadingExtScript): + (WebCore::HTMLDocumentParser::State::forceSynchronous): + (WebCore::HTMLDocumentParser::State::setForceSynchronous): + (WebCore::HTMLDocumentParser::State::inAnyNonHTMLText): + (WebCore::HTMLDocumentParser::State::hasTagState): + (WebCore::HTMLDocumentParser::State::hasEntityState): + (WebCore::HTMLDocumentParser::State::needsSpecialWriteHandling): + (WebCore::HTMLDocumentParser::State::): + (WebCore::HTMLDocumentParser::State::setBit): + (WebCore::HTMLDocumentParser::State::testBit): + * html/HTMLElement.cpp: + * html/HTMLFormControlElement.cpp: + * html/HTMLParser.cpp: + (WebCore::HTMLParser::reportErrorToConsole): + * html/HTMLParser.h: + * html/HTMLTokenizer.cpp: Removed. + * html/HTMLTokenizer.h: Removed. + * html/HTMLViewSourceDocument.cpp: + (WebCore::HTMLViewSourceDocument::createTokenizer): + (WebCore::HTMLViewSourceDocument::addViewSourceToken): + * html/HTMLViewSourceDocument.h: + * loader/DocumentLoader.cpp: + * loader/FTPDirectoryDocument.cpp: + (WebCore::FTPDirectoryTokenizer::FTPDirectoryTokenizer): + (WebCore::FTPDirectoryTokenizer::loadDocumentTemplate): + (WebCore::FTPDirectoryTokenizer::finish): + * loader/FrameLoader.cpp: + * loader/ImageDocument.cpp: + * loader/MediaDocument.cpp: + * loader/PluginDocument.cpp: + * loader/TextDocument.cpp: + * page/XSSAuditor.h: + * svg/SVGDocumentExtensions.cpp: + * wml/WMLErrorHandling.cpp: + (WebCore::reportWMLError): + * xml/XSLStyleSheetLibxslt.cpp: + (WebCore::XSLStyleSheet::parseString): + * xml/XSLTProcessor.cpp: + * xml/XSLTProcessorLibxslt.cpp: + +2010-06-12 Andreas Kling + + Reviewed by Darin Adler. + + Window object should have CanvasGradient and CanvasPattern + https://bugs.webkit.org/show_bug.cgi?id=40394 + + This fixes the following tests: + - canvas/philip/tests/2d.gradient.object.return.html + - canvas/philip/tests/2d.pattern.basic.type.html + + * html/canvas/CanvasGradient.idl: + * html/canvas/CanvasPattern.idl: + * page/DOMWindow.idl: + +2010-06-12 Dan Bernstein + + Reviewed by Oliver Hunt. + + REGRESSION (Safari 4-TOT): Crash when a frame’s resize handler removes the frame + https://bugs.webkit.org/show_bug.cgi?id=40534 + + Test: fast/replaced/frame-removed-during-resize.html + + * rendering/RenderWidget.cpp: + (WebCore::RenderWidget::updateWidgetPosition): Null-check m_widget, since resizing the widget + may trigger an iframe’s resize handler, which may destroy the widget. + +2010-06-12 Dean Jackson + + Reviewed by Darin Adler. + + Animation keyframe timing functions are applying incorrectly + https://bugs.webkit.org/show_bug.cgi?id=38963 + + When copying RenderStyles, we have to clone the AnimationList so that each keyframe + can have its own timing function. + + Tests: animations/keyframe-timing-functions-transform.html + animations/keyframe-timing-functions2.html + + * platform/animation/Animation.h: + (WebCore::Animation::create): + * platform/animation/AnimationList.cpp: + (WebCore::AnimationList::AnimationList): + * platform/animation/AnimationList.h: + (WebCore::AnimationList::AnimationList): + +2010-06-12 Dan Bernstein + + Reviewed by Dave Hyatt. + + -webkit-column-break-* properties don’t do anything + https://bugs.webkit.org/show_bug.cgi?id=40531 + + Test: fast/multicol/break-properties.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::paintChildren): Check for -webkit-column-break-{before,after}: always + and -webkit-column-break-inside: avoid when doing column layout. + +2010-06-13 Robert Hogan + + Reviewed by Alexey Proskuryakov. + + FrameLoader::clear() clears JS objects that cached pages later rely on + + https://bugs.webkit.org/show_bug.cgi?id=37725 + https://bugs.webkit.org/show_bug.cgi?id=31626 + + Fix the following tests for Qt: + + fast/events/pageshow-pagehide-on-back-cached.html + fast/events/pageshow-pagehide-on-back-cached-with-frames.html + fast/loader/input-element-page-cache-crash.html + fast/dom/Window/timer-resume-on-navigation-back.html + loader/go-back-to-different-window-size.html + fast/dom/javascript-url-crash-function.html + fast/dom/location-new-window-no-crash.html + http/tests/security/javascriptURL/xss-ALLOWED-from-javascript-url-window-open.html + + which currently fail because the page's Qt-bindings runtime objects are + cleared when navigating away from the page containing them. + + Track Qt-bindings objects in a separate ScriptController::cacheableRootBindingObject(). + RuntimeObjects tracked by this root object will not get invalidated on page navigations, + so they will still be available when the pages containing them are retrieved from the + b/f cache. + + This means the Qt bindings objects will only get cleared on Frame::pageDestroyed(). + + * bindings/js/ScriptController.cpp: + (WebCore::ScriptController::~ScriptController): + (WebCore::ScriptController::cacheableBindingRootObject): + * bindings/js/ScriptController.h: + +2010-06-12 Kent Tamura + + Reviewed by Darin Adler. + + REGRESSION: Can't submit a form with + https://bugs.webkit.org/show_bug.cgi?id=40429 + + Validity state was not updated correctly for radio buttons, and it + prevents form submission even if a radio button group has a + checked radio button. + + Test: fast/forms/interactive-validation-required-radio.html + + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::updateCheckedRadioButtons): + Call setNeedsValidityCheck() for all of radio buttons in the same group + to update validity state. + (WebCore::HTMLInputElement::setChecked): + Remove setNeedsValidityCheck() call because it is called in + updateCheckedRadioButtons(). + +2010-06-12 Kent Tamura + + Reviewed by Dimitri Glazkov. + + Disable interactive form validation in non-strict modes + https://bugs.webkit.org/show_bug.cgi?id=40218 + + The interactive validation feature of HTML5 is not compatible with + HTML4, and users and page authors don't expect existing sites work + differently in WebKit. For example, maxlength and required attributes + in existing sites unexpectedly prevented form submission. + So, we disable the interactive validation feature in non-strict + modes to improve compatibility. + + Test: fast/forms/interactive-validation-compat-mode.html + fast/forms/interactive-validation-html4.html + + * html/HTMLFormElement.cpp: + (WebCore::HTMLFormElement::validateInteractively): + Process interactive validation only in the strict mode. + +2010-06-12 Eric Seidel + + Reviewed by David Levin. + + Rename Tokenizer to DocumentParser to match what it actually does + https://bugs.webkit.org/show_bug.cgi?id=40504 + + The rename was entirely done by do-webcore-rename. + The only manual changes were removing out-dated comments + and fixing Tokenizer_h to DocumentParser_h in the header guards. + + I'll do all the rest of the renames (like the tokenizer subclasses + and the tokenizer() createTokenizer() methods) in separate changes. + + No functional change, thus no tests. + + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSHTMLDocumentCustom.cpp: + * bindings/v8/ScriptEventListener.cpp: + * dom/Document.cpp: + (WebCore::Document::createTokenizer): + * dom/Document.h: + (WebCore::Document::tokenizer): + * dom/DocumentParser.h: Added. + (WebCore::DocumentParser::~DocumentParser): + (WebCore::DocumentParser::stopParsing): + (WebCore::DocumentParser::processingData): + (WebCore::DocumentParser::executingScript): + (WebCore::DocumentParser::wantsRawData): + (WebCore::DocumentParser::writeRawData): + (WebCore::DocumentParser::inViewSourceMode): + (WebCore::DocumentParser::setInViewSourceMode): + (WebCore::DocumentParser::wellFormed): + (WebCore::DocumentParser::lineNumber): + (WebCore::DocumentParser::columnNumber): + (WebCore::DocumentParser::executeScriptsWaitingForStylesheets): + (WebCore::DocumentParser::htmlParser): + (WebCore::DocumentParser::asHTMLTokenizer): + (WebCore::DocumentParser::xssAuditor): + (WebCore::DocumentParser::setXSSAuditor): + (WebCore::DocumentParser::DocumentParser): + * dom/Tokenizer.h: Removed. + * dom/ViewportArguments.cpp: + (WebCore::reportViewportWarning): + * dom/XMLTokenizer.h: + * dom/XMLTokenizerLibxml2.cpp: + (WebCore::XMLTokenizer::stopParsing): + * dom/XMLTokenizerQt.cpp: + (WebCore::XMLTokenizer::stopParsing): + * html/HTML5Tokenizer.cpp: + (WebCore::HTML5Tokenizer::HTML5Tokenizer): + * html/HTML5Tokenizer.h: + * html/HTMLDocument.cpp: + (WebCore::HTMLDocument::createTokenizer): + * html/HTMLDocument.h: + * html/HTMLFormControlElement.cpp: + (WebCore::HTMLFormControlElement::removedFromTree): + * html/HTMLTokenizer.cpp: + (WebCore::HTMLTokenizer::HTMLTokenizer): + (WebCore::HTMLTokenizer::stopParsing): + * html/HTMLTokenizer.h: + * html/HTMLViewSourceDocument.cpp: + (WebCore::HTMLViewSourceDocument::createTokenizer): + * html/HTMLViewSourceDocument.h: + * loader/DocumentLoader.cpp: + (WebCore::DocumentLoader::isLoadingInAPISense): + * loader/DocumentWriter.cpp: + (WebCore::DocumentWriter::addData): + * loader/FTPDirectoryDocument.cpp: + (WebCore::FTPDirectoryDocument::createTokenizer): + * loader/FTPDirectoryDocument.h: + * loader/ImageDocument.cpp: + (WebCore::ImageDocument::createTokenizer): + * loader/ImageDocument.h: + * loader/MediaDocument.cpp: + (WebCore::MediaDocument::createTokenizer): + * loader/MediaDocument.h: + * loader/PluginDocument.cpp: + (WebCore::PluginDocument::createTokenizer): + * loader/PluginDocument.h: + * loader/SinkDocument.cpp: + (WebCore::SinkDocument::createTokenizer): + * loader/SinkDocument.h: + * loader/TextDocument.cpp: + (WebCore::TextTokenizer::TextTokenizer): + (WebCore::TextDocument::createTokenizer): + (WebCore::createTextTokenizer): + * loader/TextDocument.h: + * wml/WMLDocument.cpp: + (WebCore::WMLDocument::finishedParsing): + +2010-06-12 Eric Seidel + + Reviewed by Adam Barth. + + HTML5Tokenizer needs to tell the InspectorTimelineAgent before and after it writes + https://bugs.webkit.org/show_bug.cgi?id=40417 + + This "fixes" inspector/timeline-script-tag-1.html. HTML5 results + differ from the old parser for expected reasons. + + HTML5Tokenizer calls InspectorTimelineAgent::will/didWriteHTML every + time we pump the lexer instead of every write() call. + We end up pumping the lexer slightly more often than the old code called + write() in order to cleanly handle unclosed-entities, unclosed tags, + buffered characters, etc. at the end of a document. + + I discussed this extensively with James Robinson in #webkit and we decided + that it was better for the HTML5Tokenizer to call for every pump and + that the Inspector should later filter out empty pumps. + + We can't filter out empty pumps yet, because the number of parsed + characters is passed in willWrite instead of didWrite and thus is + speculative (and wrong). This is a problem independent of this change + as willWrite's "length" argument is wrong in different ways for the old + parser, including always being 0 when the old parser resumes. + + Tested by inspector/timeline-script-tag-1.html + + * html/HTML5Tokenizer.cpp: + (WebCore::HTML5Tokenizer::willPumpLexer): + - Notify the InspectorTimelineAgent we're about to process input. + (WebCore::HTML5Tokenizer::didPumpLexer): + - Notify the InspectorTimelineAgent we did process tokens. + (WebCore::HTML5Tokenizer::pumpLexer): + - Call willPump and didPump + * html/HTML5Tokenizer.h: + * inspector/InspectorTimelineAgent.h: + - Add a FIXME about passing length to didWrite instead of willWrite. + +2010-06-11 Sheriff Bot + + Unreviewed, rolling out r61052. + http://trac.webkit.org/changeset/61052 + https://bugs.webkit.org/show_bug.cgi?id=40517 + + "Broke fast/forms/caret-rtl.html on Mac bots" (Requested by + eseidel on #webkit). + + * html/HTMLElement.cpp: + (WebCore::HTMLElement::mapToEntry): + (WebCore::HTMLElement::parseMappedAttribute): + +2010-06-11 Maciej Stachowiak + + Reviewed by Ojan Vafai. + + Implement HTML5 hidden attribute + https://bugs.webkit.org/show_bug.cgi?id=40511 + + Test: fast/html/hidden-attr.html + + Note: I used the mapped attribute mechanism for this instead of a rule in the UA stylesheet + to avoid a performance hit from adding a global attribute rule to the UA stylesheet. + + * html/HTMLElement.cpp: + (WebCore::HTMLElement::mapToEntry): Pick up hidden as a global mapped attribute. + (WebCore::HTMLElement::parseMappedAttribute): Map hidden attribute to display: none. + +2010-06-10 Abhishek Arya + + Reviewed by Dave Hyatt. + + Do not render CSS Styles :first-letter and :first-line in a SVG text element context. + https://bugs.webkit.org/show_bug.cgi?id=40031 + + Test: svg/text/text-style-invalid.svg + + * rendering/RenderSVGText.cpp: + (WebCore::RenderSVGText::firstLineBlock): + (WebCore::RenderSVGText::updateFirstLetter): + * rendering/RenderSVGText.h: + +2010-06-11 Kenneth Russell + + Reviewed by Dimitri Glazkov. + + getParameter with UNPACK_FLIP_Y_WEBGL and UNPACK_PREMULTIPLY_ALPHA_WEBGL is buggy + https://bugs.webkit.org/show_bug.cgi?id=40506 + + Return the data members of WebGLRenderingContext for these + parameter queries rather than asking OpenGL, which knows nothing + about them. + + * html/canvas/WebGLRenderingContext.cpp: + (WebCore::WebGLRenderingContext::getParameter): + +2010-06-11 Simon Fraser + + Reviewed by Dr Dan Bernstein. + + REGRESSION: crash when unloading an iFrame with Flash from the DOM + https://bugs.webkit.org/show_bug.cgi?id=40161 + + + Null-check the ownerElement of the RenderView's document when unhooking the compositing + root of an iframe whose layers are parented via the enclosing document. Fixes a crash when + dynamically removing such an iframe. + + Test: compositing/iframes/remove-iframe-crash.html + + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::detachRootPlatformLayer): + +2010-06-11 Abhishek Arya + + Reviewed by David Hyatt. + + Don't process floats if parent node is not a RenderBlock. + https://bugs.webkit.org/show_bug.cgi?id=40033 + + Test: svg/text/clear-floats-crash.svg + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::clearFloats): + +2010-06-11 Sheriff Bot + + Unreviewed, rolling out r61036. + http://trac.webkit.org/changeset/61036 + https://bugs.webkit.org/show_bug.cgi?id=40499 + + broke chromium compile (Requested by jamesr on #webkit). + + * bindings/v8/SerializedScriptValue.cpp: + * bindings/v8/SerializedScriptValue.h: + (WebCore::SerializedScriptValue::deserializeAndSetProperty): + (WebCore::SerializedScriptValue::create): + (WebCore::SerializedScriptValue::createFromWire): + (WebCore::SerializedScriptValue::release): + (WebCore::SerializedScriptValue::SerializedScriptValue): + +2010-06-11 Kenneth Russell + + Reviewed by Dimitri Glazkov. + + Add texImage2D and texSubImage2D signatures with internal format, etc. + https://bugs.webkit.org/show_bug.cgi?id=40318 + + Added new texImage2D and texSubImage2D entry points following + WebGL specification changes. Added UNPACK_FLIP_Y_WEBGL and + UNPACK_PREMULTIPLY_ALPHA_WEBGL pixelStorei parameters, honored + them for the new entry points taking HTML elements, and added + support to getParameter. Added warnings to the console for calls + to the obsolete entry points, which will be removed in a few + weeks. Updated all layout tests to use the new entry points and + pixelStorei parameters, and associated expectations. No other new + tests. + + * html/canvas/WebGLRenderingContext.cpp: + (WebCore::WebGLRenderingContext::WebGLRenderingContext): + (WebCore::WebGLRenderingContext::getParameter): + (WebCore::WebGLRenderingContext::pixelStorei): + (WebCore::WebGLRenderingContext::texImage2DImpl): + (WebCore::WebGLRenderingContext::texImage2D): + (WebCore::WebGLRenderingContext::texSubImage2DImpl): + (WebCore::WebGLRenderingContext::texSubImage2D): + (WebCore::WebGLRenderingContext::printWarningToConsole): + * html/canvas/WebGLRenderingContext.h: + * html/canvas/WebGLRenderingContext.idl: + * platform/graphics/GraphicsContext3D.h: + (WebCore::GraphicsContext3D::): + +2010-06-11 James Robinson + + Reviewed by Dimitri Glazkov. + + [chromium] Skia mispaints pages with border-radius + https://bugs.webkit.org/show_bug.cgi?id=40456 + + Skia mispaints pages that have border radius set in some cases. The bug is in the anti aliased + clip path logic used to implement anti aliased curves in Skia. Since Skia internally only supports + 1-bit clips, anti aliased clipping is emulated by creating a new alpha layer, storing a set of + clip paths on the side, and then 'erasing' the regions outside the clip. See r49641. + PlatformContextSkia maintains a stack of PlatformContextSkia::State objects that preserve information + like fill color, drawing mode, etc that is manipulated by GraphicsContext::save() / + GraphicsContext::restore() calls as well some internal functions. Whenever a new State object is pushed + a new copy of the current State object is pushed onto the top of this stack using the copy c'tor. The + set of anti alias clip paths is also stored on the State object, but not copied when new entries are + added as the paths only apply to that entry on the stack. + + The bug is that the state stack is stored in a WTF::Vector. When this vector exceeds its capacity + (by default at 16 elements) all of the existing State entries are copied into the new buffer using + State's copy constructor. This does not preserve the anti alias clip paths, so when the State entries + are popped the anti aliasing info is lost. This corrupts all further paint operations since it results + in inbalanced save/restore calls to the underlying SkCanvas. + + The fix is to make the PlatformContextSkia::State copy constructor copy all fields and to add a new + function PlatformContextSkia::State::cloneInheritedProperties to use when pushing new State entries + that copies everything except for the anti aliased clip paths. + + Test: fast/css/nested-rounded-corners.html + + * platform/graphics/skia/PlatformContextSkia.cpp: + (PlatformContextSkia::State::State): + (PlatformContextSkia::State::cloneInheritedProperties): + (PlatformContextSkia::save): + +2010-06-11 Jeremy Orlow + + Reviewed by Darin Fisher. + + [V8] Clean up SerializedScriptValue + https://bugs.webkit.org/show_bug.cgi?id=40482 + + SerializedScriptValue doesn't follow WebKit's style guidelines very well + and needlessly inlines quite a bit within the .h file. This change cleans + things up. No funcitonal changes. + + No change in behavior. + + * bindings/v8/SerializedScriptValue.cpp: + (WebCore::SerializedScriptValue::deserializeAndSetProperty): + (WebCore::SerializedScriptValue::create): + (WebCore::SerializedScriptValue::createFromWire): + (WebCore::SerializedScriptValue::release): + (WebCore::SerializedScriptValue::SerializedScriptValue): + * bindings/v8/SerializedScriptValue.h: + +2010-06-11 Anton Muhin + + Reviewed by Adam Barth. + + [v8] Introduce single element caches for WebCore::String to v8::String conversions + https://bugs.webkit.org/show_bug.cgi?id=40435 + Measurements show that for some web apps (GMail, Wave) and some scenarios + (intensive reading and/or keeping a tab open for a long time), + hit rate lies in 30--50% interval. + Inlining fast case gives another minor performance win. + + * bindings/v8/V8Binding.cpp: + (WebCore::getStringCache): + (WebCore::v8ExternalStringSlow): + * bindings/v8/V8Binding.h: + (WebCore::v8ExternalString): + +2010-06-11 Leandro Pereira + + Reviewed by Gustavo Noronha Silva. + + [EFL] Build fix: remove unneeded file (npapi.cpp) and add + other files that got added to the tree. + http://webkit.org/b/40331 + + * CMakeLists.txt: + * CMakeListsEfl.txt: + +2010-06-11 Tony Gentilcore + + Reviewed by Eric Seidel. + + Fix fast/forms/preserveFormDuringResidualStyle.html for HTML5 Parser. + https://bugs.webkit.org/show_bug.cgi?id=40454 + + This required exposing the HTMLParser which we definitely don't want to + do, but the good news is that it can go away when the HTMLParser goes + away. + + No new tests because covered by fast/forms/preserve/FormDuringResidualStyle.html. + + * dom/Tokenizer.h: + (WebCore::Tokenizer::htmlParser): + * html/HTML5Tokenizer.cpp: + (WebCore::HTML5Tokenizer::htmlParser): + * html/HTML5Tokenizer.h: + * html/HTML5TreeBuilder.h: + (WebCore::HTML5TreeBuilder::htmlParser): + * html/HTMLFormControlElement.cpp: + (WebCore::HTMLFormControlElement::removedFromTree): + * html/HTMLTokenizer.h: + (WebCore::HTMLTokenizer::htmlParser): + +2010-06-11 Kenneth Russell + + Reviewed by Dimitri Glazkov. + + Delete custom JSC bindings for bufferData, texImage2D and texSubImage2D + https://bugs.webkit.org/show_bug.cgi?id=40443 + + Deleted custom JSC bindings for bufferData, texImage2D and + texSubImage2D and fixed minor associated issues in code generator + and IDL. Updated fast/canvas/webgl/texImageTest-expected.txt, + which now runs as intended. Ran all layout tests, including WebGL + tests, in Safari. + + * bindings/js/JSWebGLRenderingContextCustom.cpp: + - Deleted custom bindings. + * bindings/scripts/CodeGeneratorJS.pm: + - Made overload helper functions static to fix compiler warnings. + - Added needed isObject check for overloads between object and non-object arguments. + - Added JSValue::encode to exception return path, needed on Leopard in particular. + * html/HTMLCanvasElement.idl: + * html/HTMLImageElement.idl: + * html/HTMLVideoElement.idl: + - Added GenerateNativeConverter extended attribute. + * html/canvas/WebGLRenderingContext.idl: + - Deleted #ifdefs for custom JSC bindings. + +2010-06-11 Kevin Ollivier + + [wx] Build fix, add KillRingNone.cpp until we can implement it. + + * wscript: + +2010-06-11 Hans Wennborg + + Reviewed by Jeremy Orlow. + + DOM storage should only create databases when needed + https://bugs.webkit.org/show_bug.cgi?id=40301 + + As soon as a page attempts to use localstorage, StorageAreaSync will + create an empty database if one doesn't already exist. This can lead to + lots of unnecessary database files. In particular, they are created + even when the privacy settings or private browsing mode disallow + localstorage data, which may seem odd to the user. + + Database creation should be put off in StorageAreaSync until it is time + to actually write something to the database. + + Tests: + manual-tests/localstorage-empty-database.html + + * manual-tests/localstorage-empty-database.html: Added. + * storage/StorageAreaSync.cpp: + (WebCore::StorageAreaSync::StorageAreaSync): + (WebCore::StorageAreaSync::openDatabase): + (WebCore::StorageAreaSync::performImport): + (WebCore::StorageAreaSync::sync): + * storage/StorageAreaSync.h: + (WebCore::StorageAreaSync::): + +2010-06-11 Ilya Tikhonovsky + + Reviewed by Eric Seidel. + + Perl scripts for bindings don't use strict keyword. + As result some problems in the script code were not detected at compile stage. + https://bugs.webkit.org/show_bug.cgi?id=40468 + + * bindings/scripts/CodeGenerator.pm: + * bindings/scripts/IDLParser.pm: + * bindings/scripts/IDLStructure.pm: + +2010-06-11 Eric Seidel + + Reviewed by Adam Barth. + + HTML5Tokenizer should not delete itself while running scripts + https://bugs.webkit.org/show_bug.cgi?id=40458 + + Tested by fast/dom/document-clear.html + + * html/HTML5Tokenizer.cpp: + (WebCore::HTML5Tokenizer::attemptToEnd): + - Don't ever end() while running scripts. + This matches the old HTMLTokenizer.cpp + +2010-06-11 Zhenyao Mo + + Reviewed by Dimitri Glazkov. + + getActiveUniform must ensure names of arrays end in "[0]" + https://bugs.webkit.org/show_bug.cgi?id=38709 + + Test: fast/canvas/webgl/get-active-test.html + + * html/canvas/WebGLRenderingContext.cpp: + (WebCore::WebGLRenderingContext::getActiveAttrib): Append "[0]" to the name if needed. + +2010-06-11 Zhenyao Mo + + Reviewed by Dimitri Glazkov. + + readPixels with negative width/height should generate INVALID_VALUE and return + https://bugs.webkit.org/show_bug.cgi?id=39704 + + * html/canvas/WebGLRenderingContext.cpp: Deal with negative width/height. + (WebCore::WebGLRenderingContext::readPixels): + * html/canvas/WebGLRenderingContext.h: Change width/height type from unsigned long to long. + * html/canvas/WebGLRenderingContext.idl: Ditto. + +2010-06-11 Zhenyao Mo + + Reviewed by Dimitri Glazkov. + + uniform* entry points must ignore the call if a null WebGLUniformLocation is passed + https://bugs.webkit.org/show_bug.cgi?id=38707 + + * html/canvas/WebGLRenderingContext.cpp: uniform* entry points ignore the call if a null WebGLUniformLocation is passed. + (WebCore::WebGLRenderingContext::uniform1f): + (WebCore::WebGLRenderingContext::uniform1fv): + (WebCore::WebGLRenderingContext::uniform1i): + (WebCore::WebGLRenderingContext::uniform1iv): + (WebCore::WebGLRenderingContext::uniform2f): + (WebCore::WebGLRenderingContext::uniform2fv): + (WebCore::WebGLRenderingContext::uniform2i): + (WebCore::WebGLRenderingContext::uniform2iv): + (WebCore::WebGLRenderingContext::uniform3f): + (WebCore::WebGLRenderingContext::uniform3fv): + (WebCore::WebGLRenderingContext::uniform3i): + (WebCore::WebGLRenderingContext::uniform3iv): + (WebCore::WebGLRenderingContext::uniform4f): + (WebCore::WebGLRenderingContext::uniform4fv): + (WebCore::WebGLRenderingContext::uniform4i): + (WebCore::WebGLRenderingContext::uniform4iv): + (WebCore::WebGLRenderingContext::uniformMatrix2fv): + (WebCore::WebGLRenderingContext::uniformMatrix3fv): + (WebCore::WebGLRenderingContext::uniformMatrix4fv): + +2010-06-11 Zhenyao Mo + + Reviewed by Dimitri Glazkov. + + drawElements/drawArrays should validate input parameters according to GLES2 spec + https://bugs.webkit.org/show_bug.cgi?id=38700 + + Tests: fast/canvas/webgl/draw-arrays-out-of-bounds.html + fast/canvas/webgl/draw-elements-out-of-bounds.html + + * html/canvas/WebGLRenderingContext.cpp: + (WebCore::WebGLRenderingContext::drawArrays): Validate input parameters. + (WebCore::WebGLRenderingContext::drawElements): Ditto. + (WebCore::WebGLRenderingContext::validateDrawMode): Validate mode for draw{Arrays/Elements}. + * html/canvas/WebGLRenderingContext.h: Add validateDrawMode, fix incorrect parameter types. + * html/canvas/WebGLRenderingContext.idl: Fix incorrect parameter types. + +2010-06-11 Luiz Agostini + + Reviewed by Antti Koivisto. + + CSS3 Media Queries are not serialized according to CSSOM + https://bugs.webkit.org/show_bug.cgi?id=39220 + + MediaQuery serialization according to specification + http://dev.w3.org/csswg/cssom/#serializing-media-queries. + + MediaQuery objects now ignore duplicated expressions. MediaQueryEvaluator::eval() + now does not proccess MediaQuery objects that are known to be invalid. + + Test: fast/media/media-query-serialization.html + + * css/MediaQuery.cpp: + (WebCore::stringCompare): + (WebCore::MediaQuery::serialize): + (WebCore::MediaQuery::MediaQuery): + (WebCore::MediaQuery::~MediaQuery): + (WebCore::MediaQuery::operator==): + (WebCore::MediaQuery::cssText): + (WebCore::MediaQuery::append): + * css/MediaQuery.h: + (WebCore::MediaQuery::ignored): + (WebCore::MediaQuery::begin): + (WebCore::MediaQuery::end): + * css/MediaQueryExp.cpp: + (WebCore::MediaQueryExp::serialize): + * css/MediaQueryExp.h: + * css/MediaQueryEvaluator.cpp: + (WebCore::MediaQueryEvaluator::eval): + + +2010-06-10 Jeremy Orlow + + Reviewed by Steve Block. + + Implement more of IndexedDB's Indexes and ObjectStores + https://bugs.webkit.org/show_bug.cgi?id=40424 + + Clean up both of these classes a bit and add create/open/remove + methods as needed. + + Tests in a future patch (promise). + + * storage/IDBDatabase.h: + * storage/IDBDatabaseImpl.cpp: + (WebCore::IDBDatabaseImpl::objectStores): + (WebCore::IDBDatabaseImpl::createObjectStore): + (WebCore::IDBDatabaseImpl::objectStore): + (WebCore::IDBDatabaseImpl::removeObjectStore): + * storage/IDBDatabaseImpl.h: + (WebCore::IDBDatabaseImpl::name): + (WebCore::IDBDatabaseImpl::description): + (WebCore::IDBDatabaseImpl::version): + * storage/IDBDatabaseRequest.cpp: + (WebCore::IDBDatabaseRequest::IDBDatabaseRequest): + (WebCore::IDBDatabaseRequest::createObjectStore): + (WebCore::IDBDatabaseRequest::objectStore): + (WebCore::IDBDatabaseRequest::removeObjectStore): + * storage/IDBDatabaseRequest.h: + (WebCore::IDBDatabaseRequest::create): + (WebCore::IDBDatabaseRequest::name): + (WebCore::IDBDatabaseRequest::description): + (WebCore::IDBDatabaseRequest::version): + (WebCore::IDBDatabaseRequest::objectStores): + * storage/IDBDatabaseRequest.idl: + * storage/IDBObjectStore.h: + * storage/IDBObjectStoreImpl.h: + * storage/IDBObjectStoreRequest.cpp: + (WebCore::IDBObjectStoreRequest::get): + (WebCore::IDBObjectStoreRequest::add): + (WebCore::IDBObjectStoreRequest::modify): + (WebCore::IDBObjectStoreRequest::addOrModify): + (WebCore::IDBObjectStoreRequest::remove): + (WebCore::IDBObjectStoreRequest::createIndex): + (WebCore::IDBObjectStoreRequest::index): + (WebCore::IDBObjectStoreRequest::removeIndex): + * storage/IDBObjectStoreRequest.h: + * storage/IDBObjectStoreRequest.idl: + +2010-06-11 Alexander Pavlov + + Reviewed by Pavel Feldman. + + Web Inspector: Enable serialization/deserialization of the frontend state + https://bugs.webkit.org/show_bug.cgi?id=40228 + + * inspector/InspectorBackend.cpp: + (WebCore::InspectorBackend::saveApplicationSettings): + (WebCore::InspectorBackend::saveSessionSettings): + * inspector/InspectorBackend.h: + * inspector/InspectorBackend.idl: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::InspectorController): + (WebCore::InspectorController::setSessionSettings): + (WebCore::InspectorController::populateScriptObjects): + (WebCore::InspectorController::didCommitLoad): + * inspector/InspectorController.h: + * inspector/InspectorFrontend.cpp: + (WebCore::InspectorFrontend::populateApplicationSettings): + (WebCore::InspectorFrontend::populateSessionSettings): + * inspector/InspectorFrontend.h: + * inspector/front-end/ConsoleView.js: + (WebInspector.ConsoleView.prototype._settingsLoaded): + (WebInspector.ConsoleView.prototype._enterKeyPressed.printResult): + (WebInspector.ConsoleView.prototype._enterKeyPressed): + * inspector/front-end/EventListenersSidebarPane.js: + (WebInspector.EventListenersSidebarPane.prototype._settingsLoaded): + (WebInspector.EventListenersSidebarPane.prototype): + (): + * inspector/front-end/InspectorBackendStub.js: + (.WebInspector.InspectorBackendStub.prototype.saveApplicationSettings): + (.WebInspector.InspectorBackendStub.prototype.saveSessionSettings): + * inspector/front-end/ResourceView.js: + (WebInspector.ResourceView.prototype._selectTab): + (WebInspector.ResourceView.prototype._selectHeadersTab): + (WebInspector.ResourceView.prototype.selectContentTab): + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourcesPanel.prototype._createStatusbarButtons): + (WebInspector.ResourcesPanel.prototype._settingsLoaded): + (WebInspector.ResourcesPanel.prototype._toggleLargerResources): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.prototype._showScriptOrResource): + (WebInspector.ScriptsPanel.prototype._addScriptToFilesMenu): + * inspector/front-end/Settings.js: + (WebInspector.populateApplicationSettings): + (WebInspector.populateSessionSettings): + (WebInspector.Settings): + (WebInspector.Settings.prototype.reset): + (WebInspector.Settings.prototype._load): + (WebInspector.Settings.prototype._set): + * inspector/front-end/StylesSidebarPane.js: + (WebInspector.StylesSidebarPane.prototype._settingsLoaded): + (WebInspector.StylesSidebarPane.prototype.update): + (WebInspector.StylesSidebarPane.prototype._changeSetting): + (WebInspector.StylesSidebarPane.prototype._changeColorFormat): + (WebInspector.ComputedStyleSidebarPane.settingsLoaded): + (WebInspector.ComputedStyleSidebarPane.showInheritedToggleFunction): + (WebInspector.ComputedStyleSidebarPane): + * inspector/front-end/WatchExpressionsSidebarPane.js: + (WebInspector.WatchExpressionsSidebarPane): + (WebInspector.WatchExpressionsSidebarPane.prototype._settingsLoaded): + (WebInspector.WatchExpressionsSection): + (WebInspector.WatchExpressionsSection.prototype.saveExpressions): + * inspector/front-end/inspector.js: + (WebInspector.loaded): + (WebInspector.reset): + +2010-06-10 Pavel Feldman + + Reviewed by Yury Semikhatsky. + + Web Inspector: Port performSearch from InjectedScript to InspectorDOMAgent. + + https://bugs.webkit.org/show_bug.cgi?id=40422 + + * inspector/InjectedScriptHost.cpp: + (WebCore::InjectedScriptHost::addNodesToSearchResult): + * inspector/InspectorBackend.cpp: + (WebCore::InspectorBackend::performSearch): + (WebCore::InspectorBackend::searchCanceled): + * inspector/InspectorBackend.h: + * inspector/InspectorBackend.idl: + * inspector/InspectorDOMAgent.cpp: + (WebCore::): + (WebCore::InspectorDOMAgent::InspectorDOMAgent): + (WebCore::InspectorDOMAgent::~InspectorDOMAgent): + (WebCore::InspectorDOMAgent::performSearch): + (WebCore::InspectorDOMAgent::searchCanceled): + (WebCore::InspectorDOMAgent::onMatchJobsTimer): + (WebCore::InspectorDOMAgent::reportNodesAsSearchResults): + * inspector/InspectorDOMAgent.h: + (WebCore::MatchJob::~MatchJob): + (WebCore::MatchJob::MatchJob): + (WebCore::MatchJob::addNodesToResults): + * inspector/InspectorFrontend.cpp: + (WebCore::InspectorFrontend::addNodesToSearchResult): + * inspector/InspectorFrontend.h: + * inspector/InspectorResource.cpp: + (WebCore::InspectorResource::updateScriptObject): + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel.prototype.searchCanceled): + (WebInspector.ElementsPanel.prototype.performSearch): + (WebInspector.ElementsPanel.prototype.addNodesToSearchResult): + * inspector/front-end/InjectedScript.js: + (injectedScriptConstructor): + * inspector/front-end/InjectedScriptAccess.js: + +2010-06-11 Mikhail Naganov + + Reviewed by Pavel Feldman. + + [Chromium] Restore 'console.profiles' access. + + https://bugs.webkit.org/show_bug.cgi?id=39840 + + * bindings/v8/ScriptProfiler.cpp: + (WebCore::ScriptProfiler::stop): + * bindings/v8/custom/V8ConsoleCustom.cpp: + (WebCore::V8Console::profilesAccessorGetter): + * inspector/InspectorController.cpp: + (WebCore::InspectorController::stopUserInitiatedProfiling): + +2010-06-10 Nikita Vasilyev + + Reviewed by Pavel Feldman. + + Web Inspector: Make a close brace in Styles pane selectable. + https://bugs.webkit.org/show_bug.cgi?id=40157 + + * inspector/front-end/inspector.css: + (.styles-selector): + (.styles-section .properties li): + (.styles-section): + +2010-06-11 Yury Semikhatsky + + Reviewed by Pavel Feldman. + + Web Inspector: localize missing script source message + https://bugs.webkit.org/show_bug.cgi?id=40467 + + * English.lproj/localizedStrings.js: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::didParseSource): fixed typo in comment. + +2010-06-11 Zhenyao Mo + + Reviewed by Dimitri Glazkov. + + Vertex attributes enabled as arrays but not bound to buffers must generate INVALID_OPERATION + https://bugs.webkit.org/show_bug.cgi?id=40315 + + * html/canvas/WebGLRenderingContext.cpp: + (WebCore::WebGLRenderingContext::validateRenderingState): Check if an enabled vertext attribs is bound to a buffer. + (WebCore::WebGLRenderingContext::vertexAttribPointer): Set bound buffer in vertex attrib state. + * html/canvas/WebGLRenderingContext.h: Add a member in vertex attrib state to track bound buffer. + +2010-05-31 Jocelyn Turcotte + + Reviewed by Simon Hausmann. + + [Qt] Implement the simple text code path. + https://bugs.webkit.org/show_bug.cgi?id=40077 + + Remove the FONT_FAST_PATH macro and use the Qt's + fast text implementation instead of the one of WebKit. + + The Qt::TextBypassShaping flag is used to tell Qt to + only use the glyph advances. + + Qt 4.7 is needed to get this flag thus the complex path is always + used if QtWebKit is compiled against an earlier version. + + Contrary to the WebKit's implementation, the complex code path + is taken if the text is RightToLeft, justified or is formatted + with non-zero letter or word spacing. + + * platform/graphics/Font.cpp: + (WebCore::Font::drawText): + (WebCore::Font::floatWidth): + (WebCore::Font::selectionRectForText): + (WebCore::Font::offsetForPosition): + * platform/graphics/Font.h: + (WebCore::Font::isRoundingHackCharacter): + * platform/graphics/qt/FontQt.cpp: + (WebCore::fromRawDataWithoutRef): + (WebCore::needComplexCodePath): + (WebCore::setupPlatformContext): + (WebCore::Font::canReturnFallbackFontsForComplexText): + (WebCore::Font::drawSimpleText): + (WebCore::Font::drawComplexText): + (WebCore::Font::floatWidthForSimpleText): + (WebCore::Font::offsetForPositionForSimpleText): + (WebCore::Font::selectionRectForSimpleText): + +2010-06-03 Jocelyn Turcotte + + Reviewed by Simon Hausmann. + + Move the text code path detection code from FontFastPath.cpp to Font.cpp. + https://bugs.webkit.org/show_bug.cgi?id=40077 + + This is a patch preliminary to the implementation of the + simple font code path for the Qt port. + + * platform/graphics/Font.cpp: + (WebCore::Font::setCodePath): + (WebCore::Font::codePath): + * platform/graphics/Font.h: + * platform/graphics/FontFastPath.cpp: + +2010-06-11 Sterling Swigart + + Reviewed by Dmitry Titov. + + Added AsyncImageResizer and ImageResizerThread classes, which after further + patches will be capable of resizing images. + https://bugs.webkit.org/show_bug.cgi?id=40018 + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * html/AsyncImageResizer.cpp: Added. + (WebCore::AsyncImageResizer::create): + (WebCore::AsyncImageResizer::AsyncImageResizer): + (WebCore::AsyncImageResizer::~AsyncImageResizer): + (WebCore::AsyncImageResizer::notifyFinished): + * html/AsyncImageResizer.h: Added. + (WebCore::AsyncImageResizer::CallbackInfo::CallbackInfo): + (WebCore::AsyncImageResizer::): + (WebCore::AsyncImageResizer::resizeComplete): + (WebCore::AsyncImageResizer::resizeError): + * html/ImageResizerThread.cpp: Added. + (WebCore::returnBlobOrError): + (WebCore::ImageResizerThread::start): + (WebCore::ImageResizerThread::ImageResizerThread): + (WebCore::ImageResizerThread::~ImageResizerThread): + (WebCore::ImageResizerThread::imageResizerThreadStart): + (WebCore::ImageResizerThread::imageResizerThread): + * html/ImageResizerThread.h: Added. + +2010-06-11 Steve Block + + Reviewed by Alexey Proskuryakov. + + Client-based Geolocation does not handle multiple simultaneous requests + https://bugs.webkit.org/show_bug.cgi?id=40148 + + Test: fast/dom/Geolocation/multiple-requests.html + + The Geolocation must handle multiple calls to addObserver() from the same Geolocation object. + + * page/GeolocationController.cpp: + (WebCore::GeolocationController::addObserver): + +2010-06-11 Nikita Vasilyev + + Reviewed by Pavel Feldman. + + Web Inspector: When completing using a tab key, select very first value, not a second. + https://bugs.webkit.org/show_bug.cgi?id=40409 + + * inspector/front-end/TextPrompt.js: + (WebInspector.TextPrompt.prototype._completionsReady): + +2010-06-10 Yuzo Fujishima + + Reviewed by Shinichiro Hamaji. + + Fix Bug 40452: REGRESSION: printing is broken if stylesheet has @page + https://bugs.webkit.org/show_bug.cgi?id=40452 + + Test: printing/page-rule-in-media-query.html + + * css/CSSStyleSelector.cpp: + (WebCore::CSSRuleSet::addRulesFromSheet): + (WebCore::CSSRuleSet::addStyleRule): + +2010-06-10 Sheriff Bot + + Unreviewed, rolling out r60989. + http://trac.webkit.org/changeset/60989 + https://bugs.webkit.org/show_bug.cgi?id=40462 + + It makes things crash (Requested by abarth on #webkit). + + * dom/Tokenizer.h: + (WebCore::Tokenizer::isHTMLTokenizer): + * html/HTML5Tokenizer.cpp: + * html/HTML5Tokenizer.h: + * html/HTML5TreeBuilder.h: + * html/HTMLFormControlElement.cpp: + (WebCore::HTMLFormControlElement::removedFromTree): + * html/HTMLTokenizer.h: + (WebCore::HTMLTokenizer::isHTMLTokenizer): + (WebCore::HTMLTokenizer::htmlParser): + +2010-06-10 Tony Gentilcore + + Reviewed by Eric Seidel. + + Fix fast/forms/preserveFormDuringResidualStyle.html for HTML5 Parser. + https://bugs.webkit.org/show_bug.cgi?id=40454 + + This required exposing the HTMLParser which we definitely don't want to + do, but the good news is that it can go away when the HTMLParser goes + away. + + No new tests because covered by fast/forms/preserve/FormDuringResidualStyle.html. + + * dom/Tokenizer.h: + (WebCore::Tokenizer::htmlParser): + * html/HTML5Tokenizer.cpp: + (WebCore::HTML5Tokenizer::htmlParser): + * html/HTML5Tokenizer.h: + * html/HTML5TreeBuilder.h: + (WebCore::HTML5TreeBuilder::htmlParser): + * html/HTMLFormControlElement.cpp: + (WebCore::HTMLFormControlElement::removedFromTree): + * html/HTMLTokenizer.h: + (WebCore::HTMLTokenizer::htmlParser): + +2010-06-10 Tony Chang + + Reviewed by Kent Tamura. + + crash when focus is changed while trying to focus next element + https://bugs.webkit.org/show_bug.cgi?id=40407 + + Test: fast/events/focus-change-crash.html + + * dom/Element.cpp: + (WebCore::Element::focus): + +2010-06-10 Sheriff Bot + + Unreviewed, rolling out r60979. + http://trac.webkit.org/changeset/60979 + https://bugs.webkit.org/show_bug.cgi?id=40450 + + Broke build on Leopard (Requested by kbr_google on #webkit). + + * bindings/js/JSWebGLRenderingContextCustom.cpp: + (WebCore::JSWebGLRenderingContext::bufferData): + (WebCore::JSWebGLRenderingContext::bufferSubData): + (WebCore::JSWebGLRenderingContext::texImage2D): + (WebCore::JSWebGLRenderingContext::texSubImage2D): + * bindings/scripts/CodeGeneratorJS.pm: + * html/HTMLCanvasElement.idl: + * html/HTMLImageElement.idl: + * html/HTMLVideoElement.idl: + * html/canvas/WebGLRenderingContext.idl: + +2010-06-10 Kenneth Russell + + Reviewed by Dimitri Glazkov. + + Delete custom JSC bindings for bufferData, texImage2D and texSubImage2D + https://bugs.webkit.org/show_bug.cgi?id=40443 + + Deleted custom JSC bindings for bufferData, texImage2D and + texSubImage2D and fixed minor associated issues in code generator + and IDL. Updated fast/canvas/webgl/texImageTest-expected.txt, + which now runs as intended. Ran all layout tests, including WebGL + tests, in Safari. + + * bindings/js/JSWebGLRenderingContextCustom.cpp: + - Deleted custom bindings. + * bindings/scripts/CodeGeneratorJS.pm: + - Made overload helper functions static to fix compiler warnings. + - Added needed isObject check for overloads between object and non-object arguments. + * html/HTMLCanvasElement.idl: + * html/HTMLImageElement.idl: + * html/HTMLVideoElement.idl: + - Added GenerateNativeConverter extended attribute. + * html/canvas/WebGLRenderingContext.idl: + - Deleted #ifdefs for custom JSC bindings. + +2010-06-10 David Hyatt + + Reviewed by John Sullivan. + + https://bugs.webkit.org/show_bug.cgi?id=40441, back out the original fix for 29601, since it has broken continuous + wheel delta values. + + * platform/mac/WebCoreSystemInterface.h: + * platform/mac/WebCoreSystemInterface.mm: + * platform/mac/WheelEventMac.mm: + (WebCore::PlatformWheelEvent::PlatformWheelEvent): + +2010-06-10 Abhishek Arya + + Reviewed by Dimitri Glazkov. + + Add null pointer checks for nativeImageForCurrentFrame + function calls. + https://bugs.webkit.org/show_bug.cgi?id=39797 + + * platform/chromium/PasteboardChromium.cpp: + (WebCore::Pasteboard::writeImage): + * platform/graphics/qt/GraphicsContext3DQt.cpp: + (WebCore::GraphicsContext3D::getImageData): + * platform/qt/PasteboardQt.cpp: + (WebCore::Pasteboard::writeImage): + +2010-06-09 Kenneth Russell + + Reviewed by Dimitri Glazkov. + + Implement TypedArray BYTES_PER_ELEMENT + https://bugs.webkit.org/show_bug.cgi?id=39100 + + Implemented BYTES_PER_ELEMENT on all ArrayBufferView subclasses. + Required bug fixes to JSC bindings' custom constructors. Updated + fast/canvas/webgl/array-unit-tests.html to verify. Ran all WebGL + layout tests in Safari and Chromium. + + * bindings/js/JSFloat32ArrayConstructor.cpp: + (WebCore::JSFloat32ArrayConstructor::JSFloat32ArrayConstructor): + (WebCore::JSFloat32ArrayConstructor::getOwnPropertySlot): + (WebCore::JSFloat32ArrayConstructor::getOwnPropertyDescriptor): + * bindings/js/JSFloat32ArrayConstructor.h: + (WebCore::JSFloat32ArrayConstructor::createStructure): + * bindings/js/JSInt16ArrayConstructor.cpp: + (WebCore::JSInt16ArrayConstructor::JSInt16ArrayConstructor): + (WebCore::JSInt16ArrayConstructor::getOwnPropertySlot): + (WebCore::JSInt16ArrayConstructor::getOwnPropertyDescriptor): + * bindings/js/JSInt16ArrayConstructor.h: + (WebCore::JSInt16ArrayConstructor::createStructure): + * bindings/js/JSInt32ArrayConstructor.cpp: + (WebCore::JSInt32ArrayConstructor::JSInt32ArrayConstructor): + (WebCore::JSInt32ArrayConstructor::getOwnPropertySlot): + (WebCore::JSInt32ArrayConstructor::getOwnPropertyDescriptor): + * bindings/js/JSInt32ArrayConstructor.h: + (WebCore::JSInt32ArrayConstructor::createStructure): + * bindings/js/JSInt8ArrayConstructor.cpp: + (WebCore::JSInt8ArrayConstructor::JSInt8ArrayConstructor): + (WebCore::JSInt8ArrayConstructor::getOwnPropertySlot): + (WebCore::JSInt8ArrayConstructor::getOwnPropertyDescriptor): + * bindings/js/JSInt8ArrayConstructor.h: + (WebCore::JSInt8ArrayConstructor::createStructure): + * bindings/js/JSUint16ArrayConstructor.cpp: + (WebCore::JSUint16ArrayConstructor::JSUint16ArrayConstructor): + (WebCore::JSUint16ArrayConstructor::getOwnPropertySlot): + (WebCore::JSUint16ArrayConstructor::getOwnPropertyDescriptor): + * bindings/js/JSUint16ArrayConstructor.h: + (WebCore::JSUint16ArrayConstructor::createStructure): + * bindings/js/JSUint32ArrayConstructor.cpp: + (WebCore::JSUint32ArrayConstructor::JSUint32ArrayConstructor): + (WebCore::JSUint32ArrayConstructor::getOwnPropertySlot): + (WebCore::JSUint32ArrayConstructor::getOwnPropertyDescriptor): + * bindings/js/JSUint32ArrayConstructor.h: + (WebCore::JSUint32ArrayConstructor::createStructure): + * bindings/js/JSUint8ArrayConstructor.cpp: + (WebCore::JSUint8ArrayConstructor::JSUint8ArrayConstructor): + (WebCore::JSUint8ArrayConstructor::getOwnPropertySlot): + (WebCore::JSUint8ArrayConstructor::getOwnPropertyDescriptor): + * bindings/js/JSUint8ArrayConstructor.h: + (WebCore::JSUint8ArrayConstructor::createStructure): + * html/canvas/Float32Array.idl: + * html/canvas/Int16Array.idl: + * html/canvas/Int32Array.idl: + * html/canvas/Int8Array.idl: + * html/canvas/Uint16Array.idl: + * html/canvas/Uint32Array.idl: + * html/canvas/Uint8Array.idl: + +2010-06-10 Eric Seidel + + Reviewed by Adam Barth. + + HTML5 Parser should continue parsing after script execution + https://bugs.webkit.org/show_bug.cgi?id=40416 + + The previous code was just wrong. We were always blocking + the parser after any script execution. Now we correctly continue + parsing after a successful script execution and only block the + parser when we weren't able to execute the script immediately. + + Added a new haveParsingBlockingScript() function to HTML5ScriptRunner + to make some of the code more self-documenting. + + Test: fast/tokenizer/write-multiple-scripts.html + fast/js/implicit-call-with-global-reentry.html + + * html/HTML5ScriptRunner.cpp: + (WebCore::HTML5ScriptRunner::execute): + - Remove some old (now bogus) FIXMEs and notImplemented() calls. + - Fix the logic to match the HTML5 spec by continuing parsing + after script execution and only blocking the parser when the + script wasn't able to immediately run. + (WebCore::HTML5ScriptRunner::haveParsingBlockingScript): + - New function to make some of the code read better. + (WebCore::HTML5ScriptRunner::executeParsingBlockingScripts): + - Use haveParsingBlockingScript(). + (WebCore::HTML5ScriptRunner::executeScriptsWaitingForLoad): + - Use haveParsingBlockingScript(). + (WebCore::HTML5ScriptRunner::runScript): + - Use haveParsingBlockingScript(). + * html/HTML5ScriptRunner.h: + +2010-06-10 Yury Semikhatsky + + Reviewed by Pavel Feldman. + + Web Inspector: to reduce the front end start up time don't push script + sources to frontend if debugger is always enabled, instead request + script content lazily at the moment it should be displyed. It is critical for + always enabled debugger because in that case lots of script may have + already been parsed when the front end is opening and pushing all + of them at once may slow things down(even though the script sources will never + be used if scripts panel isn't open). + https://bugs.webkit.org/show_bug.cgi?id=40364 + + * inspector/InspectorBackend.cpp: + (WebCore::InspectorBackend::getScriptSource): + * inspector/InspectorBackend.h: + * inspector/InspectorBackend.idl: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::didCommitLoad): + (WebCore::InspectorController::getScriptSource): + (WebCore::InspectorController::didParseSource): + * inspector/InspectorController.h: + * inspector/InspectorFrontend.cpp: + (WebCore::InspectorFrontend::didGetScriptSource): + * inspector/InspectorFrontend.h: + * inspector/front-end/InspectorBackendStub.js: + (.WebInspector.InspectorBackendStub.prototype.editScriptSource): + (.WebInspector.InspectorBackendStub.prototype.getScriptSource): + * inspector/front-end/ScriptView.js: + (WebInspector.ScriptView.prototype.setupSourceFrameIfNeeded): + (WebInspector.ScriptView.prototype._didGetScriptSource): + (WebInspector.ScriptView.prototype._sourceFrameSetupFinished): + +2010-06-10 Adam Barth + + Reviewed by Eric Seidel. + + Use allowRequestIfNoIllegalURICharacters instead of context for XSSAuditor::canLoadExternalScriptFromSrc + https://bugs.webkit.org/show_bug.cgi?id=40404 + + We originally added the context parameter to + canLoadExternalScriptFromSrc to work around some false positives caused + by folks checking external script URLs on the server. Our thought was + that we could tell these were not real XSS attacks because the + surrounding context wouldn't match in the URL and the document. + + Implementing this feature in the HTML5 parser is hard because it + pierces a layer of abstraction (the token abstraction of the input + stream). We could hack this into the new parser, but instead I think + it's better to switch to using the allowRequestIfNoIllegalURICharacters + heuristic. + + We designed the allowRequestIfNoIllegalURICharacters after the context + heuristic to deal with other cases where the server was validating + input before echoing it. However, we never tried applying it to + canLoadExternalScriptFromSrc. + + It's possible that this will cause false positives and will need to be + reverted, which is why I've left in some of the infrustructure for + computing context. We don't have a good way to know if that will + happen except to try. We do know, however, that this heuristic will + work for the original false positives we saw. + + * html/HTML5Tokenizer.cpp: + (WebCore::HTML5Tokenizer::shouldLoadExternalScriptFromSrc): + * html/HTMLTokenizer.cpp: + (WebCore::HTMLTokenizer::parseTag): + * page/XSSAuditor.cpp: + (WebCore::XSSAuditor::canLoadExternalScriptFromSrc): + * page/XSSAuditor.h: + +2010-06-10 Kwang Yul Seo + + Reviewed by Kent Tamura. + + Add ENABLE(DATABASE) guard for DatabaseAuthorizer.cpp + https://bugs.webkit.org/show_bug.cgi?id=40399 + + Build fix for ENABLE(DATABASE)=0. + + * storage/DatabaseAuthorizer.cpp: + +2010-06-10 Shu Chang + + Reviewed by Kenneth Rohde Christiansen. + + Change the type of ShadowBlur from int to float in GraphicsContext. + Using int for ShadowBlur loses precision and fails the test. + Note: This code change fixes Qt port but Mac is still failing due to + platform issue. Function CGContextSetShadowWithColor() does not take + a blur value less than 0.5. + + https://bugs.webkit.org/show_bug.cgi?id=40370 + + * platform/graphics/GraphicsContext.cpp: + (WebCore::GraphicsContext::setShadow): + (WebCore::GraphicsContext::getShadow): + * platform/graphics/GraphicsContext.h: + * platform/graphics/GraphicsContextPrivate.h: + * platform/graphics/cairo/FontCairo.cpp: + (WebCore::Font::drawGlyphs): + * platform/graphics/cairo/GraphicsContextCairo.cpp: + (WebCore::GraphicsContext::calculateShadowBufferDimensions): + (WebCore::drawPathShadow): + (WebCore::drawBorderlessRectShadow): + (WebCore::GraphicsContext::setPlatformShadow): + * platform/graphics/cairo/ImageCairo.cpp: + (WebCore::BitmapImage::draw): + * platform/graphics/cg/GraphicsContextCG.cpp: + (WebCore::GraphicsContext::setPlatformShadow): + * platform/graphics/chromium/FontChromiumWin.cpp: + (WebCore::TransparencyAwareFontPainter::TransparencyAwareGlyphPainter::drawGlyphs): + (WebCore::Font::drawComplexText): + * platform/graphics/gtk/FontGtk.cpp: + (WebCore::Font::drawComplexText): + * platform/graphics/haiku/GraphicsContextHaiku.cpp: + (WebCore::GraphicsContext::setPlatformShadow): + * platform/graphics/mac/FontMac.mm: + (WebCore::Font::drawGlyphs): + * platform/graphics/openvg/GraphicsContextOpenVG.cpp: + (WebCore::GraphicsContext::setPlatformShadow): + * platform/graphics/qt/FontQt.cpp: + (WebCore::Font::drawComplexText): + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContext::drawRect): + (WebCore::GraphicsContext::drawLine): + (WebCore::GraphicsContext::strokeArc): + (WebCore::GraphicsContext::drawConvexPolygon): + (WebCore::drawFilledShadowPath): + (WebCore::GraphicsContext::strokePath): + (WebCore::drawBorderlessRectShadow): + (WebCore::GraphicsContext::setPlatformShadow): + * platform/graphics/qt/ImageQt.cpp: + (WebCore::BitmapImage::draw): + * platform/graphics/skia/GraphicsContextSkia.cpp: + (WebCore::GraphicsContext::setPlatformShadow): + * platform/graphics/skia/SkiaFontWin.cpp: + (WebCore::windowsCanHandleDrawTextShadow): + * platform/graphics/win/FontCGWin.cpp: + (WebCore::drawGDIGlyphs): + (WebCore::Font::drawGlyphs): + * platform/graphics/wince/GraphicsContextWince.cpp: + (WebCore::GraphicsContext::fillRoundedRect): + (WebCore::GraphicsContext::setPlatformShadow): + (WebCore::GraphicsContext::drawText): + * platform/graphics/wx/GraphicsContextWx.cpp: + (WebCore::GraphicsContext::setPlatformShadow): + +2010-06-10 Yael Aharon + + Reviewed by Kenneth Rohde Christiansen. + + Support for loading notification icons + https://bugs.webkit.org/show_bug.cgi?id=40396 + + Make notification objects download the icon needed for displaying the + notification before calling the NotificationPresenter to display the + notification. + + An error during the download would cause the notification to be displayed + without an icon. + + If a notification is in the process of download, and a new notification + is created with the same ReplaceId, the download is not cancelled + immediately and the notification is removed only after the download is + complete. + + Tests: http/tests/notifications/icon-does-not-exist.html + http/tests/notifications/icon-exists-cancel.html + http/tests/notifications/icon-exists-show-alert-during-load.html + http/tests/notifications/icon-exists.html + http/tests/notifications/icon-requires-auth.html + + * notifications/Notification.cpp: + (WebCore::Notification::Notification): + (WebCore::Notification::~Notification): + (WebCore::Notification::show): + (WebCore::Notification::cancel): + (WebCore::Notification::startLoading): + (WebCore::Notification::stopLoading): + (WebCore::Notification::didReceiveResponse): + (WebCore::Notification::didReceiveData): + (WebCore::Notification::didFinishLoading): + (WebCore::Notification::didFail): + (WebCore::Notification::didFailRedirectCheck): + (WebCore::Notification::didReceiveAuthenticationCancellation): + (WebCore::Notification::finishLoading): + * notifications/Notification.h: + (WebCore::Notification::iconData): + (WebCore::Notification::releaseIconData): + (WebCore::Notification::): + +2010-06-10 Raine Makelainen + + Reviewed by Kenneth Rohde Christiansen. + + Impossible to set input method hints based HTML5 input types + https://bugs.webkit.org/show_bug.cgi?id=40107 + + Helper methods for checking "tel", "number", "email", + and "url" input element types. + + * html/HTMLInputElement.h: + (WebCore::HTMLInputElement::isTelephoneField): + (WebCore::HTMLInputElement::isNumberField): + (WebCore::HTMLInputElement::isEmailField): + (WebCore::HTMLInputElement::isUrlField): + +2010-06-10 Daniel Cheng + + Reviewed by Jian Li. + + Don't convert filenames to URLs in edit drags. + https://bugs.webkit.org/show_bug.cgi?id=38826 + + For security reasons, we don't want to expose file system paths to web + content, so we filter them out of edit drags. + + Test: editing/pasteboard/file-drag-to-editable.html + + * page/DragController.cpp: + (WebCore::documentFragmentFromDragData): + * platform/DragData.h: + (WebCore::DragData::): + * platform/android/DragDataAndroid.cpp: + (WebCore::DragData::containsURL): + (WebCore::DragData::asURL): + * platform/chromium/DragDataChromium.cpp: + (WebCore::DragData::containsURL): + (WebCore::DragData::asURL): + * platform/efl/DragDataEfl.cpp: + (WebCore::DragData::containsURL): + (WebCore::DragData::asURL): + * platform/gtk/DragDataGtk.cpp: + (WebCore::DragData::containsURL): + (WebCore::DragData::asURL): + * platform/haiku/DragDataHaiku.cpp: + (WebCore::DragData::containsURL): + (WebCore::DragData::asURL): + * platform/mac/DragDataMac.mm: + (WebCore::DragData::containsURL): + (WebCore::DragData::asURL): + * platform/qt/DragDataQt.cpp: + (WebCore::DragData::asPlainText): + (WebCore::DragData::containsURL): + (WebCore::DragData::asURL): + * platform/win/ClipboardUtilitiesWin.cpp: + (WebCore::getURL): + (WebCore::getPlainText): + * platform/win/ClipboardUtilitiesWin.h: + * platform/win/ClipboardWin.cpp: + (WebCore::ClipboardWin::getData): + * platform/win/DragDataWin.cpp: + (WebCore::DragData::containsURL): + (WebCore::DragData::asURL): + * platform/wince/DragDataWince.cpp: + (WebCore::DragData::containsURL): + (WebCore::DragData::asURL): + * platform/wx/DragDataWx.cpp: + (WebCore::DragData::containsURL): + (WebCore::DragData::asURL): + +2010-06-10 Mike Belshe + + Reviewed by David Levin + + Track whether a resource is loaded via a proxy. + + https://bugs.webkit.org/show_bug.cgi?id=40312 + + * platform/network/chromium/ResourceResponse.h: + (WebCore::ResourceResponse::wasFetchedViaProxy): + (WebCore::ResourceResponse::setWasFetchedViaProxy): + +2010-06-10 Jungshik Shin + + Reviewed by Kent Tamura + + Bug 38224 - [chromium] Enable rendering of Ethiopic, Lao, Tibetan + and a few other scripts on Win XP + + https://bugs.webkit.org/show_bug.cgi?id=38224 + + Make it possible to specify a list of fonts for per-script + fallback instead of a single font per script. This is + necessary for Malayalam (for which Windows font doesn't + support Unicode 5.x fully on Vista or earlier), Ethiopic + (we want to support on XP with a 3rd party font because XP + doesn't have any Ethiopic font out of the box) and some other + scripts. This is a short-term 'fix' until we have per-script + font preferences. + + No layout test is added because the test results would be + dependent on which fonts are present. + + * platform/graphics/chromium/FontUtilsChromiumWin.cpp: + (WebCore::): + (WebCore::FontMap::ScriptToFontFamilies::): + +2010-06-09 Andrei Popescu + + Reviewed by Adam Barth. + + CodeGeneratorJS.pm incorrectly increments $paramIndex when a method is declared with [CallWith] + https://bugs.webkit.org/show_bug.cgi?id=40372 + + Use two variables to keep track of the number of arguments passed from JavaScript vs the number + of arguments passed to the corresponding C++ method. These numbers can be different since + the parameter declared via [CallWith] is generated in the bindings instead of being passed + from JavaScript. + + Test: storage/indexeddb/idb-objectstore-request.html + + * bindings/scripts/CodeGeneratorJS.pm: + * bindings/scripts/test/CPP/WebDOMTestObj.cpp: + (WebDOMTestObj::withScriptExecutionContext): + * bindings/scripts/test/CPP/WebDOMTestObj.h: + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndArg): + (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg): + (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture): + (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD): + +2010-06-09 MORITA Hajime + + Reviewed by Kent Tamura. + + Refactoring: Simple shadow elements should be factored out . + https://bugs.webkit.org/show_bug.cgi?id=40400 + + Pulled ShadowElement class up from SliderThumbElement, + ProgressValueElement, ShadowInputElement. + And renamed ProgressValueElement to ShadowBlockElement. + + No new tests. Because there is no functional change. + + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * rendering/RenderFileUploadControl.cpp: + * rendering/RenderProgress.cpp: + (WebCore::RenderProgress::updateValuePartState): + * rendering/RenderProgress.h: + * rendering/RenderSlider.cpp: + (WebCore::SliderThumbElement::SliderThumbElement): + (WebCore::SliderThumbElement::defaultEventHandler): + (WebCore::SliderThumbElement::detach): + * rendering/ShadowElement.cpp: Added. + (WebCore::ShadowBlockElement::create): + (WebCore::ShadowBlockElement::ShadowBlockElement): + (WebCore::ShadowInputElement::create): + (WebCore::ShadowInputElement::ShadowInputElement): + * rendering/ShadowElement.h: Added. + (WebCore::ShadowElement::ShadowElement): + (WebCore::ShadowElement::isShadowNode): + (WebCore::ShadowElement::shadowParentNode): + +2010-06-10 Eric Seidel + + Reviewed by Adam Barth. + + Reduce FrameView.h includes to speed up build times + https://bugs.webkit.org/show_bug.cgi?id=40408 + + Another fix for Qt. + + * page/Frame.h: + - Include CSSMutableStyleDeclaration.h since it's used by m_typingStyle = 0; + +2010-06-10 Eric Seidel + + Reviewed by Adam Barth. + + Reduce FrameView.h includes to speed up build times + https://bugs.webkit.org/show_bug.cgi?id=40408 + + More attempted build fixes for Tiger and Qt. + + * page/Frame.cpp: + * page/Frame.h: + +2010-06-10 Eric Seidel + + Reviewed by Adam Barth. + + Reduce FrameView.h includes to speed up build times + https://bugs.webkit.org/show_bug.cgi?id=40408 + + Add a few more RenderLayer.h includes to fix non-mac builds. + + * page/FrameView.cpp: + * rendering/RenderObject.cpp: + * rendering/RenderTreeAsText.cpp: + +2010-06-10 Eric Seidel + + Reviewed by Adam Barth. + + Reduce FrameView.h includes to speed up build times + https://bugs.webkit.org/show_bug.cgi?id=40408 + + Cleaned up FrameView.h includes and then propagated the + cascade of includes to the necessary .cpp files. + This should reduce the set of files rebuilt every + time FrameView.h changes, and should also reduce the size + of some .o files. + + No functional changes, thus no tests. + + * accessibility/AccessibilityRenderObject.cpp: + * dom/ContainerNode.cpp: + * dom/Document.cpp: + * dom/Element.cpp: + * dom/EventTarget.h: + * dom/Node.cpp: + * editing/EditorCommand.cpp: + * editing/SelectionController.cpp: + * html/HTML5Tokenizer.cpp: + (WebCore::HTML5Tokenizer::script): + - No need for this to be inline. Being inline required + Frame.h in the header, which causes huge include cascade. + * html/HTML5Tokenizer.h: + * page/DragController.cpp: + * page/EventHandler.cpp: + * page/Frame.h: + * page/FrameView.h: + * page/PrintContext.cpp: + * page/SpatialNavigation.cpp: + * rendering/RenderBlock.cpp: + * rendering/RenderBlockLineLayout.cpp: + * rendering/RenderImage.cpp: + * rendering/RenderInline.cpp: + * rendering/RenderObject.h: + * rendering/RenderTextControlSingleLine.cpp: + * rendering/RenderWidget.cpp: + * rendering/SVGRenderSupport.cpp: + +2010-06-10 Adam Barth + + Reviewed by Eric Seidel. + + Move HTML5 entity parser to its own file + https://bugs.webkit.org/show_bug.cgi?id=40406 + + Moving this algorithm to its own file better encapsulates its + dependencies and makes it callable from other parts of WebCore. + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * html/HTML5EntityParser.cpp: Copied from WebCore/html/HTML5Lexer.cpp. + (WebCore::): + (WebCore::consumeHTML5Entity): + * html/HTML5EntityParser.h: Copied from WebCore/html/HTML5Lexer.h. + * html/HTML5Lexer.cpp: + (WebCore::HTML5Lexer::processEntity): + (WebCore::HTML5Lexer::nextToken): + * html/HTML5Lexer.h: + +2010-06-09 Tony Gentilcore + + Reviewed by Adam Barth. + + HTML5 Parser: Fix fast/profiler tests that depend on event handler line numbers + https://bugs.webkit.org/show_bug.cgi?id=40393 + + This emulated the old behavior in HTMLTokenizer:processToken() + + No new tests because covered by: + - fast/profiler/dead-time.html + - fast/profiler/inline-event-handler.html + - fast/profiler/stop-profiling-after-setTimeout.html + - fast/profiler/throw-exception-from-eval.html + + * html/HTML5Tokenizer.cpp: + (WebCore::HTML5Tokenizer::pumpLexer): + +2010-06-09 Alexey Proskuryakov + + Reviewed by Dan Bernstein. + + https://bugs.webkit.org/show_bug.cgi?id=9504 + img tag rewritten by innerHTML doesn't use image map + + Test: fast/dom/replaced-image-map.html + + * html/HTMLMapElement.cpp: + (WebCore::HTMLMapElement::~HTMLMapElement): Destructor is not a good place to make changes + that affect page behavior, because destructors are called by garbage collector. Don't + undregister the image map from here. + (WebCore::HTMLMapElement::parseMappedAttribute): Only tell document about the map if it's + actually in document. A map in a detached subtree isn't used by Firefox at least. + (WebCore::HTMLMapElement::insertedIntoDocument): Register the map. + (WebCore::HTMLMapElement::removedFromDocument): Unregister the map. + + * html/HTMLMapElement.h: Added insertedIntoDocument/removedFromDocument overrides. + +2010-06-09 Roland Steiner + + Reviewed by Ojan Vafai. + + Bug 35632 - htmlediting.cpp : isEmptyTableCell() is incomplete + https://bugs.webkit.org/show_bug.cgi?id=35632 + + Correct isEmptyTableCell to check for the presence of other renderer + children. + + Test: editing/deleting/delete-br-in-last-table-cell.html + + * editing/htmlediting.cpp: + (WebCore::isEmptyTableCell): + +2010-06-09 Qi Zhang + + Reviewed by Laszlo Gombos. + + [Qt] Failed at http://philip.html5.org/tests/canvas/suite/tests/2d.path.arcTo.transformation.html + https://bugs.webkit.org/show_bug.cgi?id=38598 + + In path transform function handle path only have moveElement case. + + * platform/graphics/qt/PathQt.cpp: + (WebCore::Path::transform): + +2010-06-09 Anton Muhin + + Reviewed by Nate Chapin. + + [v8] First phase of switching to new named property query API + https://bugs.webkit.org/show_bug.cgi?id=40303 + + To allow better management of attributes of intercepted properties, + we're starting to switch to new named property query API which + now could return attributes instead of simple property present/absent + flag. The next step would remove USE_NEW_QUERY_CALLBACK, then + v8 would have them enabled by default. + + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/v8/NPV8Object.cpp: + * bindings/v8/ScriptArray.cpp: + * bindings/v8/ScriptCallStack.cpp: + * bindings/v8/SerializedScriptValue.cpp: + * bindings/v8/V8Binding.cpp: + * bindings/v8/V8DOMWrapper.cpp: + * bindings/v8/V8GCController.cpp: + * bindings/v8/V8IsolatedContext.cpp: + * bindings/v8/V8NPObject.cpp: + (WebCore::npObjectQueryProperty): + * bindings/v8/V8Proxy.cpp: + * bindings/v8/custom/V8PopStateEventCustom.cpp: + * bindings/v8/custom/V8StorageCustom.cpp: + (WebCore::V8Storage::namedPropertyQuery): + * config.h: + +2010-06-09 Steve Block + + Reviewed by Jeremy Orlow. + + Need to include V8Proxy.h in V8 generated bindings for toV8Context() + https://bugs.webkit.org/show_bug.cgi?id=40290 + + No new tests, build fix only. + + * bindings/scripts/CodeGeneratorV8.pm: + +2010-06-09 Jarkko Sakkinen + + Reviewed by Kenneth Rohde Christiansen. + + WebGL rendering context does not activate unless accelerated + compositing is enabled from settings. + https://bugs.webkit.org/show_bug.cgi?id=37772 + + * html/HTMLCanvasElement.cpp: + (WebCore::HTMLCanvasElement::getContext): + +2010-06-09 Yong Li + + Reviewed by George Staikos. + + https://bugs.webkit.org/show_bug.cgi?id=40252 + Make image down-sampling threshold runtime adjustable. + + No new test needed. + + * platform/graphics/ImageSource.cpp: + (WebCore::ImageSource::setData): + * platform/graphics/ImageSource.h: + (WebCore::ImageSource::maxPixelsPerDecodedImage): + (WebCore::ImageSource::setMaxPixelsPerDecodedImage): + +2010-06-09 Adam Barth + + Reviewed by Eric Seidel. + + Fix handling of bytes received from the network while in document.write + https://bugs.webkit.org/show_bug.cgi?id=40356 + + The old tokenizer has specially logic for handling the case of + receiving bytes from the network while in a nested call to + document.write. This patch implements similar logic for the HTML5 + tokenizer. Also, this patch abstracts the tricky shuffling of + SegmentedStrings behind a simple API. + + I'm not sure how to trigger this case. My guess is we can trigger it + using a nested event loop, e.g., via alert(), but I'm not sure how to + test that in a LayoutTest. There don't appear to be any LayoutTests + that currently test this behavior despite it being present in the old + tokenizer. + + * html/HTML5Tokenizer.cpp: + (WebCore::HTML5Tokenizer::pumpLexer): + (WebCore::HTML5Tokenizer::write): + - Added a branch for the |append| argument. + (WebCore::HTML5Tokenizer::end): + (WebCore::HTML5Tokenizer::finish): + (WebCore::HTML5Tokenizer::executeScript): + - Switch over to using a RAII pattern for recording and restoring + insertion points. + * html/HTML5Tokenizer.h: + (WebCore::HTML5Tokenizer::InputStream::InputStream): + (WebCore::HTML5Tokenizer::InputStream::appendToEnd): + (WebCore::HTML5Tokenizer::InputStream::insertAtCurrentInsertionPoint): + (WebCore::HTML5Tokenizer::InputStream::close): + - Putting the close() method on InputStream makes it much easier to + handle EOF. We now just close the last buffer in the stream when + the network says it's done. + (WebCore::HTML5Tokenizer::InputStream::current): + - This class could be moved to its own file, but it shouldn't be + used outside of the tokenizer. + (WebCore::HTML5Tokenizer::InsertionPointRecord::InsertionPointRecord): + (WebCore::HTML5Tokenizer::InsertionPointRecord::~InsertionPointRecord): + - A simple RAII class for managing saved insertion points. + * platform/text/SegmentedString.cpp: + (WebCore::SegmentedString::operator=): + - Fix a related bug where m_closed was not being copied properly in + the assignment operator. + +2010-06-09 Tony Gentilcore + + Reviewed by Adam Barth. + + Fix fast/parser/hex-entities-length.html for HTML5 parser + https://bugs.webkit.org/show_bug.cgi?id=40385 + + Stripping surrogate pair values appears to be a problem with the spec + in "Preprocessing the input stream." Minefield doesn't appear to + implement the part in question. So this patch removes that guard and + adds a FIXME to track the issue. + + No new tests because covered by fast/parser/hex-entities-length.html + + * html/HTML5Lexer.h: + (WebCore::HTML5Lexer::InputStreamPreprocessor::peek): + +2010-06-09 Kenneth Russell + + Reviewed by Dimitri Glazkov. + + Update readPixels to take ArrayBufferView rather than returning it + https://bugs.webkit.org/show_bug.cgi?id=40322 + + No new tests; covered by existing tests, which have been modified. + + * html/canvas/WebGLRenderingContext.cpp: + (WebCore::WebGLRenderingContext::readPixels): + * html/canvas/WebGLRenderingContext.h: + * html/canvas/WebGLRenderingContext.idl: + +2010-06-09 Enrico Ros + + Reviewed by Ariya Hidayat. + + Fix drawing zero-sized gradients on Canvas. + https://bugs.webkit.org/show_bug.cgi?id=40340 + + HTML5 draft says that nothing must be painted if the gradient start + point equals the stop point. + + This commit fixes the following canvas test: + http://philip.html5.org/tests/canvas/suite/tests/2d.gradient.interpolate.zerosize.html + + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::fillRect): skip zero-sized linear gradients + * platform/graphics/Gradient.h: + (WebCore::Gradient::isRadial): made public + (WebCore::Gradient::isZeroSize): true if start == stop + +2010-06-09 Leandro Pereira + + Reviewed by Adam Treat. + + [EFL] Allow building core libraries as shared objects to speed up + linking time on machines with small amounts of memory. + http://webkit.org/b/39899 + + * CMakeLists.txt: If building with shared core, install the lib. + Remove npapi.cpp (causes conflicts when linking dynamically). + * CMakeListsEfl.txt: EFL libraries are needed to link dynamically. + +2010-06-09 Mark Rowe + + Reviewed by Adele Peterson. + + REGRESSION (r51629): WebBackForwardList created via -init crashes when -addItem: is called. + + A WebBackForwardList created via -init results in a BackForwardList being created with a null m_page. + BackForwardList needs to be careful not to dereference m_page without first ensuring it's not null. + + * history/BackForwardList.cpp: + (WebCore::BackForwardList::addItem): Null-check m_page. + (WebCore::BackForwardList::goBack): Ditto. + (WebCore::BackForwardList::goForward): Ditto. + (WebCore::BackForwardList::goToItem): Ditto. + (WebCore::BackForwardList::setCapacity): Ditto. + +2010-06-09 Kwang Yul Seo + + Reviewed by Kent Tamura. + + [BREWMP] Add dummy Context Menu implementation + https://bugs.webkit.org/show_bug.cgi?id=40223 + + Brew MP does not use Context Menu. Add dummy implementation. + + * platform/brew/ContextMenuBrew.cpp: Added. + (WebCore::ContextMenu::ContextMenu): + (WebCore::ContextMenu::~ContextMenu): + (WebCore::ContextMenu::itemCount): + (WebCore::ContextMenu::insertItem): + (WebCore::ContextMenu::appendItem): + (WebCore::ContextMenu::itemWithAction): + (WebCore::ContextMenu::itemAtIndex): + (WebCore::ContextMenu::setPlatformDescription): + (WebCore::ContextMenu::platformDescription): + (WebCore::ContextMenu::releasePlatformDescription): + * platform/brew/ContextMenuItemBrew.cpp: Added. + (WebCore::ContextMenuItem::ContextMenuItem): + (WebCore::ContextMenuItem::~ContextMenuItem): + (WebCore::ContextMenuItem::releasePlatformDescription): + (WebCore::ContextMenuItem::type): + (WebCore::ContextMenuItem::action): + (WebCore::ContextMenuItem::title): + (WebCore::ContextMenuItem::platformSubMenu): + (WebCore::ContextMenuItem::setType): + (WebCore::ContextMenuItem::setAction): + (WebCore::ContextMenuItem::setTitle): + (WebCore::ContextMenuItem::setSubMenu): + (WebCore::ContextMenuItem::setChecked): + (WebCore::ContextMenuItem::setEnabled): + (WebCore::ContextMenuItem::enabled): + +2010-06-09 Kwang Yul Seo + + Reviewed by Kent Tamura. + + [BREWMP] Port Clipboard + https://bugs.webkit.org/show_bug.cgi?id=35734 + + Add dummy Clipboard. + + * platform/brew/ClipboardBrew.cpp: Added. + (WebCore::ClipboardBrew::ClipboardBrew): + (WebCore::ClipboardBrew::~ClipboardBrew): + (WebCore::ClipboardBrew::clearData): + (WebCore::ClipboardBrew::clearAllData): + (WebCore::ClipboardBrew::getData): + (WebCore::ClipboardBrew::setData): + (WebCore::ClipboardBrew::types): + (WebCore::ClipboardBrew::files): + (WebCore::ClipboardBrew::setDragImage): + (WebCore::ClipboardBrew::setDragImageElement): + (WebCore::ClipboardBrew::createDragImage): + (WebCore::ClipboardBrew::declareAndWriteDragImage): + (WebCore::ClipboardBrew::writeURL): + (WebCore::ClipboardBrew::writeRange): + (WebCore::ClipboardBrew::writePlainText): + (WebCore::ClipboardBrew::hasData): + * platform/brew/ClipboardBrew.h: Added. + +2010-06-09 Anders Bakken + + Reviewed by David Levin. + + [Qt] ClipboardQt.cpp has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=39781 + + * platform/qt/ClipboardQt.cpp: + (WebCore::ClipboardQt::declareAndWriteDragImage): + +2010-06-09 Kenneth Russell + + Reviewed by Dimitri Glazkov. + + Rename FloatArray to Float32Array + https://bugs.webkit.org/show_bug.cgi?id=40323 + + Used do-webcore-rename to perform renaming. Manually undid + incorrect changes to WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp, + WebCore/manual-tests/resources/ArrayParameterTestApplet.java and + ArrayParameterTestApplet.class. Updated LayoutTests. Built and ran + all layout tests on Safari; built Chromium and ran selected WebGL + tests. + + * CMakeLists.txt: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pri: + * WebCore.pro: + * WebCore.xcodeproj/project.pbxproj: + * bindings/generic/RuntimeEnabledFeatures.h: + (WebCore::RuntimeEnabledFeatures::float32ArrayEnabled): + * bindings/js/JSArrayBufferViewCustom.cpp: + (WebCore::toJS): + * bindings/js/JSDOMWindowCustom.cpp: + (WebCore::JSDOMWindow::float32Array): + (WebCore::JSDOMWindow::webGLFloatArray): + * bindings/js/JSFloat32ArrayConstructor.cpp: Copied from WebCore/bindings/js/JSFloatArrayConstructor.cpp. + (WebCore::): + (WebCore::JSFloat32ArrayConstructor::JSFloat32ArrayConstructor): + (WebCore::constructCanvasFloatArray): + (WebCore::JSFloat32ArrayConstructor::getConstructData): + * bindings/js/JSFloat32ArrayConstructor.h: Copied from WebCore/bindings/js/JSFloatArrayConstructor.h. + * bindings/js/JSFloat32ArrayCustom.cpp: Copied from WebCore/bindings/js/JSFloatArrayCustom.cpp. + (WebCore::JSFloat32Array::indexSetter): + (WebCore::toJS): + (WebCore::JSFloat32Array::set): + * bindings/js/JSFloatArrayConstructor.cpp: Removed. + * bindings/js/JSFloatArrayConstructor.h: Removed. + * bindings/js/JSFloatArrayCustom.cpp: Removed. + * bindings/js/JSWebGLRenderingContextCustom.cpp: + (WebCore::dataFunctionf): + (WebCore::dataFunctionMatrix): + * bindings/v8/custom/V8ArrayBufferViewCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8DOMWindowCustom.cpp: + (WebCore::V8DOMWindow::WebGLFloatArrayAccessorGetter): + * bindings/v8/custom/V8Float32ArrayCustom.cpp: Copied from WebCore/bindings/v8/custom/V8FloatArrayCustom.cpp. + (WebCore::V8Float32Array::constructorCallback): + (WebCore::V8Float32Array::setCallback): + (WebCore::toV8): + * bindings/v8/custom/V8FloatArrayCustom.cpp: Removed. + * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp: + (WebCore::vertexAttribAndUniformHelperf): + (WebCore::uniformMatrixHelper): + * html/canvas/Float32Array.cpp: Copied from WebCore/html/canvas/FloatArray.cpp. + (WebCore::Float32Array::create): + (WebCore::Float32Array::Float32Array): + (WebCore::Float32Array::slice): + * html/canvas/Float32Array.h: Copied from WebCore/html/canvas/FloatArray.h. + * html/canvas/Float32Array.idl: Copied from WebCore/html/canvas/FloatArray.idl. + * html/canvas/FloatArray.cpp: Removed. + * html/canvas/FloatArray.h: Removed. + * html/canvas/FloatArray.idl: Removed. + * html/canvas/WebGLGetInfo.cpp: + (WebCore::WebGLGetInfo::WebGLGetInfo): + (WebCore::WebGLGetInfo::getWebGLFloatArray): + * html/canvas/WebGLGetInfo.h: + * html/canvas/WebGLRenderingContext.cpp: + (WebCore::WebGLRenderingContext::getUniform): + (WebCore::WebGLRenderingContext::getVertexAttrib): + (WebCore::WebGLRenderingContext::uniform1fv): + (WebCore::WebGLRenderingContext::uniform2fv): + (WebCore::WebGLRenderingContext::uniform3fv): + (WebCore::WebGLRenderingContext::uniform4fv): + (WebCore::WebGLRenderingContext::uniformMatrix2fv): + (WebCore::WebGLRenderingContext::uniformMatrix3fv): + (WebCore::WebGLRenderingContext::uniformMatrix4fv): + (WebCore::WebGLRenderingContext::vertexAttrib1fv): + (WebCore::WebGLRenderingContext::vertexAttrib2fv): + (WebCore::WebGLRenderingContext::vertexAttrib3fv): + (WebCore::WebGLRenderingContext::vertexAttrib4fv): + (WebCore::WebGLRenderingContext::getWebGLFloatArrayParameter): + * html/canvas/WebGLRenderingContext.h: + * html/canvas/WebGLRenderingContext.idl: + * page/DOMWindow.idl: + * platform/graphics/GraphicsContext3D.h: + * platform/graphics/mac/GraphicsContext3DMac.cpp: + * platform/graphics/qt/GraphicsContext3DQt.cpp: + +2010-06-09 Eric Seidel + + Reviewed by Adam Barth. + + HTML5 Parser needs to integrate with the XSSAuditor + https://bugs.webkit.org/show_bug.cgi?id=40287 + + This fixes most of the XSSAuditor tests, except for the ones + which rely on the srcValue "context". The previous HTMLTokenizer + implementation was both Lexer and ScriptRunner and thus could + provide the XSSAuditor with the un-modified attribute source. + This naive implementation will fail the context-sensitive tests + but Adam Barth says he'll just have to find a new way to provide + the required information to the XSSAuditor in a later patch. + + Covered by numerous http/tests/security/xssAuditor tests. + + * html/HTML5ScriptRunner.cpp: + (WebCore::HTML5ScriptRunner::requestScript): + - Ask the HTML5ScriptRunner host before running any scripts. + * html/HTML5ScriptRunnerHost.h: + - Add a shouldLoadExternalScriptFromSrc declaration. + * html/HTML5Tokenizer.cpp: + (WebCore::HTML5Tokenizer::shouldLoadExternalScriptFromSrc): + - Ask the XSSAuditor if we're allowed to run the passed script. + * html/HTML5Tokenizer.h: + +2010-06-09 Tony Gentilcore + + Reviewed by Adam Barth. + + Fix script-after-frameset test in HTML5 parser + https://bugs.webkit.org/show_bug.cgi?id=40274 + + The old HTMLTokenizer enforced this in scriptHandler(). We don't use + that code anymore, so it needs to be implemented. The spec does this + as a part of "insertion mode"->"after frameset", so this adds an + InsertionMode enum instead of a one-off boolean. + + No new tests because covered by fast/tokenizer/script-after-frameset.html + + * html/HTML5TreeBuilder.cpp: + (WebCore::HTML5TreeBuilder::HTML5TreeBuilder): + (WebCore::HTML5TreeBuilder::passTokenToLegacyParser): + * html/HTML5TreeBuilder.h: + (WebCore::HTML5TreeBuilder::): + (WebCore::HTML5TreeBuilder::setInsertionMode): + (WebCore::HTML5TreeBuilder::insertionMode): + +2010-06-09 Kwang Yul Seo + + Reviewed by Kent Tamura. + + [BREWMP] Add EventLoop + https://bugs.webkit.org/show_bug.cgi?id=39401 + + BREW MP does not have an explicit event loop. Add dummy EventLoop::cycle. + + * platform/brew/EventLoopBrew.cpp: Added. + (WebCore::EventLoop::cycle): + +2010-06-09 Sheriff Bot + + Unreviewed, rolling out r60889. + http://trac.webkit.org/changeset/60889 + https://bugs.webkit.org/show_bug.cgi?id=40365 + + gtk bot has some kind of memory corruption (Requested by + loislo on #webkit). + + * inspector/InspectorClient.h: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::setFrontend): + * inspector/InspectorController.h: + * inspector/InspectorFrontend.cpp: + (WebCore::InspectorFrontend::InspectorFrontend): + * inspector/InspectorFrontend.h: + * inspector/InspectorFrontendClientLocal.cpp: + (WebCore::InspectorFrontendClientLocal::frontendLoaded): + * inspector/InspectorValues.cpp: + (WebCore::InspectorObject::writeJSON): + * inspector/front-end/inspector.js: + * loader/EmptyClients.h: + +2010-06-09 Kent Tamura + + Reviewed by Eric Carlson. + + [Windows] Build fix on Japanese Windows + https://bugs.webkit.org/show_bug.cgi?id=40358 + + cl.exe on Japanese Windows assumes files with invalid CP932 + sequences broken and doesn't build them at all. + + * platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp: Remove non-ASCII characters + * platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h: ditto. + * platform/graphics/win/WKCAImageQueue.cpp: ditto. + * platform/graphics/win/WKCAImageQueue.h: ditto. + +2010-06-09 Pavel Podivilov + + Reviewed by Yury Semikhatsky. + + Web Inspector: Add isDebuggerAlwaysEnabled method to ScriptDebugServer. + This method returns true if debugger should always be enabled when + frontend is attached. + https://bugs.webkit.org/show_bug.cgi?id=40289 + + * bindings/js/ScriptDebugServer.cpp: + (WebCore::ScriptDebugServer::isDebuggerAlwaysEnabled): + * bindings/js/ScriptDebugServer.h: + * bindings/v8/ScriptDebugServer.cpp: + (WebCore::ScriptDebugServer::isDebuggerAlwaysEnabled): + * bindings/v8/ScriptDebugServer.h: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::setFrontend): + +2010-06-07 Ilya Tikhonovsky + + Reviewed by Pavel Feldman. + + WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc + data from inspected page to WebInspector as JSON string via http. The native + serialization to JSON string is supported by InspectorValue's classes. This patch + has the implementation of sendMessageToFrontend function. WebKit version of it still + uses ScriptFunctionCall and will be switched to another transport a little bit later. + https://bugs.webkit.org/show_bug.cgi?id=40134 + + * inspector/InspectorClient.h: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::connectFrontend): + (WebCore::InspectorController::disconnectFrontend): + * inspector/InspectorController.h: + * inspector/InspectorFrontend.cpp: + (WebCore::InspectorFrontend::InspectorFrontend): + * inspector/InspectorFrontend.h: + * inspector/InspectorFrontendClientLocal.cpp: + (WebCore::InspectorFrontendClientLocal::frontendLoaded): + * inspector/InspectorValues.cpp: + (WebCore::InspectorObject::writeJSON): + * inspector/front-end/inspector.js: + (WebInspector.dispatchMessageToFrontend): + * loader/EmptyClients.h: + (WebCore::EmptyInspectorClient::sendMessageToFrontend): + +2010-06-09 Csaba Osztrogonác + + Reviewed by Dirk Schulze. + + [Qt] Imperfect dependency for generated SVGNames.cpp + https://bugs.webkit.org/show_bug.cgi?id=40359 + + * WebCore.pri: Missing dependency added. + +2010-06-08 Dirk Schulze + + Reviewed by Nikolas Zimmermann. + + Implement non-scaling-stroke (from SVG Tiny 1.2, also in Opera) + https://bugs.webkit.org/show_bug.cgi?id=31438 + + This is the implementation of the SVG property vector-effect according + to the specification of SVG Tiny 1.2. + getScreenCTM() was not able to calculate the transformation matrix in + comparison to the host coordinate system for objects, that get refereced + by a use element. This is fixed and covered by the the new test as well. + This patch is based upon a patch of Jeff Schiller. + + Test: svg/custom/non-scaling-stroke.svg + + * css/CSSComputedStyleDeclaration.cpp: Added CSSPropertyVectorEffect. + (WebCore::): + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): + (WebCore::CSSPrimitiveValue::operator EVectorEffect): + * css/SVGCSSComputedStyleDeclaration.cpp: + (WebCore::CSSComputedStyleDeclaration::getSVGPropertyCSSValue): + * css/SVGCSSParser.cpp: + (WebCore::CSSParser::parseSVGValue): + * css/SVGCSSPropertyNames.in: + * css/SVGCSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::applySVGProperty): + * css/SVGCSSValueKeywords.in: Add vector-effect value non-scaling-stroke. + * rendering/RenderPath.cpp: Revert transformations to ctm and transform path instead. + (WebCore::fillAndStrokePath): + * rendering/RenderSVGResourceContainer.h: + (WebCore::RenderSVGResourceContainer::transformOnNonScalingStroke): + * rendering/RenderSVGResourceGradient.cpp: Transform the gradient with the screenCTM. + (WebCore::RenderSVGResourceGradient::applyResource): + * rendering/RenderSVGResourcePattern.cpp: Transform the pattern with the screenCTM. + (WebCore::RenderSVGResourcePattern::applyResource): + * rendering/style/SVGRenderStyle.h: Added vector-effect property, not interited. + (WebCore::SVGRenderStyle::NonInheritedFlags::): + (WebCore::SVGRenderStyle::setBitDefaults): + * rendering/style/SVGRenderStyleDefs.h: Added enums for vector-effect. + (WebCore::): + * svg/SVGLocatable.cpp: Calculate screenCTM for referenced objects. + (WebCore::SVGLocatable::computeCTM): + * svg/SVGStyledElement.cpp: + (WebCore::SVGStyledElement::cssPropertyIdForSVGAttributeName): + * svg/svgattrs.in: + +2010-06-08 Mark Rowe + + Reviewed by Adele Peterson. + + REGRESSION (r56051): Inspect Element context menu does nothing in applications linked against 10.4 SDK + + Revert the change to ContextMenu::addInspectElementItem from r56051. It was made without + explanation and broke a reliance that WebKit has on the presence of a separator before the + Inspect Element menu item. This also restores the context menu item to the correct location + at the bottom of the context menu in applications built against the Mac OS X 10.4 SDK. + + * platform/ContextMenu.cpp: + (WebCore::ContextMenu::addInspectElementItem): + +2010-06-08 Roland Steiner + + Unreviewed build fix + + Bug 38145 - Validate *tex* functions input parameters according to ES2 conformance + https://bugs.webkit.org/show_bug.cgi?id=38145 + https://bugs.webkit.org/show_bug.cgi?id=40346 + + Fix for 38145 broke the build ('log2 not found' on Windows), + the fix from 40346 also didn't catch ('log ambiguous'). + + 2nd quick fix: add explicit casts to double and use double constants. + + No new tests. + + * html/canvas/WebGLRenderingContext.cpp: + (WebCore::WebGLRenderingContext::validateTexFuncParameters): + +2010-05-18 Yuzo Fujishima + + Reviewed by Shinichiro Hamaji. + + Fix for Bug 34529 - [CSSOM] issues with cssText and selectorText + Serialize selector as per http://dev.w3.org/csswg/cssom/#serializing-selectors + Without this patch, for example, selectors containing ':' or '.' are not properly serialized. + https://bugs.webkit.org/show_bug.cgi?id=34529 + + Test: fast/css/selector-text-escape.html + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * css/CSSOMUtils.cpp: Added. + (WebCore::appendCharacter): + (WebCore::serializeCharacter): + (WebCore::serializeCharacterAsCodePoint): + (WebCore::serializeIdentifier): + (WebCore::serializeString): + * css/CSSOMUtils.h: Added. + * css/CSSSelector.cpp: + (WebCore::CSSSelector::selectorText): + +2010-06-08 Ryosuke Niwa + + Reviewed by Justin Garcia + + InsertListCommand needs cleanup + https://bugs.webkit.org/show_bug.cgi?id=36430 + + Separated code for listifying and unlistifying paragraphs. + Also isolated the dependency on the selection in doApply. + + No test is added since this is a cleanup. + + * editing/InsertListCommand.cpp: + (WebCore::InsertListCommand::doApply): isolated code to listify / unlistify paragraphs + (WebCore::InsertListCommand::unlistifyParagraph): ditto + (WebCore::InsertListCommand::listifyParagraph): ditto + * editing/InsertListCommand.h: + +2010-06-08 Kenneth Russell + + Unreviewed, build fix. + + Fix build breakage from 38145 + https://bugs.webkit.org/show_bug.cgi?id=40346 + + The fix for bug 38145 broke the Chromium Win build because + Microsoft's cmath doesn't define log2. Suggested fix by zmo is to + change log2(x) to log(x) / log(2). Built and ran WebGL layout + tests in Safari on Mac OS X. Changed download mirrors for + python-irclib to working ones. + + * html/canvas/WebGLRenderingContext.cpp: + (WebCore::WebGLRenderingContext::validateTexFuncParameters): + +2010-06-08 Zhenyao Mo + + Reviewed by Dimitri Glazkov. + + Validate *tex* functions input parameters according to ES2 conformance + https://bugs.webkit.org/show_bug.cgi?id=38145 + + Test: fast/canvas/webgl/tex-input-validation.html + + * html/canvas/WebGLFramebuffer.cpp: + (WebCore::WebGLFramebuffer::getColorBufferFormat): Get color buffer internalformat. + * html/canvas/WebGLFramebuffer.h: Ditto. + * html/canvas/WebGLRenderingContext.cpp: + (WebCore::WebGLRenderingContext::WebGLRenderingContext): Deal with max tex units and max texture size. + (WebCore::WebGLRenderingContext::copyTexImage2D): Validate input parameters. + (WebCore::WebGLRenderingContext::copyTexSubImage2D): Ditto. + (WebCore::WebGLRenderingContext::texImage2DBase): Ditto. + (WebCore::WebGLRenderingContext::texParameterf): Ditto. + (WebCore::WebGLRenderingContext::texParameteri): Ditto. + (WebCore::WebGLRenderingContext::texSubImage2DBase): Ditto. + (WebCore::WebGLRenderingContext::handleNPOTTextures): Deal with max tex units. + (WebCore::WebGLRenderingContext::isTexInternalformatColorBufferCombinationValid): Check whether the texture format and framebuffer color buffer internalformat combination is valid. + (WebCore::WebGLRenderingContext::getTextureBinding): get the current bound texture for given target. + (WebCore::WebGLRenderingContext::validateTexFuncFormatAndType): Validate input format/type for *tex* functions. + (WebCore::WebGLRenderingContext::validateTexFuncParameters): Validate input parameters for *tex* functions. + (WebCore::WebGLRenderingContext::texParameter): Base function for texParameteri and texParameterf. + * html/canvas/WebGLRenderingContext.h: Deal with max tex units. + * html/canvas/WebGLTexture.cpp: + (WebCore::WebGLTexture::WebGLTexture): Cache internalformat. + * html/canvas/WebGLTexture.h: Ditto. + (WebCore::WebGLTexture::setInternalformat): + (WebCore::WebGLTexture::getInternalformat): + * platform/graphics/GraphicsContext3D.cpp: internalformat and format need to be the same. + (WebCore::GraphicsContext3D::extractImageData): + +2010-06-08 Erik Arvidsson + + Reviewed by Ojan Vafai. + + REGRESSION: Weird focus behavior affects quoting on University of Washington message board system + https://bugs.webkit.org/show_bug.cgi?id=38548 + + Test: editing/selection/click-in-focusable-link-should-not-clear-selection.html + + * page/FocusController.cpp: + (WebCore::clearSelectionIfNeeded): Make sure we do not clear selection when canStartSelection + returns false. + +2010-06-08 Enrico Ros + + Reviewed by Ariya Hidayat. + + [Qt] Crashfix on Path::contains + https://bugs.webkit.org/show_bug.cgi?id=40253 + + Fix accessing the first item of an empty vector, that happens when + CanvasRenderingContext2D::isPointInPath is invoked over a borderless + path (e.g. a path made of just a MoveTo operation). + + * platform/graphics/qt/PathQt.cpp: + (WebCore::isPointOnPathBorder): + +2010-06-08 Sheriff Bot + + Unreviewed, rolling out r60859. + http://trac.webkit.org/changeset/60859 + https://bugs.webkit.org/show_bug.cgi?id=40334 + + Included debugging statements. Caused a test to fail. + (Requested by ojan on #webkit). + + * page/FocusController.cpp: + (WebCore::clearSelectionIfNeeded): + +2010-06-08 Sheriff Bot + + Unreviewed, rolling out r60858. + http://trac.webkit.org/changeset/60858 + https://bugs.webkit.org/show_bug.cgi?id=40325 + + Qt needs a clean build. Rolling out the patch for now and fix + it tomorrow (Requested by krit on #webkit). + + * css/CSSComputedStyleDeclaration.cpp: + (WebCore::): + * css/CSSPrimitiveValueMappings.h: + * css/SVGCSSComputedStyleDeclaration.cpp: + (WebCore::CSSComputedStyleDeclaration::getSVGPropertyCSSValue): + * css/SVGCSSParser.cpp: + (WebCore::CSSParser::parseSVGValue): + * css/SVGCSSPropertyNames.in: + * css/SVGCSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::applySVGProperty): + * css/SVGCSSValueKeywords.in: + * rendering/RenderPath.cpp: + (WebCore::fillAndStrokePath): + * rendering/RenderSVGResourceContainer.h: + * rendering/RenderSVGResourceGradient.cpp: + (WebCore::RenderSVGResourceGradient::applyResource): + * rendering/RenderSVGResourcePattern.cpp: + (WebCore::RenderSVGResourcePattern::applyResource): + * rendering/style/SVGRenderStyle.h: + (WebCore::SVGRenderStyle::NonInheritedFlags::): + (WebCore::SVGRenderStyle::setBitDefaults): + * rendering/style/SVGRenderStyleDefs.h: + (WebCore::): + * svg/SVGLocatable.cpp: + (WebCore::SVGLocatable::computeCTM): + * svg/SVGStyledElement.cpp: + (WebCore::SVGStyledElement::cssPropertyIdForSVGAttributeName): + * svg/svgattrs.in: + +2010-06-08 Daniel Bates + + Unreviewed, fix Xcode project file after change-set 60841. + + Xcode is not happy about the entries for files EditingBehavior.h and + EditingBehaviorTypes.h that were added in change-set 60841 (Bug # 39854). + Lets make Xcode happy. + + Also, lets place these entries in alphabetic order. + + * WebCore.xcodeproj/project.pbxproj: + +2010-06-08 Erik Arvidsson + + Reviewed by ojan@chromium.org. + + REGRESSION: Weird focus behavior affects quoting on University of Washington message board system + https://bugs.webkit.org/show_bug.cgi?id=38548 + + We should not clear the selection when canStartSelection returns false. + + Test: editing/selection/click-in-focusable-link-should-not-clear-selection.html + + * page/FocusController.cpp: + (WebCore::clearSelectionIfNeeded): Make sure we do not clear selection when canStartSelection + returns false. + +2010-06-08 Dirk Schulze + + Reviewed by Nikolas Zimmermann. + + Implement non-scaling-stroke (from SVG Tiny 1.2, also in Opera) + https://bugs.webkit.org/show_bug.cgi?id=31438 + + This is the implementation of the SVG property vector-effect according + to the specification of SVG Tiny 1.2. + getScreenCTM() was not able to calculate the transformation matrix in + comparison to the host coordinate system for objects, that get refereced + by a use element. This is fixed and covered by the the new test as well. + This patch is based upon a patch of Jeff Schiller. + + Test: svg/custom/non-scaling-stroke.svg + + * css/CSSComputedStyleDeclaration.cpp: Added CSSPropertyVectorEffect. + (WebCore::): + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): + (WebCore::CSSPrimitiveValue::operator EVectorEffect): + * css/SVGCSSComputedStyleDeclaration.cpp: + (WebCore::CSSComputedStyleDeclaration::getSVGPropertyCSSValue): + * css/SVGCSSParser.cpp: + (WebCore::CSSParser::parseSVGValue): + * css/SVGCSSPropertyNames.in: + * css/SVGCSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::applySVGProperty): + * css/SVGCSSValueKeywords.in: Add vector-effect value non-scaling-stroke. + * rendering/RenderPath.cpp: Revert transformations to ctm and transform path instead. + (WebCore::fillAndStrokePath): + * rendering/RenderSVGResourceContainer.h: + (WebCore::RenderSVGResourceContainer::transformOnNonScalingStroke): + * rendering/RenderSVGResourceGradient.cpp: Transform the gradient with the screenCTM. + (WebCore::RenderSVGResourceGradient::applyResource): + * rendering/RenderSVGResourcePattern.cpp: Transform the pattern with the screenCTM. + (WebCore::RenderSVGResourcePattern::applyResource): + * rendering/style/SVGRenderStyle.h: Added vector-effect property, not interited. + (WebCore::SVGRenderStyle::NonInheritedFlags::): + (WebCore::SVGRenderStyle::setBitDefaults): + * rendering/style/SVGRenderStyleDefs.h: Added enums for vector-effect. + (WebCore::): + * svg/SVGLocatable.cpp: Calculate screenCTM for referenced objects. + (WebCore::SVGLocatable::computeCTM): + * svg/SVGStyledElement.cpp: + (WebCore::SVGStyledElement::cssPropertyIdForSVGAttributeName): + * svg/svgattrs.in: + +2010-06-08 Alexey Proskuryakov + + * GNUmakefile.am: Also adding platform/Cursor.cpp to Gtk build. + +2010-06-08 Csaba Osztrogonác + + [Qt] Unreviewed buildfix after r60849. + + * WebCore.pro: platform/Cursor.cpp is added to Qt build system. + +2010-06-08 Kenneth Rohde Christiansen + + Unreviewed Buildbot fix. + + Reset the Qt TextBreakIterator when reusing it. + + * platform/text/qt/TextBreakIteratorQt.cpp: + (WebCore::setUpIterator): + +2010-06-04 Alexey Proskuryakov + + Reviewed by John Sullivan. + + https://bugs.webkit.org/show_bug.cgi?id=15779 + Custom CSS .cur cursor anchor point is ignored + + Test: manual-tests/cur-hotspot.html + + Currently, this patch only has effect in Safari 5 on Windows. Other platforms will need + to implement getting hot spot information from .cur files. + + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + Added Cursor.cpp. Looks like TextWrangler fixed line endings in vcproj file. + + * css/CSSCursorImageValue.cpp: + (WebCore::CSSCursorImageValue::CSSCursorImageValue): Renamed "hotspot" to "hotSpot" to match + other code. + (WebCore::CSSCursorImageValue::updateIfSVGCursorIsUsed): Ditto. Added a FIXME about possibly + incorrect code for resolving differences with CSS specified hotspot. + + * css/CSSCursorImageValue.h: + (WebCore::CSSCursorImageValue::create): + (WebCore::CSSCursorImageValue::hotSpot): + Renamed "hotspot" to "hotSpot" to match other code. + + * css/CSSParser.cpp: (WebCore::CSSParser::parseValue): Start with an invalid value for hot + spot, so that we can differentiate between missing and (0, 0) CSS hot spots. Missing and + invalid (-1, -1) are treated identically by Firefox, so we don't need to differentiate these. + + * css/CSSStyleSelector.cpp: (WebCore::CSSStyleSelector::applyProperty): Renamed "hotspot" to + "hotSpot" to match other code. + + * page/EventHandler.cpp: (WebCore::EventHandler::selectCursor): Don't ignore cursors with + invalid CSS hot spots. Firefox ignores only the hot spot, not the whole cursor in this case + (and IE doesn't support CSS3 cursor declarations). + + * platform/Cursor.cpp: Added. (WebCore::determineHotSpot): Added a function that decides + where hot spot is, provided an image and a possible out of band coordinate specification. + + * platform/Cursor.h: Added determineHotSpot(). + + * platform/graphics/BitmapImage.cpp: + (WebCore::BitmapImage::getHotSpot): + * platform/graphics/BitmapImage.h: + * platform/graphics/Image.h: + (WebCore::Image::getHotSpot): + * platform/graphics/ImageSource.cpp: + (WebCore::ImageSource::getHotSpot): + * platform/graphics/ImageSource.h: + Added plumbing to get hot spot data from an image provider. + + * platform/graphics/cg/ImageSourceCG.cpp: (WebCore::ImageSource::getHotSpot): CG implemantation. + + * platform/mac/CursorMac.mm: (WebCore::createCustomCursor): Call determineHotSpot() to + determine where hot spot should be. + (WebCore::Cursor::Cursor): Renamed "hotspot" to "hotSpot" to match other code. + + * platform/win/CursorWin.cpp: (WebCore::Cursor::Cursor): Call determineHotSpot() to determine + where hot spot should be. + + * platform/gtk/CursorGtk.cpp: (WebCore::Cursor::Cursor): Ditto. This must be done despite + this platform not having an implementation for ImageSource::getHotSpot(), because we no longer + check for out of bounds hot spots in EventHandler::selectCursor(). + + * platform/qt/CursorQt.cpp: (WebCore::Cursor::Cursor): Ditto. + +2010-06-08 Kenneth Rohde Christiansen + + Reviewed by Antti Koivisto. + + [Qt] TextBreakIterator Qt performance + https://bugs.webkit.org/show_bug.cgi?id=39958 + + Rework TextBreakIteratorQt to be more in line with the ICU version. + + We now reuse iterators where ever possible. The string data is compared + with memcmp, which should be faster than using a hash, as you need + to traverse the full buffer in the case the strings don't match, + where as the compare would fail quickly. + + * platform/text/qt/TextBreakIteratorQt.cpp: + (WebCore::TextBreakIterator::TextBreakIterator): + (WebCore::setUpIterator): + (WebCore::wordBreakIterator): + (WebCore::characterBreakIterator): + (WebCore::lineBreakIterator): + (WebCore::sentenceBreakIterator): + +2010-06-08 Andras Becsi + + Unreviewed build fix after r60785. + + [GTK] Add missing GtkVersioning.h include to fix the build + on older GTK+ versions. + + No new tests needed. + + * platform/gtk/WidgetGtk.cpp: + +2010-06-08 Yury Semikhatsky + + Reviewed by Pavel Feldman. + + Web Inspector: extend ScriptDebugServer to support script source editing + https://bugs.webkit.org/show_bug.cgi?id=40297 + + * bindings/js/ScriptDebugServer.cpp: + (WebCore::ScriptDebugServer::editScriptSource): + * bindings/js/ScriptDebugServer.h: + * bindings/v8/ScriptDebugServer.cpp: + (WebCore::ScriptDebugServer::editScriptSource): + * bindings/v8/ScriptDebugServer.h: + * inspector/InspectorBackend.cpp: + (WebCore::InspectorBackend::editScriptSource): + * inspector/InspectorBackend.h: + * inspector/InspectorBackend.idl: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::InspectorController): + (WebCore::InspectorController::disableDebugger): + (WebCore::InspectorController::editScriptSource): + (WebCore::InspectorController::currentCallFrames): + (WebCore::InspectorController::didPause): + (WebCore::InspectorController::didContinue): + * inspector/InspectorController.h: + * inspector/InspectorFrontend.cpp: + (WebCore::InspectorFrontend::didEditScriptSource): + * inspector/InspectorFrontend.h: + * inspector/front-end/Script.js: + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.prototype.canEditScripts): + (WebInspector.ScriptsPanel.prototype.editScriptSource.mycallback): + (WebInspector.ScriptsPanel.prototype.editScriptSource): + * inspector/front-end/Settings.js: + * inspector/front-end/SourceView.js: + (WebInspector.SourceView.prototype._editLine): + * inspector/front-end/TextViewer.js: + (WebInspector.TextViewer.prototype._handleDoubleClick): + (WebInspector.TextViewer.prototype._commitEditingLine): + * inspector/front-end/inspector.css: + (#scripts-files option.extension-script): + +2010-06-08 Antonio Gomes + + Reviewed by Ojan Vafai and Darin Adler. + + Refactor platform dependent editing behavior code out of Settings + https://bugs.webkit.org/show_bug.cgi?id=39854 + + As per discussion in bug 36627, Darin Adler suggested: "before the addition of any new EditingBehavior, + I think we to add functions to translate the overall behavior policy into specific behaviors rather than + directly saying 'behavior == Mac' or 'behavior == Windows'. Helper functions that expression the different + rules in plain language.". Patch addresses this request. + + No behavior change, so no new tests. + + * GNUmakefile.am: + * WebCore.pro: + * WebCore/WebCore.vcproj/WebCore.vcproj + * WebCore/WebCore.xcodeproj/project.pbxproj + * page/Settings.cpp: + (WebCore::Settings::Settings): + * page/Settings.h: Moved out EditingBehavior enum to WebCore/editing/EditingBehaviorTypes.h, + and renamed to EditingBehaviorTypes. + (WebCore::Settings::setEditingBehaviorType): Renamed from setEditingBehavior. + (WebCore::Settings::editingBehaviorType): Renamed from editingBehavior. + * editing/EditingBehavior.h: Added. + (WebCore::EditingBehavior::EditingBehavior): Class to work as a central point for + editing behavior that might have to be handled differently in the different platforms/ports. + Class should be not used or instantiated directly, but rather implicitly constructed + through the Editor class. + (WebCore::EditingBehavior::shouldMoveCaretToHorizontalBoundaryWhenPastTopOrBottom): + (WebCore::EditingBehavior::shouldConsiderSelectionAsDirectional): + (WebCore::EditingBehavior::shouldCenterAlignWhenSelectionIsRevealed): + * editing/EditingBehaviorTypes.h: Added. + (WebCore::): + * editing/Editor.cpp: + (WebCore::Editor::behavior): Getter for EditingBehavior class. + * editing/Editor.h: + * editing/EditorCommand.cpp: + (WebCore::executeToggleStyle): + * editing/SelectionController.cpp: + (WebCore::SelectionController::setSelection): + (WebCore::SelectionController::setIsDirectional): + (WebCore::SelectionController::positionForPlatform): + (WebCore::SelectionController::modify): + * page/EventHandler.cpp: + (WebCore::EventHandler::handleMousePressEventSingleClick): + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::positionForPointWithInlineChildren): + + - Call sites will look like: + if (frame->editor()->behavior().shouldThisIfThat())) + // do something + +2010-06-08 Steve Block + + Reviewed by Jeremy Orlow. + + Prevent Geolocation making callbacks to a ScriptExecutionContext that no longer exists + https://bugs.webkit.org/show_bug.cgi?id=40162 + + Before making callbacks, we check that the relevant ScriptExecutionContext still exists. + To achieve this, the callbacks inherit from ActiveDOMObject. + + The ScriptExecutionContext is ref'ed from script, so may not be GC'ed for some time after + it is disconnected from its frame. Making the callback currently involves accessing the + Frame, so an additional check for the Frame is required. + + This change also prevents the V8 bindings from incorrectly holding a reference to the Frame. + + Test: fast/dom/Geolocation/callback-to-deleted-context.html + + * bindings/js/JSCallbackData.cpp: + (WebCore::JSCallbackData::invokeCallback): + * bindings/js/JSCustomPositionCallback.cpp: + (WebCore::JSCustomPositionCallback::JSCustomPositionCallback): + (WebCore::JSCustomPositionCallback::handleEvent): + * bindings/js/JSCustomPositionErrorCallback.cpp: + (WebCore::JSCustomPositionErrorCallback::JSCustomPositionErrorCallback): + (WebCore::JSCustomPositionErrorCallback::handleEvent): + * bindings/v8/custom/V8CustomPositionCallback.cpp: + (WebCore::V8CustomPositionCallback::V8CustomPositionCallback): + (WebCore::V8CustomPositionCallback::handleEvent): + * bindings/v8/custom/V8CustomPositionCallback.h: + (WebCore::V8CustomPositionCallback::create): + * bindings/v8/custom/V8CustomPositionErrorCallback.cpp: + (WebCore::V8CustomPositionErrorCallback::V8CustomPositionErrorCallback): + (WebCore::V8CustomPositionErrorCallback::handleEvent): + * bindings/v8/custom/V8CustomPositionErrorCallback.h: + (WebCore::V8CustomPositionErrorCallback::create): + * bindings/v8/custom/V8GeolocationCustom.cpp: + (WebCore::createPositionCallback): + (WebCore::createPositionErrorCallback): + * page/PositionCallback.h: + (WebCore::PositionCallback::PositionCallback): + * page/PositionErrorCallback.h: + (WebCore::PositionErrorCallback::PositionErrorCallback): + +2010-06-08 Xan Lopez + + Reviewed by Gustavo Noronha. + + [GTK] Avoid duplicated signals in DOM bindings + https://bugs.webkit.org/show_bug.cgi?id=40170 + + Do not create duplicated event signals between a class and its + ancestor. + + * bindings/scripts/CodeGeneratorGObject.pm: + +2010-06-08 MORITA Hajime + + Unreviewd. Touched the file to force rebuild. + + * html/HTMLMeterElement.idl: + +2010-06-08 Vangelis Kokkevis + + Reviewed by Dimitri Glazkov. + + [Chromium] Fix the math for transform matrices of composited layers. There + were problems both with how content layers were setting their position and + how the overal matrix stack was computed when the layer anchor isn't at the + center of the layer. + https://bugs.webkit.org/post_bug.cgi + + * platform/graphics/chromium/GraphicsLayerChromium.cpp: + (WebCore::GraphicsLayerChromium::updateContentsRect): + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::updateLayersRecursive): + (WebCore::LayerRendererChromium::drawLayer): + +2010-06-07 Eric Seidel + + Reviewed by Adam Barth. + + HTML5Lexer does not handle
correctly + https://bugs.webkit.org/show_bug.cgi?id=40283 + + Fix a typo in the AfterAttributeNameState. + The compiler really should have caught this since the typo + resulted in unreachable code. + + Tests: + 10 tables/mozilla/marvin/colgroup* tests. + Also added a new sub-test in html5lib/resources/webkit01.dat + + * html/HTML5Lexer.cpp: + (WebCore::HTML5Lexer::nextToken): + - Fix typo of = instead of > + +2010-06-08 Adam Barth + + Reviewed by Eric Seidel. + + Implement HTML5's forceQuirks flag + https://bugs.webkit.org/show_bug.cgi?id=40284 + + I didn't implement this before because I didn't know how to test it, + but now I do. + + Tests: + * fast/doctypes/doctype-parsing.html. + + When we actually implement the quirks mode handling in the tree + builder, we'll probably want to add to this test. + + * html/HTML5Lexer.cpp: + (WebCore::HTML5Lexer::nextToken): + * html/HTML5Token.h: + (WebCore::HTML5Token::forceQuirks): + (WebCore::HTML5Token::setForceQuirks): + * html/HTML5TreeBuilder.cpp: + (WebCore::HTML5TreeBuilder::passTokenToLegacyParser): + * html/HTMLParser.cpp: + (WebCore::HTMLParser::parseDoctypeToken): + * html/HTMLTokenizer.h: + (WebCore::DoctypeToken::reset): + +2010-06-08 Adam Barth + + Reviewed by Eric Seidel. + + Remove ASSERT in ~HTML5Tokenizer + https://bugs.webkit.org/show_bug.cgi?id=40282 + + We thought this ASSERT would be a good idea, but the problem is that + this object is deleted without warning in some circumstances, so + there's no way to know whether it has reached the end of its state + machine. + + * html/HTML5Tokenizer.cpp: + (WebCore::HTML5Tokenizer::~HTML5Tokenizer): + +2010-06-07 MORITA Hajime + + Reviewed by Kent Tamura. + + [Mac] elements should be rendered as level indicators. + https://bugs.webkit.org/show_bug.cgi?id=40217 + + Implemented RenderThemeMac::paintMeter() using NSLevelIndicatorCell. + + This change also added new -webkit-appearance values to select the + style of level indicators: + + - relevancy-level-indicator, + - continuous-capacity-level-indicator, + - discrete-capacity-level-indicator, and + - rating-level-indicator. + + The size of elements are adjusted based on the bounds of the indicator + to make room for painting whole indicator cells. + + Tests: fast/dom/HTMLMeterElement/meter-appearances-capacity.html + fast/dom/HTMLMeterElement/meter-appearances-rating-relevancy.html + fast/dom/HTMLMeterElement/meter-optimums.html + + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): + * css/CSSValueKeywords.in: + * html/HTMLMeterElement.cpp: + (WebCore::HTMLMeterElement::gaugeRegion): + * html/HTMLMeterElement.h: + (WebCore::HTMLMeterElement::): + * platform/ThemeTypes.h: + (WebCore::): + * rendering/RenderMeter.cpp: + (WebCore::RenderMeter::calcWidth): + (WebCore::RenderMeter::calcHeight): + * rendering/RenderMeter.h: + * rendering/RenderTheme.cpp: + (WebCore::RenderTheme::adjustStyle): + (WebCore::RenderTheme::paint): + (WebCore::RenderTheme::paintBorderOnly): + (WebCore::RenderTheme::paintDecorations): + (WebCore::RenderTheme::meterSizeForBounds): + * rendering/RenderTheme.h: + * rendering/RenderThemeMac.h: + * rendering/RenderThemeMac.mm: + (WebCore::RenderThemeMac::meterSizeForBounds): + (WebCore::RenderThemeMac::paintMeter): + (WebCore::RenderThemeMac::levelIndicatorStyleFor): + (WebCore::RenderThemeMac::levelIndicatorFor): + +2010-06-07 MORITA Hajime + + Reviewed by Kent Tamura. + + [Mac] ENABLE_METER_TAG should be enabled. + https://bugs.webkit.org/show_bug.cgi?id=40219 + + * Configurations/FeatureDefines.xcconfig: + * WebCore.xcodeproj/project.pbxproj: + +2010-06-07 Eric Seidel + + Unreviewed. Just commit an edit XCode keeps making automatically. + + It appears someone hand-edited the file, XCode no-like. + + * WebCore.xcodeproj/project.pbxproj: + +2010-06-07 Eric Seidel + + Reviewed by Adam Barth. + + HTML5 Parser fails script-tests which use document.write + https://bugs.webkit.org/show_bug.cgi?id=40276 + + We were leaving the TreeBuilder paused when executing the scripts + resulting in document.write() calls being ignored. + + I don't see a good way to ASSERT this correct behavior, since + the HTML5ScriptRunner and the HTML5TreeBuilder do not know about + each other. We should never have document.write() called while + the HTML5TreeBuilder is paused, however both document.write and + the network call the same HTML5Tokenizer::write method. It's OK + to be paused when the network writes, but during document.write + (or any other script execution). + + Tested by all of fast/url and numerous other tests. + + * html/HTML5Tokenizer.cpp: + (WebCore::HTML5Tokenizer::notifyFinished): + - Unpause the treebuilder before executing scripts. + (WebCore::HTML5Tokenizer::executeScriptsWaitingForStylesheets): + - Unpause the treebuilder before executing scripts. + +2010-06-07 Eric Seidel + + Reviewed by Adam Barth. + + HTML5 Parser hits ASSERT in fast/events/stop-load-in-unload-handler-using-document-write.html + https://bugs.webkit.org/show_bug.cgi?id=40268 + + Teach HTML5Tokenizer about m_parserStopped. + + While tracking down how m_parserStopped was used, I found + several useless implementations of stopParsing() which I removed. + + I also found a comment in HTMLTokenizer which still talks about the + "part" (an old class now split into Frame, Page, FrameLoader, etc.) + and an nearly empty FrameLoader::tokenizerProcessedData which I just + inlined into its one caller. + + Tests: + fast/events/stop-load-in-unload-handler-using-document-write.html + http/tests/security/xssAuditor/full-block-base-href.html + + * html/HTML5Tokenizer.cpp: + (WebCore::HTML5Tokenizer::pumpLexerIfPossible): + - New method used instead of direct calls to pumpLexer for when + callers would like to pump the lexer if possible, but don't want + to check if the parser is stopped, etc. + (WebCore::HTML5Tokenizer::pumpLexer): + - Added an ASSERT that the parser is not stopped. + - Stop pumping if the parser is stopped. + (WebCore::HTML5Tokenizer::write): + - Ignore the write if the parser is already stopped. + (WebCore::HTML5Tokenizer::end): + (WebCore::HTML5Tokenizer::attemptToEnd): + - Move comment back to finish() which was incorrectly moved here. + (WebCore::HTML5Tokenizer::endIfDelayed): + (WebCore::HTML5Tokenizer::finish): + - Move comment back here from attemptToEnd() + (WebCore::HTML5Tokenizer::resumeParsingAfterScriptExecution): + - Remove a bogus ASSERT. The lexer will stop when it needs + more data, which may not necessarily mean m_source.isEmpty(). + * html/HTML5Tokenizer.h: + - Add pumpLexerIfPossible(). + * html/HTMLTokenizer.cpp: + (WebCore::HTMLTokenizer::stopParsing): + - Add a FIXME about if we really should call checkCompleted() here. + - Inline FrameLoader::tokenizerProcessedData() since this was the only caller. + * loader/FrameLoader.cpp: + - Remove tokenizerProcessedData() + * loader/FrameLoader.h: + - Remove tokenizerProcessedData() + * loader/MediaDocument.cpp: + - Remove unneeded Tokenizer::stopParsing() override. + * loader/PluginDocument.cpp: + - Remove unneeded Tokenizer::stopParsing() override. + * loader/SinkDocument.cpp: + - Remove unneeded Tokenizer::stopParsing() override. + +2010-06-07 Adam Barth + + Reviewed by Eric Seidel. + + Fix XFrameOptions and xssAuditor crashes in HTML5 parser + https://bugs.webkit.org/show_bug.cgi?id=40265 + + We're not supposed to call end() while the tokenizer's write() method. + This causes a bunch of LayoutTests to crash. In particular, this patch + fixes crashes in the following tests: + + Tests: + * http/tests/security/XFrameOptions/x-frame-options-deny-meta-tag-in-body.html + * http/tests/security/XFrameOptions/x-frame-options-deny-meta-tag-parent-same-origin-deny.html + * http/tests/security/XFrameOptions/x-frame-options-deny-meta-tag.html + * http/tests/security/xssAuditor/full-block-base-href.html + * http/tests/security/xssAuditor/full-block-get-from-iframe.html + * http/tests/security/xssAuditor/full-block-iframe-javascript-url.html + * http/tests/security/xssAuditor/full-block-link-onclick.html + * http/tests/security/xssAuditor/full-block-post-from-iframe.html + * http/tests/security/xssAuditor/full-block-script-tag.html + * http/tests/security/xssAuditor/xss-protection-parsing-01.html + + * html/HTML5Tokenizer.cpp: + (WebCore::): + (WebCore::HTML5Tokenizer::HTML5Tokenizer): + (WebCore::HTML5Tokenizer::write): + (WebCore::HTML5Tokenizer::attemptToEnd): + (WebCore::HTML5Tokenizer::endIfDelayed): + (WebCore::HTML5Tokenizer::finish): + (WebCore::HTML5Tokenizer::resumeParsingAfterScriptExecution): + * html/HTML5Tokenizer.h: + (WebCore::HTML5Tokenizer::inWrite): + +2010-06-07 Eric Seidel + + Reviewed by Adam Barth. + + HTML5 parser hits ASSERT in http/tests/misc/window-dot-stop.html + https://bugs.webkit.org/show_bug.cgi?id=40264 + + * html/HTML5Tokenizer.cpp: + (WebCore::HTML5Tokenizer::executeScript): + +2010-06-07 Kinuko Yasuda + + Unreviewed. + + Avoid "warning: no previous prototype for" in Snow Leopard compilation. + + * platform/BlobItem.cpp: Added static to getFileSnapshotModificationTime(). + +2010-06-07 Kinuko Yasuda + + Reviewed by Jian Li. + + Refactor FormData and Blob for better support of Blobs synthesized by BlobBuilder. + https://bugs.webkit.org/show_bug.cgi?id=39083 + + - Introduces a new class BlobItem as a basic component of Blob and FormDataList. + - File would become a special type of Blob that contains only one FileBlobItem. + - Fix the dependency violation in FormData so that the files under platform/ do not include any html/ files. + + The patch doesn't support the latest File API changes (e.g. type, + url and slice's type parameters) and should not change any of its + existing behaviors. + + The existing tests should be able to be used for regression. + + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * html/Blob.cpp: + (WebCore::Blob::Blob): + (WebCore::Blob::size): + (WebCore::Blob::path): + (WebCore::Blob::append): + (WebCore::Blob::slice): + * html/Blob.h: + (WebCore::Blob::create): + (WebCore::Blob::type): + (WebCore::Blob::items): + (WebCore::Blob::Blob): + * html/File.cpp: + (WebCore::File::File): + (WebCore::File::name): + * html/File.h: + (WebCore::File::fileName): + * html/FileReader.cpp: + (WebCore::FileReader::readAsBinaryString): + (WebCore::FileReader::readAsText): + * html/FileStream.cpp: + (WebCore::FileStream::openForRead): + * html/FormDataList.cpp: + (WebCore::FormDataList::appendString): Moved the line ending fix logic to StringBlobItem::convertToCString. + (WebCore::FormDataList::appendBlob): + * html/FormDataList.h: + (WebCore::FormDataList::items): + * html/HTMLFormElement.cpp: + (WebCore::HTMLFormElement::createFormData): + * html/HTMLProgressElement.cpp: + * platform/BlobItem.cpp: Added. + * platform/BlobItem.h: Added. + * platform/network/FormData.cpp: + (WebCore::FormDataElement::FormDataElement): + (WebCore::FormData::create): + (WebCore::FormData::createMultiPart): + (WebCore::FormData::deepCopy): + (WebCore::FormData::appendData): + (WebCore::FormData::appendString): + (WebCore::FormData::appendFile): + (WebCore::FormData::appendFileRange): + (WebCore::FormData::appendItems): + (WebCore::FormData::appendItem): + (WebCore::FormData::appendKeyValuePairItems): + * platform/network/FormData.h: + (WebCore::operator!=): + * platform/network/mac/FormDataStreamMac.mm: + (WebCore::closeCurrentStream): + (WebCore::advanceCurrentStream): + (WebCore::formCreate): + (WebCore::formRead): + (WebCore::setHTTPBody): + * xml/XMLHttpRequest.cpp: + (WebCore::XMLHttpRequest::send): + +2010-06-07 Vangelis Kokkevis + + Reviewed by Dimitri Glazkov. + + [chromium] Decoupled transform matrix update of composited layers from + drawing and interposed a sorting step so that the layers are now composited + back to front to get transparency working correctly. Also added missing code + for the preserves3D CSS property. + + * platform/graphics/chromium/GraphicsLayerChromium.cpp: + (WebCore::GraphicsLayerChromium::updateLayerPreserves3D): + * platform/graphics/chromium/LayerChromium.h: + (WebCore::LayerChromium::setDrawTransform): + (WebCore::LayerChromium::drawTransform): + (WebCore::LayerChromium::setDrawOpacity): + (WebCore::LayerChromium::drawOpacity): + (WebCore::LayerChromium::preserves3D): + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::compareLayerZ): + (WebCore::LayerRendererChromium::drawLayers): + (WebCore::LayerRendererChromium::updateLayersRecursive): + (WebCore::LayerRendererChromium::drawLayer): + * platform/graphics/chromium/LayerRendererChromium.h: + +2010-06-07 Anton Muhin + + Reviewed by Nate Chapin. + + [Chromium] convert a key to AtomicString in V8NodeList::namedPropertyGetter + https://bugs.webkit.org/show_bug.cgi?id=40238 + + Comparison to "length" below could be performed faster in this (major) case + as it would only require direct pointer comparison (cf. to full text + comparison if key is converted to WebCore::String.) + + * bindings/v8/custom/V8NodeListCustom.cpp: + (WebCore::V8NodeList::namedPropertyGetter): + +2010-06-07 Ariya Hidayat + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Fix GraphicsContext::clipOut to take the transformation matrix into account. + + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContext::clipOut): + +2010-06-07 Gustavo Noronha Silva + + Reviewed by Xan Lopez. + + [gtk] web fonts not loaded properly in scribd html5 reader + https://bugs.webkit.org/show_bug.cgi?id=38758 + + Avoid always giving a positive reply in createFontPlatformData. We + do not want every non-existing family name to be considered a hit, + or weird usage of local sources in @font-face rules will make + WebKitGTK+ never consider the online fonts. + + * GNUmakefile.am: + * platform/graphics/cairo/FontCacheCairo.cpp: + (WebCore::isWellKnownFontName): + (WebCore::FontCache::createFontPlatformData): + * platform/graphics/cairo/GOwnPtrCairo.cpp: Added. + (WTF::FcPattern): + (WTF::FcObjectSet): + (WTF::FcFontSet): + * platform/graphics/cairo/GOwnPtrCairo.h: Added. + +2010-06-07 Adam Barth + + Reviewed by Eric Seidel. + + "Fix" fast/dom/stripNullFromTextNodes.html in HTML5 parser + https://bugs.webkit.org/show_bug.cgi?id=40200 + + The proper handling of null characters is to replace them with U+FFFD. + This patch "fixes" fast/dom/stripNullFromTextNodes.html in the sense + that it makes it give the proper output w.r.t. HTML5. However, that + doesn't match the behavior of the old parser, which just stripped the + nulls. + + * html/HTML5Lexer.h: + (WebCore::HTML5Lexer::InputStreamPreprocessor::peek): + +2010-06-07 Adam Barth + + Reviewed by Eric Seidel. + + HTML5 parser should normalize line endings + https://bugs.webkit.org/show_bug.cgi?id=40199 + + When reading characters from the source, we need to normalize line + endings, which means treating \r as \n and folding \r\n sequences into + a single \n. Doing this requires a slightly tighter pattern for + advancing the source (to make sure we update our state machine + correctly). + + Fixes fast/css/first-child-pseudo-class.html and hundreds of other + LayoutTests in the HTML5 parser. + + * html/HTML5Lexer.cpp: + (WebCore::HTML5Lexer::nextToken): + * html/HTML5Lexer.h: + (WebCore::HTML5Lexer::InputStreamPreprocessor::LineEndingNormalizer): + - Introduced InputStreamPreprocessor to keep track of our line + endings state machine. This class will grow to eventually do + all the input stream preprocessing required by the HTML5 spec. + (WebCore::HTML5Lexer::InputStreamPreprocessor::nextInputCharacter): + - We need to be careful not to read *source more than + once because we need to know whether we've transformed the + character. Keeping the next input character in this state + machine requires some careful coding, but seems advantageous. + (WebCore::HTML5Lexer::InputStreamPreprocessor::peek): + (WebCore::HTML5Lexer::InputStreamPreprocessor::advance): + +2010-06-07 Andrei Popescu + + Reviewed by Jeremy Orlow. + + run-bindings-tests results broken by Changeset 60776 + https://bugs.webkit.org/show_bug.cgi?id=40230 + + The change to CodeGeneratorJS.pm in + http://trac.webkit.org/changeset/60776/trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm + added the possibility to use [CallWith=ScriptExecutionContext] in idl files. + + Before the above change was submitted, CodeGeneratorJS.pm was modified so that native + functions return EncodedJSValue instead of JSValues. This was done in + http://trac.webkit.org/changeset/60631/trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm + + This CL updates the CodeGeneratorJS.pm to correctly return an EncodedJSValue in the case + where the ScriptExecutionContext pointer is 0 at the time when the native function is invoked. + + No new tests, just fixing run-bindings-tests. + + * bindings/scripts/CodeGeneratorJS.pm: + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContext): + * bindings/scripts/test/JS/JSTestObj.h: + +2010-06-07 Kwang Yul Seo + + Reviewed by Eric Seidel. + + [BREWMP] Add dummy SearchPopupMenu implementation + https://bugs.webkit.org/show_bug.cgi?id=40224 + + Add dummy implementation of SearchPopupMenu. + + * platform/brew/SearchPopupMenuBrew.cpp: Added. + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::enabled): + +2010-06-07 Julien Chaffraix + + Unreviewed, reverting my HTML comment parsing change as it + breaks Gtk and Qt. + + * html/HTMLTokenizer.cpp: + (WebCore::HTMLTokenizer::parseComment): + (WebCore::HTMLTokenizer::parseTag): + * html/HTMLTokenizer.h: + +2010-06-07 Martin Robinson + + Reviewed by Oliver Hunt. + + [GTK] HTML5 input type=range is not drawn + https://bugs.webkit.org/show_bug.cgi?id=39561 + + Support HTML5 range widgets. They are now drawn using the standard + GTK+ theme drawing mechanism. + + * platform/gtk/RenderThemeGtk.cpp: + (WebCore::supportsFocus): Add focus support for parts of sliders. + (WebCore::setMozillaState): + Add the GtkThemeWidgetType argument and honor depressed states for slider thumbs. + (WebCore::paintMozillaGtkWidget): Pass in the widget type to setMozillaState. + (WebCore::RenderThemeGtk::paintSliderTrack): Added. + (WebCore::RenderThemeGtk::adjustSliderTrackStyle): Added. + (WebCore::RenderThemeGtk::paintSliderThumb): Added. + (WebCore::RenderThemeGtk::adjustSliderThumbStyle): Added. + (WebCore::RenderThemeGtk::adjustSliderThumbSize): Added support for non-media sliders. + * platform/gtk/RenderThemeGtk.h: Added new method declarations. + +2010-06-07 Martin Robinson + + Reviewed by Xan Lopez. + + [GTK] gtk_widget_get_window should replace widget->window + https://bugs.webkit.org/show_bug.cgi?id=40180 + + Replace all uses of widget->window with gtk_widget_get_window. For older + GTK+ versions, #define gtk_widget_get_window in GtkVersioning.h. + + No tests necessary as functionality has not changed. + + * platform/gtk/GtkPluginWidget.cpp: + (WebCore::GtkPluginWidget::invalidateRect): Replace widget->window use. + * platform/gtk/GtkVersioning.h: Add gtk_widget_get_window for old GTK+ versions. + * platform/gtk/PlatformScreenGtk.cpp: + (WebCore::getVisual): Replace widget->window use. + (WebCore::screenRect): Ditto. + * platform/gtk/PopupMenuGtk.cpp: + (WebCore::PopupMenu::show): Ditto. + * platform/gtk/WidgetGtk.cpp: + (WebCore::gdkDrawable): Ditto. + (WebCore::Widget::setCursor): Ditto. + +2010-06-07 Nikolas Zimmermann + + Reviewed by Sam Weinig. + + Add CPP bindings generator + https://bugs.webkit.org/show_bug.cgi?id=38279 + + Add CPP bindings generator used in Olympia platform. + We can succesfully generate cpp bindings for all IDLs except: + - DOMWindow.idl / EventTarget.idl (filtered out in the IDL list in DerivedSources.make for non-jsc/v8 generators anyways, so no problem at all) + - inspector/ (not needed for us at all) + - svg/ (needs custom handling, related to animated attributes) + + All generated files are free of style issues: "Total errors found: 0 in 510 files" + Not integrated in any build system so far, though I've successfully tested on Mac and inside Olympia, of course. + + * bindings/cpp: Added. + * bindings/cpp/WebDOMCString.cpp: Added. + (WebDOMCString::reset): + (WebDOMCString::assign): + (WebDOMCString::length): + (WebDOMCString::data): + (WebDOMCString::utf16): + (WebDOMCString::fromUTF16): + (WebDOMCString::WebDOMCString): + (WebDOMCString::operator=): + (WebDOMCString::operator WTF::CString): + * bindings/cpp/WebDOMCString.h: Added. + (WebDOMCString::~WebDOMCString): + (WebDOMCString::WebDOMCString): + (WebDOMCString::operator=): + (WebDOMCString::isEmpty): + (WebDOMCString::isNull): + * bindings/cpp/WebDOMEventListenerCustom.cpp: Added. + (WebDOMEventListener::handleEvent): + (toWebKit): + * bindings/cpp/WebDOMEventTarget.cpp: Added. + (WebDOMEventTarget::WebDOMEventTargetPrivate::WebDOMEventTargetPrivate): + (WebDOMEventTarget::WebDOMEventTarget): + (WebDOMEventTarget::~WebDOMEventTarget): + (WebDOMEventTarget::impl): + (toWebCore): + (toWebKit): + * bindings/cpp/WebDOMEventTarget.h: Added. + * bindings/cpp/WebDOMHTMLDocumentCustom.cpp: Added. + (documentWrite): + (WebDOMHTMLDocument::write): + (WebDOMHTMLDocument::writeln): + * bindings/cpp/WebDOMNodeCustom.cpp: Added. + (WebDOMNode::insertBefore): + (WebDOMNode::replaceChild): + (WebDOMNode::removeChild): + (WebDOMNode::appendChild): + (WebDOMNode::addEventListener): + (WebDOMNode::removeEventListener): + * bindings/cpp/WebDOMObject.h: Added. + (WebDOMObject::WebDOMObject): + (WebDOMObject::~WebDOMObject): + * bindings/cpp/WebDOMString.cpp: Added. + (WebDOMString::reset): + (WebDOMString::assign): + (WebDOMString::length): + (WebDOMString::data): + (WebDOMString::utf8): + (WebDOMString::fromUTF8): + (WebDOMString::WebDOMString): + (WebDOMString::operator=): + (WebDOMString::operator WebCore::String): + (WebDOMString::operator WebCore::AtomicString): + (WebDOMString::equals): + * bindings/cpp/WebDOMString.h: Added. + (WebDOMString::~WebDOMString): + (WebDOMString::WebDOMString): + (WebDOMString::operator=): + (WebDOMString::isEmpty): + (WebDOMString::isNull): + * bindings/cpp/WebExceptionHandler.cpp: Added. + (globalExceptionHandler): + (webInstallExceptionHandler): + (webRaiseDOMException): + * bindings/cpp/WebExceptionHandler.h: Added. + (webDOMRaiseError): + * bindings/cpp/WebNativeEventListener.cpp: Added. + (WebNativeEventListener::WebNativeEventListener): + (WebNativeEventListener::~WebNativeEventListener): + (WebNativeEventListener::handleEvent): + (WebNativeEventListener::reportError): + (WebNativeEventListener::operator==): + * bindings/cpp/WebNativeEventListener.h: Added. + (WebNativeEventListener::create): + (WebNativeEventListener::cast): + * bindings/scripts/CodeGeneratorCPP.pm: Added. + * bindings/scripts/test/CPP: Added. + * bindings/scripts/test/CPP/WebDOMTestCallback.cpp: Added. + (WebDOMTestCallback::WebDOMTestCallbackPrivate::WebDOMTestCallbackPrivate): + (WebDOMTestCallback::WebDOMTestCallback): + (WebDOMTestCallback::impl): + (WebDOMTestCallback::~WebDOMTestCallback): + (WebDOMTestCallback::callbackWithClass1Param): + (WebDOMTestCallback::callbackWithClass2Param): + (WebDOMTestCallback::callbackWithNonBoolReturnType): + (toWebCore): + (toWebKit): + * bindings/scripts/test/CPP/WebDOMTestCallback.h: Added. + * bindings/scripts/test/CPP/WebDOMTestInterface.cpp: Added. + (WebDOMTestInterface::WebDOMTestInterfacePrivate::WebDOMTestInterfacePrivate): + (WebDOMTestInterface::WebDOMTestInterface): + (WebDOMTestInterface::impl): + (WebDOMTestInterface::~WebDOMTestInterface): + (toWebCore): + (toWebKit): + * bindings/scripts/test/CPP/WebDOMTestInterface.h: Added. + * bindings/scripts/test/CPP/WebDOMTestObj.cpp: Added. + (WebDOMTestObj::WebDOMTestObjPrivate::WebDOMTestObjPrivate): + (WebDOMTestObj::WebDOMTestObj): + (WebDOMTestObj::impl): + (WebDOMTestObj::~WebDOMTestObj): + (WebDOMTestObj::readOnlyIntAttr): + (WebDOMTestObj::readOnlyStringAttr): + (WebDOMTestObj::readOnlyTestObjAttr): + (WebDOMTestObj::intAttr): + (WebDOMTestObj::setIntAttr): + (WebDOMTestObj::longLongAttr): + (WebDOMTestObj::setLongLongAttr): + (WebDOMTestObj::unsignedLongLongAttr): + (WebDOMTestObj::setUnsignedLongLongAttr): + (WebDOMTestObj::stringAttr): + (WebDOMTestObj::setStringAttr): + (WebDOMTestObj::testObjAttr): + (WebDOMTestObj::setTestObjAttr): + (WebDOMTestObj::attrWithException): + (WebDOMTestObj::setAttrWithException): + (WebDOMTestObj::attrWithSetterException): + (WebDOMTestObj::setAttrWithSetterException): + (WebDOMTestObj::attrWithGetterException): + (WebDOMTestObj::setAttrWithGetterException): + (WebDOMTestObj::scriptStringAttr): + (WebDOMTestObj::voidMethod): + (WebDOMTestObj::voidMethodWithArgs): + (WebDOMTestObj::intMethod): + (WebDOMTestObj::intMethodWithArgs): + (WebDOMTestObj::objMethod): + (WebDOMTestObj::objMethodWithArgs): + (WebDOMTestObj::methodThatRequiresAllArgs): + (WebDOMTestObj::methodThatRequiresAllArgsAndThrows): + (WebDOMTestObj::serializedValue): + (WebDOMTestObj::methodWithException): + (WebDOMTestObj::addEventListener): + (WebDOMTestObj::removeEventListener): + (WebDOMTestObj::withDynamicFrame): + (WebDOMTestObj::withDynamicFrameAndArg): + (WebDOMTestObj::withDynamicFrameAndOptionalArg): + (WebDOMTestObj::withScriptStateVoid): + (WebDOMTestObj::withScriptStateObj): + (WebDOMTestObj::withScriptStateVoidException): + (WebDOMTestObj::withScriptStateObjException): + (WebDOMTestObj::methodWithOptionalArg): + (WebDOMTestObj::methodWithNonOptionalArgAndOptionalArg): + (WebDOMTestObj::methodWithNonOptionalArgAndTwoOptionalArgs): + (toWebCore): + (toWebKit): + * bindings/scripts/test/CPP/WebDOMTestObj.h: Added. + * css/StyleSheet.idl: Export helper method isCSSStyleSheet() for cpp bindings only. + * dom/CustomEvent.idl: Disabled for cpp bindings, needs arbitary input parameter handling support ('DOMObject' type). + * dom/Document.idl: Ignore getCSSCanvasContext() for cpp bindings and export helper method isHTMLDocument() (cpp bindings only). + * dom/Event.idl: Export isMutationEvent()/isMouseEvent()/isUIEvent() helpers for cpp bindings only. + * dom/EventListener.h: Add CPPEventListenerType. + * dom/Node.idl: addEventListener/removeEventListener need [Custom] flag for cpp bindings. + * dom/PopStateEvent.idl: Disabled just like CustomEvent, for the same reason ("any" argument type handling). + * html/HTMLCanvasElement.idl: Disable getContext() method for cpp bindings, as it's done for objc bindings. + * html/HTMLDocument.idl: Add [NoCPPCustom] marker for open(), as we're just autogenerating it. + * html/HTMLInputElement.idl: Disable valueAsDate() method for cpp bindings, as we're missing native 'Date' type support. + * html/TextMetrics.h: Add missing PassRefPtr.h include. + * html/canvas/CanvasRenderingContext2D.idl: Disable methods (setLineCap, etc..) for cpp bindings whose names clash with property setters. + * page/AbstractView.idl: Rename 'Media' type to 'StyleMedia' - this should have been done before. + * page/Location.idl: Disable several methods which would need a custom implementation for the cpp bindings. + * page/WebKitPoint.h: Add missing PassRefPtr.h include. + * storage/SQLResultSet.idl: Correct type from 'long' to 'long long', for cpp bindings only though as it wouldn't build on Chromium/V8. + * workers/DedicatedWorkerContext.idl: Disable postMessage() for now when using cpp bindings, would need custom code for us. + * workers/WorkerContext.idl: Hide constructors from cpp bindings. + +2010-06-07 Julien Chaffraix + + Reviewed by Alexey Proskuryakov. + + Space should be allowed between -- and > in comment end + https://bugs.webkit.org/show_bug.cgi?id=21945 + + Implemented the HTML comment parsing algorithm so that we match HTML5 and + FF when parsing comments. Missing from this patch is + the parser errors, which will be added in a follow up patch. + + Added tests cases for broken comments. + + Tests: fast/parser/broken-comment-1.html + fast/parser/broken-comment-2.html + fast/parser/broken-comment-3.html + fast/parser/broken-comment-4.html + fast/parser/broken-comment-5.html + fast/parser/broken-comment-6.html + fast/parser/broken-comment-in-head-1.html + fast/parser/broken-comment-in-head-2.html + fast/parser/broken-comment-in-head-3.html + fast/parser/broken-comment-in-head-4.html + fast/parser/broken-comment-in-head-5.html + + * html/HTMLTokenizer.cpp: + (WebCore::HTMLTokenizer::parseComment): Now we use a state machine + that matches the HTML5 specification. + (WebCore::HTMLTokenizer::emitCommentToken): This emits the comment token + and keep some of the original behavior as parseComment is called in wrong + context (inside a for example). Added a more explicit comment about + this. + (WebCore::HTMLTokenizer::parseTag): Remove the handling of <!--> in quirks mode. + HTML5 specifies that we should accept this in strict mode too. + * html/HTMLTokenizer.h: + (WebCore::HTMLTokenizer::): Added a new enum for the comment parsing state. + +2010-06-07 Mahesh Kulakrni <mahesh.kulkarni@nokia.com> + + Reviewed by Simon Hausmann. + + [QT] QT_BEARER flag is not enabled on S60 properly + https://bugs.webkit.org/show_bug.cgi?id=39357 + + enable QT_BEARER for all platform based on qtmobility + + bearer module availability or for qt 4.7+ + + * WebCore.pri: + +2010-06-07 Leon Clarke <leonclarke@google.com> + + Reviewed by Jeremy Orlow. + + Fix indexeddb idls in android makefile + https://bugs.webkit.org/show_bug.cgi?id=40169 + + No new tests. Android-specific build fix. + + * Android.derived.v8bindings.mk: + +2010-06-07 Andrei Popescu <andreip@google.com> + + Reviewed by Jeremy Orlow. + + [indexedDB] It is impossible to create object stores + https://bugs.webkit.org/show_bug.cgi?id=40054 + + No new tests. Layout tests will be added separately. + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * bindings/scripts/CodeGeneratorJS.pm: + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: + (webkit_dom_test_obj_with_script_execution_context): + * bindings/scripts/test/GObject/WebKitDOMTestObj.h: + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore::): + (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContext): + * bindings/scripts/test/JS/JSTestObj.h: + * bindings/scripts/test/ObjC/DOMTestObj.h: + * bindings/scripts/test/ObjC/DOMTestObj.mm: + (-[DOMTestObj withScriptExecutionContext]): + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjInternal::withScriptExecutionContextCallback): + (WebCore::): + * page/DOMWindow.cpp: + (WebCore::DOMWindow::clear): + (WebCore::DOMWindow::indexedDB): + * storage/IDBCallbacks.h: + * storage/IDBDatabase.h: + * storage/IDBDatabaseImpl.cpp: + (WebCore::IDBDatabaseImpl::createObjectStore): + * storage/IDBDatabaseImpl.h: + * storage/IDBDatabaseRequest.cpp: + (WebCore::IDBDatabaseRequest::IDBDatabaseRequest): + (WebCore::IDBDatabaseRequest::createObjectStore): + * storage/IDBDatabaseRequest.h: + * storage/IDBDatabaseRequest.idl: + * storage/IDBObjectStore.cpp: Removed. + * storage/IDBObjectStore.h: + (WebCore::IDBObjectStore::~IDBObjectStore): + * storage/IDBObjectStoreImpl.cpp: Added. + (WebCore::IDBObjectStoreImpl::~IDBObjectStoreImpl): + (WebCore::IDBObjectStoreImpl::IDBObjectStoreImpl): + (WebCore::IDBObjectStoreImpl::indexNames): + (WebCore::IDBObjectStoreImpl::createIndex): + (WebCore::IDBObjectStoreImpl::index): + (WebCore::IDBObjectStoreImpl::removeIndex): + * storage/IDBObjectStoreImpl.h: Added. + (WebCore::IDBObjectStoreImpl::create): + (WebCore::IDBObjectStoreImpl::name): + (WebCore::IDBObjectStoreImpl::keyPath): + * storage/IDBObjectStoreRequest.cpp: + (WebCore::IDBObjectStoreRequest::IDBObjectStoreRequest): + * storage/IDBObjectStoreRequest.h: + (WebCore::IDBObjectStoreRequest::create): + * storage/IDBRequest.cpp: + (WebCore::IDBRequest::onSuccess): + * storage/IDBRequest.h: + * storage/IndexedDatabaseRequest.cpp: + (WebCore::IndexedDatabaseRequest::IndexedDatabaseRequest): + (WebCore::IndexedDatabaseRequest::open): + * storage/IndexedDatabaseRequest.h: + (WebCore::IndexedDatabaseRequest::create): + * storage/IndexedDatabaseRequest.idl: + +2010-06-07 Nikolas Zimmermann <nzimmermann@rim.com> + + Not reviewed. Updated run-bindings-tests results. + + * bindings/scripts/test/JS/JSTestInterface.cpp: + (WebCore::JSTestInterfaceConstructor::constructTestInterface): + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore::jsTestObjPrototypeFunctionVoidMethod): + (WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs): + (WebCore::jsTestObjPrototypeFunctionIntMethod): + (WebCore::jsTestObjPrototypeFunctionIntMethodWithArgs): + (WebCore::jsTestObjPrototypeFunctionObjMethod): + (WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs): + (WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgs): + (WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows): + (WebCore::jsTestObjPrototypeFunctionSerializedValue): + (WebCore::jsTestObjPrototypeFunctionMethodWithException): + (WebCore::jsTestObjPrototypeFunctionCustomMethod): + (WebCore::jsTestObjPrototypeFunctionCustomMethodWithArgs): + (WebCore::jsTestObjPrototypeFunctionCustomArgsAndException): + (WebCore::jsTestObjPrototypeFunctionAddEventListener): + (WebCore::jsTestObjPrototypeFunctionRemoveEventListener): + (WebCore::jsTestObjPrototypeFunctionWithDynamicFrame): + (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndArg): + (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg): + (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture): + (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD): + (WebCore::jsTestObjPrototypeFunctionWithScriptStateVoid): + (WebCore::jsTestObjPrototypeFunctionWithScriptStateObj): + (WebCore::jsTestObjPrototypeFunctionWithScriptStateVoidException): + (WebCore::jsTestObjPrototypeFunctionWithScriptStateObjException): + (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArg): + (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg): + (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs): + (WebCore::jsTestObjPrototypeFunctionOverloadedMethod1): + (WebCore::jsTestObjPrototypeFunctionOverloadedMethod2): + (WebCore::jsTestObjPrototypeFunctionOverloadedMethod3): + (WebCore::jsTestObjPrototypeFunctionOverloadedMethod4): + (WebCore::jsTestObjPrototypeFunctionOverloadedMethod): + * bindings/scripts/test/JS/JSTestObj.h: + +2010-06-07 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: Implement JSON parsing for InspectorValue. + https://bugs.webkit.org/show_bug.cgi?id=40064 + + * inspector/InspectorValues.cpp: + (WebCore::): + (WebCore::InspectorValue::asBool): + (WebCore::InspectorValue::asNumber): + (WebCore::InspectorValue::asString): + (WebCore::InspectorValue::asObject): + (WebCore::InspectorValue::asArray): + (WebCore::InspectorValue::readJSON): + (WebCore::InspectorValue::writeJSON): + (WebCore::InspectorBasicValue::asBool): + (WebCore::InspectorBasicValue::asNumber): + (WebCore::InspectorBasicValue::writeJSON): + (WebCore::InspectorString::asString): + (WebCore::InspectorObject::asObject): + (WebCore::InspectorObject::getBool): + (WebCore::InspectorObject::getNumber): + (WebCore::InspectorObject::getString): + (WebCore::InspectorObject::getObject): + (WebCore::InspectorObject::getArray): + (WebCore::InspectorObject::get): + (WebCore::InspectorArray::asArray): + * inspector/InspectorValues.h: + (WebCore::InspectorObject::begin): + (WebCore::InspectorObject::end): + +2010-06-07 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix text selection drawing. + https://bugs.webkit.org/show_bug.cgi?id=40221 + + The regression was introduced in r60169. + + * platform/graphics/qt/FontQt.cpp: + (WebCore::drawTextCommon): + +2010-06-07 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: should be possible to distinguish extension scripts from main world scripts + https://bugs.webkit.org/show_bug.cgi?id=40220 + + * bindings/js/ScriptDebugServer.cpp: remove global listeners set which is not used anymore. + (WebCore::ScriptDebugServer::dispatchDidParseSource): pass script wrold type to the listeners. + (WebCore::currentWorldType): + (WebCore::ScriptDebugServer::sourceParsed): + * bindings/js/ScriptDebugServer.h: + * bindings/v8/ScriptDebugServer.cpp: + (WebCore::ScriptDebugServer::dispatchDidParseSource): + * inspector/InspectorController.cpp: + (WebCore::InspectorController::didParseSource): + * inspector/InspectorController.h: + * inspector/InspectorFrontend.cpp: + (WebCore::InspectorFrontend::parsedScriptSource): + * inspector/InspectorFrontend.h: + * inspector/ScriptDebugListener.h: pass type of the isolated world where the script was compiled to didParseSource. + (WebCore::): + * inspector/front-end/InjectedScript.js: + (injectedScriptConstructor): + * inspector/front-end/Script.js: + (WebInspector.Script): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.prototype.addScript): + (WebInspector.ScriptsPanel.prototype._addScriptToFilesMenu): use different style to highlight content scripts. + * inspector/front-end/inspector.css: + (#scripts-files option.extension-script): + * inspector/front-end/inspector.js: + (WebInspector.parsedScriptSource): + +2010-06-06 MORITA Hajime <morrita@google.com> + + Unreviewd, Chromium windows build fix. + + * rendering/RenderThemeChromiumWin.cpp: + (WebCore::RenderThemeChromiumWin::paintProgressBar): + +2010-06-06 MORITA Hajime <morrita@google.com> + + Reviewed by Kent Tamura. + + ASSERTION FAILED with -webkit-appearance:progress-bar for non <progress> elements + https://bugs.webkit.org/show_bug.cgi?id=40158 + + paintProgressBar() and paintMeter() assumed given RenderObject is + RenderProgress or RenderMeter respectively, but arbitrary elements + can have -webkit-appearance: progress-bar and such elements + violates that assumption. So this change added type check before + downcasting the RenderObject. + + * platform/qt/RenderThemeQt.cpp: + (WebCore::RenderThemeQt::paintProgressBar): + * rendering/RenderTheme.cpp: + (WebCore::RenderTheme::paintMeter): + * rendering/RenderThemeChromiumSkia.cpp: + (WebCore::RenderThemeChromiumSkia::paintProgressBar): + * rendering/RenderThemeChromiumWin.cpp: + (WebCore::RenderThemeChromiumWin::paintProgressBar): + * rendering/RenderThemeMac.mm: + (WebCore::RenderThemeMac::paintProgressBar): + +2010-06-06 Gavin Barraclough <barraclough@apple.com> + + Reviewed by NOBODY (Qt build fix pt 2). + + * bridge/qt/qt_runtime.cpp: + (JSC::Bindings::findMethodIndex): + (JSC::Bindings::QtRuntimeMetaMethod::call): + (JSC::Bindings::QtRuntimeConnectionMethod::call): + +2010-06-06 Gavin Barraclough <barraclough@apple.com> + + Reviewed by NOBODY (Qt build fix). + + * bridge/qt/qt_runtime.cpp: + (JSC::Bindings::findMethodIndex): + (JSC::Bindings::QtRuntimeMetaMethod::call): + (JSC::Bindings::QtRuntimeConnectionMethod::call): + +2010-06-06 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Sam Weinig. + + Bug 40214 - Clean up error construction / throwing in JSC. + + The one egregious insanity here is that creating an error requires + a VM-entry-esqe-host call (the string argument is wrapped as a JS + object & pushed on the RegisterFile, then unwrapped back to a + UString). Changing this also means you only require a global + object, not an ExecState, to create an error. + + The methods to create error objects are also parameterized + requiring a switch on the type, which can be made cleaner and + faster by moving to a separate method per error type. Code to add + divot information to error had been duplicated, and is coalesced + back into a single function. + + Convenience methods added to create & throw type & syntax error + with a default error message, since this is a common case. + + Also, errors are currently thrown either using + "throwError(exec, error)" or "exec->setException(error)" - unify + on the former, since this is more commonly used. Add + "throwVMError(exec, error)" equivalents, as a convenience for + cases where the result was being wrapped in "JSValue::encode(...)". + + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSArrayBufferConstructor.h: + (WebCore::construct): + * bindings/js/JSArrayBufferViewHelper.h: + (WebCore::setWebGLArrayHelper): + * bindings/js/JSAudioConstructor.cpp: + (WebCore::constructAudio): + * bindings/js/JSCanvasRenderingContext2DCustom.cpp: + (WebCore::JSCanvasRenderingContext2D::setFillColor): + (WebCore::JSCanvasRenderingContext2D::setStrokeColor): + (WebCore::JSCanvasRenderingContext2D::drawImage): + (WebCore::JSCanvasRenderingContext2D::drawImageFromRect): + (WebCore::JSCanvasRenderingContext2D::setShadow): + (WebCore::JSCanvasRenderingContext2D::createPattern): + (WebCore::JSCanvasRenderingContext2D::fillText): + (WebCore::JSCanvasRenderingContext2D::strokeText): + * bindings/js/JSClipboardCustom.cpp: + (WebCore::JSClipboard::clearData): + (WebCore::JSClipboard::getData): + (WebCore::JSClipboard::setDragImage): + * bindings/js/JSDOMBinding.cpp: + (WebCore::setDOMException): + (WebCore::toJSSequence): + * bindings/js/JSDOMWrapper.cpp: + (WebCore::DOMObject::defineOwnProperty): + * bindings/js/JSDesktopNotificationsCustom.cpp: + (WebCore::JSNotificationCenter::requestPermission): + * bindings/js/JSEventSourceConstructor.cpp: + (WebCore::constructEventSource): + * bindings/js/JSHTMLDocumentCustom.cpp: + (WebCore::JSHTMLDocument::open): + * bindings/js/JSHTMLInputElementCustom.cpp: + (WebCore::JSHTMLInputElement::selectionStart): + (WebCore::JSHTMLInputElement::setSelectionStart): + (WebCore::JSHTMLInputElement::selectionEnd): + (WebCore::JSHTMLInputElement::setSelectionEnd): + (WebCore::JSHTMLInputElement::setSelectionRange): + * bindings/js/JSImageConstructor.cpp: + (WebCore::constructImage): + * bindings/js/JSJavaScriptCallFrameCustom.cpp: + (WebCore::JSJavaScriptCallFrame::evaluate): + * bindings/js/JSMessageChannelConstructor.cpp: + (WebCore::JSMessageChannelConstructor::construct): + * bindings/js/JSMessagePortCustom.cpp: + (WebCore::fillMessagePortArray): + * bindings/js/JSOptionConstructor.cpp: + (WebCore::constructHTMLOptionElement): + * bindings/js/JSSVGMatrixCustom.cpp: + (WebCore::JSSVGMatrix::multiply): + * bindings/js/JSSharedWorkerConstructor.cpp: + (WebCore::constructSharedWorker): + * bindings/js/JSWebGLRenderingContextCustom.cpp: + (WebCore::JSWebGLRenderingContext::bufferData): + (WebCore::JSWebGLRenderingContext::bufferSubData): + (WebCore::getObjectParameter): + (WebCore::JSWebGLRenderingContext::getFramebufferAttachmentParameter): + (WebCore::JSWebGLRenderingContext::getParameter): + (WebCore::JSWebGLRenderingContext::getProgramParameter): + (WebCore::JSWebGLRenderingContext::getShaderParameter): + (WebCore::JSWebGLRenderingContext::getUniform): + (WebCore::JSWebGLRenderingContext::texImage2D): + (WebCore::JSWebGLRenderingContext::texSubImage2D): + (WebCore::dataFunctionf): + (WebCore::dataFunctioni): + (WebCore::dataFunctionMatrix): + * bindings/js/JSWebSocketConstructor.cpp: + (WebCore::constructWebSocket): + * bindings/js/JSWebSocketCustom.cpp: + (WebCore::JSWebSocket::send): + * bindings/js/JSWorkerConstructor.cpp: + (WebCore::constructWorker): + * bindings/js/JSXMLHttpRequestConstructor.cpp: + (WebCore::constructXMLHttpRequest): + * bindings/js/JSXMLHttpRequestCustom.cpp: + (WebCore::JSXMLHttpRequest::open): + * bindings/js/SerializedScriptValue.cpp: + (WebCore::BaseWalker::throwStackOverflow): + (WebCore::BaseWalker::throwInterruptedException): + (WebCore::SerializingTreeWalker::startArray): + (WebCore::SerializingTreeWalker::startObject): + * bindings/js/WorkerScriptController.cpp: + (WebCore::WorkerScriptController::setException): + * bindings/scripts/CodeGeneratorJS.pm: + * bridge/c/c_instance.cpp: + (JSC::Bindings::CInstance::moveGlobalExceptionToExecState): + (JSC::Bindings::CInstance::invokeMethod): + (JSC::Bindings::CInstance::invokeDefaultMethod): + (JSC::Bindings::CInstance::invokeConstruct): + * bridge/jni/jsc/JNIBridgeJSC.cpp: + (JavaField::dispatchValueFromInstance): + (JavaField::dispatchSetValueToInstance): + * bridge/jni/jsc/JavaInstanceJSC.cpp: + (JavaInstance::invokeMethod): + * bridge/objc/objc_instance.mm: + (ObjcInstance::moveGlobalExceptionToExecState): + (ObjcInstance::invokeMethod): + * bridge/objc/objc_runtime.mm: + (JSC::Bindings::ObjcField::valueFromInstance): + (JSC::Bindings::ObjcField::setValueToInstance): + (JSC::Bindings::ObjcArray::setValueAt): + (JSC::Bindings::ObjcArray::valueAt): + (JSC::Bindings::callObjCFallbackObject): + * bridge/objc/objc_utility.h: + * bridge/objc/objc_utility.mm: + (JSC::Bindings::throwError): + * bridge/runtime_array.cpp: + (JSC::RuntimeArray::put): + * bridge/runtime_method.cpp: + (JSC::callRuntimeMethod): + * bridge/runtime_object.cpp: + (JSC::Bindings::RuntimeObject::throwInvalidAccessError): + +2010-06-06 Dirk Schulze <krit@webkit.org> + + Reviewed by Nikolas Zimmermann. + + hit testing does not respect clip paths + https://bugs.webkit.org/show_bug.cgi?id=15162 + + Test: svg/dynamic-updates/SVGClipPath-influences-hitTesting.html + + Added a check, if a float point is not only in the shape/object boundaries + but also is not in the clipped away area of a clipPath. + + * rendering/HitTestRequest.h: + (WebCore::HitTestRequest::): + (WebCore::HitTestRequest::svgClipContent): + * rendering/RenderPath.cpp: + (WebCore::RenderPath::fillContains): + (WebCore::RenderPath::nodeAtFloatPoint): + * rendering/RenderPath.h: + * rendering/RenderSVGContainer.cpp: + (WebCore::RenderSVGContainer::nodeAtFloatPoint): + * rendering/RenderSVGImage.cpp: + (WebCore::RenderSVGImage::nodeAtFloatPoint): + * rendering/RenderSVGResourceClipper.cpp: + (WebCore::RenderSVGResourceClipper::hitTestClipContent): + * rendering/RenderSVGResourceClipper.h: + * rendering/RenderSVGText.cpp: + (WebCore::RenderSVGText::nodeAtFloatPoint): + * rendering/SVGRenderSupport.cpp: + (WebCore::pointInClippingArea): + * rendering/SVGRenderSupport.h: + +2010-06-06 Dirk Schulze <krit@webkit.org> + + Reviewed by Nikolas Zimmermann. + + SVG Pattern/Gradient clean-up + https://bugs.webkit.org/show_bug.cgi?id=40205 + + Transformations of SVG Patterns and Gradients can be bundeled. + This calculation also needs just to be calculated once. It's not a great speed-up for most platforms, + but a clean-up and preparation for new features like vectorEffects and others. + Now, that we don't recalucluate the gradient and its transformations, it was necessary to add a way + to transform alreday existing gradients on Cairo. This is done in the same way like Skia transforms + gradients after they were created. + + This patch doesn't change functionality, so no new tests added. + + * platform/graphics/Gradient.cpp: + * platform/graphics/cairo/GradientCairo.cpp: + (WebCore::Gradient::setPlatformGradientSpaceTransform): + * rendering/RenderSVGResourceGradient.cpp: + (WebCore::RenderSVGResourceGradient::applyResource): + * rendering/RenderSVGResourceGradient.h: + * rendering/RenderSVGResourcePattern.cpp: + (WebCore::RenderSVGResourcePattern::applyResource): + (WebCore::RenderSVGResourcePattern::createTileImage): + (WebCore::RenderSVGResourcePattern::buildPattern): + * rendering/RenderSVGResourcePattern.h: + +2010-06-05 Dumitru Daniliuc <dumi@chromium.org> + + Unreviewed, typo/build fix. + + * bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp: + (WebCore::V8SQLStatementErrorCallback::handleEvent): + +2010-05-28 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Adam Barth. + + Do not pass empty handles to v8. + https://bugs.webkit.org/show_bug.cgi?id=39896 + + Passing an empty handle to v8 results in a crash with a stack + trace that doesn't give us much information about the cause of the + crash. Instead, if we check the handles we pass to v8 and crash + when they are empty, we do not make things worse, and should get a + more informative stack trace. + + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/scripts/test/V8/V8TestCallback.cpp: + (WebCore::V8TestCallback::callbackWithClass1Param): + (WebCore::V8TestCallback::callbackWithClass2Param): + * bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp: + (WebCore::V8SQLStatementErrorCallback::handleEvent): + +2010-05-30 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Darin Adler. + + Add a convenient helper getter for Frame* to RenderObject + https://bugs.webkit.org/show_bug.cgi?id=39928 + + document()->frame() is being called enough from RenderObject derivated classes + that it worth adding a helper Frame getter as a shortcut. + + No behavior change, so no new tests. + + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::isOffScreen): + (WebCore::AccessibilityRenderObject::stringValue): + (WebCore::AccessibilityRenderObject::selection): + (WebCore::AccessibilityRenderObject::setSelectedVisiblePositionRange): + * page/EventHandler.cpp: + (WebCore::canAutoscroll): + * rendering/InlineTextBox.cpp: + (WebCore::InlineTextBox::paint): + (WebCore::InlineTextBox::paintCustomHighlight): + (WebCore::InlineTextBox::paintTextMatchMarker): + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::paintCaret): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::paintCustomHighlight): + * rendering/RenderDataGrid.cpp: + (WebCore::RenderDataGrid::isActive): + * rendering/RenderFrameSet.cpp: + (WebCore::RenderFrameSet::flattenFrameSet): + * rendering/RenderImage.cpp: + (WebCore::RenderImage::paintFocusRings): + * rendering/RenderInline.cpp: + (WebCore::RenderInline::addDashboardRegions): + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::~RenderLayer): + (WebCore::RenderLayer::panScrollFromPoint): + (WebCore::RenderLayer::scrollByRecursively): + (WebCore::RenderLayer::scrollToOffset): + (WebCore::RenderLayer::autoscroll): + (WebCore::RenderLayer::isActive): + (showLayerTree): + * rendering/RenderLayerBacking.cpp: + (WebCore::inspectorTimelineAgent): + * rendering/RenderListBox.cpp: + (WebCore::RenderListBox::paintItemForeground): + (WebCore::RenderListBox::paintItemBackground): + (WebCore::RenderListBox::panScroll): + (WebCore::RenderListBox::autoscroll): + (WebCore::RenderListBox::isActive): + * rendering/RenderObject.cpp: + (WebCore::RenderObject::~RenderObject): + (WebCore::RenderObject::selectionBackgroundColor): + (WebCore::RenderObject::selectionForegroundColor): + (WebCore::RenderObject::destroy): + (WebCore::RenderObject::addDashboardRegions): + (WebCore::RenderObject::animation): + * rendering/RenderObject.h: + (WebCore::RenderObject::document): + (WebCore::RenderObject::frame): + +2010-06-05 Jonathan Kliegman <kliegs@chromium.org> + + Reviewed by Dirk Schulze. + + SVG doesn't support rgba colors + https://bugs.webkit.org/show_bug.cgi?id=16183 + + Enabled processing of rgba, hsl and hsla color specifications + for SVG files. SVG spec calls for CSS2 but common usage and + other browsers suppor CSS3 colors being used in SVG files + + Removed unused svg paramater from CSSParser::parseColorFromValue + + Tests: svg/custom/fill-opacity-hsl.svg + svg/custom/fill-opacity-rgba.svg + + * css/CSSParser.cpp: + (WebCore::CSSParser::parseColorFromValue): + * css/CSSParser.h: + * css/SVGCSSParser.cpp: + (WebCore::CSSParser::parseSVGValue): + (WebCore::CSSParser::parseSVGPaint): + (WebCore::CSSParser::parseSVGColor): + * svg/SVGColor.cpp: + (WebCore::SVGColor::colorFromRGBColorString): + +2010-06-05 Anders Bakken <agbakken@gmail.com> + + Reviewed by Eric Seidel. + + [Qt] ContextMenuItemQt.cpp has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=39780 + + * platform/qt/ContextMenuItemQt.cpp: + +2010-06-05 Anders Bakken <agbakken@gmail.com> + + Reviewed by Eric Seidel. + + [Qt] ContextMenuQt.cpp has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=39779 + + * platform/qt/ContextMenuQt.cpp: + +2010-06-05 Anders Bakken <agbakken@gmail.com> + + Reviewed by Eric Seidel. + + [Qt] DragDataQt.cpp has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=39777 + + * platform/qt/DragDataQt.cpp: + +2010-06-05 Anders Bakken <agbakken@gmail.com> + + Reviewed by Eric Seidel. + + [Qt] FileChooserQt.cpp has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=39776 + + * platform/qt/FileChooserQt.cpp: + +2010-06-05 Anders Bakken <agbakken@gmail.com> + + Reviewed by Eric Seidel. + + [Qt] FileSystemQt.cpp has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=39775 + + * platform/qt/FileSystemQt.cpp: + +2010-06-05 Anders Bakken <agbakken@gmail.com> + + Reviewed by Eric Seidel. + + [Qt] KURLQt.cpp has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=39774 + + * platform/qt/KURLQt.cpp: + +2010-06-05 Anders Bakken <agbakken@gmail.com> + + Reviewed by Eric Seidel. + + [Qt] LoggingQt.cpp has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=39772 + + * platform/qt/LoggingQt.cpp: + +2010-06-05 Anders Bakken <agbakken@gmail.com> + + Reviewed by Eric Seidel. + + [Qt] PlatformKeyboardEventQt.cpp has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=39770 + + * platform/qt/PlatformKeyboardEventQt.cpp: + (WebCore::keyIdentifierForQtKeyCode): + (WebCore::windowsKeyCodeForKeyEvent): + (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent): + +2010-06-05 Anders Bakken <agbakken@gmail.com> + + Reviewed by Eric Seidel. + + [Qt] PlatformScreenQt.cpp has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=39768 + + * platform/qt/PlatformMouseEventQt.cpp: + (WebCore::PlatformMouseEvent::PlatformMouseEvent): + +2010-06-05 Anders Bakken <agbakken@gmail.com> + + Reviewed by Eric Seidel. + + [Qt] RenderThemeQt.cpp has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=39767 + + * platform/qt/RenderThemeQt.cpp: + +2010-06-05 Anders Bakken <agbakken@gmail.com> + + Reviewed by Eric Seidel. + + [Qt] ScrollbarQt.cpp has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=39765 + + * platform/qt/ScrollbarQt.cpp: + +2010-06-04 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Make HTML5Lexer go fast + https://bugs.webkit.org/show_bug.cgi?id=40048 + + This patch changes us from using a jump table for each character to + using absolute jumps between parser states. This appears to be about a + 1% improvement on the parser bench mark (which is 1/10th of what we + need to catch the old parser). + + I've kept the underlying logic as close to the old logic as possible. + This new form will make it easier to handle the input stream part of + the spec and to make further performance improvements. + + * html/HTML5Lexer.cpp: + (WebCore::HTML5Lexer::reset): + (WebCore::HTML5Lexer::nextToken): + (WebCore::HTML5Lexer::emitCurrentToken): + * html/HTML5Lexer.h: + +2010-06-04 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Adler. + + HTML5 parser should be within 1% of old parser performance + https://bugs.webkit.org/show_bug.cgi?id=40172 + + Stop using adopt(). I think this function is cause us to do extra + mallocs that are hurting performance. Instead of caching AtomicString + on HTML5Token, just use the AtomicString on the old token. Also, + reserve inline capacity for 10 attributes. + + * html/HTML5Lexer.cpp: + (WebCore::HTML5Lexer::isAppropriateEndTag): + * html/HTML5Lexer.h: + * html/HTML5Token.h: + (WebCore::HTML5Token::beginStartTag): + (WebCore::HTML5Token::beginEndTag): + (WebCore::HTML5Token::beginCharacter): + (WebCore::HTML5Token::beginComment): + (WebCore::HTML5Token::beginDOCTYPE): + (WebCore::HTML5Token::name): + (WebCore::HTML5Token::characters): + (WebCore::HTML5Token::comment): + * html/HTML5TreeBuilder.cpp: + (WebCore::convertToOldStyle): + (WebCore::HTML5TreeBuilder::passTokenToLegacyParser): + +2010-06-04 Anders Bakken <agbakken@gmail.com> + + Reviewed by Eric Seidel. + + [Qt] ScrollbarThemeQt.cpp has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=39764 + + * platform/qt/ScrollbarThemeQt.cpp: + (WebCore::scPart): + (WebCore::scrollbarPart): + (WebCore::styleOptionSlider): + +2010-06-04 Anders Bakken <agbakken@gmail.com> + + Reviewed by Eric Seidel. + + [Qt] SharedTimerQt.cpp has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=39763 + + * platform/qt/SharedTimerQt.cpp: + +2010-06-04 Anders Bakken <agbakken@gmail.com> + + Reviewed by Eric Seidel. + + WidgetQt.cpp has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=39759 + + * platform/qt/WidgetQt.cpp: + +2010-06-04 Anders Bakken <agbakken@gmail.com> + + Reviewed by Eric Seidel. + + TemporaryLinkStubsQt.cpp has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=39761 + + * platform/qt/TemporaryLinkStubsQt.cpp: + +2010-06-04 Anders Bakken <agbakken@gmail.com> + + Reviewed by Eric Seidel. + + [Qt] SoundQt.cpp has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=39762 + + * platform/qt/SoundQt.cpp: + +2010-06-04 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Dirk Schulze. + + Canvas createPattern(img, repetition) shouldn't throw INVALID_STATE_ERR when !img.complete + https://bugs.webkit.org/show_bug.cgi?id=40166 + + Spec link: + http://www.whatwg.org/specs/web-apps/current-work/#dom-context-2d-createpattern + + Test: http/tests/misc/canvas-pattern-from-incremental-image.html (updated) + + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::createPattern): + +2010-06-04 Anders Bakken <agbakken@gmail.com> + + Reviewed by David Levin. + + [Qt] Localizations.cpp has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=39773 + + * platform/qt/Localizations.cpp: + (WebCore::localizedMediaTimeDescription): + +2010-06-04 Lyon Chen <liachen@rim.com> + + Reviewed by Darin Adler. + + ApplicationCacheStorage::storeNewestCache() Crash WebKit when openDatabase(true) failed + https://bugs.webkit.org/show_bug.cgi?id=40074 + + Adding m_database.isOpen() check for every openDatabase(true) call, this is needed because + openDatabase(true) could still fail, for example when cacheStorage is full or no longer available. + + * loader/appcache/ApplicationCacheStorage.cpp: + (WebCore::ApplicationCacheStorage::store): + (WebCore::ApplicationCacheStorage::storeNewestCache): + +2010-06-04 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r60684. + http://trac.webkit.org/changeset/60684 + https://bugs.webkit.org/show_bug.cgi?id=40196 + + This patch broke chromium reliability tests (Requested by + tonyg-cr on #webkit). + + * bindings/v8/ScriptSourceCode.h: + (WebCore::ScriptSourceCode::ScriptSourceCode): + * bindings/v8/V8Proxy.cpp: + (WebCore::V8Proxy::compileScript): + (WebCore::V8Proxy::evaluate): + * bindings/v8/V8Proxy.h: + +2010-06-04 Chris Fleizach <cfleizach@apple.com> + + Reviewed by David Kilzer. + + AX: need an aria-help + https://bugs.webkit.org/show_bug.cgi?id=40010 + + Test: accessibility/aria-help.html + + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::helpText): + * html/HTMLAttributeNames.in: + +2010-06-04 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] Canvas arc() with zero radius should draw a line to the start point + https://bugs.webkit.org/show_bug.cgi?id=40164 + + Spec link: + http://www.whatwg.org/specs/web-apps/current-work/#dom-context-2d-arc + + * platform/graphics/qt/PathQt.cpp: + (WebCore::Path::addArc): + +2010-06-04 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] RenderThemeGtk leaks memory + https://bugs.webkit.org/show_bug.cgi?id=40168 + + Call gtk_widget_destroy in the RenderThemeGtk destructor. This cleans + up all widget resources when a theme is destroyed. + + No new tests, because functionality has not changed. + + * platform/gtk/RenderThemeGtk.cpp: + (WebCore::RenderThemeGtk::~RenderThemeGtk): Call gtk_widget_destroy on m_gtkWindow. + +2010-06-04 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] RenderThemeGtk leaks memory + https://bugs.webkit.org/show_bug.cgi?id=40168 + + Remove the use of releaseRef to assign a value to a RefPtr. This results in + the original pointer taking an extra reference. + + * platform/gtk/RenderThemeGtk.cpp: + (WebCore::RenderThemeGtk::initMediaStyling): Remove the use of releaseRef here. + +2010-06-04 Adam Barth <abarth@webkit.org> + + Reviewed by Gavin Barraclough. + + Try to fix the windows build + https://bugs.webkit.org/show_bug.cgi?id=40189 + + Suppress the "unreachable code" warning because we want to assert that + we don't reach certain code points. + + * html/HTML5Lexer.cpp: + +2010-06-04 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Make HTML5Lexer go fast + https://bugs.webkit.org/show_bug.cgi?id=40048 + + A couple more cases like the previous patch that I missed. + + * html/HTML5Lexer.cpp: + (WebCore::HTML5Lexer::nextToken): + +2010-06-04 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Make HTML5Lexer go fast + https://bugs.webkit.org/show_bug.cgi?id=40048 + + Make all the state transitions in the machine explicit. This allows us + to remove all the break statements, which won't work correctly after we + change the macro definitions. + + Also, while I was looking at every line of code, I fixed a bunch of the + one-line-if style errors introduces in my previous patches. + + * html/HTML5Lexer.cpp: + (WebCore::HTML5Lexer::nextToken): + +2010-06-04 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Oliver Hunt. + + Bug 40187 - Change function signature of NativeConstructor to match NativeFunction + + Mostly for consistency, but constructor & args arguments are redundant, + and this will help if we wish to be able to JIT calls to more constructors. + + * bindings/js/JSArrayBufferConstructor.cpp: + (WebCore::constructCanvasArrayBuffer): + * bindings/js/JSAudioConstructor.cpp: + (WebCore::constructAudio): + * bindings/js/JSEventSourceConstructor.cpp: + (WebCore::constructEventSource): + * bindings/js/JSFloatArrayConstructor.cpp: + (WebCore::constructCanvasFloatArray): + * bindings/js/JSImageConstructor.cpp: + (WebCore::constructImage): + * bindings/js/JSInt16ArrayConstructor.cpp: + (WebCore::constructCanvasShortArray): + * bindings/js/JSInt32ArrayConstructor.cpp: + (WebCore::constructCanvasIntArray): + * bindings/js/JSInt8ArrayConstructor.cpp: + (WebCore::constructCanvasByteArray): + * bindings/js/JSMessageChannelConstructor.cpp: + (WebCore::JSMessageChannelConstructor::construct): + * bindings/js/JSMessageChannelConstructor.h: + * bindings/js/JSOptionConstructor.cpp: + (WebCore::constructHTMLOptionElement): + * bindings/js/JSSharedWorkerConstructor.cpp: + (WebCore::constructSharedWorker): + * bindings/js/JSUint16ArrayConstructor.cpp: + (WebCore::constructCanvasUnsignedShortArray): + * bindings/js/JSUint32ArrayConstructor.cpp: + (WebCore::constructCanvasUnsignedIntArray): + * bindings/js/JSUint8ArrayConstructor.cpp: + (WebCore::constructCanvasUnsignedByteArray): + * bindings/js/JSWebKitCSSMatrixConstructor.cpp: + (WebCore::constructWebKitCSSMatrix): + * bindings/js/JSWebKitPointConstructor.cpp: + (WebCore::constructWebKitPoint): + * bindings/js/JSWebSocketConstructor.cpp: + (WebCore::constructWebSocket): + * bindings/js/JSWorkerConstructor.cpp: + (WebCore::constructWorker): + * bindings/js/JSXMLHttpRequestConstructor.cpp: + (WebCore::constructXMLHttpRequest): + * bindings/js/JSXSLTProcessorConstructor.cpp: + (WebCore::constructXSLTProcessor): + * bindings/scripts/CodeGeneratorJS.pm: + * bridge/runtime_object.cpp: + (JSC::Bindings::callRuntimeConstructor): + +2010-06-04 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Make HTML5Lexer go fast + https://bugs.webkit.org/show_bug.cgi?id=40048 + + Change the intent of the loop to match what it's going to be once we + remove the loop. This is a whitespace only change that will make the + final diff much, much smaller. Sorry for the transient ugly style. + + * html/HTML5Lexer.cpp: + (WebCore::HTML5Lexer::nextToken): + +2010-06-04 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Make HTML5Lexer go fast + https://bugs.webkit.org/show_bug.cgi?id=40048 + + Introduce ADVANCE_TO macro. This is the last macro we need to + introduce. + + * html/HTML5Lexer.cpp: + (WebCore::HTML5Lexer::nextToken): + +2010-06-04 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Make HTML5Lexer go fast + https://bugs.webkit.org/show_bug.cgi?id=40048 + + Fix the rest of the RECONSUME_IN cases that were missed by our script. + Also, reorder some assigment to prepare for the ADVANCE_TO patch. + + * html/HTML5Lexer.cpp: + (WebCore::HTML5Lexer::nextToken): + +2010-06-04 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Make HTML5Lexer go fast + https://bugs.webkit.org/show_bug.cgi?id=40048 + + This patch handles the FLUSH_AND_ADVANCE_TO case. Again, this patch + introduces style errors that will be fixed shortly. + + * html/HTML5Lexer.cpp: + (WebCore::HTML5Lexer::nextToken): + +2010-06-04 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Make HTML5Lexer go fast + https://bugs.webkit.org/show_bug.cgi?id=40048 + + This patch handles the FLUSH_EMIT_AND_RESUME_IN case. This patch + introduces some bad style w.r.t. one-line if statements, but we'll fix + them all automatically in cleanup patch when we're done. + + * html/HTML5Lexer.cpp: + (WebCore::HTML5Lexer::nextToken): + +2010-06-04 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Make HTML5Lexer go fast + https://bugs.webkit.org/show_bug.cgi?id=40048 + + More small steps. This patch deals with emitting tokens. + + * html/HTML5Lexer.cpp: + (WebCore::HTML5Lexer::nextToken): + +2010-06-04 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Make HTML5Lexer go fast + https://bugs.webkit.org/show_bug.cgi?id=40048 + + The next step: using macros to delimit each state. Evetually, we're + going to change what these macros expand to. + + * html/HTML5Lexer.cpp: + (WebCore::HTML5Lexer::nextToken): + +2010-06-04 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Make HTML5Lexer go fast + https://bugs.webkit.org/show_bug.cgi?id=40048 + + We're going to do this patch in small steps to make it easier to verify correctness. + + * html/HTML5Lexer.cpp: + (WebCore::HTML5Lexer::nextToken): + +2010-06-04 Jay Civelli <jcivelli@chromium.org> + + Reviewed by David Levin. + + [chromium] Adding support for the left and right Windows keys to the + NativeWebKeyboardEvent. + https://bugs.webkit.org/show_bug.cgi?id=39752 + + * platform/chromium/KeyCodeConversionGtk.cpp: + (WebCore::windowsKeyCodeForKeyEvent): + +2010-06-04 Dirk Schulze <krit@webkit.org> + + Reviewed by Nikolas Zimmermann. + + SVG filter on filter don't work + https://bugs.webkit.org/show_bug.cgi?id=32708 + + Any child of <text> was not allowed to use the same filter as the text root. + I couldn't found any reason in the SVG specification that legimitate this. + Only batik also doesn't allow the same filter on the text root as on it's childs, + while any other effect is still allowed. + I removed this limitation so that the result looks like the result on Firefox. + + Test: svg/filters/filter-on-filter-for-text.svg + + * rendering/SVGRenderSupport.cpp: + (WebCore::SVGRenderBase::prepareToRenderSVGContent): + * rendering/SVGRenderSupport.h: + * rendering/SVGRootInlineBox.cpp: + (WebCore::SVGRootInlineBoxPaintWalker::SVGRootInlineBoxPaintWalker): + (WebCore::SVGRootInlineBoxPaintWalker::chunkStartCallback): + (WebCore::SVGRootInlineBox::paint): + +2010-06-04 Nate Chapin <japhet@chromium.org> + + Reviewed by Adam Barth. + + Factor PageCache functionality out of FrameLoader and into + PageCache itself. + + https://bugs.webkit.org/show_bug.cgi?id=39382 + + Refactor only, so no new tests. + + * history/PageCache.cpp: + (WebCore::pageCacheLogPrefix): + (WebCore::pageCacheLog): + (WebCore::logCanCacheFrameDecision): + (WebCore::logCanCachePageDecision): + (WebCore::PageCache::canCachePageContainingThisFrame): + (WebCore::PageCache::canCache): + (WebCore::PageCache::add): + (WebCore::PageCache::get): + * history/PageCache.h: + * loader/DocumentLoader.cpp: + (WebCore::DocumentLoader::commitIfReady): + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::commitProvisionalLoad): + (WebCore::FrameLoader::prepareForCachedPageRestore): + (WebCore::FrameLoader::continueLoadAfterNavigationPolicy): + (WebCore::FrameLoader::loadProvisionalItemFromCachedPage): + (WebCore::FrameLoader::navigateToDifferentDocument): + * loader/FrameLoader.h: + (WebCore::FrameLoader::quickRedirectComing): + * svg/graphics/SVGImage.cpp: + (WebCore::SVGImage::dataChanged): + +2010-06-04 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Pavel Feldman. + + WebInspector: Web Inspector: it would be better to push object properties to JSON string in order of insertion. + https://bugs.webkit.org/show_bug.cgi?id=40140 + + * inspector/InspectorValues.cpp: + (WebCore::InspectorObject::writeJSON): + * inspector/InspectorValues.h: + (WebCore::InspectorObject::setBool): + (WebCore::InspectorObject::setNumber): + (WebCore::InspectorObject::setString): + (WebCore::InspectorObject::set): + +2010-06-04 Tony Gentilcore <tonyg@chromium.org> + + Reviewed by Adam Barth. + + Persist V8's ScriptData to the memory cache. + https://bugs.webkit.org/show_bug.cgi?id=38661 + + This stores V8's ScriptData in the memory cache and also causes the + network platform layer to be notified of the available cacheable + metadata. + + Chromium's morejs benchmark shows a 3-4% improvement on fast hardware. + + No new tests because no new functionality. + + * bindings/v8/ScriptSourceCode.h: + (WebCore::ScriptSourceCode::ScriptSourceCode): + (WebCore::ScriptSourceCode::cachedScript): + * bindings/v8/V8Proxy.cpp: + (WebCore::V8Proxy::compileScript): + (WebCore::V8Proxy::precompileScript): + (WebCore::V8Proxy::evaluate): + * bindings/v8/V8Proxy.h: + +2010-06-04 Tony Gentilcore <tonyg@chromium.org> + + Reviewed by Adam Barth. + + Utilize new takeFirst() method where appropriate. + https://bugs.webkit.org/show_bug.cgi?id=40089 + + No new tests because no new functionality. + + * css/CSSStyleSheet.cpp: + (WebCore::CSSStyleSheet::addSubresourceStyleURLs): + * dom/XMLTokenizerLibxml2.cpp: + (WebCore::PendingCallbacks::callAndRemoveFirstCallback): + * html/HTMLTokenizer.cpp: + (WebCore::HTMLTokenizer::reset): + (WebCore::HTMLTokenizer::executeExternalScriptsIfReady): + * platform/text/SegmentedString.cpp: + (WebCore::SegmentedString::advanceSubstring): + * storage/Database.cpp: + (WebCore::Database::scheduleTransaction): + * storage/SQLTransaction.cpp: + (WebCore::SQLTransaction::getNextStatement): + * storage/SQLTransactionCoordinator.cpp: + (WebCore::SQLTransactionCoordinator::processPendingTransactions): + +2010-06-04 Nikita Vasilyev <me@elv1s.ru> + + Reviewed by Pavel Feldman. + + Web Inspector: better Function.prototype.bind for the internal code. + + In the "Event Listeners" pane show handler function instead of Function.prototype.bind. + + https://bugs.webkit.org/show_bug.cgi?id=40080 + + * inspector/front-end/utilities.js: + (Function.prototype.bind.bound): + (Function.prototype.bind.bound.toString): + (Function.prototype.bind): + +2010-06-04 Alexander Pavlov <apavlov@chromium.org> + + Unreviewed, fix Qt build. + + Add references to a new file. + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/front-end/WebKit.qrc: + +2010-06-04 Alexander Pavlov <apavlov@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: Eliminate direct dependency of StylesSidebarPane on InspectorBackend + https://bugs.webkit.org/show_bug.cgi?id=40069 + + No new tests are needed, as this is a refactoring. + + * inspector/front-end/CSSStyleModel.js: Added. + (WebInspector.CSSStyleModel): + (WebInspector.CSSStyleModel.prototype.getStylesAsync): + (WebInspector.CSSStyleModel.prototype.getComputedStyleAsync): + (WebInspector.CSSStyleModel.prototype.setRuleSelector): + (WebInspector.CSSStyleModel.prototype.addRule): + (WebInspector.CSSStyleModel.prototype.toggleStyleEnabled): + (WebInspector.CSSStyleModel.prototype.setCSSText): + (WebInspector.CSSStyleModel.prototype.applyStyleText): + * inspector/front-end/StylesSidebarPane.js: + (WebInspector.StylesSidebarPane.prototype.update.stylesCallback): + (WebInspector.StylesSidebarPane.prototype.update.computedStyleCallback): + (WebInspector.StylesSidebarPane.prototype.update): + (WebInspector.StylesSidebarPane.prototype._arrayContainsInheritedProperty): + (WebInspector.StylePropertiesSection.prototype.editingSelectorCommitted.successCallback): + (WebInspector.StylePropertiesSection.prototype.editingSelectorCommitted): + (WebInspector.BlankStylePropertiesSection.prototype.editingSelectorCommitted.successCallback): + (WebInspector.BlankStylePropertiesSection.prototype.editingSelectorCommitted): + (WebInspector.StylePropertyTreeElement.prototype.): + (WebInspector.StylePropertyTreeElement.prototype): + * inspector/front-end/inspector.html: + * inspector/front-end/inspector.js: + (WebInspector.loaded): + +2010-06-04 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] Compilation fails when compiling against Qt 4.7 and Qt Mobility is installed + https://bugs.webkit.org/show_bug.cgi?id=40116 + + CONFIG += mobility has the side-effect of pulling in mobility includes, which conflict + with Qt 4.7's bearer managenent includes and break the build. + + * WebCore.pro: + +2010-06-04 Vangelis Kokkevis <vangelis@chromium.org> + + Reviewed by Dimitri Glazkov. + + [chromium] Fix scrolling bug with pages using accelerated compositing. + https://bugs.webkit.org/show_bug.cgi?id=40037 + + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::LayerRendererChromium): + (WebCore::LayerRendererChromium::drawLayers): + +2010-06-04 Matthew Delaney <mdelaney@apple.com> + + Reviewed by Darin Adler. + + CG implementation needed for compression quality in canvas.toDataURL + https://bugs.webkit.org/show_bug.cgi?id=38492 + + Took toDataURL.jpeg.quality.basic.html test off of Skipped list. Passes. + + Went the route of avoiding in-band signaling to flag the use of a quality + parameter or not. So, instead of simply passing the quality down as a + double, instead I pass a reference to the quality parameter from where + it comes in just after the JS bindings. Thus, no need for any global + constants to signify when the quality is not specified. Updated the other + platforms to support this (qt was on the only one currently with any + implementation). + + * bindings/js/JSHTMLCanvasElementCustom.cpp: Moved range check logic for quality parameter down lower. Updated + call to toDataURL to use double* instead of just passing the quality directly. + (WebCore::JSHTMLCanvasElement::toDataURL): + * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp: Updated toDataURL call to pass double* + (WebCore::V8HTMLCanvasElement::toDataURLCallback): + * dom/CanvasSurface.cpp: Updated method prototype. + (WebCore::CanvasSurface::toDataURL): + * dom/CanvasSurface.h: Updated method prototype. + (WebCore::CanvasSurface::toDataURL): + * platform/graphics/ImageBuffer.h: Updated method signature to use double* for quality param. + * platform/graphics/cairo/ImageBufferCairo.cpp: Updated prototype for consistency. + (WebCore::ImageBuffer::toDataURL): + * platform/graphics/cg/ImageBufferCG.cpp: Implemented support for quality parametejr when jpeg MIME type used. + (WebCore::jpegUTI): + (WebCore::utiFromMIMEType): + (WebCore::ImageBuffer::toDataURL): + * platform/graphics/haiku/ImageBufferHaiku.cpp: Updated prototype for consistency. + (WebCore::ImageBuffer::toDataURL): + * platform/graphics/qt/ImageBufferQt.cpp: Updated prototype for consistency. + (WebCore::ImageBuffer::toDataURL): + * platform/graphics/skia/ImageBufferSkia.cpp: Updated prototype for consistency. + (WebCore::ImageBuffer::toDataURL): + * platform/graphics/wince/ImageBufferWince.cpp: Updated prototype for consistency. + (WebCore::ImageBuffer::toDataURL): + * platform/graphics/wx/ImageBufferWx.cpp: Updated prototype for consistency. + (WebCore::ImageBuffer::toDataURL): + +2010-06-04 Alejandro G. Castro <alex@igalia.com> + + Reviewed by Xan Lopez. + + Leaks in listDirectory + https://bugs.webkit.org/show_bug.cgi?id=40008 + + Fixed both leaks. + + * platform/gtk/FileSystemGtk.cpp: + (WebCore::listDirectory): + +2010-06-04 Anton Muhin <antonm@chromium.org> + + Reviewed by Nate Chapin. + + [Chromium] get rid of named interceptor on HTMLDocument and introduce/remove accessors when named items get deleted/removed + https://bugs.webkit.org/show_bug.cgi?id=39877 + + This patch makes callbacks invoked on named items addition/removal + install API accessors and thus there is no more need in + named and indexed interceptors on HTMLDocument which + speeds up invocation of methods on document. + + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/v8/ScriptController.cpp: + (WebCore::ScriptController::namedItemAdded): + (WebCore::ScriptController::namedItemRemoved): + * bindings/v8/V8DOMWindowShell.cpp: + (WebCore::checkDocumentWrapper): + (WebCore::V8DOMWindowShell::updateDocumentWrapperCache): + (WebCore::getter): + (WebCore::V8DOMWindowShell::namedItemAdded): + (WebCore::V8DOMWindowShell::namedItemRemoved): + * bindings/v8/V8DOMWindowShell.h: + * bindings/v8/V8DOMWrapper.cpp: + (WebCore::V8DOMWrapper::instantiateV8Object): + * bindings/v8/custom/V8HTMLDocumentCustom.cpp: + (WebCore::V8HTMLDocument::WrapInShadowObject): + (WebCore::V8HTMLDocument::GetNamedProperty): + (WebCore::V8HTMLDocument::allAccessorSetter): + (WebCore::toV8): + +2010-06-04 Kwang Yul Seo <skyul@company100.net> + + Reviewed by Kent Tamura. + + Change filenameFromString to return CString + https://bugs.webkit.org/show_bug.cgi?id=39494 + + filenameFromString returns a newly allocated string and the caller must + free the string. GTK and EFL ports use g_free while all others ports use + fastFree. This is confusing because the same function behaves + differently with respect to ports. Change filenameFromString to return + CString. + + * platform/FileSystem.cpp: + (WebCore::filenameFromString): + * platform/FileSystem.h: + * platform/efl/FileSystemEfl.cpp: + (WebCore::filenameFromString): + * platform/gtk/FileChooserGtk.cpp: + (WebCore::FileChooser::basenameForWidth): + * platform/gtk/FileSystemGtk.cpp: + (WebCore::filenameFromString): + (WebCore::filenameForDisplay): + (WebCore::fileExists): + (WebCore::deleteFile): + (WebCore::deleteEmptyDirectory): + (WebCore::getFileSize): + (WebCore::getFileModificationTime): + (WebCore::makeAllDirectories): + (WebCore::pathGetFileName): + (WebCore::directoryName): + (WebCore::listDirectory): + * platform/gtk/SharedBufferGtk.cpp: + (WebCore::SharedBuffer::createWithContentsOfFile): + * platform/network/soup/ResourceHandleSoup.cpp: + (WebCore::startHttp): + * platform/posix/SharedBufferPOSIX.cpp: + (WebCore::SharedBuffer::createWithContentsOfFile): + +2010-06-04 No'am Rosenthal <noam.rosenthal@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Fix compilation with QT_NO_FEATURE + https://bugs.webkit.org/show_bug.cgi?id=38324 + + The #ifdef QT_NO_GRAPHICSEFFECT was in the wrong place, would have + made AC not work at all. + + No new tests. + + * platform/graphics/qt/GraphicsLayerQt.cpp: + (WebCore::GraphicsLayerQtImpl::flushChanges): + +2010-06-04 Qi Zhang <qi.2.zhang@nokia.com> + + Reviewed by Laszlo Gombos. + + [Qt] Failed at http://philip.html5.org/tests/canvas/suite/tests/2d.path.arcTo.ensuresubpath.1.html + https://bugs.webkit.org/show_bug.cgi?id=38645 + + Path arcto function need to ensure there is subpath before it. + + * platform/graphics/qt/PathQt.cpp: + (WebCore::Path::addArcTo): + +2010-06-04 Qi Zhang <qi.2.zhang@nokia.com> + + Reviewed by Laszlo Gombos. + + [Qt] failed at http://philip.html5.org/tests/canvas/suite/tests/2d.path.arc.angle.3.html + https://bugs.webkit.org/show_bug.cgi?id=38537 + + For path.arc function handle span > 2PI + + * platform/graphics/qt/PathQt.cpp: + (WebCore::Path::addArc): + +2010-06-04 Zhenyao Mo <zmo@google.com> + + Reviewed by Dimitri Glazkov. + + Set attributes.stencil to false by default at context creation + https://bugs.webkit.org/show_bug.cgi?id=40090 + + * platform/graphics/GraphicsContext3D.h: Set default attributes.stencil to false. + (WebCore::GraphicsContext3D::Attributes::Attributes): + +2010-06-03 Abhishek Arya <inferno@chromium.org> + + Reviewed by Eric Carlson. + + Fix a crash when trying to use an invalid media src url by + moving the isValid url checks to a central location in + isSafeToLoadURL function. Also added an empty string check + in DocumentLoader::didTellClientAboutLoad. + + Test: media/invalid-media-url-crash.html + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::isSafeToLoadURL): + (WebCore::HTMLMediaElement::selectNextSourceChild): + (WebCore::HTMLMediaElement::getPluginProxyParams): + * loader/DocumentLoader.h: + (WebCore::DocumentLoader::didTellClientAboutLoad): + +2010-06-03 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r60642. + http://trac.webkit.org/changeset/60642 + https://bugs.webkit.org/show_bug.cgi?id=40151 + + Broke rendering of border images on rotated elements + (Requested by jamesr on #webkit). + + * platform/graphics/GraphicsContext.cpp: + (WebCore::GraphicsContext::drawImage): + (WebCore::GraphicsContext::drawTiledImage): + * platform/graphics/GraphicsContext.h: + * rendering/RenderBoxModelObject.cpp: + (WebCore::RenderBoxModelObject::paintNinePieceImage): + +2010-06-03 Damian Kaleta <dkaleta@apple.com> + + Reviewed by Beth Dakin. + + Pixel cracks in border images when drawing with a scale factor > 1 + <rdar://problem/7994266>pixel cracks in border images + https://bugs.webkit.org/show_bug.cgi?id=15720 + + * platform/graphics/GraphicsContext.cpp: + (WebCore::GraphicsContext::drawImage): + (WebCore::GraphicsContext::drawTiledImage): + * platform/graphics/GraphicsContext.h: Added two new methods to support drawing using FloatRect. + If the boolean flag roundToPixels is true, the pixels are adjusted with the pixel boundaries. + * rendering/RenderBoxModelObject.cpp: + (WebCore::RenderBoxModelObject::paintNinePieceImage): + +2010-06-03 James Robinson <jamesr@chromium.org> + + Reviewed by Dan Bernstein. + + Take container's scroll offset and clip into account when initializing LayoutState + https://bugs.webkit.org/show_bug.cgi?id=38506 + + When doing a subtree layout, the initial LayoutState creation needs to + take the layout root container's offset and its scroll offset into account + to create the initial offset. Otherwise if a subtree layout occurs + for a layout root whose container has a non-zero scroll offset + the LayoutState's offset and clip are wrong, resulting in a mispaint. + See the test cases for examples. + + Tests: fast/repaint/layout-state-scrolloffset.html + fast/repaint/layout-state-scrolloffset2.html + fast/repaint/layout-state-scrolloffset3.html + + * rendering/LayoutState.cpp: + (WebCore::LayoutState::LayoutState): + +2010-06-03 Gavin Barraclough <barraclough@apple.com> + + Reviewed by NOBODY (speculative Qt build fix II). + + * bridge/qt/qt_runtime.cpp: + (JSC::Bindings::QtRuntimeMetaMethod::call): + (JSC::Bindings::QtRuntimeConnectionMethod::call): + +2010-06-03 Gavin Barraclough <barraclough@apple.com> + + Reviewed by NOBODY (speculative Qt build fix). + + * bridge/qt/qt_runtime.cpp: + (JSC::Bindings::QtRuntimeMetaMethod::call): + (JSC::Bindings::QtRuntimeConnectionMethod::call): + +2010-06-02 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Oliver Hunt. + + Bug 40094 - The return type of NativeFunction should be EncodedJSValue + On Windows & Linux, using JSVALUE32_64, EncodedJSValue is returned in registers, but JSValue is not. + + * bindings/js/JSCallbackData.cpp: + (WebCore::JSCallbackData::invokeCallback): + * bindings/js/JSCustomXPathNSResolver.cpp: + (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI): + * bindings/js/JSEventListener.cpp: + (WebCore::JSEventListener::handleEvent): + * bindings/js/JSHTMLAllCollectionCustom.cpp: + (WebCore::callHTMLAllCollection): + * bindings/js/JSHTMLCollectionCustom.cpp: + (WebCore::callHTMLCollection): + * bindings/js/JSHTMLDocumentCustom.cpp: + (WebCore::JSHTMLDocument::open): + * bindings/js/JSInjectedScriptHostCustom.cpp: + (WebCore::InjectedScriptHost::createInjectedScript): + * bindings/js/JSNodeFilterCondition.cpp: + (WebCore::JSNodeFilterCondition::acceptNode): + * bindings/js/JSNodeListCustom.cpp: + (WebCore::callNodeList): + * bindings/js/JSPluginElementFunctions.cpp: + (WebCore::callPlugin): + * bindings/js/ScheduledAction.cpp: + (WebCore::ScheduledAction::create): + (WebCore::ScheduledAction::executeFunctionInContext): + * bindings/js/ScriptFunctionCall.cpp: + (WebCore::ScriptFunctionCall::call): + * bindings/js/SerializedScriptValue.cpp: + (WebCore::SerializingTreeWalker::convertIfTerminal): + * bindings/objc/WebScriptObject.mm: + (-[WebScriptObject callWebScriptMethod:withArguments:]): + * bindings/scripts/CodeGeneratorJS.pm: + * bridge/NP_jsobject.cpp: + (_NPN_InvokeDefault): + (_NPN_Invoke): + (_NPN_Construct): + * bridge/jni/jni_jsobject.mm: + (JavaJSObject::call): + * bridge/objc/objc_runtime.mm: + (JSC::Bindings::callObjCFallbackObject): + * bridge/runtime_method.cpp: + (JSC::callRuntimeMethod): + * bridge/runtime_object.cpp: + (JSC::Bindings::callRuntimeObject): + +2010-06-03 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r60614. + http://trac.webkit.org/changeset/60614 + https://bugs.webkit.org/show_bug.cgi?id=40123 + + It made fast/dom/Window/window-postmessage-clone.html fail on + Mac bots (Requested by Ossy on #webkit). + + * Android.derived.jscbindings.mk: + * Android.derived.v8bindings.mk: + * Android.mk: + * CMakeLists.txt: + * DerivedSources.cpp: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pri: + * WebCore.pro: + * bindings/generic/RuntimeEnabledFeatures.cpp: + * bindings/generic/RuntimeEnabledFeatures.h: + * bindings/js/JSEventCustom.cpp: + (WebCore::toJS): + * bindings/v8/custom/V8EventCustom.cpp: + (WebCore::toV8): + * dom/Document.cpp: + (WebCore::Document::createEvent): + (WebCore::Document::addListenerTypeIfNeeded): + * dom/Document.h: + (WebCore::Document::): + * dom/Document.idl: + * dom/Element.h: + * dom/Element.idl: + * dom/Event.cpp: + (WebCore::Event::fromUserGesture): + * dom/Event.h: + * dom/EventNames.h: + * dom/TransformActionEvent.cpp: Removed. + * dom/TransformActionEvent.h: Removed. + * dom/TransformActionEvent.idl: Removed. + * html/HTMLAttributeNames.in: + * html/HTMLElement.cpp: + (WebCore::HTMLElement::parseMappedAttribute): + * page/DOMWindow.h: + * page/DOMWindow.idl: + +2010-06-03 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + [v8] Web Inspector: show "Object" as description for values with anonymous constructor + https://bugs.webkit.org/show_bug.cgi?id=40121 + + * inspector/front-end/InjectedScript.js: + (injectedScriptConstructor): + +2010-06-03 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix NPAPI support on Mac OS X/Cocoa-32 + + qt_mac_window_for() returns a NSWindow on Cocoa, so we were + passing in a NSWindow instead of a WindowRef as part of the + NP_CGContext. + + https://bugs.webkit.org/show_bug.cgi?id=38762 + + * WebCore.gypi: Reflect rename + * WebCore.pro: Reflect rename + * plugins/mac/PluginViewMac.cpp: Renamed to PluginViewMac.mm + and fix bug by getting the Carbon windowRef from the NSWindow. + * wscript: Reflect rename + +2010-06-03 Kim Grönholm <kim.1.gronholm@nokia.com> + + Reviewed by Simon Hausmann. + + Add TransformActionEvent support + https://bugs.webkit.org/show_bug.cgi?id=39757 + + Added only the necessary TransformAction event interfaces and not e.g. + any eventhandler hooks that generate and dispatch them. + + Test: fast/events/transformaction/create-transformaction-event.html + More tests will be added with the machinery that generates and + dispatches these events. + + * Android.derived.jscbindings.mk: + * Android.derived.v8bindings.mk: + * Android.mk: + * CMakeLists.txt: + * DerivedSources.cpp: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pri: + * WebCore.pro: + * bindings/generic/RuntimeEnabledFeatures.cpp: + * bindings/generic/RuntimeEnabledFeatures.h: + (WebCore::RuntimeEnabledFeatures::transformactionEnabled): + (WebCore::RuntimeEnabledFeatures::setTransformActionEnabled): + (WebCore::RuntimeEnabledFeatures::ontransformactionstartEnabled): + (WebCore::RuntimeEnabledFeatures::ontransformactionupdateEnabled): + (WebCore::RuntimeEnabledFeatures::ontransformactionendEnabled): + * bindings/js/JSEventCustom.cpp: + (WebCore::toJS): + * bindings/v8/custom/V8EventCustom.cpp: + (WebCore::toV8): + * dom/Document.cpp: + (WebCore::Document::createEvent): + (WebCore::Document::addListenerTypeIfNeeded): + * dom/Document.h: + (WebCore::Document::): + * dom/Document.idl: + * dom/Element.h: + * dom/Element.idl: + * dom/Event.cpp: + (WebCore::Event::isTransformActionEvent): + (WebCore::Event::fromUserGesture): + * dom/Event.h: + * dom/EventNames.h: + * dom/TransformActionEvent.cpp: Added. + (WebCore::TransformActionEvent::TransformActionEvent): + (WebCore::TransformActionEvent::initTransformActionEvent): + * dom/TransformActionEvent.h: Added. + (WebCore::TransformActionEvent::create): + (WebCore::TransformActionEvent::translateX): + (WebCore::TransformActionEvent::translateY): + (WebCore::TransformActionEvent::translateSpeedX): + (WebCore::TransformActionEvent::translateSpeedY): + (WebCore::TransformActionEvent::scale): + (WebCore::TransformActionEvent::scaleSpeed): + (WebCore::TransformActionEvent::rotate): + (WebCore::TransformActionEvent::rotateSpeed): + (WebCore::TransformActionEvent::TransformActionEvent): + (WebCore::TransformActionEvent::isTransformActionEvent): + * dom/TransformActionEvent.idl: Added. + * html/HTMLAttributeNames.in: + * html/HTMLElement.cpp: + (WebCore::HTMLElement::parseMappedAttribute): + * page/DOMWindow.h: + * page/DOMWindow.idl: + +2010-06-03 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: a number of fixes that make InspectorController + happy with null redirects. + + https://bugs.webkit.org/show_bug.cgi?id=40109 + + * inspector/InspectorController.cpp: + (WebCore::InspectorController::willSendRequest): + (WebCore::InspectorController::didReceiveResponse): + (WebCore::InspectorController::didReceiveContentLength): + (WebCore::InspectorController::didFinishLoading): + (WebCore::InspectorController::didFailLoading): + +2010-06-03 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed. Rolling out aggressive cache part of the r60391 + described in the bug below. It was orthogonal to the rest of + the patch and caused regression. + + https://bugs.webkit.org/show_bug.cgi?id=37364 + + * platform/graphics/skia/ImageSkia.cpp: + (WebCore::drawResampledBitmap): + +2010-06-02 Darin Fisher <darin@chromium.org> + + Reviewed by Brady Eidson. + + location.href and outgoing referrer not updated properly by + pushState/replaceState + https://bugs.webkit.org/show_bug.cgi?id=40027 + + Tests: fast/loader/stateobjects/pushstate-updates-location.html + fast/loader/stateobjects/replacestate-updates-location.html + http/tests/navigation/pushstate-updates-referrer.html + http/tests/navigation/replacestate-updates-referrer.html + + * dom/Document.cpp: + (WebCore::Document::updateURLForPushOrReplaceState): + Update the FrameLoader's notion of the current URL as well! + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::loadInSameDocument): + Use the 'url' parameter instead of m_URL since m_URL might have + changed during the handling of the PopState event. Eventually, + this will become irrelevant since the PopState event should be + dispatched asynchronously, but just in case we patch HashChange + to be asynchronous before PopState, this change would be needed. + +2010-06-02 Eric Seidel <eric@webkit.org> + + Reviewed by Adam Barth. + + REGRESSION(60409): document.write is not synchronous when using the HTML5 parser + https://bugs.webkit.org/show_bug.cgi?id=40047 + + The HTML5 spec states that we should "spin the event loop" while + waiting for stylesheets to load. Currently we do that by yielding + out of the parser when stylesheets are loading. Because it was easy + we made inline <scripts> yield for stylesheet loads as well. However, + this caused document.write() to return after encountering the first + inline <script> tag in many cases which is incorrect. document.write + is supposed to block until the entire document is parsed (including) + executing inline script tags. To match the exiting parser, we'll just + make inline <script> tags not block on stylesheets for now. + + This is tested by WebCore/benchmarks/html-parser.html as well + as likely several other tests in LayoutTests which we haven't + triaged yet. + + * html/HTML5ScriptRunner.cpp: + (WebCore::HTML5ScriptRunner::executeScript): + - ASSERT that either stylesheets have loaded or we're executing an + inline <script> tag. + (WebCore::HTML5ScriptRunner::runScript): + - Remove the code to block inline <script> tags on stylesheet loads. + +2010-06-02 MORITA Hajime <morrita@google.com> + + Unreviewd, Chromium windows build fix. + + * rendering/RenderThemeChromiumWin.cpp: + (WebCore::RenderThemeChromiumWin::paintProgressBar): + +2010-06-02 MORITA Hajime <morrita@google.com> + + Reviewed by Kent Tamura. + + [Chromium] Linux: progress bar image pieces should be painted with same resampling mode + https://bugs.webkit.org/show_bug.cgi?id=40045 + + computeResamplingMode(), used by Image::drawPattern() and + BitmapImage::draw(), chooses an image resampling mode based on the + size of given image and the destination rectangle. But when + painting single component (i.e. a progress bar) from multiple + images, it can choose different resampling modes for images of + same component. That difference creates unexpected visual artifacts + like seams between images of single component. + + This change introduced "image resampling hint" to allow callers to + control the resampling mode. Using the hint, + RenderThemeChromiumSkia now able to hold same resampling mode + during draw a progress bar. + + No new tests. Expectations will come after ENABLE_PROGRESS_BAR get + enabled on chromium. + + * platform/graphics/skia/ImageSkia.cpp: + (WebCore::computeResamplingMode): + * platform/graphics/skia/PlatformContextSkia.cpp: + (PlatformContextSkia::save): + (PlatformContextSkia::setImageResamplingHint): Added + (PlatformContextSkia::clearImageResamplingHint): Added + (PlatformContextSkia::hasImageResamplingHint): Added + (PlatformContextSkia::imageResamplingHint): Added + * platform/graphics/skia/PlatformContextSkia.h: + * rendering/RenderThemeChromiumSkia.cpp: + (WebCore::RenderThemeChromiumSkia::paintProgressBar): + +2010-06-03 MORITA Hajime <morrita@google.com> + + Reviewed by Kent Tamura. + + [Chromium] Support HTML5 <progress> element on Linux. + https://bugs.webkit.org/show_bug.cgi?id=37310 + + Implemented RenderThemeChromiumSkia::paintProgressBar(), extracing + determinateProgressValueRectFor() from RenderThemeChromiumWin to + RenderThemeChromiumSkia + + No new tests. Expectations will come after ENABLE_PROGRESS_BAR get + enabled on chromium. + + * rendering/RenderThemeChromiumSkia.cpp: + (WebCore::RenderThemeChromiumSkia::determinateProgressValueRectFor): + (WebCore::RenderThemeChromiumSkia::indeterminateProgressValueRectFor): + (WebCore::RenderThemeChromiumSkia::animationRepeatIntervalForProgressBar): + (WebCore::RenderThemeChromiumSkia::animationDurationForProgressBar): + (WebCore::RenderThemeChromiumSkia::paintProgressBar): + (WebCore::RenderThemeChromiumSkia::progressValueRectFor): + * rendering/RenderThemeChromiumSkia.h: + * rendering/RenderThemeChromiumWin.cpp: + (WebCore::RenderThemeChromiumWin::paintProgressBar): + +2010-06-02 Nico Weber <thakis@chromium.org> + + Reviewed by Simon Fraser. + + Scroll events are sent twice per keypress for ports that don't have a platformWidget scrollbar + https://bugs.webkit.org/show_bug.cgi?id=39918 + + This was regressed by http://trac.webkit.org/changeset/58615 . Fix this by slightly tweaking + that patch. + + Test: editing/input/page-up-down-scrolls.html + + * page/FrameView.cpp: + (WebCore::FrameView::scrollPositionChanged): + * page/FrameView.h: + * platform/ScrollView.cpp: + (WebCore::ScrollView::valueChanged): + * platform/ScrollView.h: + (WebCore::ScrollView::repaintFixedElementsAfterScrolling): + +2010-06-02 Andrey Kosyakov <caseq@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: use platform-specific key designations in shortcuts help for mac + https://bugs.webkit.org/show_bug.cgi?id=39158 + + * inspector/front-end/KeyboardShortcut.js: + (WebInspector.KeyboardShortcut.shortcutToString): + (WebInspector.KeyboardShortcut._keyName): + (WebInspector.KeyboardShortcut._modifiersToString): + * inspector/front-end/inspector.js: + (WebInspector._registerShortcuts): + +2010-06-02 Kenneth Russell <kbr@google.com> + + Reviewed by Darin Fisher. + + Enable WebGL on more platforms even if accelerated compositing is disabled + https://bugs.webkit.org/show_bug.cgi?id=40085 + + Conditionalize the code which prevents a WebGL rendering context + from being created if accelerated compositing is disabled. + Currently Chromium is the only port which will create a context if + accelerated compositing is disabled; other ports may opt in to + this code path if desired. + + Tested with existing WebGL layout tests in Safari and Chromium on + Mac OS X. + + * html/HTMLCanvasElement.cpp: + (WebCore::HTMLCanvasElement::getContext): + +2010-06-02 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r60580. + http://trac.webkit.org/changeset/60580 + https://bugs.webkit.org/show_bug.cgi?id=40087 + + This broke dragging links if the selection was in a + contentEditable element. (Requested by arv on #webkit). + + * page/FocusController.cpp: + (WebCore::clearSelectionIfNeeded): + +2010-06-02 Erik Arvidsson <arv@chromium.org> + + Reviewed by ojan@chromium.org. + + REGRESSION: Weird focus behavior affects quoting on University of Washington message board system + https://bugs.webkit.org/show_bug.cgi?id=38548 + + Test: editing/selection/click-in-focusable-link-should-not-clear-selection.html + + * page/FocusController.cpp: + (WebCore::clearSelectionIfNeeded): + +2010-06-02 David Hyatt <hyatt@apple.com> + + Reviewed by Anders Carlsson. + + Just disable the current version of multi-column layout completely when the new + pagination model is in effect. + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::setDesiredColumnCountAndWidth): + +2010-06-02 David Hyatt <hyatt@apple.com> + + Reviewed by Anders Carlsson. + + Turn off unforced page breaking at paint time when the new page breaking model is being used. + + * rendering/RenderLineBoxList.cpp: + (WebCore::RenderLineBoxList::paint): + +2010-06-02 David Hyatt <hyatt@apple.com> + + Reviewed by Anders Carlsson. + + Don't check page break properties at paint time if we're using the new page breaking model. + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::paintChildren): + +2010-06-02 Nate Chapin <japhet@chromium.org> + + Reviewed by Dimitri Glazkov. + + [V8] Fix an infinite recursion crash when trying to wrap + media elements without a media player. + + No test because there isn't a good way to ensure the media player + is off. + + * dom/make_names.pl: Call, e.g., V8HTMLElement::wrap(HTMLElement*) + instead of toV8(HTMLElement*). + +2010-06-02 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Darin Adler. + + Notification object ref counting is not correct. + https://bugs.webkit.org/show_bug.cgi?id=39998 + + Return PassRefPtr<Notification> instead of a raw pointer from the create methods + for Web Notifications. + + No new tests are needed, as existing tests show the problem when sending the + "display" event asynchronously. + + * notifications/Notification.h: + (WebCore::Notification::create): + * notifications/NotificationCenter.h: + (WebCore::NotificationCenter::createHTMLNotification): + (WebCore::NotificationCenter::createNotification): + +2010-06-02 Mikhail Naganov <mnaganov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: add Console API for retrieving memory stats + + Add 'console.memory' property which returns an object. Currently + it has two fields: totalJSHeapSize and usedJSHeapSize. Later, it can be + extended for reporting total browser's memory consumption. + + https://bugs.webkit.org/show_bug.cgi?id=39646 + + * CMakeLists.txt: + * DerivedSources.cpp: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pri: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSBindingsAllInOne.cpp: + * bindings/js/JSConsoleCustom.cpp: + (WebCore::JSConsole::memory): + * bindings/v8/custom/V8ConsoleCustom.cpp: + (WebCore::V8Console::memoryAccessorGetter): + * page/Console.h: + * page/Console.idl: + * page/MemoryInfo.cpp: Added. + (WebCore::MemoryInfo::MemoryInfo): + * page/MemoryInfo.h: Added. + (WebCore::MemoryInfo::create): + (WebCore::MemoryInfo::totalJSHeapSize): + (WebCore::MemoryInfo::usedJSHeapSize): + * page/MemoryInfo.idl: Added. + +2010-06-02 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: support "Continue to Here" in debugger + https://bugs.webkit.org/show_bug.cgi?id=39953 + + * English.lproj/localizedStrings.js: + * inspector/front-end/BreakpointManager.js: + (WebInspector.BreakpointManager.prototype.setOneTimeBreakpoint): + (WebInspector.BreakpointManager.prototype.removeOneTimeBreakpoint): + (WebInspector.BreakpointManager.prototype.addBreakpoint): + * inspector/front-end/ScriptView.js: + (WebInspector.ScriptView): + (WebInspector.ScriptView.prototype._continueToLine): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.prototype.continueToLine): + (WebInspector.ScriptsPanel.prototype.debuggerPaused): + * inspector/front-end/SourceFrame.js: + (WebInspector.SourceFrame): + * inspector/front-end/SourceView.js: + (WebInspector.SourceView): + (WebInspector.SourceView.prototype._continueToLine): + (WebInspector.SourceView.prototype.updateLocalContent): + +2010-06-02 Mikhail Naganov <mnaganov@chromium.org> + + Unreviewed, rolling out r60563. + http://trac.webkit.org/changeset/60563 + https://bugs.webkit.org/show_bug.cgi?id=39646 + + windows build failed + + * CMakeLists.txt: + * DerivedSources.cpp: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pri: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSConsoleCustom.cpp: + * bindings/v8/custom/V8ConsoleCustom.cpp: + * page/Console.h: + * page/Console.idl: + * page/MemoryInfo.cpp: Removed. + * page/MemoryInfo.h: Removed. + * page/MemoryInfo.idl: Removed. + +2010-06-02 Mikhail Naganov <mnaganov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: add Console API for retrieving memory stats + + Add 'console.memory' property which returns an object. Currently + it has two fields: totalJSHeapSize and usedJSHeapSize. Later, it can be + extended for reporting total browser's memory consumption. + + https://bugs.webkit.org/show_bug.cgi?id=39646 + + * CMakeLists.txt: + * DerivedSources.cpp: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pri: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSConsoleCustom.cpp: + (WebCore::JSConsole::memory): + * bindings/v8/custom/V8ConsoleCustom.cpp: + (WebCore::V8Console::memoryAccessorGetter): + * page/Console.h: + * page/Console.idl: + * page/MemoryInfo.cpp: Added. + (WebCore::MemoryInfo::MemoryInfo): + * page/MemoryInfo.h: Added. + (WebCore::MemoryInfo::create): + (WebCore::MemoryInfo::totalJSHeapSize): + (WebCore::MemoryInfo::usedJSHeapSize): + * page/MemoryInfo.idl: Added. + +2010-06-02 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: add test for resource parameters. + + https://bugs.webkit.org/show_bug.cgi?id=40026 + + Test: http/tests/inspector/resource-parameters.html + + * inspector/front-end/HAREntry.js: + (WebInspector.HAREntry.prototype._buildParameters): + * inspector/front-end/Resource.js: + (WebInspector.Resource.prototype._parseParameters): + * inspector/front-end/ResourceView.js: + (WebInspector.ResourceView.prototype._refreshParms): + +2010-06-02 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix make install on Symbian for headers in package builds when INSTALL_HEADERS is not defined + + First we wrote inst_headers.output with $$[QT_INSTALL_HEADERS] and then + overwrote it with the $$INSTALL_HEADERS variant without checking if the + variable was set. + + Fixed and cleaned up the logic of falling back to $$[QT_INSTALL_HEADERS]. + + * WebCore.pro: + +2010-06-02 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + [GTK] Style fixes for the generated code in DOM bindings + https://bugs.webkit.org/show_bug.cgi?id=39949 + + Get rid of extra spaces and wrong indentation in the generated + code. + + * bindings/scripts/CodeGeneratorGObject.pm: + * bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp: + (webkit_dom_test_callback_callback_with_class1param): + (webkit_dom_test_callback_callback_with_class2param): + (webkit_dom_test_callback_callback_with_non_bool_return_type): + (webkit_dom_test_callback_set_property): + (webkit_dom_test_callback_get_property): + * bindings/scripts/test/GObject/WebKitDOMTestCallback.h: + * bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp: + (webkit_dom_test_interface_set_property): + (webkit_dom_test_interface_get_property): + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: + (webkit_dom_test_obj_void_method): + (webkit_dom_test_obj_void_method_with_args): + (webkit_dom_test_obj_int_method): + (webkit_dom_test_obj_int_method_with_args): + (webkit_dom_test_obj_obj_method): + (webkit_dom_test_obj_obj_method_with_args): + (webkit_dom_test_obj_method_that_requires_all_args): + (webkit_dom_test_obj_method_that_requires_all_args_and_throws): + (webkit_dom_test_obj_serialized_value): + (webkit_dom_test_obj_method_with_exception): + (webkit_dom_test_obj_with_dynamic_frame): + (webkit_dom_test_obj_with_dynamic_frame_and_arg): + (webkit_dom_test_obj_with_dynamic_frame_and_optional_arg): + (webkit_dom_test_obj_with_dynamic_frame_and_user_gesture): + (webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad): + (webkit_dom_test_obj_with_script_state_void): + (webkit_dom_test_obj_with_script_state_obj): + (webkit_dom_test_obj_with_script_state_void_exception): + (webkit_dom_test_obj_with_script_state_obj_exception): + (webkit_dom_test_obj_method_with_optional_arg): + (webkit_dom_test_obj_method_with_non_optional_arg_and_optional_arg): + (webkit_dom_test_obj_method_with_non_optional_arg_and_two_optional_args): + (webkit_dom_test_obj_get_read_only_int_attr): + (webkit_dom_test_obj_get_read_only_string_attr): + (webkit_dom_test_obj_get_read_only_test_obj_attr): + (webkit_dom_test_obj_get_int_attr): + (webkit_dom_test_obj_set_int_attr): + (webkit_dom_test_obj_get_long_long_attr): + (webkit_dom_test_obj_set_long_long_attr): + (webkit_dom_test_obj_get_unsigned_long_long_attr): + (webkit_dom_test_obj_set_unsigned_long_long_attr): + (webkit_dom_test_obj_get_string_attr): + (webkit_dom_test_obj_set_string_attr): + (webkit_dom_test_obj_get_test_obj_attr): + (webkit_dom_test_obj_set_test_obj_attr): + (webkit_dom_test_obj_get_attr_with_exception): + (webkit_dom_test_obj_set_attr_with_exception): + (webkit_dom_test_obj_get_attr_with_setter_exception): + (webkit_dom_test_obj_set_attr_with_setter_exception): + (webkit_dom_test_obj_get_attr_with_getter_exception): + (webkit_dom_test_obj_set_attr_with_getter_exception): + (webkit_dom_test_obj_get_script_string_attr): + (webkit_dom_test_obj_set_property): + (webkit_dom_test_obj_get_property): + (webkit_dom_test_obj_class_init): + * bindings/scripts/test/GObject/WebKitDOMTestObj.h: + +2010-06-02 Andrey Kosyakov <caseq@chromium.org> + + Reviewed by Pavel Feldman. + + WebInspector: Added conversion of inspector's resource representation into HAR. + Moved common resource accessors from ResourceView to Resource. + https://bugs.webkit.org/show_bug.cgi?id=30567 + + Test: http/tests/inspector/resource-har-conversion.html + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/front-end/HAREntry.js: Added. + (WebInspector.HAREntry): + (WebInspector.HAREntry.prototype.build): + (WebInspector.HAREntry.prototype._buildRequest): + (WebInspector.HAREntry.prototype._buildResponse): + (WebInspector.HAREntry.prototype._buildContent): + (WebInspector.HAREntry.prototype._buildTimings): + (WebInspector.HAREntry.prototype._buildHeaders): + (WebInspector.HAREntry.prototype._buildPostData): + (WebInspector.HAREntry.prototype._buildParameters): + (WebInspector.HAREntry.prototype._buildParameter): + (WebInspector.HAREntry.prototype._toMilliseconds): + * inspector/front-end/Resource.js: + (WebInspector.Resource): + (WebInspector.Resource.prototype.set url): + (WebInspector.Resource.prototype.get receiveDuration): + (WebInspector.Resource.prototype.requestHeaderValue): + (WebInspector.Resource.prototype.get requestFormData): + (WebInspector.Resource.prototype.set requestFormData): + (WebInspector.Resource.prototype.responseHeaderValue): + (WebInspector.Resource.prototype.get queryParameters): + (WebInspector.Resource.prototype.get formParameters): + (WebInspector.Resource.prototype._parseParameters): + (WebInspector.Resource.prototype._headerValue): + * inspector/front-end/ResourceView.js: + (WebInspector.ResourceView.prototype._refreshQueryString): + (WebInspector.ResourceView.prototype._refreshFormData): + (WebInspector.ResourceView.prototype._refreshParms): + * inspector/front-end/WebKit.qrc: + * inspector/front-end/inspector.html: + +2010-06-02 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r60547. + http://trac.webkit.org/changeset/60547 + https://bugs.webkit.org/show_bug.cgi?id=40051 + + It made fast/overflow/overflow-with-local-background- + attachment.html crash (Requested by Ossy on #webkit). + + * notifications/Notification.h: + (WebCore::Notification::create): + * notifications/NotificationCenter.h: + (WebCore::NotificationCenter::createHTMLNotification): + (WebCore::NotificationCenter::createNotification): + +2010-06-02 Eric Seidel <eric@webkit.org> + + Reviewed by Adam Barth. + + HTML5 parser does not track line numbers + https://bugs.webkit.org/show_bug.cgi?id=39984 + + This adds rudimentary line-number tracking to the HTML5Lexer. + We'll still need to handle \r\n cases eventually, but this + fixes the vast majority of our line-number related failures. + + Fixes 268 layout tests. :) + + * html/HTML5Lexer.cpp: + (WebCore::HTML5Lexer::reset): + - Reset m_lineNumber to 0. + (WebCore::HTML5Lexer::consumeEntity): + - Pass m_lineNumber to advance(). + (WebCore::HTML5Lexer::nextToken): + - Pass m_lineNumber to advance(). + * html/HTML5Lexer.h: + (WebCore::HTML5Lexer::lineNumber): + - Expose m_lineNumber for HTML5Tokenizer. + (WebCore::HTML5Lexer::columnNumber): + - Mirrors the implementation in the old HTMLTokenizer. + we might some day support column number tracking in + the Lexer. It certainly would be possible. + * html/HTML5ScriptRunner.cpp: + (WebCore::HTML5ScriptRunner::HTML5ScriptRunner): + - ASSERT we're passed a host. + (WebCore::HTML5ScriptRunner::sourceFromPendingScript): + - Use PendingScript.startingLineNumber when PendingScript is an inline script. + (WebCore::HTML5ScriptRunner::execute): + - Now expects a start line number passed from the TreeBuilder. + (WebCore::HTML5ScriptRunner::runScript): + - Now expects a start line number. + * html/HTML5ScriptRunner.h: + (WebCore::HTML5ScriptRunner::PendingScript::PendingScript): + - Track startingLineNumber for any inline script. + * html/HTML5Tokenizer.cpp: + (WebCore::HTML5Tokenizer::begin): + - Add a FIXME. The old HTMLTokenizer resets its "lexer" state here. + (WebCore::HTML5Tokenizer::pumpLexer): + - Pass scriptStartLine to the HTML5ScriptRunner + (WebCore::HTML5Tokenizer::lineNumber): + - Implementation for Tokenizer.h + (WebCore::HTML5Tokenizer::columnNumber): + - Implementation for Tokenizer.h + * html/HTML5Tokenizer.h: + * html/HTML5TreeBuilder.cpp: + (WebCore::HTML5TreeBuilder::HTML5TreeBuilder): + - Initialize the new line number tracking variables. + (WebCore::HTML5TreeBuilder::handleScriptEndTag): + - Save off the line number from the start tag to pass to the ScriptRunner. + (WebCore::HTML5TreeBuilder::takeScriptToProcess): + - Return the line number from the start tag. + (WebCore::HTML5TreeBuilder::passTokenToLegacyParser): + - Save off the line number of ever script start tag we see. + * html/HTML5TreeBuilder.h: + - Keep both the line number of the last start tag, and the + line number of the script we know we're expecting our caller to + run before resuming parsing. These are separate to keep the code + clean, especially since the last script start tag line number is + a hack specific to using the old HTMLParser. + +2010-06-02 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by Pavel Feldman. + + Web Inspector: Timeline should nicely format the Timer timeout + https://bugs.webkit.org/show_bug.cgi?id=40040 + + * inspector/front-end/TimelinePanel.js: + (WebInspector.TimelinePanel.FormattedRecord.prototype._generatePopupContent): Format the Timer's timeout time. + +2010-06-02 Vangelis Kokkevis <vangelis@chromium.org> + + Reviewed by Dimitri Glazkov. + + [Chromium] Clamp dirtyRect updates of composited layer contents to the size + of the layer to avoid writing outside texture bounds. + https://bugs.webkit.org/show_bug.cgi?id=40030 + + * platform/graphics/chromium/LayerChromium.cpp: + (WebCore::LayerChromium::updateTextureContents): + +2010-06-02 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Darin Adler. + + Notification object ref counting is not correct. + https://bugs.webkit.org/show_bug.cgi?id=39998 + + Return PassRefPtr<Notification> instead of a raw pointer from the create methods + for Web Notifications. + + No new tests are needed, as existing tests show the problem when sending the + "display" event asynchronously. + + * notifications/Notification.h: + (WebCore::Notification::create): + * notifications/NotificationCenter.h: + (WebCore::NotificationCenter::createHTMLNotification): + (WebCore::NotificationCenter::createNotification): + +2010-06-02 Qi Zhang <qi.2.zhang@nokia.com> + + Reviewed by Dirk Schulze. + + [Qt] Image shadow doesn't work + https://bugs.webkit.org/show_bug.cgi?id=37804 + + Implement the code for image shadow + + * platform/graphics/qt/ImageQt.cpp: + (WebCore::BitmapImage::draw): + +2010-06-02 Vangelis Kokkevis <vangelis@chromium.org> + + Reviewed by Darin Fisher. + + Adding the precision qualifier to fragment shaders used by the GL + compositor in chromium to turn them into valid GLSL ES. + https://bugs.webkit.org/show_bug.cgi?id=40022 + + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::initializeSharedGLObjects): + +2010-06-02 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by David Levin. + + Fix type qualifier is meaningless on cast type in SVGFEColorMatrixElement::build + https://bugs.webkit.org/show_bug.cgi?id=40015 + + No new tests as there is no new functionality. + + Remove const from the cast type. + + * svg/SVGFEColorMatrixElement.cpp: + (WebCore::SVGFEColorMatrixElement::build): + +2010-06-02 Sterling Swigart <sswigart@google.com> + + Reviewed by David Levin. + + Image Resizer Patch 0: Added compilation argument to conditionally compile pending patches. + https://bugs.webkit.org/show_bug.cgi?id=39906 + + * Configurations/FeatureDefines.xcconfig: + * GNUmakefile.am: + * WebCore.pri: + +2010-06-01 Dirk Schulze <krit@webkit.org> + + Reviewed by Nikolas Zimmermann. + + SVG repaintRect should be empty if content got clipped away + https://bugs.webkit.org/show_bug.cgi?id=39965 + + The SVG repaintRect of the renderer was not empty, if the content got clipped away. + The MaskerData/ClipperData <-> RenderObject mapping is set up during the layout phase now, to be able to + relayout a RenderObject, if it's repaintRect is empty. This has the following reason: + We apply the object to the resource on painting at the moment. + With an empty repaintRect, paint() quits earlier and therefore the object doesn't get applied to the resource. + This can cause problems, if the resource get changed by animations or scripts. + On a change, the resource tells all it's callers to relayout. + If the reference to the caller (our RenderObject) is missing, the object won't ever update + and therefore won't get drawn. + We already have LayoutTests that cover this problem. The complete repaintRect calculation + (including the smallest clipping area and shadow size calculation) moved from the renderers to SVGRenderSupport. + This eliminates redundant code. + + * rendering/RenderPath.cpp: + (WebCore::RenderPath::updateCachedBoundaries): + * rendering/RenderSVGContainer.cpp: + (WebCore::RenderSVGContainer::repaintRectInLocalCoordinates): + * rendering/RenderSVGImage.cpp: + (WebCore::RenderSVGImage::repaintRectInLocalCoordinates): + * rendering/RenderSVGResource.h: + * rendering/RenderSVGResourceClipper.cpp: + (WebCore::RenderSVGResourceClipper::resourceBoundingBox): + * rendering/RenderSVGResourceClipper.h: + * rendering/RenderSVGResourceFilter.cpp: + (WebCore::RenderSVGResourceFilter::resourceBoundingBox): + * rendering/RenderSVGResourceFilter.h: + * rendering/RenderSVGResourceGradient.h: + (WebCore::RenderSVGResourceGradient::resourceBoundingBox): + * rendering/RenderSVGResourceMarker.h: + (WebCore::RenderSVGResourceMarker::resourceBoundingBox): + * rendering/RenderSVGResourceMasker.cpp: + (WebCore::RenderSVGResourceMasker::resourceBoundingBox): + * rendering/RenderSVGResourceMasker.h: + * rendering/RenderSVGResourcePattern.h: + (WebCore::RenderSVGResourcePattern::resourceBoundingBox): + * rendering/RenderSVGResourceSolidColor.h: + (WebCore::RenderSVGResourceSolidColor::resourceBoundingBox): + * rendering/RenderSVGText.cpp: + (WebCore::RenderSVGText::strokeBoundingBox): + (WebCore::RenderSVGText::repaintRectInLocalCoordinates): + * rendering/SVGRenderSupport.cpp: + (WebCore::SVGRenderBase::intersectRepaintRectWithResources): + * rendering/SVGRenderSupport.h: + * rendering/SVGRenderTreeAsText.cpp: + (WebCore::writeResources): + * rendering/style/SVGRenderStyle.h: + (WebCore::SVGRenderStyle::hasClipper): + (WebCore::SVGRenderStyle::hasMasker): + (WebCore::SVGRenderStyle::hasFilter): + +2010-06-01 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r60539. + http://trac.webkit.org/changeset/60539 + https://bugs.webkit.org/show_bug.cgi?id=40043 + + Accidentally added an unreviewed and invalid change to the + patch. (Requested by krit on #webkit). + + * rendering/RenderPath.cpp: + (WebCore::RenderPath::updateCachedBoundaries): + * rendering/RenderSVGContainer.cpp: + (WebCore::RenderSVGContainer::repaintRectInLocalCoordinates): + * rendering/RenderSVGImage.cpp: + (WebCore::RenderSVGImage::repaintRectInLocalCoordinates): + * rendering/RenderSVGResource.h: + * rendering/RenderSVGResourceClipper.cpp: + (WebCore::RenderSVGResourceClipper::resourceBoundingBox): + * rendering/RenderSVGResourceClipper.h: + * rendering/RenderSVGResourceFilter.cpp: + (WebCore::RenderSVGResourceFilter::resourceBoundingBox): + * rendering/RenderSVGResourceFilter.h: + * rendering/RenderSVGResourceGradient.h: + (WebCore::RenderSVGResourceGradient::resourceBoundingBox): + * rendering/RenderSVGResourceMarker.h: + (WebCore::RenderSVGResourceMarker::resourceBoundingBox): + * rendering/RenderSVGResourceMasker.cpp: + (WebCore::RenderSVGResourceMasker::resourceBoundingBox): + * rendering/RenderSVGResourceMasker.h: + * rendering/RenderSVGResourcePattern.h: + (WebCore::RenderSVGResourcePattern::resourceBoundingBox): + * rendering/RenderSVGResourceSolidColor.h: + (WebCore::RenderSVGResourceSolidColor::resourceBoundingBox): + * rendering/RenderSVGText.cpp: + (WebCore::RenderSVGText::strokeBoundingBox): + (WebCore::RenderSVGText::repaintRectInLocalCoordinates): + * rendering/SVGRenderSupport.cpp: + (WebCore::SVGRenderBase::filterBoundingBoxForRenderer): + (WebCore::SVGRenderBase::clipperBoundingBoxForRenderer): + (WebCore::SVGRenderBase::maskerBoundingBoxForRenderer): + * rendering/SVGRenderSupport.h: + * rendering/SVGRenderTreeAsText.cpp: + (WebCore::writeResources): + * rendering/style/SVGRenderStyle.h: + * svg/SVGColor.cpp: + (WebCore::SVGColor::colorFromRGBColorString): + +2010-06-01 Dirk Schulze <krit@webkit.org> + + Reviewed by Nikolas Zimmermann. + + SVG repaintRect should be empty if content got clipped away + https://bugs.webkit.org/show_bug.cgi?id=39965 + + The SVG repaintRect of the renderer was not empty, if the content got clipped away. + The MaskerData/ClipperData <-> RenderObject mapping is set up during the layout phase now, to be able to + relayout a RenderObject, if it's repaintRect is empty. This has the following reason: + We apply the object to the resource on painting at the moment. + With an empty repaintRect, paint() quits earlier and therefore the object doesn't get applied to the resource. + This can cause problems, if the resource get changed by animations or scripts. + On a change, the resource tells all it's callers to relayout. + If the reference to the caller (our RenderObject) is missing, the object won't ever update + and therefore won't get drawn. + We already have LayoutTests that cover this problem. The complete repaintRect calculation + (including the smallest clipping area and shadow size calculation) moved from the renderers to SVGRenderSupport. + This eliminates redundant code. + + * rendering/RenderPath.cpp: + (WebCore::RenderPath::updateCachedBoundaries): + * rendering/RenderSVGContainer.cpp: + (WebCore::RenderSVGContainer::repaintRectInLocalCoordinates): + * rendering/RenderSVGImage.cpp: + (WebCore::RenderSVGImage::repaintRectInLocalCoordinates): + * rendering/RenderSVGResource.h: + * rendering/RenderSVGResourceClipper.cpp: + (WebCore::RenderSVGResourceClipper::resourceBoundingBox): + * rendering/RenderSVGResourceClipper.h: + * rendering/RenderSVGResourceFilter.cpp: + (WebCore::RenderSVGResourceFilter::resourceBoundingBox): + * rendering/RenderSVGResourceFilter.h: + * rendering/RenderSVGResourceGradient.h: + (WebCore::RenderSVGResourceGradient::resourceBoundingBox): + * rendering/RenderSVGResourceMarker.h: + (WebCore::RenderSVGResourceMarker::resourceBoundingBox): + * rendering/RenderSVGResourceMasker.cpp: + (WebCore::RenderSVGResourceMasker::resourceBoundingBox): + * rendering/RenderSVGResourceMasker.h: + * rendering/RenderSVGResourcePattern.h: + (WebCore::RenderSVGResourcePattern::resourceBoundingBox): + * rendering/RenderSVGResourceSolidColor.h: + (WebCore::RenderSVGResourceSolidColor::resourceBoundingBox): + * rendering/RenderSVGText.cpp: + (WebCore::RenderSVGText::strokeBoundingBox): + (WebCore::RenderSVGText::repaintRectInLocalCoordinates): + * rendering/SVGRenderSupport.cpp: + (WebCore::SVGRenderBase::intersectRepaintRectWithResources): + * rendering/SVGRenderSupport.h: + * rendering/SVGRenderTreeAsText.cpp: + (WebCore::writeResources): + * rendering/style/SVGRenderStyle.h: + (WebCore::SVGRenderStyle::hasClipper): + (WebCore::SVGRenderStyle::hasMasker): + (WebCore::SVGRenderStyle::hasFilter): + +2010-06-01 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r60530. + http://trac.webkit.org/changeset/60530 + https://bugs.webkit.org/show_bug.cgi?id=40041 + + resource-har-conversion failed on GTK (Requested by abarth on + #webkit). + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/front-end/HAREntry.js: Removed. + * inspector/front-end/Resource.js: + (WebInspector.Resource): + (WebInspector.Resource.prototype.set url): + * inspector/front-end/ResourceView.js: + (WebInspector.ResourceView.prototype._refreshQueryString): + (WebInspector.ResourceView.prototype._refreshFormData): + (WebInspector.ResourceView.prototype._refreshParms): + * inspector/front-end/WebKit.qrc: + * inspector/front-end/inspector.html: + +2010-06-01 No'am Rosenthal <noam.rosenthal@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] GraphicsLayer: warnings when reloading page + https://bugs.webkit.org/show_bug.cgi?id=39694 + + Made sure recaching and masks aren't attempted on zero-size layers. + + No new tests. Old tests (e.g. LayoutTests/compositing/masks) show the problem. + + * platform/graphics/qt/GraphicsLayerQt.cpp: + (WebCore::MaskEffectQt::draw): + (WebCore::GraphicsLayerQtImpl::recache): + +2010-06-01 anton muhin <antonm@google.com> + + Reviewed by Nate Chapin. + + [Chromium] enforce presence of named property query callback if named property enumerator is present + https://bugs.webkit.org/show_bug.cgi?id=40006 + We need to be able to distinguish between enumerable and not enumerable properties + in the presence of named interceptor. V8 is migrating to use query + callback to report enumerable properties and fallback check--- + using getter callback---would report properties as not enumerable. + Thus if there is an enumerator callback, there should be query callback as well. + (see V8's r4751). + + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/v8/V8NPObject.cpp: + (WebCore::npObjectQueryProperty): + (WebCore::createV8ObjectForNPObject): + * bindings/v8/custom/V8StorageCustom.cpp: + (WebCore::V8Storage::namedPropertyQuery): + +2010-06-01 Andrey Kosyakov <caseq@chromium.org> + + Reviewed by Pavel Feldman. + + WebInspector: Added conversion of inspector's resource representation into HAR. + Moved common resource accessors from ResourceView to Resource. + https://bugs.webkit.org/show_bug.cgi?id=30567 + + Test: http/tests/inspector/resource-har-conversion.html + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/front-end/HAREntry.js: Added. + (WebInspector.HAREntry): + (WebInspector.HAREntry.prototype.build): + (WebInspector.HAREntry.prototype._buildRequest): + (WebInspector.HAREntry.prototype._buildResponse): + (WebInspector.HAREntry.prototype._buildContent): + (WebInspector.HAREntry.prototype._buildTimings): + (WebInspector.HAREntry.prototype._buildHeaders): + (WebInspector.HAREntry.prototype._buildPostData): + (WebInspector.HAREntry.prototype._buildParameters): + (WebInspector.HAREntry.prototype._buildParameter): + (WebInspector.HAREntry.prototype._toMilliseconds): + * inspector/front-end/Resource.js: + (WebInspector.Resource): + (WebInspector.Resource.prototype.set url): + (WebInspector.Resource.prototype.get receiveDuration): + (WebInspector.Resource.prototype.requestHeaderValue): + (WebInspector.Resource.prototype.get requestFormData): + (WebInspector.Resource.prototype.set requestFormData): + (WebInspector.Resource.prototype.responseHeaderValue): + (WebInspector.Resource.prototype.get queryParameters): + (WebInspector.Resource.prototype.get formParameters): + (WebInspector.Resource.prototype._parseParameters): + (WebInspector.Resource.prototype._headerValue): + * inspector/front-end/ResourceView.js: + (WebInspector.ResourceView.prototype._refreshQueryString): + (WebInspector.ResourceView.prototype._refreshFormData): + (WebInspector.ResourceView.prototype._refreshParms): + * inspector/front-end/WebKit.qrc: + * inspector/front-end/inspector.html: + +2010-06-01 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + Fix "variable may be used before being set" warning in TextResourceDecoder::checkForHeadCharset + https://bugs.webkit.org/show_bug.cgi?id=40001 + + No new tests as there is no new functionality. + + Initialize len to 0 just to eliminate the compiler warning. + + * loader/TextResourceDecoder.cpp: + (WebCore::TextResourceDecoder::checkForHeadCharset): + +2010-06-01 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Pavel Feldman. + + WebInspector: Safari specific files InspectorFrontendClientLocal were removed from chromium project. + https://bugs.webkit.org/show_bug.cgi?id=39993 + + * WebCore.gypi: + +2010-06-01 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Darin Adler. + + Fix broken code generation in GenerateParametersCheckExpression. + https://bugs.webkit.org/show_bug.cgi?id=39960 + + * bindings/scripts/CodeGeneratorJS.pm: + * bindings/scripts/test/JS/JSTestObj.cpp: Updated baseline. + +2010-06-01 Mark Rowe <mrowe@apple.com> + + Rubber-stamped by Adam Roben. + + Remove Breakpoint.js. It was emptied in r60450 but for some reason it was not + deleted at that time. The presence of empty files within the inspector's resource + folder causes Mac OS X production builds to fail. + + * inspector/front-end/Breakpoint.js: Removed. + +2010-05-24 James Hawkins <jhawkins@chromium.org> + + Reviewed by Darin Fisher. + + Added ability for PopupMenuClient to signal when + * selection changed, and + * selection cleared. + + https://bugs.webkit.org/show_bug.cgi?id=39639 + + No new tests because this functionality is intentionally hidden from + everything other than renderer. + + * platform/PopupMenuClient.h: + * platform/chromium/PopupMenuChromium.cpp: + (WebCore::PopupListBox::selectIndex): + (WebCore::PopupListBox::clearSelection): + * rendering/RenderMenuList.h: + (WebCore::RenderMenuList::RenderMenuList::selectionChanged): + (WebCore::RenderMenuList::RenderMenuList::selectionCleared): + * rendering/RenderTextControlSingleLine.h: + (WebCore::RenderTextControlSingleLine::selectionChanged): + (WebCore::RenderTextControlSingleLine::selectionCleared): + +2010-06-01 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Dimitri Glazkov. + + Check if a database needs to be auto-vacuumed only after transactions that have deleted something. + https://bugs.webkit.org/show_bug.cgi?id=39688 + + * storage/Database.cpp: + (WebCore::Database::resetDeletes): + (WebCore::Database::hadDeletes): + * storage/Database.h: + * storage/DatabaseAuthorizer.cpp: + (WebCore::DatabaseAuthorizer::resetDeletes): + (WebCore::DatabaseAuthorizer::dropTable): + (WebCore::DatabaseAuthorizer::dropTempTable): + (WebCore::DatabaseAuthorizer::dropIndex): + (WebCore::DatabaseAuthorizer::dropTempIndex): + (WebCore::DatabaseAuthorizer::dropTrigger): + (WebCore::DatabaseAuthorizer::dropTempTrigger): + (WebCore::DatabaseAuthorizer::dropView): + (WebCore::DatabaseAuthorizer::dropTempView): + (WebCore::DatabaseAuthorizer::dropVTable): + (WebCore::DatabaseAuthorizer::allowDelete): + (WebCore::DatabaseAuthorizer::updateDeletesBasedOnTableName): Added. + * storage/DatabaseAuthorizer.h: + (WebCore::DatabaseAuthorizer::hadDeletes): + * storage/SQLTransaction.cpp: + (WebCore::SQLTransaction::openTransactionAndPreflight): + (WebCore::SQLTransaction::postflightAndCommit): + +2010-06-01 David Hyatt <hyatt@apple.com> + + Reviewed by Anders Carlsson. + + Add a preference for paginating during layout (the new model for computing page breaks). + + * page/Settings.cpp: + (WebCore::Settings::Settings): + * page/Settings.h: + (WebCore::Settings::setPaginateDuringLayoutEnabled): + (WebCore::Settings::paginateDuringLayoutEnabled): + +2010-06-01 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Adam Barth. + + Clean up the DB classes in preparation for a bigger refactoring. + https://bugs.webkit.org/show_bug.cgi?id=39041 + + * storage/ChangeVersionWrapper.cpp: + * storage/ChangeVersionWrapper.h: + * storage/Database.cpp: + (WebCore::Database::Database): + (WebCore::Database::lastActionChangedDatabase): + (WebCore::Database::lastActionWasInsert): + (WebCore::Database::inProgressTransactionCompleted): + (WebCore::Database::securityOrigin): + * storage/Database.h: + (WebCore::Database::sqliteDatabase): + (WebCore::Database::databaseDebugName): + * storage/DatabaseTask.cpp: + (WebCore::DatabaseTransactionTask::doPerformTask): + * storage/DatabaseTask.h: + * storage/SQLStatement.cpp: + (WebCore::SQLStatement::execute): + * storage/SQLStatement.h: + * storage/SQLTransaction.cpp: + (WebCore::SQLTransaction::SQLTransaction): + (WebCore::SQLTransaction::openTransactionAndPreflight): + (WebCore::SQLTransaction::runStatements): + (WebCore::SQLTransaction::runCurrentStatement): + (WebCore::SQLTransaction::postflightAndCommit): + (WebCore::SQLTransaction::cleanupAfterSuccessCallback): + (WebCore::SQLTransaction::cleanupAfterTransactionErrorCallback): + * storage/SQLTransaction.h: + +2010-06-01 Rob Buis <rwlbuis@gmail.com> + + Reviewed by Nikolas Zimmermann. + + Large SVG rect with shadow fails to render + https://bugs.webkit.org/show_bug.cgi?id=38851 + + Store intermediate shadow calculation in floats to prevent integer overflow. + + Test: svg/filters/shadow-on-rect-large.svg + + * rendering/style/SVGRenderStyle.cpp: + (WebCore::getSVGShadowExtent): + (WebCore::SVGRenderStyle::inflateForShadow): + +2010-06-01 Jer Noble <jer.noble@apple.com> + + Reviewed by Sam Weinig. + + QuickTime 7.6.4 + Safari Nightly = Crash + https://bugs.webkit.org/show_bug.cgi?id=40019 + rdar://problem/8035443 + + Check the return value of QTCFPropertyListCreateXMLData before calling CFDataGetLength(). + + * platform/graphics/win/QTCFDictionary.cpp: + (QTCFDictionaryCreateCopyWithDataCallback): + +2010-06-01 Rob Buis <rwlbuis@gmail.com> + + Reviewed by Dirk Schulze. + + Manipulating SVG element attributes in Javascript does not work as expected + https://bugs.webkit.org/show_bug.cgi?id=34328 + + Reset the viewBox to be empty when removing the viewBox attribute. + + Test: svg/custom/svg-viewBox-dynamic.html + + * svg/SVGFitToViewBox.cpp: + (WebCore::SVGFitToViewBox::parseViewBox): + (WebCore::SVGFitToViewBox::parseMappedAttribute): + * svg/SVGFitToViewBox.h: + * svg/SVGViewSpec.cpp: + (WebCore::SVGViewSpec::setViewBoxString): + (WebCore::SVGViewSpec::parseViewSpec): + +2010-06-01 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Beth Dakin. + + AX: WebKit doesn't call [super -accessibilityAttributeValue:attribute forParameter:] when it encounters a parameterized attribute that it doesn't handle. + https://bugs.webkit.org/show_bug.cgi?id=39324 + + There are some parameters that super handles that are not explicitly returned by the list of the element's attributes. + In those cases, super should handle. + + * accessibility/mac/AccessibilityObjectWrapper.mm: + (-[AccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]): + +2010-05-28 David Hyatt <hyatt@apple.com> + + Reviewed by Beth Dakin. + + https://bugs.webkit.org/show_bug.cgi?id=15550, complete implementation of column-span. Add support for nested column + spans. When a column span is nested inside multiple enclosing blocks, the blocks have to be split around the column-span. + We do this using block element continuations, the same kind of solution we employed for blocks inside inlines. + + The code for block continuations is very similar to the code for inline continuations. It may be possible to refactor the + code into RenderBoxModelObject so that more of it can be shared, but this first pass avoids that so as not to risk + causing any regressions in core rendering. + + Note also that - just as with inline continuations - you can't unsplit block continuations yet. There is no technical limitation + here... the functions just need to be written to handle it. + + Added new tests in fast/multicol/span. + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::styleDidChange): + (WebCore::RenderBlock::continuationBefore): + (WebCore::RenderBlock::addChildToContinuation): + (WebCore::RenderBlock::containingColumnsBlock): + (WebCore::RenderBlock::clone): + (WebCore::RenderBlock::splitBlocks): + (WebCore::RenderBlock::splitFlow): + (WebCore::RenderBlock::splitAnonymousBlocksAroundChild): + (WebCore::RenderBlock::makeChildrenAnonymousColumnBlocks): + (WebCore::RenderBlock::columnsBlockForSpanningElement): + (WebCore::RenderBlock::addChildIgnoringAnonymousColumnBlocks): + (WebCore::RenderBlock::addChild): + (WebCore::RenderBlock::addChildIgnoringContinuation): + (WebCore::RenderBlock::blockElementContinuation): + (WebCore::RenderBlock::layoutColumns): + * rendering/RenderBlock.h: + +2010-06-01 Alexey Proskuryakov <ap@apple.com> + + Build fix. + + Hopefully, touching WebCore.base.exp will actually rebuild the export file. + + * WebCore.Geolocation.exp: + * WebCore.base.exp: + +2010-06-01 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Adam Barth. + + Execute void callbacks in the context they were created in. + https://bugs.webkit.org/show_bug.cgi?id=39145 + + * bindings/v8/custom/V8CustomVoidCallback.cpp: + (WebCore::V8CustomVoidCallback::V8CustomVoidCallback): + (WebCore::V8CustomVoidCallback::handleEvent): + * bindings/v8/custom/V8CustomVoidCallback.h: + +2010-06-01 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=39434 + REGRESSION (r59811): Geolocation callbacks cannot be created + + * DerivedSources.make: Don't append both WebCore.Geolocation.exp and WebCore.ClientBasedGeolocation.exp, + they are mutually exclusive. + + * WebCore.Geolocation.exp: Touched to force .exp file rebuild. + + * WebCore.xcodeproj/project.pbxproj: Removed GeolocationService related files. + + * bindings/js/JSGeolocationCustom.cpp: + (WebCore::createPositionCallback): Functions defined in JavaScript code no longer inherit + from InternalFunction, they inherit from JSFunction. This check is still imperfect, because + it's not clear what definition of "function" should really be used, if any - other bindings + code never checks callback type. + (WebCore::createPositionErrorCallback): Ditto. + + * page/Geolocation.h: Don't include GeolocationService.h unless it's going to be used. + +2010-06-01 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Darin Fisher. + + IndexedDB cleanup + https://bugs.webkit.org/show_bug.cgi?id=40007 + + Remove the exception code parameter since this function can no longer + cause an exception. + + * storage/IDBObjectStoreRequest.idl: + * storage/IndexedDatabase.h: + * storage/IndexedDatabaseImpl.cpp: + (WebCore::IndexedDatabaseImpl::open): + * storage/IndexedDatabaseImpl.h: + * storage/IndexedDatabaseRequest.cpp: + (WebCore::IndexedDatabaseRequest::open): + * storage/IndexedDatabaseRequest.h: + * storage/IndexedDatabaseRequest.idl: + +2010-06-01 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] Double clicks cause three button press events + https://bugs.webkit.org/show_bug.cgi?id=38853 + + Add GOwnPtr wrapper for GdkEvent and expose a setter for + PlatformMouseEvent::m_clickCount. + + * GNUmakefile.am: Add GOwnPtrGtk.{cpp,h} to the sources list. + * platform/PlatformMouseEvent.h: + (WebCore::PlatformMouseEvent::setClickCount): Added. + * platform/gtk/GOwnPtrGtk.cpp: Added. + (WTF::GdkEvent): + * platform/gtk/GOwnPtrGtk.h: Added. + +2010-06-01 Adam Langley <agl@chromium.org> + + Reviewed by Eric Seidel. + + [chromium] respect the user's embedded bitmap settings on Linux. + + We plumbed everything through Skia and Chrome, but forgot to connect + the two wires inside WebCore. + + (Note: no layout test because test_shell forces this option off. Also, + the test font which triggers this behaviour is 32MB.) + + https://bugs.webkit.org/show_bug.cgi?id=39894 + http://code.google.com/p/chromium/issues/detail?id=21149 + + * platform/graphics/chromium/FontPlatformDataLinux.cpp: + (WebCore::FontPlatformData::setupPaint): + +2010-06-01 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Laszlo Gombos. + + [Qt] Fix installation of the QtWebKit module .pri file when building inside of Qt + + * WebCore.pro: + +2010-06-01 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix a QtWebKit.pc corruption problem. + https://bugs.webkit.org/show_bug.cgi?id=36826 + + The problem occurs while installing QtWebKit from trunk + or a source package. + + * WebCore.pro: + +2010-06-01 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Laszlo Gombos. + + [Qt] Fix Symbian package dependencies of apps against QtWebKit when installing into Qt + + Install the versioning qt_webkit_version.pri into $$[QMAKE_MKSPECS]/modules, which is + where mkspecs/features/qt.prf expects it. + + * WebCore.pro: + +2010-06-01 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r60470. + http://trac.webkit.org/changeset/60470 + https://bugs.webkit.org/show_bug.cgi?id=39990 + + Need to rollout until bot can be updated (Requested by jorlow + on #webkit). + + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/v8/ScriptController.cpp: + (WebCore::ScriptController::namedItemAdded): + (WebCore::ScriptController::namedItemRemoved): + * bindings/v8/V8DOMWindowShell.cpp: + (WebCore::V8DOMWindowShell::updateDocumentWrapperCache): + * bindings/v8/V8DOMWindowShell.h: + * bindings/v8/V8DOMWrapper.cpp: + (WebCore::V8DOMWrapper::instantiateV8Object): + * bindings/v8/custom/V8HTMLDocumentCustom.cpp: + (WebCore::V8HTMLDocument::namedPropertyDeleter): + (WebCore::V8HTMLDocument::namedPropertyGetter): + (WebCore::V8HTMLDocument::indexedPropertyGetter): + (WebCore::V8HTMLDocument::allAccessorSetter): + (WebCore::toV8): + +2010-06-01 Anton Muhin <antonm@chromium.org> + + Reviewed by Nate Chapin. + + [Chromium] get rid of named interceptor on HTMLDocument and introduce/remove accessors when named items get deleted/removed + https://bugs.webkit.org/show_bug.cgi?id=39877 + + This patch makes callbacks invoked on named items addition/removal + install API accessors and thus there is no more need in + named and indexed interceptors on HTMLDocument which + speeds up invocation of methods on document. + + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/v8/ScriptController.cpp: + (WebCore::ScriptController::namedItemAdded): + (WebCore::ScriptController::namedItemRemoved): + * bindings/v8/V8DOMWindowShell.cpp: + (WebCore::checkDocumentWrapper): + (WebCore::V8DOMWindowShell::updateDocumentWrapperCache): + (WebCore::getter): + (WebCore::V8DOMWindowShell::namedItemAdded): + (WebCore::V8DOMWindowShell::namedItemRemoved): + * bindings/v8/V8DOMWindowShell.h: + * bindings/v8/V8DOMWrapper.cpp: + (WebCore::V8DOMWrapper::instantiateV8Object): + * bindings/v8/custom/V8HTMLDocumentCustom.cpp: + (WebCore::V8HTMLDocument::WrapInShadowObject): + (WebCore::V8HTMLDocument::GetNamedProperty): + (WebCore::V8HTMLDocument::allAccessorSetter): + (WebCore::toV8): + 2010-06-01 Zoltan Herczeg <zherczeg@webkit.org> Reviewed by Dirk Schulze. diff --git a/WebCore/Configurations/FeatureDefines.xcconfig b/WebCore/Configurations/FeatureDefines.xcconfig index c64d94c..5b52793 100644 --- a/WebCore/Configurations/FeatureDefines.xcconfig +++ b/WebCore/Configurations/FeatureDefines.xcconfig @@ -55,9 +55,11 @@ ENABLE_FILE_READER = ENABLE_FILE_READER; ENABLE_FILE_WRITER = ; ENABLE_GEOLOCATION = ENABLE_GEOLOCATION; ENABLE_ICONDATABASE = ENABLE_ICONDATABASE; +ENABLE_IMAGE_RESIZER = ; ENABLE_INDEXED_DATABASE = ; ENABLE_JAVASCRIPT_DEBUGGER = ENABLE_JAVASCRIPT_DEBUGGER; ENABLE_MATHML = ; +ENABLE_METER_TAG = ENABLE_METER_TAG; ENABLE_NOTIFICATIONS = ; ENABLE_OFFLINE_WEB_APPLICATIONS = ENABLE_OFFLINE_WEB_APPLICATIONS; ENABLE_PROGRESS_TAG = ENABLE_PROGRESS_TAG; @@ -79,4 +81,4 @@ ENABLE_XHTMLMP = ; ENABLE_XPATH = ENABLE_XPATH; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(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_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(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/DerivedSources.cpp b/WebCore/DerivedSources.cpp index ae6b92e..7ac3e51 100644 --- a/WebCore/DerivedSources.cpp +++ b/WebCore/DerivedSources.cpp @@ -175,6 +175,7 @@ #include "JSIDBErrorEvent.cpp" #include "JSIDBEvent.cpp" #include "JSIDBIndexRequest.cpp" +#include "JSIDBKeyRange.cpp" #include "JSIDBObjectStoreRequest.cpp" #include "JSIDBRequest.cpp" #include "JSIDBSuccessEvent.cpp" @@ -185,6 +186,7 @@ #include "JSLocation.cpp" #include "JSMediaError.cpp" #include "JSMediaList.cpp" +#include "JSMemoryInfo.cpp" #include "JSMessageChannel.cpp" #include "JSMessageEvent.cpp" #include "JSMessagePort.cpp" diff --git a/WebCore/DerivedSources.make b/WebCore/DerivedSources.make index 867b002..7ec915f 100644 --- a/WebCore/DerivedSources.make +++ b/WebCore/DerivedSources.make @@ -77,7 +77,7 @@ DOM_CLASSES = \ WebGLBuffer \ Int8Array \ WebGLContextAttributes \ - FloatArray \ + Float32Array \ WebGLFramebuffer \ CanvasGradient \ Int32Array \ @@ -218,6 +218,7 @@ DOM_CLASSES = \ IDBErrorEvent \ IDBEvent \ IDBIndexRequest \ + IDBKeyRange \ IDBObjectStoreRequest \ IDBRequest \ IDBSuccessEvent \ @@ -230,6 +231,7 @@ DOM_CLASSES = \ Location \ MediaError \ MediaList \ + MemoryInfo \ MessageChannel \ MessageEvent \ MessagePort \ @@ -472,10 +474,10 @@ all : \ CSSGrammar.cpp \ CSSPropertyNames.h \ CSSValueKeywords.h \ - ColorData.c \ + ColorData.cpp \ DocTypeStrings.cpp \ HTMLElementFactory.cpp \ - HTMLEntityNames.c \ + HTMLEntityNames.cpp \ HTMLNames.cpp \ WMLElementFactory.cpp \ WMLNames.cpp \ @@ -563,22 +565,22 @@ CSSValueKeywords.h : $(WEBCORE_CSS_VALUE_KEYWORDS) css/makevalues.pl # DOCTYPE strings -DocTypeStrings.cpp : html/DocTypeStrings.gperf - gperf -CEot -L ANSI-C -k "*" -N findDoctypeEntry -F ,PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards $< > $@ +DocTypeStrings.cpp : html/DocTypeStrings.gperf $(WebCore)/make-hash-tools.pl + perl $(WebCore)/make-hash-tools.pl . $(WebCore)/html/DocTypeStrings.gperf # -------- # HTML entity names -HTMLEntityNames.c : html/HTMLEntityNames.gperf - gperf -a -L ANSI-C -C -G -c -o -t -k '*' -N findEntity -D -s 2 $< > $@ +HTMLEntityNames.cpp : html/HTMLEntityNames.gperf $(WebCore)/make-hash-tools.pl + perl $(WebCore)/make-hash-tools.pl . $(WebCore)/html/HTMLEntityNames.gperf # -------- # color names -ColorData.c : platform/ColorData.gperf - gperf -CDEot -L ANSI-C -k '*' -N findColor -D -s 2 $< > $@ +ColorData.cpp : platform/ColorData.gperf $(WebCore)/make-hash-tools.pl + perl $(WebCore)/make-hash-tools.pl . $(WebCore)/platform/ColorData.gperf # -------- @@ -901,14 +903,13 @@ ifeq ($(findstring ENABLE_VIDEO,$(FEATURE_DEFINES)), ENABLE_VIDEO) WEBCORE_EXPORT_DEPENDENCIES := $(WEBCORE_EXPORT_DEPENDENCIES) WebCore.Video.exp endif - +ifeq ($(findstring ENABLE_GEOLOCATION,$(FEATURE_DEFINES)), ENABLE_GEOLOCATION) ifeq ($(findstring ENABLE_CLIENT_BASED_GEOLOCATION,$(FEATURE_DEFINES)), ENABLE_CLIENT_BASED_GEOLOCATION) WEBCORE_EXPORT_DEPENDENCIES := $(WEBCORE_EXPORT_DEPENDENCIES) WebCore.ClientBasedGeolocation.exp -endif - -ifeq ($(findstring ENABLE_GEOLOCATION,$(FEATURE_DEFINES)), ENABLE_GEOLOCATION) +else WEBCORE_EXPORT_DEPENDENCIES := $(WEBCORE_EXPORT_DEPENDENCIES) WebCore.Geolocation.exp endif +endif ifeq ($(shell gcc -E -P -dM $(FRAMEWORK_FLAGS) WebCore/ForwardingHeaders/wtf/Platform.h | grep WTF_USE_PROTECTION_SPACE_AUTH_CALLBACK | cut -d' ' -f3), 1) WEBCORE_EXPORT_DEPENDENCIES := $(WEBCORE_EXPORT_DEPENDENCIES) WebCore.ProtectionSpaceAuthCallback.exp diff --git a/WebCore/English.lproj/localizedStrings.js b/WebCore/English.lproj/localizedStrings.js index e59b66d..743296a 100644 Binary files a/WebCore/English.lproj/localizedStrings.js and b/WebCore/English.lproj/localizedStrings.js differ diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am index fc6b818..47f2057 100644 --- a/WebCore/GNUmakefile.am +++ b/WebCore/GNUmakefile.am @@ -83,7 +83,7 @@ webcoregtk_cppflags += \ webcore_built_nosources += \ DerivedSources/DocTypeStrings.cpp \ DerivedSources/tokenizer.cpp \ - DerivedSources/ColorData.c \ + DerivedSources/ColorData.cpp \ DerivedSources/webkit/webkitdomdummy.c webcore_built_sources += \ @@ -92,7 +92,7 @@ webcore_built_sources += \ DerivedSources/CSSPropertyNames.h \ DerivedSources/CSSValueKeywords.h \ DerivedSources/HTMLElementFactory.cpp \ - DerivedSources/HTMLEntityNames.c \ + DerivedSources/HTMLEntityNames.cpp \ DerivedSources/HTMLNames.cpp \ DerivedSources/JSHTMLElementWrapperFactory.cpp \ DerivedSources/UserAgentStyleSheets.h \ @@ -183,7 +183,7 @@ IDL_BINDINGS += \ WebCore/html/canvas/ArrayBufferView.idl \ WebCore/html/canvas/ArrayBuffer.idl \ WebCore/html/canvas/Int8Array.idl \ - WebCore/html/canvas/FloatArray.idl \ + WebCore/html/canvas/Float32Array.idl \ WebCore/html/canvas/CanvasGradient.idl \ WebCore/html/canvas/Int32Array.idl \ WebCore/html/canvas/CanvasPattern.idl \ @@ -296,6 +296,7 @@ IDL_BINDINGS += \ WebCore/page/Geoposition.idl \ WebCore/page/History.idl \ WebCore/page/Location.idl \ + WebCore/page/MemoryInfo.idl \ WebCore/page/Navigator.idl \ WebCore/page/PositionError.idl \ WebCore/page/Screen.idl \ @@ -511,8 +512,6 @@ webcore_sources += \ WebCore/bindings/js/JSWebKitPointConstructor.h \ WebCore/bindings/js/JSWorkerContextErrorHandler.cpp \ WebCore/bindings/js/JSWorkerContextErrorHandler.h \ - WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp \ - WebCore/bindings/js/JSXMLHttpRequestConstructor.h \ WebCore/bindings/js/JSXMLHttpRequestCustom.cpp \ WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp \ WebCore/bindings/js/JSXSLTProcessorConstructor.cpp \ @@ -640,6 +639,8 @@ webcore_sources += \ WebCore/css/CSSMutableStyleDeclaration.cpp \ WebCore/css/CSSMutableStyleDeclaration.h \ WebCore/css/CSSNamespace.h \ + WebCore/css/CSSOMUtils.cpp \ + WebCore/css/CSSOMUtils.h \ WebCore/css/CSSPageRule.cpp \ WebCore/css/CSSPageRule.h \ WebCore/css/CSSParser.cpp \ @@ -900,7 +901,7 @@ webcore_sources += \ WebCore/dom/Text.h \ WebCore/dom/TextEvent.cpp \ WebCore/dom/TextEvent.h \ - WebCore/dom/Tokenizer.h \ + WebCore/dom/DocumentParser.h \ WebCore/dom/Traversal.cpp \ WebCore/dom/Traversal.h \ WebCore/dom/TreeDepthLimit.h \ @@ -920,11 +921,11 @@ webcore_sources += \ WebCore/dom/WebKitTransitionEvent.h \ WebCore/dom/WheelEvent.cpp \ WebCore/dom/WheelEvent.h \ - WebCore/dom/XMLTokenizer.cpp \ - WebCore/dom/XMLTokenizer.h \ - WebCore/dom/XMLTokenizerLibxml2.cpp \ - WebCore/dom/XMLTokenizerScope.cpp \ - WebCore/dom/XMLTokenizerScope.h \ + WebCore/dom/XMLDocumentParser.cpp \ + WebCore/dom/XMLDocumentParser.h \ + WebCore/dom/XMLDocumentParserLibxml2.cpp \ + WebCore/dom/XMLDocumentParserScope.cpp \ + WebCore/dom/XMLDocumentParserScope.h \ WebCore/dom/default/PlatformMessagePortChannel.cpp \ WebCore/dom/default/PlatformMessagePortChannel.h \ WebCore/editing/AppendNodeCommand.cpp \ @@ -948,6 +949,8 @@ webcore_sources += \ WebCore/editing/EditAction.h \ WebCore/editing/EditCommand.cpp \ WebCore/editing/EditCommand.h \ + WebCore/editing/EditingBehavior.h \ + WebCore/editing/EditingBehaviorTypes.h \ WebCore/editing/Editor.cpp \ WebCore/editing/Editor.h \ WebCore/editing/EditorCommand.cpp \ @@ -1036,6 +1039,8 @@ webcore_sources += \ WebCore/history/HistoryItem.h \ WebCore/history/PageCache.cpp \ WebCore/history/PageCache.h \ + WebCore/html/AsyncImageResizer.cpp \ + WebCore/html/AsyncImageResizer.h \ WebCore/html/Blob.cpp \ WebCore/html/Blob.h \ WebCore/html/canvas/CanvasContextAttributes.h \ @@ -1082,11 +1087,13 @@ webcore_sources += \ WebCore/html/FileThreadTask.h \ WebCore/html/FormDataList.cpp \ WebCore/html/FormDataList.h \ + WebCore/html/HTML5EntityParser.cpp \ + WebCore/html/HTML5EntityParser.h \ WebCore/html/HTML5Lexer.cpp \ WebCore/html/HTML5Lexer.h \ WebCore/html/HTML5Token.h \ - WebCore/html/HTML5Tokenizer.cpp \ - WebCore/html/HTML5Tokenizer.h \ + WebCore/html/HTML5DocumentParser.cpp \ + WebCore/html/HTML5DocumentParser.h \ WebCore/html/HTML5TreeBuilder.cpp \ WebCore/html/HTML5TreeBuilder.h \ WebCore/html/HTML5ScriptRunner.cpp \ @@ -1212,8 +1219,8 @@ webcore_sources += \ WebCore/html/HTMLParagraphElement.h \ WebCore/html/HTMLParamElement.cpp \ WebCore/html/HTMLParamElement.h \ - WebCore/html/HTMLParser.cpp \ - WebCore/html/HTMLParser.h \ + WebCore/html/LegacyHTMLTreeConstructor.cpp \ + WebCore/html/LegacyHTMLTreeConstructor.h \ WebCore/html/HTMLParserErrorCodes.cpp \ WebCore/html/HTMLParserErrorCodes.h \ WebCore/html/HTMLParserQuirks.h \ @@ -1253,14 +1260,16 @@ webcore_sources += \ WebCore/html/HTMLTextAreaElement.h \ WebCore/html/HTMLTitleElement.cpp \ WebCore/html/HTMLTitleElement.h \ - WebCore/html/HTMLTokenizer.cpp \ - WebCore/html/HTMLTokenizer.h \ + WebCore/html/HTMLDocumentParser.cpp \ + WebCore/html/HTMLDocumentParser.h \ WebCore/html/HTMLUListElement.cpp \ WebCore/html/HTMLUListElement.h \ WebCore/html/HTMLViewSourceDocument.cpp \ WebCore/html/HTMLViewSourceDocument.h \ WebCore/html/ImageData.cpp \ WebCore/html/ImageData.h \ + WebCore/html/ImageResizerThread.cpp \ + WebCore/html/ImageResizerThread.h \ WebCore/html/LabelsNodeList.cpp \ WebCore/html/LabelsNodeList.h \ WebCore/html/MediaError.h \ @@ -1496,6 +1505,8 @@ webcore_sources += \ WebCore/page/Location.cpp \ WebCore/page/Location.h \ WebCore/page/MediaCanStartListener.h \ + WebCore/page/MemoryInfo.cpp \ + WebCore/page/MemoryInfo.h \ WebCore/page/MouseEventWithHitTestResults.cpp \ WebCore/page/MouseEventWithHitTestResults.h \ WebCore/page/Navigator.cpp \ @@ -1556,6 +1567,8 @@ webcore_sources += \ WebCore/platform/Arena.cpp \ WebCore/platform/Arena.h \ WebCore/platform/AutodrainedPool.h \ + WebCore/platform/BlobItem.cpp \ + WebCore/platform/BlobItem.h \ WebCore/platform/ContentType.cpp \ WebCore/platform/ContentType.h \ WebCore/platform/ContextMenu.cpp \ @@ -1565,6 +1578,7 @@ webcore_sources += \ WebCore/platform/CookieJar.h \ WebCore/platform/CrossThreadCopier.cpp \ WebCore/platform/CrossThreadCopier.h \ + WebCore/platform/Cursor.cpp \ WebCore/platform/Cursor.h \ WebCore/platform/DeprecatedPtrList.h \ WebCore/platform/DeprecatedPtrListImpl.cpp \ @@ -2005,6 +2019,8 @@ webcore_sources += \ WebCore/rendering/RootInlineBox.h \ WebCore/rendering/ScrollBehavior.cpp \ WebCore/rendering/ScrollBehavior.h \ + WebCore/rendering/ShadowElement.cpp \ + WebCore/rendering/ShadowElement.h \ WebCore/rendering/TableLayout.h \ WebCore/rendering/TextControlInnerElements.cpp \ WebCore/rendering/TextControlInnerElements.h \ @@ -2114,6 +2130,8 @@ webcoregtk_sources += \ WebCore/platform/graphics/cairo/GradientCairo.cpp \ WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp \ WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h \ + WebCore/platform/graphics/cairo/GOwnPtrCairo.cpp \ + WebCore/platform/graphics/cairo/GOwnPtrCairo.h \ WebCore/platform/graphics/cairo/ImageBufferCairo.cpp \ WebCore/platform/graphics/cairo/ImageBufferData.h \ WebCore/platform/graphics/cairo/ImageCairo.cpp \ @@ -2144,6 +2162,8 @@ webcoregtk_sources += \ WebCore/platform/gtk/EventLoopGtk.cpp \ WebCore/platform/gtk/FileChooserGtk.cpp \ WebCore/platform/gtk/FileSystemGtk.cpp \ + WebCore/platform/gtk/GOwnPtrGtk.cpp \ + WebCore/platform/gtk/GOwnPtrGtk.h \ WebCore/platform/gtk/GRefPtrGtk.cpp \ WebCore/platform/gtk/GRefPtrGtk.h \ WebCore/platform/gtk/GtkPluginWidget.cpp \ @@ -2480,6 +2500,7 @@ IDL_BINDINGS += \ WebCore/storage/IDBErrorEvent.idl \ WebCore/storage/IDBEvent.idl \ WebCore/storage/IDBIndexRequest.idl \ + WebCore/storage/IDBKeyRange.idl \ WebCore/storage/IDBObjectStoreRequest.idl \ WebCore/storage/IDBRequest.idl \ WebCore/storage/IDBSuccessEvent.idl \ @@ -2508,8 +2529,11 @@ webcore_sources += \ WebCore/storage/IDBIndexImpl.h \ WebCore/storage/IDBIndexRequest.cpp \ WebCore/storage/IDBIndexRequest.h \ - WebCore/storage/IDBObjectStore.cpp \ + WebCore/storage/IDBKeyRange.cpp \ + WebCore/storage/IDBKeyRange.h \ WebCore/storage/IDBObjectStore.h \ + WebCore/storage/IDBObjectStoreImpl.cpp \ + WebCore/storage/IDBObjectStoreImpl.h \ WebCore/storage/IDBObjectStoreRequest.cpp \ WebCore/storage/IDBObjectStoreRequest.h \ WebCore/storage/IDBRequest.cpp \ @@ -2588,6 +2612,19 @@ webcore_cppflags += -DENABLE_ICONDATABASE=0 endif # END ENABLE_ICONDATABASE # ---- +# Image Resizer Support +# ---- +if ENABLE_IMAGE_RESIZER +FEATURE_DEFINES += ENABLE_IMAGE_RESIZER=1 + +webcore_cppflags += -DENABLE_IMAGE_RESIZER=1 + +else +webcore_cppflags += -DENABLE_IMAGE_RESIZER=0 + +endif # END ENABLE_IMAGE_RESIZER + +# ---- # Orientation Events # ---- if ENABLE_ORIENTATION_EVENTS @@ -2992,8 +3029,12 @@ webcore_sources += \ WebCore/mathml/RenderMathMLMath.h \ WebCore/mathml/RenderMathMLOperator.cpp \ WebCore/mathml/RenderMathMLOperator.h \ + WebCore/mathml/RenderMathMLRoot.cpp \ + WebCore/mathml/RenderMathMLRoot.h \ WebCore/mathml/RenderMathMLRow.cpp \ WebCore/mathml/RenderMathMLRow.h \ + WebCore/mathml/RenderMathMLSquareRoot.cpp \ + WebCore/mathml/RenderMathMLSquareRoot.h \ WebCore/mathml/RenderMathMLSubSup.cpp \ WebCore/mathml/RenderMathMLSubSup.h \ WebCore/mathml/RenderMathMLUnderOver.cpp \ @@ -3766,17 +3807,16 @@ DerivedSources/CSSValueKeywords.h : $(WEBCORE_CSS_VALUE_KEYWORDS) $(WebCore)/css mv CSSValueKeywords.* $(GENSOURCES) # DOCTYPE strings -DerivedSources/DocTypeStrings.cpp : $(WebCore)/html/DocTypeStrings.gperf - $(AM_V_GEN)$(GPERF) -CEot -I -L ANSI-C -k "*" -N findDoctypeEntry -F ,PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards $(WebCore)/html/DocTypeStrings.gperf > $@ +DerivedSources/DocTypeStrings.cpp : $(WebCore)/html/DocTypeStrings.gperf $(WebCore)/make-hash-tools.pl + $(PERL) $(WebCore)/make-hash-tools.pl $(GENSOURCES) $(WebCore)/html/DocTypeStrings.gperf # HTML entity names -DerivedSources/HTMLEntityNames.c : $(WebCore)/html/HTMLEntityNames.gperf - $(AM_V_GEN)$(GPERF) -a -I -L ANSI-C -C -G -c -o -t -k '*' -N findEntity -D -s 2 \ - $(WebCore)/html/HTMLEntityNames.gperf > $@ +DerivedSources/HTMLEntityNames.cpp : $(WebCore)/html/HTMLEntityNames.gperf $(WebCore)/make-hash-tools.pl + $(PERL) $(WebCore)/make-hash-tools.pl $(GENSOURCES) $(WebCore)/html/HTMLEntityNames.gperf # color names -DerivedSources/ColorData.c: $(WebCore)/platform/ColorData.gperf - $(AM_V_GEN)$(GPERF) -CDEot -L ANSI-C -k '*' -N findColor -D -s 2 $< > $@ +DerivedSources/ColorData.cpp: $(WebCore)/platform/ColorData.gperf $(WebCore)/make-hash-tools.pl + $(PERL) $(WebCore)/make-hash-tools.pl $(GENSOURCES) $(WebCore)/platform/ColorData.gperf # CSS tokenizer DerivedSources/tokenizer.cpp : $(WebCore)/css/tokenizer.flex $(WebCore)/css/maketokenizer @@ -4027,6 +4067,7 @@ IDL_BINDINGS_GDOM += \ WebCore/page/Geolocation.idl \ WebCore/page/History.idl \ WebCore/page/Location.idl \ + WebCore/page/MemoryInfo.idl \ WebCore/page/Navigator.idl \ WebCore/page/Screen.idl \ WebCore/page/WebKitPoint.idl \ diff --git a/WebCore/WebCore.base.exp b/WebCore/WebCore.base.exp index c799b84..29704fb 100644 --- a/WebCore/WebCore.base.exp +++ b/WebCore/WebCore.base.exp @@ -1055,3 +1055,4 @@ _wkSetUpFontCache _wkSignalCFReadStreamEnd _wkSignalCFReadStreamError _wkSignalCFReadStreamHasBytes + diff --git a/WebCore/WebCore.gyp/WebCore.gyp b/WebCore/WebCore.gyp/WebCore.gyp index 1042bd4..16f19d9 100644 --- a/WebCore/WebCore.gyp/WebCore.gyp +++ b/WebCore/WebCore.gyp/WebCore.gyp @@ -314,7 +314,7 @@ '../css/CSSValueKeywords.in', ], 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/webkit/CSSValueKeywords.c', + '<(SHARED_INTERMEDIATE_DIR)/webkit/CSSValueKeywords.cpp', '<(SHARED_INTERMEDIATE_DIR)/webkit/CSSValueKeywords.h', ], 'action': [ @@ -531,24 +531,20 @@ { 'rule_name': 'gperf', 'extension': 'gperf', - # gperf output is only ever #included by other source files. As - # such, process_outputs_as_sources is off. Some gperf output is - # #included as *.c and some as *.cpp. Since there's no way to tell - # which one will be needed in a rule definition, declare both as - # outputs. The harness script will generate one file and copy it to - # the other. # - # This rule places outputs in SHARED_INTERMEDIATE_DIR because glue - # needs access to HTMLEntityNames.c. + # gperf outputs are generated by WebCore/make-hash-tools.pl + # 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/webkit/<(RULE_INPUT_ROOT).c', '<(SHARED_INTERMEDIATE_DIR)/webkit/<(RULE_INPUT_ROOT).cpp', ], + 'dependencies': [ + '../make-hash-tools.pl', + ], 'action': [ - 'python', - 'scripts/rule_gperf.py', + 'perl', + '../make-hash-tools.pl', + '<(SHARED_INTERMEDIATE_DIR)/webkit', '<(RULE_INPUT_PATH)', - '<(SHARED_INTERMEDIATE_DIR)/webkit' ], 'process_outputs_as_sources': 0, }, diff --git a/WebCore/WebCore.gyp/scripts/rule_gperf.py b/WebCore/WebCore.gyp/scripts/rule_gperf.py deleted file mode 100644 index e76ed6f..0000000 --- a/WebCore/WebCore.gyp/scripts/rule_gperf.py +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/python -# -# 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. -# -# Copyright (c) 2009 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# usage: rule_gperf.py INPUT_FILE OUTPUT_DIR -# INPUT_FILE is a path to DocTypeStrings.gperf, HTMLEntityNames.gperf, or -# ColorData.gperf. -# OUTPUT_DIR is where the gperf-generated .cpp file should be placed. Because -# some users want a .c file instead of a .cpp file, the .cpp file is copied -# to .c when done. - -import posixpath -import shutil -import subprocess -import sys - -assert len(sys.argv) == 3 - -inputFile = sys.argv[1] -outputDir = sys.argv[2] - -gperfCommands = { - 'DocTypeStrings.gperf': [ - '-CEot', '-L', 'ANSI-C', '-k*', '-N', 'findDoctypeEntry', - '-F', ',PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards' - ], - 'HTMLEntityNames.gperf': [ - '-a', '-L', 'ANSI-C', '-C', '-G', '-c', '-o', '-t', '-k*', - '-N', 'findEntity', '-D', '-s', '2' - ], - 'ColorData.gperf': [ - '-CDEot', '-L', 'ANSI-C', '-k*', '-N', 'findColor', '-D', '-s', '2' - ], -} - -inputName = posixpath.basename(inputFile) -assert inputName in gperfCommands - -(inputRoot, inputExt) = posixpath.splitext(inputName) -outputCpp = posixpath.join(outputDir, inputRoot + '.cpp') - -#command = ['gperf', '--output-file', outputCpp] -command = ['gperf'] -command.extend(gperfCommands[inputName]) -command.append(inputFile) - -ofile = open(outputCpp, 'w') - -# Do it. check_call is new in 2.5, so simulate its behavior with call and -# assert. -returnCode = subprocess.call(command, stdout=ofile.fileno()) -assert returnCode == 0 - -outputC = posixpath.join(outputDir, inputRoot + '.c') -shutil.copyfile(outputCpp, outputC) diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi index c66a32b..f03613a 100644 --- a/WebCore/WebCore.gypi +++ b/WebCore/WebCore.gypi @@ -89,7 +89,7 @@ 'html/canvas/WebGLBuffer.idl', 'html/canvas/Int8Array.idl', 'html/canvas/WebGLContextAttributes.idl', - 'html/canvas/FloatArray.idl', + 'html/canvas/Float32Array.idl', 'html/canvas/WebGLFramebuffer.idl', 'html/canvas/CanvasGradient.idl', 'html/canvas/Int32Array.idl', @@ -212,6 +212,7 @@ 'page/Geoposition.idl', 'page/History.idl', 'page/Location.idl', + 'page/MemoryInfo.idl', 'page/Navigator.idl', 'page/PositionError.idl', 'page/Screen.idl', @@ -231,6 +232,7 @@ 'storage/IDBErrorEvent.idl', 'storage/IDBEvent.idl', 'storage/IDBIndexRequest.idl', + 'storage/IDBKeyRange.idl', 'storage/IDBObjectStoreRequest.idl', 'storage/IDBRequest.idl', 'storage/IDBSuccessEvent.idl', @@ -649,8 +651,6 @@ 'bindings/js/JSWorkerContextErrorHandler.cpp', 'bindings/js/JSWorkerContextErrorHandler.h', 'bindings/js/JSWorkerCustom.cpp', - 'bindings/js/JSXMLHttpRequestConstructor.cpp', - 'bindings/js/JSXMLHttpRequestConstructor.h', 'bindings/js/JSXMLHttpRequestCustom.cpp', 'bindings/js/JSXMLHttpRequestUploadCustom.cpp', 'bindings/js/JSXSLTProcessorConstructor.cpp', @@ -703,7 +703,7 @@ 'bindings/v8/custom/V8ArrayBufferCustom.cpp', 'bindings/v8/custom/V8Int8ArrayCustom.cpp', 'bindings/v8/custom/V8Int32ArrayCustom.cpp', - 'bindings/v8/custom/V8FloatArrayCustom.cpp', + 'bindings/v8/custom/V8Float32ArrayCustom.cpp', 'bindings/v8/custom/V8Int16ArrayCustom.cpp', 'bindings/v8/custom/V8Uint8ArrayCustom.cpp', 'bindings/v8/custom/V8Uint32ArrayCustom.cpp', @@ -964,6 +964,8 @@ 'css/CSSMutableStyleDeclaration.cpp', 'css/CSSMutableStyleDeclaration.h', 'css/CSSNamespace.h', + 'css/CSSOMUtils.cpp', + 'css/CSSOMUtils.h', 'css/CSSPageRule.cpp', 'css/CSSPageRule.h', 'css/CSSParser.cpp', @@ -1236,7 +1238,7 @@ 'dom/TouchEvent.cpp', 'dom/TouchList.cpp', 'dom/TouchList.h', - 'dom/Tokenizer.h', + 'dom/DocumentParser.h', 'dom/TransformSourceLibxslt.cpp', 'dom/TransformSource.h', 'dom/Traversal.cpp', @@ -1258,12 +1260,12 @@ 'dom/WebKitTransitionEvent.h', 'dom/WheelEvent.cpp', 'dom/WheelEvent.h', - 'dom/XMLTokenizer.cpp', - 'dom/XMLTokenizer.h', - 'dom/XMLTokenizerLibxml2.cpp', - 'dom/XMLTokenizerScope.cpp', - 'dom/XMLTokenizerScope.h', - 'dom/XMLTokenizerQt.cpp', + 'dom/XMLDocumentParser.cpp', + 'dom/XMLDocumentParser.h', + 'dom/XMLDocumentParserLibxml2.cpp', + 'dom/XMLDocumentParserScope.cpp', + 'dom/XMLDocumentParserScope.h', + 'dom/XMLDocumentParserQt.cpp', 'editing/android/EditorAndroid.cpp', 'editing/chromium/EditorChromium.cpp', 'editing/mac/EditorMac.mm', @@ -1291,6 +1293,8 @@ 'editing/EditAction.h', 'editing/EditCommand.cpp', 'editing/EditCommand.h', + 'editing/EditingBehavior.h', + 'editing/EditingBehaviorTypes.h', 'editing/Editor.cpp', 'editing/Editor.h', 'editing/EditorCommand.cpp', @@ -1381,6 +1385,8 @@ 'history/HistoryItem.h', 'history/PageCache.cpp', 'history/PageCache.h', + 'html/AsyncImageResizer.cpp', + 'html/AsyncImageResizer.h', 'html/Blob.cpp', 'html/Blob.h', 'html/canvas/ArrayBufferView.cpp', @@ -1393,8 +1399,8 @@ 'html/canvas/Int8Array.h', 'html/canvas/WebGLContextAttributes.cpp', 'html/canvas/WebGLContextAttributes.h', - 'html/canvas/FloatArray.cpp', - 'html/canvas/FloatArray.h', + 'html/canvas/Float32Array.cpp', + 'html/canvas/Float32Array.h', 'html/canvas/WebGLFramebuffer.cpp', 'html/canvas/WebGLFramebuffer.h', 'html/canvas/WebGLGetInfo.cpp', @@ -1469,10 +1475,12 @@ 'html/FileThreadTask.h', 'html/FormDataList.cpp', 'html/FormDataList.h', + 'html/HTML5EntityParser.cpp', + 'html/HTML5EntityParser.h', 'html/HTML5Lexer.cpp', 'html/HTML5Lexer.h', - 'html/HTML5Tokenizer.cpp', - 'html/HTML5Tokenizer.h', + 'html/HTML5DocumentParser.cpp', + 'html/HTML5DocumentParser.h', 'html/HTML5TreeBuilder.cpp', 'html/HTML5TreeBuilder.h', 'html/HTML5ScriptRunner.cpp', @@ -1601,8 +1609,8 @@ 'html/HTMLParagraphElement.h', 'html/HTMLParamElement.cpp', 'html/HTMLParamElement.h', - 'html/HTMLParser.cpp', - 'html/HTMLParser.h', + 'html/LegacyHTMLTreeConstructor.cpp', + 'html/LegacyHTMLTreeConstructor.h', 'html/HTMLParserErrorCodes.cpp', 'html/HTMLParserErrorCodes.h', 'html/HTMLPlugInElement.cpp', @@ -1643,8 +1651,8 @@ 'html/HTMLTextAreaElement.h', 'html/HTMLTitleElement.cpp', 'html/HTMLTitleElement.h', - 'html/HTMLTokenizer.cpp', - 'html/HTMLTokenizer.h', + 'html/HTMLDocumentParser.cpp', + 'html/HTMLDocumentParser.h', 'html/HTMLUListElement.cpp', 'html/HTMLUListElement.h', 'html/HTMLVideoElement.cpp', @@ -1653,6 +1661,8 @@ 'html/HTMLViewSourceDocument.h', 'html/ImageData.cpp', 'html/ImageData.h', + 'html/ImageResizerThread.cpp', + 'html/ImageResizerThread.h', 'html/LabelsNodeList.cpp', 'html/LabelsNodeList.h', 'html/MediaError.h', @@ -1688,8 +1698,6 @@ 'inspector/InspectorFrontend.cpp', 'inspector/InspectorFrontend.h', 'inspector/InspectorFrontendClient.h', - 'inspector/InspectorFrontendClientLocal.cpp', - 'inspector/InspectorFrontendClientLocal.h', 'inspector/InspectorFrontendHost.cpp', 'inspector/InspectorFrontendHost.h', 'inspector/InspectorResource.cpp', @@ -1941,6 +1949,8 @@ 'page/History.h', 'page/Location.cpp', 'page/Location.h', + 'page/MemoryInfo.cpp', + 'page/MemoryInfo.h', 'page/MouseEventWithHitTestResults.cpp', 'page/MouseEventWithHitTestResults.h', 'page/Navigator.cpp', @@ -2879,6 +2889,8 @@ 'platform/Arena.cpp', 'platform/Arena.h', 'platform/AutodrainedPool.h', + 'platform/BlobItem.cpp', + 'platform/BlobItem.h', 'platform/ContentType.cpp', 'platform/ContentType.h', 'platform/ContextMenu.cpp', @@ -2980,7 +2992,7 @@ 'plugins/gtk/xembed.h', 'plugins/mac/PluginDataMac.mm', 'plugins/mac/PluginPackageMac.cpp', - 'plugins/mac/PluginViewMac.cpp', + 'plugins/mac/PluginViewMac.mm', 'plugins/qt/PluginDataQt.cpp', 'plugins/qt/PluginPackageQt.cpp', 'plugins/qt/PluginViewQt.cpp', @@ -3304,6 +3316,8 @@ 'rendering/RootInlineBox.h', 'rendering/ScrollBehavior.cpp', 'rendering/ScrollBehavior.h', + 'rendering/ShadowElement.cpp', + 'rendering/ShadowElement.h', 'rendering/SVGCharacterData.cpp', 'rendering/SVGCharacterData.h', 'rendering/SVGCharacterLayoutInfo.cpp', @@ -3377,8 +3391,11 @@ 'storage/IDBIndexImpl.h', 'storage/IDBIndexRequest.cpp', 'storage/IDBIndexRequest.h', - 'storage/IDBObjectStore.cpp', + 'storage/IDBKeyRange.cpp', + 'storage/IDBKeyRange.h', 'storage/IDBObjectStore.h', + 'storage/IDBObjectStoreImpl.cpp', + 'storage/IDBObjectStoreImpl.h', 'storage/IDBObjectStoreRequest.cpp', 'storage/IDBObjectStoreRequest.h', 'storage/IDBRequest.cpp', @@ -3884,6 +3901,7 @@ 'inspector/front-end/ConsoleView.js', 'inspector/front-end/ContextMenu.js', 'inspector/front-end/CookieItemsView.js', + 'inspector/front-end/CSSStyleModel.js', 'inspector/front-end/Database.js', 'inspector/front-end/DatabaseQueryView.js', 'inspector/front-end/DatabaseTableView.js', @@ -3897,6 +3915,7 @@ 'inspector/front-end/ElementsTreeOutline.js', 'inspector/front-end/EventListenersSidebarPane.js', 'inspector/front-end/FontView.js', + 'inspector/front-end/HAREntry.js', 'inspector/front-end/HelpScreen.js', 'inspector/front-end/ImageView.js', 'inspector/front-end/InspectorBackendStub.js', diff --git a/WebCore/WebCore.pri b/WebCore/WebCore.pri index 9b873fe..f4abc27 100644 --- a/WebCore/WebCore.pri +++ b/WebCore/WebCore.pri @@ -8,6 +8,9 @@ CONFIG(minimal) { DEFINES += ENABLE_NETSCAPE_PLUGIN_API=0 } +## load mobilityconfig if mobility is available +load(mobilityconfig, true) + ## Define default features macros for optional components ## (look for defs in config.h and included files!) # Try to locate sqlite3 source @@ -62,6 +65,7 @@ contains(DEFINES, ENABLE_SINGLE_THREADED=1) { !contains(DEFINES, ENABLE_PROGRESS_TAG=.): DEFINES += ENABLE_PROGRESS_TAG=1 !contains(DEFINES, ENABLE_BLOB_SLICE=.): DEFINES += ENABLE_BLOB_SLICE=0 !contains(DEFINES, ENABLE_NOTIFICATIONS=.): DEFINES += ENABLE_NOTIFICATIONS=1 +!contains(DEFINES, ENABLE_IMAGE_RESIZER=.): DEFINES += ENABLE_IMAGE_RESIZER=0 greaterThan(QT_MINOR_VERSION, 5) { !contains(DEFINES, ENABLE_3D_RENDERING=.): DEFINES += ENABLE_3D_RENDERING=1 @@ -108,17 +112,24 @@ greaterThan(QT_MINOR_VERSION, 5) { else:DEFINES += ENABLE_XSLT=0 } -!CONFIG(QTDIR_build):!contains(DEFINES, ENABLE_QT_BEARER=.) { - symbian: { - exists($${EPOCROOT}epoc32/release/winscw/udeb/QtBearer.lib)| \ - exists($${EPOCROOT}epoc32/release/armv5/lib/QtBearer.lib) { - DEFINES += ENABLE_QT_BEARER=1 - } +# geolocation support if QtMobility exists +!CONFIG(QTDIR_build):!contains(DEFINES, ENABLE_GEOLOCATION=.) { + contains(MOBILITY_CONFIG, location) { + DEFINES += ENABLE_GEOLOCATION=1 } } # Bearer management is part of Qt 4.7 -!lessThan(QT_MINOR_VERSION, 7):!contains(DEFINES, ENABLE_QT_BEARER=.):DEFINES += ENABLE_QT_BEARER=1 +# for older version, check for mobility with bearer +!contains(DEFINES, ENABLE_QT_BEARER=.) { + !lessThan(QT_MINOR_VERSION, 7) { + DEFINES += ENABLE_QT_BEARER=1 + } else { + contains(MOBILITY_CONFIG, bearer) { + DEFINES += ENABLE_QT_BEARER=1 + } + } +} # Enable touch event support with Qt 4.6 !lessThan(QT_MINOR_VERSION, 6): DEFINES += ENABLE_TOUCH_EVENTS=1 @@ -166,7 +177,7 @@ contains(DEFINES, ENABLE_TILED_BACKING_STORE=1): FEATURE_DEFINES_JAVASCRIPT += E contains(DEFINES, ENABLE_NOTIFICATIONS=1): FEATURE_DEFINES_JAVASCRIPT += ENABLE_NOTIFICATIONS=1 contains(DEFINES, ENABLE_METER_TAG=1): FEATURE_DEFINES_JAVASCRIPT += ENABLE_METER_TAG=1 contains(DEFINES, ENABLE_PROGRESS_TAG=1): FEATURE_DEFINES_JAVASCRIPT += ENABLE_PROGRESS_TAG=1 - +contains(DEFINES, ENABLE_GEOLOCATION=1): FEATURE_DEFINES_JAVASCRIPT += ENABLE_GEOLOCATION=1 ## Derived source generators MATHML_NAMES = $$PWD/mathml/mathtags.in @@ -179,7 +190,7 @@ XLINK_NAMES = $$PWD/svg/xlinkattrs.in TOKENIZER = $$PWD/css/tokenizer.flex -DOCTYPESTRINGS = $$PWD/html/DocTypeStrings.gperf +DOCTYPESTRINGS_GPERF = $$PWD/html/DocTypeStrings.gperf CSSBISON = $$PWD/css/CSSGrammar.y @@ -191,7 +202,7 @@ XMLNS_NAMES = $$PWD/xml/xmlnsattrs.in ENTITIES_GPERF = $$PWD/html/HTMLEntityNames.gperf -COLORDAT_GPERF = $$PWD/platform/ColorData.gperf +COLORDATA_GPERF = $$PWD/platform/ColorData.gperf WALDOCSSPROPS = $$PWD/css/CSSPropertyNames.in @@ -308,7 +319,7 @@ IDL_BINDINGS += \ html/canvas/ArrayBufferView.idl \ html/canvas/ArrayBuffer.idl \ html/canvas/Int8Array.idl \ - html/canvas/FloatArray.idl \ + html/canvas/Float32Array.idl \ html/canvas/CanvasGradient.idl \ html/canvas/Int32Array.idl \ html/canvas/CanvasPattern.idl \ @@ -432,6 +443,7 @@ IDL_BINDINGS += \ page/Geoposition.idl \ page/History.idl \ page/Location.idl \ + page/MemoryInfo.idl \ page/Navigator.idl \ page/PositionError.idl \ page/Screen.idl \ @@ -451,6 +463,7 @@ IDL_BINDINGS += \ storage/IDBErrorEvent.idl \ storage/IDBEvent.idl \ storage/IDBIndexRequest.idl \ + storage/IDBKeyRange.idl \ storage/IDBObjectStoreRequest.idl \ storage/IDBRequest.idl \ storage/IDBSuccessEvent.idl \ @@ -644,6 +657,7 @@ contains(DEFINES, ENABLE_SVG=1) { # GENERATOR 5-C: svgnames.output = $${WC_GENERATED_SOURCES_DIR}/SVGNames.cpp svgnames.input = SVG_NAMES + svgnames.depends = $$PWD/svg/svgattrs.in svgnames.wkScript = $$PWD/dom/make_names.pl svgnames.commands = perl -I$$PWD/bindings/scripts $$svgnames.wkScript --tags $$PWD/svg/svgtags.in --attrs $$PWD/svg/svgattrs.in --extraDefines \"$${DEFINES}\" --preprocessor \"$${QMAKE_MOC} -E\" --factory --wrapperFactory --outputDir $$WC_GENERATED_SOURCES_DIR svgnames.wkExtraSources = $${WC_GENERATED_SOURCES_DIR}/SVGElementFactory.cpp $${WC_GENERATED_SOURCES_DIR}/JSSVGElementWrapperFactory.cpp @@ -658,17 +672,17 @@ xlinknames.input = XLINK_NAMES addExtraCompiler(xlinknames) # GENERATOR 6-A: -cssprops.output = $${WC_GENERATED_SOURCES_DIR}/${QMAKE_FILE_BASE}.cpp -cssprops.input = WALDOCSSPROPS cssprops.wkScript = $$PWD/css/makeprop.pl +cssprops.output = $${WC_GENERATED_SOURCES_DIR}/CSSPropertyNames.cpp +cssprops.input = WALDOCSSPROPS cssprops.commands = perl -ne \"print lc\" ${QMAKE_FILE_NAME} $${DASHBOARDSUPPORTCSSPROPERTIES} $${EXTRACSSPROPERTIES} > $${WC_GENERATED_SOURCES_DIR}/${QMAKE_FILE_BASE}.in && cd $$WC_GENERATED_SOURCES_DIR && perl $$cssprops.wkScript && $(DEL_FILE) ${QMAKE_FILE_BASE}.in ${QMAKE_FILE_BASE}.gperf cssprops.depends = ${QMAKE_FILE_NAME} $${DASHBOARDSUPPORTCSSPROPERTIES} $${EXTRACSSPROPERTIES} addExtraCompiler(cssprops) # GENERATOR 6-B: -cssvalues.output = $${WC_GENERATED_SOURCES_DIR}/${QMAKE_FILE_BASE}.c -cssvalues.input = WALDOCSSVALUES cssvalues.wkScript = $$PWD/css/makevalues.pl +cssvalues.output = $${WC_GENERATED_SOURCES_DIR}/CSSValueKeywords.cpp +cssvalues.input = WALDOCSSVALUES cssvalues.commands = perl -ne \"print lc\" ${QMAKE_FILE_NAME} $$EXTRACSSVALUES > $${WC_GENERATED_SOURCES_DIR}/${QMAKE_FILE_BASE}.in && cd $$WC_GENERATED_SOURCES_DIR && perl $$cssvalues.wkScript && $(DEL_FILE) ${QMAKE_FILE_BASE}.in ${QMAKE_FILE_BASE}.gperf cssvalues.depends = ${QMAKE_FILE_NAME} $${EXTRACSSVALUES} cssvalues.clean = ${QMAKE_FILE_OUT} ${QMAKE_VAR_WC_GENERATED_SOURCES_DIR}/${QMAKE_FILE_BASE}.h @@ -725,23 +739,30 @@ xmlnames.commands = perl -I$$PWD/bindings/scripts $$xmlnames.wkScript --attrs $$ addExtraCompiler(xmlnames) # GENERATOR 8-A: -entities.output = $${WC_GENERATED_SOURCES_DIR}/HTMLEntityNames.c +entities.output = $${WC_GENERATED_SOURCES_DIR}/HTMLEntityNames.cpp entities.input = ENTITIES_GPERF -entities.commands = gperf -a -L ANSI-C -C -G -c -o -t --includes --key-positions="*" -N findEntity -D -s 2 < $$PWD/html/HTMLEntityNames.gperf > $${WC_GENERATED_SOURCES_DIR}/HTMLEntityNames.c +entities.wkScript = $$PWD/make-hash-tools.pl +entities.commands = perl $$entities.wkScript $${WC_GENERATED_SOURCES_DIR} $$ENTITIES_GPERF entities.clean = ${QMAKE_FILE_OUT} +entities.depends = $$PWD/make-hash-tools.pl addExtraCompiler(entities) # GENERATOR 8-B: -doctypestrings.output = $${WC_GENERATED_SOURCES_DIR}/${QMAKE_FILE_BASE}.cpp -doctypestrings.input = DOCTYPESTRINGS -doctypestrings.commands = gperf -CEot -L ANSI-C --includes --key-positions="*" -N findDoctypeEntry -F ,PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards < ${QMAKE_FILE_NAME} >> ${QMAKE_FILE_OUT} +doctypestrings.output = $${WC_GENERATED_SOURCES_DIR}/DocTypeStrings.cpp +doctypestrings.input = DOCTYPESTRINGS_GPERF +doctypestrings.wkScript = $$PWD/make-hash-tools.pl +doctypestrings.commands = perl $$doctypestrings.wkScript $${WC_GENERATED_SOURCES_DIR} $$DOCTYPESTRINGS_GPERF doctypestrings.clean = ${QMAKE_FILE_OUT} +doctypestrings.depends = $$PWD/make-hash-tools.pl addExtraCompiler(doctypestrings) # GENERATOR 8-C: -colordata.output = $${WC_GENERATED_SOURCES_DIR}/ColorData.c -colordata.input = COLORDAT_GPERF -colordata.commands = gperf -CDEot -L ANSI-C --includes --key-positions="*" -N findColor -D -s 2 < ${QMAKE_FILE_NAME} >> ${QMAKE_FILE_OUT} +colordata.output = $${WC_GENERATED_SOURCES_DIR}/ColorData.cpp +colordata.input = COLORDATA_GPERF +colordata.wkScript = $$PWD/make-hash-tools.pl +colordata.commands = perl $$colordata.wkScript $${WC_GENERATED_SOURCES_DIR} $$COLORDATA_GPERF +colordata.clean = ${QMAKE_FILE_OUT} +colordata.depends = $$PWD/make-hash-tools.pl addExtraCompiler(colordata) # GENERATOR 9: diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro index 66b9c0a..eb77370 100644 --- a/WebCore/WebCore.pro +++ b/WebCore/WebCore.pro @@ -74,7 +74,8 @@ CONFIG(QTDIR_build) { !static: DEFINES += QT_MAKEDLL symbian: TARGET =$$TARGET$${QT_LIBINFIX} } -include($$PWD/../WebKit/qt/qtwebkit_version.pri) +moduleFile=$$PWD/../WebKit/qt/qt_webkit_version.pri +include($$moduleFile) VERSION = $${QT_WEBKIT_MAJOR_VERSION}.$${QT_WEBKIT_MINOR_VERSION}.$${QT_WEBKIT_PATCH_VERSION} unix { @@ -338,7 +339,6 @@ SOURCES += \ bindings/js/JSTreeWalkerCustom.cpp \ bindings/js/JSWebKitCSSMatrixConstructor.cpp \ bindings/js/JSWebKitPointConstructor.cpp \ - bindings/js/JSXMLHttpRequestConstructor.cpp \ bindings/js/JSXMLHttpRequestCustom.cpp \ bindings/js/JSXMLHttpRequestUploadCustom.cpp \ bindings/js/JSPluginCustom.cpp \ @@ -404,6 +404,7 @@ SOURCES += \ css/CSSInitialValue.cpp \ css/CSSMediaRule.cpp \ css/CSSMutableStyleDeclaration.cpp \ + css/CSSOMUtils.cpp \ css/CSSPageRule.cpp \ css/CSSParser.cpp \ css/CSSParserValues.cpp \ @@ -533,8 +534,8 @@ SOURCES += \ dom/WebKitAnimationEvent.cpp \ dom/WebKitTransitionEvent.cpp \ dom/WheelEvent.cpp \ - dom/XMLTokenizer.cpp \ - dom/XMLTokenizerQt.cpp \ + dom/XMLDocumentParser.cpp \ + dom/XMLDocumentParserQt.cpp \ dom/default/PlatformMessagePortChannel.cpp \ editing/AppendNodeCommand.cpp \ editing/ApplyStyleCommand.cpp \ @@ -588,6 +589,7 @@ SOURCES += \ history/HistoryItem.cpp \ history/qt/HistoryItemQt.cpp \ history/PageCache.cpp \ + html/AsyncImageResizer.cpp \ html/Blob.cpp \ html/canvas/CanvasGradient.cpp \ html/canvas/CanvasPattern.cpp \ @@ -608,8 +610,9 @@ SOURCES += \ html/FileStreamProxy.cpp \ html/FileThread.cpp \ html/FormDataList.cpp \ + html/HTML5EntityParser.cpp \ html/HTML5Lexer.cpp \ - html/HTML5Tokenizer.cpp \ + html/HTML5DocumentParser.cpp \ html/HTML5TreeBuilder.cpp \ html/HTML5ScriptRunner.cpp \ html/HTMLAllCollection.cpp \ @@ -672,7 +675,7 @@ SOURCES += \ html/HTMLOptionsCollection.cpp \ html/HTMLParagraphElement.cpp \ html/HTMLParamElement.cpp \ - html/HTMLParser.cpp \ + html/LegacyHTMLTreeConstructor.cpp \ html/HTMLParserErrorCodes.cpp \ html/HTMLPlugInElement.cpp \ html/HTMLPlugInImageElement.cpp \ @@ -692,10 +695,11 @@ SOURCES += \ html/HTMLTableSectionElement.cpp \ html/HTMLTextAreaElement.cpp \ html/HTMLTitleElement.cpp \ - html/HTMLTokenizer.cpp \ + html/HTMLDocumentParser.cpp \ html/HTMLUListElement.cpp \ html/HTMLViewSourceDocument.cpp \ html/ImageData.cpp \ + html/ImageResizerThread.cpp \ html/LabelsNodeList.cpp \ html/PreloadScanner.cpp \ html/StepRange.cpp \ @@ -789,6 +793,7 @@ SOURCES += \ page/GeolocationPositionCache.cpp \ page/History.cpp \ page/Location.cpp \ + page/MemoryInfo.cpp \ page/MouseEventWithHitTestResults.cpp \ page/OriginAccessEntry.cpp \ page/Page.cpp \ @@ -813,6 +818,7 @@ SOURCES += \ platform/animation/Animation.cpp \ platform/animation/AnimationList.cpp \ platform/Arena.cpp \ + platform/BlobItem.cpp \ platform/text/Base64.cpp \ platform/text/BidiContext.cpp \ platform/ContentType.cpp \ @@ -982,6 +988,7 @@ SOURCES += \ rendering/RootInlineBox.cpp \ rendering/SVGRenderTreeAsText.cpp \ rendering/ScrollBehavior.cpp \ + rendering/ShadowElement.cpp \ rendering/TextControlInnerElements.cpp \ rendering/TransformState.cpp \ rendering/style/BindingURI.cpp \ @@ -1075,7 +1082,6 @@ HEADERS += \ bindings/js/JSWorkerConstructor.h \ bindings/js/JSWorkerContextBase.h \ bindings/js/JSWorkerContextErrorHandler.h \ - bindings/js/JSXMLHttpRequestConstructor.h \ bindings/js/JSXSLTProcessorConstructor.h \ bindings/js/JavaScriptCallFrame.h \ bindings/js/ScheduledAction.h \ @@ -1138,6 +1144,7 @@ HEADERS += \ css/CSSInitialValue.h \ css/CSSMediaRule.h \ css/CSSMutableStyleDeclaration.h \ + css/CSSOMUtils.h \ css/CSSPageRule.h \ css/CSSParser.h \ css/CSSParserValues.h \ @@ -1267,7 +1274,7 @@ HEADERS += \ dom/WebKitAnimationEvent.h \ dom/WebKitTransitionEvent.h \ dom/WheelEvent.h \ - dom/XMLTokenizer.h \ + dom/XMLDocumentParser.h \ editing/AppendNodeCommand.h \ editing/ApplyStyleCommand.h \ editing/BreakBlockquoteCommand.h \ @@ -1278,6 +1285,7 @@ HEADERS += \ editing/DeleteFromTextNodeCommand.h \ editing/DeleteSelectionCommand.h \ editing/EditCommand.h \ + editing/EditingBehavior.h \ editing/Editor.h \ editing/FormatBlockCommand.h \ editing/htmlediting.h \ @@ -1318,6 +1326,7 @@ HEADERS += \ history/CachedPage.h \ history/HistoryItem.h \ history/PageCache.h \ + html/AsyncImageResizer.h \ html/Blob.h \ html/canvas/CanvasGradient.h \ html/canvas/CanvasPattern.h \ @@ -1404,7 +1413,7 @@ HEADERS += \ html/HTMLParagraphElement.h \ html/HTMLParamElement.h \ html/HTMLParserErrorCodes.h \ - html/HTMLParser.h \ + html/LegacyHTMLTreeConstructor.h \ html/HTMLPlugInElement.h \ html/HTMLPlugInImageElement.h \ html/HTMLPreElement.h \ @@ -1424,11 +1433,12 @@ HEADERS += \ html/HTMLTableSectionElement.h \ html/HTMLTextAreaElement.h \ html/HTMLTitleElement.h \ - html/HTMLTokenizer.h \ + html/HTMLDocumentParser.h \ html/HTMLUListElement.h \ html/HTMLVideoElement.h \ html/HTMLViewSourceDocument.h \ html/ImageData.h \ + html/ImageResizerThread.h \ html/LabelsNodeList.h \ html/PreloadScanner.h \ html/StepRange.h \ @@ -1562,6 +1572,7 @@ HEADERS += \ platform/animation/Animation.h \ platform/animation/AnimationList.h \ platform/Arena.h \ + platform/BlobItem.h \ platform/ContentType.h \ platform/ContextMenu.h \ platform/CrossThreadCopier.h \ @@ -1793,6 +1804,7 @@ HEADERS += \ rendering/RenderWordBreak.h \ rendering/RootInlineBox.h \ rendering/ScrollBehavior.h \ + rendering/ShadowElement.h \ rendering/style/BindingURI.h \ rendering/style/ContentData.h \ rendering/style/CounterDirectives.h \ @@ -2102,6 +2114,7 @@ SOURCES += \ platform/network/qt/QNetworkReplyHandler.cpp \ editing/qt/EditorQt.cpp \ editing/qt/SmartReplaceQt.cpp \ + platform/Cursor.cpp \ platform/qt/ClipboardQt.cpp \ platform/qt/ContextMenuItemQt.cpp \ platform/qt/ContextMenuQt.cpp \ @@ -2228,7 +2241,7 @@ contains(DEFINES, ENABLE_NETSCAPE_PLUGIN_API=1) { mac { SOURCES += \ plugins/mac/PluginPackageMac.cpp \ - plugins/mac/PluginViewMac.cpp + plugins/mac/PluginViewMac.mm OBJECTIVE_SOURCES += \ platform/text/mac/StringImplMac.mm \ platform/mac/WebCoreNSStringExtras.mm @@ -2347,7 +2360,9 @@ contains(DEFINES, ENABLE_INDEXED_DATABASE=1) { storage/IDBIndex.h \ storage/IDBIndexImpl.h \ storage/IDBIndexRequest.h \ + storage/IDBKeyRange.h \ storage/IDBObjectStore.h \ + storage/IDBObjectStoreImpl.h \ storage/IDBObjectStoreRequest.h \ storage/IDBRequest.h \ storage/IDBSuccessEvent.h \ @@ -2364,7 +2379,8 @@ contains(DEFINES, ENABLE_INDEXED_DATABASE=1) { storage/IDBEvent.cpp \ storage/IDBIndexImpl.cpp \ storage/IDBIndexRequest.cpp \ - storage/IDBObjectStore.cpp \ + storage/IDBKeyRange.cpp \ + storage/IDBObjectStoreImpl.cpp \ storage/IDBObjectStoreRequest.cpp \ storage/IDBRequest.cpp \ storage/IDBSuccessEvent.cpp \ @@ -2619,8 +2635,22 @@ contains(DEFINES, ENABLE_QT_BEARER=1) { SOURCES += \ platform/network/qt/NetworkStateNotifierQt.cpp + # Bearer management is part of Qt 4.7, so don't accidentially + # pull in Qt Mobility when building against >= 4.7 + !greaterThan(QT_MINOR_VERSION, 6) { + CONFIG += mobility + MOBILITY += bearer + } +} + +contains(DEFINES, ENABLE_GEOLOCATION=1) { + HEADERS += \ + platform/qt/GeolocationServiceQt.h + SOURCES += \ + platform/qt/GeolocationServiceQt.cpp + CONFIG += mobility - MOBILITY += bearer + MOBILITY += location } contains(DEFINES, ENABLE_SVG=1) { @@ -2883,7 +2913,7 @@ HEADERS += \ bindings/js/JSArrayBufferConstructor.h \ bindings/js/JSArrayBufferViewHelper.h \ bindings/js/JSInt8ArrayConstructor.h \ - bindings/js/JSFloatArrayConstructor.h \ + bindings/js/JSFloat32ArrayConstructor.h \ bindings/js/JSInt32ArrayConstructor.h \ bindings/js/JSInt16ArrayConstructor.h \ bindings/js/JSUint8ArrayConstructor.h \ @@ -2897,7 +2927,7 @@ HEADERS += \ html/canvas/WebGLBuffer.h \ html/canvas/Int8Array.h \ html/canvas/WebGLContextAttributes.h \ - html/canvas/FloatArray.h \ + html/canvas/Float32Array.h \ html/canvas/WebGLFramebuffer.h \ html/canvas/WebGLGetInfo.h \ html/canvas/Int32Array.h \ @@ -2918,8 +2948,8 @@ SOURCES += \ bindings/js/JSArrayBufferViewCustom.cpp \ bindings/js/JSInt8ArrayConstructor.cpp \ bindings/js/JSInt8ArrayCustom.cpp \ - bindings/js/JSFloatArrayConstructor.cpp \ - bindings/js/JSFloatArrayCustom.cpp \ + bindings/js/JSFloat32ArrayConstructor.cpp \ + bindings/js/JSFloat32ArrayCustom.cpp \ bindings/js/JSInt32ArrayConstructor.cpp \ bindings/js/JSInt32ArrayCustom.cpp \ bindings/js/JSWebGLRenderingContextCustom.cpp \ @@ -2938,7 +2968,7 @@ SOURCES += \ html/canvas/WebGLBuffer.cpp \ html/canvas/Int8Array.cpp \ html/canvas/WebGLContextAttributes.cpp \ - html/canvas/FloatArray.cpp \ + html/canvas/Float32Array.cpp \ html/canvas/WebGLFramebuffer.cpp \ html/canvas/WebGLGetInfo.cpp \ html/canvas/Int32Array.cpp \ @@ -2968,31 +2998,45 @@ contains(DEFINES, ENABLE_SYMBIAN_DIALOG_PROVIDERS) { include($$PWD/../WebKit/qt/Api/headers.pri) HEADERS += $$WEBKIT_API_HEADERS -!CONFIG(QTDIR_build) { +CONFIG(QTDIR_build) { + modfile.files = $$moduleFile + modfile.path = $$[QMAKE_MKSPECS]/modules + + INSTALLS += modfile +} else { exists($$OUTPUT_DIR/include/QtWebKit/classheaders.pri): include($$OUTPUT_DIR/include/QtWebKit/classheaders.pri) WEBKIT_INSTALL_HEADERS = $$WEBKIT_API_HEADERS $$WEBKIT_CLASS_HEADERS !symbian { headers.files = $$WEBKIT_INSTALL_HEADERS - headers.path = $$INSTALL_HEADERS/QtWebKit - target.path = $$INSTALL_LIBS + !isEmpty(INSTALL_HEADERS): headers.path = $$INSTALL_HEADERS/QtWebKit + else: headers.path = $$[QT_INSTALL_HEADERS]/QtWebKit - isEmpty(INSTALL_HEADERS): headers.path = $$[QT_INSTALL_HEADERS]/QtWebKit - isEmpty(INSTALL_LIBS): target.path = $$[QT_INSTALL_LIBS] + !isEmpty(INSTALL_LIBS): target.path = $$INSTALL_LIBS + else: target.path = $$[QT_INSTALL_LIBS] - INSTALLS += target headers + modfile.files = $$moduleFile + modfile.path = $$[QMAKE_MKSPECS]/modules + + INSTALLS += target headers modfile } 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 - isEmpty(INSTALL_HEADERS): inst_headers.output = $$[QT_INSTALL_HEADERS]/QtWebKit/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT} - inst_headers.output = $$INSTALL_HEADERS/QtWebKit/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT} + !isEmpty(INSTALL_HEADERS): inst_headers.output = $$INSTALL_HEADERS/QtWebKit/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT} + else: 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 + inst_modfile.commands = $$inst_headers.commands + inst_modfile.input = moduleFile + inst_modfile.output = $$[QMAKE_MKSPECS]/modules + + QMAKE_EXTRA_COMPILERS += inst_modfile + + install.depends += compiler_inst_headers_make_all compiler_inst_modfile_make_all QMAKE_EXTRA_TARGETS += install } @@ -3010,7 +3054,7 @@ HEADERS += $$WEBKIT_API_HEADERS QMAKE_PKGCONFIG_LIBDIR = $$target.path QMAKE_PKGCONFIG_INCDIR = $$headers.path QMAKE_PKGCONFIG_DESTDIR = pkgconfig - lib_replace.match = $$DESTDIR + lib_replace.match = $$re_escape($$DESTDIR) lib_replace.replace = $$[QT_INSTALL_LIBS] QMAKE_PKGCONFIG_INSTALL_REPLACE += lib_replace } diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj index 98ce9eb..e693884 100644 --- a/WebCore/WebCore.vcproj/WebCore.vcproj +++ b/WebCore/WebCore.vcproj/WebCore.vcproj @@ -8493,6 +8493,62 @@ > </File> <File + RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSMemoryInfo.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSMemoryInfo.h" + > + </File> + <File RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSMessageChannel.cpp" > <FileConfiguration @@ -22333,6 +22389,14 @@ > </File> <File + RelativePath="..\platform\BlobItem.cpp" + > + </File> + <File + RelativePath="..\platform\BlobItem.h" + > + </File> + <File RelativePath="..\platform\ContentType.cpp" > </File> @@ -22365,6 +22429,10 @@ > </File> <File + RelativePath="..\platform\Cursor.cpp" + > + </File> + <File RelativePath="..\platform\Cursor.h" > </File> @@ -27429,6 +27497,14 @@ > </File> <File + RelativePath="..\css\CSSOMUtils.cpp" + > + </File> + <File + RelativePath="..\css\CSSOMUtils.h" + > + </File> + <File RelativePath="..\css\CSSPageRule.cpp" > </File> @@ -28799,6 +28875,14 @@ > </File> <File + RelativePath="..\rendering\ShadowElement.cpp" + > + </File> + <File + RelativePath="..\rendering\ShadowElement.h" + > + </File> + <File RelativePath="..\rendering\SVGCharacterData.cpp" > </File> @@ -29649,6 +29733,10 @@ > </File> <File + RelativePath="..\dom\DocumentParser.h" + > + </File> + <File RelativePath="..\dom\DocumentType.cpp" > </File> @@ -30105,10 +30193,6 @@ > </File> <File - RelativePath="..\dom\Tokenizer.h" - > - </File> - <File RelativePath="..\dom\TransformSource.h" > </File> @@ -30193,23 +30277,23 @@ > </File> <File - RelativePath="..\dom\XMLTokenizer.cpp" + RelativePath="..\dom\XMLDocumentParser.cpp" > </File> <File - RelativePath="..\dom\XMLTokenizer.h" + RelativePath="..\dom\XMLDocumentParser.h" > </File> <File - RelativePath="..\dom\XMLTokenizerLibxml2.cpp" + RelativePath="..\dom\XMLDocumentParserLibxml2.cpp" > </File> <File - RelativePath="..\dom\XMLTokenizerScope.cpp" + RelativePath="..\dom\XMLDocumentParserScope.cpp" > </File> <File - RelativePath="..\dom\XMLTokenizerScope.h" + RelativePath="..\dom\XMLDocumentParserScope.h" > </File> </Filter> @@ -30387,6 +30471,54 @@ <File RelativePath="..\editing\AppendNodeCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\AppendNodeCommand.h" @@ -30395,6 +30527,54 @@ <File RelativePath="..\editing\ApplyStyleCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\ApplyStyleCommand.h" @@ -30403,6 +30583,54 @@ <File RelativePath="..\editing\BreakBlockquoteCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\BreakBlockquoteCommand.h" @@ -30411,6 +30639,54 @@ <File RelativePath="..\editing\CompositeEditCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\CompositeEditCommand.h" @@ -30419,6 +30695,54 @@ <File RelativePath="..\editing\CreateLinkCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\CreateLinkCommand.h" @@ -30427,6 +30751,54 @@ <File RelativePath="..\editing\DeleteButton.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\DeleteButton.h" @@ -30435,6 +30807,54 @@ <File RelativePath="..\editing\DeleteButtonController.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\DeleteButtonController.h" @@ -30443,6 +30863,54 @@ <File RelativePath="..\editing\DeleteFromTextNodeCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\DeleteFromTextNodeCommand.h" @@ -30451,62 +30919,410 @@ <File RelativePath="..\editing\DeleteSelectionCommand.cpp" > - </File> - <File - RelativePath="..\editing\DeleteSelectionCommand.h" - > - </File> - <File - RelativePath="..\editing\EditAction.h" - > - </File> - <File - RelativePath="..\editing\EditCommand.cpp" - > - </File> - <File - RelativePath="..\editing\EditCommand.h" - > - </File> - <File - RelativePath="..\editing\Editor.cpp" - > - </File> - <File - RelativePath="..\editing\Editor.h" - > - </File> - <File - RelativePath="..\editing\EditorCommand.cpp" - > - </File> - <File - RelativePath="..\editing\EditorDeleteAction.h" - > - </File> - <File - RelativePath="..\editing\EditorInsertAction.h" - > - </File> - <File - RelativePath="..\editing\FormatBlockCommand.cpp" - > - </File> - <File - RelativePath="..\editing\FormatBlockCommand.h" - > - </File> - <File - RelativePath="..\editing\htmlediting.cpp" + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\editing\DeleteSelectionCommand.h" + > + </File> + <File + RelativePath="..\editing\EditAction.h" + > + </File> + <File + RelativePath="..\editing\EditCommand.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\editing\EditCommand.h" + > + </File> + <File + RelativePath="..\editing\EditingAllInOne.cpp" + > + </File> + <File + RelativePath="..\editing\EditingBehavior.h" + > + </File> + <File + RelativePath="..\editing\EditingBehaviorTypes.h" + > + </File> + <File + RelativePath="..\editing\Editor.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\editing\Editor.h" + > + </File> + <File + RelativePath="..\editing\EditorCommand.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\editing\EditorDeleteAction.h" + > + </File> + <File + RelativePath="..\editing\EditorInsertAction.h" > </File> <File + RelativePath="..\editing\FormatBlockCommand.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\editing\FormatBlockCommand.h" + > + </File> + <File + RelativePath="..\editing\htmlediting.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File RelativePath="..\editing\htmlediting.h" > </File> <File RelativePath="..\editing\HTMLInterchange.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\HTMLInterchange.h" @@ -30515,6 +31331,54 @@ <File RelativePath="..\editing\IndentOutdentCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\IndentOutdentCommand.h" @@ -30523,6 +31387,54 @@ <File RelativePath="..\editing\InsertIntoTextNodeCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\InsertIntoTextNodeCommand.h" @@ -30531,6 +31443,54 @@ <File RelativePath="..\editing\InsertLineBreakCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\InsertLineBreakCommand.h" @@ -30539,6 +31499,54 @@ <File RelativePath="..\editing\InsertListCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\InsertListCommand.h" @@ -30547,6 +31555,54 @@ <File RelativePath="..\editing\InsertNodeBeforeCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\InsertNodeBeforeCommand.h" @@ -30555,6 +31611,54 @@ <File RelativePath="..\editing\InsertParagraphSeparatorCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\InsertParagraphSeparatorCommand.h" @@ -30563,6 +31667,54 @@ <File RelativePath="..\editing\InsertTextCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\InsertTextCommand.h" @@ -30571,6 +31723,54 @@ <File RelativePath="..\editing\JoinTextNodesCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\JoinTextNodesCommand.h" @@ -30579,6 +31779,54 @@ <File RelativePath="..\editing\markup.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\markup.h" @@ -30587,6 +31835,54 @@ <File RelativePath="..\editing\MergeIdenticalElementsCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\MergeIdenticalElementsCommand.h" @@ -30595,6 +31891,54 @@ <File RelativePath="..\editing\ModifySelectionListLevel.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\ModifySelectionListLevel.h" @@ -30603,6 +31947,54 @@ <File RelativePath="..\editing\MoveSelectionCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\MoveSelectionCommand.h" @@ -30611,6 +32003,54 @@ <File RelativePath="..\editing\RemoveCSSPropertyCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\RemoveCSSPropertyCommand.h" @@ -30619,10 +32059,106 @@ <File RelativePath="..\editing\RemoveFormatCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\RemoveNodeCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\RemoveNodeCommand.h" @@ -30631,6 +32167,54 @@ <File RelativePath="..\editing\RemoveNodePreservingChildrenCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\RemoveNodePreservingChildrenCommand.h" @@ -30639,6 +32223,54 @@ <File RelativePath="..\editing\ReplaceNodeWithSpanCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\ReplaceNodeWithSpanCommand.h" @@ -30647,6 +32279,54 @@ <File RelativePath="..\editing\ReplaceSelectionCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\ReplaceSelectionCommand.h" @@ -30655,6 +32335,54 @@ <File RelativePath="..\editing\SelectionController.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\SelectionController.h" @@ -30663,6 +32391,54 @@ <File RelativePath="..\editing\SetNodeAttributeCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\SetNodeAttributeCommand.h" @@ -30671,6 +32447,54 @@ <File RelativePath="..\editing\SmartReplace.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\SmartReplace.h" @@ -30679,10 +32503,106 @@ <File RelativePath="..\editing\SmartReplaceCF.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\SplitElementCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\SplitElementCommand.h" @@ -30691,6 +32611,54 @@ <File RelativePath="..\editing\SplitTextNodeCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\SplitTextNodeCommand.h" @@ -30699,6 +32667,54 @@ <File RelativePath="..\editing\SplitTextNodeContainingElementCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\SplitTextNodeContainingElementCommand.h" @@ -30715,6 +32731,54 @@ <File RelativePath="..\editing\TextIterator.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\TextIterator.h" @@ -30723,6 +32787,54 @@ <File RelativePath="..\editing\TypingCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\TypingCommand.h" @@ -30731,6 +32843,54 @@ <File RelativePath="..\editing\UnlinkCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\UnlinkCommand.h" @@ -30739,6 +32899,54 @@ <File RelativePath="..\editing\visible_units.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\visible_units.h" @@ -30747,6 +32955,54 @@ <File RelativePath="..\editing\VisiblePosition.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\VisiblePosition.h" @@ -30755,6 +33011,54 @@ <File RelativePath="..\editing\VisibleSelection.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\VisibleSelection.h" @@ -30763,6 +33067,54 @@ <File RelativePath="..\editing\WrapContentsInDummySpanCommand.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\editing\WrapContentsInDummySpanCommand.h" @@ -30773,6 +33125,14 @@ Name="html" > <File + RelativePath="..\html\AsyncImageResizer.cpp" + > + </File> + <File + RelativePath="..\html\AsyncImageResizer.h" + > + </File> + <File RelativePath="..\html\Blob.cpp" > </File> @@ -30960,36 +33320,44 @@ RelativePath="..\html\FormDataList.h" > </File> - <File - RelativePath="..\html\HTML5Lexer.cpp" + <File + RelativePath="..\html\HTML5DocumentParser.cpp" + > + </File> + <File + RelativePath="..\html\HTML5DocumentParser.h" + > + </File> + <File + RelativePath="..\html\HTML5EntityParser.cpp" > </File> <File - RelativePath="..\html\HTML5Lexer.h" + RelativePath="..\html\HTML5EntityParser.h" > </File> <File - RelativePath="..\html\HTML5Tokenizer.cpp" + RelativePath="..\html\HTML5Lexer.cpp" > </File> <File - RelativePath="..\html\HTML5Tokenizer.h" + RelativePath="..\html\HTML5Lexer.h" > </File> <File - RelativePath="..\html\HTML5TreeBuilder.cpp" + RelativePath="..\html\HTML5ScriptRunner.cpp" > </File> <File - RelativePath="..\html\HTML5TreeBuilder.h" + RelativePath="..\html\HTML5ScriptRunner.h" > </File> <File - RelativePath="..\html\HTML5ScriptRunner.cpp" + RelativePath="..\html\HTML5TreeBuilder.cpp" > </File> <File - RelativePath="..\html\HTML5ScriptRunner.h" + RelativePath="..\html\HTML5TreeBuilder.h" > </File> <File @@ -34101,11 +36469,11 @@ > </File> <File - RelativePath="..\html\HTMLParser.cpp" + RelativePath="..\html\LegacyHTMLTreeConstructor.cpp" > </File> <File - RelativePath="..\html\HTMLParser.h" + RelativePath="..\html\LegacyHTMLTreeConstructor.h" > </File> <File @@ -35133,11 +37501,11 @@ > </File> <File - RelativePath="..\html\HTMLTokenizer.cpp" + RelativePath="..\html\HTMLDocumentParser.cpp" > </File> <File - RelativePath="..\html\HTMLTokenizer.h" + RelativePath="..\html\HTMLDocumentParser.h" > </File> <File @@ -35269,6 +37637,14 @@ > </File> <File + RelativePath="..\html\ImageResizerThread.cpp" + > + </File> + <File + RelativePath="..\html\ImageResizerThread.h" + > + </File> + <File RelativePath="..\html\LabelsNodeList.cpp" > </File> @@ -35404,11 +37780,123 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\GCController.h" + RelativePath="..\bindings\js\GCController.h" + > + </File> + <File + RelativePath="..\bindings\js\JSAttrCustom.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\bindings\js\JSAudioConstructor.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\bindings\js\JSAudioConstructor.h" > </File> <File - RelativePath="..\bindings\js\JSAttrCustom.cpp" + RelativePath="..\bindings\js\JSBindingsAllInOne.cpp" + > + </File> + <File + RelativePath="..\bindings\js\JSCallbackData.cpp" > <FileConfiguration Name="Debug|Win32" @@ -35460,7 +37948,11 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSAudioConstructor.cpp" + RelativePath="..\bindings\js\JSCallbackData.h" + > + </File> + <File + RelativePath="..\bindings\js\JSCanvasRenderingContext2DCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -35512,15 +38004,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSAudioConstructor.h" - > - </File> - <File - RelativePath="..\bindings\js\JSBindingsAllInOne.cpp" - > - </File> - <File - RelativePath="..\bindings\js\JSCallbackData.cpp" + RelativePath="..\bindings\js\JSCanvasRenderingContextCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -35572,11 +38056,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSCallbackData.h" - > - </File> - <File - RelativePath="..\bindings\js\JSCanvasRenderingContext2DCustom.cpp" + RelativePath="..\bindings\js\JSCDATASectionCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -35628,7 +38108,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSCanvasRenderingContextCustom.cpp" + RelativePath="..\bindings\js\JSClipboardCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -35680,7 +38160,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSCDATASectionCustom.cpp" + RelativePath="..\bindings\js\JSConsoleCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -35732,7 +38212,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSClipboardCustom.cpp" + RelativePath="..\bindings\js\JSCoordinatesCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -35784,7 +38264,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSConsoleCustom.cpp" + RelativePath="..\bindings\js\JSCSSRuleCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -35836,7 +38316,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSCoordinatesCustom.cpp" + RelativePath="..\bindings\js\JSCSSRuleListCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -35888,7 +38368,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSCSSRuleCustom.cpp" + RelativePath="..\bindings\js\JSCSSStyleDeclarationCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -35940,7 +38420,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSCSSRuleListCustom.cpp" + RelativePath="..\bindings\js\JSCSSValueCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -35992,7 +38472,15 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSCSSStyleDeclarationCustom.cpp" + RelativePath="..\bindings\js\JSCustomPositionCallback.cpp" + > + </File> + <File + RelativePath="..\bindings\js\JSCustomPositionErrorCallback.cpp" + > + </File> + <File + RelativePath="..\bindings\js\JSCustomSQLStatementErrorCallback.cpp" > <FileConfiguration Name="Debug|Win32" @@ -36044,7 +38532,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSCSSValueCustom.cpp" + RelativePath="..\bindings\js\JSCustomVoidCallback.cpp" > <FileConfiguration Name="Debug|Win32" @@ -36096,15 +38584,11 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSCustomPositionCallback.cpp" - > - </File> - <File - RelativePath="..\bindings\js\JSCustomPositionErrorCallback.cpp" + RelativePath="..\bindings\js\JSCustomVoidCallback.h" > </File> <File - RelativePath="..\bindings\js\JSCustomSQLStatementErrorCallback.cpp" + RelativePath="..\bindings\js\JSCustomXPathNSResolver.cpp" > <FileConfiguration Name="Debug|Win32" @@ -36156,7 +38640,11 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSCustomVoidCallback.cpp" + RelativePath="..\bindings\js\JSCustomXPathNSResolver.h" + > + </File> + <File + RelativePath="..\bindings\js\JSDatabaseCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -36208,11 +38696,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSCustomVoidCallback.h" - > - </File> - <File - RelativePath="..\bindings\js\JSCustomXPathNSResolver.cpp" + RelativePath="..\bindings\js\JSDatabaseSyncCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -36264,11 +38748,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSCustomXPathNSResolver.h" - > - </File> - <File - RelativePath="..\bindings\js\JSDatabaseCustom.cpp" + RelativePath="..\bindings\js\JSDataGridColumnListCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -36320,7 +38800,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSDatabaseSyncCustom.cpp" + RelativePath="..\bindings\js\JSDataGridDataSource.cpp" > <FileConfiguration Name="Debug|Win32" @@ -36372,7 +38852,15 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSDataGridColumnListCustom.cpp" + RelativePath="..\bindings\js\JSDebugWrapperSet.cpp" + > + </File> + <File + RelativePath="..\bindings\js\JSDebugWrapperSet.h" + > + </File> + <File + RelativePath="..\bindings\js\JSDedicatedWorkerContextCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -36424,7 +38912,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSDataGridDataSource.cpp" + RelativePath="..\bindings\js\JSDesktopNotificationsCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -36476,15 +38964,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSDebugWrapperSet.cpp" - > - </File> - <File - RelativePath="..\bindings\js\JSDebugWrapperSet.h" - > - </File> - <File - RelativePath="..\bindings\js\JSDedicatedWorkerContextCustom.cpp" + RelativePath="..\bindings\js\JSDocumentCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -36536,7 +39016,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSDesktopNotificationsCustom.cpp" + RelativePath="..\bindings\js\JSDOMApplicationCacheCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -36588,7 +39068,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSDocumentCustom.cpp" + RelativePath="..\bindings\js\JSDOMBinding.cpp" > <FileConfiguration Name="Debug|Win32" @@ -36640,7 +39120,15 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSDOMApplicationCacheCustom.cpp" + RelativePath="..\bindings\js\JSDOMBinding.h" + > + </File> + <File + RelativePath="..\bindings\js\JSDOMFormDataCustom.cpp" + > + </File> + <File + RelativePath="..\bindings\js\JSDOMGlobalObject.cpp" > <FileConfiguration Name="Debug|Win32" @@ -36692,7 +39180,11 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSDOMBinding.cpp" + RelativePath="..\bindings\js\JSDOMGlobalObject.h" + > + </File> + <File + RelativePath="..\bindings\js\JSDOMWindowBase.cpp" > <FileConfiguration Name="Debug|Win32" @@ -36744,15 +39236,11 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSDOMBinding.h" - > - </File> - <File - RelativePath="..\bindings\js\JSDOMFormDataCustom.cpp" + RelativePath="..\bindings\js\JSDOMWindowBase.h" > </File> <File - RelativePath="..\bindings\js\JSDOMGlobalObject.cpp" + RelativePath="..\bindings\js\JSDOMWindowCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -36804,11 +39292,11 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSDOMGlobalObject.h" + RelativePath="..\bindings\js\JSDOMWindowCustom.h" > </File> <File - RelativePath="..\bindings\js\JSDOMWindowBase.cpp" + RelativePath="..\bindings\js\JSDOMWindowShell.cpp" > <FileConfiguration Name="Debug|Win32" @@ -36860,11 +39348,19 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSDOMWindowBase.h" + RelativePath="..\bindings\js\JSDOMWindowShell.h" > </File> <File - RelativePath="..\bindings\js\JSDOMWindowCustom.cpp" + RelativePath="..\bindings\js\JSDOMWrapper.cpp" + > + </File> + <File + RelativePath="..\bindings\js\JSDOMWrapper.h" + > + </File> + <File + RelativePath="..\bindings\js\JSElementCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -36916,11 +39412,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSDOMWindowCustom.h" - > - </File> - <File - RelativePath="..\bindings\js\JSDOMWindowShell.cpp" + RelativePath="..\bindings\js\JSEventCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -36972,19 +39464,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSDOMWindowShell.h" - > - </File> - <File - RelativePath="..\bindings\js\JSDOMWrapper.cpp" - > - </File> - <File - RelativePath="..\bindings\js\JSDOMWrapper.h" - > - </File> - <File - RelativePath="..\bindings\js\JSElementCustom.cpp" + RelativePath="..\bindings\js\JSEventListener.cpp" > <FileConfiguration Name="Debug|Win32" @@ -37036,7 +39516,11 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSEventCustom.cpp" + RelativePath="..\bindings\js\JSEventListener.h" + > + </File> + <File + RelativePath="..\bindings\js\JSEventSourceConstructor.cpp" > <FileConfiguration Name="Debug|Win32" @@ -37088,7 +39572,11 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSEventListener.cpp" + RelativePath="..\bindings\js\JSEventSourceConstructor.h" + > + </File> + <File + RelativePath="..\bindings\js\JSEventTarget.cpp" > <FileConfiguration Name="Debug|Win32" @@ -37140,11 +39628,11 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSEventListener.h" + RelativePath="..\bindings\js\JSEventTarget.h" > </File> <File - RelativePath="..\bindings\js\JSEventSourceConstructor.cpp" + RelativePath="..\bindings\js\JSExceptionBase.cpp" > <FileConfiguration Name="Debug|Win32" @@ -37196,11 +39684,15 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSEventSourceConstructor.h" + RelativePath="..\bindings\js\JSExceptionBase.h" > </File> <File - RelativePath="..\bindings\js\JSEventTarget.cpp" + RelativePath="..\bindings\js\JSGeolocationCustom.cpp" + > + </File> + <File + RelativePath="..\bindings\js\JSHistoryCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -37252,11 +39744,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSEventTarget.h" - > - </File> - <File - RelativePath="..\bindings\js\JSExceptionBase.cpp" + RelativePath="..\bindings\js\JSHTMLAllCollectionCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -37308,15 +39796,59 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSExceptionBase.h" - > - </File> - <File - RelativePath="..\bindings\js\JSGeolocationCustom.cpp" + RelativePath="..\bindings\js\JSHTMLAppletElementCustom.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Internal|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSHistoryCustom.cpp" + RelativePath="..\bindings\js\JSHTMLCanvasElementCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -37368,7 +39900,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSHTMLAllCollectionCustom.cpp" + RelativePath="..\bindings\js\JSHTMLCollectionCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -37420,7 +39952,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSHTMLAppletElementCustom.cpp" + RelativePath="..\bindings\js\JSHTMLDataGridElementCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -37472,7 +40004,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSHTMLCanvasElementCustom.cpp" + RelativePath="..\bindings\js\JSHTMLDocumentCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -37524,7 +40056,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSHTMLCollectionCustom.cpp" + RelativePath="..\bindings\js\JSHTMLElementCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -37576,7 +40108,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSHTMLDataGridElementCustom.cpp" + RelativePath="..\bindings\js\JSHTMLEmbedElementCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -37628,7 +40160,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSHTMLDocumentCustom.cpp" + RelativePath="..\bindings\js\JSHTMLFormElementCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -37680,7 +40212,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSHTMLElementCustom.cpp" + RelativePath="..\bindings\js\JSHTMLFrameElementCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -37732,7 +40264,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSHTMLEmbedElementCustom.cpp" + RelativePath="..\bindings\js\JSHTMLFrameSetElementCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -37784,7 +40316,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSHTMLFormElementCustom.cpp" + RelativePath="..\bindings\js\JSHTMLIFrameElementCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -37836,7 +40368,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSHTMLFrameElementCustom.cpp" + RelativePath="..\bindings\js\JSHTMLInputElementCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -37888,59 +40420,11 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSHTMLFrameSetElementCustom.cpp" + RelativePath="..\bindings\js\JSHTMLInputElementCustom.h" > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Debug_Internal|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Debug_Cairo|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release_Cairo|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Debug_All|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSHTMLIFrameElementCustom.cpp" + RelativePath="..\bindings\js\JSHTMLObjectElementCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -37992,7 +40476,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSHTMLInputElementCustom.cpp" + RelativePath="..\bindings\js\JSHTMLOptionsCollectionCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -38044,11 +40528,7 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSHTMLInputElementCustom.h" - > - </File> - <File - RelativePath="..\bindings\js\JSHTMLObjectElementCustom.cpp" + RelativePath="..\bindings\js\JSHTMLSelectElementCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -38100,59 +40580,11 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSHTMLOptionsCollectionCustom.cpp" + RelativePath="..\bindings\js\JSHTMLSelectElementCustom.h" > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Debug_Internal|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Debug_Cairo|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release_Cairo|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Debug_All|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSHTMLSelectElementCustom.cpp" + RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBAny.cpp" > <FileConfiguration Name="Debug|Win32" @@ -38204,11 +40636,11 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSHTMLSelectElementCustom.h" + RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBAny.h" > </File> <File - RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBAny.cpp" + RelativePath="..\bindings\js\JSIDBAnyCustom.cpp" > <FileConfiguration Name="Debug|Win32" @@ -38260,10 +40692,6 @@ </FileConfiguration> </File> <File - RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBAny.h" - > - </File> - <File RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBDatabase.cpp" > <FileConfiguration @@ -38656,7 +41084,7 @@ > </File> <File - RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBObjectStoreRequest.cpp" + RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBKeyRange.cpp" > <FileConfiguration Name="Debug|Win32" @@ -38708,11 +41136,11 @@ </FileConfiguration> </File> <File - RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBObjectStoreRequest.h" + RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBKeyRange.h" > - </File> + </File> <File - RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBRequest.cpp" + RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBObjectStoreRequest.cpp" > <FileConfiguration Name="Debug|Win32" @@ -38764,11 +41192,11 @@ </FileConfiguration> </File> <File - RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBRequest.h" + RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBObjectStoreRequest.h" > </File> <File - RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBSuccessEvent.cpp" + RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBRequest.cpp" > <FileConfiguration Name="Debug|Win32" @@ -38820,11 +41248,11 @@ </FileConfiguration> </File> <File - RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBSuccessEvent.h" + RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBRequest.h" > </File> <File - RelativePath="..\bindings\js\JSIDBAnyCustom.cpp" + RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBSuccessEvent.cpp" > <FileConfiguration Name="Debug|Win32" @@ -38876,6 +41304,10 @@ </FileConfiguration> </File> <File + RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBSuccessEvent.h" + > + </File> + <File RelativePath="..\bindings\js\JSImageConstructor.cpp" > <FileConfiguration @@ -41508,62 +43940,6 @@ > </File> <File - RelativePath="..\bindings\js\JSXMLHttpRequestConstructor.cpp" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Debug_Internal|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Debug_Cairo|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release_Cairo|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Debug_All|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="..\bindings\js\JSXMLHttpRequestConstructor.h" - > - </File> - <File RelativePath="..\bindings\js\JSXMLHttpRequestCustom.cpp" > <FileConfiguration @@ -42276,15 +44652,15 @@ > </File> <File - RelativePath="..\bindings\js\ScriptInstance.h" + RelativePath="..\bindings\js\ScriptGCEvent.cpp" > </File> <File - RelativePath="..\bindings\js\ScriptGCEvent.cpp" + RelativePath="..\bindings\js\ScriptGCEvent.h" > </File> <File - RelativePath="..\bindings\js\ScriptGCEvent.h" + RelativePath="..\bindings\js\ScriptInstance.h" > </File> <File @@ -44177,19 +46553,19 @@ > </File> <File - RelativePath="..\storage\IDBEvent.cpp" + RelativePath="..\storage\IDBErrorEvent.cpp" > </File> <File - RelativePath="..\storage\IDBEvent.h" + RelativePath="..\storage\IDBErrorEvent.h" > </File> <File - RelativePath="..\storage\IDBErrorEvent.cpp" + RelativePath="..\storage\IDBEvent.cpp" > </File> <File - RelativePath="..\storage\IDBErrorEvent.h" + RelativePath="..\storage\IDBEvent.h" > </File> <File @@ -44213,14 +46589,26 @@ > </File> <File - RelativePath="..\storage\IDBObjectStore.cpp" + RelativePath="..\storage\IDBKeyRange.cpp" > </File> <File + RelativePath="..\storage\IDBKeyRange.h" + > + </File> + <File RelativePath="..\storage\IDBObjectStore.h" > </File> <File + RelativePath="..\storage\IDBObjectStoreImpl.cpp" + > + </File> + <File + RelativePath="..\storage\IDBObjectStoreImpl.h" + > + </File> + <File RelativePath="..\storage\IDBObjectStoreRequest.cpp" > </File> @@ -44465,22 +46853,22 @@ > </File> </Filter> - <Filter - Name="strings" - > - <File - RelativePath="$(WebKitOutputDir)\include\private\JavaScriptCore\AtomicString.cpp" - > - </File> - <File - RelativePath="$(WebKitOutputDir)\include\private\JavaScriptCore\StringImpl.cpp" - > - </File> - <File - RelativePath="$(WebKitOutputDir)\include\private\JavaScriptCore\WTFString.cpp" - > - </File> - </Filter> + <Filter + Name="strings" + > + <File + RelativePath="$(WebKitOutputDir)\include\private\JavaScriptCore\AtomicString.cpp" + > + </File> + <File + RelativePath="$(WebKitOutputDir)\include\private\JavaScriptCore\StringImpl.cpp" + > + </File> + <File + RelativePath="$(WebKitOutputDir)\include\private\JavaScriptCore\WTFString.cpp" + > + </File> + </Filter> <Filter Name="bridge" > @@ -44836,6 +47224,10 @@ > </File> <File + RelativePath="..\inspector\front-end\CSSStyleModel.js" + > + </File> + <File RelativePath="..\inspector\front-end\Database.js" > </File> @@ -44888,6 +47280,14 @@ > </File> <File + RelativePath="..\inspector\front-end\HAREntry.js" + > + </File> + <File + RelativePath="..\inspector\front-end\helpScreen.css" + > + </File> + <File RelativePath="..\inspector\front-end\HelpScreen.js" > </File> @@ -44908,10 +47308,6 @@ > </File> <File - RelativePath="..\inspector\front-end\helpScreen.css" - > - </File> - <File RelativePath="..\inspector\front-end\inspector.css" > </File> diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj index 9c825d4..8d6bb96 100644 --- a/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/WebCore/WebCore.xcodeproj/project.pbxproj @@ -932,8 +932,8 @@ 49EECDE010503C2400099FAB /* ArrayBufferView.h in Headers */ = {isa = PBXBuildFile; fileRef = 49EECDC810503C2300099FAB /* ArrayBufferView.h */; }; 49EECDE210503C2400099FAB /* ArrayBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECDCA10503C2300099FAB /* ArrayBuffer.cpp */; }; 49EECDE310503C2400099FAB /* ArrayBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 49EECDCB10503C2300099FAB /* ArrayBuffer.h */; }; - 49EECDE510503C2400099FAB /* FloatArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECDCD10503C2300099FAB /* FloatArray.cpp */; }; - 49EECDE610503C2400099FAB /* FloatArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 49EECDCE10503C2300099FAB /* FloatArray.h */; }; + 49EECDE510503C2400099FAB /* Float32Array.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECDCD10503C2300099FAB /* Float32Array.cpp */; }; + 49EECDE610503C2400099FAB /* Float32Array.h in Headers */ = {isa = PBXBuildFile; fileRef = 49EECDCE10503C2300099FAB /* Float32Array.h */; }; 49EECDE810503C2400099FAB /* Int32Array.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECDD010503C2300099FAB /* Int32Array.cpp */; }; 49EECDE910503C2400099FAB /* Int32Array.h in Headers */ = {isa = PBXBuildFile; fileRef = 49EECDD110503C2300099FAB /* Int32Array.h */; }; 49EECDEB10503C2400099FAB /* Int16Array.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECDD310503C2300099FAB /* Int16Array.cpp */; }; @@ -946,8 +946,8 @@ 49EECDF510503C2400099FAB /* Uint16Array.h in Headers */ = {isa = PBXBuildFile; fileRef = 49EECDDD10503C2400099FAB /* Uint16Array.h */; }; 49EECF00105070C400099FAB /* JSArrayBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECEF2105070C400099FAB /* JSArrayBuffer.cpp */; }; 49EECF01105070C400099FAB /* JSArrayBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 49EECEF3105070C400099FAB /* JSArrayBuffer.h */; }; - 49EECF02105070C400099FAB /* JSFloatArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECEF4105070C400099FAB /* JSFloatArray.cpp */; }; - 49EECF03105070C400099FAB /* JSFloatArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 49EECEF5105070C400099FAB /* JSFloatArray.h */; }; + 49EECF02105070C400099FAB /* JSFloat32Array.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECEF4105070C400099FAB /* JSFloat32Array.cpp */; }; + 49EECF03105070C400099FAB /* JSFloat32Array.h in Headers */ = {isa = PBXBuildFile; fileRef = 49EECEF5105070C400099FAB /* JSFloat32Array.h */; }; 49EECF04105070C400099FAB /* JSInt32Array.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECEF6105070C400099FAB /* JSInt32Array.cpp */; }; 49EECF05105070C400099FAB /* JSInt32Array.h in Headers */ = {isa = PBXBuildFile; fileRef = 49EECEF7105070C400099FAB /* JSInt32Array.h */; }; 49EECF06105070C400099FAB /* JSInt16Array.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECEF8105070C400099FAB /* JSInt16Array.cpp */; }; @@ -961,7 +961,7 @@ 49EECF1B105072F300099FAB /* JSArrayBufferView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECF19105072F300099FAB /* JSArrayBufferView.cpp */; }; 49EECF1C105072F300099FAB /* JSArrayBufferView.h in Headers */ = {isa = PBXBuildFile; fileRef = 49EECF1A105072F300099FAB /* JSArrayBufferView.h */; }; 49EECF7810508D9C00099FAB /* JSInt8ArrayCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECF7110508D9C00099FAB /* JSInt8ArrayCustom.cpp */; }; - 49EECF7910508D9C00099FAB /* JSFloatArrayCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECF7210508D9C00099FAB /* JSFloatArrayCustom.cpp */; }; + 49EECF7910508D9C00099FAB /* JSFloat32ArrayCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECF7210508D9C00099FAB /* JSFloat32ArrayCustom.cpp */; }; 49EECF7A10508D9C00099FAB /* JSInt32ArrayCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECF7310508D9C00099FAB /* JSInt32ArrayCustom.cpp */; }; 49EECF7B10508D9C00099FAB /* JSInt16ArrayCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECF7410508D9C00099FAB /* JSInt16ArrayCustom.cpp */; }; 49EECF7C10508D9C00099FAB /* JSUint8ArrayCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECF7510508D9C00099FAB /* JSUint8ArrayCustom.cpp */; }; @@ -971,8 +971,8 @@ 49EECFAC1050938200099FAB /* JSArrayBufferConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 49EECF9A1050938200099FAB /* JSArrayBufferConstructor.h */; }; 49EECFAD1050938200099FAB /* JSInt8ArrayConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECF9B1050938200099FAB /* JSInt8ArrayConstructor.cpp */; }; 49EECFAE1050938200099FAB /* JSInt8ArrayConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 49EECF9C1050938200099FAB /* JSInt8ArrayConstructor.h */; }; - 49EECFAF1050938200099FAB /* JSFloatArrayConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECF9D1050938200099FAB /* JSFloatArrayConstructor.cpp */; }; - 49EECFB01050938200099FAB /* JSFloatArrayConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 49EECF9E1050938200099FAB /* JSFloatArrayConstructor.h */; }; + 49EECFAF1050938200099FAB /* JSFloat32ArrayConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECF9D1050938200099FAB /* JSFloat32ArrayConstructor.cpp */; }; + 49EECFB01050938200099FAB /* JSFloat32ArrayConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 49EECF9E1050938200099FAB /* JSFloat32ArrayConstructor.h */; }; 49EECFB11050938200099FAB /* JSInt32ArrayConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECF9F1050938200099FAB /* JSInt32ArrayConstructor.cpp */; }; 49EECFB21050938200099FAB /* JSInt32ArrayConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 49EECFA01050938200099FAB /* JSInt32ArrayConstructor.h */; }; 49EECFB51050938200099FAB /* JSInt16ArrayConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECFA31050938200099FAB /* JSInt16ArrayConstructor.cpp */; }; @@ -1014,6 +1014,8 @@ 4E19592C0A39DACC00220FE5 /* MediaQueryEvaluator.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E1959260A39DACC00220FE5 /* MediaQueryEvaluator.h */; }; 4E19592D0A39DACC00220FE5 /* MediaQueryExp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4E1959270A39DACC00220FE5 /* MediaQueryExp.cpp */; }; 4E19592E0A39DACC00220FE5 /* MediaQueryExp.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E1959280A39DACC00220FE5 /* MediaQueryExp.h */; }; + 4F1534DE11B532EC0021FD86 /* EditingBehavior.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F1534DD11B532EC0021FD86 /* EditingBehavior.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 4F1534E011B533020021FD86 /* EditingBehaviorTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F1534DF11B533020021FD86 /* EditingBehaviorTypes.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4F3289B511A42AAB005ABE7E /* InspectorValues.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4F3289B311A42AAB005ABE7E /* InspectorValues.cpp */; }; 4F3289B611A42AAB005ABE7E /* InspectorValues.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F3289B411A42AAB005ABE7E /* InspectorValues.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4FD8D0F2119C718B002FA825 /* ScriptGCEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4FD8D0F0119C718B002FA825 /* ScriptGCEvent.cpp */; }; @@ -1163,7 +1165,7 @@ 51FAFE340CECBF2D00BB3F24 /* DatabaseTrackerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 51FAFE330CECBF2D00BB3F24 /* DatabaseTrackerClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; 521D46F611AEC98100514613 /* KillRingMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 521D46F511AEC98100514613 /* KillRingMac.mm */; }; 521D46F811AEC9B100514613 /* KillRing.h in Headers */ = {isa = PBXBuildFile; fileRef = 521D46F711AEC9B100514613 /* KillRing.h */; }; - 54C50F7B0E801DF3009832A0 /* XMLTokenizerLibxml2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 54C50F7A0E801DF3009832A0 /* XMLTokenizerLibxml2.cpp */; }; + 54C50F7B0E801DF3009832A0 /* XMLDocumentParserLibxml2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 54C50F7A0E801DF3009832A0 /* XMLDocumentParserLibxml2.cpp */; }; 550A0BC9085F6039007353D6 /* QualifiedName.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 550A0BC7085F6039007353D6 /* QualifiedName.cpp */; }; 550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */ = {isa = PBXBuildFile; fileRef = 550A0BC8085F6039007353D6 /* QualifiedName.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5913953B110758450083EC55 /* JNIBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 5913953A110758450083EC55 /* JNIBridge.h */; }; @@ -1183,8 +1185,6 @@ 59B597731108656B007159E8 /* BridgeJSC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59B597721108656B007159E8 /* BridgeJSC.cpp */; }; 59B5977511086579007159E8 /* BridgeJSC.h in Headers */ = {isa = PBXBuildFile; fileRef = 59B5977411086579007159E8 /* BridgeJSC.h */; settings = {ATTRIBUTES = (Private, ); }; }; 59BC393F11054A1300FD85DB /* JavaStringJSC.h in Headers */ = {isa = PBXBuildFile; fileRef = 59BC393E11054A1300FD85DB /* JavaStringJSC.h */; }; - 59C77F2A10545B3B00506104 /* GeolocationServiceMock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59C77F2810545B3B00506104 /* GeolocationServiceMock.cpp */; }; - 59C77F2B10545B3B00506104 /* GeolocationServiceMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 59C77F2910545B3B00506104 /* GeolocationServiceMock.h */; settings = {ATTRIBUTES = (Private, ); }; }; 59E560A71105336600AA1258 /* JavaClassJSC.h in Headers */ = {isa = PBXBuildFile; fileRef = 59E560A61105336600AA1258 /* JavaClassJSC.h */; }; 59E560A91105336F00AA1258 /* JavaClassJSC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59E560A81105336F00AA1258 /* JavaClassJSC.cpp */; }; 59E842661109E5A2000305AD /* JNIBridgeJSC.h in Headers */ = {isa = PBXBuildFile; fileRef = 59E842651109E5A2000305AD /* JNIBridgeJSC.h */; }; @@ -1193,8 +1193,8 @@ 59EE122E1106080F00885116 /* JNIUtilityPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EE122D1106080F00885116 /* JNIUtilityPrivate.h */; }; 59EE12301106081F00885116 /* JNIUtility.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59EE122F1106081F00885116 /* JNIUtility.cpp */; }; 59EE12321106082900885116 /* JNIUtility.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EE12311106082900885116 /* JNIUtility.h */; }; - 5D15E3AB0F9E6AC1009E0E3F /* XMLTokenizerScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5D15E3A90F9E6AC1009E0E3F /* XMLTokenizerScope.cpp */; }; - 5D15E3AC0F9E6AC1009E0E3F /* XMLTokenizerScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D15E3AA0F9E6AC1009E0E3F /* XMLTokenizerScope.h */; }; + 5D15E3AB0F9E6AC1009E0E3F /* XMLDocumentParserScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5D15E3A90F9E6AC1009E0E3F /* XMLDocumentParserScope.cpp */; }; + 5D15E3AC0F9E6AC1009E0E3F /* XMLDocumentParserScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D15E3AA0F9E6AC1009E0E3F /* XMLDocumentParserScope.h */; }; 5D874F130D161D3200796C3B /* NetscapePlugInStreamLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93E227DD0AF589AD00D48324 /* NetscapePlugInStreamLoader.cpp */; }; 5D88EE9111407FD300BC3ABC /* DOMSVGFEMorphologyElement.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 84224189107E786F00766A87 /* DOMSVGFEMorphologyElement.h */; }; 5D88EE9211407FF400BC3ABC /* DOMSVGFEMorphologyElementInternal.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 8422418B107E786F00766A87 /* DOMSVGFEMorphologyElementInternal.h */; }; @@ -1371,6 +1371,10 @@ 7AED3E060FBB1EAA00D2B03C /* InspectorFrontend.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AED3E040FBB1EAA00D2B03C /* InspectorFrontend.h */; }; 7AFD4A8B1131C2760035B883 /* ScriptBreakpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AFD4A8A1131C2760035B883 /* ScriptBreakpoint.h */; settings = {ATTRIBUTES = (Private, ); }; }; 7AFD4FF4113277B60035B883 /* ScriptDebugListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AFD4FF3113277B60035B883 /* ScriptDebugListener.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 816C806811BE887E009A45E9 /* IDBKeyRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 816C806611BE887E009A45E9 /* IDBKeyRange.cpp */; }; + 816C806911BE887E009A45E9 /* IDBKeyRange.h in Headers */ = {isa = PBXBuildFile; fileRef = 816C806711BE887E009A45E9 /* IDBKeyRange.h */; }; + 816C80AF11BE990D009A45E9 /* JSIDBKeyRange.h in Headers */ = {isa = PBXBuildFile; fileRef = 816C80AE11BE990D009A45E9 /* JSIDBKeyRange.h */; }; + 816C80B111BE9934009A45E9 /* JSIDBKeyRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 816C80B011BE9934009A45E9 /* JSIDBKeyRange.cpp */; }; 82B658981189E39200E052A1 /* InspectorCSSStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 82B658971189E39200E052A1 /* InspectorCSSStore.h */; settings = {ATTRIBUTES = (Private, ); }; }; 82B6589A1189E47600E052A1 /* InspectorCSSStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 82B658991189E47600E052A1 /* InspectorCSSStore.cpp */; }; 841FDC261178C9BE00F8AC9B /* RenderSVGResourceFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 841FDC241178C9BE00F8AC9B /* RenderSVGResourceFilter.cpp */; }; @@ -2272,6 +2276,7 @@ 85F74E0A0AA8DF8C000DC284 /* DOMCSSUnknownRule.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 85032DD50AA8C9BE007D3B7D /* DOMCSSUnknownRule.h */; }; 85FF315A0AAFBFCB00374F38 /* DOMKeyboardEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 85FF31580AAFBFCB00374F38 /* DOMKeyboardEvent.h */; }; 85FF315B0AAFBFCB00374F38 /* DOMKeyboardEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = 85FF31590AAFBFCB00374F38 /* DOMKeyboardEvent.mm */; }; + 86243D0111BC31F700CC006A /* JSArrayBufferViewHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 86243D0011BC31F700CC006A /* JSArrayBufferViewHelper.h */; }; 8952535211641B3400CABF00 /* FileThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8952535011641B3400CABF00 /* FileThread.cpp */; }; 8952535311641B3400CABF00 /* FileThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 8952535111641B3400CABF00 /* FileThread.h */; }; 895253D7116C4C6800CABF00 /* FileStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 895253D4116C4C6800CABF00 /* FileStream.cpp */; }; @@ -2280,6 +2285,8 @@ 895253DC116C4EF500CABF00 /* FileStreamProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 895253DA116C4EF500CABF00 /* FileStreamProxy.cpp */; }; 895253DD116C4EF500CABF00 /* FileStreamProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 895253DB116C4EF500CABF00 /* FileStreamProxy.h */; }; 895253DF116C4F0600CABF00 /* FileThreadTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 895253DE116C4F0600CABF00 /* FileThreadTask.h */; }; + 8988E10E11A3508B00DB732E /* BlobItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8988E10C11A3508B00DB732E /* BlobItem.cpp */; }; + 8988E10F11A3508B00DB732E /* BlobItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 8988E10D11A3508B00DB732E /* BlobItem.h */; settings = {ATTRIBUTES = (Private, ); }; }; 8FAC774D119872CB0015AE94 /* JSMainThreadExecState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8F934D841189F1EE00508D5D /* JSMainThreadExecState.cpp */; }; 9302B0BD0D79F82900C7EE83 /* PageGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9302B0BC0D79F82900C7EE83 /* PageGroup.cpp */; }; 9302B0BF0D79F82C00C7EE83 /* PageGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = 9302B0BE0D79F82C00C7EE83 /* PageGroup.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -2481,11 +2488,11 @@ 93EB355F09E37FD600F43799 /* MouseEventWithHitTestResults.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93EB355E09E37FD600F43799 /* MouseEventWithHitTestResults.cpp */; }; 93F198E508245E59001E9ABC /* HTMLDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D23C02DE4396018635CA /* HTMLDocument.h */; settings = {ATTRIBUTES = (Private, ); }; }; 93F198E608245E59001E9ABC /* HTMLElement.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D23F02DE4396018635CA /* HTMLElement.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 93F198EF08245E59001E9ABC /* HTMLParser.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D25102DE4396018635CA /* HTMLParser.h */; }; - 93F198F008245E59001E9ABC /* HTMLTokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D25302DE4396018635CA /* HTMLTokenizer.h */; }; + 93F198EF08245E59001E9ABC /* LegacyHTMLTreeConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D25102DE4396018635CA /* LegacyHTMLTreeConstructor.h */; }; + 93F198F008245E59001E9ABC /* HTMLDocumentParser.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D25302DE4396018635CA /* HTMLDocumentParser.h */; }; 93F198F608245E59001E9ABC /* TextResourceDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D27902DE43D7018635CA /* TextResourceDecoder.h */; settings = {ATTRIBUTES = (Private, ); }; }; 93F1991808245E59001E9ABC /* Range.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D30402DE4476018635CA /* Range.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 93F1992108245E59001E9ABC /* XMLTokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D30A02DE4476018635CA /* XMLTokenizer.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 93F1992108245E59001E9ABC /* XMLDocumentParser.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D30A02DE4476018635CA /* XMLDocumentParser.h */; settings = {ATTRIBUTES = (Private, ); }; }; 93F1992F08245E59001E9ABC /* Cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = F587868402DE3B8601EA4122 /* Cursor.h */; settings = {ATTRIBUTES = (Private, ); }; }; 93F1994F08245E59001E9ABC /* Settings.h in Headers */ = {isa = PBXBuildFile; fileRef = F587863A02DE3A1401EA4122 /* Settings.h */; settings = {ATTRIBUTES = (Private, ); }; }; 93F1995008245E59001E9ABC /* CachePolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = F587864902DE3A9A01EA4122 /* CachePolicy.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -2511,11 +2518,11 @@ 93F19A5F08245E59001E9ABC /* WebCoreViewFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = F587855502DE375901EA4122 /* WebCoreViewFactory.m */; }; 93F19A9108245E59001E9ABC /* HTMLDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D23B02DE4396018635CA /* HTMLDocument.cpp */; }; 93F19A9208245E59001E9ABC /* HTMLElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D23E02DE4396018635CA /* HTMLElement.cpp */; }; - 93F19A9B08245E59001E9ABC /* HTMLParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D25002DE4396018635CA /* HTMLParser.cpp */; }; - 93F19A9C08245E59001E9ABC /* HTMLTokenizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D25202DE4396018635CA /* HTMLTokenizer.cpp */; }; + 93F19A9B08245E59001E9ABC /* LegacyHTMLTreeConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D25002DE4396018635CA /* LegacyHTMLTreeConstructor.cpp */; }; + 93F19A9C08245E59001E9ABC /* HTMLDocumentParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D25202DE4396018635CA /* HTMLDocumentParser.cpp */; }; 93F19A9D08245E59001E9ABC /* TextResourceDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D27802DE43D7018635CA /* TextResourceDecoder.cpp */; }; 93F19AB908245E59001E9ABC /* Range.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D30302DE4476018635CA /* Range.cpp */; }; - 93F19ABC08245E59001E9ABC /* XMLTokenizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D30902DE4476018635CA /* XMLTokenizer.cpp */; }; + 93F19ABC08245E59001E9ABC /* XMLDocumentParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D30902DE4476018635CA /* XMLDocumentParser.cpp */; }; 93F19AD508245E59001E9ABC /* RenderTreeAsText.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93955A4203D72932008635CE /* RenderTreeAsText.cpp */; }; 93F19AE108245E59001E9ABC /* BlockExceptions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 65F80697054D9F86008BF776 /* BlockExceptions.mm */; }; 93F19AE508245E59001E9ABC /* WebCoreKeyGenerator.m in Sources */ = {isa = PBXBuildFile; fileRef = 84B2B1F8056BEF3A00D2B771 /* WebCoreKeyGenerator.m */; }; @@ -2552,6 +2559,8 @@ 973889A1116EA9DC00ADF313 /* DocumentWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 9738899F116EA9DC00ADF313 /* DocumentWriter.h */; settings = {ATTRIBUTES = (Private, ); }; }; 973E325610883B7C005BC493 /* ResourceLoadNotifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 973E325410883B7C005BC493 /* ResourceLoadNotifier.cpp */; }; 973E325710883B7C005BC493 /* ResourceLoadNotifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 973E325510883B7C005BC493 /* ResourceLoadNotifier.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 976E896011C0CA3A00EA9CA9 /* HTML5EntityParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 976E895E11C0CA3A00EA9CA9 /* HTML5EntityParser.cpp */; }; + 976E896111C0CA3A00EA9CA9 /* HTML5EntityParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 976E895F11C0CA3A00EA9CA9 /* HTML5EntityParser.h */; }; 979F43D31075E44A0000F83B /* RedirectScheduler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 979F43D11075E44A0000F83B /* RedirectScheduler.cpp */; }; 979F43D41075E44A0000F83B /* RedirectScheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = 979F43D21075E44A0000F83B /* RedirectScheduler.h */; settings = {ATTRIBUTES = (Private, ); }; }; 97C078501165D5BE003A32EF /* SuffixTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 97C0784F1165D5BE003A32EF /* SuffixTree.h */; }; @@ -2574,6 +2583,10 @@ 9FA37EFB1172FDA600C4CD55 /* JSScriptProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 9FA37EF71172FD9300C4CD55 /* JSScriptProfile.h */; }; 9FA37EFC1172FDA600C4CD55 /* JSScriptProfileNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9FA37EF81172FD9300C4CD55 /* JSScriptProfileNode.cpp */; }; 9FA37EFD1172FDA600C4CD55 /* JSScriptProfileNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 9FA37EF91172FD9300C4CD55 /* JSScriptProfileNode.h */; }; + 9FFE3E7A11B59C5D0037874E /* MemoryInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9FFE3E7811B59C5D0037874E /* MemoryInfo.cpp */; }; + 9FFE3E7B11B59C5D0037874E /* MemoryInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 9FFE3E7911B59C5D0037874E /* MemoryInfo.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 9FFE3EA511B5A4390037874E /* JSMemoryInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9FFE3EA311B5A4390037874E /* JSMemoryInfo.cpp */; }; + 9FFE3EA611B5A4390037874E /* JSMemoryInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 9FFE3EA411B5A4390037874E /* JSMemoryInfo.h */; }; A136A00C1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A136A00A1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp */; }; A136A00D1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.h in Headers */ = {isa = PBXBuildFile; fileRef = A136A00B1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.h */; }; A17C81220F2A5CF7005DAAEB /* HTMLElementFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A17C81200F2A5CF7005DAAEB /* HTMLElementFactory.cpp */; }; @@ -2625,6 +2638,8 @@ A7AD2F870EC89D07008AB002 /* LinkHash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7AD2F850EC89D07008AB002 /* LinkHash.cpp */; }; A7AD2F880EC89D07008AB002 /* LinkHash.h in Headers */ = {isa = PBXBuildFile; fileRef = A7AD2F860EC89D07008AB002 /* LinkHash.h */; settings = {ATTRIBUTES = (Private, ); }; }; A7B6E69F0B291A9600D0529F /* DragData.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B6E69D0B291A9600D0529F /* DragData.h */; settings = {ATTRIBUTES = (Private, ); }; }; + A7BBE26611AFB3F20005EA03 /* JSHTMLMeterElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7BBE26411AFB3F20005EA03 /* JSHTMLMeterElement.cpp */; }; + A7BBE26711AFB3F20005EA03 /* JSHTMLMeterElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A7BBE26511AFB3F20005EA03 /* JSHTMLMeterElement.h */; }; A7CA595D0B27BD9E00FA021D /* DragController.h in Headers */ = {isa = PBXBuildFile; fileRef = A7CA595B0B27BD9E00FA021D /* DragController.h */; settings = {ATTRIBUTES = (Private, ); }; }; A7CA595E0B27BD9E00FA021D /* DragController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7CA595C0B27BD9E00FA021D /* DragController.cpp */; }; A7CA59630B27C1F200FA021D /* DragClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A7CA59620B27C1F200FA021D /* DragClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -2639,6 +2654,8 @@ A7D3C5240B576B4B002CA450 /* PasteboardHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D3C5230B576B4B002CA450 /* PasteboardHelper.h */; settings = {ATTRIBUTES = (Private, ); }; }; A7D6B3490F61104500B79FD1 /* WorkerScriptLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D6B3470F61104500B79FD1 /* WorkerScriptLoader.h */; }; A7D6B34A0F61104500B79FD1 /* WorkerScriptLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7D6B3480F61104500B79FD1 /* WorkerScriptLoader.cpp */; }; + A7F338A311C0EFCA00A320A7 /* ShadowElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7F338A111C0EFCA00A320A7 /* ShadowElement.cpp */; }; + A7F338A411C0EFCA00A320A7 /* ShadowElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A7F338A211C0EFCA00A320A7 /* ShadowElement.h */; }; A809F1470B73793A002E4D7F /* RenderSVGGradientStop.h in Headers */ = {isa = PBXBuildFile; fileRef = A809F1450B73793A002E4D7F /* RenderSVGGradientStop.h */; }; A809F1480B73793B002E4D7F /* RenderSVGGradientStop.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A809F1460B73793A002E4D7F /* RenderSVGGradientStop.cpp */; }; A809F1AA0B737FB6002E4D7F /* RenderSVGHiddenContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = A809F1A80B737FB6002E4D7F /* RenderSVGHiddenContainer.h */; }; @@ -2957,8 +2974,8 @@ A86629D209DA2B48009633A5 /* JSMouseEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A86629CC09DA2B47009633A5 /* JSMouseEvent.cpp */; }; A86629D309DA2B48009633A5 /* JSKeyboardEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A86629CD09DA2B47009633A5 /* JSKeyboardEvent.h */; }; A86629D409DA2B48009633A5 /* JSKeyboardEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A86629CE09DA2B47009633A5 /* JSKeyboardEvent.cpp */; }; - A871038A11A2947000DBD50E /* HTML5Tokenizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871038811A2947000DBD50E /* HTML5Tokenizer.cpp */; }; - A871038B11A2947000DBD50E /* HTML5Tokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = A871038911A2947000DBD50E /* HTML5Tokenizer.h */; }; + A871038A11A2947000DBD50E /* HTML5DocumentParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871038811A2947000DBD50E /* HTML5DocumentParser.cpp */; }; + A871038B11A2947000DBD50E /* HTML5DocumentParser.h in Headers */ = {isa = PBXBuildFile; fileRef = A871038911A2947000DBD50E /* HTML5DocumentParser.h */; }; A871D4560A127CBC00B12A68 /* HTMLPlugInElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A871D44C0A127CBC00B12A68 /* HTMLPlugInElement.h */; settings = {ATTRIBUTES = (Private, ); }; }; A871D4570A127CBC00B12A68 /* HTMLPlugInElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871D44D0A127CBC00B12A68 /* HTMLPlugInElement.cpp */; }; A871D4580A127CBC00B12A68 /* HTMLParamElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A871D44E0A127CBC00B12A68 /* HTMLParamElement.h */; }; @@ -3500,6 +3517,10 @@ ABDDFE7A0A5C6E7000A3E11D /* RenderMenuList.h in Headers */ = {isa = PBXBuildFile; fileRef = ABDDFE740A5C6E7000A3E11D /* RenderMenuList.h */; }; ABFE7E120D32FAF60066F4D2 /* MediaControlElements.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABFE7E100D32FAF50066F4D2 /* MediaControlElements.cpp */; }; ABFE7E130D32FAF60066F4D2 /* MediaControlElements.h in Headers */ = {isa = PBXBuildFile; fileRef = ABFE7E110D32FAF50066F4D2 /* MediaControlElements.h */; }; + B0149E7D11A4B21500196A7B /* AsyncImageResizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B0149E7911A4B21500196A7B /* AsyncImageResizer.cpp */; }; + B0149E7E11A4B21500196A7B /* AsyncImageResizer.h in Headers */ = {isa = PBXBuildFile; fileRef = B0149E7A11A4B21500196A7B /* AsyncImageResizer.h */; }; + B0149E7F11A4B21500196A7B /* ImageResizerThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B0149E7B11A4B21500196A7B /* ImageResizerThread.cpp */; }; + B0149E8011A4B21500196A7B /* ImageResizerThread.h in Headers */ = {isa = PBXBuildFile; fileRef = B0149E7C11A4B21500196A7B /* ImageResizerThread.h */; }; B20111070AB7740500DB0E68 /* JSSVGAElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B20111050AB7740500DB0E68 /* JSSVGAElement.cpp */; }; B20111080AB7740500DB0E68 /* JSSVGAElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B20111060AB7740500DB0E68 /* JSSVGAElement.h */; }; B21127A60B3186770009BE53 /* JSSVGPODTypeWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = B21127A50B3186770009BE53 /* JSSVGPODTypeWrapper.h */; }; @@ -4239,12 +4260,13 @@ B5C1123C102B6C4600096578 /* SQLTransactionCoordinator.h in Headers */ = {isa = PBXBuildFile; fileRef = B5C1123A102B6C4600096578 /* SQLTransactionCoordinator.h */; }; B5D3601A112F8B560048DEA8 /* DatabaseCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = B5D36019112F8B560048DEA8 /* DatabaseCallback.h */; }; B627FB2D11AD743500E97B72 /* IDBDatabaseImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50AD2A911AC1631008CF2FB /* IDBDatabaseImpl.cpp */; }; - B6693EEB11AD63E6003F2770 /* IDBObjectStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6693EE711AD63E6003F2770 /* IDBObjectStore.cpp */; }; B6693EEC11AD63E6003F2770 /* IDBObjectStore.h in Headers */ = {isa = PBXBuildFile; fileRef = B6693EE811AD63E6003F2770 /* IDBObjectStore.h */; }; B6693EED11AD63E6003F2770 /* IDBObjectStoreRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6693EE911AD63E6003F2770 /* IDBObjectStoreRequest.cpp */; }; B6693EEE11AD63E6003F2770 /* IDBObjectStoreRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = B6693EEA11AD63E6003F2770 /* IDBObjectStoreRequest.h */; }; B6693EF211AD6486003F2770 /* JSIDBObjectStoreRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6693EF011AD6486003F2770 /* JSIDBObjectStoreRequest.cpp */; }; B6693EF311AD6486003F2770 /* JSIDBObjectStoreRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = B6693EF111AD6486003F2770 /* JSIDBObjectStoreRequest.h */; }; + B6B0540911B68F10002564C5 /* IDBObjectStoreImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6B0540711B68F10002564C5 /* IDBObjectStoreImpl.cpp */; }; + B6B0540A11B68F10002564C5 /* IDBObjectStoreImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = B6B0540811B68F10002564C5 /* IDBObjectStoreImpl.h */; }; B71FE6DF11091CB300DAEF77 /* PrintContext.h in Headers */ = {isa = PBXBuildFile; fileRef = B776D43A1104525D00BEB0EC /* PrintContext.h */; settings = {ATTRIBUTES = (Private, ); }; }; B734B181119B9911006587BD /* FontTranscoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B734B180119B9911006587BD /* FontTranscoder.cpp */; }; B734B183119B991D006587BD /* FontTranscoder.h in Headers */ = {isa = PBXBuildFile; fileRef = B734B182119B991D006587BD /* FontTranscoder.h */; }; @@ -4339,8 +4361,6 @@ BC348BBE0DB7F531004ABAB9 /* JSXMLHttpRequestCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC348BBD0DB7F531004ABAB9 /* JSXMLHttpRequestCustom.cpp */; }; BC348BD30DB7F804004ABAB9 /* JSXMLHttpRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC348BD10DB7F804004ABAB9 /* JSXMLHttpRequest.cpp */; }; BC348BD40DB7F804004ABAB9 /* JSXMLHttpRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = BC348BD20DB7F804004ABAB9 /* JSXMLHttpRequest.h */; }; - BC348BE90DB80354004ABAB9 /* JSXMLHttpRequestConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC348BE70DB80354004ABAB9 /* JSXMLHttpRequestConstructor.cpp */; }; - BC348BEA0DB80354004ABAB9 /* JSXMLHttpRequestConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC348BE80DB80354004ABAB9 /* JSXMLHttpRequestConstructor.h */; }; BC3BC29C0E91AB0F00835588 /* HostWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = BC3BC29B0E91AB0F00835588 /* HostWindow.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC3BE12B0E98092F00835588 /* PopupMenuStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = BC3BE12A0E98092F00835588 /* PopupMenuStyle.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC3BE9930E9C1C7C00835588 /* RenderScrollbar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC3BE9900E9C1C7C00835588 /* RenderScrollbar.cpp */; }; @@ -4655,7 +4675,7 @@ BCCD74DC0A4C8D35005FDA6D /* HTMLViewSourceDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCD74DB0A4C8D35005FDA6D /* HTMLViewSourceDocument.h */; }; BCCD74E50A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCD74E40A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp */; }; BCCE58AC1061E8CF008FB35A /* JSDatabaseCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCE58AB1061E8CF008FB35A /* JSDatabaseCustom.cpp */; }; - BCCFBAE80B5152ED0001F1D7 /* Tokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCFBAE70B5152ED0001F1D7 /* Tokenizer.h */; settings = {ATTRIBUTES = (Private, ); }; }; + BCCFBAE80B5152ED0001F1D7 /* DocumentParser.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCFBAE70B5152ED0001F1D7 /* DocumentParser.h */; settings = {ATTRIBUTES = (Private, ); }; }; BCD0E0FA0E972C3500265DEA /* SecurityOrigin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD0E0F70E972C3500265DEA /* SecurityOrigin.cpp */; }; BCD0E0FB0E972C3500265DEA /* SecurityOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD0E0F80E972C3500265DEA /* SecurityOrigin.h */; settings = {ATTRIBUTES = (Private, ); }; }; BCD0E0FC0E972C3500265DEA /* SecurityOriginHash.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD0E0F90E972C3500265DEA /* SecurityOriginHash.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -4691,8 +4711,6 @@ BCE1C4400D9830F4003B02F2 /* JSLocationCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE1C43F0D9830F4003B02F2 /* JSLocationCustom.cpp */; }; BCE3BEC20D222B1D007E06E4 /* TagNodeList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE3BEC00D222B1D007E06E4 /* TagNodeList.cpp */; }; BCE3BEC30D222B1D007E06E4 /* TagNodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE3BEC10D222B1D007E06E4 /* TagNodeList.h */; }; - BCE494AB0F4F5E9E0084E319 /* GeolocationServiceMac.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE494A90F4F5E9E0084E319 /* GeolocationServiceMac.h */; settings = {ATTRIBUTES = (); }; }; - BCE494AC0F4F5E9E0084E319 /* GeolocationServiceMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCE494AA0F4F5E9E0084E319 /* GeolocationServiceMac.mm */; }; BCE658FF0EA9248A007E4533 /* Theme.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE658FE0EA9248A007E4533 /* Theme.h */; settings = {ATTRIBUTES = (Private, ); }; }; BCE659A90EA927B9007E4533 /* ThemeTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE659A80EA927B9007E4533 /* ThemeTypes.h */; settings = {ATTRIBUTES = (Private, ); }; }; BCE659E60EA92FB2007E4533 /* ThemeMac.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE659E50EA92FB2007E4533 /* ThemeMac.h */; }; @@ -4895,6 +4913,7 @@ E10B9B6D0B747599003ED890 /* NativeXPathNSResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E10B9B6B0B747599003ED890 /* NativeXPathNSResolver.cpp */; }; E10B9CCC0B747A44003ED890 /* DOMCustomXPathNSResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = E10B9CCA0B747A44003ED890 /* DOMCustomXPathNSResolver.h */; }; E10B9CCD0B747A44003ED890 /* DOMCustomXPathNSResolver.mm in Sources */ = {isa = PBXBuildFile; fileRef = E10B9CCB0B747A44003ED890 /* DOMCustomXPathNSResolver.mm */; }; + E11AF15111B9A1A300805103 /* Cursor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E11AF15011B9A1A300805103 /* Cursor.cpp */; }; E11C9D9B0EB3681200E409DB /* ScriptExecutionContext.h in Headers */ = {isa = PBXBuildFile; fileRef = E11C9D9A0EB3681200E409DB /* ScriptExecutionContext.h */; settings = {ATTRIBUTES = (Private, ); }; }; E11C9DB00EB3699500E409DB /* ScriptExecutionContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E11C9DAF0EB3699500E409DB /* ScriptExecutionContext.cpp */; }; E124748410AA161D00B79493 /* AuthenticationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = E124748310AA161D00B79493 /* AuthenticationClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -5058,6 +5077,8 @@ F5D3A57D106B83B300545297 /* DateComponents.h in Headers */ = {isa = PBXBuildFile; fileRef = F5D3A57B106B83B300545297 /* DateComponents.h */; settings = {ATTRIBUTES = (Private, ); }; }; F916C48D0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F916C48B0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.cpp */; }; F916C48E0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = F916C48C0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.h */; }; + F98FFF4411A2676200F548E8 /* CSSOMUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F98FFF4211A2676200F548E8 /* CSSOMUtils.cpp */; }; + F98FFF4511A2676200F548E8 /* CSSOMUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = F98FFF4311A2676200F548E8 /* CSSOMUtils.h */; }; F9F0ED7A0DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = F9F0ED770DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.h */; }; FA0B1F8611125CEE007F9839 /* RenderMathMLMath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B1F8211125CEE007F9839 /* RenderMathMLMath.cpp */; }; FA0B1F8711125CEE007F9839 /* RenderMathMLMath.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B1F8311125CEE007F9839 /* RenderMathMLMath.h */; }; @@ -5105,8 +5126,6 @@ FE80DA660E9C4703000D6F75 /* JSGeoposition.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80DA620E9C4703000D6F75 /* JSGeoposition.h */; }; FE80DA710E9C472F000D6F75 /* JSPositionError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE80DA6D0E9C472F000D6F75 /* JSPositionError.cpp */; }; FE80DA720E9C472F000D6F75 /* JSPositionError.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80DA6E0E9C472F000D6F75 /* JSPositionError.h */; }; - FEAB90120EA51B9C006348C3 /* GeolocationService.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEAB90100EA51B9C006348C3 /* GeolocationService.cpp */; }; - FEAB90130EA51B9C006348C3 /* GeolocationService.h in Headers */ = {isa = PBXBuildFile; fileRef = FEAB90110EA51B9C006348C3 /* GeolocationService.h */; settings = {ATTRIBUTES = (Private, ); }; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -6535,9 +6554,9 @@ 49EECDCA10503C2300099FAB /* ArrayBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ArrayBuffer.cpp; path = canvas/ArrayBuffer.cpp; sourceTree = "<group>"; }; 49EECDCB10503C2300099FAB /* ArrayBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ArrayBuffer.h; path = canvas/ArrayBuffer.h; sourceTree = "<group>"; }; 49EECDCC10503C2300099FAB /* ArrayBuffer.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = ArrayBuffer.idl; path = canvas/ArrayBuffer.idl; sourceTree = "<group>"; }; - 49EECDCD10503C2300099FAB /* FloatArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FloatArray.cpp; path = canvas/FloatArray.cpp; sourceTree = "<group>"; }; - 49EECDCE10503C2300099FAB /* FloatArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FloatArray.h; path = canvas/FloatArray.h; sourceTree = "<group>"; }; - 49EECDCF10503C2300099FAB /* FloatArray.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = FloatArray.idl; path = canvas/FloatArray.idl; sourceTree = "<group>"; }; + 49EECDCD10503C2300099FAB /* Float32Array.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Float32Array.cpp; path = canvas/Float32Array.cpp; sourceTree = "<group>"; }; + 49EECDCE10503C2300099FAB /* Float32Array.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Float32Array.h; path = canvas/Float32Array.h; sourceTree = "<group>"; }; + 49EECDCF10503C2300099FAB /* Float32Array.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Float32Array.idl; path = canvas/Float32Array.idl; sourceTree = "<group>"; }; 49EECDD010503C2300099FAB /* Int32Array.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Int32Array.cpp; path = canvas/Int32Array.cpp; sourceTree = "<group>"; }; 49EECDD110503C2300099FAB /* Int32Array.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Int32Array.h; path = canvas/Int32Array.h; sourceTree = "<group>"; }; 49EECDD210503C2300099FAB /* Int32Array.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Int32Array.idl; path = canvas/Int32Array.idl; sourceTree = "<group>"; }; @@ -6555,8 +6574,8 @@ 49EECDDE10503C2400099FAB /* Uint16Array.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Uint16Array.idl; path = canvas/Uint16Array.idl; sourceTree = "<group>"; }; 49EECEF2105070C400099FAB /* JSArrayBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSArrayBuffer.cpp; sourceTree = "<group>"; }; 49EECEF3105070C400099FAB /* JSArrayBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSArrayBuffer.h; sourceTree = "<group>"; }; - 49EECEF4105070C400099FAB /* JSFloatArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFloatArray.cpp; sourceTree = "<group>"; }; - 49EECEF5105070C400099FAB /* JSFloatArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFloatArray.h; sourceTree = "<group>"; }; + 49EECEF4105070C400099FAB /* JSFloat32Array.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFloat32Array.cpp; sourceTree = "<group>"; }; + 49EECEF5105070C400099FAB /* JSFloat32Array.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFloat32Array.h; sourceTree = "<group>"; }; 49EECEF6105070C400099FAB /* JSInt32Array.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInt32Array.cpp; sourceTree = "<group>"; }; 49EECEF7105070C400099FAB /* JSInt32Array.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInt32Array.h; sourceTree = "<group>"; }; 49EECEF8105070C400099FAB /* JSInt16Array.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInt16Array.cpp; sourceTree = "<group>"; }; @@ -6570,7 +6589,7 @@ 49EECF19105072F300099FAB /* JSArrayBufferView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSArrayBufferView.cpp; sourceTree = "<group>"; }; 49EECF1A105072F300099FAB /* JSArrayBufferView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSArrayBufferView.h; sourceTree = "<group>"; }; 49EECF7110508D9C00099FAB /* JSInt8ArrayCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInt8ArrayCustom.cpp; sourceTree = "<group>"; }; - 49EECF7210508D9C00099FAB /* JSFloatArrayCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFloatArrayCustom.cpp; sourceTree = "<group>"; }; + 49EECF7210508D9C00099FAB /* JSFloat32ArrayCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFloat32ArrayCustom.cpp; sourceTree = "<group>"; }; 49EECF7310508D9C00099FAB /* JSInt32ArrayCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInt32ArrayCustom.cpp; sourceTree = "<group>"; }; 49EECF7410508D9C00099FAB /* JSInt16ArrayCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInt16ArrayCustom.cpp; sourceTree = "<group>"; }; 49EECF7510508D9C00099FAB /* JSUint8ArrayCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSUint8ArrayCustom.cpp; sourceTree = "<group>"; }; @@ -6580,8 +6599,8 @@ 49EECF9A1050938200099FAB /* JSArrayBufferConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSArrayBufferConstructor.h; sourceTree = "<group>"; }; 49EECF9B1050938200099FAB /* JSInt8ArrayConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInt8ArrayConstructor.cpp; sourceTree = "<group>"; }; 49EECF9C1050938200099FAB /* JSInt8ArrayConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInt8ArrayConstructor.h; sourceTree = "<group>"; }; - 49EECF9D1050938200099FAB /* JSFloatArrayConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFloatArrayConstructor.cpp; sourceTree = "<group>"; }; - 49EECF9E1050938200099FAB /* JSFloatArrayConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFloatArrayConstructor.h; sourceTree = "<group>"; }; + 49EECF9D1050938200099FAB /* JSFloat32ArrayConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFloat32ArrayConstructor.cpp; sourceTree = "<group>"; }; + 49EECF9E1050938200099FAB /* JSFloat32ArrayConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFloat32ArrayConstructor.h; sourceTree = "<group>"; }; 49EECF9F1050938200099FAB /* JSInt32ArrayConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInt32ArrayConstructor.cpp; sourceTree = "<group>"; }; 49EECFA01050938200099FAB /* JSInt32ArrayConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInt32ArrayConstructor.h; sourceTree = "<group>"; }; 49EECFA31050938200099FAB /* JSInt16ArrayConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInt16ArrayConstructor.cpp; sourceTree = "<group>"; }; @@ -6638,6 +6657,8 @@ 4E1959260A39DACC00220FE5 /* MediaQueryEvaluator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MediaQueryEvaluator.h; sourceTree = "<group>"; }; 4E1959270A39DACC00220FE5 /* MediaQueryExp.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = MediaQueryExp.cpp; sourceTree = "<group>"; }; 4E1959280A39DACC00220FE5 /* MediaQueryExp.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MediaQueryExp.h; sourceTree = "<group>"; }; + 4F1534DD11B532EC0021FD86 /* EditingBehavior.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditingBehavior.h; sourceTree = "<group>"; }; + 4F1534DF11B533020021FD86 /* EditingBehaviorTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditingBehaviorTypes.h; sourceTree = "<group>"; }; 4F3289B311A42AAB005ABE7E /* InspectorValues.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorValues.cpp; sourceTree = "<group>"; }; 4F3289B411A42AAB005ABE7E /* InspectorValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorValues.h; sourceTree = "<group>"; }; 4FD8D0F0119C718B002FA825 /* ScriptGCEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptGCEvent.cpp; sourceTree = "<group>"; }; @@ -6802,7 +6823,7 @@ 51FAFE330CECBF2D00BB3F24 /* DatabaseTrackerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatabaseTrackerClient.h; sourceTree = "<group>"; }; 521D46F511AEC98100514613 /* KillRingMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KillRingMac.mm; sourceTree = "<group>"; }; 521D46F711AEC9B100514613 /* KillRing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KillRing.h; sourceTree = "<group>"; }; - 54C50F7A0E801DF3009832A0 /* XMLTokenizerLibxml2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLTokenizerLibxml2.cpp; sourceTree = "<group>"; }; + 54C50F7A0E801DF3009832A0 /* XMLDocumentParserLibxml2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLDocumentParserLibxml2.cpp; sourceTree = "<group>"; }; 550A0BC7085F6039007353D6 /* QualifiedName.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = QualifiedName.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 550A0BC8085F6039007353D6 /* QualifiedName.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = QualifiedName.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 5913953A110758450083EC55 /* JNIBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JNIBridge.h; sourceTree = "<group>"; }; @@ -6823,8 +6844,6 @@ 59B597721108656B007159E8 /* BridgeJSC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BridgeJSC.cpp; path = bridge/jsc/BridgeJSC.cpp; sourceTree = "<group>"; }; 59B5977411086579007159E8 /* BridgeJSC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BridgeJSC.h; path = bridge/jsc/BridgeJSC.h; sourceTree = "<group>"; }; 59BC393E11054A1300FD85DB /* JavaStringJSC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JavaStringJSC.h; path = jsc/JavaStringJSC.h; sourceTree = "<group>"; }; - 59C77F2810545B3B00506104 /* GeolocationServiceMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GeolocationServiceMock.cpp; path = mock/GeolocationServiceMock.cpp; sourceTree = "<group>"; }; - 59C77F2910545B3B00506104 /* GeolocationServiceMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GeolocationServiceMock.h; path = mock/GeolocationServiceMock.h; sourceTree = "<group>"; }; 59E560A61105336600AA1258 /* JavaClassJSC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JavaClassJSC.h; path = jsc/JavaClassJSC.h; sourceTree = "<group>"; }; 59E560A81105336F00AA1258 /* JavaClassJSC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JavaClassJSC.cpp; path = jsc/JavaClassJSC.cpp; sourceTree = "<group>"; }; 59E842651109E5A2000305AD /* JNIBridgeJSC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JNIBridgeJSC.h; path = jsc/JNIBridgeJSC.h; sourceTree = "<group>"; }; @@ -6833,8 +6852,8 @@ 59EE122D1106080F00885116 /* JNIUtilityPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JNIUtilityPrivate.h; path = jsc/JNIUtilityPrivate.h; sourceTree = "<group>"; }; 59EE122F1106081F00885116 /* JNIUtility.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JNIUtility.cpp; sourceTree = "<group>"; }; 59EE12311106082900885116 /* JNIUtility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JNIUtility.h; sourceTree = "<group>"; }; - 5D15E3A90F9E6AC1009E0E3F /* XMLTokenizerScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLTokenizerScope.cpp; sourceTree = "<group>"; }; - 5D15E3AA0F9E6AC1009E0E3F /* XMLTokenizerScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLTokenizerScope.h; sourceTree = "<group>"; }; + 5D15E3A90F9E6AC1009E0E3F /* XMLDocumentParserScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLDocumentParserScope.cpp; sourceTree = "<group>"; }; + 5D15E3AA0F9E6AC1009E0E3F /* XMLDocumentParserScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLDocumentParserScope.h; sourceTree = "<group>"; }; 5D925B650F64D4DD00B847F0 /* ScrollBehavior.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollBehavior.cpp; sourceTree = "<group>"; }; 5D925B660F64D4DD00B847F0 /* ScrollBehavior.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollBehavior.h; sourceTree = "<group>"; }; 5DA5E0FA102B953800088CF9 /* JSWebSocket.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebSocket.cpp; sourceTree = "<group>"; }; @@ -6875,18 +6894,13 @@ 65653F2A0D9727D200CA9723 /* SVGAltGlyphElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAltGlyphElement.cpp; sourceTree = "<group>"; }; 65653F2B0D9727D200CA9723 /* SVGAltGlyphElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAltGlyphElement.h; sourceTree = "<group>"; }; 65653F2C0D9727D200CA9723 /* SVGAltGlyphElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SVGAltGlyphElement.idl; sourceTree = "<group>"; }; - 656580ED09D12B20000E61D7 /* CSSPropertyNames.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSSPropertyNames.cpp; sourceTree = "<group>"; }; 656580EE09D12B20000E61D7 /* CSSPropertyNames.gperf */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CSSPropertyNames.gperf; sourceTree = "<group>"; }; 656580EF09D12B20000E61D7 /* CSSPropertyNames.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSPropertyNames.h; sourceTree = "<group>"; }; - 6565811C09D12DB2000E61D7 /* DocTypeStrings.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = DocTypeStrings.cpp; sourceTree = "<group>"; }; 6565814409D13043000E61D7 /* CSSGrammar.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSSGrammar.cpp; sourceTree = "<group>"; }; - 6565814609D13043000E61D7 /* CSSValueKeywords.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = CSSValueKeywords.c; sourceTree = "<group>"; }; 6565814709D13043000E61D7 /* CSSValueKeywords.gperf */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CSSValueKeywords.gperf; sourceTree = "<group>"; }; 6565814809D13043000E61D7 /* CSSValueKeywords.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSValueKeywords.h; sourceTree = "<group>"; }; - 6565814B09D13043000E61D7 /* HTMLEntityNames.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = HTMLEntityNames.c; sourceTree = "<group>"; }; 6565814C09D13043000E61D7 /* tokenizer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = tokenizer.cpp; sourceTree = "<group>"; }; 656581AC09D14EE6000E61D7 /* CharsetData.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CharsetData.cpp; sourceTree = "<group>"; }; - 656581AD09D14EE6000E61D7 /* ColorData.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ColorData.c; sourceTree = "<group>"; }; 656581AE09D14EE6000E61D7 /* UserAgentStyleSheets.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = UserAgentStyleSheets.h; sourceTree = "<group>"; }; 656581AF09D14EE6000E61D7 /* UserAgentStyleSheetsData.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = UserAgentStyleSheetsData.cpp; sourceTree = "<group>"; }; 656581E609D1508D000E61D7 /* SVGElementFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGElementFactory.cpp; sourceTree = "<group>"; }; @@ -7028,6 +7042,11 @@ 7AED3E040FBB1EAA00D2B03C /* InspectorFrontend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorFrontend.h; sourceTree = "<group>"; }; 7AFD4A8A1131C2760035B883 /* ScriptBreakpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptBreakpoint.h; sourceTree = "<group>"; }; 7AFD4FF3113277B60035B883 /* ScriptDebugListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptDebugListener.h; sourceTree = "<group>"; }; + 816C806611BE887E009A45E9 /* IDBKeyRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBKeyRange.cpp; sourceTree = "<group>"; }; + 816C806711BE887E009A45E9 /* IDBKeyRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBKeyRange.h; sourceTree = "<group>"; }; + 816C80AE11BE990D009A45E9 /* JSIDBKeyRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBKeyRange.h; sourceTree = "<group>"; }; + 816C80B011BE9934009A45E9 /* JSIDBKeyRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBKeyRange.cpp; sourceTree = "<group>"; }; + 81CC114011BEAA9D00D0D856 /* IDBKeyRange.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBKeyRange.idl; sourceTree = "<group>"; }; 82B658971189E39200E052A1 /* InspectorCSSStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorCSSStore.h; sourceTree = "<group>"; }; 82B658991189E47600E052A1 /* InspectorCSSStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorCSSStore.cpp; sourceTree = "<group>"; }; 841FDC241178C9BE00F8AC9B /* RenderSVGResourceFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGResourceFilter.cpp; sourceTree = "<group>"; }; @@ -7879,6 +7898,7 @@ 85F56A790A98CE3700ADB60A /* DOMProcessingInstruction.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMProcessingInstruction.mm; sourceTree = "<group>"; }; 85FF31580AAFBFCB00374F38 /* DOMKeyboardEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMKeyboardEvent.h; sourceTree = "<group>"; }; 85FF31590AAFBFCB00374F38 /* DOMKeyboardEvent.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMKeyboardEvent.mm; sourceTree = "<group>"; }; + 86243D0011BC31F700CC006A /* JSArrayBufferViewHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSArrayBufferViewHelper.h; sourceTree = "<group>"; }; 8952535011641B3400CABF00 /* FileThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileThread.cpp; sourceTree = "<group>"; }; 8952535111641B3400CABF00 /* FileThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileThread.h; sourceTree = "<group>"; }; 895253D4116C4C6800CABF00 /* FileStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileStream.cpp; sourceTree = "<group>"; }; @@ -7887,6 +7907,8 @@ 895253DA116C4EF500CABF00 /* FileStreamProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileStreamProxy.cpp; sourceTree = "<group>"; }; 895253DB116C4EF500CABF00 /* FileStreamProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileStreamProxy.h; sourceTree = "<group>"; }; 895253DE116C4F0600CABF00 /* FileThreadTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileThreadTask.h; sourceTree = "<group>"; }; + 8988E10C11A3508B00DB732E /* BlobItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BlobItem.cpp; sourceTree = "<group>"; }; + 8988E10D11A3508B00DB732E /* BlobItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlobItem.h; sourceTree = "<group>"; }; 8F934D831189F1EE00508D5D /* JSMainThreadExecState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMainThreadExecState.h; sourceTree = "<group>"; }; 8F934D841189F1EE00508D5D /* JSMainThreadExecState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMainThreadExecState.cpp; sourceTree = "<group>"; }; 9302B0BC0D79F82900C7EE83 /* PageGroup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageGroup.cpp; sourceTree = "<group>"; }; @@ -8116,7 +8138,7 @@ 93F19B1A08245E5A001E9ABC /* WebCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = WebCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 93F1D31A0558CC5C00821BC0 /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = /usr/lib/libicucore.dylib; sourceTree = "<absolute>"; }; 93F8B3050A300FE100F61AB8 /* CodeGenerator.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; name = CodeGenerator.pm; path = scripts/CodeGenerator.pm; sourceTree = "<group>"; }; - 93F8B3060A300FEA00F61AB8 /* CodeGeneratorJS.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; name = CodeGeneratorJS.pm; path = ../scripts/CodeGeneratorJS.pm; sourceTree = "<group>"; }; + 93F8B3060A300FEA00F61AB8 /* CodeGeneratorJS.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; name = CodeGeneratorJS.pm; path = ../scripts/CodeGeneratorJS.pm; sourceTree = "<group>"; wrapsLines = 0; }; 93F8B3070A300FEA00F61AB8 /* generate-bindings.pl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; name = "generate-bindings.pl"; path = "scripts/generate-bindings.pl"; sourceTree = "<group>"; }; 93F8B3080A300FEA00F61AB8 /* IDLStructure.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; name = IDLStructure.pm; path = scripts/IDLStructure.pm; sourceTree = "<group>"; }; 93F925410F7EF5B8007E37C9 /* CheckedRadioButtons.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CheckedRadioButtons.h; sourceTree = "<group>"; }; @@ -8138,6 +8160,8 @@ 9738899F116EA9DC00ADF313 /* DocumentWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentWriter.h; sourceTree = "<group>"; }; 973E325410883B7C005BC493 /* ResourceLoadNotifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceLoadNotifier.cpp; sourceTree = "<group>"; }; 973E325510883B7C005BC493 /* ResourceLoadNotifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadNotifier.h; sourceTree = "<group>"; }; + 976E895E11C0CA3A00EA9CA9 /* HTML5EntityParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTML5EntityParser.cpp; sourceTree = "<group>"; }; + 976E895F11C0CA3A00EA9CA9 /* HTML5EntityParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTML5EntityParser.h; sourceTree = "<group>"; }; 979F43D11075E44A0000F83B /* RedirectScheduler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RedirectScheduler.cpp; sourceTree = "<group>"; }; 979F43D21075E44A0000F83B /* RedirectScheduler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RedirectScheduler.h; sourceTree = "<group>"; }; 97C0784F1165D5BE003A32EF /* SuffixTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SuffixTree.h; sourceTree = "<group>"; }; @@ -8162,6 +8186,11 @@ 9FA37EF71172FD9300C4CD55 /* JSScriptProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSScriptProfile.h; sourceTree = "<group>"; }; 9FA37EF81172FD9300C4CD55 /* JSScriptProfileNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSScriptProfileNode.cpp; sourceTree = "<group>"; }; 9FA37EF91172FD9300C4CD55 /* JSScriptProfileNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSScriptProfileNode.h; sourceTree = "<group>"; }; + 9FFE3E7811B59C5D0037874E /* MemoryInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemoryInfo.cpp; sourceTree = "<group>"; }; + 9FFE3E7911B59C5D0037874E /* MemoryInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInfo.h; sourceTree = "<group>"; }; + 9FFE3E7C11B59C6E0037874E /* MemoryInfo.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MemoryInfo.idl; sourceTree = "<group>"; }; + 9FFE3EA311B5A4390037874E /* JSMemoryInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMemoryInfo.cpp; sourceTree = "<group>"; }; + 9FFE3EA411B5A4390037874E /* JSMemoryInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMemoryInfo.h; sourceTree = "<group>"; }; A136A00A1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLHttpRequestProgressEventThrottle.cpp; sourceTree = "<group>"; }; A136A00B1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLHttpRequestProgressEventThrottle.h; sourceTree = "<group>"; }; A17C81200F2A5CF7005DAAEB /* HTMLElementFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLElementFactory.cpp; sourceTree = "<group>"; }; @@ -8192,6 +8221,7 @@ A5C974D011485FF10066F2AB /* KeyEventCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = KeyEventCocoa.mm; path = cocoa/KeyEventCocoa.mm; sourceTree = "<group>"; }; A718760D0B2A120100A16ECE /* DragActions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragActions.h; sourceTree = "<group>"; }; A718788F0B2D04AC00A16ECE /* DragControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DragControllerMac.mm; sourceTree = "<group>"; }; + A71A70C911AFB02000989D6D /* HTMLMeterElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLMeterElement.idl; sourceTree = "<group>"; }; A7352C170B1BB89D00A986D0 /* RenderSVGBlock.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGBlock.cpp; sourceTree = "<group>"; }; A7352C180B1BB89D00A986D0 /* RenderSVGBlock.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderSVGBlock.h; sourceTree = "<group>"; }; A75E497410752ACB00C9B896 /* SerializedScriptValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SerializedScriptValue.h; sourceTree = "<group>"; }; @@ -8215,6 +8245,8 @@ A7AD2F850EC89D07008AB002 /* LinkHash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LinkHash.cpp; sourceTree = "<group>"; }; A7AD2F860EC89D07008AB002 /* LinkHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LinkHash.h; sourceTree = "<group>"; }; A7B6E69D0B291A9600D0529F /* DragData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragData.h; sourceTree = "<group>"; }; + A7BBE26411AFB3F20005EA03 /* JSHTMLMeterElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLMeterElement.cpp; sourceTree = "<group>"; }; + A7BBE26511AFB3F20005EA03 /* JSHTMLMeterElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLMeterElement.h; sourceTree = "<group>"; }; A7CA595B0B27BD9E00FA021D /* DragController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragController.h; sourceTree = "<group>"; }; A7CA595C0B27BD9E00FA021D /* DragController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DragController.cpp; sourceTree = "<group>"; }; A7CA59620B27C1F200FA021D /* DragClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragClient.h; sourceTree = "<group>"; }; @@ -8230,6 +8262,8 @@ A7D3C5230B576B4B002CA450 /* PasteboardHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PasteboardHelper.h; sourceTree = "<group>"; }; A7D6B3470F61104500B79FD1 /* WorkerScriptLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WorkerScriptLoader.h; path = workers/WorkerScriptLoader.h; sourceTree = "<group>"; }; A7D6B3480F61104500B79FD1 /* WorkerScriptLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WorkerScriptLoader.cpp; path = workers/WorkerScriptLoader.cpp; sourceTree = "<group>"; }; + A7F338A111C0EFCA00A320A7 /* ShadowElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShadowElement.cpp; sourceTree = "<group>"; }; + A7F338A211C0EFCA00A320A7 /* ShadowElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShadowElement.h; sourceTree = "<group>"; }; A809F1450B73793A002E4D7F /* RenderSVGGradientStop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGGradientStop.h; sourceTree = "<group>"; }; A809F1460B73793A002E4D7F /* RenderSVGGradientStop.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGGradientStop.cpp; sourceTree = "<group>"; }; A809F1A80B737FB6002E4D7F /* RenderSVGHiddenContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGHiddenContainer.h; sourceTree = "<group>"; }; @@ -8413,8 +8447,8 @@ A86629CC09DA2B47009633A5 /* JSMouseEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSMouseEvent.cpp; sourceTree = "<group>"; }; A86629CD09DA2B47009633A5 /* JSKeyboardEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSKeyboardEvent.h; sourceTree = "<group>"; }; A86629CE09DA2B47009633A5 /* JSKeyboardEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSKeyboardEvent.cpp; sourceTree = "<group>"; }; - A871038811A2947000DBD50E /* HTML5Tokenizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTML5Tokenizer.cpp; sourceTree = "<group>"; }; - A871038911A2947000DBD50E /* HTML5Tokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTML5Tokenizer.h; sourceTree = "<group>"; }; + A871038811A2947000DBD50E /* HTML5DocumentParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTML5DocumentParser.cpp; sourceTree = "<group>"; }; + A871038911A2947000DBD50E /* HTML5DocumentParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTML5DocumentParser.h; sourceTree = "<group>"; }; A871D44C0A127CBC00B12A68 /* HTMLPlugInElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLPlugInElement.h; sourceTree = "<group>"; }; A871D44D0A127CBC00B12A68 /* HTMLPlugInElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLPlugInElement.cpp; sourceTree = "<group>"; }; A871D44E0A127CBC00B12A68 /* HTMLParamElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLParamElement.h; sourceTree = "<group>"; }; @@ -8835,6 +8869,10 @@ ABDDFE740A5C6E7000A3E11D /* RenderMenuList.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderMenuList.h; sourceTree = "<group>"; }; ABFE7E100D32FAF50066F4D2 /* MediaControlElements.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaControlElements.cpp; sourceTree = "<group>"; }; ABFE7E110D32FAF50066F4D2 /* MediaControlElements.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaControlElements.h; sourceTree = "<group>"; }; + B0149E7911A4B21500196A7B /* AsyncImageResizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AsyncImageResizer.cpp; sourceTree = "<group>"; }; + B0149E7A11A4B21500196A7B /* AsyncImageResizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsyncImageResizer.h; sourceTree = "<group>"; }; + B0149E7B11A4B21500196A7B /* ImageResizerThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageResizerThread.cpp; sourceTree = "<group>"; }; + B0149E7C11A4B21500196A7B /* ImageResizerThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageResizerThread.h; sourceTree = "<group>"; }; B20111050AB7740500DB0E68 /* JSSVGAElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSSVGAElement.cpp; sourceTree = "<group>"; }; B20111060AB7740500DB0E68 /* JSSVGAElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSSVGAElement.h; sourceTree = "<group>"; }; B21127A50B3186770009BE53 /* JSSVGPODTypeWrapper.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSSVGPODTypeWrapper.h; sourceTree = "<group>"; }; @@ -9729,13 +9767,14 @@ B5C11239102B6C4600096578 /* SQLTransactionCoordinator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SQLTransactionCoordinator.cpp; sourceTree = "<group>"; }; B5C1123A102B6C4600096578 /* SQLTransactionCoordinator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLTransactionCoordinator.h; sourceTree = "<group>"; }; B5D36019112F8B560048DEA8 /* DatabaseCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatabaseCallback.h; sourceTree = "<group>"; }; - B6693EE711AD63E6003F2770 /* IDBObjectStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBObjectStore.cpp; sourceTree = "<group>"; }; B6693EE811AD63E6003F2770 /* IDBObjectStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBObjectStore.h; sourceTree = "<group>"; }; B6693EE911AD63E6003F2770 /* IDBObjectStoreRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBObjectStoreRequest.cpp; sourceTree = "<group>"; }; B6693EEA11AD63E6003F2770 /* IDBObjectStoreRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBObjectStoreRequest.h; sourceTree = "<group>"; }; B6693EEF11AD63F6003F2770 /* IDBObjectStoreRequest.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBObjectStoreRequest.idl; sourceTree = "<group>"; }; B6693EF011AD6486003F2770 /* JSIDBObjectStoreRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBObjectStoreRequest.cpp; sourceTree = "<group>"; }; B6693EF111AD6486003F2770 /* JSIDBObjectStoreRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBObjectStoreRequest.h; sourceTree = "<group>"; }; + B6B0540711B68F10002564C5 /* IDBObjectStoreImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBObjectStoreImpl.cpp; sourceTree = "<group>"; }; + B6B0540811B68F10002564C5 /* IDBObjectStoreImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBObjectStoreImpl.h; sourceTree = "<group>"; }; B734B180119B9911006587BD /* FontTranscoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FontTranscoder.cpp; path = transcoder/FontTranscoder.cpp; sourceTree = "<group>"; }; B734B182119B991D006587BD /* FontTranscoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FontTranscoder.h; path = transcoder/FontTranscoder.h; sourceTree = "<group>"; }; B776D43A1104525D00BEB0EC /* PrintContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrintContext.h; sourceTree = "<group>"; }; @@ -9837,8 +9876,6 @@ BC348BBD0DB7F531004ABAB9 /* JSXMLHttpRequestCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLHttpRequestCustom.cpp; sourceTree = "<group>"; }; BC348BD10DB7F804004ABAB9 /* JSXMLHttpRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLHttpRequest.cpp; sourceTree = "<group>"; }; BC348BD20DB7F804004ABAB9 /* JSXMLHttpRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSXMLHttpRequest.h; sourceTree = "<group>"; }; - BC348BE70DB80354004ABAB9 /* JSXMLHttpRequestConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLHttpRequestConstructor.cpp; sourceTree = "<group>"; }; - BC348BE80DB80354004ABAB9 /* JSXMLHttpRequestConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSXMLHttpRequestConstructor.h; sourceTree = "<group>"; }; BC3BC29B0E91AB0F00835588 /* HostWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HostWindow.h; sourceTree = "<group>"; }; BC3BE12A0E98092F00835588 /* PopupMenuStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PopupMenuStyle.h; sourceTree = "<group>"; }; BC3BE9900E9C1C7C00835588 /* RenderScrollbar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderScrollbar.cpp; sourceTree = "<group>"; }; @@ -10173,7 +10210,7 @@ BCCD74DB0A4C8D35005FDA6D /* HTMLViewSourceDocument.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLViewSourceDocument.h; sourceTree = "<group>"; }; BCCD74E40A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLViewSourceDocument.cpp; sourceTree = "<group>"; }; BCCE58AB1061E8CF008FB35A /* JSDatabaseCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDatabaseCustom.cpp; sourceTree = "<group>"; }; - BCCFBAE70B5152ED0001F1D7 /* Tokenizer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Tokenizer.h; sourceTree = "<group>"; }; + BCCFBAE70B5152ED0001F1D7 /* DocumentParser.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DocumentParser.h; sourceTree = "<group>"; }; BCD0E0F70E972C3500265DEA /* SecurityOrigin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SecurityOrigin.cpp; sourceTree = "<group>"; }; BCD0E0F80E972C3500265DEA /* SecurityOrigin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecurityOrigin.h; sourceTree = "<group>"; }; BCD0E0F90E972C3500265DEA /* SecurityOriginHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecurityOriginHash.h; sourceTree = "<group>"; }; @@ -10211,8 +10248,6 @@ BCE1C43F0D9830F4003B02F2 /* JSLocationCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSLocationCustom.cpp; sourceTree = "<group>"; }; BCE3BEC00D222B1D007E06E4 /* TagNodeList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TagNodeList.cpp; sourceTree = "<group>"; }; BCE3BEC10D222B1D007E06E4 /* TagNodeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TagNodeList.h; sourceTree = "<group>"; }; - BCE494A90F4F5E9E0084E319 /* GeolocationServiceMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationServiceMac.h; sourceTree = "<group>"; }; - BCE494AA0F4F5E9E0084E319 /* GeolocationServiceMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GeolocationServiceMac.mm; sourceTree = "<group>"; }; BCE658FE0EA9248A007E4533 /* Theme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Theme.h; sourceTree = "<group>"; }; BCE659A80EA927B9007E4533 /* ThemeTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThemeTypes.h; sourceTree = "<group>"; }; BCE659E50EA92FB2007E4533 /* ThemeMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThemeMac.h; sourceTree = "<group>"; }; @@ -10435,6 +10470,7 @@ E10B9B6B0B747599003ED890 /* NativeXPathNSResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NativeXPathNSResolver.cpp; sourceTree = "<group>"; }; E10B9CCA0B747A44003ED890 /* DOMCustomXPathNSResolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMCustomXPathNSResolver.h; sourceTree = "<group>"; }; E10B9CCB0B747A44003ED890 /* DOMCustomXPathNSResolver.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMCustomXPathNSResolver.mm; sourceTree = "<group>"; }; + E11AF15011B9A1A300805103 /* Cursor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Cursor.cpp; sourceTree = "<group>"; }; E11C9D9A0EB3681200E409DB /* ScriptExecutionContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptExecutionContext.h; sourceTree = "<group>"; }; E11C9DAF0EB3699500E409DB /* ScriptExecutionContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptExecutionContext.cpp; sourceTree = "<group>"; }; E124748310AA161D00B79493 /* AuthenticationClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthenticationClient.h; sourceTree = "<group>"; }; @@ -10514,9 +10550,14 @@ E1F1E82E0C3C2BB9006DB391 /* XSLTExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XSLTExtensions.h; sourceTree = "<group>"; }; E1FF57A20F01255B00891EBB /* ThreadGlobalData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadGlobalData.h; sourceTree = "<group>"; }; E1FF57A50F01256B00891EBB /* ThreadGlobalData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadGlobalData.cpp; sourceTree = "<group>"; }; + E406F3FA1198304D009D59D6 /* DocTypeStrings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocTypeStrings.cpp; sourceTree = "<group>"; }; + E406F3FB1198307D009D59D6 /* ColorData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ColorData.cpp; sourceTree = "<group>"; }; + E406F4021198329A009D59D6 /* HTMLEntityNames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLEntityNames.cpp; sourceTree = "<group>"; }; E415F10C0D9A05870033CE97 /* ElementTimeControl.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ElementTimeControl.idl; sourceTree = "<group>"; }; E415F1680D9A165D0033CE97 /* DOMElementTimeControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMElementTimeControl.h; sourceTree = "<group>"; }; E415F1830D9A1A830033CE97 /* ElementTimeControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementTimeControl.h; sourceTree = "<group>"; }; + E41EA038119836DB00710BC5 /* CSSPropertyNames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSPropertyNames.cpp; sourceTree = "<group>"; }; + E41EA0391198374900710BC5 /* CSSValueKeywords.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSValueKeywords.cpp; sourceTree = "<group>"; }; E440A2D41191A50B000820B0 /* SVGFELighting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFELighting.cpp; sourceTree = "<group>"; }; E440A2D61191A523000820B0 /* SVGFELighting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGFELighting.h; sourceTree = "<group>"; }; E446138F0CD6331000FADA75 /* HTMLAudioElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLAudioElement.cpp; sourceTree = "<group>"; }; @@ -10603,16 +10644,16 @@ F523D23C02DE4396018635CA /* HTMLDocument.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HTMLDocument.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; F523D23E02DE4396018635CA /* HTMLElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLElement.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; F523D23F02DE4396018635CA /* HTMLElement.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HTMLElement.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; - F523D25002DE4396018635CA /* HTMLParser.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLParser.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; - F523D25102DE4396018635CA /* HTMLParser.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HTMLParser.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; - F523D25202DE4396018635CA /* HTMLTokenizer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLTokenizer.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; - F523D25302DE4396018635CA /* HTMLTokenizer.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HTMLTokenizer.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; + F523D25002DE4396018635CA /* LegacyHTMLTreeConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LegacyHTMLTreeConstructor.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; + F523D25102DE4396018635CA /* LegacyHTMLTreeConstructor.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = LegacyHTMLTreeConstructor.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; + F523D25202DE4396018635CA /* HTMLDocumentParser.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLDocumentParser.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; + F523D25302DE4396018635CA /* HTMLDocumentParser.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HTMLDocumentParser.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; F523D27802DE43D7018635CA /* TextResourceDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextResourceDecoder.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; F523D27902DE43D7018635CA /* TextResourceDecoder.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = TextResourceDecoder.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; F523D30302DE4476018635CA /* Range.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Range.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; F523D30402DE4476018635CA /* Range.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Range.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; - F523D30902DE4476018635CA /* XMLTokenizer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLTokenizer.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; - F523D30A02DE4476018635CA /* XMLTokenizer.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = XMLTokenizer.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; + F523D30902DE4476018635CA /* XMLDocumentParser.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLDocumentParser.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; + F523D30A02DE4476018635CA /* XMLDocumentParser.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = XMLDocumentParser.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; F58784F002DE375901EA4122 /* CursorMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CursorMac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; F587851502DE375901EA4122 /* DeprecatedPtrListImpl.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = DeprecatedPtrListImpl.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; F587851602DE375901EA4122 /* DeprecatedPtrListImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeprecatedPtrListImpl.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; @@ -10641,6 +10682,8 @@ F8216299029F4FB501000131 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JavaScriptCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; F916C48B0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLHttpRequestProgressEvent.cpp; sourceTree = "<group>"; }; F916C48C0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSXMLHttpRequestProgressEvent.h; sourceTree = "<group>"; }; + F98FFF4211A2676200F548E8 /* CSSOMUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSOMUtils.cpp; sourceTree = "<group>"; }; + F98FFF4311A2676200F548E8 /* CSSOMUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSOMUtils.h; sourceTree = "<group>"; }; F9F0ED770DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = XMLHttpRequestProgressEvent.h; sourceTree = "<group>"; }; F9F0ED780DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = XMLHttpRequestProgressEvent.idl; sourceTree = "<group>"; }; FA0B1F8211125CEE007F9839 /* RenderMathMLMath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMathMLMath.cpp; sourceTree = "<group>"; }; @@ -10700,8 +10743,6 @@ FE80DA6D0E9C472F000D6F75 /* JSPositionError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPositionError.cpp; sourceTree = "<group>"; }; FE80DA6E0E9C472F000D6F75 /* JSPositionError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPositionError.h; sourceTree = "<group>"; }; FEA4133F105D67AE0007236F /* WebCore.DragSupport.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; path = WebCore.DragSupport.exp; sourceTree = "<group>"; }; - FEAB90100EA51B9C006348C3 /* GeolocationService.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeolocationService.cpp; sourceTree = "<group>"; }; - FEAB90110EA51B9C006348C3 /* GeolocationService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationService.h; sourceTree = "<group>"; }; FEFD102C105C41470002855E /* WebCore.ContextMenus.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; path = WebCore.ContextMenus.exp; sourceTree = "<group>"; }; /* End PBXFileReference section */ @@ -11020,8 +11061,12 @@ 1AE82EC90CAAE177002237AE /* storage */ = { isa = PBXGroup; children = ( + 81CC114011BEAA9D00D0D856 /* IDBKeyRange.idl */, + 816C806611BE887E009A45E9 /* IDBKeyRange.cpp */, + 816C806711BE887E009A45E9 /* IDBKeyRange.h */, + B6B0540711B68F10002564C5 /* IDBObjectStoreImpl.cpp */, + B6B0540811B68F10002564C5 /* IDBObjectStoreImpl.h */, B6693EEF11AD63F6003F2770 /* IDBObjectStoreRequest.idl */, - B6693EE711AD63E6003F2770 /* IDBObjectStore.cpp */, B6693EE811AD63E6003F2770 /* IDBObjectStore.h */, B6693EE911AD63E6003F2770 /* IDBObjectStoreRequest.cpp */, B6693EEA11AD63E6003F2770 /* IDBObjectStoreRequest.h */, @@ -11052,12 +11097,12 @@ C56C9151119D84CB00DE4CD9 /* IDBAny.idl */, C5198F381192ECFD002B74A6 /* IDBCallbacks.h */, C5198F3A1192ECFD002B74A6 /* IDBDatabase.h */, - C50AD2A911AC1631008CF2FB /* IDBDatabaseImpl.cpp */, - C50AD2AA11AC1631008CF2FB /* IDBDatabaseImpl.h */, C5198F3B1192ECFD002B74A6 /* IDBDatabaseError.h */, C5198F3C1192ECFD002B74A6 /* IDBDatabaseError.idl */, C5198F3D1192ECFD002B74A6 /* IDBDatabaseException.h */, C5198F3E1192ECFD002B74A6 /* IDBDatabaseException.idl */, + C50AD2A911AC1631008CF2FB /* IDBDatabaseImpl.cpp */, + C50AD2AA11AC1631008CF2FB /* IDBDatabaseImpl.h */, C5198F3F1192ECFD002B74A6 /* IDBDatabaseRequest.cpp */, C5198F401192ECFD002B74A6 /* IDBDatabaseRequest.h */, C5198F411192ECFD002B74A6 /* IDBDatabaseRequest.idl */, @@ -11073,6 +11118,12 @@ C51DA9A211AEF2C1009799C5 /* IDBIndexRequest.cpp */, C51DA9A311AEF2C1009799C5 /* IDBIndexRequest.h */, C51DA9A411AEF2C1009799C5 /* IDBIndexRequest.idl */, + B6693EE811AD63E6003F2770 /* IDBObjectStore.h */, + B6B0540711B68F10002564C5 /* IDBObjectStoreImpl.cpp */, + B6B0540811B68F10002564C5 /* IDBObjectStoreImpl.h */, + B6693EE911AD63E6003F2770 /* IDBObjectStoreRequest.cpp */, + B6693EEA11AD63E6003F2770 /* IDBObjectStoreRequest.h */, + B6693EEF11AD63F6003F2770 /* IDBObjectStoreRequest.idl */, C5198F421192ECFD002B74A6 /* IDBRequest.cpp */, C5198F431192ECFD002B74A6 /* IDBRequest.h */, C5198F441192ECFD002B74A6 /* IDBRequest.idl */, @@ -11450,9 +11501,9 @@ 49484FBE102CF23C00187DD3 /* CanvasRenderingContext2D.idl */, 49484FBF102CF23C00187DD3 /* CanvasStyle.cpp */, 49484FC0102CF23C00187DD3 /* CanvasStyle.h */, - 49EECDCD10503C2300099FAB /* FloatArray.cpp */, - 49EECDCE10503C2300099FAB /* FloatArray.h */, - 49EECDCF10503C2300099FAB /* FloatArray.idl */, + 49EECDCD10503C2300099FAB /* Float32Array.cpp */, + 49EECDCE10503C2300099FAB /* Float32Array.h */, + 49EECDCF10503C2300099FAB /* Float32Array.idl */, 49EECDD310503C2300099FAB /* Int16Array.cpp */, 49EECDD410503C2300099FAB /* Int16Array.h */, 49EECDD510503C2300099FAB /* Int16Array.idl */, @@ -11765,8 +11816,6 @@ 59C77F101054591C00506104 /* mock */ = { isa = PBXGroup; children = ( - 59C77F2810545B3B00506104 /* GeolocationServiceMock.cpp */, - 59C77F2910545B3B00506104 /* GeolocationServiceMock.h */, ); name = mock; sourceTree = "<group>"; @@ -11811,20 +11860,20 @@ 656580EC09D12B20000E61D7 /* Derived Sources */ = { isa = PBXGroup; children = ( + E41EA0391198374900710BC5 /* CSSValueKeywords.cpp */, + E41EA038119836DB00710BC5 /* CSSPropertyNames.cpp */, + E406F4021198329A009D59D6 /* HTMLEntityNames.cpp */, + E406F3FB1198307D009D59D6 /* ColorData.cpp */, + E406F3FA1198304D009D59D6 /* DocTypeStrings.cpp */, 656581AC09D14EE6000E61D7 /* CharsetData.cpp */, - 656581AD09D14EE6000E61D7 /* ColorData.c */, 6565814409D13043000E61D7 /* CSSGrammar.cpp */, 650F53DB09D15DDA00C9B0C8 /* CSSGrammar.h */, - 656580ED09D12B20000E61D7 /* CSSPropertyNames.cpp */, 656580EE09D12B20000E61D7 /* CSSPropertyNames.gperf */, 656580EF09D12B20000E61D7 /* CSSPropertyNames.h */, - 6565814609D13043000E61D7 /* CSSValueKeywords.c */, 6565814709D13043000E61D7 /* CSSValueKeywords.gperf */, 6565814809D13043000E61D7 /* CSSValueKeywords.h */, - 6565811C09D12DB2000E61D7 /* DocTypeStrings.cpp */, A17C81200F2A5CF7005DAAEB /* HTMLElementFactory.cpp */, A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */, - 6565814B09D13043000E61D7 /* HTMLEntityNames.c */, A8D06B380A265DCD005E7203 /* HTMLNames.cpp */, A8D06B370A265DCD005E7203 /* HTMLNames.h */, 938E65F609F0985D008A48EC /* JSHTMLElementWrapperFactory.cpp */, @@ -11946,8 +11995,6 @@ 066C772C0AB603D200238CC4 /* FileChooserMac.mm */, 514B3F750C722055000530DF /* FileSystemMac.mm */, 935C476C09AC4D6300A6AAB4 /* FoundationExtras.h */, - BCE494A90F4F5E9E0084E319 /* GeolocationServiceMac.h */, - BCE494AA0F4F5E9E0084E319 /* GeolocationServiceMac.mm */, 935C476E09AC4D7300A6AAB4 /* KeyEventMac.mm */, 521D46F511AEC98100514613 /* KillRingMac.mm */, 6593923909AE435C002C531F /* KURLMac.mm */, @@ -12068,6 +12115,9 @@ BCE1C4190D982980003B02F2 /* Location.h */, BCE1C4220D9829F2003B02F2 /* Location.idl */, 931BCC601124DFCB00BE70DD /* MediaCanStartListener.h */, + 9FFE3E7811B59C5D0037874E /* MemoryInfo.cpp */, + 9FFE3E7911B59C5D0037874E /* MemoryInfo.h */, + 9FFE3E7C11B59C6E0037874E /* MemoryInfo.idl */, 93EB355E09E37FD600F43799 /* MouseEventWithHitTestResults.cpp */, 935C476209AC4CE600A6AAB4 /* MouseEventWithHitTestResults.h */, A9C6E5A30D746458006442E9 /* Navigator.cpp */, @@ -13241,6 +13291,8 @@ 93309D93099E64910056E581 /* EditAction.h */, 93309D94099E64910056E581 /* EditCommand.cpp */, 93309D95099E64910056E581 /* EditCommand.h */, + 4F1534DD11B532EC0021FD86 /* EditingBehavior.h */, + 4F1534DF11B533020021FD86 /* EditingBehaviorTypes.h */, 4B3043CA0AE0373B00A82647 /* Editor.cpp */, 4B3043CB0AE0373B00A82647 /* Editor.h */, 93A38B4A0D0E5808006872C2 /* EditorCommand.cpp */, @@ -13364,10 +13416,12 @@ 93EEC1EC09C2877700C515D1 /* html */ = { isa = PBXGroup; children = ( + 49484FAE102CF01E00187DD3 /* canvas */, + B0149E7911A4B21500196A7B /* AsyncImageResizer.cpp */, + B0149E7A11A4B21500196A7B /* AsyncImageResizer.h */, 2EAFAF0B10E2AF2D007ED3D6 /* Blob.cpp */, 2EAFAF0C10E2AF2D007ED3D6 /* Blob.h */, 2EAFAF0D10E2AF2D007ED3D6 /* Blob.idl */, - 49484FAE102CF01E00187DD3 /* canvas */, 93C441ED0F813A1A00C1A634 /* CollectionCache.cpp */, 93C441EE0F813A1A00C1A634 /* CollectionCache.h */, 93C441FF0F813AE100C1A634 /* CollectionType.h */, @@ -13406,14 +13460,16 @@ 895253DE116C4F0600CABF00 /* FileThreadTask.h */, A8136D370973A8E700D74463 /* FormDataList.cpp */, A8136D360973A8E700D74463 /* FormDataList.h */, + 976E895E11C0CA3A00EA9CA9 /* HTML5EntityParser.cpp */, + 976E895F11C0CA3A00EA9CA9 /* HTML5EntityParser.h */, 97E8B35411A23CE200169409 /* HTML5Lexer.cpp */, 97E8B35511A23CE200169409 /* HTML5Lexer.h */, A83B3AEE11ADEFF500458809 /* HTML5ScriptRunner.cpp */, A83B3AEF11ADEFF500458809 /* HTML5ScriptRunner.h */, A87F163411AE841300CBB2E5 /* HTML5ScriptRunnerHost.h */, 97E8B3C211A2890800169409 /* HTML5Token.h */, - A871038811A2947000DBD50E /* HTML5Tokenizer.cpp */, - A871038911A2947000DBD50E /* HTML5Tokenizer.h */, + A871038811A2947000DBD50E /* HTML5DocumentParser.cpp */, + A871038911A2947000DBD50E /* HTML5DocumentParser.h */, A879C62311A9D1F70059237A /* HTML5TreeBuilder.cpp */, A879C62411A9D1F70059237A /* HTML5TreeBuilder.h */, BC97E239109144950010D361 /* HTMLAllCollection.cpp */, @@ -13569,6 +13625,7 @@ A80E79FC0A19C307007FB8C5 /* HTMLMetaElement.idl */, A4544248119B3661009BE912 /* HTMLMeterElement.cpp */, A4544249119B3661009BE912 /* HTMLMeterElement.h */, + A71A70C911AFB02000989D6D /* HTMLMeterElement.idl */, A8CFF79F0A156978000A4234 /* HTMLModElement.cpp */, A8CFF79D0A156978000A4234 /* HTMLModElement.h */, 1AE2AB070A1CE5CF00B42B25 /* HTMLModElement.idl */, @@ -13597,8 +13654,8 @@ A871D44F0A127CBC00B12A68 /* HTMLParamElement.cpp */, A871D44E0A127CBC00B12A68 /* HTMLParamElement.h */, 1AE2AB720A1CE81500B42B25 /* HTMLParamElement.idl */, - F523D25002DE4396018635CA /* HTMLParser.cpp */, - F523D25102DE4396018635CA /* HTMLParser.h */, + F523D25002DE4396018635CA /* LegacyHTMLTreeConstructor.cpp */, + F523D25102DE4396018635CA /* LegacyHTMLTreeConstructor.h */, BC588B4A0BFA723C00EE679E /* HTMLParserErrorCodes.cpp */, BC588AEF0BFA6CF900EE679E /* HTMLParserErrorCodes.h */, 449B19F30FA72ECE0015CA4A /* HTMLParserQuirks.h */, @@ -13656,8 +13713,8 @@ A871DC1D0A15205700B12A68 /* HTMLTitleElement.cpp */, A871DC1C0A15205700B12A68 /* HTMLTitleElement.h */, A80E7AAE0A19D1F1007FB8C5 /* HTMLTitleElement.idl */, - F523D25202DE4396018635CA /* HTMLTokenizer.cpp */, - F523D25302DE4396018635CA /* HTMLTokenizer.h */, + F523D25202DE4396018635CA /* HTMLDocumentParser.cpp */, + F523D25302DE4396018635CA /* HTMLDocumentParser.h */, A8EA79E70A1916DF00A8EF5F /* HTMLUListElement.cpp */, A8EA79E60A1916DF00A8EF5F /* HTMLUListElement.h */, 1A85B1D50A1B236C00D8C87C /* HTMLUListElement.idl */, @@ -13669,6 +13726,8 @@ A77979130D6B9D0C003851B9 /* ImageData.cpp */, A77979140D6B9D0C003851B9 /* ImageData.h */, A77979150D6B9D0C003851B9 /* ImageData.idl */, + B0149E7B11A4B21500196A7B /* ImageResizerThread.cpp */, + B0149E7C11A4B21500196A7B /* ImageResizerThread.h */, A456FA2411AD4A830020B420 /* LabelsNodeList.cpp */, A456FA2511AD4A830020B420 /* LabelsNodeList.h */, E446139B0CD6331000FADA75 /* MediaError.h */, @@ -13766,8 +13825,8 @@ BC00F0130E0A189500FD04E3 /* JSFileList.h */, 2E94F439119207DA00B7F75D /* JSFileReader.cpp */, 2E94F43A119207DA00B7F75D /* JSFileReader.h */, - 49EECEF4105070C400099FAB /* JSFloatArray.cpp */, - 49EECEF5105070C400099FAB /* JSFloatArray.h */, + 49EECEF4105070C400099FAB /* JSFloat32Array.cpp */, + 49EECEF5105070C400099FAB /* JSFloat32Array.h */, BC97E410109154FA0010D361 /* JSHTMLAllCollection.cpp */, BC97E411109154FA0010D361 /* JSHTMLAllCollection.h */, 1A4A2DEB0A1B852A00C807F8 /* JSHTMLAnchorElement.cpp */, @@ -13860,6 +13919,8 @@ 1AE2AE5A0A1D26F200B42B25 /* JSHTMLMenuElement.h */, A80E7A150A19C3D6007FB8C5 /* JSHTMLMetaElement.cpp */, A80E7A160A19C3D6007FB8C5 /* JSHTMLMetaElement.h */, + A7BBE26411AFB3F20005EA03 /* JSHTMLMeterElement.cpp */, + A7BBE26511AFB3F20005EA03 /* JSHTMLMeterElement.h */, 1AE2AB1F0A1CE63B00B42B25 /* JSHTMLModElement.cpp */, 1AE2AB200A1CE63B00B42B25 /* JSHTMLModElement.h */, BC305C770C076BB300CD20F0 /* JSHTMLObjectElement.cpp */, @@ -14472,6 +14533,8 @@ 51E3F9D50DA05E1D00250911 /* JSStorage.h */, 51E0BAE80DA55D4A00A9E417 /* JSStorageEvent.cpp */, 51E0BAE90DA55D4A00A9E417 /* JSStorageEvent.h */, + 816C80AE11BE990D009A45E9 /* JSIDBKeyRange.h */, + 816C80B011BE9934009A45E9 /* JSIDBKeyRange.cpp */, ); name = Storage; sourceTree = "<group>"; @@ -15436,6 +15499,7 @@ isa = PBXGroup; children = ( 492273A21083B3B100EE5C84 /* JSArrayBufferViewCustom.cpp */, + 86243D0011BC31F700CC006A /* JSArrayBufferViewHelper.h */, BC2ED6BB0C6BD2F000920BFF /* JSAttrCustom.cpp */, 49EED14B1051971900099FAB /* JSCanvasRenderingContext2DCustom.cpp */, 49EED14D1051971A00099FAB /* JSCanvasRenderingContextCustom.cpp */, @@ -15459,7 +15523,7 @@ 652FBBBB0DE27CB60001D386 /* JSDOMWindowCustom.h */, BC2ED5540C6B9BD300920BFF /* JSElementCustom.cpp */, BCEFAF4D0C317E6900FA81F6 /* JSEventCustom.cpp */, - 49EECF7210508D9C00099FAB /* JSFloatArrayCustom.cpp */, + 49EECF7210508D9C00099FAB /* JSFloat32ArrayCustom.cpp */, FE80D7A60E9C1ED2000D6F75 /* JSGeolocationCustom.cpp */, BCE7B1920D4E86960075A539 /* JSHistoryCustom.cpp */, BC97E42B10915B060010D361 /* JSHTMLAllCollectionCustom.cpp */, @@ -15616,6 +15680,8 @@ BC94D14D0C275C68006BC617 /* JSHistory.h */, BCE1C4390D9830D3003B02F2 /* JSLocation.cpp */, BCE1C43A0D9830D3003B02F2 /* JSLocation.h */, + 9FFE3EA311B5A4390037874E /* JSMemoryInfo.cpp */, + 9FFE3EA411B5A4390037874E /* JSMemoryInfo.h */, A9D247F50D757E3300FDF959 /* JSNavigator.cpp */, A9D247F60D757E3300FDF959 /* JSNavigator.h */, BCEC01C00C274DDD009F4EC9 /* JSScreen.cpp */, @@ -15794,8 +15860,8 @@ E4EEFFC70D34550C00469A58 /* JSAudioConstructor.h */, E0FEF371B77C53EAC1C1FBEE /* JSEventSourceConstructor.cpp */, E0FEF371B67C53EAC1C1FBEE /* JSEventSourceConstructor.h */, - 49EECF9D1050938200099FAB /* JSFloatArrayConstructor.cpp */, - 49EECF9E1050938200099FAB /* JSFloatArrayConstructor.h */, + 49EECF9D1050938200099FAB /* JSFloat32ArrayConstructor.cpp */, + 49EECF9E1050938200099FAB /* JSFloat32ArrayConstructor.h */, BC6C49F10D7DBA0500FFA558 /* JSImageConstructor.cpp */, BC6C49F20D7DBA0500FFA558 /* JSImageConstructor.h */, 49EECFA31050938200099FAB /* JSInt16ArrayConstructor.cpp */, @@ -15824,8 +15890,6 @@ 518A34C51026C8C9001B6896 /* JSWebSocketConstructor.h */, E1CA5CD50E8CDEE900E8EF90 /* JSWorkerConstructor.cpp */, E1CA5CD20E8CDE8000E8EF90 /* JSWorkerConstructor.h */, - BC348BE70DB80354004ABAB9 /* JSXMLHttpRequestConstructor.cpp */, - BC348BE80DB80354004ABAB9 /* JSXMLHttpRequestConstructor.h */, BCE99EC10DCA624100182683 /* JSXSLTProcessorConstructor.cpp */, BCE99EC20DCA624100182683 /* JSXSLTProcessorConstructor.h */, ); @@ -15858,6 +15922,8 @@ BCFB2F74097A2E1A00BA703D /* Arena.cpp */, BCFB2F75097A2E1A00BA703D /* Arena.h */, 51E1ECB10C91C55600DC255B /* AutodrainedPool.h */, + 8988E10C11A3508B00DB732E /* BlobItem.cpp */, + 8988E10D11A3508B00DB732E /* BlobItem.h */, BCC8CFCA0986CD2400140BF2 /* ColorData.gperf */, 41D015C90F4B5C71004A662F /* ContentType.cpp */, 41D015C80F4B5C71004A662F /* ContentType.h */, @@ -15868,6 +15934,7 @@ 9352088109BD45E900F2038D /* CookieJar.h */, 2E4346560F546A9900B0F1BA /* CrossThreadCopier.cpp */, 2E4346570F546A9900B0F1BA /* CrossThreadCopier.h */, + E11AF15011B9A1A300805103 /* Cursor.cpp */, F587868402DE3B8601EA4122 /* Cursor.h */, F587869902DE3B8601EA4122 /* DeprecatedPtrList.h */, F587851602DE375901EA4122 /* DeprecatedPtrListImpl.cpp */, @@ -15881,8 +15948,6 @@ 066C772A0AB603B700238CC4 /* FileChooser.h */, 514B3F720C722047000530DF /* FileSystem.h */, BC073BA90C399B1F000F5979 /* FloatConversion.h */, - FEAB90100EA51B9C006348C3 /* GeolocationService.cpp */, - FEAB90110EA51B9C006348C3 /* GeolocationService.h */, BC3BC29B0E91AB0F00835588 /* HostWindow.h */, 521D46F711AEC9B100514613 /* KillRing.h */, 6593923509AE4346002C531F /* KURL.cpp */, @@ -16136,6 +16201,8 @@ A80E6DF90A199067007FB8C5 /* CSSMutableStyleDeclaration.cpp */, A80E6DFA0A199067007FB8C5 /* CSSMutableStyleDeclaration.h */, A80E73470A199C77007FB8C5 /* CSSNamespace.h */, + F98FFF4211A2676200F548E8 /* CSSOMUtils.cpp */, + F98FFF4311A2676200F548E8 /* CSSOMUtils.h */, A80E6CCB0A1989CA007FB8C5 /* CSSPageRule.cpp */, A80E6CD60A1989CA007FB8C5 /* CSSPageRule.h */, 85C56CA60AA89D5F00D95755 /* CSSPageRule.idl */, @@ -16492,6 +16559,8 @@ A8CFF5DA0A155A05000A4234 /* RootInlineBox.h */, 5D925B650F64D4DD00B847F0 /* ScrollBehavior.cpp */, 5D925B660F64D4DD00B847F0 /* ScrollBehavior.h */, + A7F338A111C0EFCA00A320A7 /* ShadowElement.cpp */, + A7F338A211C0EFCA00A320A7 /* ShadowElement.h */, 0842BC701190144000C7D08F /* SVGCharacterData.cpp */, 0842BC711190144000C7D08F /* SVGCharacterData.h */, B2B33A5D0B887CEF00C15984 /* SVGCharacterLayoutInfo.cpp */, @@ -16748,7 +16817,7 @@ 933A142B0B7D188600A53FFD /* TextEvent.cpp */, 933A142D0B7D188600A53FFD /* TextEvent.h */, 933A142C0B7D188600A53FFD /* TextEvent.idl */, - BCCFBAE70B5152ED0001F1D7 /* Tokenizer.h */, + BCCFBAE70B5152ED0001F1D7 /* DocumentParser.h */, 5DB1BC6810715A6400EFAA49 /* TransformSource.h */, 5DB1BC6910715A6400EFAA49 /* TransformSourceLibxslt.cpp */, 854FE72C0A2297BE0058D7AD /* Traversal.cpp */, @@ -16775,11 +16844,11 @@ 85031B3A0A44EFC700F992E0 /* WheelEvent.cpp */, 85031B3B0A44EFC700F992E0 /* WheelEvent.h */, 93EEC1F709C2877700C515D1 /* WheelEvent.idl */, - F523D30902DE4476018635CA /* XMLTokenizer.cpp */, - F523D30A02DE4476018635CA /* XMLTokenizer.h */, - 54C50F7A0E801DF3009832A0 /* XMLTokenizerLibxml2.cpp */, - 5D15E3A90F9E6AC1009E0E3F /* XMLTokenizerScope.cpp */, - 5D15E3AA0F9E6AC1009E0E3F /* XMLTokenizerScope.h */, + F523D30902DE4476018635CA /* XMLDocumentParser.cpp */, + F523D30A02DE4476018635CA /* XMLDocumentParser.h */, + 54C50F7A0E801DF3009832A0 /* XMLDocumentParserLibxml2.cpp */, + 5D15E3A90F9E6AC1009E0E3F /* XMLDocumentParserScope.cpp */, + 5D15E3AA0F9E6AC1009E0E3F /* XMLDocumentParserScope.h */, ); path = dom; sourceTree = "<group>"; @@ -16872,6 +16941,7 @@ BCFB2F77097A2E1A00BA703D /* Arena.h in Headers */, 49EECDE310503C2400099FAB /* ArrayBuffer.h in Headers */, 49EECDE010503C2400099FAB /* ArrayBufferView.h in Headers */, + B0149E7E11A4B21500196A7B /* AsyncImageResizer.h in Headers */, B2C3DA1F0D006C1D00EF6F26 /* AtomicString.h in Headers */, 0FC705210EB1815600B90AD8 /* AtomicStringHash.h in Headers */, B2C3DA200D006C1D00EF6F26 /* AtomicStringImpl.h in Headers */, @@ -16897,6 +16967,7 @@ BC5EB9200E82040800B25965 /* BindingURI.h in Headers */, A89943280B42338800D7C802 /* BitmapImage.h in Headers */, 2EAFAF0F10E2AF2D007ED3D6 /* Blob.h in Headers */, + 8988E10F11A3508B00DB732E /* BlobItem.h in Headers */, 93F199BE08245E59001E9ABC /* BlockExceptions.h in Headers */, BC5EB5E10E81BE8700B25965 /* BorderData.h in Headers */, BC5EB5DB0E81B7EA00B25965 /* BorderValue.h in Headers */, @@ -17013,6 +17084,7 @@ A80E6D030A1989CA007FB8C5 /* CSSMediaRule.h in Headers */, A80E6DFC0A199067007FB8C5 /* CSSMutableStyleDeclaration.h in Headers */, A80E734E0A199C77007FB8C5 /* CSSNamespace.h in Headers */, + F98FFF4511A2676200F548E8 /* CSSOMUtils.h in Headers */, A80E6D000A1989CA007FB8C5 /* CSSPageRule.h in Headers */, BC772B3E0C4EA91E0083285F /* CSSParser.h in Headers */, BC02A4B70E0997B9004B6D2B /* CSSParserValues.h in Headers */, @@ -17835,6 +17907,8 @@ BC7FA6210D1F0CBD00DB22A9 /* DynamicNodeList.h in Headers */, 93309DE2099E64920056E581 /* EditAction.h in Headers */, 93309DE4099E64920056E581 /* EditCommand.h in Headers */, + 4F1534DE11B532EC0021FD86 /* EditingBehavior.h in Headers */, + 4F1534E011B533020021FD86 /* EditingBehaviorTypes.h in Headers */, 6550B6A4099DF0270090D781 /* EditingText.h in Headers */, 4B3043CD0AE0373B00A82647 /* Editor.h in Headers */, 1AF326790D78B9440068F0C4 /* EditorClient.h in Headers */, @@ -17880,7 +17954,7 @@ 845E72F80FD261EE00A87D79 /* Filter.h in Headers */, 08C9251A0FCC7C4A00480DEC /* FilterEffect.h in Headers */, A8CFF04F0A154F09000A4234 /* FixedTableLayout.h in Headers */, - 49EECDE610503C2400099FAB /* FloatArray.h in Headers */, + 49EECDE610503C2400099FAB /* Float32Array.h in Headers */, BC073BAA0C399B1F000F5979 /* FloatConversion.h in Headers */, B27535690B053814002CE64F /* FloatPoint.h in Headers */, B2E27CA00B0F2B0900F17C7B /* FloatPoint3D.h in Headers */, @@ -17931,9 +18005,6 @@ BC56CB2410D5AC8000A77C64 /* GeolocationError.h in Headers */, BC56CB2510D5AC8000A77C64 /* GeolocationPosition.h in Headers */, 5962297A1133EFE200DC4CBB /* GeolocationPositionCache.h in Headers */, - FEAB90130EA51B9C006348C3 /* GeolocationService.h in Headers */, - BCE494AB0F4F5E9E0084E319 /* GeolocationServiceMac.h in Headers */, - 59C77F2B10545B3B00506104 /* GeolocationServiceMock.h in Headers */, FE80D7C90E9C1F25000D6F75 /* Geoposition.h in Headers */, B2C3DA6C0D006CD600EF6F26 /* GlyphBuffer.h in Headers */, C5D4AA7A116BAFB60069CA93 /* GlyphMetricsMap.h in Headers */, @@ -17956,9 +18027,12 @@ 930908910AF7EDE40081DF01 /* HitTestRequest.h in Headers */, 9307F1D80AF2D59000DBA31A /* HitTestResult.h in Headers */, BC3BC29C0E91AB0F00835588 /* HostWindow.h in Headers */, + 976E896111C0CA3A00EA9CA9 /* HTML5EntityParser.h in Headers */, 97E8B35711A23CE200169409 /* HTML5Lexer.h in Headers */, + A83B3AF111ADEFF500458809 /* HTML5ScriptRunner.h in Headers */, + A87F163511AE841300CBB2E5 /* HTML5ScriptRunnerHost.h in Headers */, 97E8B3C311A2890800169409 /* HTML5Token.h in Headers */, - A871038B11A2947000DBD50E /* HTML5Tokenizer.h in Headers */, + A871038B11A2947000DBD50E /* HTML5DocumentParser.h in Headers */, A879C62611A9D1F70059237A /* HTML5TreeBuilder.h in Headers */, BC97E23A109144950010D361 /* HTMLAllCollection.h in Headers */, A8CFF7AB0A156978000A4234 /* HTMLAnchorElement.h in Headers */, @@ -18026,7 +18100,7 @@ A81369DA097374F600D74463 /* HTMLOptionsCollection.h in Headers */, A8EA7CB50A192B9C00A8EF5F /* HTMLParagraphElement.h in Headers */, A871D4580A127CBC00B12A68 /* HTMLParamElement.h in Headers */, - 93F198EF08245E59001E9ABC /* HTMLParser.h in Headers */, + 93F198EF08245E59001E9ABC /* LegacyHTMLTreeConstructor.h in Headers */, BC588AF00BFA6CF900EE679E /* HTMLParserErrorCodes.h in Headers */, 449B19F50FA72ECE0015CA4A /* HTMLParserQuirks.h in Headers */, A871D4560A127CBC00B12A68 /* HTMLPlugInElement.h in Headers */, @@ -18048,7 +18122,7 @@ A871DB250A150BD600B12A68 /* HTMLTableSectionElement.h in Headers */, A81369D6097374F600D74463 /* HTMLTextAreaElement.h in Headers */, A871DC280A15205700B12A68 /* HTMLTitleElement.h in Headers */, - 93F198F008245E59001E9ABC /* HTMLTokenizer.h in Headers */, + 93F198F008245E59001E9ABC /* HTMLDocumentParser.h in Headers */, A8EA79F20A1916DF00A8EF5F /* HTMLUListElement.h in Headers */, E44613AB0CD6331000FADA75 /* HTMLVideoElement.h in Headers */, BCCD74DC0A4C8D35005FDA6D /* HTMLViewSourceDocument.h in Headers */, @@ -18068,6 +18142,12 @@ C5198F541192ECFD002B74A6 /* IDBDatabaseRequest.h in Headers */, C56C9160119D84E600DE4CD9 /* IDBErrorEvent.h in Headers */, C56C9163119D84E600DE4CD9 /* IDBEvent.h in Headers */, + C51DA9A511AEF2C1009799C5 /* IDBIndex.h in Headers */, + C51DA9A711AEF2C1009799C5 /* IDBIndexImpl.h in Headers */, + C51DA9A911AEF2C1009799C5 /* IDBIndexRequest.h in Headers */, + B6693EEC11AD63E6003F2770 /* IDBObjectStore.h in Headers */, + B6B0540A11B68F10002564C5 /* IDBObjectStoreImpl.h in Headers */, + B6693EEE11AD63E6003F2770 /* IDBObjectStoreRequest.h in Headers */, C5198F571192ECFD002B74A6 /* IDBRequest.h in Headers */, C56C9169119D84FF00DE4CD9 /* IDBSuccessEvent.h in Headers */, 1A71D57C0F33819000F9CE4E /* IdentifierRep.h in Headers */, @@ -18080,6 +18160,7 @@ 1A820D920A13EBA600AF843C /* ImageDocument.h in Headers */, 089582560E857A7E00F82C83 /* ImageLoader.h in Headers */, BC7F44A80B9E324E00A9D081 /* ImageObserver.h in Headers */, + B0149E8011A4B21500196A7B /* ImageResizerThread.h in Headers */, B27535710B053814002CE64F /* ImageSource.h in Headers */, 4B3480940EEF50D400AC1B41 /* ImageSourceCG.h in Headers */, 316FE1180E6E1DA700BF6088 /* ImplicitAnimation.h in Headers */, @@ -18113,6 +18194,7 @@ 7A0E770F10C00A8800A0276E /* InspectorFrontendHost.h in Headers */, 41F062010F5F0B6600A07EAC /* InspectorResource.h in Headers */, 754133A8102E00E800075D00 /* InspectorTimelineAgent.h in Headers */, + 4F3289B611A42AAB005ABE7E /* InspectorValues.h in Headers */, F375CC071150D300008DDB81 /* InspectorWorkerResource.h in Headers */, 49EECDEC10503C2400099FAB /* Int16Array.h in Headers */, 49EECDE910503C2400099FAB /* Int32Array.h in Headers */, @@ -18138,6 +18220,7 @@ 49EECF01105070C400099FAB /* JSArrayBuffer.h in Headers */, 49EECFAC1050938200099FAB /* JSArrayBufferConstructor.h in Headers */, 49EECF1C105072F300099FAB /* JSArrayBufferView.h in Headers */, + 86243D0111BC31F700CC006A /* JSArrayBufferViewHelper.h in Headers */, 65DF31DB09D1C123000BE325 /* JSAttr.h in Headers */, E4EEFFC90D34550C00469A58 /* JSAudioConstructor.h in Headers */, BC124F000C26447A009E2349 /* JSBarInfo.h in Headers */, @@ -18218,8 +18301,8 @@ 2E3BC0CB117D3E0800B9409A /* JSFileError.h in Headers */, BC00F0170E0A189500FD04E3 /* JSFileList.h in Headers */, 2E94F43C119207DA00B7F75D /* JSFileReader.h in Headers */, - 49EECF03105070C400099FAB /* JSFloatArray.h in Headers */, - 49EECFB01050938200099FAB /* JSFloatArrayConstructor.h in Headers */, + 49EECF03105070C400099FAB /* JSFloat32Array.h in Headers */, + 49EECFB01050938200099FAB /* JSFloat32ArrayConstructor.h in Headers */, FE80DA640E9C4703000D6F75 /* JSGeolocation.h in Headers */, FE80DA660E9C4703000D6F75 /* JSGeoposition.h in Headers */, BC94D14F0C275C68006BC617 /* JSHistory.h in Headers */, @@ -18270,6 +18353,7 @@ E446143A0CD689C800FADA75 /* JSHTMLMediaElement.h in Headers */, 1AE2AE5C0A1D26F200B42B25 /* JSHTMLMenuElement.h in Headers */, A80E7A180A19C3D6007FB8C5 /* JSHTMLMetaElement.h in Headers */, + A7BBE26711AFB3F20005EA03 /* JSHTMLMeterElement.h in Headers */, 1AE2AB2A0A1CE63B00B42B25 /* JSHTMLModElement.h in Headers */, BC305C7A0C076BB300CD20F0 /* JSHTMLObjectElement.h in Headers */, 1A85B1EB0A1B240500D8C87C /* JSHTMLOListElement.h in Headers */, @@ -18302,6 +18386,8 @@ C5F4F40B119306AC00FDFADD /* JSIDBDatabaseRequest.h in Headers */, C56C91A1119D918100DE4CD9 /* JSIDBErrorEvent.h in Headers */, C56C91A3119D918100DE4CD9 /* JSIDBEvent.h in Headers */, + C5BBC9D111AEF838007C2BFE /* JSIDBIndexRequest.h in Headers */, + B6693EF311AD6486003F2770 /* JSIDBObjectStoreRequest.h in Headers */, C5F4F40D119306AC00FDFADD /* JSIDBRequest.h in Headers */, C56C91A7119D918700DE4CD9 /* JSIDBSuccessEvent.h in Headers */, BC6C49F40D7DBA0500FFA558 /* JSImageConstructor.h in Headers */, @@ -18322,6 +18408,7 @@ BCE1C43C0D9830D3003B02F2 /* JSLocation.h in Headers */, E44614190CD6826900FADA75 /* JSMediaError.h in Headers */, BC3C39B70C0D3D8D005F4D7A /* JSMediaList.h in Headers */, + 9FFE3EA611B5A4390037874E /* JSMemoryInfo.h in Headers */, E107400E0E77BDC00033AF24 /* JSMessageChannel.h in Headers */, E10743270E7835A50033AF24 /* JSMessageChannelConstructor.h in Headers */, 75793EC90D0CE72D007FC0AC /* JSMessageEvent.h in Headers */, @@ -18556,7 +18643,6 @@ E1C362EF0EAF2AA9007410BC /* JSWorkerLocation.h in Headers */, E1271A580EEECDE400F61213 /* JSWorkerNavigator.h in Headers */, BC348BD40DB7F804004ABAB9 /* JSXMLHttpRequest.h in Headers */, - BC348BEA0DB80354004ABAB9 /* JSXMLHttpRequestConstructor.h in Headers */, BC60DA3A0D2A302800B9918F /* JSXMLHttpRequestException.h in Headers */, F916C48E0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.h in Headers */, BCDFD4960E30592F009D10AD /* JSXMLHttpRequestUpload.h in Headers */, @@ -18573,8 +18659,10 @@ A59E3C1E11580F510072928E /* KeyEventCodesIPhone.h in Headers */, 316FE11A0E6E1DA700BF6088 /* KeyframeAnimation.h in Headers */, BC5EBA110E823E4700B25965 /* KeyframeList.h in Headers */, + 521D46F811AEC9B100514613 /* KillRing.h in Headers */, 6593923809AE4346002C531F /* KURL.h in Headers */, BCBD21AB0E417AD400A070F2 /* KURLHash.h in Headers */, + A456FA2711AD4A830020B420 /* LabelsNodeList.h in Headers */, 85EC9AFB0A71A2C600EEEAED /* Language.h in Headers */, 2D9066070BE141D400956998 /* LayoutState.h in Headers */, 512DD8F50D91E6AF000F89EE /* LegacyWebArchive.h in Headers */, @@ -18614,6 +18702,7 @@ 4E19592A0A39DACC00220FE5 /* MediaQuery.h in Headers */, 4E19592C0A39DACC00220FE5 /* MediaQueryEvaluator.h in Headers */, 4E19592E0A39DACC00220FE5 /* MediaQueryExp.h in Headers */, + 9FFE3E7B11B59C5D0037874E /* MemoryInfo.h in Headers */, 93309DFA099E64920056E581 /* MergeIdenticalElementsCommand.h in Headers */, E1ADECCE0E76AD8B004A1A5E /* MessageChannel.h in Headers */, 75793E840D0CE0B3007FC0AC /* MessageEvent.h in Headers */, @@ -18917,6 +19006,7 @@ 93309E10099E64920056E581 /* SetNodeAttributeCommand.h in Headers */, 93F1994F08245E59001E9ABC /* Settings.h in Headers */, BC5EB8C40E82031B00B25965 /* ShadowData.h in Headers */, + A7F338A411C0EFCA00A320A7 /* ShadowElement.h in Headers */, A80E6CE80A1989CA007FB8C5 /* ShadowValue.h in Headers */, B2AFFC940D00A5DF0030074D /* ShapeArabic.h in Headers */, 1A4A954E0B4EDCCB002D8C3C /* SharedBuffer.h in Headers */, @@ -19231,7 +19321,7 @@ 9305B24D098F1B6B00C28855 /* Timer.h in Headers */, E44613B00CD6331000FADA75 /* TimeRanges.h in Headers */, 49E912AE0EFAC906009D0CAF /* TimingFunction.h in Headers */, - BCCFBAE80B5152ED0001F1D7 /* Tokenizer.h in Headers */, + BCCFBAE80B5152ED0001F1D7 /* DocumentParser.h in Headers */, 49E911C40EF86D47009D0CAF /* TransformationMatrix.h in Headers */, 49E911CE0EF86D47009D0CAF /* TransformOperation.h in Headers */, 49E911D00EF86D47009D0CAF /* TransformOperations.h in Headers */, @@ -19377,8 +19467,8 @@ A833C80D0A2CF25600D57664 /* XMLNames.h in Headers */, E15A36D71104572000B7B639 /* XMLNSNames.h in Headers */, 1ACE53EB0A8D18E70022947D /* XMLSerializer.h in Headers */, - 93F1992108245E59001E9ABC /* XMLTokenizer.h in Headers */, - 5D15E3AC0F9E6AC1009E0E3F /* XMLTokenizerScope.h in Headers */, + 93F1992108245E59001E9ABC /* XMLDocumentParser.h in Headers */, + 5D15E3AC0F9E6AC1009E0E3F /* XMLDocumentParserScope.h in Headers */, 1AB7FC690A8B92EC00D9D37B /* XPathEvaluator.h in Headers */, BC60DA5B0D2A31F700B9918F /* XPathException.h in Headers */, 1AB7FC6C0A8B92EC00D9D37B /* XPathExpression.h in Headers */, @@ -19403,18 +19493,16 @@ E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */, 97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */, CE172E011136E8CE0062A533 /* ZoomMode.h in Headers */, - A456FA2711AD4A830020B420 /* LabelsNodeList.h in Headers */, B6693EEC11AD63E6003F2770 /* IDBObjectStore.h in Headers */, B6693EEE11AD63E6003F2770 /* IDBObjectStoreRequest.h in Headers */, B6693EF311AD6486003F2770 /* JSIDBObjectStoreRequest.h in Headers */, - A83B3AF111ADEFF500458809 /* HTML5ScriptRunner.h in Headers */, - 521D46F811AEC9B100514613 /* KillRing.h in Headers */, - A87F163511AE841300CBB2E5 /* HTML5ScriptRunnerHost.h in Headers */, C51DA9A511AEF2C1009799C5 /* IDBIndex.h in Headers */, C51DA9A711AEF2C1009799C5 /* IDBIndexImpl.h in Headers */, C51DA9A911AEF2C1009799C5 /* IDBIndexRequest.h in Headers */, C5BBC9D111AEF838007C2BFE /* JSIDBIndexRequest.h in Headers */, - 4F3289B611A42AAB005ABE7E /* InspectorValues.h in Headers */, + B6B0540A11B68F10002564C5 /* IDBObjectStoreImpl.h in Headers */, + 816C806911BE887E009A45E9 /* IDBKeyRange.h in Headers */, + 816C80AF11BE990D009A45E9 /* JSIDBKeyRange.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -19710,6 +19798,7 @@ BCFB2F76097A2E1A00BA703D /* Arena.cpp in Sources */, 49EECDE210503C2400099FAB /* ArrayBuffer.cpp in Sources */, 49EECDDF10503C2400099FAB /* ArrayBufferView.cpp in Sources */, + B0149E7D11A4B21500196A7B /* AsyncImageResizer.cpp in Sources */, A8C4A80E09D563270003AC8D /* Attr.cpp in Sources */, A8C4A80C09D563270003AC8D /* Attribute.cpp in Sources */, 934F71380D5A6EFF00018D69 /* AuthenticationChallengeBase.cpp in Sources */, @@ -19729,6 +19818,7 @@ BC5EB91F0E82040800B25965 /* BindingURI.cpp in Sources */, A89943290B42338800D7C802 /* BitmapImage.cpp in Sources */, 2EAFAF0E10E2AF2D007ED3D6 /* Blob.cpp in Sources */, + 8988E10E11A3508B00DB732E /* BlobItem.cpp in Sources */, 93F19AE108245E59001E9ABC /* BlockExceptions.mm in Sources */, BCEA4854097D93020094C9E4 /* break_lines.cpp in Sources */, 93309DDA099E64920056E581 /* BreakBlockquoteCommand.cpp in Sources */, @@ -19827,6 +19917,7 @@ A8C4A80A09D563270003AC8D /* CSSMappedAttributeDeclaration.cpp in Sources */, A80E6CFC0A1989CA007FB8C5 /* CSSMediaRule.cpp in Sources */, A80E6DFB0A199067007FB8C5 /* CSSMutableStyleDeclaration.cpp in Sources */, + F98FFF4411A2676200F548E8 /* CSSOMUtils.cpp in Sources */, A80E6CF50A1989CA007FB8C5 /* CSSPageRule.cpp in Sources */, BC772B3D0C4EA91E0083285F /* CSSParser.cpp in Sources */, BC02A5400E099C5A004B6D2B /* CSSParserValues.cpp in Sources */, @@ -19849,6 +19940,7 @@ BCCBE7B50E07166900EAFA8E /* CSSVariableDependentValue.cpp in Sources */, BCCBE69B0E06F51000EAFA8E /* CSSVariablesDeclaration.cpp in Sources */, BCCBE68B0E06E60D00EAFA8E /* CSSVariablesRule.cpp in Sources */, + E11AF15111B9A1A300805103 /* Cursor.cpp in Sources */, 93F19A2608245E59001E9ABC /* CursorMac.mm in Sources */, 62CD32591157E57C0063B0A7 /* CustomEvent.cpp in Sources */, 5196116A0CAC56570010A80C /* Database.cpp in Sources */, @@ -20211,7 +20303,7 @@ BC5EB69E0E81DAEB00B25965 /* FillLayer.cpp in Sources */, 08C925190FCC7C4A00480DEC /* FilterEffect.cpp in Sources */, A8CFF04D0A154F09000A4234 /* FixedTableLayout.cpp in Sources */, - 49EECDE510503C2400099FAB /* FloatArray.cpp in Sources */, + 49EECDE510503C2400099FAB /* Float32Array.cpp in Sources */, B27535680B053814002CE64F /* FloatPoint.cpp in Sources */, B2E27C9F0B0F2B0900F17C7B /* FloatPoint3D.cpp in Sources */, B27535590B053814002CE64F /* FloatPointCG.cpp in Sources */, @@ -20257,9 +20349,6 @@ FE80D7C50E9C1F25000D6F75 /* Geolocation.cpp in Sources */, BC56CB2110D5AC8000A77C64 /* GeolocationController.cpp in Sources */, 596229781133EFD700DC4CBB /* GeolocationPositionCache.cpp in Sources */, - FEAB90120EA51B9C006348C3 /* GeolocationService.cpp in Sources */, - BCE494AC0F4F5E9E0084E319 /* GeolocationServiceMac.mm in Sources */, - 59C77F2A10545B3B00506104 /* GeolocationServiceMock.cpp in Sources */, B2C3DA6D0D006CD600EF6F26 /* GlyphPageTreeNode.cpp in Sources */, B2AFFC830D00A5C10030074D /* GlyphPageTreeNodeMac.cpp in Sources */, BC53C6080DA56C570021EB5D /* Gradient.cpp in Sources */, @@ -20279,8 +20368,10 @@ 5160F4980B0AA75F00C1D2AF /* HistoryItemMac.mm in Sources */, 9363B62C0F8E8FE000803810 /* HistoryPropertyList.cpp in Sources */, 9307F1D70AF2D59000DBA31A /* HitTestResult.cpp in Sources */, + 976E896011C0CA3A00EA9CA9 /* HTML5EntityParser.cpp in Sources */, 97E8B35611A23CE200169409 /* HTML5Lexer.cpp in Sources */, - A871038A11A2947000DBD50E /* HTML5Tokenizer.cpp in Sources */, + A83B3AF011ADEFF500458809 /* HTML5ScriptRunner.cpp in Sources */, + A871038A11A2947000DBD50E /* HTML5DocumentParser.cpp in Sources */, A879C62511A9D1F70059237A /* HTML5TreeBuilder.cpp in Sources */, BC97E23B109144950010D361 /* HTMLAllCollection.cpp in Sources */, A8CFF7A40A156978000A4234 /* HTMLAnchorElement.cpp in Sources */, @@ -20349,7 +20440,7 @@ 9327A94209968D1A0068A546 /* HTMLOptionsCollection.cpp in Sources */, A8EA7CB20A192B9C00A8EF5F /* HTMLParagraphElement.cpp in Sources */, A871D4590A127CBC00B12A68 /* HTMLParamElement.cpp in Sources */, - 93F19A9B08245E59001E9ABC /* HTMLParser.cpp in Sources */, + 93F19A9B08245E59001E9ABC /* LegacyHTMLTreeConstructor.cpp in Sources */, BC588B4B0BFA723C00EE679E /* HTMLParserErrorCodes.cpp in Sources */, A871D4570A127CBC00B12A68 /* HTMLPlugInElement.cpp in Sources */, 4415292F0E1AE8A000C4A2D0 /* HTMLPlugInImageElement.cpp in Sources */, @@ -20370,7 +20461,7 @@ A871DB260A150BD600B12A68 /* HTMLTableSectionElement.cpp in Sources */, A81369D7097374F600D74463 /* HTMLTextAreaElement.cpp in Sources */, A871DC290A15205700B12A68 /* HTMLTitleElement.cpp in Sources */, - 93F19A9C08245E59001E9ABC /* HTMLTokenizer.cpp in Sources */, + 93F19A9C08245E59001E9ABC /* HTMLDocumentParser.cpp in Sources */, A8EA79F30A1916DF00A8EF5F /* HTMLUListElement.cpp in Sources */, E44613AA0CD6331000FADA75 /* HTMLVideoElement.cpp in Sources */, BCCD74E50A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp in Sources */, @@ -20383,9 +20474,14 @@ B275358E0B053A66002CE64F /* IconMac.mm in Sources */, 51E1ECC00C91C90400DC255B /* IconRecord.cpp in Sources */, C56C9152119D84CB00DE4CD9 /* IDBAny.cpp in Sources */, + B627FB2D11AD743500E97B72 /* IDBDatabaseImpl.cpp in Sources */, C5198F531192ECFD002B74A6 /* IDBDatabaseRequest.cpp in Sources */, C56C915F119D84E600DE4CD9 /* IDBErrorEvent.cpp in Sources */, C56C9162119D84E600DE4CD9 /* IDBEvent.cpp in Sources */, + C51DA9A611AEF2C1009799C5 /* IDBIndexImpl.cpp in Sources */, + C51DA9A811AEF2C1009799C5 /* IDBIndexRequest.cpp in Sources */, + B6B0540911B68F10002564C5 /* IDBObjectStoreImpl.cpp in Sources */, + B6693EED11AD63E6003F2770 /* IDBObjectStoreRequest.cpp in Sources */, C5198F561192ECFD002B74A6 /* IDBRequest.cpp in Sources */, C56C9168119D84FF00DE4CD9 /* IDBSuccessEvent.cpp in Sources */, 1A71D57B0F33819000F9CE4E /* IdentifierRep.cpp in Sources */, @@ -20396,6 +20492,7 @@ 1A820D910A13EBA600AF843C /* ImageDocument.cpp in Sources */, 089582550E857A7E00F82C83 /* ImageLoader.cpp in Sources */, B275357B0B053814002CE64F /* ImageMac.mm in Sources */, + B0149E7F11A4B21500196A7B /* ImageResizerThread.cpp in Sources */, B275355F0B053814002CE64F /* ImageSourceCG.cpp in Sources */, 4B3480930EEF50D400AC1B41 /* ImageSourceCGMac.mm in Sources */, 316FE1170E6E1DA700BF6088 /* ImplicitAnimation.cpp in Sources */, @@ -20426,6 +20523,7 @@ 7A0E770E10C00A8800A0276E /* InspectorFrontendHost.cpp in Sources */, 41F062020F5F0B6600A07EAC /* InspectorResource.cpp in Sources */, 754133AA102E00F400075D00 /* InspectorTimelineAgent.cpp in Sources */, + 4F3289B511A42AAB005ABE7E /* InspectorValues.cpp in Sources */, 49EECDEB10503C2400099FAB /* Int16Array.cpp in Sources */, 49EECDE810503C2400099FAB /* Int32Array.cpp in Sources */, 49C7B9CB1042D32F0009D447 /* Int8Array.cpp in Sources */, @@ -20555,9 +20653,9 @@ 2E3BC0CA117D3E0800B9409A /* JSFileError.cpp in Sources */, BC00F0160E0A189500FD04E3 /* JSFileList.cpp in Sources */, 2E94F43B119207DA00B7F75D /* JSFileReader.cpp in Sources */, - 49EECF02105070C400099FAB /* JSFloatArray.cpp in Sources */, - 49EECFAF1050938200099FAB /* JSFloatArrayConstructor.cpp in Sources */, - 49EECF7910508D9C00099FAB /* JSFloatArrayCustom.cpp in Sources */, + 49EECF02105070C400099FAB /* JSFloat32Array.cpp in Sources */, + 49EECFAF1050938200099FAB /* JSFloat32ArrayConstructor.cpp in Sources */, + 49EECF7910508D9C00099FAB /* JSFloat32ArrayCustom.cpp in Sources */, FE80DA630E9C4703000D6F75 /* JSGeolocation.cpp in Sources */, FE80D7AB0E9C1ED2000D6F75 /* JSGeolocationCustom.cpp in Sources */, FE80DA650E9C4703000D6F75 /* JSGeoposition.cpp in Sources */, @@ -20623,6 +20721,7 @@ E44614390CD689C700FADA75 /* JSHTMLMediaElement.cpp in Sources */, 1AE2AE5B0A1D26F200B42B25 /* JSHTMLMenuElement.cpp in Sources */, A80E7A170A19C3D6007FB8C5 /* JSHTMLMetaElement.cpp in Sources */, + A7BBE26611AFB3F20005EA03 /* JSHTMLMeterElement.cpp in Sources */, 1AE2AB290A1CE63B00B42B25 /* JSHTMLModElement.cpp in Sources */, BC305C790C076BB300CD20F0 /* JSHTMLObjectElement.cpp in Sources */, BC305CA40C0781BB00CD20F0 /* JSHTMLObjectElementCustom.cpp in Sources */, @@ -20658,6 +20757,8 @@ C5F4F40A119306AC00FDFADD /* JSIDBDatabaseRequest.cpp in Sources */, C56C91A0119D918100DE4CD9 /* JSIDBErrorEvent.cpp in Sources */, C56C91A2119D918100DE4CD9 /* JSIDBEvent.cpp in Sources */, + C5BBC9D011AEF838007C2BFE /* JSIDBIndexRequest.cpp in Sources */, + B6693EF211AD6486003F2770 /* JSIDBObjectStoreRequest.cpp in Sources */, C5F4F40C119306AC00FDFADD /* JSIDBRequest.cpp in Sources */, C56C91A6119D918700DE4CD9 /* JSIDBSuccessEvent.cpp in Sources */, BC6C49F30D7DBA0500FFA558 /* JSImageConstructor.cpp in Sources */, @@ -20687,6 +20788,7 @@ 8FAC774D119872CB0015AE94 /* JSMainThreadExecState.cpp in Sources */, E44614180CD6826900FADA75 /* JSMediaError.cpp in Sources */, BC3C39B60C0D3D8D005F4D7A /* JSMediaList.cpp in Sources */, + 9FFE3EA511B5A4390037874E /* JSMemoryInfo.cpp in Sources */, E107400D0E77BDC00033AF24 /* JSMessageChannel.cpp in Sources */, E10743240E7835830033AF24 /* JSMessageChannelConstructor.cpp in Sources */, E1A5F99B0E7EAA2500AF85EA /* JSMessageChannelCustom.cpp in Sources */, @@ -20953,7 +21055,6 @@ E1C362F00EAF2AA9007410BC /* JSWorkerLocation.cpp in Sources */, E1271A590EEECDE400F61213 /* JSWorkerNavigator.cpp in Sources */, BC348BD30DB7F804004ABAB9 /* JSXMLHttpRequest.cpp in Sources */, - BC348BE90DB80354004ABAB9 /* JSXMLHttpRequestConstructor.cpp in Sources */, BC348BBE0DB7F531004ABAB9 /* JSXMLHttpRequestCustom.cpp in Sources */, BC60DA390D2A302800B9918F /* JSXMLHttpRequestException.cpp in Sources */, F916C48D0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.cpp in Sources */, @@ -20974,9 +21075,11 @@ 935C477009AC4D7300A6AAB4 /* KeyEventMac.mm in Sources */, 316FE1190E6E1DA700BF6088 /* KeyframeAnimation.cpp in Sources */, BC5EBA100E823E4700B25965 /* KeyframeList.cpp in Sources */, + 521D46F611AEC98100514613 /* KillRingMac.mm in Sources */, 6593923709AE4346002C531F /* KURL.cpp in Sources */, 1A98956B0AA78F80005EF5EF /* KURLCFNet.cpp in Sources */, 6593923A09AE435C002C531F /* KURLMac.mm in Sources */, + A456FA2611AD4A830020B420 /* LabelsNodeList.cpp in Sources */, 9352084509BD43B900F2038D /* Language.mm in Sources */, 2D9066060BE141D400956998 /* LayoutState.cpp in Sources */, 512DD8F40D91E6AF000F89EE /* LegacyWebArchive.cpp in Sources */, @@ -21012,6 +21115,7 @@ 4E1959290A39DACC00220FE5 /* MediaQuery.cpp in Sources */, 4E19592B0A39DACC00220FE5 /* MediaQueryEvaluator.cpp in Sources */, 4E19592D0A39DACC00220FE5 /* MediaQueryExp.cpp in Sources */, + 9FFE3E7A11B59C5D0037874E /* MemoryInfo.cpp in Sources */, 93309DF9099E64920056E581 /* MergeIdenticalElementsCommand.cpp in Sources */, E1ADECCF0E76AD8B004A1A5E /* MessageChannel.cpp in Sources */, 75793E830D0CE0B3007FC0AC /* MessageEvent.cpp in Sources */, @@ -21277,6 +21381,7 @@ 93309E0F099E64920056E581 /* SetNodeAttributeCommand.cpp in Sources */, 14C9A5EA0B3D105F005A0232 /* Settings.cpp in Sources */, BC5EB8C30E82031B00B25965 /* ShadowData.cpp in Sources */, + A7F338A311C0EFCA00A320A7 /* ShadowElement.cpp in Sources */, A80E6CF40A1989CA007FB8C5 /* ShadowValue.cpp in Sources */, B2AFFC930D00A5DF0030074D /* ShapeArabic.c in Sources */, 1A4A954D0B4EDCCB002D8C3C /* SharedBuffer.cpp in Sources */, @@ -21678,9 +21783,9 @@ A833C80C0A2CF25600D57664 /* XMLNames.cpp in Sources */, E15A36D91104572700B7B639 /* XMLNSNames.cpp in Sources */, 1ACE53EA0A8D18E70022947D /* XMLSerializer.cpp in Sources */, - 93F19ABC08245E59001E9ABC /* XMLTokenizer.cpp in Sources */, - 54C50F7B0E801DF3009832A0 /* XMLTokenizerLibxml2.cpp in Sources */, - 5D15E3AB0F9E6AC1009E0E3F /* XMLTokenizerScope.cpp in Sources */, + 93F19ABC08245E59001E9ABC /* XMLDocumentParser.cpp in Sources */, + 54C50F7B0E801DF3009832A0 /* XMLDocumentParserLibxml2.cpp in Sources */, + 5D15E3AB0F9E6AC1009E0E3F /* XMLDocumentParserScope.cpp in Sources */, 1AB7FC680A8B92EC00D9D37B /* XPathEvaluator.cpp in Sources */, 1AB7FC6B0A8B92EC00D9D37B /* XPathExpression.cpp in Sources */, 1AB7FC6E0A8B92EC00D9D37B /* XPathExpressionNode.cpp in Sources */, @@ -21704,17 +21809,15 @@ 93F19B0508245E59001E9ABC /* XSLTProcessorLibxslt.cpp in Sources */, E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */, 97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */, - A456FA2611AD4A830020B420 /* LabelsNodeList.cpp in Sources */, - B6693EEB11AD63E6003F2770 /* IDBObjectStore.cpp in Sources */, B6693EED11AD63E6003F2770 /* IDBObjectStoreRequest.cpp in Sources */, B6693EF211AD6486003F2770 /* JSIDBObjectStoreRequest.cpp in Sources */, B627FB2D11AD743500E97B72 /* IDBDatabaseImpl.cpp in Sources */, - A83B3AF011ADEFF500458809 /* HTML5ScriptRunner.cpp in Sources */, - 521D46F611AEC98100514613 /* KillRingMac.mm in Sources */, C51DA9A611AEF2C1009799C5 /* IDBIndexImpl.cpp in Sources */, C51DA9A811AEF2C1009799C5 /* IDBIndexRequest.cpp in Sources */, C5BBC9D011AEF838007C2BFE /* JSIDBIndexRequest.cpp in Sources */, - 4F3289B511A42AAB005ABE7E /* InspectorValues.cpp in Sources */, + B6B0540911B68F10002564C5 /* IDBObjectStoreImpl.cpp in Sources */, + 816C806811BE887E009A45E9 /* IDBKeyRange.cpp in Sources */, + 816C80B111BE9934009A45E9 /* JSIDBKeyRange.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/WebCore/WebCorePrefix.h b/WebCore/WebCorePrefix.h index 09ffd4c..db79bad 100644 --- a/WebCore/WebCorePrefix.h +++ b/WebCore/WebCorePrefix.h @@ -59,7 +59,9 @@ #endif #else +#if !defined(BUILDING_BREWMP__) #include <pthread.h> +#endif #endif // defined(WIN32) || defined(_WIN32) #if defined(ANDROID) @@ -75,8 +77,10 @@ #include <JavaScriptCore/config.h> #endif +#if !defined(BUILDING_BREWMP__) #include <sys/types.h> #include <fcntl.h> +#endif #if defined(__APPLE__) #include <regex.h> #endif @@ -106,11 +110,15 @@ #endif +#if !defined(BUILDING_BREWMP__) #include <sys/types.h> +#endif #if defined(__APPLE__) #include <sys/param.h> #endif +#if !defined(BUILDING_BREWMP__) #include <sys/stat.h> +#endif #if defined(__APPLE__) #include <sys/time.h> #include <sys/resource.h> diff --git a/WebCore/accessibility/AccessibilityRenderObject.cpp b/WebCore/accessibility/AccessibilityRenderObject.cpp index 48829a2..ffe62f8 100644 --- a/WebCore/accessibility/AccessibilityRenderObject.cpp +++ b/WebCore/accessibility/AccessibilityRenderObject.cpp @@ -60,6 +60,7 @@ #include "RenderHTMLCanvas.h" #include "RenderImage.h" #include "RenderInline.h" +#include "RenderLayer.h" #include "RenderListBox.h" #include "RenderListMarker.h" #include "RenderMenuList.h" @@ -649,7 +650,7 @@ bool AccessibilityRenderObject::isOffScreen() const { ASSERT(m_renderer); IntRect contentRect = m_renderer->absoluteClippedOverflowRect(); - FrameView* view = m_renderer->document()->frame()->view(); + FrameView* view = m_renderer->frame()->view(); FloatRect viewRect = view->visibleContentRect(); viewRect.intersect(contentRect); return viewRect.isEmpty(); @@ -928,6 +929,10 @@ String AccessibilityRenderObject::helpText() const if (!m_renderer) return String(); + const AtomicString& ariaHelp = getAttribute(aria_helpAttr); + if (!ariaHelp.isEmpty()) + return ariaHelp; + for (RenderObject* curr = m_renderer; curr; curr = curr->parent()) { if (curr->node() && curr->node()->isHTMLElement()) { const AtomicString& summary = static_cast<Element*>(curr->node())->getAttribute(summaryAttr); @@ -1126,7 +1131,7 @@ String AccessibilityRenderObject::stringValue() const return toRenderButton(m_renderer)->text(); if (isWebArea()) { - if (m_renderer->document()->frame()) + if (m_renderer->frame()) return String(); // FIXME: should use startOfDocument and endOfDocument (or rangeForDocument?) here @@ -1469,8 +1474,8 @@ AccessibilityObject* AccessibilityRenderObject::internalLinkElement() const return 0; // check if URL is the same as current URL - linkURL.removeFragmentIdentifier(); - if (m_renderer->document()->url() != linkURL) + KURL documentURL = m_renderer->document()->url(); + if (!equalIgnoringFragmentIdentifier(documentURL, linkURL)) return 0; Node* linkedNode = m_renderer->document()->findAnchor(fragmentIdentifier); @@ -1848,7 +1853,7 @@ bool AccessibilityRenderObject::accessibilityIsIgnored() const bool AccessibilityRenderObject::isLoaded() const { - return !m_renderer->document()->tokenizer(); + return !m_renderer->document()->parser(); } double AccessibilityRenderObject::estimatedLoadingProgress() const @@ -1968,7 +1973,7 @@ const AtomicString& AccessibilityRenderObject::accessKey() const VisibleSelection AccessibilityRenderObject::selection() const { - return m_renderer->document()->frame()->selection()->selection(); + return m_renderer->frame()->selection()->selection(); } PlainTextRange AccessibilityRenderObject::selectedTextRange() const @@ -2521,10 +2526,10 @@ void AccessibilityRenderObject::setSelectedVisiblePositionRange(const VisiblePos // make selection and tell the document to use it. if it's zero length, then move to that position if (range.start == range.end) - m_renderer->document()->frame()->selection()->moveTo(range.start, true); + m_renderer->frame()->selection()->moveTo(range.start, true); else { VisibleSelection newSelection = VisibleSelection(range.start, range.end); - m_renderer->document()->frame()->selection()->setSelection(newSelection); + m_renderer->frame()->selection()->setSelection(newSelection); } } diff --git a/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm b/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm index 8e81935..1fdb0cc 100644 --- a/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm +++ b/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm @@ -2331,12 +2331,9 @@ static RenderObject* rendererForView(NSView* view) } else if ([parameter isKindOfClass:[NSValue self]] && strcmp([(NSValue*)parameter objCType], @encode(NSRange)) == 0) { rangeSet = true; range = [(NSValue*)parameter rangeValue]; - } else { - // got a parameter of a type we never use - // NOTE: No ASSERT_NOT_REACHED because this can happen accidentally - // while using accesstool (e.g.), forcing you to start over - return nil; + // Attribute type is not supported. Allow super to handle. + return [super accessibilityAttributeValue:attribute forParameter:parameter]; } // dispatch @@ -2575,7 +2572,9 @@ static RenderObject* rendererForView(NSView* view) } } - return nil; + // There are some parameters that super handles that are not explicitly returned by the list of the element's attributes. + // In that case it must be passed to super. + return [super accessibilityAttributeValue:attribute forParameter:parameter]; } - (BOOL)accessibilityShouldUseUniqueId diff --git a/WebCore/bindings/cpp/WebDOMCString.cpp b/WebCore/bindings/cpp/WebDOMCString.cpp new file mode 100644 index 0000000..ab87ac8 --- /dev/null +++ b/WebCore/bindings/cpp/WebDOMCString.cpp @@ -0,0 +1,113 @@ +/* + * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * Copyright (C) 2009 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. + */ + +#include "config.h" +#include "WebDOMCString.h" + +#include "TextEncoding.h" +#include "WebDOMString.h" +#include <wtf/text/CString.h> + +class WebDOMCStringPrivate : public WTF::CStringBuffer { +}; + +void WebDOMCString::reset() +{ + if (m_private) { + m_private->deref(); + m_private = 0; + } +} + +void WebDOMCString::assign(const WebDOMCString& other) +{ + assign(const_cast<WebDOMCStringPrivate*>(other.m_private)); +} + +void WebDOMCString::assign(const char* data, size_t length) +{ + char* newData; + RefPtr<WTF::CStringBuffer> buffer = + WTF::CString::newUninitialized(length, newData).buffer(); + memcpy(newData, data, length); + assign(static_cast<WebDOMCStringPrivate*>(buffer.get())); +} + +size_t WebDOMCString::length() const +{ + if (!m_private) + return 0; + // NOTE: The buffer's length includes the null byte. + return const_cast<WebDOMCStringPrivate*>(m_private)->length() - 1; +} + +const char* WebDOMCString::data() const +{ + if (!m_private) + return 0; + return const_cast<WebDOMCStringPrivate*>(m_private)->data(); +} + +WebDOMString WebDOMCString::utf16() const +{ + return WebCore::UTF8Encoding().decode(data(), length()); +} + +WebDOMCString WebDOMCString::fromUTF16(const WebUChar* data, size_t length) +{ + return WebCore::UTF8Encoding().encode( + data, length, WebCore::QuestionMarksForUnencodables); +} + +WebDOMCString WebDOMCString::fromUTF16(const WebUChar* data) +{ + size_t len = 0; + while (data[len] != WebUChar(0)) + len++; + return fromUTF16(data, len); +} + +WebDOMCString::WebDOMCString(const WTF::CString& s) + : m_private(static_cast<WebDOMCStringPrivate*>(s.buffer())) +{ + if (m_private) + m_private->ref(); +} + +WebDOMCString& WebDOMCString::operator=(const WTF::CString& s) +{ + assign(static_cast<WebDOMCStringPrivate*>(s.buffer())); + return *this; +} + +WebDOMCString::operator WTF::CString() const +{ + return m_private; +} + +void WebDOMCString::assign(WebDOMCStringPrivate* p) +{ + // Take care to handle the case where m_private == p + if (p) + p->ref(); + if (m_private) + m_private->deref(); + m_private = p; +} diff --git a/WebCore/bindings/cpp/WebDOMCString.h b/WebCore/bindings/cpp/WebDOMCString.h new file mode 100644 index 0000000..e02a587 --- /dev/null +++ b/WebCore/bindings/cpp/WebDOMCString.h @@ -0,0 +1,89 @@ +/* + * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * Copyright (C) 2009 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 WebDOMCString_h +#define WebDOMCString_h + +#include <WebDOMObject.h> +#include <stddef.h> // For size_t + +namespace WTF { +class CString; +}; + +// UTF-16 character type +#if defined(WIN32) +typedef wchar_t WebUChar; +#else +typedef unsigned short WebUChar; +#endif + +class WebDOMCStringPrivate; +class WebDOMString; + +// A single-byte string container with unspecified encoding. It is +// inexpensive to copy a WebDOMCString object. +// +// WARNING: It is not safe to pass a WebDOMCString across threads!!! +// +class WebDOMCString { +public: + ~WebDOMCString() { reset(); } + + WebDOMCString() : m_private(0) { } + + WebDOMCString(const char* data, size_t len) : m_private(0) + { + assign(data, len); + } + + WebDOMCString(const WebDOMCString& s) : m_private(0) { assign(s); } + + WebDOMCString& operator=(const WebDOMCString& s) + { + assign(s); + return *this; + } + + void reset(); + void assign(const WebDOMCString&); + void assign(const char* data, size_t len); + + size_t length() const; + const char* data() const; + + bool isEmpty() const { return !length(); } + bool isNull() const { return !m_private; } + + WebDOMString utf16() const; + + static WebDOMCString fromUTF16(const WebUChar* data, size_t length); + static WebDOMCString fromUTF16(const WebUChar* data); + + WebDOMCString(const WTF::CString&); + WebDOMCString& operator=(const WTF::CString&); + operator WTF::CString() const; + +private: + void assign(WebDOMCStringPrivate*); + WebDOMCStringPrivate* m_private; +}; + +#endif diff --git a/WebCore/bindings/cpp/WebDOMEventListenerCustom.cpp b/WebCore/bindings/cpp/WebDOMEventListenerCustom.cpp new file mode 100644 index 0000000..db31b71 --- /dev/null +++ b/WebCore/bindings/cpp/WebDOMEventListenerCustom.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (C) Research In Motion Limited 2010. 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. + */ + +#include "config.h" +#include "WebDOMEventListener.h" + +#include "WebDOMEvent.h" +#include "WebNativeEventListener.h" +#include <wtf/RefPtr.h> + +void WebDOMEventListener::handleEvent(const WebDOMEvent& evt) +{ + if (!impl()) + return; + + impl()->handleEvent(0, toWebCore(evt)); +} + +WebDOMEventListener toWebKit(WebUserEventListener* value) +{ + RefPtr<WebNativeEventListener> listener = WebNativeEventListener::create(value); + return WebDOMEventListener(listener.get()); +} diff --git a/WebCore/bindings/cpp/WebDOMEventTarget.cpp b/WebCore/bindings/cpp/WebDOMEventTarget.cpp new file mode 100644 index 0000000..2eaef00 --- /dev/null +++ b/WebCore/bindings/cpp/WebDOMEventTarget.cpp @@ -0,0 +1,155 @@ +/* + * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * 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 "WebDOMEventTarget.h" + +#include "DOMApplicationCache.h" +#include "DedicatedWorkerContext.h" +#include "EventSource.h" +#include "MessagePort.h" +#include "Node.h" +#include "Notification.h" +#include "SharedWorker.h" +#include "SharedWorkerContext.h" +#include "ThreadCheck.h" +#include "WebDOMDOMApplicationCache.h" +#include "WebDOMDedicatedWorkerContext.h" +#include "WebDOMEventSource.h" +#include "WebDOMMessagePort.h" +#include "WebDOMNode.h" +#include "WebDOMNotification.h" +#include "WebDOMSharedWorker.h" +#include "WebDOMSharedWorkerContext.h" +#include "WebDOMWebSocket.h" +#include "WebDOMWorker.h" +#include "WebDOMXMLHttpRequest.h" +#include "WebDOMXMLHttpRequestUpload.h" +#include "WebExceptionHandler.h" +#include "WebSocket.h" +#include "Worker.h" +#include "XMLHttpRequest.h" +#include "XMLHttpRequestUpload.h" + +#include <wtf/RefPtr.h> + +struct WebDOMEventTarget::WebDOMEventTargetPrivate { + WebDOMEventTargetPrivate(WebCore::EventTarget* object = 0) + : impl(object) + { + } + + RefPtr<WebCore::EventTarget> impl; +}; + +WebDOMEventTarget::WebDOMEventTarget() + : WebDOMObject() + , m_impl(0) +{ +} + +WebDOMEventTarget::WebDOMEventTarget(WebCore::EventTarget* impl) + : WebDOMObject() + , m_impl(new WebDOMEventTargetPrivate(impl)) +{ +} + +WebDOMEventTarget::WebDOMEventTarget(const WebDOMEventTarget& copy) + : WebDOMObject() +{ + m_impl = copy.impl() ? new WebDOMEventTargetPrivate(copy.impl()) : 0; +} + +WebDOMEventTarget::~WebDOMEventTarget() +{ + delete m_impl; + m_impl = 0; +} + +WebCore::EventTarget* WebDOMEventTarget::impl() const +{ + return m_impl ? m_impl->impl.get() : 0; +} + +WebCore::EventTarget* toWebCore(const WebDOMEventTarget& wrapper) +{ + return wrapper.impl(); +} + +WebDOMEventTarget toWebKit(WebCore::EventTarget* value) +{ +#if ENABLE(EVENTSOURCE) + if (WebCore::EventSource* eventSource = value->toEventSource()) + return toWebKit(eventSource); +#endif + +#if ENABLE(SVG) && 0 + // FIXME: Enable once SVG bindings are generated. + // SVGElementInstance supports both toSVGElementInstance and toNode since so much mouse handling code depends on toNode returning a valid node. + if (WebCore::SVGElementInstance* instance = value->toSVGElementInstance()) + return toWebKit(instance); +#endif + + if (WebCore::Node* node = value->toNode()) + return toWebKit(node); + + if (WebCore::XMLHttpRequest* xhr = value->toXMLHttpRequest()) + return toWebKit(xhr); + + if (WebCore::XMLHttpRequestUpload* upload = value->toXMLHttpRequestUpload()) + return toWebKit(upload); + +#if ENABLE(OFFLINE_WEB_APPLICATIONS) + if (WebCore::DOMApplicationCache* cache = value->toDOMApplicationCache()) + return toWebKit(cache); +#endif + + if (WebCore::MessagePort* messagePort = value->toMessagePort()) + return toWebKit(messagePort); + +#if ENABLE(WORKERS) + if (WebCore::Worker* worker = value->toWorker()) + return toWebKit(worker); + + if (WebCore::DedicatedWorkerContext* workerContext = value->toDedicatedWorkerContext()) + return toWebKit(workerContext); +#endif + +#if ENABLE(SHARED_WORKERS) + if (WebCore::SharedWorker* sharedWorker = value->toSharedWorker()) + return toWebKit(sharedWorker); + + if (WebCore::SharedWorkerContext* workerContext = value->toSharedWorkerContext()) + return toWebKit(workerContext); +#endif + +#if ENABLE(NOTIFICATIONS) + if (WebCore::Notification* notification = value->toNotification()) + return toWebKit(notification); +#endif + +#if ENABLE(WEB_SOCKETS) + if (WebCore::WebSocket* webSocket = value->toWebSocket()) + return toWebKit(webSocket); +#endif + + ASSERT_NOT_REACHED(); + return WebDOMEventTarget(); +} diff --git a/WebCore/bindings/cpp/WebDOMEventTarget.h b/WebCore/bindings/cpp/WebDOMEventTarget.h new file mode 100644 index 0000000..f5360ca --- /dev/null +++ b/WebCore/bindings/cpp/WebDOMEventTarget.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) Research In Motion Limited 2010. 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 WebDOMEventTarget_h +#define WebDOMEventTarget_h + +#include <WebDOMObject.h> + +namespace WebCore { +class EventTarget; +}; + +class WebDOMEventTarget : public WebDOMObject { +public: + WebDOMEventTarget(); + explicit WebDOMEventTarget(WebCore::EventTarget*); + WebDOMEventTarget(const WebDOMEventTarget&); + ~WebDOMEventTarget(); + + WebCore::EventTarget* impl() const; + + // FIXME: Add a possibility to check what kind of EventTarget we have, + // to be able to cast eg. a WebDOMEventTarget to a WebDOMNode + +protected: + struct WebDOMEventTargetPrivate; + WebDOMEventTargetPrivate* m_impl; +}; + +WebCore::EventTarget* toWebCore(const WebDOMEventTarget&); +WebDOMEventTarget toWebKit(WebCore::EventTarget*); + +#endif diff --git a/WebCore/bindings/cpp/WebDOMHTMLDocumentCustom.cpp b/WebCore/bindings/cpp/WebDOMHTMLDocumentCustom.cpp new file mode 100644 index 0000000..aa511ad --- /dev/null +++ b/WebCore/bindings/cpp/WebDOMHTMLDocumentCustom.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) Research In Motion Limited 2010. 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. + */ + +#include "config.h" +#include "WebDOMHTMLDocument.h" + +#include "CharacterNames.h" +#include "HTMLDocument.h" +#include "SegmentedString.h" +#include "WebExceptionHandler.h" + +static inline void documentWrite(const WebDOMString& text, WebCore::HTMLDocument* document, bool addNewline) +{ + WebCore::SegmentedString segmentedString = WebCore::String(text); + if (addNewline) + segmentedString.append(WebCore::SegmentedString(&WebCore::newlineCharacter, 1)); + document->write(segmentedString); +} + +void WebDOMHTMLDocument::write(const WebDOMString& text) +{ + if (!impl()) + return; + + documentWrite(text, impl(), false); +} + +void WebDOMHTMLDocument::writeln(const WebDOMString& text) +{ + if (!impl()) + return; + + documentWrite(text, impl(), true); +} diff --git a/WebCore/bindings/cpp/WebDOMNodeCustom.cpp b/WebCore/bindings/cpp/WebDOMNodeCustom.cpp new file mode 100644 index 0000000..41abb0c --- /dev/null +++ b/WebCore/bindings/cpp/WebDOMNodeCustom.cpp @@ -0,0 +1,96 @@ +/* + * Copyright (C) Research In Motion Limited 2010. 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. + */ + +#include "config.h" +#include "WebDOMNode.h" + +#include "Node.h" +#include "WebDOMEventListener.h" +#include "WebExceptionHandler.h" +#include "WebNativeEventListener.h" + +WebDOMNode WebDOMNode::insertBefore(const WebDOMNode& newChild, const WebDOMNode& refChild) +{ + if (!impl()) + return WebDOMNode(); + + WebCore::ExceptionCode ec = 0; + if (impl()->insertBefore(toWebCore(newChild), toWebCore(refChild), ec, true)) + return newChild; + + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); + return WebDOMNode(); +} + +WebDOMNode WebDOMNode::replaceChild(const WebDOMNode& newChild, const WebDOMNode& oldChild) +{ + if (!impl()) + return WebDOMNode(); + + WebCore::ExceptionCode ec = 0; + if (impl()->replaceChild(toWebCore(newChild), toWebCore(oldChild), ec, true)) + return oldChild; + + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); + return WebDOMNode(); +} + +WebDOMNode WebDOMNode::removeChild(const WebDOMNode& oldChild) +{ + if (!impl()) + return WebDOMNode(); + + WebCore::ExceptionCode ec = 0; + if (impl()->removeChild(toWebCore(oldChild), ec)) + return oldChild; + + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); + return WebDOMNode(); +} + +WebDOMNode WebDOMNode::appendChild(const WebDOMNode& newChild) +{ + if (!impl()) + return WebDOMNode(); + + WebCore::ExceptionCode ec = 0; + if (impl()->appendChild(toWebCore(newChild), ec, true)) + return newChild; + + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); + return WebDOMNode(); +} + +void WebDOMNode::addEventListener(const WebDOMString& type, const WebDOMEventListener& listener, bool useCapture) +{ + if (!impl()) + return; + + if (toWebCore(listener)) + impl()->addEventListener(type, toWebCore(listener), useCapture); +} + +void WebDOMNode::removeEventListener(const WebDOMString& type, const WebDOMEventListener& listener, bool useCapture) +{ + if (!impl()) + return; + + if (toWebCore(listener)) + impl()->removeEventListener(type, toWebCore(listener), useCapture); +} diff --git a/WebCore/bindings/cpp/WebDOMObject.h b/WebCore/bindings/cpp/WebDOMObject.h new file mode 100644 index 0000000..4d1830b --- /dev/null +++ b/WebCore/bindings/cpp/WebDOMObject.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) Research In Motion Limited 2010. 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 WebDOMObject_h +#define WebDOMObject_h + +class WebDOMObject { +protected: + WebDOMObject() { } + ~WebDOMObject() { } +}; + +// Looks akward, though we prefix all classes with WebDOM +typedef unsigned long long WebDOMDOMTimeStamp; + +#endif diff --git a/WebCore/bindings/cpp/WebDOMString.cpp b/WebCore/bindings/cpp/WebDOMString.cpp new file mode 100644 index 0000000..d87dedd --- /dev/null +++ b/WebCore/bindings/cpp/WebDOMString.cpp @@ -0,0 +1,124 @@ +/* + * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * Copyright (C) 2009 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. + */ + +#include "config.h" +#include "WebDOMString.h" + +#include "WebDOMCString.h" +#include <wtf/text/AtomicString.h> +#include <wtf/text/CString.h> +#include <wtf/text/WTFString.h> + +class WebDOMStringPrivate : public WebCore::StringImpl { +}; + +void WebDOMString::reset() +{ + if (m_private) { + m_private->deref(); + m_private = 0; + } +} + +void WebDOMString::assign(const WebDOMString& other) +{ + assign(const_cast<WebDOMStringPrivate*>(other.m_private)); +} + +void WebDOMString::assign(const WebUChar* data, size_t length) +{ + assign(static_cast<WebDOMStringPrivate*>( + WebCore::StringImpl::create(data, length).get())); +} + +size_t WebDOMString::length() const +{ + return m_private ? const_cast<WebDOMStringPrivate*>(m_private)->length() : 0; +} + +const WebUChar* WebDOMString::data() const +{ + return m_private ? const_cast<WebDOMStringPrivate*>(m_private)->characters() : 0; +} + +WebDOMCString WebDOMString::utf8() const +{ + return WebCore::String(m_private).utf8(); +} + +WebDOMString WebDOMString::fromUTF8(const char* data, size_t length) +{ + return WebCore::String::fromUTF8(data, length); +} + +WebDOMString WebDOMString::fromUTF8(const char* data) +{ + return WebCore::String::fromUTF8(data); +} + +WebDOMString::WebDOMString(const WebCore::String& s) + : m_private(static_cast<WebDOMStringPrivate*>(s.impl())) +{ + if (m_private) + m_private->ref(); +} + +WebDOMString& WebDOMString::operator=(const WebCore::String& s) +{ + assign(static_cast<WebDOMStringPrivate*>(s.impl())); + return *this; +} + +WebDOMString::operator WebCore::String() const +{ + return m_private; +} + +WebDOMString::WebDOMString(const WebCore::AtomicString& s) + : m_private(0) +{ + assign(s.string()); +} + +WebDOMString& WebDOMString::operator=(const WebCore::AtomicString& s) +{ + assign(s.string()); + return *this; +} + +WebDOMString::operator WebCore::AtomicString() const +{ + return WebCore::AtomicString(static_cast<WebCore::StringImpl *>(m_private)); +} + +bool WebDOMString::equals(const char* string) const +{ + return WebCore::equal(m_private, string); +} + +void WebDOMString::assign(WebDOMStringPrivate* p) +{ + // Take care to handle the case where m_private == p + if (p) + p->ref(); + if (m_private) + m_private->deref(); + m_private = p; +} diff --git a/WebCore/bindings/cpp/WebDOMString.h b/WebCore/bindings/cpp/WebDOMString.h new file mode 100644 index 0000000..ca09ee8 --- /dev/null +++ b/WebCore/bindings/cpp/WebDOMString.h @@ -0,0 +1,99 @@ +/* + * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * Copyright (C) 2009 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 WebDOMString_h +#define WebDOMString_h + +#include <WebDOMCString.h> + +namespace WebCore { +class String; +class AtomicString; +} + +class WebDOMStringPrivate; + +// A UTF-16 string container. It is inexpensive to copy a WebDOMString +// object. +// +// WARNING: It is not safe to pass a WebDOMString across threads!!! +// +class WebDOMString { +public: + ~WebDOMString() { reset(); } + + WebDOMString() : m_private(0) { } + + WebDOMString(const WebUChar* data, size_t len) : m_private(0) + { + assign(data, len); + } + + WebDOMString(const WebDOMString& s) : m_private(0) { assign(s); } + + WebDOMString& operator=(const WebDOMString& s) + { + assign(s); + return *this; + } + + void reset(); + void assign(const WebDOMString&); + void assign(const WebUChar* data, size_t len); + + size_t length() const; + const WebUChar* data() const; + + bool isEmpty() const { return !length(); } + bool isNull() const { return !m_private; } + + WebDOMCString utf8() const; + + static WebDOMString fromUTF8(const char* data, size_t length); + static WebDOMString fromUTF8(const char* data); + + template <int N> WebDOMString(const char (&data)[N]) + : m_private(0) + { + assign(fromUTF8(data, N - 1)); + } + + template <int N> WebDOMString& operator=(const char (&data)[N]) + { + assign(fromUTF8(data, N - 1)); + return *this; + } + + WebDOMString(const WebCore::String&); + WebDOMString& operator=(const WebCore::String&); + operator WebCore::String() const; + + WebDOMString(const WebCore::AtomicString&); + WebDOMString& operator=(const WebCore::AtomicString&); + operator WebCore::AtomicString() const; + + bool equals(const char* string) const; + +private: + void assign(WebDOMStringPrivate*); + WebDOMStringPrivate* m_private; +}; + +#endif diff --git a/WebCore/bindings/cpp/WebExceptionHandler.cpp b/WebCore/bindings/cpp/WebExceptionHandler.cpp new file mode 100644 index 0000000..f285525 --- /dev/null +++ b/WebCore/bindings/cpp/WebExceptionHandler.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (C) Research In Motion Limited 2010. 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. + */ + +#include "config.h" +#include "WebExceptionHandler.h" + +// To avoid a global static symbol, we declare it in a function +static inline WebExceptionHandler& globalExceptionHandler() +{ + static WebExceptionHandler s_globalExceptionHandler; + return s_globalExceptionHandler; +} + +void webInstallExceptionHandler(WebExceptionHandler handler) +{ + ASSERT(handler); + globalExceptionHandler() = handler; +} + +void webRaiseDOMException(WebDOMExceptionCode ec) +{ + ASSERT(ec); + if (WebExceptionHandler& handler = globalExceptionHandler()) + (*handler)(ec); +} diff --git a/WebCore/bindings/cpp/WebExceptionHandler.h b/WebCore/bindings/cpp/WebExceptionHandler.h new file mode 100644 index 0000000..e679254 --- /dev/null +++ b/WebCore/bindings/cpp/WebExceptionHandler.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * 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 WebExceptionHandler_h +#define WebExceptionHandler_h + +typedef int WebDOMExceptionCode; +typedef void (*WebExceptionHandler)(WebDOMExceptionCode); + +// Used from the outside to register a callback that gets fired whenever an exception is raised +void webInstallExceptionHandler(WebExceptionHandler); + +// Never used by the bindings, only indirectly by webDOMRaiseError +void webRaiseDOMException(WebDOMExceptionCode); + +// Used from the bindings +inline void webDOMRaiseError(WebDOMExceptionCode ec) +{ + if (ec) + webRaiseDOMException(ec); +} + +#endif diff --git a/WebCore/bindings/cpp/WebNativeEventListener.cpp b/WebCore/bindings/cpp/WebNativeEventListener.cpp new file mode 100644 index 0000000..ddd7112 --- /dev/null +++ b/WebCore/bindings/cpp/WebNativeEventListener.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (C) Research In Motion Limited 2010. 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. + */ + +#include "config.h" +#include "WebNativeEventListener.h" + +#include "WebDOMEvent.h" + +WebNativeEventListener::WebNativeEventListener(WebUserEventListener* listener) + : WebCore::EventListener(CPPEventListenerType), + m_listener(listener) +{ + ASSERT(m_listener); + m_listener->ref(); +} + +WebNativeEventListener::~WebNativeEventListener() +{ + m_listener->deref(); +} + +void WebNativeEventListener::handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event* event) +{ + m_listener->handleEvent(toWebKit(event)); +} + +bool WebNativeEventListener::reportError(WebCore::ScriptExecutionContext*, const WebCore::String&, const WebCore::String&, int) +{ + // FIXME: Implement error handling + return false; +} + +bool WebNativeEventListener::operator==(const WebCore::EventListener& other) +{ + const WebNativeEventListener* ptrOther = cast(&other); + return ptrOther && m_listener == ptrOther->m_listener; +} diff --git a/WebCore/bindings/cpp/WebNativeEventListener.h b/WebCore/bindings/cpp/WebNativeEventListener.h new file mode 100644 index 0000000..fff1b1c --- /dev/null +++ b/WebCore/bindings/cpp/WebNativeEventListener.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * Copyright (C) 2001 Peter Kelly (pmk@post.com) + * Copyright (C) 2003, 2008, 2009 Apple Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * 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 WebNativeEventListener_h +#define WebNativeEventListener_h + +#include "EventListener.h" +#include "WebDOMEventListener.h" + +class WebNativeEventListener : public WebCore::EventListener { +public: + static PassRefPtr<WebNativeEventListener> create(WebUserEventListener* listener) + { + return adoptRef(new WebNativeEventListener(listener)); + } + + static const WebNativeEventListener* cast(const WebCore::EventListener* listener) + { + return listener->type() == CPPEventListenerType + ? static_cast<const WebNativeEventListener*>(listener) + : 0; + } + + virtual ~WebNativeEventListener(); + virtual bool operator==(const WebCore::EventListener& other); + +private: + virtual void handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event*); + virtual bool reportError(WebCore::ScriptExecutionContext*, const WebCore::String& message, const WebCore::String& url, int lineNumber); + +protected: + WebNativeEventListener(WebUserEventListener*); + WebUserEventListener* m_listener; +}; + +#endif diff --git a/WebCore/bindings/generic/BindingSecurity.h b/WebCore/bindings/generic/BindingSecurity.h index 929b8f4..d7c9dfe 100644 --- a/WebCore/bindings/generic/BindingSecurity.h +++ b/WebCore/bindings/generic/BindingSecurity.h @@ -36,6 +36,7 @@ #include "Element.h" #include "GenericBinding.h" #include "HTMLFrameElementBase.h" +#include "HTMLNames.h" namespace WebCore { diff --git a/WebCore/bindings/generic/RuntimeEnabledFeatures.h b/WebCore/bindings/generic/RuntimeEnabledFeatures.h index c84465a..2d62a27 100644 --- a/WebCore/bindings/generic/RuntimeEnabledFeatures.h +++ b/WebCore/bindings/generic/RuntimeEnabledFeatures.h @@ -87,7 +87,7 @@ public: static bool uint16ArrayEnabled() { return isWebGLEnabled; } static bool int32ArrayEnabled() { return isWebGLEnabled; } static bool uint32ArrayEnabled() { return isWebGLEnabled; } - static bool floatArrayEnabled() { return isWebGLEnabled; } + static bool float32ArrayEnabled() { return isWebGLEnabled; } static bool webGLRenderingContextEnabled() { return isWebGLEnabled; } static bool webGLArrayBufferEnabled() { return isWebGLEnabled; } static bool webGLByteArrayEnabled() { return isWebGLEnabled; } diff --git a/WebCore/bindings/js/JSArrayBufferConstructor.cpp b/WebCore/bindings/js/JSArrayBufferConstructor.cpp index 2930be8..683f9d1 100644 --- a/WebCore/bindings/js/JSArrayBufferConstructor.cpp +++ b/WebCore/bindings/js/JSArrayBufferConstructor.cpp @@ -46,22 +46,22 @@ JSArrayBufferConstructor::JSArrayBufferConstructor(ExecState* exec, JSDOMGlobalO putDirect(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly|DontDelete|DontEnum); } -static JSObject* constructCanvasArrayBuffer(ExecState* exec, JSObject* constructor, const ArgList& args) +static EncodedJSValue JSC_HOST_CALL constructCanvasArrayBuffer(ExecState* exec) { - JSArrayBufferConstructor* jsConstructor = static_cast<JSArrayBufferConstructor*>(constructor); + JSArrayBufferConstructor* jsConstructor = static_cast<JSArrayBufferConstructor*>(exec->callee()); unsigned int size = 0; - if (args.size() == 1) { - size = (unsigned int)args.at(0).toInt32(exec); + if (exec->argumentCount() == 1) { + size = (unsigned int)exec->argument(0).toInt32(exec); if (isnan(size)) size = 0; } RefPtr<ArrayBuffer> buffer = ArrayBuffer::create(size, 1); if (!buffer.get()){ setDOMException(exec, INDEX_SIZE_ERR); - return 0; + return JSValue::encode(JSValue()); } - return asObject(toJS(exec, jsConstructor->globalObject(), buffer.get())); + return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), buffer.get()))); } JSC::ConstructType JSArrayBufferConstructor::getConstructData(JSC::ConstructData& constructData) diff --git a/WebCore/bindings/js/JSArrayBufferConstructor.h b/WebCore/bindings/js/JSArrayBufferConstructor.h index fd03815..fa07a55 100644 --- a/WebCore/bindings/js/JSArrayBufferConstructor.h +++ b/WebCore/bindings/js/JSArrayBufferConstructor.h @@ -70,7 +70,7 @@ namespace WebCore { unsigned length = array->get(exec, JSC::Identifier(exec, "length")).toUInt32(exec); void* tempValues; if (!tryFastCalloc(length, sizeof(T)).getValue(tempValues)) { - throwError(exec, JSC::GeneralError); + throwError(exec, createError(exec, "Error")); return 0; } diff --git a/WebCore/bindings/js/JSArrayBufferViewCustom.cpp b/WebCore/bindings/js/JSArrayBufferViewCustom.cpp index a865a30..1fb6b49 100644 --- a/WebCore/bindings/js/JSArrayBufferViewCustom.cpp +++ b/WebCore/bindings/js/JSArrayBufferViewCustom.cpp @@ -35,7 +35,7 @@ #include "JSUint16Array.h" #include "JSInt32Array.h" #include "JSUint32Array.h" -#include "JSFloatArray.h" +#include "JSFloat32Array.h" #include "ArrayBufferView.h" @@ -50,7 +50,7 @@ JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, ArrayBu if (object) { if (object->isFloatArray()) - return getDOMObjectWrapper<JSFloatArray>(exec, globalObject, static_cast<FloatArray*>(object)); + return getDOMObjectWrapper<JSFloat32Array>(exec, globalObject, static_cast<Float32Array*>(object)); if (object->isUnsignedByteArray()) return getDOMObjectWrapper<JSUint8Array>(exec, globalObject, static_cast<Uint8Array*>(object)); if (object->isByteArray()) diff --git a/WebCore/bindings/js/JSArrayBufferViewHelper.h b/WebCore/bindings/js/JSArrayBufferViewHelper.h index 6b77c0c..f632f38 100644 --- a/WebCore/bindings/js/JSArrayBufferViewHelper.h +++ b/WebCore/bindings/js/JSArrayBufferViewHelper.h @@ -41,7 +41,7 @@ template <class T> JSC::JSValue setWebGLArrayHelper(JSC::ExecState* exec, T* impl, T* (*conversionFunc)(JSC::JSValue)) { if (exec->argumentCount() < 1) - return throwError(exec, JSC::SyntaxError); + return JSC::throwSyntaxError(exec); T* array = (*conversionFunc)(exec->argument(0)); if (array) { @@ -78,7 +78,7 @@ JSC::JSValue setWebGLArrayHelper(JSC::ExecState* exec, T* impl, T* (*conversionF return JSC::jsUndefined(); } - return JSC::throwError(exec, JSC::SyntaxError); + return JSC::throwSyntaxError(exec); } } diff --git a/WebCore/bindings/js/JSAudioConstructor.cpp b/WebCore/bindings/js/JSAudioConstructor.cpp index cc791d1..5bbaf41 100644 --- a/WebCore/bindings/js/JSAudioConstructor.cpp +++ b/WebCore/bindings/js/JSAudioConstructor.cpp @@ -46,13 +46,13 @@ JSAudioConstructor::JSAudioConstructor(ExecState* exec, JSDOMGlobalObject* globa putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontDelete | DontEnum); } -static JSObject* constructAudio(ExecState* exec, JSObject* constructor, const ArgList& args) +static EncodedJSValue JSC_HOST_CALL constructAudio(ExecState* exec) { - JSAudioConstructor* jsConstructor = static_cast<JSAudioConstructor*>(constructor); + JSAudioConstructor* jsConstructor = static_cast<JSAudioConstructor*>(exec->callee()); Document* document = jsConstructor->document(); if (!document) - return throwError(exec, ReferenceError, "Audio constructor associated document is unavailable"); + return throwVMError(exec, createReferenceError(exec, "Audio constructor associated document is unavailable")); // Calling toJS on the document causes the JS document wrapper to be // added to the window object. This is done to ensure that JSDocument::markChildren @@ -60,13 +60,13 @@ static JSObject* constructAudio(ExecState* exec, JSObject* constructor, const Ar toJS(exec, jsConstructor->globalObject(), document); // FIXME: This converts an undefined argument to the string "undefined", but possibly we - // should treat it as if no argument was passed instead, by checking the value of args.at - // rather than looking at args.size. + // should treat it as if no argument was passed instead, by checking the value of exec->argument + // rather than looking at exec->argumentCount. String src; - if (args.size() > 0) - src = ustringToString(args.at(0).toString(exec)); - return asObject(toJS(exec, jsConstructor->globalObject(), - HTMLAudioElement::createForJSConstructor(document, src))); + if (exec->argumentCount() > 0) + src = ustringToString(exec->argument(0).toString(exec)); + return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), + HTMLAudioElement::createForJSConstructor(document, src)))); } ConstructType JSAudioConstructor::getConstructData(ConstructData& constructData) diff --git a/WebCore/bindings/js/JSBindingsAllInOne.cpp b/WebCore/bindings/js/JSBindingsAllInOne.cpp index 7a105ff..ae31608 100644 --- a/WebCore/bindings/js/JSBindingsAllInOne.cpp +++ b/WebCore/bindings/js/JSBindingsAllInOne.cpp @@ -127,12 +127,12 @@ #include "JSWorkerContextCustom.cpp" #include "JSWorkerContextErrorHandler.cpp" #include "JSWorkerCustom.cpp" -#include "JSXMLHttpRequestConstructor.cpp" #include "JSXMLHttpRequestCustom.cpp" #include "JSXMLHttpRequestUploadCustom.cpp" #include "JSXSLTProcessorConstructor.cpp" #include "JSXSLTProcessorCustom.cpp" #include "JavaScriptCallFrame.cpp" +#include "MemoryInfo.cpp" #include "ScheduledAction.cpp" #include "ScriptArray.cpp" #include "ScriptCachedFrameData.cpp" diff --git a/WebCore/bindings/js/JSCallbackData.cpp b/WebCore/bindings/js/JSCallbackData.cpp index e813da2..6b19639 100644 --- a/WebCore/bindings/js/JSCallbackData.cpp +++ b/WebCore/bindings/js/JSCallbackData.cpp @@ -51,7 +51,7 @@ JSValue JSCallbackData::invokeCallback(MarkedArgumentBuffer& args, bool* raisedE JSValue function = callback()->get(exec, Identifier(exec, "handleEvent")); CallData callData; - CallType callType = function.getCallData(callData); + CallType callType = getCallData(function, callData); if (callType == CallTypeNone) { callType = callback()->getCallData(callData); if (callType == CallTypeNone) @@ -60,7 +60,12 @@ JSValue JSCallbackData::invokeCallback(MarkedArgumentBuffer& args, bool* raisedE } globalObject()->globalData()->timeoutChecker.start(); - JSValue result = globalObject()->scriptExecutionContext()->isDocument() + ScriptExecutionContext* context = globalObject()->scriptExecutionContext(); + // We will fail to get the context if the frame has been detached. + if (!context) + return JSValue(); + + JSValue result = context->isDocument() ? JSMainThreadExecState::call(exec, function, callType, callData, callback(), args) : JSC::call(exec, function, callType, callData, callback(), args); globalObject()->globalData()->timeoutChecker.stop(); diff --git a/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp b/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp index 416f976..914dea0 100644 --- a/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp +++ b/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp @@ -121,7 +121,7 @@ JSValue JSCanvasRenderingContext2D::setFillColor(ExecState* exec) exec->argument(2).toFloat(exec), exec->argument(3).toFloat(exec), exec->argument(4).toFloat(exec)); break; default: - return throwError(exec, SyntaxError); + return throwSyntaxError(exec); } return jsUndefined(); } @@ -158,7 +158,7 @@ JSValue JSCanvasRenderingContext2D::setStrokeColor(ExecState* exec) exec->argument(2).toFloat(exec), exec->argument(3).toFloat(exec), exec->argument(4).toFloat(exec)); break; default: - return throwError(exec, SyntaxError); + return throwSyntaxError(exec); } return jsUndefined(); @@ -190,7 +190,7 @@ JSValue JSCanvasRenderingContext2D::drawImage(ExecState* exec) // The img parameter can be a <img> or <canvas> element. JSValue value = exec->argument(0); if (!value.isObject()) - return throwError(exec, TypeError); + return throwTypeError(exec); JSObject* o = asObject(value); ExceptionCode ec = 0; @@ -213,7 +213,7 @@ JSValue JSCanvasRenderingContext2D::drawImage(ExecState* exec) setDOMException(exec, ec); break; default: - return throwError(exec, SyntaxError); + return throwSyntaxError(exec); } } else if (o->inherits(&JSHTMLCanvasElement::s_info)) { HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(static_cast<JSHTMLElement*>(o)->impl()); @@ -234,7 +234,7 @@ JSValue JSCanvasRenderingContext2D::drawImage(ExecState* exec) setDOMException(exec, ec); break; default: - return throwError(exec, SyntaxError); + return throwSyntaxError(exec); } #if ENABLE(VIDEO) } else if (o->inherits(&JSHTMLVideoElement::s_info)) { @@ -256,7 +256,7 @@ JSValue JSCanvasRenderingContext2D::drawImage(ExecState* exec) setDOMException(exec, ec); break; default: - return throwError(exec, SyntaxError); + return throwSyntaxError(exec); } #endif } else { @@ -272,11 +272,11 @@ JSValue JSCanvasRenderingContext2D::drawImageFromRect(ExecState* exec) JSValue value = exec->argument(0); if (!value.isObject()) - return throwError(exec, TypeError); + return throwTypeError(exec); JSObject* o = asObject(value); if (!o->inherits(&JSHTMLImageElement::s_info)) - return throwError(exec, TypeError); + return throwTypeError(exec); context->drawImageFromRect(static_cast<HTMLImageElement*>(static_cast<JSHTMLElement*>(o)->impl()), exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec), exec->argument(3).toFloat(exec), exec->argument(4).toFloat(exec), @@ -326,7 +326,7 @@ JSValue JSCanvasRenderingContext2D::setShadow(ExecState* exec) exec->argument(6).toFloat(exec), exec->argument(7).toFloat(exec)); break; default: - return throwError(exec, SyntaxError); + return throwSyntaxError(exec); } return jsUndefined(); @@ -338,7 +338,7 @@ JSValue JSCanvasRenderingContext2D::createPattern(ExecState* exec) JSValue value = exec->argument(0); if (!value.isObject()) - return throwError(exec, TypeError); + return throwTypeError(exec); JSObject* o = asObject(value); if (o->inherits(&JSHTMLImageElement::s_info)) { @@ -406,7 +406,7 @@ JSValue JSCanvasRenderingContext2D::fillText(ExecState* exec) // number arg = y // optional number arg = maxWidth if (exec->argumentCount() < 3 || exec->argumentCount() > 4) - return throwError(exec, SyntaxError); + return throwSyntaxError(exec); if (exec->argumentCount() == 4) context->fillText(ustringToString(exec->argument(0).toString(exec)), exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec), exec->argument(3).toFloat(exec)); @@ -424,7 +424,7 @@ JSValue JSCanvasRenderingContext2D::strokeText(ExecState* exec) // number arg = y // optional number arg = maxWidth if (exec->argumentCount() < 3 || exec->argumentCount() > 4) - return throwError(exec, SyntaxError); + return throwSyntaxError(exec); if (exec->argumentCount() == 4) context->strokeText(ustringToString(exec->argument(0).toString(exec)), exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec), exec->argument(3).toFloat(exec)); diff --git a/WebCore/bindings/js/JSClipboardCustom.cpp b/WebCore/bindings/js/JSClipboardCustom.cpp index ad5e055..9bdffdb 100644 --- a/WebCore/bindings/js/JSClipboardCustom.cpp +++ b/WebCore/bindings/js/JSClipboardCustom.cpp @@ -78,14 +78,14 @@ JSValue JSClipboard::clearData(ExecState* exec) } // FIXME: It does not match the rest of the JS bindings to throw on invalid number of arguments. - return throwError(exec, SyntaxError, "clearData: Invalid number of arguments"); + return throwError(exec, createSyntaxError(exec, "clearData: Invalid number of arguments")); } JSValue JSClipboard::getData(ExecState* exec) { // FIXME: It does not match the rest of the JS bindings to throw on invalid number of arguments. if (exec->argumentCount() != 1) - return throwError(exec, SyntaxError, "getData: Invalid number of arguments"); + return throwError(exec, createSyntaxError(exec, "getData: Invalid number of arguments")); Clipboard* clipboard = impl(); @@ -106,7 +106,7 @@ JSValue JSClipboard::setDragImage(ExecState* exec) // FIXME: It does not match the rest of the JS bindings to throw on invalid number of arguments. if (exec->argumentCount() != 3) - return throwError(exec, SyntaxError, "setDragImage: Invalid number of arguments"); + return throwError(exec, createSyntaxError(exec, "setDragImage: Invalid number of arguments")); int x = exec->argument(1).toInt32(exec); int y = exec->argument(2).toInt32(exec); @@ -114,11 +114,11 @@ JSValue JSClipboard::setDragImage(ExecState* exec) // See if they passed us a node Node* node = toNode(exec->argument(0)); if (!node) - return throwError(exec, TypeError); + return throwTypeError(exec); // FIXME: This should probably be a TypeError. if (!node->isElementNode()) - return throwError(exec, SyntaxError, "setDragImageFromElement: Invalid first argument"); + return throwError(exec, createSyntaxError(exec, "setDragImageFromElement: Invalid first argument")); if (static_cast<Element*>(node)->hasLocalName(imgTag) && !node->inDocument()) clipboard->setDragImage(static_cast<HTMLImageElement*>(node)->cachedImage(), IntPoint(x, y)); diff --git a/WebCore/bindings/js/JSConsoleCustom.cpp b/WebCore/bindings/js/JSConsoleCustom.cpp index 3ad34a3..b9b407c 100644 --- a/WebCore/bindings/js/JSConsoleCustom.cpp +++ b/WebCore/bindings/js/JSConsoleCustom.cpp @@ -28,7 +28,9 @@ #include "JSConsole.h" #include "Console.h" +#include "JSMemoryInfo.h" #include "JSScriptProfile.h" +#include "MemoryInfo.h" #include "ScriptCallStack.h" #include "ScriptProfile.h" #include <runtime/JSArray.h> @@ -55,4 +57,9 @@ JSValue JSConsole::profiles(ExecState* exec) const #endif +JSValue JSConsole::memory(ExecState* exec) const +{ + return toJS(exec, MemoryInfo::create()); +} + } // namespace WebCore diff --git a/WebCore/bindings/js/JSCustomPositionCallback.cpp b/WebCore/bindings/js/JSCustomPositionCallback.cpp index cc6d45c..8990520 100644 --- a/WebCore/bindings/js/JSCustomPositionCallback.cpp +++ b/WebCore/bindings/js/JSCustomPositionCallback.cpp @@ -38,12 +38,17 @@ namespace WebCore { using namespace JSC; JSCustomPositionCallback::JSCustomPositionCallback(JSObject* callback, JSDOMGlobalObject* globalObject) - : m_data(callback, globalObject) + : PositionCallback(globalObject->scriptExecutionContext()) + , m_data(callback, globalObject) { } void JSCustomPositionCallback::handleEvent(Geoposition* geoposition) { + // ActiveDOMObject will null our pointer to the ScriptExecutionContext when it goes away. + if (!scriptExecutionContext()) + return; + RefPtr<JSCustomPositionCallback> protect(this); JSC::JSLock lock(SilenceAssertionsOnly); diff --git a/WebCore/bindings/js/JSCustomPositionErrorCallback.cpp b/WebCore/bindings/js/JSCustomPositionErrorCallback.cpp index c94ae9a..1777387 100644 --- a/WebCore/bindings/js/JSCustomPositionErrorCallback.cpp +++ b/WebCore/bindings/js/JSCustomPositionErrorCallback.cpp @@ -38,12 +38,17 @@ namespace WebCore { using namespace JSC; JSCustomPositionErrorCallback::JSCustomPositionErrorCallback(JSObject* callback, JSDOMGlobalObject* globalObject) - : m_data(callback, globalObject) + : PositionErrorCallback(globalObject->scriptExecutionContext()) + , m_data(callback, globalObject) { } void JSCustomPositionErrorCallback::handleEvent(PositionError* positionError) { + // ActiveDOMObject will null our pointer to the ScriptExecutionContext when it goes away. + if (!scriptExecutionContext()) + return; + RefPtr<JSCustomPositionErrorCallback> protect(this); JSC::JSLock lock(SilenceAssertionsOnly); diff --git a/WebCore/bindings/js/JSCustomXPathNSResolver.cpp b/WebCore/bindings/js/JSCustomXPathNSResolver.cpp index e7d174f..37f2512 100644 --- a/WebCore/bindings/js/JSCustomXPathNSResolver.cpp +++ b/WebCore/bindings/js/JSCustomXPathNSResolver.cpp @@ -73,7 +73,7 @@ String JSCustomXPathNSResolver::lookupNamespaceURI(const String& prefix) JSValue function = m_customResolver->get(exec, Identifier(exec, "lookupNamespaceURI")); CallData callData; - CallType callType = function.getCallData(callData); + CallType callType = getCallData(function, callData); if (callType == CallTypeNone) { callType = m_customResolver->getCallData(callData); if (callType == CallTypeNone) { diff --git a/WebCore/bindings/js/JSDOMBinding.cpp b/WebCore/bindings/js/JSDOMBinding.cpp index 87d8cf7..27ac9e4 100644 --- a/WebCore/bindings/js/JSDOMBinding.cpp +++ b/WebCore/bindings/js/JSDOMBinding.cpp @@ -603,7 +603,7 @@ void setDOMException(ExecState* exec, ExceptionCode ec) } ASSERT(errorObject); - exec->setException(errorObject); + throwError(exec, errorObject); } bool checkNodeSecurity(ExecState* exec, Node* node) @@ -729,7 +729,7 @@ JSC::JSObject* toJSSequence(ExecState* exec, JSValue value, unsigned& length) { JSObject* object = value.getObject(); if (!object) { - throwError(exec, TypeError); + throwTypeError(exec); return 0; } JSValue lengthValue = object->get(exec, exec->propertyNames().length); @@ -737,7 +737,7 @@ JSC::JSObject* toJSSequence(ExecState* exec, JSValue value, unsigned& length) return 0; if (lengthValue.isUndefinedOrNull()) { - throwError(exec, TypeError); + throwTypeError(exec); return 0; } diff --git a/WebCore/bindings/js/JSDOMWindowCustom.cpp b/WebCore/bindings/js/JSDOMWindowCustom.cpp index eabf962..7e0a785 100644 --- a/WebCore/bindings/js/JSDOMWindowCustom.cpp +++ b/WebCore/bindings/js/JSDOMWindowCustom.cpp @@ -65,7 +65,7 @@ #include "JSUint32ArrayConstructor.h" #include "JSInt16ArrayConstructor.h" #include "JSUint16ArrayConstructor.h" -#include "JSFloatArrayConstructor.h" +#include "JSFloat32ArrayConstructor.h" #endif #include "JSWebKitCSSMatrixConstructor.h" #include "JSWebKitPointConstructor.h" @@ -73,7 +73,7 @@ #include "JSWebSocketConstructor.h" #endif #include "JSWorkerConstructor.h" -#include "JSXMLHttpRequestConstructor.h" +#include "JSXMLHttpRequest.h" #include "JSXSLTProcessorConstructor.h" #include "Location.h" #include "MediaPlayer.h" @@ -606,9 +606,9 @@ JSValue JSDOMWindow::uint16Array(ExecState* exec) const return getDOMConstructor<JSUint16ArrayConstructor>(exec, this); } -JSValue JSDOMWindow::floatArray(ExecState* exec) const +JSValue JSDOMWindow::float32Array(ExecState* exec) const { - return getDOMConstructor<JSFloatArrayConstructor>(exec, this); + return getDOMConstructor<JSFloat32ArrayConstructor>(exec, this); } // Temporary aliases to keep current WebGL content working during transition period to TypedArray spec. @@ -650,7 +650,7 @@ JSValue JSDOMWindow::webGLUnsignedShortArray(ExecState* exec) const JSValue JSDOMWindow::webGLFloatArray(ExecState* exec) const { - return getDOMConstructor<JSFloatArrayConstructor>(exec, this); + return getDOMConstructor<JSFloat32ArrayConstructor>(exec, this); } #endif diff --git a/WebCore/bindings/js/JSDOMWrapper.cpp b/WebCore/bindings/js/JSDOMWrapper.cpp index 3fcdcc1..9548f2f 100644 --- a/WebCore/bindings/js/JSDOMWrapper.cpp +++ b/WebCore/bindings/js/JSDOMWrapper.cpp @@ -44,7 +44,7 @@ DOMObject::~DOMObject() bool DOMObject::defineOwnProperty(ExecState* exec, const Identifier&, PropertyDescriptor&, bool) { - throwError(exec, TypeError, "defineProperty is not supported on DOM Objects"); + throwError(exec, createTypeError(exec, "defineProperty is not supported on DOM Objects")); return false; } diff --git a/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp b/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp index 3098752..6c4dfb4 100644 --- a/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp +++ b/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp @@ -50,10 +50,10 @@ JSValue JSNotificationCenter::requestPermission(ExecState* exec) // Permission request is only valid from page context. ScriptExecutionContext* context = impl()->context(); if (context->isWorkerContext()) - return throwError(exec, SyntaxError); + return throwSyntaxError(exec); if (!exec->argument(0).isObject()) - return throwError(exec, TypeError); + return throwTypeError(exec); PassRefPtr<JSCustomVoidCallback> callback = JSCustomVoidCallback::create(exec->argument(0).getObject(), toJSDOMGlobalObject(static_cast<Document*>(context), exec)); diff --git a/WebCore/bindings/js/JSEventListener.cpp b/WebCore/bindings/js/JSEventListener.cpp index e25a5d1..ceed445 100644 --- a/WebCore/bindings/js/JSEventListener.cpp +++ b/WebCore/bindings/js/JSEventListener.cpp @@ -93,7 +93,7 @@ void JSEventListener::handleEvent(ScriptExecutionContext* scriptExecutionContext JSValue handleEventFunction = jsFunction->get(exec, Identifier(exec, "handleEvent")); CallData callData; - CallType callType = handleEventFunction.getCallData(callData); + CallType callType = getCallData(handleEventFunction, callData); if (callType == CallTypeNone) { handleEventFunction = JSValue(); callType = jsFunction->getCallData(callData); diff --git a/WebCore/bindings/js/JSEventSourceConstructor.cpp b/WebCore/bindings/js/JSEventSourceConstructor.cpp index e48489b..4524f70 100644 --- a/WebCore/bindings/js/JSEventSourceConstructor.cpp +++ b/WebCore/bindings/js/JSEventSourceConstructor.cpp @@ -56,28 +56,28 @@ JSEventSourceConstructor::JSEventSourceConstructor(ExecState* exec, JSDOMGlobalO putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly|DontDelete|DontEnum); } -static JSObject* constructEventSource(ExecState* exec, JSObject* constructor, const ArgList& args) +static EncodedJSValue JSC_HOST_CALL constructEventSource(ExecState* exec) { - if (args.size() < 1) - return throwError(exec, SyntaxError, "Not enough arguments"); + if (exec->argumentCount() < 1) + return throwVMError(exec, createSyntaxError(exec, "Not enough arguments")); - UString url = args.at(0).toString(exec); + UString url = exec->argument(0).toString(exec); if (exec->hadException()) - return 0; + return JSValue::encode(JSValue()); - JSEventSourceConstructor* jsConstructor = static_cast<JSEventSourceConstructor*>(constructor); + JSEventSourceConstructor* jsConstructor = static_cast<JSEventSourceConstructor*>(exec->callee()); ScriptExecutionContext* context = jsConstructor->scriptExecutionContext(); if (!context) - return throwError(exec, ReferenceError, "EventSource constructor associated document is unavailable"); + return throwVMError(exec, createReferenceError(exec, "EventSource constructor associated document is unavailable")); ExceptionCode ec = 0; RefPtr<EventSource> eventSource = EventSource::create(ustringToString(url), context, ec); if (ec) { setDOMException(exec, ec); - return 0; + return JSValue::encode(JSValue()); } - return asObject(toJS(exec, jsConstructor->globalObject(), eventSource.release())); + return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), eventSource.release()))); } ConstructType JSEventSourceConstructor::getConstructData(ConstructData& constructData) diff --git a/WebCore/bindings/js/JSFloat32ArrayConstructor.cpp b/WebCore/bindings/js/JSFloat32ArrayConstructor.cpp new file mode 100644 index 0000000..08cffb5 --- /dev/null +++ b/WebCore/bindings/js/JSFloat32ArrayConstructor.cpp @@ -0,0 +1,86 @@ +/* + * 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 COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(3D_CANVAS) + +#include "JSFloat32ArrayConstructor.h" + +#include "Document.h" +#include "Float32Array.h" +#include "JSArrayBuffer.h" +#include "JSArrayBufferConstructor.h" +#include "JSFloat32Array.h" +#include <runtime/Error.h> + +namespace WebCore { + +using namespace JSC; + +const ClassInfo JSFloat32ArrayConstructor::s_info = { "Float32ArrayConstructor", &JSArrayBufferView::s_info, 0, 0 }; + +JSFloat32ArrayConstructor::JSFloat32ArrayConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) + : DOMConstructorObject(JSFloat32ArrayConstructor::createStructure(globalObject->objectPrototype()), globalObject) +{ + putDirect(exec->propertyNames().prototype, JSFloat32ArrayPrototype::self(exec, globalObject), DontDelete | ReadOnly); +} + +JSObject* JSFloat32ArrayConstructor::createPrototype(ExecState* exec, JSGlobalObject* globalObject) +{ + return new (exec) JSFloat32ArrayPrototype(globalObject, JSFloat32ArrayPrototype::createStructure(globalObject->objectPrototype())); +} + +bool JSFloat32ArrayConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticValueSlot<JSFloat32ArrayConstructor, DOMObject>(exec, JSFloat32ArrayPrototype::s_info.staticPropHashTable, this, propertyName, slot); +} + +bool JSFloat32ArrayConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticValueDescriptor<JSFloat32ArrayConstructor, DOMObject>(exec, JSFloat32ArrayPrototype::s_info.staticPropHashTable, this, propertyName, descriptor); +} + +static EncodedJSValue JSC_HOST_CALL constructCanvasFloatArray(ExecState* exec) +{ + ArgList args(exec); + JSFloat32ArrayConstructor* jsConstructor = static_cast<JSFloat32ArrayConstructor*>(exec->callee()); + RefPtr<Float32Array> array = static_cast<Float32Array*>(construct<Float32Array, float>(exec, args).get()); + if (!array.get()) { + setDOMException(exec, INDEX_SIZE_ERR); + return JSValue::encode(JSValue()); + } + return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get()))); +} + +JSC::ConstructType JSFloat32ArrayConstructor::getConstructData(JSC::ConstructData& constructData) +{ + constructData.native.function = constructCanvasFloatArray; + return ConstructTypeHost; +} + +} // namespace WebCore + +#endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/js/JSFloat32ArrayConstructor.h b/WebCore/bindings/js/JSFloat32ArrayConstructor.h new file mode 100644 index 0000000..c2f8b7e --- /dev/null +++ b/WebCore/bindings/js/JSFloat32ArrayConstructor.h @@ -0,0 +1,57 @@ +/* + * 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 COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JSFloat32ArrayConstructor_h +#define JSFloat32ArrayConstructor_h + +#include "JSDOMBinding.h" +#include "JSDocument.h" + +namespace WebCore { + + class JSFloat32ArrayConstructor : public DOMConstructorObject { + typedef DOMConstructorObject Base; + public: + JSFloat32ArrayConstructor(JSC::ExecState*, JSDOMGlobalObject*); + static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*); + virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); + virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); + static const JSC::ClassInfo s_info; + + static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) + { + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); + } + + private: + virtual JSC::ConstructType getConstructData(JSC::ConstructData&); + virtual const JSC::ClassInfo* classInfo() const { return &s_info; } + protected: + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; + }; + +} + +#endif // JSFloat32ArrayConstructor_h diff --git a/WebCore/bindings/js/JSFloat32ArrayCustom.cpp b/WebCore/bindings/js/JSFloat32ArrayCustom.cpp new file mode 100644 index 0000000..7965274 --- /dev/null +++ b/WebCore/bindings/js/JSFloat32ArrayCustom.cpp @@ -0,0 +1,56 @@ +/* + * 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 COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(3D_CANVAS) + +#include "JSArrayBufferViewHelper.h" +#include "JSFloat32Array.h" + +#include "Float32Array.h" + +using namespace JSC; + +namespace WebCore { + +void JSFloat32Array::indexSetter(JSC::ExecState* exec, unsigned index, JSC::JSValue value) +{ + impl()->set(index, static_cast<float>(value.toNumber(exec))); +} + +JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Float32Array* object) +{ + return getDOMObjectWrapper<JSFloat32Array>(exec, globalObject, object); +} + +JSC::JSValue JSFloat32Array::set(JSC::ExecState* exec) +{ + return setWebGLArrayHelper(exec, impl(), toFloat32Array); +} + +} // namespace WebCore + +#endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/js/JSFloatArrayConstructor.cpp b/WebCore/bindings/js/JSFloatArrayConstructor.cpp deleted file mode 100644 index 57374af..0000000 --- a/WebCore/bindings/js/JSFloatArrayConstructor.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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 COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(3D_CANVAS) - -#include "JSFloatArrayConstructor.h" - -#include "Document.h" -#include "FloatArray.h" -#include "JSArrayBuffer.h" -#include "JSArrayBufferConstructor.h" -#include "JSFloatArray.h" -#include <runtime/Error.h> - -namespace WebCore { - -using namespace JSC; - -const ClassInfo JSFloatArrayConstructor::s_info = { "FloatArrayConstructor", &JSArrayBufferView::s_info, 0, 0 }; - -JSFloatArrayConstructor::JSFloatArrayConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) - : DOMConstructorObject(JSFloatArrayConstructor::createStructure(globalObject->objectPrototype()), globalObject) -{ - putDirect(exec->propertyNames().prototype, JSFloatArrayPrototype::self(exec, globalObject), None); - putDirect(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly|DontDelete|DontEnum); -} - -static JSObject* constructCanvasFloatArray(ExecState* exec, JSObject* constructor, const ArgList& args) -{ - JSFloatArrayConstructor* jsConstructor = static_cast<JSFloatArrayConstructor*>(constructor); - RefPtr<FloatArray> array = static_cast<FloatArray*>(construct<FloatArray, float>(exec, args).get()); - if (!array.get()) { - setDOMException(exec, INDEX_SIZE_ERR); - return 0; - } - return asObject(toJS(exec, jsConstructor->globalObject(), array.get())); -} - -JSC::ConstructType JSFloatArrayConstructor::getConstructData(JSC::ConstructData& constructData) -{ - constructData.native.function = constructCanvasFloatArray; - return ConstructTypeHost; -} - -} // namespace WebCore - -#endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/js/JSFloatArrayConstructor.h b/WebCore/bindings/js/JSFloatArrayConstructor.h deleted file mode 100644 index 6d2dae7..0000000 --- a/WebCore/bindings/js/JSFloatArrayConstructor.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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 COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef JSFloatArrayConstructor_h -#define JSFloatArrayConstructor_h - -#include "JSDOMBinding.h" -#include "JSDocument.h" - -namespace WebCore { - - class JSFloatArrayConstructor : public DOMConstructorObject { - public: - JSFloatArrayConstructor(JSC::ExecState*, JSDOMGlobalObject*); - static const JSC::ClassInfo s_info; - - private: - virtual JSC::ConstructType getConstructData(JSC::ConstructData&); - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } - }; - -} - -#endif // JSFloatArrayConstructor_h diff --git a/WebCore/bindings/js/JSFloatArrayCustom.cpp b/WebCore/bindings/js/JSFloatArrayCustom.cpp deleted file mode 100644 index 8a82f98..0000000 --- a/WebCore/bindings/js/JSFloatArrayCustom.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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 COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(3D_CANVAS) - -#include "JSArrayBufferViewHelper.h" -#include "JSFloatArray.h" - -#include "FloatArray.h" - -using namespace JSC; - -namespace WebCore { - -void JSFloatArray::indexSetter(JSC::ExecState* exec, unsigned index, JSC::JSValue value) -{ - impl()->set(index, static_cast<float>(value.toNumber(exec))); -} - -JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, FloatArray* object) -{ - return getDOMObjectWrapper<JSFloatArray>(exec, globalObject, object); -} - -JSC::JSValue JSFloatArray::set(JSC::ExecState* exec) -{ - return setWebGLArrayHelper(exec, impl(), toFloatArray); -} - -} // namespace WebCore - -#endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/js/JSGeolocationCustom.cpp b/WebCore/bindings/js/JSGeolocationCustom.cpp index 16849ec..bd36df8 100644 --- a/WebCore/bindings/js/JSGeolocationCustom.cpp +++ b/WebCore/bindings/js/JSGeolocationCustom.cpp @@ -31,12 +31,15 @@ #include "DOMWindow.h" #include "ExceptionCode.h" #include "Geolocation.h" -#include "GeolocationService.h" #include "JSCustomPositionCallback.h" #include "JSCustomPositionErrorCallback.h" #include "JSDOMWindow.h" #include "PositionOptions.h" -#include <runtime/InternalFunction.h> +#include <runtime/JSFunction.h> + +#if !ENABLE(CLIENT_BASED_GEOLOCATION) +#include "GeolocationService.h" +#endif using namespace JSC; using namespace std; @@ -46,7 +49,8 @@ namespace WebCore { static PassRefPtr<PositionCallback> createPositionCallback(ExecState* exec, JSDOMGlobalObject* globalObject, JSValue value) { // The spec specifies 'FunctionOnly' for this object. - if (!value.inherits(&InternalFunction::info)) { + // FIXME: This check disallows callable objects created via JSC API. It's not clear what exactly the specification intends to allow. + if (!value.inherits(&JSFunction::info)) { setDOMException(exec, TYPE_MISMATCH_ERR); return 0; } @@ -62,7 +66,8 @@ static PassRefPtr<PositionErrorCallback> createPositionErrorCallback(ExecState* return 0; // The spec specifies 'FunctionOnly' for this object. - if (!value.inherits(&InternalFunction::info)) { + // FIXME: This check disallows callable objects created via JSC API. It's not clear what exactly the specification intends to allow. + if (!value.inherits(&JSFunction::info)) { setDOMException(exec, TYPE_MISMATCH_ERR); return 0; } diff --git a/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp b/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp index 3d819ef..a504f25 100644 --- a/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp +++ b/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp @@ -34,6 +34,7 @@ #include "JSNodeList.h" #include "Node.h" #include "StaticNodeList.h" +#include <runtime/JSValue.h> #include <wtf/Vector.h> using namespace JSC; @@ -58,10 +59,10 @@ static JSValue getNamedItems(ExecState* exec, JSHTMLAllCollection* collection, c // HTMLCollections are strange objects, they support both get and call, // so that document.forms.item(0) and document.forms(0) both work. -static JSValue JSC_HOST_CALL callHTMLAllCollection(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL callHTMLAllCollection(ExecState* exec) { if (exec->argumentCount() < 1) - return jsUndefined(); + return JSValue::encode(jsUndefined()); // Do not use thisObj here. It can be the JSHTMLDocument, in the document.forms(i) case. JSHTMLAllCollection* jsCollection = static_cast<JSHTMLAllCollection*>(exec->callee()); @@ -75,10 +76,10 @@ static JSValue JSC_HOST_CALL callHTMLAllCollection(ExecState* exec) UString string = exec->argument(0).toString(exec); unsigned index = string.toUInt32(&ok, false); if (ok) - return toJS(exec, jsCollection->globalObject(), collection->item(index)); + return JSValue::encode(toJS(exec, jsCollection->globalObject(), collection->item(index))); // Support for document.images('<name>') etc. - return getNamedItems(exec, jsCollection, Identifier(exec, string)); + return JSValue::encode(getNamedItems(exec, jsCollection, Identifier(exec, string))); } // The second arg, if set, is the index of the item we want @@ -90,13 +91,13 @@ static JSValue JSC_HOST_CALL callHTMLAllCollection(ExecState* exec) Node* node = collection->namedItem(pstr); while (node) { if (!index) - return toJS(exec, jsCollection->globalObject(), node); + return JSValue::encode(toJS(exec, jsCollection->globalObject(), node)); node = collection->nextNamedItem(pstr); --index; } } - return jsUndefined(); + return JSValue::encode(jsUndefined()); } CallType JSHTMLAllCollection::getCallData(CallData& callData) diff --git a/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp b/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp index a69696a..ae9115e 100644 --- a/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp +++ b/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp @@ -88,17 +88,21 @@ JSValue JSHTMLCanvasElement::getContext(ExecState* exec) JSValue JSHTMLCanvasElement::toDataURL(ExecState* exec) { const String& type = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)); - double quality = 1.0; + HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(impl()); + ExceptionCode ec = 0; + + JSC::JSValue result; + double quality; + double* qualityPtr = 0; if (exec->argumentCount() > 1) { JSValue v = exec->argument(1); - if (v.isNumber()) + if (v.isNumber()) { quality = v.toNumber(exec); - if (!(0.0 <= quality && quality <= 1.0)) - quality = 1.0; + qualityPtr = &quality; + } } - HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(impl()); - ExceptionCode ec = 0; - JSC::JSValue result = jsString(exec, canvas->toDataURL(type, quality, ec)); + + result = jsString(exec, canvas->toDataURL(type, qualityPtr, ec)); setDOMException(exec, ec); return result; } diff --git a/WebCore/bindings/js/JSHTMLCollectionCustom.cpp b/WebCore/bindings/js/JSHTMLCollectionCustom.cpp index 24059b7..b0cfd99 100644 --- a/WebCore/bindings/js/JSHTMLCollectionCustom.cpp +++ b/WebCore/bindings/js/JSHTMLCollectionCustom.cpp @@ -55,10 +55,10 @@ static JSValue getNamedItems(ExecState* exec, JSHTMLCollection* collection, cons // HTMLCollections are strange objects, they support both get and call, // so that document.forms.item(0) and document.forms(0) both work. -static JSValue JSC_HOST_CALL callHTMLCollection(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL callHTMLCollection(ExecState* exec) { if (exec->argumentCount() < 1) - return jsUndefined(); + return JSValue::encode(jsUndefined()); // Do not use thisObj here. It can be the JSHTMLDocument, in the document.forms(i) case. JSHTMLCollection* jsCollection = static_cast<JSHTMLCollection*>(exec->callee()); @@ -72,10 +72,10 @@ static JSValue JSC_HOST_CALL callHTMLCollection(ExecState* exec) UString string = exec->argument(0).toString(exec); unsigned index = string.toUInt32(&ok, false); if (ok) - return toJS(exec, jsCollection->globalObject(), collection->item(index)); + return JSValue::encode(toJS(exec, jsCollection->globalObject(), collection->item(index))); // Support for document.images('<name>') etc. - return getNamedItems(exec, jsCollection, Identifier(exec, string)); + return JSValue::encode(getNamedItems(exec, jsCollection, Identifier(exec, string))); } // The second arg, if set, is the index of the item we want @@ -87,13 +87,13 @@ static JSValue JSC_HOST_CALL callHTMLCollection(ExecState* exec) Node* node = collection->namedItem(pstr); while (node) { if (!index) - return toJS(exec, jsCollection->globalObject(), node); + return JSValue::encode(toJS(exec, jsCollection->globalObject(), node)); node = collection->nextNamedItem(pstr); --index; } } - return jsUndefined(); + return JSValue::encode(jsUndefined()); } CallType JSHTMLCollection::getCallData(CallData& callData) diff --git a/WebCore/bindings/js/JSHTMLDocumentCustom.cpp b/WebCore/bindings/js/JSHTMLDocumentCustom.cpp index 30cb3a2..a0e189e 100644 --- a/WebCore/bindings/js/JSHTMLDocumentCustom.cpp +++ b/WebCore/bindings/js/JSHTMLDocumentCustom.cpp @@ -40,8 +40,9 @@ #include "JSDOMWindowShell.h" #include "JSHTMLCollection.h" #include "SegmentedString.h" -#include "Tokenizer.h" +#include "DocumentParser.h" #include <runtime/Error.h> +#include <runtime/JSCell.h> using namespace JSC; @@ -110,9 +111,9 @@ JSValue JSHTMLDocument::open(ExecState* exec) if (wrapper) { JSValue function = wrapper->get(exec, Identifier(exec, "open")); CallData callData; - CallType callType = function.getCallData(callData); + CallType callType = ::getCallData(function, callData); if (callType == CallTypeNone) - return throwError(exec, TypeError); + return throwTypeError(exec); return JSC::call(exec, function, callType, callData, wrapper, ArgList(exec)); } } diff --git a/WebCore/bindings/js/JSHTMLInputElementCustom.cpp b/WebCore/bindings/js/JSHTMLInputElementCustom.cpp index d4be8dc..23db266 100644 --- a/WebCore/bindings/js/JSHTMLInputElementCustom.cpp +++ b/WebCore/bindings/js/JSHTMLInputElementCustom.cpp @@ -71,7 +71,7 @@ JSValue JSHTMLInputElement::selectionStart(ExecState* exec) const { HTMLInputElement* input = static_cast<HTMLInputElement*>(impl()); if (!input->canHaveSelection()) - return throwError(exec, TypeError); + return throwTypeError(exec); return jsNumber(exec, input->selectionStart()); } @@ -80,7 +80,7 @@ void JSHTMLInputElement::setSelectionStart(ExecState* exec, JSValue value) { HTMLInputElement* input = static_cast<HTMLInputElement*>(impl()); if (!input->canHaveSelection()) - throwError(exec, TypeError); + throwTypeError(exec); input->setSelectionStart(value.toInt32(exec)); } @@ -89,7 +89,7 @@ JSValue JSHTMLInputElement::selectionEnd(ExecState* exec) const { HTMLInputElement* input = static_cast<HTMLInputElement*>(impl()); if (!input->canHaveSelection()) - return throwError(exec, TypeError); + return throwTypeError(exec); return jsNumber(exec, input->selectionEnd()); } @@ -98,7 +98,7 @@ void JSHTMLInputElement::setSelectionEnd(ExecState* exec, JSValue value) { HTMLInputElement* input = static_cast<HTMLInputElement*>(impl()); if (!input->canHaveSelection()) - throwError(exec, TypeError); + throwTypeError(exec); input->setSelectionEnd(value.toInt32(exec)); } @@ -107,7 +107,7 @@ JSValue JSHTMLInputElement::setSelectionRange(ExecState* exec) { HTMLInputElement* input = static_cast<HTMLInputElement*>(impl()); if (!input->canHaveSelection()) - return throwError(exec, TypeError); + return throwTypeError(exec); int start = exec->argument(0).toInt32(exec); int end = exec->argument(1).toInt32(exec); diff --git a/WebCore/bindings/js/JSImageConstructor.cpp b/WebCore/bindings/js/JSImageConstructor.cpp index a574326..f2ad803 100644 --- a/WebCore/bindings/js/JSImageConstructor.cpp +++ b/WebCore/bindings/js/JSImageConstructor.cpp @@ -40,12 +40,12 @@ JSImageConstructor::JSImageConstructor(ExecState* exec, JSDOMGlobalObject* globa putDirect(exec->propertyNames().prototype, JSHTMLImageElementPrototype::self(exec, globalObject), None); } -static JSObject* constructImage(ExecState* exec, JSObject* constructor, const ArgList& args) +static EncodedJSValue JSC_HOST_CALL constructImage(ExecState* exec) { - JSImageConstructor* jsConstructor = static_cast<JSImageConstructor*>(constructor); + JSImageConstructor* jsConstructor = static_cast<JSImageConstructor*>(exec->callee()); Document* document = jsConstructor->document(); if (!document) - return throwError(exec, ReferenceError, "Image constructor associated document is unavailable"); + return throwVMError(exec, createReferenceError(exec, "Image constructor associated document is unavailable")); // Calling toJS on the document causes the JS document wrapper to be // added to the window object. This is done to ensure that JSDocument::markChildren @@ -55,17 +55,17 @@ static JSObject* constructImage(ExecState* exec, JSObject* constructor, const Ar int height; int* optionalWidth = 0; int* optionalHeight = 0; - if (args.size() > 0) { - width = args.at(0).toInt32(exec); + if (exec->argumentCount() > 0) { + width = exec->argument(0).toInt32(exec); optionalWidth = &width; } - if (args.size() > 1) { - height = args.at(1).toInt32(exec); + if (exec->argumentCount() > 1) { + height = exec->argument(1).toInt32(exec); optionalHeight = &height; } - return asObject(toJS(exec, jsConstructor->globalObject(), - HTMLImageElement::createForJSConstructor(document, optionalWidth, optionalHeight))); + return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), + HTMLImageElement::createForJSConstructor(document, optionalWidth, optionalHeight)))); } ConstructType JSImageConstructor::getConstructData(ConstructData& constructData) diff --git a/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp b/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp index c13ea0c..a0d75f8 100644 --- a/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp +++ b/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp @@ -88,7 +88,7 @@ ScriptObject InjectedScriptHost::createInjectedScript(const String& source, Scri return ScriptObject(); JSValue functionValue = comp.value(); CallData callData; - CallType callType = functionValue.getCallData(callData); + CallType callType = getCallData(functionValue, callData); if (callType == CallTypeNone) return ScriptObject(); diff --git a/WebCore/bindings/js/JSInt16ArrayConstructor.cpp b/WebCore/bindings/js/JSInt16ArrayConstructor.cpp index c8f725f..aaed578 100644 --- a/WebCore/bindings/js/JSInt16ArrayConstructor.cpp +++ b/WebCore/bindings/js/JSInt16ArrayConstructor.cpp @@ -46,19 +46,34 @@ const ClassInfo JSInt16ArrayConstructor::s_info = { "Int16ArrayConstructor", &JS JSInt16ArrayConstructor::JSInt16ArrayConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) : DOMConstructorObject(JSInt16ArrayConstructor::createStructure(globalObject->objectPrototype()), globalObject) { - putDirect(exec->propertyNames().prototype, JSInt16ArrayPrototype::self(exec, globalObject), None); - putDirect(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly|DontDelete|DontEnum); + putDirect(exec->propertyNames().prototype, JSInt16ArrayPrototype::self(exec, globalObject), DontDelete | ReadOnly); } -static JSObject* constructCanvasShortArray(ExecState* exec, JSObject* constructor, const ArgList& args) +JSObject* JSInt16ArrayConstructor::createPrototype(ExecState* exec, JSGlobalObject* globalObject) { - JSInt16ArrayConstructor* jsConstructor = static_cast<JSInt16ArrayConstructor*>(constructor); + return new (exec) JSInt16ArrayPrototype(globalObject, JSInt16ArrayPrototype::createStructure(globalObject->objectPrototype())); +} + +bool JSInt16ArrayConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticValueSlot<JSInt16ArrayConstructor, DOMObject>(exec, JSInt16ArrayPrototype::s_info.staticPropHashTable, this, propertyName, slot); +} + +bool JSInt16ArrayConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticValueDescriptor<JSInt16ArrayConstructor, DOMObject>(exec, JSInt16ArrayPrototype::s_info.staticPropHashTable, this, propertyName, descriptor); +} + +static EncodedJSValue JSC_HOST_CALL constructCanvasShortArray(ExecState* exec) +{ + ArgList args(exec); + JSInt16ArrayConstructor* jsConstructor = static_cast<JSInt16ArrayConstructor*>(exec->callee()); RefPtr<Int16Array> array = static_cast<Int16Array*>(construct<Int16Array, short>(exec, args).get()); if (!array.get()) { setDOMException(exec, INDEX_SIZE_ERR); - return 0; + return JSValue::encode(JSValue()); } - return asObject(toJS(exec, jsConstructor->globalObject(), array.get())); + return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get()))); } JSC::ConstructType JSInt16ArrayConstructor::getConstructData(JSC::ConstructData& constructData) diff --git a/WebCore/bindings/js/JSInt16ArrayConstructor.h b/WebCore/bindings/js/JSInt16ArrayConstructor.h index fb132e3..87908a0 100644 --- a/WebCore/bindings/js/JSInt16ArrayConstructor.h +++ b/WebCore/bindings/js/JSInt16ArrayConstructor.h @@ -32,13 +32,24 @@ namespace WebCore { class JSInt16ArrayConstructor : public DOMConstructorObject { + typedef DOMConstructorObject Base; public: JSInt16ArrayConstructor(JSC::ExecState*, JSDOMGlobalObject*); + static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*); + virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); + virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); static const JSC::ClassInfo s_info; + static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) + { + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); + } + private: virtual JSC::ConstructType getConstructData(JSC::ConstructData&); virtual const JSC::ClassInfo* classInfo() const { return &s_info; } + protected: + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; }; } diff --git a/WebCore/bindings/js/JSInt32ArrayConstructor.cpp b/WebCore/bindings/js/JSInt32ArrayConstructor.cpp index 5f79f1f..b44c9ca 100644 --- a/WebCore/bindings/js/JSInt32ArrayConstructor.cpp +++ b/WebCore/bindings/js/JSInt32ArrayConstructor.cpp @@ -45,19 +45,34 @@ const ClassInfo JSInt32ArrayConstructor::s_info = { "Int32ArrayConstructor", &JS JSInt32ArrayConstructor::JSInt32ArrayConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) : DOMConstructorObject(JSInt32ArrayConstructor::createStructure(globalObject->objectPrototype()), globalObject) { - putDirect(exec->propertyNames().prototype, JSInt32ArrayPrototype::self(exec, globalObject), None); - putDirect(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly|DontDelete|DontEnum); + putDirect(exec->propertyNames().prototype, JSInt32ArrayPrototype::self(exec, globalObject), DontDelete | ReadOnly); } -static JSObject* constructCanvasIntArray(ExecState* exec, JSObject* constructor, const ArgList& args) +JSObject* JSInt32ArrayConstructor::createPrototype(ExecState* exec, JSGlobalObject* globalObject) { - JSInt32ArrayConstructor* jsConstructor = static_cast<JSInt32ArrayConstructor*>(constructor); + return new (exec) JSInt32ArrayPrototype(globalObject, JSInt32ArrayPrototype::createStructure(globalObject->objectPrototype())); +} + +bool JSInt32ArrayConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticValueSlot<JSInt32ArrayConstructor, DOMObject>(exec, JSInt32ArrayPrototype::s_info.staticPropHashTable, this, propertyName, slot); +} + +bool JSInt32ArrayConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticValueDescriptor<JSInt32ArrayConstructor, DOMObject>(exec, JSInt32ArrayPrototype::s_info.staticPropHashTable, this, propertyName, descriptor); +} + +static EncodedJSValue JSC_HOST_CALL constructCanvasIntArray(ExecState* exec) +{ + ArgList args(exec); + JSInt32ArrayConstructor* jsConstructor = static_cast<JSInt32ArrayConstructor*>(exec->callee()); RefPtr<Int32Array> array = static_cast<Int32Array*>(construct<Int32Array, int>(exec, args).get()); if (!array.get()) { setDOMException(exec, INDEX_SIZE_ERR); - return 0; + return JSValue::encode(JSValue()); } - return asObject(toJS(exec, jsConstructor->globalObject(), array.get())); + return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get()))); } JSC::ConstructType JSInt32ArrayConstructor::getConstructData(JSC::ConstructData& constructData) diff --git a/WebCore/bindings/js/JSInt32ArrayConstructor.h b/WebCore/bindings/js/JSInt32ArrayConstructor.h index f15358c..6bed3c4 100644 --- a/WebCore/bindings/js/JSInt32ArrayConstructor.h +++ b/WebCore/bindings/js/JSInt32ArrayConstructor.h @@ -32,13 +32,24 @@ namespace WebCore { class JSInt32ArrayConstructor : public DOMConstructorObject { + typedef DOMConstructorObject Base; public: JSInt32ArrayConstructor(JSC::ExecState*, JSDOMGlobalObject*); + static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*); + virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); + virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); static const JSC::ClassInfo s_info; + static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) + { + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); + } + private: virtual JSC::ConstructType getConstructData(JSC::ConstructData&); virtual const JSC::ClassInfo* classInfo() const { return &s_info; } + protected: + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; }; } diff --git a/WebCore/bindings/js/JSInt8ArrayConstructor.cpp b/WebCore/bindings/js/JSInt8ArrayConstructor.cpp index ad922fe..e4c5688 100644 --- a/WebCore/bindings/js/JSInt8ArrayConstructor.cpp +++ b/WebCore/bindings/js/JSInt8ArrayConstructor.cpp @@ -45,19 +45,34 @@ const ClassInfo JSInt8ArrayConstructor::s_info = { "Int8ArrayConstructor", &JSAr JSInt8ArrayConstructor::JSInt8ArrayConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) : DOMConstructorObject(JSInt8ArrayConstructor::createStructure(globalObject->objectPrototype()), globalObject) { - putDirect(exec->propertyNames().prototype, JSInt8ArrayPrototype::self(exec, globalObject), None); - putDirect(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly|DontDelete|DontEnum); + putDirect(exec->propertyNames().prototype, JSInt8ArrayPrototype::self(exec, globalObject), DontDelete | ReadOnly); } -static JSObject* constructCanvasByteArray(ExecState* exec, JSObject* constructor, const ArgList& args) +JSObject* JSInt8ArrayConstructor::createPrototype(ExecState* exec, JSGlobalObject* globalObject) { - JSInt8ArrayConstructor* jsConstructor = static_cast<JSInt8ArrayConstructor*>(constructor); + return new (exec) JSInt8ArrayPrototype(globalObject, JSInt8ArrayPrototype::createStructure(globalObject->objectPrototype())); +} + +bool JSInt8ArrayConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticValueSlot<JSInt8ArrayConstructor, DOMObject>(exec, JSInt8ArrayPrototype::s_info.staticPropHashTable, this, propertyName, slot); +} + +bool JSInt8ArrayConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticValueDescriptor<JSInt8ArrayConstructor, DOMObject>(exec, JSInt8ArrayPrototype::s_info.staticPropHashTable, this, propertyName, descriptor); +} + +static EncodedJSValue JSC_HOST_CALL constructCanvasByteArray(ExecState* exec) +{ + ArgList args(exec); + JSInt8ArrayConstructor* jsConstructor = static_cast<JSInt8ArrayConstructor*>(exec->callee()); RefPtr<Int8Array> array = static_cast<Int8Array*>(construct<Int8Array, signed char>(exec, args).get()); if (!array.get()) { setDOMException(exec, INDEX_SIZE_ERR); - return 0; + return JSValue::encode(JSValue()); } - return asObject(toJS(exec, jsConstructor->globalObject(), array.get())); + return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get()))); } JSC::ConstructType JSInt8ArrayConstructor::getConstructData(JSC::ConstructData& constructData) diff --git a/WebCore/bindings/js/JSInt8ArrayConstructor.h b/WebCore/bindings/js/JSInt8ArrayConstructor.h index 4a9bd3a..96482fc 100644 --- a/WebCore/bindings/js/JSInt8ArrayConstructor.h +++ b/WebCore/bindings/js/JSInt8ArrayConstructor.h @@ -32,13 +32,24 @@ namespace WebCore { class JSInt8ArrayConstructor : public DOMConstructorObject { + typedef DOMConstructorObject Base; public: JSInt8ArrayConstructor(JSC::ExecState*, JSDOMGlobalObject*); + static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*); + virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); + virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); static const JSC::ClassInfo s_info; + static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) + { + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); + } + private: virtual JSC::ConstructType getConstructData(JSC::ConstructData&); virtual const JSC::ClassInfo* classInfo() const { return &s_info; } + protected: + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; }; } diff --git a/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp b/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp index 6c04930..0f47b7b 100644 --- a/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp +++ b/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp @@ -30,6 +30,7 @@ #include "JavaScriptCallFrame.h" #include <runtime/ArrayPrototype.h> +#include <runtime/Error.h> using namespace JSC; @@ -41,7 +42,7 @@ JSValue JSJavaScriptCallFrame::evaluate(ExecState* exec) JSValue result = impl()->evaluate(exec->argument(0).toString(exec), exception); if (exception) - exec->setException(exception); + throwError(exec, exception); return result; } diff --git a/WebCore/bindings/js/JSMessageChannelConstructor.cpp b/WebCore/bindings/js/JSMessageChannelConstructor.cpp index 9721ba3..b188ed5 100644 --- a/WebCore/bindings/js/JSMessageChannelConstructor.cpp +++ b/WebCore/bindings/js/JSMessageChannelConstructor.cpp @@ -54,14 +54,14 @@ ConstructType JSMessageChannelConstructor::getConstructData(ConstructData& const return ConstructTypeHost; } -JSObject* JSMessageChannelConstructor::construct(ExecState* exec, JSObject* constructor, const ArgList&) +EncodedJSValue JSC_HOST_CALL JSMessageChannelConstructor::construct(ExecState* exec) { - JSMessageChannelConstructor* jsConstructor = static_cast<JSMessageChannelConstructor*>(constructor); + JSMessageChannelConstructor* jsConstructor = static_cast<JSMessageChannelConstructor*>(exec->callee()); ScriptExecutionContext* context = jsConstructor->scriptExecutionContext(); if (!context) - return throwError(exec, ReferenceError, "MessageChannel constructor associated document is unavailable"); + return throwVMError(exec, createReferenceError(exec, "MessageChannel constructor associated document is unavailable")); - return asObject(toJS(exec, jsConstructor->globalObject(), MessageChannel::create(context))); + return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), MessageChannel::create(context)))); } } // namespace WebCore diff --git a/WebCore/bindings/js/JSMessageChannelConstructor.h b/WebCore/bindings/js/JSMessageChannelConstructor.h index d958760..decf05b 100644 --- a/WebCore/bindings/js/JSMessageChannelConstructor.h +++ b/WebCore/bindings/js/JSMessageChannelConstructor.h @@ -38,7 +38,7 @@ namespace WebCore { static const JSC::ClassInfo s_info; virtual bool implementsHasInstance() const { return true; } - static JSC::JSObject* construct(JSC::ExecState*, JSC::JSObject*, const JSC::ArgList&); + static JSC::EncodedJSValue JSC_HOST_CALL construct(JSC::ExecState*); virtual JSC::ConstructType getConstructData(JSC::ConstructData&); }; diff --git a/WebCore/bindings/js/JSMessagePortCustom.cpp b/WebCore/bindings/js/JSMessagePortCustom.cpp index 79c1811..227d6ed 100644 --- a/WebCore/bindings/js/JSMessagePortCustom.cpp +++ b/WebCore/bindings/js/JSMessagePortCustom.cpp @@ -86,7 +86,7 @@ void fillMessagePortArray(JSC::ExecState* exec, JSC::JSValue value, MessagePortA // Validation of Objects implementing an interface, per WebIDL spec 4.1.15. RefPtr<MessagePort> port = toMessagePort(value); if (!port) { - throwError(exec, TypeError); + throwTypeError(exec); return; } portArray[i] = port.release(); diff --git a/WebCore/bindings/js/JSNodeFilterCondition.cpp b/WebCore/bindings/js/JSNodeFilterCondition.cpp index d34f5c1..b723286 100644 --- a/WebCore/bindings/js/JSNodeFilterCondition.cpp +++ b/WebCore/bindings/js/JSNodeFilterCondition.cpp @@ -46,7 +46,7 @@ short JSNodeFilterCondition::acceptNode(JSC::ExecState* exec, Node* filterNode) JSLock lock(SilenceAssertionsOnly); CallData callData; - CallType callType = m_filter.getCallData(callData); + CallType callType = getCallData(m_filter, callData); if (callType == CallTypeNone) return NodeFilter::FILTER_ACCEPT; diff --git a/WebCore/bindings/js/JSNodeListCustom.cpp b/WebCore/bindings/js/JSNodeListCustom.cpp index 6d51943..dd59c15 100644 --- a/WebCore/bindings/js/JSNodeListCustom.cpp +++ b/WebCore/bindings/js/JSNodeListCustom.cpp @@ -36,13 +36,13 @@ using namespace JSC; namespace WebCore { // Need to support call so that list(0) works. -static JSValue JSC_HOST_CALL callNodeList(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL callNodeList(ExecState* exec) { bool ok; unsigned index = exec->argument(0).toString(exec).toUInt32(&ok); if (!ok) - return jsUndefined(); - return toJS(exec, static_cast<JSNodeList*>(exec->callee())->impl()->item(index)); + return JSValue::encode(jsUndefined()); + return JSValue::encode(toJS(exec, static_cast<JSNodeList*>(exec->callee())->impl()->item(index))); } CallType JSNodeList::getCallData(CallData& callData) diff --git a/WebCore/bindings/js/JSOptionConstructor.cpp b/WebCore/bindings/js/JSOptionConstructor.cpp index 8b29136..d0a51cd 100644 --- a/WebCore/bindings/js/JSOptionConstructor.cpp +++ b/WebCore/bindings/js/JSOptionConstructor.cpp @@ -42,31 +42,31 @@ JSOptionConstructor::JSOptionConstructor(ExecState* exec, JSDOMGlobalObject* glo putDirect(exec->propertyNames().length, jsNumber(exec, 4), ReadOnly|DontDelete|DontEnum); } -static JSObject* constructHTMLOptionElement(ExecState* exec, JSObject* constructor, const ArgList& args) +static EncodedJSValue JSC_HOST_CALL constructHTMLOptionElement(ExecState* exec) { - JSOptionConstructor* jsConstructor = static_cast<JSOptionConstructor*>(constructor); + JSOptionConstructor* jsConstructor = static_cast<JSOptionConstructor*>(exec->callee()); Document* document = jsConstructor->document(); if (!document) - return throwError(exec, ReferenceError, "Option constructor associated document is unavailable"); + return throwVMError(exec, createReferenceError(exec, "Option constructor associated document is unavailable")); String data; - if (!args.at(0).isUndefined()) - data = ustringToString(args.at(0).toString(exec)); + if ((exec->argumentCount() >= 1) && !exec->argument(0).isUndefined()) + data = ustringToString(exec->argument(0).toString(exec)); String value; - if (!args.at(1).isUndefined()) - value = ustringToString(args.at(1).toString(exec)); - bool defaultSelected = args.at(2).toBoolean(exec); - bool selected = args.at(3).toBoolean(exec); + if ((exec->argumentCount() >= 2) && !exec->argument(1).isUndefined()) + value = ustringToString(exec->argument(1).toString(exec)); + bool defaultSelected = (exec->argumentCount() >= 3) && exec->argument(2).toBoolean(exec); + bool selected = (exec->argumentCount() >= 4) && exec->argument(3).toBoolean(exec); ExceptionCode ec = 0; RefPtr<HTMLOptionElement> element = HTMLOptionElement::createForJSConstructor(document, data, value, defaultSelected, selected, ec); if (ec) { setDOMException(exec, ec); - return 0; + return JSValue::encode(JSValue()); } - return asObject(toJS(exec, jsConstructor->globalObject(), element.release())); + return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), element.release()))); } ConstructType JSOptionConstructor::getConstructData(ConstructData& constructData) diff --git a/WebCore/bindings/js/JSPluginElementFunctions.cpp b/WebCore/bindings/js/JSPluginElementFunctions.cpp index a260782..7cc2e65 100644 --- a/WebCore/bindings/js/JSPluginElementFunctions.cpp +++ b/WebCore/bindings/js/JSPluginElementFunctions.cpp @@ -105,13 +105,13 @@ bool runtimeObjectCustomPut(ExecState* exec, const Identifier& propertyName, JSV return true; } -static JSValue JSC_HOST_CALL callPlugin(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL callPlugin(ExecState* exec) { Instance* instance = pluginInstance(static_cast<JSHTMLElement*>(exec->callee())->impl()); instance->begin(); JSValue result = instance->invokeDefaultMethod(exec); instance->end(); - return result; + return JSValue::encode(result); } CallType runtimeObjectGetCallData(HTMLElement* element, CallData& callData) diff --git a/WebCore/bindings/js/JSSVGMatrixCustom.cpp b/WebCore/bindings/js/JSSVGMatrixCustom.cpp index 149da8a..56f735e 100644 --- a/WebCore/bindings/js/JSSVGMatrixCustom.cpp +++ b/WebCore/bindings/js/JSSVGMatrixCustom.cpp @@ -34,10 +34,10 @@ namespace WebCore { JSValue JSSVGMatrix::multiply(ExecState* exec) { if (exec->argumentCount() < 1) - return throwError(exec, SyntaxError, "Not enough arguments"); + return throwError(exec, createSyntaxError(exec, "Not enough arguments")); if (!exec->argument(0).inherits(&JSSVGMatrix::s_info)) - return throwError(exec, TypeError, "secondMatrix argument was not a SVGMatrix"); + return throwError(exec, createTypeError(exec, "secondMatrix argument was not a SVGMatrix")); JSSVGMatrix* matrixObj = static_cast<JSSVGMatrix*>(asObject(exec->argument(0))); diff --git a/WebCore/bindings/js/JSSharedWorkerConstructor.cpp b/WebCore/bindings/js/JSSharedWorkerConstructor.cpp index a66b1f7..f2bf6de 100644 --- a/WebCore/bindings/js/JSSharedWorkerConstructor.cpp +++ b/WebCore/bindings/js/JSSharedWorkerConstructor.cpp @@ -53,20 +53,20 @@ JSSharedWorkerConstructor::JSSharedWorkerConstructor(ExecState* exec, JSDOMGloba putDirect(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly|DontDelete|DontEnum); } -static JSObject* constructSharedWorker(ExecState* exec, JSObject* constructor, const ArgList& args) +static EncodedJSValue JSC_HOST_CALL constructSharedWorker(ExecState* exec) { - JSSharedWorkerConstructor* jsConstructor = static_cast<JSSharedWorkerConstructor*>(constructor); + JSSharedWorkerConstructor* jsConstructor = static_cast<JSSharedWorkerConstructor*>(exec->callee()); - if (args.size() < 1) - return throwError(exec, SyntaxError, "Not enough arguments"); + if (exec->argumentCount() < 1) + return throwVMError(exec, createSyntaxError(exec, "Not enough arguments")); - UString scriptURL = args.at(0).toString(exec); + UString scriptURL = exec->argument(0).toString(exec); UString name; - if (args.size() > 1) - name = args.at(1).toString(exec); + if (exec->argumentCount() > 1) + name = exec->argument(1).toString(exec); if (exec->hadException()) - return 0; + return JSValue::encode(JSValue()); // FIXME: We need to use both the dynamic scope and the lexical scope (dynamic scope for resolving the worker URL) DOMWindow* window = asJSDOMWindow(exec->lexicalGlobalObject())->impl(); @@ -74,7 +74,7 @@ static JSObject* constructSharedWorker(ExecState* exec, JSObject* constructor, c RefPtr<SharedWorker> worker = SharedWorker::create(ustringToString(scriptURL), ustringToString(name), window->document(), ec); setDOMException(exec, ec); - return asObject(toJS(exec, jsConstructor->globalObject(), worker.release())); + return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), worker.release()))); } ConstructType JSSharedWorkerConstructor::getConstructData(ConstructData& constructData) diff --git a/WebCore/bindings/js/JSUint16ArrayConstructor.cpp b/WebCore/bindings/js/JSUint16ArrayConstructor.cpp index 243c3a1..b1770c5 100644 --- a/WebCore/bindings/js/JSUint16ArrayConstructor.cpp +++ b/WebCore/bindings/js/JSUint16ArrayConstructor.cpp @@ -45,19 +45,34 @@ const ClassInfo JSUint16ArrayConstructor::s_info = { "Uint16ArrayConstructor", & JSUint16ArrayConstructor::JSUint16ArrayConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) : DOMConstructorObject(JSUint16ArrayConstructor::createStructure(globalObject->objectPrototype()), globalObject) { - putDirect(exec->propertyNames().prototype, JSUint16ArrayPrototype::self(exec, globalObject), None); - putDirect(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly|DontDelete|DontEnum); + putDirect(exec->propertyNames().prototype, JSUint16ArrayPrototype::self(exec, globalObject), DontDelete | ReadOnly); } -static JSObject* constructCanvasUnsignedShortArray(ExecState* exec, JSObject* constructor, const ArgList& args) +JSObject* JSUint16ArrayConstructor::createPrototype(ExecState* exec, JSGlobalObject* globalObject) { - JSUint16ArrayConstructor* jsConstructor = static_cast<JSUint16ArrayConstructor*>(constructor); + return new (exec) JSUint16ArrayPrototype(globalObject, JSUint16ArrayPrototype::createStructure(globalObject->objectPrototype())); +} + +bool JSUint16ArrayConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticValueSlot<JSUint16ArrayConstructor, DOMObject>(exec, JSUint16ArrayPrototype::s_info.staticPropHashTable, this, propertyName, slot); +} + +bool JSUint16ArrayConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticValueDescriptor<JSUint16ArrayConstructor, DOMObject>(exec, JSUint16ArrayPrototype::s_info.staticPropHashTable, this, propertyName, descriptor); +} + +static EncodedJSValue JSC_HOST_CALL constructCanvasUnsignedShortArray(ExecState* exec) +{ + ArgList args(exec); + JSUint16ArrayConstructor* jsConstructor = static_cast<JSUint16ArrayConstructor*>(exec->callee()); RefPtr<Uint16Array> array = static_cast<Uint16Array*>(construct<Uint16Array, unsigned short>(exec, args).get()); if (!array.get()) { setDOMException(exec, INDEX_SIZE_ERR); - return 0; + return JSValue::encode(JSValue()); } - return asObject(toJS(exec, jsConstructor->globalObject(), array.get())); + return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get()))); } JSC::ConstructType JSUint16ArrayConstructor::getConstructData(JSC::ConstructData& constructData) diff --git a/WebCore/bindings/js/JSUint16ArrayConstructor.h b/WebCore/bindings/js/JSUint16ArrayConstructor.h index a146d00..b950791 100644 --- a/WebCore/bindings/js/JSUint16ArrayConstructor.h +++ b/WebCore/bindings/js/JSUint16ArrayConstructor.h @@ -32,13 +32,24 @@ namespace WebCore { class JSUint16ArrayConstructor : public DOMConstructorObject { + typedef DOMConstructorObject Base; public: JSUint16ArrayConstructor(JSC::ExecState*, JSDOMGlobalObject*); + static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*); + virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); + virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); static const JSC::ClassInfo s_info; + static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) + { + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); + } + private: virtual JSC::ConstructType getConstructData(JSC::ConstructData&); virtual const JSC::ClassInfo* classInfo() const { return &s_info; } + protected: + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; }; } diff --git a/WebCore/bindings/js/JSUint32ArrayConstructor.cpp b/WebCore/bindings/js/JSUint32ArrayConstructor.cpp index b03f093..46ec9da 100644 --- a/WebCore/bindings/js/JSUint32ArrayConstructor.cpp +++ b/WebCore/bindings/js/JSUint32ArrayConstructor.cpp @@ -45,19 +45,34 @@ const ClassInfo JSUint32ArrayConstructor::s_info = { "Uint32ArrayConstructor", & JSUint32ArrayConstructor::JSUint32ArrayConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) : DOMConstructorObject(JSUint32ArrayConstructor::createStructure(globalObject->objectPrototype()), globalObject) { - putDirect(exec->propertyNames().prototype, JSUint32ArrayPrototype::self(exec, globalObject), None); - putDirect(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly|DontDelete|DontEnum); + putDirect(exec->propertyNames().prototype, JSUint32ArrayPrototype::self(exec, globalObject), DontDelete | ReadOnly); } -static JSObject* constructCanvasUnsignedIntArray(ExecState* exec, JSObject* constructor, const ArgList& args) +JSObject* JSUint32ArrayConstructor::createPrototype(ExecState* exec, JSGlobalObject* globalObject) { - JSUint32ArrayConstructor* jsConstructor = static_cast<JSUint32ArrayConstructor*>(constructor); + return new (exec) JSUint32ArrayPrototype(globalObject, JSUint32ArrayPrototype::createStructure(globalObject->objectPrototype())); +} + +bool JSUint32ArrayConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticValueSlot<JSUint32ArrayConstructor, DOMObject>(exec, JSUint32ArrayPrototype::s_info.staticPropHashTable, this, propertyName, slot); +} + +bool JSUint32ArrayConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticValueDescriptor<JSUint32ArrayConstructor, DOMObject>(exec, JSUint32ArrayPrototype::s_info.staticPropHashTable, this, propertyName, descriptor); +} + +static EncodedJSValue JSC_HOST_CALL constructCanvasUnsignedIntArray(ExecState* exec) +{ + ArgList args(exec); + JSUint32ArrayConstructor* jsConstructor = static_cast<JSUint32ArrayConstructor*>(exec->callee()); RefPtr<Uint32Array> array = static_cast<Uint32Array*>(construct<Uint32Array, unsigned int>(exec, args).get()); if (!array.get()) { setDOMException(exec, INDEX_SIZE_ERR); - return 0; + return JSValue::encode(JSValue()); } - return asObject(toJS(exec, jsConstructor->globalObject(), array.get())); + return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get()))); } JSC::ConstructType JSUint32ArrayConstructor::getConstructData(JSC::ConstructData& constructData) diff --git a/WebCore/bindings/js/JSUint32ArrayConstructor.h b/WebCore/bindings/js/JSUint32ArrayConstructor.h index a00c071..7cad849 100644 --- a/WebCore/bindings/js/JSUint32ArrayConstructor.h +++ b/WebCore/bindings/js/JSUint32ArrayConstructor.h @@ -32,13 +32,24 @@ namespace WebCore { class JSUint32ArrayConstructor : public DOMConstructorObject { + typedef DOMConstructorObject Base; public: JSUint32ArrayConstructor(JSC::ExecState*, JSDOMGlobalObject*); + static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*); + virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); + virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); static const JSC::ClassInfo s_info; + static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) + { + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); + } + private: virtual JSC::ConstructType getConstructData(JSC::ConstructData&); virtual const JSC::ClassInfo* classInfo() const { return &s_info; } + protected: + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; }; } diff --git a/WebCore/bindings/js/JSUint8ArrayConstructor.cpp b/WebCore/bindings/js/JSUint8ArrayConstructor.cpp index 531b860..0d47b51 100644 --- a/WebCore/bindings/js/JSUint8ArrayConstructor.cpp +++ b/WebCore/bindings/js/JSUint8ArrayConstructor.cpp @@ -46,19 +46,34 @@ const ClassInfo JSUint8ArrayConstructor::s_info = { "Uint8ArrayConstructor", &JS JSUint8ArrayConstructor::JSUint8ArrayConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) : DOMConstructorObject(JSUint8ArrayConstructor::createStructure(globalObject->objectPrototype()), globalObject) { - putDirect(exec->propertyNames().prototype, JSUint8ArrayPrototype::self(exec, globalObject), None); - putDirect(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly|DontDelete|DontEnum); + putDirect(exec->propertyNames().prototype, JSUint8ArrayPrototype::self(exec, globalObject), DontDelete | ReadOnly); } -static JSObject* constructCanvasUnsignedByteArray(ExecState* exec, JSObject* constructor, const ArgList& args) +JSObject* JSUint8ArrayConstructor::createPrototype(ExecState* exec, JSGlobalObject* globalObject) { - JSUint8ArrayConstructor* jsConstructor = static_cast<JSUint8ArrayConstructor*>(constructor); + return new (exec) JSUint8ArrayPrototype(globalObject, JSUint8ArrayPrototype::createStructure(globalObject->objectPrototype())); +} + +bool JSUint8ArrayConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticValueSlot<JSUint8ArrayConstructor, DOMObject>(exec, JSUint8ArrayPrototype::s_info.staticPropHashTable, this, propertyName, slot); +} + +bool JSUint8ArrayConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticValueDescriptor<JSUint8ArrayConstructor, DOMObject>(exec, JSUint8ArrayPrototype::s_info.staticPropHashTable, this, propertyName, descriptor); +} + +static EncodedJSValue JSC_HOST_CALL constructCanvasUnsignedByteArray(ExecState* exec) +{ + ArgList args(exec); + JSUint8ArrayConstructor* jsConstructor = static_cast<JSUint8ArrayConstructor*>(exec->callee()); RefPtr<Uint8Array> array = static_cast<Uint8Array*>(construct<Uint8Array, unsigned char>(exec, args).get()); if (!array.get()) { setDOMException(exec, INDEX_SIZE_ERR); - return 0; + return JSValue::encode(JSValue()); } - return asObject(toJS(exec, jsConstructor->globalObject(), array.get())); + return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get()))); } JSC::ConstructType JSUint8ArrayConstructor::getConstructData(JSC::ConstructData& constructData) diff --git a/WebCore/bindings/js/JSUint8ArrayConstructor.h b/WebCore/bindings/js/JSUint8ArrayConstructor.h index 05db4ee..644cf86 100644 --- a/WebCore/bindings/js/JSUint8ArrayConstructor.h +++ b/WebCore/bindings/js/JSUint8ArrayConstructor.h @@ -32,13 +32,24 @@ namespace WebCore { class JSUint8ArrayConstructor : public DOMConstructorObject { + typedef DOMConstructorObject Base; public: JSUint8ArrayConstructor(JSC::ExecState*, JSDOMGlobalObject*); + static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*); + virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); + virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); static const JSC::ClassInfo s_info; + static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) + { + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); + } + private: virtual JSC::ConstructType getConstructData(JSC::ConstructData&); virtual const JSC::ClassInfo* classInfo() const { return &s_info; } + protected: + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; }; } diff --git a/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp b/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp index 02dae08..eb4f549 100644 --- a/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp +++ b/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp @@ -36,7 +36,7 @@ #include "JSHTMLImageElement.h" #include "JSImageData.h" #include "JSWebGLBuffer.h" -#include "JSFloatArray.h" +#include "JSFloat32Array.h" #include "JSWebGLFramebuffer.h" #include "JSInt32Array.h" #include "JSWebGLProgram.h" @@ -48,7 +48,7 @@ #include "JSWebKitCSSMatrix.h" #include "NotImplemented.h" #include "WebGLBuffer.h" -#include "FloatArray.h" +#include "Float32Array.h" #include "WebGLFramebuffer.h" #include "WebGLGetInfo.h" #include "Int32Array.h" @@ -67,45 +67,6 @@ using namespace JSC; namespace WebCore { -JSValue JSWebGLRenderingContext::bufferData(JSC::ExecState* exec) -{ - if (exec->argumentCount() != 3) - return throwError(exec, SyntaxError); - - unsigned target = exec->argument(0).toInt32(exec); - unsigned usage = exec->argument(2).toInt32(exec); - ExceptionCode ec = 0; - - // If argument 1 is a number, we are initializing this buffer to that size - if (!exec->argument(1).isObject()) { - unsigned int count = exec->argument(1).toInt32(exec); - static_cast<WebGLRenderingContext*>(impl())->bufferData(target, count, usage, ec); - } else { - ArrayBufferView* array = toArrayBufferView(exec->argument(1)); - static_cast<WebGLRenderingContext*>(impl())->bufferData(target, array, usage, ec); - } - - setDOMException(exec, ec); - return jsUndefined(); -} - -JSValue JSWebGLRenderingContext::bufferSubData(JSC::ExecState* exec) -{ - if (exec->argumentCount() != 3) - return throwError(exec, SyntaxError); - - unsigned target = exec->argument(0).toInt32(exec); - unsigned offset = exec->argument(1).toInt32(exec); - ExceptionCode ec = 0; - - ArrayBufferView* array = toArrayBufferView(exec->argument(2)); - - static_cast<WebGLRenderingContext*>(impl())->bufferSubData(target, offset, array, ec); - - setDOMException(exec, ec); - return jsUndefined(); -} - static JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, const WebGLGetInfo& info) { switch (info.getType()) { @@ -152,7 +113,7 @@ enum ObjectType { static JSValue getObjectParameter(JSWebGLRenderingContext* obj, ExecState* exec, ObjectType objectType) { if (exec->argumentCount() != 2) - return throwError(exec, SyntaxError); + return throwSyntaxError(exec); ExceptionCode ec = 0; WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(obj->impl()); @@ -200,7 +161,7 @@ JSValue JSWebGLRenderingContext::getBufferParameter(ExecState* exec) JSValue JSWebGLRenderingContext::getFramebufferAttachmentParameter(ExecState* exec) { if (exec->argumentCount() != 3) - return throwError(exec, SyntaxError); + return throwSyntaxError(exec); ExceptionCode ec = 0; WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl()); @@ -224,7 +185,7 @@ JSValue JSWebGLRenderingContext::getFramebufferAttachmentParameter(ExecState* ex JSValue JSWebGLRenderingContext::getParameter(ExecState* exec) { if (exec->argumentCount() != 1) - return throwError(exec, SyntaxError); + return throwSyntaxError(exec); ExceptionCode ec = 0; WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl()); @@ -242,7 +203,7 @@ JSValue JSWebGLRenderingContext::getParameter(ExecState* exec) JSValue JSWebGLRenderingContext::getProgramParameter(ExecState* exec) { if (exec->argumentCount() != 2) - return throwError(exec, SyntaxError); + return throwSyntaxError(exec); ExceptionCode ec = 0; WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl()); @@ -266,7 +227,7 @@ JSValue JSWebGLRenderingContext::getRenderbufferParameter(ExecState* exec) JSValue JSWebGLRenderingContext::getShaderParameter(ExecState* exec) { if (exec->argumentCount() != 2) - return throwError(exec, SyntaxError); + return throwSyntaxError(exec); ExceptionCode ec = 0; WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl()); @@ -290,7 +251,7 @@ JSValue JSWebGLRenderingContext::getTexParameter(ExecState* exec) JSValue JSWebGLRenderingContext::getUniform(ExecState* exec) { if (exec->argumentCount() != 2) - return throwError(exec, SyntaxError); + return throwSyntaxError(exec); ExceptionCode ec = 0; WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl()); @@ -311,207 +272,6 @@ JSValue JSWebGLRenderingContext::getVertexAttrib(ExecState* exec) return getObjectParameter(this, exec, kVertexAttrib); } -// void texImage2D(in GLenum target, in GLint level, in GLenum internalformat, in GLsizei width, in GLsizei height, in GLint border, in GLenum format, in GLenum type, in ArrayBufferView pixels); -// void texImage2D(in GLenum target, in GLint level, in ImageData pixels, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha); -// void texImage2D(in GLenum target, in GLint level, in HTMLImageElement image, [Optional] in GLboolean flipY, [Optional] in premultiplyAlpha); -// void texImage2D(in GLenum target, in GLint level, in HTMLCanvasElement canvas, [Optional] in GLboolean flipY, [Optional] in premultiplyAlpha); -// void texImage2D(in GLenum target, in GLint level, in HTMLVideoElement video, [Optional] in GLboolean flipY, [Optional] in premultiplyAlpha); -JSValue JSWebGLRenderingContext::texImage2D(ExecState* exec) -{ - if (exec->argumentCount() < 3 || exec->argumentCount() > 9) - return throwError(exec, SyntaxError); - - ExceptionCode ec = 0; - - WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl()); - unsigned target = exec->argument(0).toInt32(exec); - if (exec->hadException()) - return jsUndefined(); - - unsigned level = exec->argument(1).toInt32(exec); - if (exec->hadException()) - return jsUndefined(); - - JSObject* o = 0; - - if (exec->argumentCount() <= 5) { - // This is one of the last 4 forms. Param 2 can be ImageData or <img>, <canvas> or <video> element. - JSValue value = exec->argument(2); - - if (!value.isObject()) - return throwError(exec, TypeError); - - o = asObject(value); - - bool flipY = exec->argument(3).toBoolean(exec); - bool premultiplyAlpha = exec->argument(4).toBoolean(exec); - - if (o->inherits(&JSImageData::s_info)) { - ImageData* data = static_cast<ImageData*>(static_cast<JSImageData*>(o)->impl()); - context->texImage2D(target, level, data, flipY, premultiplyAlpha, ec); - } else if (o->inherits(&JSHTMLImageElement::s_info)) { - HTMLImageElement* element = static_cast<HTMLImageElement*>(static_cast<JSHTMLImageElement*>(o)->impl()); - context->texImage2D(target, level, element, flipY, premultiplyAlpha, ec); - } else if (o->inherits(&JSHTMLCanvasElement::s_info)) { - HTMLCanvasElement* element = static_cast<HTMLCanvasElement*>(static_cast<JSHTMLCanvasElement*>(o)->impl()); - context->texImage2D(target, level, element, flipY, premultiplyAlpha, ec); -#if ENABLE(VIDEO) - } else if (o->inherits(&JSHTMLVideoElement::s_info)) { - HTMLVideoElement* element = static_cast<HTMLVideoElement*>(static_cast<JSHTMLVideoElement*>(o)->impl()); - context->texImage2D(target, level, element, flipY, premultiplyAlpha, ec); -#endif - } else - ec = TYPE_MISMATCH_ERR; - } else { - if (exec->argumentCount() != 9) - return throwError(exec, SyntaxError); - - // This must be the ArrayBufferView case - unsigned internalformat = exec->argument(2).toInt32(exec); - if (exec->hadException()) - return jsUndefined(); - - unsigned width = exec->argument(3).toInt32(exec); - if (exec->hadException()) - return jsUndefined(); - - unsigned height = exec->argument(4).toInt32(exec); - if (exec->hadException()) - return jsUndefined(); - - unsigned border = exec->argument(5).toInt32(exec); - if (exec->hadException()) - return jsUndefined(); - - unsigned format = exec->argument(6).toInt32(exec); - if (exec->hadException()) - return jsUndefined(); - - unsigned type = exec->argument(7).toInt32(exec); - if (exec->hadException()) - return jsUndefined(); - - JSValue value = exec->argument(8); - - // For this case passing 0 (for a null array) is allowed - if (value.isNull()) - context->texImage2D(target, level, internalformat, width, height, border, format, type, 0, ec); - else if (value.isObject()) { - o = asObject(value); - - if (o->inherits(&JSArrayBufferView::s_info)) { - // FIXME: Need to check to make sure ArrayBufferView is a Int8Array or Int16Array, - // depending on the passed type parameter. - ArrayBufferView* obj = static_cast<ArrayBufferView*>(static_cast<JSArrayBufferView*>(o)->impl()); - context->texImage2D(target, level, internalformat, width, height, border, format, type, obj, ec); - } else - return throwError(exec, TypeError); - } else - return throwError(exec, TypeError); - } - - setDOMException(exec, ec); - return jsUndefined(); -} - -// void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, in GLsizei width, in GLsizei height, in GLenum format, in GLenum type, in ArrayBufferView pixels); -// void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, in ImageData pixels, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha); -// void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, in HTMLImageElement image, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha); -// void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, in HTMLCanvasElement canvas, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha); -// void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, in HTMLVideoElement video, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha); -JSValue JSWebGLRenderingContext::texSubImage2D(ExecState* exec) -{ - if (exec->argumentCount() < 5 || exec->argumentCount() > 9) - return throwError(exec, SyntaxError); - - ExceptionCode ec = 0; - - WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl()); - unsigned target = exec->argument(0).toInt32(exec); - if (exec->hadException()) - return jsUndefined(); - - unsigned level = exec->argument(1).toInt32(exec); - if (exec->hadException()) - return jsUndefined(); - - unsigned xoff = exec->argument(2).toInt32(exec); - if (exec->hadException()) - return jsUndefined(); - - unsigned yoff = exec->argument(3).toInt32(exec); - if (exec->hadException()) - return jsUndefined(); - - JSObject* o = 0; - - if (exec->argumentCount() <= 7) { - // This is one of the last 4 forms. Param 4 can be <img>, <canvas> or <video> element, of the format param. - JSValue value = exec->argument(4); - - if (!value.isObject()) - return throwError(exec, SyntaxError); - - o = asObject(value); - - bool flipY = exec->argument(5).toBoolean(exec); - bool premultiplyAlpha = exec->argument(6).toBoolean(exec); - - if (o->inherits(&JSImageData::s_info)) { - ImageData* data = static_cast<ImageData*>(static_cast<JSImageData*>(o)->impl()); - context->texSubImage2D(target, level, xoff, yoff, data, flipY, premultiplyAlpha, ec); - } else if (o->inherits(&JSHTMLImageElement::s_info)) { - HTMLImageElement* element = static_cast<HTMLImageElement*>(static_cast<JSHTMLImageElement*>(o)->impl()); - context->texSubImage2D(target, level, xoff, yoff, element, flipY, premultiplyAlpha, ec); - } else if (o->inherits(&JSHTMLCanvasElement::s_info)) { - HTMLCanvasElement* element = static_cast<HTMLCanvasElement*>(static_cast<JSHTMLCanvasElement*>(o)->impl()); - context->texSubImage2D(target, level, xoff, yoff, element, flipY, premultiplyAlpha, ec); -#if ENABLE(VIDEO) - } else if (o->inherits(&JSHTMLVideoElement::s_info)) { - HTMLVideoElement* element = static_cast<HTMLVideoElement*>(static_cast<JSHTMLVideoElement*>(o)->impl()); - context->texSubImage2D(target, level, xoff, yoff, element, flipY, premultiplyAlpha, ec); -#endif - } else - ec = TYPE_MISMATCH_ERR; - } else { - // This must be the ArrayBufferView form - if (exec->argumentCount() != 9) - return throwError(exec, SyntaxError); - - unsigned width = exec->argument(4).toInt32(exec); - if (exec->hadException()) - return jsUndefined(); - - unsigned height = exec->argument(5).toInt32(exec); - if (exec->hadException()) - return jsUndefined(); - - unsigned format = exec->argument(6).toInt32(exec); - if (exec->hadException()) - return jsUndefined(); - - unsigned type = exec->argument(7).toInt32(exec); - if (exec->hadException()) - return jsUndefined(); - - JSValue value = exec->argument(8); - if (!value.isObject()) - context->texSubImage2D(target, level, xoff, yoff, width, height, format, type, 0, ec); - else { - o = asObject(value); - - if (o->inherits(&JSArrayBufferView::s_info)) { - ArrayBufferView* obj = static_cast<ArrayBufferView*>(static_cast<JSArrayBufferView*>(o)->impl()); - context->texSubImage2D(target, level, xoff, yoff, width, height, format, type, obj, ec); - } else - return throwError(exec, TypeError); - } - } - - setDOMException(exec, ec); - return jsUndefined(); -} - template<typename T, size_t inlineCapacity> bool toVector(JSC::ExecState* exec, JSC::JSValue value, Vector<T, inlineCapacity>& vector) { @@ -558,7 +318,7 @@ static bool functionForUniform(DataFunctionToCall f) static JSC::JSValue dataFunctionf(DataFunctionToCall f, JSC::ExecState* exec, WebGLRenderingContext* context) { if (exec->argumentCount() != 2) - return throwError(exec, SyntaxError); + return throwSyntaxError(exec); WebGLUniformLocation* location = 0; long index = -1; @@ -571,7 +331,7 @@ static JSC::JSValue dataFunctionf(DataFunctionToCall f, JSC::ExecState* exec, We if (exec->hadException()) return jsUndefined(); - RefPtr<FloatArray> webGLArray = toFloatArray(exec->argument(1)); + RefPtr<Float32Array> webGLArray = toFloat32Array(exec->argument(1)); if (exec->hadException()) return jsUndefined(); @@ -610,7 +370,7 @@ static JSC::JSValue dataFunctionf(DataFunctionToCall f, JSC::ExecState* exec, We Vector<float, 64> array; if (!toVector(exec, exec->argument(1), array)) - return throwError(exec, TypeError); + return throwTypeError(exec); switch (f) { case f_uniform1v: @@ -646,7 +406,7 @@ static JSC::JSValue dataFunctionf(DataFunctionToCall f, JSC::ExecState* exec, We static JSC::JSValue dataFunctioni(DataFunctionToCall f, JSC::ExecState* exec, WebGLRenderingContext* context) { if (exec->argumentCount() != 2) - return throwError(exec, SyntaxError); + return throwSyntaxError(exec); WebGLUniformLocation* location = toWebGLUniformLocation(exec->argument(0)); @@ -683,7 +443,7 @@ static JSC::JSValue dataFunctioni(DataFunctionToCall f, JSC::ExecState* exec, We Vector<int, 64> array; if (!toVector(exec, exec->argument(1), array)) - return throwError(exec, TypeError); + return throwTypeError(exec); switch (f) { case f_uniform1v: @@ -709,7 +469,7 @@ static JSC::JSValue dataFunctioni(DataFunctionToCall f, JSC::ExecState* exec, We static JSC::JSValue dataFunctionMatrix(DataFunctionMatrixToCall f, JSC::ExecState* exec, WebGLRenderingContext* context) { if (exec->argumentCount() != 3) - return throwError(exec, SyntaxError); + return throwSyntaxError(exec); WebGLUniformLocation* location = toWebGLUniformLocation(exec->argument(0)); @@ -720,7 +480,7 @@ static JSC::JSValue dataFunctionMatrix(DataFunctionMatrixToCall f, JSC::ExecStat if (exec->hadException()) return jsUndefined(); - RefPtr<FloatArray> webGLArray = toFloatArray(exec->argument(2)); + RefPtr<Float32Array> webGLArray = toFloat32Array(exec->argument(2)); if (exec->hadException()) return jsUndefined(); @@ -744,7 +504,7 @@ static JSC::JSValue dataFunctionMatrix(DataFunctionMatrixToCall f, JSC::ExecStat Vector<float, 64> array; if (!toVector(exec, exec->argument(2), array)) - return throwError(exec, TypeError); + return throwTypeError(exec); switch (f) { case f_uniformMatrix2fv: diff --git a/WebCore/bindings/js/JSWebKitCSSMatrixConstructor.cpp b/WebCore/bindings/js/JSWebKitCSSMatrixConstructor.cpp index baf174e..5013a6d 100644 --- a/WebCore/bindings/js/JSWebKitCSSMatrixConstructor.cpp +++ b/WebCore/bindings/js/JSWebKitCSSMatrixConstructor.cpp @@ -42,17 +42,17 @@ JSWebKitCSSMatrixConstructor::JSWebKitCSSMatrixConstructor(ExecState* exec, JSDO putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly|DontDelete|DontEnum); } -static JSObject* constructWebKitCSSMatrix(ExecState* exec, JSObject* constructor, const ArgList& args) +static EncodedJSValue JSC_HOST_CALL constructWebKitCSSMatrix(ExecState* exec) { - JSWebKitCSSMatrixConstructor* jsConstructor = static_cast<JSWebKitCSSMatrixConstructor*>(constructor); + JSWebKitCSSMatrixConstructor* jsConstructor = static_cast<JSWebKitCSSMatrixConstructor*>(exec->callee()); String s; - if (args.size() >= 1) - s = ustringToString(args.at(0).toString(exec)); + if (exec->argumentCount() >= 1) + s = ustringToString(exec->argument(0).toString(exec)); ExceptionCode ec = 0; RefPtr<WebKitCSSMatrix> matrix = WebKitCSSMatrix::create(s, ec); setDOMException(exec, ec); - return CREATE_DOM_OBJECT_WRAPPER(exec, jsConstructor->globalObject(), WebKitCSSMatrix, matrix.get()); + return JSValue::encode(CREATE_DOM_OBJECT_WRAPPER(exec, jsConstructor->globalObject(), WebKitCSSMatrix, matrix.get())); } ConstructType JSWebKitCSSMatrixConstructor::getConstructData(ConstructData& constructData) diff --git a/WebCore/bindings/js/JSWebKitPointConstructor.cpp b/WebCore/bindings/js/JSWebKitPointConstructor.cpp index 27cc1db..c62f5b6 100644 --- a/WebCore/bindings/js/JSWebKitPointConstructor.cpp +++ b/WebCore/bindings/js/JSWebKitPointConstructor.cpp @@ -43,21 +43,21 @@ JSWebKitPointConstructor::JSWebKitPointConstructor(ExecState* exec, JSDOMGlobalO putDirect(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly|DontDelete|DontEnum); } -static JSObject* constructWebKitPoint(ExecState* exec, JSObject* constructor, const ArgList& args) +static EncodedJSValue JSC_HOST_CALL constructWebKitPoint(ExecState* exec) { - JSWebKitPointConstructor* jsConstructor = static_cast<JSWebKitPointConstructor*>(constructor); + JSWebKitPointConstructor* jsConstructor = static_cast<JSWebKitPointConstructor*>(exec->callee()); float x = 0; float y = 0; - if (args.size() >= 2) { - x = (float)args.at(0).toNumber(exec); - y = (float)args.at(1).toNumber(exec); + if (exec->argumentCount() >= 2) { + x = (float)exec->argument(0).toNumber(exec); + y = (float)exec->argument(1).toNumber(exec); if (isnan(x)) x = 0; if (isnan(y)) y = 0; } - return asObject(toJS(exec, jsConstructor->globalObject(), WebKitPoint::create(x, y))); + return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), WebKitPoint::create(x, y)))); } JSC::ConstructType JSWebKitPointConstructor::getConstructData(JSC::ConstructData& constructData) diff --git a/WebCore/bindings/js/JSWebSocketConstructor.cpp b/WebCore/bindings/js/JSWebSocketConstructor.cpp index 57b7477..2384c7b 100644 --- a/WebCore/bindings/js/JSWebSocketConstructor.cpp +++ b/WebCore/bindings/js/JSWebSocketConstructor.cpp @@ -54,32 +54,32 @@ JSWebSocketConstructor::JSWebSocketConstructor(ExecState* exec, JSDOMGlobalObjec putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontDelete | DontEnum); } -static JSObject* constructWebSocket(ExecState* exec, JSObject* constructor, const ArgList& args) +static EncodedJSValue JSC_HOST_CALL constructWebSocket(ExecState* exec) { - JSWebSocketConstructor* jsConstructor = static_cast<JSWebSocketConstructor*>(constructor); + JSWebSocketConstructor* jsConstructor = static_cast<JSWebSocketConstructor*>(exec->callee()); ScriptExecutionContext* context = jsConstructor->scriptExecutionContext(); if (!context) - return throwError(exec, ReferenceError, "WebSocket constructor associated document is unavailable"); + return throwVMError(exec, createReferenceError(exec, "WebSocket constructor associated document is unavailable")); - if (args.size() == 0) - return throwError(exec, SyntaxError, "Not enough arguments"); + if (!exec->argumentCount()) + return throwVMError(exec, createSyntaxError(exec, "Not enough arguments")); - const String& urlString = ustringToString(args.at(0).toString(exec)); + const String& urlString = ustringToString(exec->argument(0).toString(exec)); if (exec->hadException()) - return throwError(exec, SyntaxError, "wrong URL"); + return throwVMError(exec, createSyntaxError(exec, "wrong URL")); const KURL& url = context->completeURL(urlString); RefPtr<WebSocket> webSocket = WebSocket::create(context); ExceptionCode ec = 0; - if (args.size() < 2) + if (exec->argumentCount() < 2) webSocket->connect(url, ec); else { - const String& protocol = ustringToString(args.at(1).toString(exec)); + const String& protocol = ustringToString(exec->argument(1).toString(exec)); if (exec->hadException()) - return 0; + return JSValue::encode(JSValue()); webSocket->connect(url, protocol, ec); } setDOMException(exec, ec); - return CREATE_DOM_OBJECT_WRAPPER(exec, jsConstructor->globalObject(), WebSocket, webSocket.get()); + return JSValue::encode(CREATE_DOM_OBJECT_WRAPPER(exec, jsConstructor->globalObject(), WebSocket, webSocket.get())); } ConstructType JSWebSocketConstructor::getConstructData(ConstructData& constructData) diff --git a/WebCore/bindings/js/JSWebSocketCustom.cpp b/WebCore/bindings/js/JSWebSocketCustom.cpp index 81b5b9e..eb0fda0 100644 --- a/WebCore/bindings/js/JSWebSocketCustom.cpp +++ b/WebCore/bindings/js/JSWebSocketCustom.cpp @@ -48,11 +48,11 @@ namespace WebCore { JSValue JSWebSocket::send(ExecState* exec) { if (exec->argumentCount() < 1) - return throwError(exec, SyntaxError, "Not enough arguments"); + return throwError(exec, createSyntaxError(exec, "Not enough arguments")); const String& msg = ustringToString(exec->argument(0).toString(exec)); if (exec->hadException()) - return throwError(exec, SyntaxError, "bad message data."); + return throwError(exec, createSyntaxError(exec, "bad message data.")); ExceptionCode ec = 0; JSValue ret = jsBoolean(impl()->send(msg, ec)); setDOMException(exec, ec); diff --git a/WebCore/bindings/js/JSWorkerConstructor.cpp b/WebCore/bindings/js/JSWorkerConstructor.cpp index 43c685e..13d8ddc 100644 --- a/WebCore/bindings/js/JSWorkerConstructor.cpp +++ b/WebCore/bindings/js/JSWorkerConstructor.cpp @@ -49,16 +49,16 @@ JSWorkerConstructor::JSWorkerConstructor(ExecState* exec, JSDOMGlobalObject* glo putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly|DontDelete|DontEnum); } -static JSObject* constructWorker(ExecState* exec, JSObject* constructor, const ArgList& args) +static EncodedJSValue JSC_HOST_CALL constructWorker(ExecState* exec) { - JSWorkerConstructor* jsConstructor = static_cast<JSWorkerConstructor*>(constructor); + JSWorkerConstructor* jsConstructor = static_cast<JSWorkerConstructor*>(exec->callee()); - if (args.size() == 0) - return throwError(exec, SyntaxError, "Not enough arguments"); + if (!exec->argumentCount()) + return throwVMError(exec, createSyntaxError(exec, "Not enough arguments")); - UString scriptURL = args.at(0).toString(exec); + UString scriptURL = exec->argument(0).toString(exec); if (exec->hadException()) - return 0; + return JSValue::encode(JSValue()); // See section 4.8.2 step 14 of WebWorkers for why this is the lexicalGlobalObject. DOMWindow* window = asJSDOMWindow(exec->lexicalGlobalObject())->impl(); @@ -67,10 +67,10 @@ static JSObject* constructWorker(ExecState* exec, JSObject* constructor, const A RefPtr<Worker> worker = Worker::create(ustringToString(scriptURL), window->document(), ec); if (ec) { setDOMException(exec, ec); - return 0; + return JSValue::encode(JSValue()); } - return asObject(toJS(exec, jsConstructor->globalObject(), worker.release())); + return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), worker.release()))); } ConstructType JSWorkerConstructor::getConstructData(ConstructData& constructData) diff --git a/WebCore/bindings/js/JSWorkerContextCustom.cpp b/WebCore/bindings/js/JSWorkerContextCustom.cpp index 47a867e..2bde58b 100644 --- a/WebCore/bindings/js/JSWorkerContextCustom.cpp +++ b/WebCore/bindings/js/JSWorkerContextCustom.cpp @@ -45,7 +45,7 @@ #include "JSWebSocketConstructor.h" #include "JSWorkerLocation.h" #include "JSWorkerNavigator.h" -#include "JSXMLHttpRequestConstructor.h" +#include "JSXMLHttpRequest.h" #include "ScheduledAction.h" #include "WorkerContext.h" #include "WorkerLocation.h" diff --git a/WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp b/WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp deleted file mode 100644 index 91fff9a..0000000 --- a/WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2004, 2007, 2008 Apple Inc. All rights reserved. - * Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com> - * - * 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 "JSXMLHttpRequestConstructor.h" - -#include "JSXMLHttpRequest.h" -#include "ScriptExecutionContext.h" -#include "XMLHttpRequest.h" -#include <runtime/Error.h> - -using namespace JSC; - -namespace WebCore { - -ASSERT_CLASS_FITS_IN_CELL(JSXMLHttpRequestConstructor); - -const ClassInfo JSXMLHttpRequestConstructor::s_info = { "XMLHttpRequestConstructor", 0, 0, 0 }; - -JSXMLHttpRequestConstructor::JSXMLHttpRequestConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) - : DOMConstructorObject(JSXMLHttpRequestConstructor::createStructure(globalObject->objectPrototype()), globalObject) -{ - putDirect(exec->propertyNames().prototype, JSXMLHttpRequestPrototype::self(exec, globalObject), None); -} - -static JSObject* constructXMLHttpRequest(ExecState* exec, JSObject* constructor, const ArgList&) -{ - JSXMLHttpRequestConstructor* jsConstructor = static_cast<JSXMLHttpRequestConstructor*>(constructor); - ScriptExecutionContext* context = jsConstructor->scriptExecutionContext(); - if (!context) - return throwError(exec, ReferenceError, "XMLHttpRequest constructor associated document is unavailable"); - - RefPtr<XMLHttpRequest> xmlHttpRequest = XMLHttpRequest::create(context); - return CREATE_DOM_OBJECT_WRAPPER(exec, jsConstructor->globalObject(), XMLHttpRequest, xmlHttpRequest.get()); -} - -ConstructType JSXMLHttpRequestConstructor::getConstructData(ConstructData& constructData) -{ - constructData.native.function = constructXMLHttpRequest; - return ConstructTypeHost; -} - -} // namespace WebCore diff --git a/WebCore/bindings/js/JSXMLHttpRequestConstructor.h b/WebCore/bindings/js/JSXMLHttpRequestConstructor.h deleted file mode 100644 index 2cc4fcf..0000000 --- a/WebCore/bindings/js/JSXMLHttpRequestConstructor.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2003, 2008 Apple Inc. All rights reserved. - * Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com> - * - * 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 JSXMLHttpRequestConstructor_h -#define JSXMLHttpRequestConstructor_h - -#include "JSDOMBinding.h" - -namespace WebCore { - -class JSXMLHttpRequestConstructor : public DOMConstructorObject { -public: - JSXMLHttpRequestConstructor(JSC::ExecState*, JSDOMGlobalObject*); - static const JSC::ClassInfo s_info; -private: - virtual JSC::ConstructType getConstructData(JSC::ConstructData&); - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } -}; - -} // namespace WebCore - -#endif // JSXMLHttpRequestConstructor_h diff --git a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp index 420bf37..da75139 100644 --- a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp +++ b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp @@ -65,7 +65,7 @@ void JSXMLHttpRequest::markChildren(MarkStack& markStack) JSValue JSXMLHttpRequest::open(ExecState* exec) { if (exec->argumentCount() < 2) - return throwError(exec, SyntaxError, "Not enough arguments"); + return throwError(exec, createSyntaxError(exec, "Not enough arguments")); const KURL& url = impl()->scriptExecutionContext()->completeURL(ustringToString(exec->argument(1).toString(exec))); String method = ustringToString(exec->argument(0).toString(exec)); @@ -127,4 +127,15 @@ JSValue JSXMLHttpRequest::responseText(ExecState* exec) const return jsOwnedStringOrNull(exec, impl()->responseText()); } +EncodedJSValue JSC_HOST_CALL JSXMLHttpRequestConstructor::constructJSXMLHttpRequest(ExecState* exec) +{ + JSXMLHttpRequestConstructor* jsConstructor = static_cast<JSXMLHttpRequestConstructor*>(exec->callee()); + ScriptExecutionContext* context = jsConstructor->scriptExecutionContext(); + if (!context) + return throwVMError(exec, createReferenceError(exec, "XMLHttpRequest constructor associated document is unavailable")); + + RefPtr<XMLHttpRequest> xmlHttpRequest = XMLHttpRequest::create(context); + return JSValue::encode(CREATE_DOM_OBJECT_WRAPPER(exec, jsConstructor->globalObject(), XMLHttpRequest, xmlHttpRequest.get())); +} + } // namespace WebCore diff --git a/WebCore/bindings/js/JSXSLTProcessorConstructor.cpp b/WebCore/bindings/js/JSXSLTProcessorConstructor.cpp index 07fec72..b2ebef3 100644 --- a/WebCore/bindings/js/JSXSLTProcessorConstructor.cpp +++ b/WebCore/bindings/js/JSXSLTProcessorConstructor.cpp @@ -47,10 +47,10 @@ JSXSLTProcessorConstructor::JSXSLTProcessorConstructor(ExecState* exec, JSDOMGlo putDirect(exec->propertyNames().prototype, JSXSLTProcessorPrototype::self(exec, globalObject), None); } -static JSObject* constructXSLTProcessor(ExecState* exec, JSObject* constructor, const ArgList&) +static EncodedJSValue JSC_HOST_CALL constructXSLTProcessor(ExecState* exec) { - JSXSLTProcessorConstructor* jsConstructor = static_cast<JSXSLTProcessorConstructor*>(constructor); - return CREATE_DOM_OBJECT_WRAPPER(exec, jsConstructor->globalObject(), XSLTProcessor, XSLTProcessor::create().get()); + JSXSLTProcessorConstructor* jsConstructor = static_cast<JSXSLTProcessorConstructor*>(exec->callee()); + return JSValue::encode(CREATE_DOM_OBJECT_WRAPPER(exec, jsConstructor->globalObject(), XSLTProcessor, XSLTProcessor::create().get())); } ConstructType JSXSLTProcessorConstructor::getConstructData(ConstructData& constructData) diff --git a/WebCore/bindings/js/ScheduledAction.cpp b/WebCore/bindings/js/ScheduledAction.cpp index 5a45e87..f69f8bd 100644 --- a/WebCore/bindings/js/ScheduledAction.cpp +++ b/WebCore/bindings/js/ScheduledAction.cpp @@ -51,7 +51,7 @@ PassOwnPtr<ScheduledAction> ScheduledAction::create(ExecState* exec, DOMWrapperW { JSValue v = exec->argument(0); CallData callData; - if (v.getCallData(callData) == CallTypeNone) { + if (getCallData(v, callData) == CallTypeNone) { UString string = v.toString(exec); if (exec->hadException()) return 0; @@ -91,7 +91,7 @@ void ScheduledAction::executeFunctionInContext(JSGlobalObject* globalObject, JSV JSLock lock(SilenceAssertionsOnly); CallData callData; - CallType callType = m_function.get().getCallData(callData); + CallType callType = getCallData(m_function.get(), callData); if (callType == CallTypeNone) return; diff --git a/WebCore/bindings/js/ScriptController.cpp b/WebCore/bindings/js/ScriptController.cpp index 3dcbb0b..5c4bd4c 100644 --- a/WebCore/bindings/js/ScriptController.cpp +++ b/WebCore/bindings/js/ScriptController.cpp @@ -87,6 +87,11 @@ ScriptController::~ScriptController() { disconnectPlatformScriptObjects(); + if (m_cacheableBindingRootObject) { + m_cacheableBindingRootObject->invalidate(); + m_cacheableBindingRootObject = 0; + } + // It's likely that destroying m_windowShells will create a lot of garbage. if (!m_windowShells.isEmpty()) { while (!m_windowShells.isEmpty()) @@ -329,6 +334,18 @@ void ScriptController::updateSecurityOrigin() // Our bindings do not do anything in this case. } +Bindings::RootObject* ScriptController::cacheableBindingRootObject() +{ + if (!canExecuteScripts(NotAboutToExecuteScript)) + return 0; + + if (!m_cacheableBindingRootObject) { + JSLock lock(SilenceAssertionsOnly); + m_cacheableBindingRootObject = Bindings::RootObject::create(0, globalObject(pluginWorld())); + } + return m_cacheableBindingRootObject.get(); +} + Bindings::RootObject* ScriptController::bindingRootObject() { if (!canExecuteScripts(NotAboutToExecuteScript)) diff --git a/WebCore/bindings/js/ScriptController.h b/WebCore/bindings/js/ScriptController.h index 16fe4f2..ee7cc7d 100644 --- a/WebCore/bindings/js/ScriptController.h +++ b/WebCore/bindings/js/ScriptController.h @@ -158,6 +158,7 @@ public: PassScriptInstance createScriptInstanceForWidget(Widget*); JSC::Bindings::RootObject* bindingRootObject(); + JSC::Bindings::RootObject* cacheableBindingRootObject(); PassRefPtr<JSC::Bindings::RootObject> createRootObject(void* nativeHandle); @@ -195,8 +196,13 @@ private: bool m_paused; bool m_allowPopupsFromPlugin; - // The root object used for objects bound outside the context of a plugin. + // The root object used for objects bound outside the context of a plugin, such + // as NPAPI plugins. The plugins using these objects prevent a page from being cached so they + // are safe to invalidate() when WebKit navigates away from the page that contains them. RefPtr<JSC::Bindings::RootObject> m_bindingRootObject; + // Unlike m_bindingRootObject these objects are used in pages that are cached, so they are not invalidate()'d. + // This ensures they are still available when the page is restored. + RefPtr<JSC::Bindings::RootObject> m_cacheableBindingRootObject; RootObjectMap m_rootObjects; #if ENABLE(NETSCAPE_PLUGIN_API) NPObject* m_windowScriptNPObject; diff --git a/WebCore/bindings/js/ScriptDebugServer.cpp b/WebCore/bindings/js/ScriptDebugServer.cpp index 94d7e73..eb0923b 100644 --- a/WebCore/bindings/js/ScriptDebugServer.cpp +++ b/WebCore/bindings/js/ScriptDebugServer.cpp @@ -126,13 +126,15 @@ void ScriptDebugServer::pageCreated(Page* page) page->setDebugger(this); } +bool ScriptDebugServer::isDebuggerAlwaysEnabled() +{ + return false; +} + bool ScriptDebugServer::hasListenersInterestedInPage(Page* page) { ASSERT_ARG(page, page); - if (hasGlobalListeners()) - return true; - return m_pageListenersMap.contains(page); } @@ -238,6 +240,12 @@ void ScriptDebugServer::stepOutOfFunction() m_doneProcessingDebuggerEvents = true; } +bool ScriptDebugServer::editScriptSource(const String&, const String&, String&) +{ + // FIXME(40300): implement this. + return false; +} + JavaScriptCallFrame* ScriptDebugServer::currentCallFrame() { if (!m_paused) @@ -257,7 +265,7 @@ void ScriptDebugServer::dispatchDidContinue(ScriptDebugListener* listener) listener->didContinue(); } -void ScriptDebugServer::dispatchDidParseSource(const ListenerSet& listeners, const JSC::SourceCode& source) +void ScriptDebugServer::dispatchDidParseSource(const ListenerSet& listeners, const JSC::SourceCode& source, ScriptWorldType worldType) { String sourceID = ustringToString(JSC::UString::from(source.provider()->asID())); String url = ustringToString(source.provider()->url()); @@ -267,7 +275,7 @@ void ScriptDebugServer::dispatchDidParseSource(const ListenerSet& listeners, con Vector<ScriptDebugListener*> copy; copyToVector(listeners, copy); for (size_t i = 0; i < copy.size(); ++i) - copy[i]->didParseSource(sourceID, url, data, firstLine); + copy[i]->didParseSource(sourceID, url, data, firstLine, worldType); } void ScriptDebugServer::dispatchFailedToParseSource(const ListenerSet& listeners, const SourceCode& source, int errorLine, const String& errorMessage) @@ -291,6 +299,13 @@ static Page* toPage(JSGlobalObject* globalObject) return frame ? frame->page() : 0; } +static ScriptWorldType currentWorldType(ExecState* exec) +{ + if (currentWorld(exec) == mainThreadNormalWorld()) + return MAIN_WORLD; + return EXTENSIONS_WORLD; +} + void ScriptDebugServer::detach(JSGlobalObject* globalObject) { // If we're detaching from the currently executing global object, manually tear down our @@ -313,23 +328,18 @@ void ScriptDebugServer::sourceParsed(ExecState* exec, const SourceCode& source, if (!page) return; + ScriptWorldType worldType = currentWorldType(exec); + m_callingListeners = true; bool isError = errorLine != -1; - if (hasGlobalListeners()) { - if (isError) - dispatchFailedToParseSource(m_listeners, source, errorLine, ustringToString(errorMessage)); - else - dispatchDidParseSource(m_listeners, source); - } - if (ListenerSet* pageListeners = m_pageListenersMap.get(page)) { ASSERT(!pageListeners->isEmpty()); if (isError) dispatchFailedToParseSource(*pageListeners, source, errorLine, ustringToString(errorMessage)); else - dispatchDidParseSource(*pageListeners, source); + dispatchDidParseSource(*pageListeners, source, worldType); } m_callingListeners = false; @@ -352,8 +362,6 @@ void ScriptDebugServer::dispatchFunctionToListeners(JavaScriptExecutionCallback ASSERT(hasListeners()); - dispatchFunctionToListeners(m_listeners, callback); - if (ListenerSet* pageListeners = m_pageListenersMap.get(page)) { ASSERT(!pageListeners->isEmpty()); dispatchFunctionToListeners(*pageListeners, callback); @@ -574,7 +582,7 @@ void ScriptDebugServer::didAddListener(Page* page) void ScriptDebugServer::didRemoveListener(Page* page) { - if (hasGlobalListeners() || (page && hasListenersInterestedInPage(page))) + if (page && hasListenersInterestedInPage(page)) return; recompileAllJSFunctionsSoon(); diff --git a/WebCore/bindings/js/ScriptDebugServer.h b/WebCore/bindings/js/ScriptDebugServer.h index cfada27..a45fae4 100644 --- a/WebCore/bindings/js/ScriptDebugServer.h +++ b/WebCore/bindings/js/ScriptDebugServer.h @@ -32,6 +32,7 @@ #if ENABLE(JAVASCRIPT_DEBUGGER) +#include "ScriptDebugListener.h" #include "PlatformString.h" #include "ScriptBreakpoint.h" #include "Timer.h" @@ -81,6 +82,8 @@ public: void stepOverStatement(); void stepOutOfFunction(); + bool editScriptSource(const String& sourceID, const String& newContent, String& newSourceOrErrorMessage); + void recompileAllJSFunctionsSoon(); void recompileAllJSFunctions(Timer<ScriptDebugServer>* = 0); @@ -88,6 +91,8 @@ public: void pageCreated(Page*); + bool isDebuggerAlwaysEnabled(); + private: typedef HashSet<ScriptDebugListener*> ListenerSet; typedef void (ScriptDebugServer::*JavaScriptExecutionCallback)(ScriptDebugListener*); @@ -96,8 +101,7 @@ private: ~ScriptDebugServer(); bool hasBreakpoint(intptr_t sourceID, unsigned lineNumber) const; - bool hasListeners() const { return !m_listeners.isEmpty() || !m_pageListenersMap.isEmpty(); } - bool hasGlobalListeners() const { return !m_listeners.isEmpty(); } + bool hasListeners() const { return !m_pageListenersMap.isEmpty(); } bool hasListenersInterestedInPage(Page*); void setJavaScriptPaused(const PageGroup&, bool paused); @@ -109,7 +113,7 @@ private: void dispatchFunctionToListeners(const ListenerSet& listeners, JavaScriptExecutionCallback callback); void dispatchDidPause(ScriptDebugListener*); void dispatchDidContinue(ScriptDebugListener*); - void dispatchDidParseSource(const ListenerSet& listeners, const JSC::SourceCode& source); + void dispatchDidParseSource(const ListenerSet& listeners, const JSC::SourceCode& source, enum ScriptWorldType); void dispatchFailedToParseSource(const ListenerSet& listeners, const JSC::SourceCode& source, int errorLine, const String& errorMessage); void pauseIfNeeded(Page*); @@ -133,7 +137,6 @@ private: typedef HashMap<intptr_t, SourceBreakpoints> BreakpointsMap; PageListenersMap m_pageListenersMap; - ListenerSet m_listeners; bool m_callingListeners; PauseOnExceptionsState m_pauseOnExceptionsState; bool m_pauseOnNextStatement; diff --git a/WebCore/bindings/js/ScriptFunctionCall.cpp b/WebCore/bindings/js/ScriptFunctionCall.cpp index 3784457..9baf809 100644 --- a/WebCore/bindings/js/ScriptFunctionCall.cpp +++ b/WebCore/bindings/js/ScriptFunctionCall.cpp @@ -143,7 +143,7 @@ ScriptValue ScriptFunctionCall::call(bool& hadException, bool reportExceptions) } CallData callData; - CallType callType = function.getCallData(callData); + CallType callType = getCallData(function, callData); if (callType == CallTypeNone) return ScriptValue(); diff --git a/WebCore/bindings/js/SerializedScriptValue.cpp b/WebCore/bindings/js/SerializedScriptValue.cpp index e761480..90f8d7c 100644 --- a/WebCore/bindings/js/SerializedScriptValue.cpp +++ b/WebCore/bindings/js/SerializedScriptValue.cpp @@ -36,6 +36,7 @@ #include "JSImageData.h" #include <JavaScriptCore/APICast.h> #include <runtime/DateInstance.h> +#include <runtime/Error.h> #include <runtime/ExceptionHelpers.h> #include <runtime/JSLock.h> #include <runtime/PropertyNameArray.h> @@ -454,12 +455,12 @@ struct BaseWalker { void throwStackOverflow() { - m_exec->setException(createStackOverflowError(m_exec)); + throwError(m_exec, createStackOverflowError(m_exec)); } void throwInterruptedException() { - m_exec->setException(createInterruptedExecutionException(&m_exec->globalData())); + throwError(m_exec, createInterruptedExecutionException(&m_exec->globalData())); } }; @@ -575,7 +576,7 @@ struct SerializingTreeWalker : public BaseWalker { return SerializedScriptValueData(toImageData(obj)); CallData unusedData; - if (value.getCallData(unusedData) == CallTypeNone) + if (getCallData(value, unusedData) == CallTypeNone) return SerializedScriptValueData(); } // Any other types are expected to serialize as null. @@ -602,7 +603,7 @@ struct SerializingTreeWalker : public BaseWalker { { // Cycle detection if (!m_cycleDetector.add(inArray).second) { - m_exec->setException(createTypeError(m_exec, "Cannot post cyclic structures.")); + throwError(m_exec, createTypeError(m_exec, "Cannot post cyclic structures.")); return false; } m_gcBuffer.append(inArray); @@ -619,7 +620,7 @@ struct SerializingTreeWalker : public BaseWalker { { // Cycle detection if (!m_cycleDetector.add(inObject).second) { - m_exec->setException(createTypeError(m_exec, "Cannot post cyclic structures.")); + throwError(m_exec, createTypeError(m_exec, "Cannot post cyclic structures.")); return false; } m_gcBuffer.append(inObject); diff --git a/WebCore/bindings/js/WorkerScriptController.cpp b/WebCore/bindings/js/WorkerScriptController.cpp index 1d45dfa..6ff8a69 100644 --- a/WebCore/bindings/js/WorkerScriptController.cpp +++ b/WebCore/bindings/js/WorkerScriptController.cpp @@ -41,6 +41,7 @@ #include <interpreter/Interpreter.h> #include <runtime/Completion.h> #include <runtime/Completion.h> +#include <runtime/Error.h> #include <runtime/JSLock.h> using namespace JSC; @@ -137,7 +138,7 @@ ScriptValue WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, void WorkerScriptController::setException(ScriptValue exception) { - m_workerContextWrapper->globalExec()->setException(exception.jsValue()); + throwError(m_workerContextWrapper->globalExec(), exception.jsValue()); } void WorkerScriptController::forbidExecution(ForbidExecutionOption option) diff --git a/WebCore/bindings/objc/WebScriptObject.mm b/WebCore/bindings/objc/WebScriptObject.mm index 794fc69..3f224f1 100644 --- a/WebCore/bindings/objc/WebScriptObject.mm +++ b/WebCore/bindings/objc/WebScriptObject.mm @@ -294,7 +294,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root JSValue function = [self _imp]->get(exec, Identifier(exec, stringToUString(String(name)))); CallData callData; - CallType callType = function.getCallData(callData); + CallType callType = getCallData(function, callData); if (callType == CallTypeNone) return nil; diff --git a/WebCore/bindings/scripts/CodeGenerator.pm b/WebCore/bindings/scripts/CodeGenerator.pm index b8f23dd..7c0f427 100644 --- a/WebCore/bindings/scripts/CodeGenerator.pm +++ b/WebCore/bindings/scripts/CodeGenerator.pm @@ -24,6 +24,8 @@ package CodeGenerator; +use strict; + use File::Find; my $useDocument = ""; @@ -272,7 +274,7 @@ sub ParseInterface return $interface if $interface->name eq $interfaceName; } - die("Could NOT find interface definition for $interface in $filename"); + die("Could NOT find interface definition for $interfaceName in $filename"); } # Helpers for all CodeGenerator***.pm modules diff --git a/WebCore/bindings/scripts/CodeGeneratorCPP.pm b/WebCore/bindings/scripts/CodeGeneratorCPP.pm new file mode 100644 index 0000000..f441b0e --- /dev/null +++ b/WebCore/bindings/scripts/CodeGeneratorCPP.pm @@ -0,0 +1,975 @@ + +# Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> +# Copyright (C) 2006 Anders Carlsson <andersca@mac.com> +# Copyright (C) 2006, 2007 Samuel Weinig <sam@webkit.org> +# Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> +# Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. +# Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> +# Copyright (C) Research In Motion Limited 2010. 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 +# 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 CodeGeneratorCPP; + +use File::stat; + +# Global Variables +my $module = ""; +my $outputDir = ""; + +my @headerContentHeader = (); +my @headerContent = (); +my %headerForwardDeclarations = (); + +my @implContentHeader = (); +my @implContent = (); +my %implIncludes = (); + +# Constants +my $exceptionInit = "WebCore::ExceptionCode ec = 0;"; +my $exceptionRaiseOnError = "webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec));"; + +# Default License Templates +my $headerLicenseTemplate = << "EOF"; +/* + * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig\@gmail.com> + * Copyright (C) Research In Motion Limited 2010. 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. + */ +EOF + +my $implementationLicenseTemplate = << "EOF"; +/* + * This file is part of the WebKit open source project. + * This file has been generated by generate-bindings.pl. DO NOT MODIFY! + * + * 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. + */ +EOF + +# Default constructor +sub new +{ + my $object = shift; + my $reference = { }; + + $codeGenerator = shift; + $outputDir = shift; + shift; # $useLayerOnTop + shift; # $preprocessor + shift; # $writeDependencies + + bless($reference, $object); + return $reference; +} + +sub finish +{ + my $object = shift; +} + +# Params: 'domClass' struct +sub GenerateInterface +{ + my $object = shift; + my $dataNode = shift; + my $defines = shift; + + my $name = $dataNode->name; + my $className = GetClassName($name); + my $parentClassName = "WebDOM" . GetParentImplClassName($dataNode); + + # Start actual generation. + $object->GenerateHeader($dataNode); + $object->GenerateImplementation($dataNode); + + # Write changes. + $object->WriteData("WebDOM" . $name); +} + +# Params: 'idlDocument' struct +sub GenerateModule +{ + my $object = shift; + my $dataNode = shift; + + $module = $dataNode->module; +} + +sub GetClassName +{ + my $name = $codeGenerator->StripModule(shift); + + # special cases + return "WebDOMString" if $codeGenerator->IsStringType($name) or $name eq "SerializedScriptValue"; + return "WebDOMAbstractView" if $name eq "DOMWindow"; + return "WebDOMObject" if $name eq "DOMObject"; + return "bool" if $name eq "boolean"; + return $name if $codeGenerator->IsPrimitiveType($name); + + return "WebDOM$name"; +} + +sub GetImplClassName +{ + my $name = $codeGenerator->StripModule(shift); + + return "DOMWindow" if $name eq "AbstractView"; + return $name; +} + +sub GetParentImplClassName +{ + my $dataNode = shift; + + if (@{$dataNode->parents} eq 0) { + return "EventTarget" if $dataNode->extendedAttributes->{"EventTarget"}; + return "Object"; + } + + return $codeGenerator->StripModule($dataNode->parents(0)); +} + +sub GetParent +{ + my $dataNode = shift; + my $numParents = @{$dataNode->parents}; + + my $parent = ""; + if ($numParents eq 0) { + $parent = "WebDOMObject"; + $parent = "WebDOMEventTarget" if $dataNode->extendedAttributes->{"EventTarget"}; + } elsif ($numParents eq 1) { + my $parentName = $codeGenerator->StripModule($dataNode->parents(0)); + $parent = "WebDOM" . $parentName; + } else { + my @parents = @{$dataNode->parents}; + my $firstParent = $codeGenerator->StripModule(shift(@parents)); + $parent = "WebDOM" . $firstParent; + } + + return $parent; +} + +sub ShouldSkipTypeInImplementation +{ + my $typeInfo = shift; + + return 1 if $typeInfo->signature->extendedAttributes->{"Custom"} + and !$typeInfo->signature->extendedAttributes->{"NoCPPCustom"}; + + return 1 if $typeInfo->signature->extendedAttributes->{"CustomArgumentHandling"} + or $typeInfo->signature->extendedAttributes->{"CustomGetter"} + or $typeInfo->signature->extendedAttributes->{"NeedsUserGestureCheck"}; + + # FIXME: We don't generate bindings for SVG related interfaces yet + return 1 if $typeInfo->signature->name =~ /getSVGDocument/; + + return 1 if $typeInfo->signature->name =~ /Constructor/; + return 0; +} + +sub ShouldSkipTypeInHeader +{ + my $typeInfo = shift; + + # FIXME: We currently ignore any attribute/function needing custom code + return 1 if $typeInfo->signature->extendedAttributes->{"CustomArgumentHandling"} + or $typeInfo->signature->extendedAttributes->{"CustomGetter"}; + + # FIXME: We don't generate bindings for SVG related interfaces yet + return 1 if $typeInfo->signature->name =~ /getSVGDocument/; + + return 1 if $typeInfo->signature->name =~ /Constructor/; + return 0; +} + +sub GetCPPType +{ + my $type = shift; + my $useConstReference = shift; + my $name = GetClassName($type); + + return "int" if $type eq "long"; + return "unsigned" if $name eq "unsigned long"; + return "unsigned short" if $type eq "CompareHow"; + + if ($codeGenerator->IsStringType($type)) { + if ($useConstReference) { + return "const $name&"; + } + + return $name; + } + + return $name if $codeGenerator->IsPrimitiveType($type) or $type eq "DOMTimeStamp"; + return "const $name&" if $useConstReference; + return $name; +} + +sub ConversionNeeded +{ + my $type = $codeGenerator->StripModule(shift); + return !$codeGenerator->IsNonPointerType($type) && !$codeGenerator->IsStringType($type); +} + +sub GetCPPTypeGetter +{ + my $argName = shift; + my $type = $codeGenerator->StripModule(shift); + + return $argName if $codeGenerator->IsPrimitiveType($type) or $codeGenerator->IsStringType($type); + return "static_cast<WebCore::Range::CompareHow>($argName)" if $type eq "CompareHow"; + return "WebCore::SerializedScriptValue::create(WebCore::String($argName))" if $type eq "SerializedScriptValue"; + return "toWebCore($argName)"; +} + +sub AddForwardDeclarationsForType +{ + my $type = $codeGenerator->StripModule(shift); + my $public = shift; + + return if $codeGenerator->IsNonPointerType($type) or $codeGenerator->IsStringType($type); + + my $class = GetClassName($type); + $headerForwardDeclarations{$class} = 1 if $public; +} + +sub AddIncludesForType +{ + my $type = $codeGenerator->StripModule(shift); + + return if $codeGenerator->IsNonPointerType($type); + return if $type =~ /cconstructor/; + + if ($codeGenerator->IsStringType($type)) { + $implIncludes{"AtomicString.h"} = 1; + $implIncludes{"KURL.h"} = 1; + $implIncludes{"WebDOMString.h"} = 1; + return; + } + + if ($type eq "DOMObject") { + $implIncludes{"WebDOMObject.h"} = 1; + return; + } + + if ($type eq "DOMWindow") { + $implIncludes{"DOMWindow.h"} = 1; + $implIncludes{"WebDOMAbstractView.h"} = 1; + return; + } + + if ($type eq "EventListener") { + $implIncludes{"WebNativeEventListener.h"} = 1; + return; + } + + if ($type eq "SerializedScriptValue") { + $implIncludes{"SerializedScriptValue.h"} = 1; + return; + } + + $implIncludes{"Node.h"} = 1 if $type eq "NodeList"; + $implIncludes{"CSSMutableStyleDeclaration.h"} = 1 if $type eq "CSSStyleDeclaration"; + + # Default, include the same named file (the implementation) and the same name prefixed with "WebDOM". + $implIncludes{"$type.h"} = 1 unless $type eq "DOMObject"; + $implIncludes{"WebDOM$type.h"} = 1; +} + +sub GenerateConditionalStringFromAttributeValue +{ + my $conditional = shift; + if ($conditional =~ /&/) { + return "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")"; + } elsif ($conditional =~ /\|/) { + return "ENABLE(" . join(") || ENABLE(", split(/\|/, $conditional)) . ")"; + } else { + return "ENABLE(" . $conditional . ")"; + } +} + +sub GenerateConditionalString +{ + my $node = shift; + my $conditional = $node->extendedAttributes->{"Conditional"}; + if ($conditional) { + return GenerateConditionalStringFromAttributeValue($conditional); + } else { + return ""; + } +} + +sub GenerateHeader +{ + my $object = shift; + my $dataNode = shift; + + my $interfaceName = $dataNode->name; + my $className = GetClassName($interfaceName); + my $implClassName = GetImplClassName($interfaceName); + my $implClassNameWithNamespace = "WebCore::" . $implClassName; + + my $parentName = ""; + $parentName = GetParent($dataNode); + + my $numConstants = @{$dataNode->constants}; + my $numAttributes = @{$dataNode->attributes}; + my $numFunctions = @{$dataNode->functions}; + + # - Add default header template + @headerContentHeader = split("\r", $headerLicenseTemplate); + push(@headerContentHeader, "\n#ifndef $className" . "_h"); + push(@headerContentHeader, "\n#define $className" . "_h\n\n"); + + my $conditionalString = GenerateConditionalString($dataNode); + push(@headerContentHeader, "#if ${conditionalString}\n\n") if $conditionalString; + + # - INCLUDES - + + my %headerIncludes = (); + $headerIncludes{"WebDOMString.h"} = 1; + $headerIncludes{"$parentName.h"} = 1; + foreach my $include (sort keys(%headerIncludes)) { + push(@headerContentHeader, "#include <$include>\n"); + } + + push(@headerContent, "class $className"); + push(@headerContent, " : public $parentName") if $parentName; + push(@headerContent, " {\n"); + push(@headerContent, "public:\n"); + + # Constructor + push(@headerContent, " $className();\n"); + push(@headerContent, " explicit $className($implClassNameWithNamespace*);\n"); + + # Copy constructor on classes which have the d-ptr + if (@{$dataNode->parents} eq 0) { + push(@headerContent, " $className(const $className&);\n"); + } + + # Destructor + if (@{$dataNode->parents} eq 0) { + push(@headerContent, " ~$className();\n"); + } + + push(@headerContent, "\n"); + $headerForwardDeclarations{$implClassNameWithNamespace} = 1; + + # - Add constants. + if ($numConstants > 0) { + my @headerConstants = (); + + # FIXME: we need a way to include multiple enums. + foreach my $constant (@{$dataNode->constants}) { + my $constantName = $constant->name; + my $constantValue = $constant->value; + + my $output = "WEBDOM_" . $constantName . " = " . $constantValue; + push(@headerConstants, " " . $output); + } + + my $combinedConstants = join(",\n", @headerConstants); + + push(@headerContent, " "); + push(@headerContent, "enum {\n"); + push(@headerContent, $combinedConstants); + push(@headerContent, "\n "); + push(@headerContent, "};\n\n"); + } + + my @headerAttributes = (); + + # - Add attribute getters/setters. + if ($numAttributes > 0) { + foreach my $attribute (@{$dataNode->attributes}) { + next if ShouldSkipTypeInHeader($attribute); + + my $attributeName = $attribute->signature->name; + my $attributeType = GetCPPType($attribute->signature->type, 0); + my $attributeIsReadonly = ($attribute->type =~ /^readonly/); + my $property = " " . $attributeType . ($attributeType =~ /\*$/ ? "" : " ") . $attributeName . "() const"; + + my $availabilityMacro = ""; + my $declarationSuffix = ";\n"; + + AddForwardDeclarationsForType($attribute->signature->type, 1); + + $attributeType = GetCPPType($attribute->signature->type, 1); + my $setterName = "set" . ucfirst($attributeName); + + $property .= $declarationSuffix; + push(@headerAttributes, $property); + if (!$attributeIsReadonly and !$attribute->signature->extendedAttributes->{"Replaceable"}) { + $property = " void $setterName($attributeType)"; + $property .= $declarationSuffix; + push(@headerAttributes, $property); + } + } + + push(@headerContent, @headerAttributes) if @headerAttributes > 0; + } + + my @headerFunctions = (); + my @deprecatedHeaderFunctions = (); + my @interfaceFunctions = (); + + # - Add functions. + if ($numFunctions > 0) { + foreach my $function (@{$dataNode->functions}) { + next if ShouldSkipTypeInHeader($function); + my $functionName = $function->signature->name; + + my $returnType = GetCPPType($function->signature->type, 0); + my $numberOfParameters = @{$function->parameters}; + my %typesToForwardDeclare = ($function->signature->type => 1); + + my $parameterIndex = 0; + my $functionSig = "$returnType $functionName("; + my $methodName = $functionName; + foreach my $param (@{$function->parameters}) { + my $paramName = $param->name; + my $paramType = GetCPPType($param->type, 1); + $typesToForwardDeclare{$param->type} = 1; + + $functionSig .= ", " if $parameterIndex >= 1; + $functionSig .= "$paramType $paramName"; + $parameterIndex++; + } + $functionSig .= ")"; + if ($dataNode->extendedAttributes->{"PureInterface"}) { + push(@interfaceFunctions, " virtual " . $functionSig . " = 0;\n"); + } + my $functionDeclaration = $functionSig; + $functionDeclaration .= ";\n"; + + foreach my $type (keys %typesToForwardDeclare) { + # add any forward declarations to the public header if a deprecated version will be generated + AddForwardDeclarationsForType($type, 1); + } + + push(@headerFunctions, " "); + push(@headerFunctions, $functionDeclaration); + } + + if (@headerFunctions > 0) { + push(@headerContent, "\n") if @headerAttributes > 0; + push(@headerContent, @headerFunctions); + } + } + + push(@headerContent, "\n"); + push(@headerContent, " $implClassNameWithNamespace* impl() const;\n"); + + if (@{$dataNode->parents} eq 0) { + push(@headerContent, "\nprotected:\n"); + push(@headerContent, " struct ${className}Private;\n"); + push(@headerContent, " ${className}Private* m_impl;\n"); + } + + push(@headerContent, "};\n\n"); + + # for PureInterface classes also add the interface that the client code needs to + # implement + if ($dataNode->extendedAttributes->{"PureInterface"}) { + push(@headerContent, "class WebUser$interfaceName {\n"); + push(@headerContent, "public:\n"); + push(@headerContent, " virtual void ref() = 0;\n"); + push(@headerContent, " virtual void deref() = 0;\n\n"); + push(@headerContent, @interfaceFunctions); + push(@headerContent, "\nprotected:\n"); + push(@headerContent, " virtual ~WebUser$interfaceName() {}\n"); + push(@headerContent, "};\n\n"); + } + + push(@headerContent, "WebCore::$implClassName* toWebCore(const $className&);\n"); + push(@headerContent, "$className toWebKit(WebCore::$implClassName*);\n"); + if ($dataNode->extendedAttributes->{"PureInterface"}) { + push(@headerContent, "$className toWebKit(WebUser$interfaceName*);\n"); + } + push(@headerContent, "\n#endif\n"); + push(@headerContent, "#endif // ${conditionalString}\n\n") if $conditionalString; +} + +sub AddEarlyReturnStatement +{ + my $returnType = shift; + + if (!defined($returnType) or $returnType eq "void") { + $returnType = ""; + } elsif ($codeGenerator->IsPrimitiveType($returnType)) { + $returnType = " 0"; + } elsif ($returnType eq "bool") { + $returnType = " false"; + } else { + $returnType = " $returnType()"; + } + + # TODO: We could set exceptions here, if we want that + my $statement = " if (!impl())\n"; + $statement .= " return$returnType;\n\n"; + return $statement; +} + +sub AddReturnStatement +{ + my $typeInfo = shift; + my $returnValue = shift; + + # Used to invoke KURLs "const String&" operator + if ($codeGenerator->IsStringType($typeInfo->signature->type)) { + return " return static_cast<const WebCore::String&>($returnValue);\n"; + } + + return " return $returnValue;\n"; +} + +sub GenerateImplementation +{ + my $object = shift; + my $dataNode = shift; + + my @ancestorInterfaceNames = (); + + if (@{$dataNode->parents} > 1) { + $codeGenerator->AddMethodsConstantsAndAttributesFromParentClasses($dataNode, \@ancestorInterfaceNames); + } + + my $interfaceName = $dataNode->name; + my $className = GetClassName($interfaceName); + my $implClassName = GetImplClassName($interfaceName); + my $parentImplClassName = GetParentImplClassName($dataNode); + my $implClassNameWithNamespace = "WebCore::" . $implClassName; + my $baseClass = "WebDOM$parentImplClassName"; + my $conditional = $dataNode->extendedAttributes->{"Conditional"}; + + my $numAttributes = @{$dataNode->attributes}; + my $numFunctions = @{$dataNode->functions}; + + # - Add default header template. + @implContentHeader = split("\r", $implementationLicenseTemplate); + + # - INCLUDES - + push(@implContentHeader, "\n#include \"config.h\"\n"); + my $conditionalString = GenerateConditionalString($dataNode); + push(@implContentHeader, "\n#if ${conditionalString}\n\n") if $conditionalString; + push(@implContentHeader, "#include \"$className.h\"\n\n"); + + $implIncludes{"WebExceptionHandler.h"} = 1; + $implIncludes{"$implClassName.h"} = 1; + @implContent = (); + + push(@implContent, "#include <wtf/GetPtr.h>\n"); + push(@implContent, "#include <wtf/RefPtr.h>\n\n"); + + # Private datastructure, encapsulating WebCore types + if (@{$dataNode->parents} eq 0) { + push(@implContent, "struct ${className}::${className}Private {\n"); + push(@implContent, " ${className}Private($implClassNameWithNamespace* object = 0)\n"); + push(@implContent, " : impl(object)\n"); + push(@implContent, " {\n"); + push(@implContent, " }\n\n"); + push(@implContent, " RefPtr<$implClassNameWithNamespace> impl;\n"); + push(@implContent, "};\n\n"); + } + + # Constructor + push(@implContent, "${className}::$className()\n"); + push(@implContent, " : ${baseClass}()\n"); + push(@implContent, " , m_impl(0)\n") if (@{$dataNode->parents} eq 0); + push(@implContent, "{\n"); + push(@implContent, "}\n\n"); + + push(@implContent, "${className}::$className($implClassNameWithNamespace* impl)\n"); + if (@{$dataNode->parents} eq 0) { + push(@implContent, " : ${baseClass}()\n"); + push(@implContent, " , m_impl(new ${className}Private(impl))\n"); + push(@implContent, "{\n"); + push(@implContent, "}\n\n"); + + push(@implContent, "${className}::${className}(const ${className}& copy)\n"); + push(@implContent, " : ${baseClass}()\n"); + push(@implContent, "{\n"); + push(@implContent, " m_impl = copy.impl() ? new ${className}Private(copy.impl()) : 0;\n"); + push(@implContent, "}\n\n"); + + push(@implContent, "$implClassNameWithNamespace* ${className}::impl() const\n"); + push(@implContent, "{\n"); + push(@implContent, " return m_impl ? m_impl->impl.get() : 0;\n"); + push(@implContent, "}\n\n"); + + # Destructor + push(@implContent, "${className}::~$className()\n"); + push(@implContent, "{\n"); + push(@implContent, " delete m_impl;\n"); + push(@implContent, " m_impl = 0;\n"); + push(@implContent, "}\n\n"); + } else { + push(@implContent, " : ${baseClass}(impl)\n"); + push(@implContent, "{\n"); + push(@implContent, "}\n\n"); + + push(@implContent, "$implClassNameWithNamespace* ${className}::impl() const\n"); + push(@implContent, "{\n"); + push(@implContent, " return static_cast<$implClassNameWithNamespace*>(${baseClass}::impl());\n"); + push(@implContent, "}\n\n"); + } + + # START implementation + %attributeNames = (); + + # - Attributes + if ($numAttributes > 0) { + foreach my $attribute (@{$dataNode->attributes}) { + next if ShouldSkipTypeInImplementation($attribute); + AddIncludesForType($attribute->signature->type); + + my $idlType = $codeGenerator->StripModule($attribute->signature->type); + + my $attributeName = $attribute->signature->name; + my $attributeType = GetCPPType($attribute->signature->type, 0); + my $attributeIsReadonly = ($attribute->type =~ /^readonly/); + + $attributeNames{$attributeName} = 1; + + # - GETTER + my $getterSig = "$attributeType $className\:\:$attributeName() const\n"; + my $hasGetterException = @{$attribute->getterExceptions}; + my $getterContentHead; + my $reflect = $attribute->signature->extendedAttributes->{"Reflect"}; + my $reflectURL = $attribute->signature->extendedAttributes->{"ReflectURL"}; + if ($reflect || $reflectURL) { + my $contentAttributeName = (($reflect || $reflectURL) eq "1") ? $attributeName : ($reflect || $reflectURL); + my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); + $implIncludes{"${namespace}.h"} = 1; + my $getAttributeFunctionName = $reflectURL ? "getURLAttribute" : "getAttribute"; + $getterContentHead = "impl()->${getAttributeFunctionName}(WebCore::${namespace}::${contentAttributeName}Attr"; + } else { + $getterContentHead = "impl()->" . $codeGenerator->WK_lcfirst($attributeName) . "("; + } + my $getterContentTail = ")"; + + # Special cases + my @customGetterContent = (); + if ($attribute->signature->extendedAttributes->{"ConvertToString"}) { + $getterContentHead = "WebCore::String::number(" . $getterContentHead; + $getterContentTail .= ")"; + } elsif ($attribute->signature->extendedAttributes->{"ConvertFromString"}) { + $getterContentTail .= ".toInt()"; + } elsif ($attribute->signature->type eq "SerializedScriptValue") { + $getterContentHead = "$getterContentHead"; + $getterContentTail .= "->toString()"; + } elsif (ConversionNeeded($attribute->signature->type)) { + $getterContentHead = "toWebKit(WTF::getPtr($getterContentHead"; + $getterContentTail .= "))"; + } + + my $getterContent; + if ($hasGetterException) { + $getterContent = $getterContentHead . "ec" . $getterContentTail; + } else { + $getterContent = $getterContentHead . $getterContentTail; + } + + my $attributeConditionalString = GenerateConditionalString($attribute->signature); + push(@implContent, "#if ${attributeConditionalString}\n") if $attributeConditionalString; + + push(@implContent, $getterSig); + push(@implContent, "{\n"); + push(@implContent, AddEarlyReturnStatement($attributeType)); + push(@implContent, @customGetterContent); + if ($hasGetterException) { + # Differentiated between when the return type is a pointer and + # not for white space issue (ie. Foo *result vs. int result). + if ($attributeType =~ /\*$/) { + $getterContent = $attributeType . "result = " . $getterContent; + } else { + $getterContent = $attributeType . " result = " . $getterContent; + } + + push(@implContent, " $exceptionInit\n"); + push(@implContent, " $getterContent;\n"); + push(@implContent, " $exceptionRaiseOnError\n"); + push(@implContent, AddReturnStatement($attribute, "result")); + } else { + push(@implContent, AddReturnStatement($attribute, $getterContent)); + } + push(@implContent, "}\n\n"); + + # - SETTER + if (!$attributeIsReadonly and !$attribute->signature->extendedAttributes->{"Replaceable"}) { + # Exception handling + my $hasSetterException = @{$attribute->setterExceptions}; + + my $coreSetterName = "set" . $codeGenerator->WK_ucfirst($attributeName); + my $setterName = "set" . ucfirst($attributeName); + my $argName = "new" . ucfirst($attributeName); + my $arg = GetCPPTypeGetter($argName, $idlType); + + # The definition of ConvertFromString and ConvertToString is flipped for the setter + if ($attribute->signature->extendedAttributes->{"ConvertFromString"}) { + $arg = "WebCore::String::number($arg)"; + } elsif ($attribute->signature->extendedAttributes->{"ConvertToString"}) { + $arg = "WebCore::String($arg).toInt()"; + } + + my $attributeType = GetCPPType($attribute->signature->type, 1); + push(@implContent, "void $className\:\:$setterName($attributeType $argName)\n"); + push(@implContent, "{\n"); + push(@implContent, AddEarlyReturnStatement()); + + my $reflect = $attribute->signature->extendedAttributes->{"Reflect"}; + my $reflectURL = $attribute->signature->extendedAttributes->{"ReflectURL"}; + push(@implContent, " $exceptionInit\n") if $hasSetterException; + my $ec = $hasSetterException ? ", ec" : ""; + if ($reflect || $reflectURL) { + my $contentAttributeName = (($reflect || $reflectURL) eq "1") ? $attributeName : ($reflect || $reflectURL); + my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); + $implIncludes{"${namespace}.h"} = 1; + push(@implContent, " impl()->setAttribute(WebCore::${namespace}::${contentAttributeName}Attr, $arg$ec);\n"); + } else { + push(@implContent, " impl()->$coreSetterName($arg$ec);\n"); + } + push(@implContent, " $exceptionRaiseOnError\n") if $hasSetterException; + push(@implContent, "}\n\n"); + } + + push(@implContent, "#endif\n") if $attributeConditionalString; + } + } + + # - Functions + if ($numFunctions > 0) { + foreach my $function (@{$dataNode->functions}) { + # Treat PureInterface as Custom as well, since the WebCore versions will take a script context as well + next if ShouldSkipTypeInImplementation($function) || $dataNode->extendedAttributes->{"PureInterface"}; + AddIncludesForType($function->signature->type); + + my $functionName = $function->signature->name; + my $returnType = GetCPPType($function->signature->type, 0); + my $hasParameters = @{$function->parameters}; + my $raisesExceptions = @{$function->raisesExceptions}; + + my @parameterNames = (); + my @needsAssert = (); + my %needsCustom = (); + + my $parameterIndex = 0; + + # FIXME: Handle Callback support, we're just passing 0 as ScriptExecutionContext for now. + push(@parameterNames, "0") if ($dataNode->extendedAttributes->{"Callback"}); + + my $functionSig = "$returnType $className\:\:$functionName("; + foreach my $param (@{$function->parameters}) { + my $paramName = $param->name; + my $paramType = GetCPPType($param->type, 1); + + # make a new parameter name if the original conflicts with a property name + $paramName = "in" . ucfirst($paramName) if $attributeNames{$paramName}; + + AddIncludesForType($param->type); + + my $idlType = $codeGenerator->StripModule($param->type); + my $implGetter = GetCPPTypeGetter($paramName, $idlType); + + push(@parameterNames, $implGetter); + $needsCustom{"NodeToReturn"} = $paramName if $param->extendedAttributes->{"Return"}; + + unless ($codeGenerator->IsPrimitiveType($idlType) or $codeGenerator->IsStringType($idlType)) { + push(@needsAssert, " ASSERT($paramName);\n"); + } + + $functionSig .= ", " if $parameterIndex >= 1; + $functionSig .= "$paramType $paramName"; + $parameterIndex++; + } + + $functionSig .= ")"; + + my @functionContent = (); + push(@parameterNames, "ec") if $raisesExceptions; + my $content = "impl()->" . $codeGenerator->WK_lcfirst($functionName) . "(" . join(", ", @parameterNames) . ")"; + + if ($returnType eq "void") { + # Special case 'void' return type. + if ($raisesExceptions) { + push(@functionContent, " $exceptionInit\n"); + push(@functionContent, " $content;\n"); + push(@functionContent, " $exceptionRaiseOnError\n"); + } else { + push(@functionContent, " $content;\n"); + } + } elsif (defined $needsCustom{"NodeToReturn"}) { + # TODO: This is important to enable, once we care about custom code! + + # Special case the insertBefore, replaceChild, removeChild + # and appendChild functions from DOMNode + my $toReturn = $needsCustom{"NodeToReturn"}; + if ($raisesExceptions) { + push(@functionContent, " $exceptionInit\n"); + push(@functionContent, " if ($content)\n"); + push(@functionContent, " return $toReturn;\n"); + push(@functionContent, " $exceptionRaiseOnError\n"); + push(@functionContent, " return $className();\n"); + } else { + push(@functionContent, " if ($content)\n"); + push(@functionContent, " return $toReturn;\n"); + push(@functionContent, " return NULL;\n"); + } + } else { + if (ConversionNeeded($function->signature->type)) { + $content = "toWebKit(WTF::getPtr($content))"; + } + + if ($raisesExceptions) { + # Differentiated between when the return type is a pointer and + # not for white space issue (ie. Foo *result vs. int result). + if ($returnType =~ /\*$/) { + $content = $returnType . "result = " . $content; + } else { + $content = $returnType . " result = " . $content; + } + + push(@functionContent, " $exceptionInit\n"); + push(@functionContent, " $content;\n"); + push(@functionContent, " $exceptionRaiseOnError\n"); + push(@functionContent, " return result;\n"); + } else { + push(@functionContent, " return $content;\n"); + } + } + + push(@implContent, "$functionSig\n"); + push(@implContent, "{\n"); + push(@implContent, AddEarlyReturnStatement($returnType)); + push(@implContent, @functionContent); + push(@implContent, "}\n\n"); + + # Clear the hash + %needsCustom = (); + } + } + + # END implementation + + # Generate internal interfaces + push(@implContent, "WebCore::$implClassName* toWebCore(const $className& wrapper)\n"); + push(@implContent, "{\n"); + push(@implContent, " return wrapper.impl();\n"); + push(@implContent, "}\n\n"); + + push(@implContent, "$className toWebKit(WebCore::$implClassName* value)\n"); + push(@implContent, "{\n"); + push(@implContent, " return $className(value);\n"); + push(@implContent, "}\n"); + + # - End the ifdef conditional if necessary + push(@implContent, "\n#endif // ${conditionalString}\n") if $conditionalString; +} + +# Internal helper +sub WriteData +{ + my $object = shift; + my $name = shift; + + # Open files for writing... + my $headerFileName = "$outputDir/" . $name . ".h"; + my $implFileName = "$outputDir/" . $name . ".cpp"; + + # Remove old files. + unlink($headerFileName); + unlink($implFileName); + + # Write public header. + open(HEADER, ">$headerFileName") or die "Couldn't open file $headerFileName"; + + print HEADER @headerContentHeader; + print HEADER "\n"; + foreach my $class (sort keys(%headerForwardDeclarations)) { + if ($class =~ /::/) { + my $namespacePart = $class; + $namespacePart =~ s/::.*//; + + my $classPart = $class; + $classPart =~ s/${namespacePart}:://; + + print HEADER "namespace $namespacePart {\nclass $classPart;\n};\n\n"; + } else { + print HEADER "class $class;\n" + } + } + + my $hasForwardDeclarations = keys(%headerForwardDeclarations); + print HEADER "\n" if $hasForwardDeclarations; + print HEADER @headerContent; + close(HEADER); + + @headerContentHeader = (); + @headerContent = (); + %headerForwardDeclarations = (); + + # Write implementation file. + open(IMPL, ">$implFileName") or die "Couldn't open file $implFileName"; + + print IMPL @implContentHeader; + + foreach my $include (sort keys(%implIncludes)) { + # "className.h" is already included right after config.h, silence check-webkit-style + next if $include eq "$name.h"; + print IMPL "#include \"$include\"\n"; + } + + print IMPL @implContent; + close(IMPL); + + @implContentHeader = (); + @implContent = (); + %implIncludes = (); +} + +1; diff --git a/WebCore/bindings/scripts/CodeGeneratorGObject.pm b/WebCore/bindings/scripts/CodeGeneratorGObject.pm index b331f97..e98c661 100644 --- a/WebCore/bindings/scripts/CodeGeneratorGObject.pm +++ b/WebCore/bindings/scripts/CodeGeneratorGObject.pm @@ -362,7 +362,7 @@ sub GenerateProperty { } if (grep {$_ eq $attribute} @writeableProperties) { - push(@txtSetProps, " case ${propEnum}:\n {\n"); + push(@txtSetProps, " case ${propEnum}:\n {\n"); push(@txtSetProps, " WebCore::ExceptionCode ec = 0;\n") if @{$attribute->setterExceptions}; push(@txtSetProps, " ${setterContentHead}"); push(@txtSetProps, ", ec") if @{$attribute->setterExceptions}; @@ -370,7 +370,7 @@ sub GenerateProperty { push(@txtSetProps, " break;\n }\n"); } - push(@txtGetProps, " case ${propEnum}:\n {\n"); + push(@txtGetProps, " case ${propEnum}:\n {\n"); my $exception = ""; if (@{$attribute->getterExceptions}) { @@ -471,6 +471,16 @@ sub GenerateEventListener { my $object = shift; my $interfaceName = shift; + # This marks event listeners in some subclasses of Element. We + # cannot add them, otherwise we'll get runtime errors because of + # duplicated signal definitions between a class and some ancestor. + + # FIXME: it would be very good to be a lot more precise in how we + # do this... + if ($attribute->signature->extendedAttributes->{"WindowEventListener"}) { + return; + } + my $name = $attribute->signature->name; my $domSignalName = substr($name, 2); my $gobjectSignalName = EventSignalName($domSignalName); @@ -548,7 +558,7 @@ EOF if (scalar @writeableProperties > 0) { $txtSetProps = << "EOF"; - ${className} *self = WEBKIT_DOM_${clsCaps}(object); + ${className}* self = WEBKIT_DOM_${clsCaps}(object); $privFunction EOF push(@txtSetProps, $txtSetProps); @@ -587,6 +597,9 @@ EOF EOF push(@txtSetProps, $txtSetProps); + # Do not insert extra spaces when interpolating array variables + $" = ""; + $implContent = << "EOF"; static void ${lowerCaseIfaceName}_finalize(GObject* object) @@ -747,7 +760,7 @@ sub GenerateFunction { my $returnType = GetGlibTypeName($functionSigType); my $returnValueIsGDOMType = IsGDOMClassType($functionSigType); - my $functionSig = "$className *self"; + my $functionSig = "${className}* self"; my $callImplParams = ""; @@ -799,8 +812,8 @@ sub GenerateFunction { $functionSig .= ", GError **error"; } - push(@hBody, "WEBKIT_API $returnType\n$functionName ($functionSig);\n\n"); - push(@cBody, "$returnType\n$functionName ($functionSig)\n{\n"); + push(@hBody, "WEBKIT_API $returnType\n$functionName($functionSig);\n\n"); + push(@cBody, "$returnType\n$functionName($functionSig)\n{\n"); if ($conditionalMethods{$functionName}) { push(@cBody, "#if ENABLE($conditionalMethods{$functionName})\n"); @@ -969,7 +982,7 @@ EOF push(@cBody, "#endif\n"); } - push(@cBody, "\n}\n\n"); + push(@cBody, "}\n\n"); } sub ClassHasFunction { diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm index bffd046..c3521bf 100644 --- a/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -172,16 +172,16 @@ sub GenerateEventListenerCall push(@GenerateEventListenerImpl, <<END); JSValue correspondingElementWrapper = toJS(exec, imp->correspondingElement()); if (!correspondingElementWrapper.isObject()) - return jsUndefined(); + return JSValue::encode(jsUndefined()); END } push(@GenerateEventListenerImpl, <<END); JSValue listener = exec->argument(1); if (!listener.isObject()) - return jsUndefined(); + return JSValue::encode(jsUndefined()); imp->${functionName}EventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), $wrapperObject, false, currentWorld(exec))$passRefPtrHandling, exec->argument(2).toBoolean(exec)); - return jsUndefined(); + return JSValue::encode(jsUndefined()); END return @GenerateEventListenerImpl; } @@ -984,12 +984,18 @@ sub GenerateHeader push(@headerContent, "};\n\n"); + # Conditionally emit the constructor object's declaration + if ($dataNode->extendedAttributes->{"CustomConstructFunction"}) { + GenerateConstructorDeclaration(\@headerContent, $className, $dataNode); + } + + if ($numFunctions > 0) { push(@headerContent,"// Functions\n\n"); foreach my $function (@{$dataNode->functions}) { next if $function->{overloadIndex} && $function->{overloadIndex} > 1; my $functionName = $codeGenerator->WK_lcfirst($className) . "PrototypeFunction" . $codeGenerator->WK_ucfirst($function->signature->name); - push(@headerContent, "JSC::JSValue JSC_HOST_CALL ${functionName}(JSC::ExecState*);\n"); + push(@headerContent, "JSC::EncodedJSValue JSC_HOST_CALL ${functionName}(JSC::ExecState*);\n"); } } @@ -1115,7 +1121,7 @@ sub GenerateParametersCheckExpression # these are acceptable values for a DOMString argument (any Object can # be converted to a string via .toString). push(@andExpression, "(${value}.isNull() || ${value}.isUndefined() || ${value}.isString() || ${value}.isObject())") if $codeGenerator->IsStringType($type); - push(@andExpression, "(${value}.isNull() || asObject(${value})->inherits(JS${type}::s_info)") unless IsNativeType($type); + push(@andExpression, "(${value}.isNull() || ${value}.isObject() && asObject(${value})->inherits(&JS${type}::s_info))") unless IsNativeType($type); $parameterIndex++; } @@ -1154,7 +1160,7 @@ sub GenerateOverloadedPrototypeFunction my $functionName = "js${implClassName}PrototypeFunction" . $codeGenerator->WK_ucfirst($function->signature->name); - push(@implContent, "JSValue JSC_HOST_CALL ${functionName}(ExecState* exec)\n"); + push(@implContent, "EncodedJSValue JSC_HOST_CALL ${functionName}(ExecState* exec)\n"); push(@implContent, <<END); { END @@ -1164,7 +1170,7 @@ END push(@implContent, " return ${functionName}$overload->{overloadIndex}(exec);\n"); } push(@implContent, <<END); - return throwError(exec, TypeError); + return JSValue::encode(throwTypeError(exec)); } END @@ -1231,10 +1237,10 @@ sub GenerateImplementation \@hashKeys, \@hashSpecials, \@hashValue1, \@hashValue2); - my $protoClassName; - $protoClassName = "${className}Prototype"; + my $protoClassName = "${className}Prototype"; - push(@implContent, constructorFor($className, $protoClassName, $interfaceName, $visibleClassName, $dataNode)); + GenerateConstructorDeclaration(\@implContent, $className, $dataNode) unless $dataNode->extendedAttributes->{"CustomConstructFunction"}; + GenerateConstructorDefinition(\@implContent, $className, $protoClassName, $interfaceName, $visibleClassName, $dataNode); } # - Add functions and constants to a hashtable definition @@ -1786,11 +1792,14 @@ sub GenerateImplementation if ($function->{overloads} && @{$function->{overloads}} > 1) { # Append a number to an overloaded method's name to make it unique: $functionName = $functionName . $function->{overloadIndex}; + # Make this function static to avoid compiler warnings, since we + # don't generate a prototype for it in the header. + push(@implContent, "static "); } my $functionImplementationName = $function->signature->extendedAttributes->{"ImplementationFunction"} || $codeGenerator->WK_lcfirst($function->signature->name); - push(@implContent, "JSValue JSC_HOST_CALL ${functionName}(ExecState* exec)\n"); + push(@implContent, "EncodedJSValue JSC_HOST_CALL ${functionName}(ExecState* exec)\n"); push(@implContent, "{\n"); $implIncludes{"<runtime/Error.h>"} = 1; @@ -1798,22 +1807,22 @@ sub GenerateImplementation if ($interfaceName eq "DOMWindow") { push(@implContent, " $className* castedThis = toJSDOMWindow(exec->hostThisValue().toThisObject(exec));\n"); push(@implContent, " if (!castedThis)\n"); - push(@implContent, " return throwError(exec, TypeError);\n"); + push(@implContent, " return throwVMTypeError(exec);\n"); } elsif ($dataNode->extendedAttributes->{"IsWorkerContext"}) { push(@implContent, " $className* castedThis = to${className}(exec->hostThisValue().toThisObject(exec));\n"); push(@implContent, " if (!castedThis)\n"); - push(@implContent, " return throwError(exec, TypeError);\n"); + push(@implContent, " return throwVMTypeError(exec);\n"); } else { push(@implContent, " JSValue thisValue = exec->hostThisValue();\n"); push(@implContent, " if (!thisValue.inherits(&${className}::s_info))\n"); - push(@implContent, " return throwError(exec, TypeError);\n"); + push(@implContent, " return throwVMTypeError(exec);\n"); push(@implContent, " $className* castedThis = static_cast<$className*>(asObject(thisValue));\n"); } if ($dataNode->extendedAttributes->{"CheckDomainSecurity"} && !$function->signature->extendedAttributes->{"DoNotCheckDomainSecurity"}) { push(@implContent, " if (!castedThis->allowsAccessFrom(exec))\n"); - push(@implContent, " return jsUndefined();\n"); + push(@implContent, " return JSValue::encode(jsUndefined());\n"); } # Special case for JSSVGLengthList / JSSVGTransformList / JSSVGPointList / JSSVGNumberList @@ -1832,12 +1841,12 @@ sub GenerateImplementation } if ($function->signature->extendedAttributes->{"Custom"} || $function->signature->extendedAttributes->{"JSCCustom"}) { - push(@implContent, " return castedThis->" . $functionImplementationName . "(exec);\n"); + push(@implContent, " return JSValue::encode(castedThis->" . $functionImplementationName . "(exec));\n"); } elsif ($svgPODListType) { $implIncludes{"JS${svgPODListType}.h"} = 1; $implIncludes{"JSSVGPODListCustom.h"} = 1; - push(@implContent, " return JSSVGPODListCustom::$functionImplementationName<$className, " . GetNativeType($svgPODListType) - . ">(castedThis, exec, to" . $svgPODListType . ");\n"); + push(@implContent, " return JSValue::encode(JSSVGPODListCustom::$functionImplementationName<$className, " . GetNativeType($svgPODListType) + . ">(castedThis, exec, to" . $svgPODListType . "));\n"); } else { push(@implContent, " $implType* imp = static_cast<$implType*>(castedThis->impl());\n"); push(@implContent, " $podType podImp(*imp);\n") if $podType; @@ -1848,9 +1857,9 @@ sub GenerateImplementation if ($requiresAllArguments) { push(@implContent, " if (exec->argumentCount() < $numParameters)\n"); if ($requiresAllArguments eq "Raise") { - push(@implContent, " return throwError(exec, SyntaxError, \"Not enough arguments\");\n"); + push(@implContent, " return throwVMError(exec, createSyntaxError(exec, \"Not enough arguments\"));\n"); } else { - push(@implContent, " return jsUndefined();\n"); + push(@implContent, " return JSValue::encode(jsUndefined());\n"); } } @@ -1860,7 +1869,7 @@ sub GenerateImplementation if ($function->signature->extendedAttributes->{"SVGCheckSecurityDocument"}) { push(@implContent, " if (!checkNodeSecurity(exec, imp->getSVGDocument(" . (@{$function->raisesExceptions} ? "ec" : "") .")))\n"); - push(@implContent, " return jsUndefined();\n"); + push(@implContent, " return JSValue::encode(jsUndefined());\n"); $implIncludes{"JSDOMBinding.h"} = 1; } @@ -1869,6 +1878,7 @@ sub GenerateImplementation } elsif ($function->signature->name eq "removeEventListener") { push(@implContent, GenerateEventListenerCall($className, "remove")); } else { + my $argsIndex = 0; my $paramIndex = 0; my $functionString = ($podType ? "podImp." : "imp->") . $functionImplementationName . "("; @@ -1885,10 +1895,15 @@ sub GenerateImplementation if ($callWith eq "DynamicFrame") { push(@implContent, " Frame* dynamicFrame = toDynamicFrame(exec);\n"); push(@implContent, " if (!dynamicFrame)\n"); - push(@implContent, " return jsUndefined();\n"); + push(@implContent, " return JSValue::encode(jsUndefined());\n"); $callWithArg = "dynamicFrame"; } elsif ($callWith eq "ScriptState") { $callWithArg = "exec"; + } elsif ($callWith eq "ScriptExecutionContext") { + push(@implContent, " ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();\n"); + push(@implContent, " if (!scriptContext)\n"); + push(@implContent, " return JSValue::encode(jsUndefined());\n"); + $callWithArg = "scriptContext"; } $functionString .= ", " if $paramIndex; $functionString .= $callWithArg; @@ -1902,7 +1917,7 @@ sub GenerateImplementation push(@implContent, "\n int argsCount = exec->argumentCount();\n"); $hasOptionalArguments = 1; } - push(@implContent, " if (argsCount < " . ($paramIndex + 1) . ") {\n"); + push(@implContent, " if (argsCount < " . ($argsIndex + 1) . ") {\n"); GenerateImplementationFunctionCall($function, $functionString, $paramIndex, " " x 2, $podType, $implClassName); push(@implContent, " }\n\n"); } @@ -1911,15 +1926,15 @@ sub GenerateImplementation if ($parameter->type eq "XPathNSResolver") { push(@implContent, " RefPtr<XPathNSResolver> customResolver;\n"); - push(@implContent, " XPathNSResolver* resolver = toXPathNSResolver(exec->argument($paramIndex));\n"); + push(@implContent, " XPathNSResolver* resolver = toXPathNSResolver(exec->argument($argsIndex));\n"); push(@implContent, " if (!resolver) {\n"); - push(@implContent, " customResolver = JSCustomXPathNSResolver::create(exec, exec->argument($paramIndex));\n"); + push(@implContent, " customResolver = JSCustomXPathNSResolver::create(exec, exec->argument($argsIndex));\n"); push(@implContent, " if (exec->hadException())\n"); - push(@implContent, " return jsUndefined();\n"); + push(@implContent, " return JSValue::encode(jsUndefined());\n"); push(@implContent, " resolver = customResolver.get();\n"); push(@implContent, " }\n"); } else { - push(@implContent, " " . GetNativeTypeFromSignature($parameter) . " $name = " . JSValueToNative($parameter, "exec->argument($paramIndex)") . ";\n"); + push(@implContent, " " . GetNativeTypeFromSignature($parameter) . " $name = " . JSValueToNative($parameter, "exec->argument($argsIndex)") . ";\n"); # If a parameter is "an index" and it's negative it should throw an INDEX_SIZE_ERR exception. # But this needs to be done in the bindings, because the type is unsigned and the fact that it @@ -1928,7 +1943,7 @@ sub GenerateImplementation $implIncludes{"ExceptionCode.h"} = 1; push(@implContent, " if ($name < 0) {\n"); push(@implContent, " setDOMException(exec, INDEX_SIZE_ERR);\n"); - push(@implContent, " return jsUndefined();\n"); + push(@implContent, " return JSValue::encode(jsUndefined());\n"); push(@implContent, " }\n"); } } @@ -1940,6 +1955,7 @@ sub GenerateImplementation } else { $functionString .= $name; } + $argsIndex++; $paramIndex++; } @@ -2221,7 +2237,7 @@ sub GenerateImplementationFunctionCall() push(@implContent, $indent . "$functionString;\n"); push(@implContent, $indent . "setDOMException(exec, ec);\n") if @{$function->raisesExceptions}; push(@implContent, $indent . "imp->commitChange(podImp, castedThis);\n") if $podType; - push(@implContent, $indent . "return jsUndefined();\n"); + push(@implContent, $indent . "return JSValue::encode(jsUndefined());\n"); } else { push(@implContent, "\n" . $indent . "JSC::JSValue result = " . NativeToJSValue($function->signature, 1, $implClassName, "", $functionString, "castedThis") . ";\n"); push(@implContent, $indent . "setDOMException(exec, ec);\n") if @{$function->raisesExceptions}; @@ -2229,7 +2245,7 @@ sub GenerateImplementationFunctionCall() $callWith = $function->signature->extendedAttributes->{"CallWith"}; if ($callWith and $callWith eq "ScriptState") { push(@implContent, $indent . "if (exec->hadException())\n"); - push(@implContent, $indent . " return jsUndefined();\n"); + push(@implContent, $indent . " return JSValue::encode(jsUndefined());\n"); } if ($podType and not $function->signature->extendedAttributes->{"Immutable"}) { @@ -2238,7 +2254,7 @@ sub GenerateImplementationFunctionCall() push(@implContent, $indent . "imp->commitChange(podImp, castedThis);\n"); } - push(@implContent, $indent . "return result;\n"); + push(@implContent, $indent . "return JSValue::encode(result);\n"); } } @@ -2702,86 +2718,94 @@ sub WriteData } } -sub constructorFor +sub GenerateConstructorDeclaration { + my $outputArray = shift; my $className = shift; - my $protoClassName = shift; - my $interfaceName = shift; - my $visibleClassName = shift; my $dataNode = shift; + my $constructorClassName = "${className}Constructor"; my $canConstruct = $dataNode->extendedAttributes->{"CanBeConstructed"}; my $callWith = $dataNode->extendedAttributes->{"CallWith"}; -my $implContent = << "EOF"; -class ${constructorClassName} : public DOMConstructorObject { -public: - ${constructorClassName}(ExecState* exec, JSDOMGlobalObject* globalObject) - : DOMConstructorObject(${constructorClassName}::createStructure(globalObject->objectPrototype()), globalObject) - { - putDirect(exec->propertyNames().prototype, ${protoClassName}::self(exec, globalObject), DontDelete | ReadOnly); - } - virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); - virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); - virtual const ClassInfo* classInfo() const { return &s_info; } - static const ClassInfo s_info; + push(@$outputArray, "class ${constructorClassName} : public DOMConstructorObject {\n"); + push(@$outputArray, "public:\n"); + push(@$outputArray, " ${constructorClassName}(JSC::ExecState*, JSDOMGlobalObject*);\n\n"); - static PassRefPtr<Structure> createStructure(JSValue proto) - { - return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); - } - -protected: - static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | DOMConstructorObject::StructureFlags; -EOF + push(@$outputArray, " virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);\n"); + push(@$outputArray, " virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);\n"); + push(@$outputArray, " virtual const JSC::ClassInfo* classInfo() const { return &s_info; }\n"); + push(@$outputArray, " static const JSC::ClassInfo s_info;\n"); - if ($canConstruct) { -$implContent .= << "EOF"; - static JSObject* construct${interfaceName}(ExecState* exec, JSObject* constructor, const ArgList&) - { -EOF + push(@$outputArray, " static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)\n"); + push(@$outputArray, " {\n"); + push(@$outputArray, " return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);\n"); + push(@$outputArray, " }\n"); - my $constructorArg = ""; - if ($callWith and $callWith eq "ScriptExecutionContext") { - $constructorArg = "context"; -$implContent .= << "EOF"; - ScriptExecutionContext* context = static_cast<${constructorClassName}*>(constructor)->scriptExecutionContext(); - if (!context) - return throwError(exec, ReferenceError); -EOF - } + push(@$outputArray, "protected:\n"); + push(@$outputArray, " static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;\n"); -$implContent .= << "EOF"; - return asObject(toJS(exec, static_cast<${constructorClassName}*>(constructor)->globalObject(), ${interfaceName}::create(${constructorArg}))); - } - virtual ConstructType getConstructData(ConstructData& constructData) - { - constructData.native.function = construct${interfaceName}; - return ConstructTypeHost; - } -EOF + if ($canConstruct) { + push(@$outputArray, " static JSC::EncodedJSValue JSC_HOST_CALL construct${className}(JSC::ExecState*);\n"); + push(@$outputArray, " virtual JSC::ConstructType getConstructData(JSC::ConstructData&);\n"); } + push(@$outputArray, "};\n\n"); +} -$implContent .= << "EOF"; -}; +sub GenerateConstructorDefinition +{ + my $outputArray = shift; -const ClassInfo ${constructorClassName}::s_info = { "${visibleClassName}Constructor", 0, &${constructorClassName}Table, 0 }; + my $className = shift; + my $protoClassName = shift; + my $interfaceName = shift; + my $visibleClassName = shift; + my $dataNode = shift; -bool ${constructorClassName}::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) -{ - return getStaticValueSlot<${constructorClassName}, DOMObject>(exec, &${constructorClassName}Table, this, propertyName, slot); -} + my $constructorClassName = "${className}Constructor"; + my $canConstruct = $dataNode->extendedAttributes->{"CanBeConstructed"}; + my $customConstructFunction = $dataNode->extendedAttributes->{"CustomConstructFunction"}; + my $callWith = $dataNode->extendedAttributes->{"CallWith"}; -bool ${constructorClassName}::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) -{ - return getStaticValueDescriptor<${constructorClassName}, DOMObject>(exec, &${constructorClassName}Table, this, propertyName, descriptor); -} + push(@$outputArray, "const ClassInfo ${constructorClassName}::s_info = { \"${visibleClassName}Constructor\", 0, &${constructorClassName}Table, 0 };\n\n"); -EOF + push(@$outputArray, "${constructorClassName}::${constructorClassName}(ExecState* exec, JSDOMGlobalObject* globalObject)\n"); + push(@$outputArray, " : DOMConstructorObject(${constructorClassName}::createStructure(globalObject->objectPrototype()), globalObject)\n"); + push(@$outputArray, "{\n"); + push(@$outputArray, " putDirect(exec->propertyNames().prototype, ${protoClassName}::self(exec, globalObject), DontDelete | ReadOnly);\n"); + push(@$outputArray, "}\n\n"); + + push(@$outputArray, "bool ${constructorClassName}::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)\n"); + push(@$outputArray, "{\n"); + push(@$outputArray, " return getStaticValueSlot<${constructorClassName}, DOMObject>(exec, &${constructorClassName}Table, this, propertyName, slot);\n"); + push(@$outputArray, "}\n\n"); - $implJSCInclude{"JSNumberCell.h"} = 1; # FIXME: What is this for? + push(@$outputArray, "bool ${constructorClassName}::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)\n"); + push(@$outputArray, "{\n"); + push(@$outputArray, " return getStaticValueDescriptor<${constructorClassName}, DOMObject>(exec, &${constructorClassName}Table, this, propertyName, descriptor);\n"); + push(@$outputArray, "}\n\n"); - return $implContent; + if ($canConstruct) { + if (!$customConstructFunction) { + push(@$outputArray, "EncodedJSValue JSC_HOST_CALL ${constructorClassName}::construct${className}(ExecState* exec)\n"); + push(@$outputArray, "{\n"); + my $constructorArg = ""; + if ($callWith and $callWith eq "ScriptExecutionContext") { + $constructorArg = "context"; + push(@$outputArray, " ScriptExecutionContext* context = static_cast<${constructorClassName}*>(exec->callee())->scriptExecutionContext();\n"); + push(@$outputArray, " if (!context)\n"); + push(@$outputArray, " return throwVMError(exec, createReferenceError(exec, \"Reference error\"));\n"); + } + push(@$outputArray, " return JSValue::encode(asObject(toJS(exec, static_cast<${constructorClassName}*>(exec->callee())->globalObject(), ${interfaceName}::create(${constructorArg}))));\n"); + push(@$outputArray, "}\n\n"); + } + + push(@$outputArray, "ConstructType ${constructorClassName}::getConstructData(ConstructData& constructData)\n"); + push(@$outputArray, "{\n"); + push(@$outputArray, " constructData.native.function = construct${className};\n"); + push(@$outputArray, " return ConstructTypeHost;\n"); + push(@$outputArray, "}\n\n"); + } } 1; diff --git a/WebCore/bindings/scripts/CodeGeneratorObjC.pm b/WebCore/bindings/scripts/CodeGeneratorObjC.pm index 89da48d..daead72 100644 --- a/WebCore/bindings/scripts/CodeGeneratorObjC.pm +++ b/WebCore/bindings/scripts/CodeGeneratorObjC.pm @@ -5,6 +5,7 @@ # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> # Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> +# Copyright (C) 2010 Google Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public @@ -740,8 +741,8 @@ sub GenerateHeader foreach my $attribute (@{$dataNode->attributes}) { my $attributeName = $attribute->signature->name; - if ($attributeName eq "id" or $attributeName eq "hash") { - # Special case attributes id and hash to be idName and hashName to avoid ObjC naming conflict. + if ($attributeName eq "id" or $attributeName eq "hash" or $attributeName eq "description") { + # Special case some attributes (like id and hash) to have a "Name" suffix to avoid ObjC naming conflicts. $attributeName .= "Name"; } elsif ($attributeName eq "frame") { # Special case attribute frame to be frameBorders. @@ -1157,8 +1158,8 @@ sub GenerateImplementation my $attributeClassName = GetClassName($attribute->signature->type); my $attributeInterfaceName = $attributeName; - if ($attributeName eq "id" or $attributeName eq "hash") { - # Special case attributes id and hash to be idName and hashName to avoid ObjC naming conflict. + if ($attributeName eq "id" or $attributeName eq "hash" or $attributeName eq "description") { + # Special case some attributes (like id and hash) to have a "Name" suffix to avoid ObjC naming conflicts. $attributeInterfaceName .= "Name"; } elsif ($attributeName eq "frame") { # Special case attribute frame to be frameBorders. diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm index 058d1cc..e471500 100644 --- a/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -273,6 +273,13 @@ END END } + if ($implClassName eq "HTMLDocument") { + push(@headerContent, <<END); + static v8::Local<v8::Object> WrapInShadowObject(v8::Local<v8::Object> wrapper, Node* impl); + static v8::Handle<v8::Value> GetNamedProperty(HTMLDocument* htmlDocument, const AtomicString& key); +END + } + my @enabledAtRuntime; foreach my $function (@{$dataNode->functions}) { my $name = $function->signature->name; @@ -289,7 +296,7 @@ END } } - if ($dataNode->extendedAttributes->{"CustomConstructor"} || $dataNode->extendedAttributes->{"CanBeConstructed"}) { + if ($dataNode->extendedAttributes->{"CustomConstructor"} || $dataNode->extendedAttributes->{"V8CustomConstructor"} || $dataNode->extendedAttributes->{"CanBeConstructed"}) { push(@headerContent, <<END); static v8::Handle<v8::Value> constructorCallback(const v8::Arguments& args); END @@ -360,9 +367,6 @@ sub GetInternalFields if (IsSubType($dataNode, "Document")) { push(@customInternalFields, "implementationIndex"); - if ($name eq "HTMLDocument") { - push(@customInternalFields, ("markerIndex", "shadowIndex")); - } } elsif ($name eq "DOMWindow") { push(@customInternalFields, "enteredIsolatedWorldIndex"); } @@ -399,7 +403,6 @@ END my %indexerSpecialCases = ( "Storage" => 1, "HTMLAppletElement" => 1, - "HTMLDocument" => 1, "HTMLEmbedElement" => 1, "HTMLObjectElement" => 1 ); @@ -426,42 +429,47 @@ sub GenerateHeaderNamedAndIndexedPropertyAccessors if ($interfaceName eq "HTMLSelectElement" || $interfaceName eq "HTMLAppletElement" || $interfaceName eq "HTMLEmbedElement" || $interfaceName eq "HTMLObjectElement") { $hasCustomNamedGetter = 1; } + if ($interfaceName eq "HTMLDocument") { + $hasCustomNamedGetter = 0; + $hasCustomIndexedGetter = 0; + } my $isIndexerSpecialCase = exists $indexerSpecialCases{$interfaceName}; if ($hasCustomIndexedGetter || $isIndexerSpecialCase) { push(@headerContent, <<END); - static v8::Handle<v8::Value> indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info); + static v8::Handle<v8::Value> indexedPropertyGetter(uint32_t, const v8::AccessorInfo&); 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); + static v8::Handle<v8::Value> indexedPropertySetter(uint32_t, v8::Local<v8::Value>, const v8::AccessorInfo&); END } if ($hasCustomDeleters) { push(@headerContent, <<END); - static v8::Handle<v8::Boolean> indexedPropertyDeleter(uint32_t index, const v8::AccessorInfo& info); + static v8::Handle<v8::Boolean> indexedPropertyDeleter(uint32_t, const v8::AccessorInfo&); END } if ($hasCustomNamedGetter) { push(@headerContent, <<END); - static v8::Handle<v8::Value> namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info); + static v8::Handle<v8::Value> namedPropertyGetter(v8::Local<v8::String>, const v8::AccessorInfo&); END } if ($hasCustomNamedSetter) { push(@headerContent, <<END); - static v8::Handle<v8::Value> namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info); + static v8::Handle<v8::Value> namedPropertySetter(v8::Local<v8::String>, v8::Local<v8::Value>, const v8::AccessorInfo&); END } - if ($hasCustomDeleters || $interfaceName eq "HTMLDocument") { + if ($hasCustomDeleters) { push(@headerContent, <<END); - static v8::Handle<v8::Boolean> namedPropertyDeleter(v8::Local<v8::String> name, const v8::AccessorInfo& info); + static v8::Handle<v8::Boolean> namedPropertyDeleter(v8::Local<v8::String>, const v8::AccessorInfo&); END } if ($hasCustomEnumerator) { push(@headerContent, <<END); - static v8::Handle<v8::Array> namedPropertyEnumerator(const v8::AccessorInfo& info); + static v8::Handle<v8::Array> namedPropertyEnumerator(const v8::AccessorInfo&); + static v8::Handle<v8::Integer> namedPropertyQuery(v8::Local<v8::String>, const v8::AccessorInfo&); END } } @@ -1504,6 +1512,10 @@ sub GenerateImplementationNamedPropertyGetter $hasCustomGetter = 1; } + if ($interfaceName eq "HTMLDocument") { + $hasCustomGetter = 0; + } + my $hasGetter = $dataNode->extendedAttributes->{"HasNameGetter"} || $hasCustomGetter || $namedPropertyGetter; if (!$hasGetter) { return; @@ -1519,8 +1531,7 @@ END } my $hasSetter = $dataNode->extendedAttributes->{"DelegatingPutFunction"}; - # FIXME: Try to remove hard-coded HTMLDocument reference by aligning handling of document.all with JSC bindings. - my $hasDeleter = $dataNode->extendedAttributes->{"CustomDeleteProperty"} || $interfaceName eq "HTMLDocument"; + my $hasDeleter = $dataNode->extendedAttributes->{"CustomDeleteProperty"}; my $hasEnumerator = $dataNode->extendedAttributes->{"CustomGetPropertyNames"}; my $setOn = "Instance"; @@ -1536,7 +1547,8 @@ END push(@implContent, " desc->${setOn}Template()->SetNamedPropertyHandler(V8${interfaceName}::namedPropertyGetter, "); push(@implContent, $hasSetter ? "V8${interfaceName}::namedPropertySetter, " : "0, "); - push(@implContent, "0, "); # NamedPropertyQuery -- not being used at the moment. + # If there is a custom enumerator, there MUST be custom query to properly communicate property attributes. + push(@implContent, $hasEnumerator ? "V8${interfaceName}::namedPropertyQuery, " : "0, "); push(@implContent, $hasDeleter ? "V8${interfaceName}::namedPropertyDeleter, " : "0, "); push(@implContent, $hasEnumerator ? "V8${interfaceName}::namedPropertyEnumerator" : "0"); push(@implContent, ");\n"); @@ -1780,7 +1792,7 @@ END push(@implContentDecls, "} // namespace ${interfaceName}Internal\n\n"); # In namespace WebCore, add generated implementation for 'CanBeConstructed'. - if ($dataNode->extendedAttributes->{"CanBeConstructed"} && !$dataNode->extendedAttributes->{"CustomConstructor"}) { + if ($dataNode->extendedAttributes->{"CanBeConstructed"} && !$dataNode->extendedAttributes->{"CustomConstructor"} && !$dataNode->extendedAttributes->{"V8CustomConstructor"}) { my $v8ConstructFunction; my $callWith = $dataNode->extendedAttributes->{"CallWith"}; if ($callWith and $callWith eq "ScriptExecutionContext") { @@ -1858,7 +1870,7 @@ END END } - if ($dataNode->extendedAttributes->{"CustomConstructor"} || $dataNode->extendedAttributes->{"CanBeConstructed"}) { + if ($dataNode->extendedAttributes->{"CustomConstructor"} || $dataNode->extendedAttributes->{"V8CustomConstructor"} || $dataNode->extendedAttributes->{"CanBeConstructed"}) { push(@implContent, <<END); desc->SetCallHandler(V8${interfaceName}::constructorCallback); END @@ -2003,6 +2015,11 @@ END instance->SetAccessCheckCallbacks(V8DOMWindow::namedSecurityCheck, V8DOMWindow::indexedSecurityCheck, v8::External::Wrap(&V8DOMWindow::info), false); END } + if ($interfaceName eq "HTMLDocument") { + push(@implContent, <<END); + desc->SetHiddenPrototype(true); +END + } if ($interfaceName eq "Location") { push(@implContent, <<END); @@ -2220,6 +2237,7 @@ sub GenerateCallbackImplementation $implIncludes{"V8CustomVoidCallback.h"} = 1; $implIncludes{"V8Proxy.h"} = 1; + push(@implContent, "#include <wtf/Assertions.h>\n\n"); push(@implContent, "namespace WebCore {\n\n"); push(@implContent, <<END); ${className}::${className}(v8::Local<v8::Object> callback) @@ -2261,15 +2279,20 @@ END push(@implContent, " if (v8Context.IsEmpty())\n"); push(@implContent, " return true;\n\n"); push(@implContent, " v8::Context::Scope scope(v8Context);\n\n"); - push(@implContent, " v8::Handle<v8::Value> argv[] = {\n"); my @argvs = (); foreach my $param (@params) { my $paramName = $param->name; - push(@argvs, " toV8(${paramName})"); + push(@implContent, " v8::Handle<v8::Value> ${paramName}Handle = toV8(${paramName});\n"); + push(@implContent, " if (${paramName}Handle.IsEmpty()) {\n"); + push(@implContent, " CRASH();\n"); + push(@implContent, " return true;\n"); + push(@implContent, " }\n"); + push(@argvs, " ${paramName}Handle"); } - push(@implContent, join(",\n", @argvs)); + push(@implContent, "\n v8::Handle<v8::Value> argv[] = {\n"); + push(@implContent, join(",\n", @argvs)); push(@implContent, "\n };\n\n"); push(@implContent, " bool callbackReturnValue = false;\n"); push(@implContent, " return !invokeCallback(m_callback, " . scalar(@params) . ", argv, callbackReturnValue, context);\n"); @@ -2531,6 +2554,11 @@ sub GenerateFunctionCallString() $result .= $indent . "EmptyScriptState state;\n"; $callWithArg = "&state"; $hasScriptState = 1; + } elsif ($callWith eq "ScriptExecutionContext") { + $result .= $indent . "ScriptExecutionContext* scriptContext = getScriptExecutionContext();\n"; + $result .= $indent . "if (!scriptContext)\n"; + $result .= $indent . " return v8::Undefined();\n"; + $callWithArg = "scriptContext"; } $functionString .= ", " if $index; $functionString .= $callWithArg; diff --git a/WebCore/bindings/scripts/IDLParser.pm b/WebCore/bindings/scripts/IDLParser.pm index 5b7beb3..3df96ab 100644 --- a/WebCore/bindings/scripts/IDLParser.pm +++ b/WebCore/bindings/scripts/IDLParser.pm @@ -21,6 +21,8 @@ package IDLParser; +use strict; + use IPC::Open2; use IDLStructure; @@ -82,7 +84,7 @@ sub Parse print " | *** Starting to parse $fileName...\n |\n" unless $beQuiet; - $pid = open2(\*PP_OUT, \*PP_IN, split(' ', $preprocessor), (map { "-D$_" } split(' ', $defines)), $fileName); + my $pid = open2(\*PP_OUT, \*PP_IN, split(' ', $preprocessor), (map { "-D$_" } split(' ', $defines)), $fileName); close PP_IN; my @documentContent = <PP_OUT>; close PP_OUT; @@ -148,7 +150,7 @@ sub dumpExtendedAttributes } my @temp; - while (($name, $value) = each(%{$attrs})) { + while ((my $name, my $value) = each(%{$attrs})) { push(@temp, "$name=$value"); } @@ -163,11 +165,11 @@ sub parseExtendedAttributes my %attrs = (); foreach my $value (split(/\s*,\s*/, $str)) { - ($name,$value) = split(/\s*=\s*/, $value, 2); + (my $name, my $val) = split(/\s*=\s*/, $value, 2); # Attributes with no value are set to be true - $value = 1 unless defined $value; - $attrs{$name} = $value; + $val = 1 unless defined $val; + $attrs{$name} = $val; die("Invalid extended attribute name: '$name'\n") if $name =~ /\s/; } @@ -232,9 +234,9 @@ sub ParseInterface # Match identifier of the interface, and enclosed data... $data =~ /$IDLStructure::interfaceSelector/; - $interfaceExtendedAttributes = (defined($1) ? $1 : " "); chop($interfaceExtendedAttributes); + my $interfaceExtendedAttributes = (defined($1) ? $1 : " "); chop($interfaceExtendedAttributes); $interfaceName = (defined($2) ? $2 : die("Parsing error!\nSource:\n$data\n)")); - $interfaceBase = (defined($3) ? $3 : ""); + my $interfaceBase = (defined($3) ? $3 : ""); $interfaceData = (defined($4) ? $4 : die("Parsing error!\nSource:\n$data\n)")); # Fill in known parts of the domClass datastructure now... diff --git a/WebCore/bindings/scripts/IDLStructure.pm b/WebCore/bindings/scripts/IDLStructure.pm index e060252..d61fce1 100644 --- a/WebCore/bindings/scripts/IDLStructure.pm +++ b/WebCore/bindings/scripts/IDLStructure.pm @@ -21,6 +21,8 @@ package IDLStructure; +use strict; + use Class::Struct; # Used to represent a parsed IDL document @@ -70,36 +72,36 @@ struct( domConstant => { }); # Helpers -$idlId = '[a-zA-Z0-9]'; # Generic identifier -$idlIdNs = '[a-zA-Z0-9:]'; # Generic identifier including namespace -$idlIdNsList = '[a-zA-Z0-9:,\ ]'; # List of Generic identifiers including namespace +our $idlId = '[a-zA-Z0-9]'; # Generic identifier +our $idlIdNs = '[a-zA-Z0-9:]'; # Generic identifier including namespace +our $idlIdNsList = '[a-zA-Z0-9:,\ ]'; # List of Generic identifiers including namespace -$idlType = '[a-zA-Z0-9_]'; # Generic type/"value string" identifier -$idlDataType = '[a-zA-Z0-9\ ]'; # Generic data type identifier +our $idlType = '[a-zA-Z0-9_]'; # Generic type/"value string" identifier +our $idlDataType = '[a-zA-Z0-9\ ]'; # Generic data type identifier # Magic IDL parsing regular expressions my $supportedTypes = "((?:unsigned )?(?:int|short|(?:long )?long)|(?:$idlIdNs*))"; # Special IDL notations -$extendedAttributeSyntax = '\[[^]]*\]'; # Used for extended attributes +our $extendedAttributeSyntax = '\[[^]]*\]'; # Used for extended attributes # Regular expression based IDL 'syntactical tokenizer' used in the IDLParser -$moduleSelector = 'module\s*(' . $idlId . '*)\s*{'; -$moduleNSSelector = 'module\s*(' . $idlId . '*)\s*\[ns\s*(' . $idlIdNs . '*)\s*(' . $idlIdNs . '*)\]\s*;'; -$constantSelector = 'const\s*' . $supportedTypes . '\s*(' . $idlType . '*)\s*=\s*(' . $idlType . '*)'; -$raisesSelector = 'raises\s*\((' . $idlIdNsList . '*)\s*\)'; -$getterRaisesSelector = '\bgetter\s+raises\s*\((' . $idlIdNsList . '*)\s*\)'; -$setterRaisesSelector = '\bsetter\s+raises\s*\((' . $idlIdNsList . '*)\s*\)'; +our $moduleSelector = 'module\s*(' . $idlId . '*)\s*{'; +our $moduleNSSelector = 'module\s*(' . $idlId . '*)\s*\[ns\s*(' . $idlIdNs . '*)\s*(' . $idlIdNs . '*)\]\s*;'; +our $constantSelector = 'const\s*' . $supportedTypes . '\s*(' . $idlType . '*)\s*=\s*(' . $idlType . '*)'; +our $raisesSelector = 'raises\s*\((' . $idlIdNsList . '*)\s*\)'; +our $getterRaisesSelector = '\bgetter\s+raises\s*\((' . $idlIdNsList . '*)\s*\)'; +our $setterRaisesSelector = '\bsetter\s+raises\s*\((' . $idlIdNsList . '*)\s*\)'; -$typeNamespaceSelector = '((?:' . $idlId . '*::)*)\s*(' . $idlDataType . '*)'; +our $typeNamespaceSelector = '((?:' . $idlId . '*::)*)\s*(' . $idlDataType . '*)'; -$exceptionSelector = 'exception\s*(' . $idlIdNs . '*)\s*([a-zA-Z\s{;]*};)'; -$exceptionSubSelector = '{\s*' . $supportedTypes . '\s*(' . $idlType . '*)\s*;\s*}'; +our $exceptionSelector = 'exception\s*(' . $idlIdNs . '*)\s*([a-zA-Z\s{;]*};)'; +our $exceptionSubSelector = '{\s*' . $supportedTypes . '\s*(' . $idlType . '*)\s*;\s*}'; -$interfaceSelector = 'interface\s*((?:' . $extendedAttributeSyntax . ' )?)(' . $idlIdNs . '*)\s*(?::(\s*[^{]*))?{([a-zA-Z0-9_=\s(),;:\[\]&\|]*)'; -$interfaceMethodSelector = '\s*((?:' . $extendedAttributeSyntax . ' )?)' . $supportedTypes . '\s*(' . $idlIdNs . '*)\s*\(\s*([a-zA-Z0-9:\s,=\[\]]*)'; -$interfaceParameterSelector = 'in\s*((?:' . $extendedAttributeSyntax . ' )?)' . $supportedTypes . '\s*(' . $idlIdNs . '*)'; +our $interfaceSelector = 'interface\s*((?:' . $extendedAttributeSyntax . ' )?)(' . $idlIdNs . '*)\s*(?::(\s*[^{]*))?{([a-zA-Z0-9_=\s(),;:\[\]&\|]*)'; +our $interfaceMethodSelector = '\s*((?:' . $extendedAttributeSyntax . ' )?)' . $supportedTypes . '\s*(' . $idlIdNs . '*)\s*\(\s*([a-zA-Z0-9:\s,=\[\]]*)'; +our $interfaceParameterSelector = 'in\s*((?:' . $extendedAttributeSyntax . ' )?)' . $supportedTypes . '\s*(' . $idlIdNs . '*)'; -$interfaceAttributeSelector = '\s*(readonly attribute|attribute)\s*(' . $extendedAttributeSyntax . ' )?' . $supportedTypes . '\s*(' . $idlType . '*)'; +our $interfaceAttributeSelector = '\s*(readonly attribute|attribute)\s*(' . $extendedAttributeSyntax . ' )?' . $supportedTypes . '\s*(' . $idlType . '*)'; 1; diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp b/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp new file mode 100644 index 0000000..7235793 --- /dev/null +++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp @@ -0,0 +1,113 @@ +/* + * This file is part of the WebKit open source project. + * This file has been generated by generate-bindings.pl. DO NOT MODIFY! + * + * 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" + +#if ENABLE(DATABASE) + +#include "WebDOMTestCallback.h" + +#include "AtomicString.h" +#include "Class1.h" +#include "Class2.h" +#include "Class3.h" +#include "KURL.h" +#include "TestCallback.h" +#include "WebDOMClass1.h" +#include "WebDOMClass2.h" +#include "WebDOMClass3.h" +#include "WebDOMString.h" +#include "WebExceptionHandler.h" +#include <wtf/GetPtr.h> +#include <wtf/RefPtr.h> + +struct WebDOMTestCallback::WebDOMTestCallbackPrivate { + WebDOMTestCallbackPrivate(WebCore::TestCallback* object = 0) + : impl(object) + { + } + + RefPtr<WebCore::TestCallback> impl; +}; + +WebDOMTestCallback::WebDOMTestCallback() + : WebDOMObject() + , m_impl(0) +{ +} + +WebDOMTestCallback::WebDOMTestCallback(WebCore::TestCallback* impl) + : WebDOMObject() + , m_impl(new WebDOMTestCallbackPrivate(impl)) +{ +} + +WebDOMTestCallback::WebDOMTestCallback(const WebDOMTestCallback& copy) + : WebDOMObject() +{ + m_impl = copy.impl() ? new WebDOMTestCallbackPrivate(copy.impl()) : 0; +} + +WebCore::TestCallback* WebDOMTestCallback::impl() const +{ + return m_impl ? m_impl->impl.get() : 0; +} + +WebDOMTestCallback::~WebDOMTestCallback() +{ + delete m_impl; + m_impl = 0; +} + +bool WebDOMTestCallback::callbackWithClass1Param(const WebDOMClass1& class1Param) +{ + if (!impl()) + return false; + + return impl()->callbackWithClass1Param(0, toWebCore(class1Param)); +} + +bool WebDOMTestCallback::callbackWithClass2Param(const WebDOMClass2& class2Param, const WebDOMString& strArg) +{ + if (!impl()) + return false; + + return impl()->callbackWithClass2Param(0, toWebCore(class2Param), strArg); +} + +int WebDOMTestCallback::callbackWithNonBoolReturnType(const WebDOMClass3& class3Param) +{ + if (!impl()) + return 0; + + return impl()->callbackWithNonBoolReturnType(0, toWebCore(class3Param)); +} + +WebCore::TestCallback* toWebCore(const WebDOMTestCallback& wrapper) +{ + return wrapper.impl(); +} + +WebDOMTestCallback toWebKit(WebCore::TestCallback* value) +{ + return WebDOMTestCallback(value); +} + +#endif // ENABLE(DATABASE) diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h b/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h new file mode 100644 index 0000000..3fe6837 --- /dev/null +++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * Copyright (C) Research In Motion Limited 2010. 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 WebDOMTestCallback_h +#define WebDOMTestCallback_h + +#if ENABLE(DATABASE) + +#include <WebDOMObject.h> +#include <WebDOMString.h> + +namespace WebCore { +class TestCallback; +}; + +class WebDOMClass1; +class WebDOMClass2; +class WebDOMClass3; +class WebDOMClass5; +class WebDOMClass6; + +class WebDOMTestCallback : public WebDOMObject { +public: + WebDOMTestCallback(); + explicit WebDOMTestCallback(WebCore::TestCallback*); + WebDOMTestCallback(const WebDOMTestCallback&); + ~WebDOMTestCallback(); + + bool callbackWithClass1Param(const WebDOMClass1& class1Param); + bool callbackWithClass2Param(const WebDOMClass2& class2Param, const WebDOMString& strArg); + int callbackWithNonBoolReturnType(const WebDOMClass3& class3Param); + int customCallback(const WebDOMClass5& class5Param, const WebDOMClass6& class6Param); + + WebCore::TestCallback* impl() const; + +protected: + struct WebDOMTestCallbackPrivate; + WebDOMTestCallbackPrivate* m_impl; +}; + +WebCore::TestCallback* toWebCore(const WebDOMTestCallback&); +WebDOMTestCallback toWebKit(WebCore::TestCallback*); + +#endif +#endif // ENABLE(DATABASE) + diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp b/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp new file mode 100644 index 0000000..0b20841 --- /dev/null +++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp @@ -0,0 +1,75 @@ +/* + * This file is part of the WebKit open source project. + * This file has been generated by generate-bindings.pl. DO NOT MODIFY! + * + * 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 "WebDOMTestInterface.h" + +#include "TestInterface.h" +#include "WebExceptionHandler.h" +#include <wtf/GetPtr.h> +#include <wtf/RefPtr.h> + +struct WebDOMTestInterface::WebDOMTestInterfacePrivate { + WebDOMTestInterfacePrivate(WebCore::TestInterface* object = 0) + : impl(object) + { + } + + RefPtr<WebCore::TestInterface> impl; +}; + +WebDOMTestInterface::WebDOMTestInterface() + : WebDOMObject() + , m_impl(0) +{ +} + +WebDOMTestInterface::WebDOMTestInterface(WebCore::TestInterface* impl) + : WebDOMObject() + , m_impl(new WebDOMTestInterfacePrivate(impl)) +{ +} + +WebDOMTestInterface::WebDOMTestInterface(const WebDOMTestInterface& copy) + : WebDOMObject() +{ + m_impl = copy.impl() ? new WebDOMTestInterfacePrivate(copy.impl()) : 0; +} + +WebCore::TestInterface* WebDOMTestInterface::impl() const +{ + return m_impl ? m_impl->impl.get() : 0; +} + +WebDOMTestInterface::~WebDOMTestInterface() +{ + delete m_impl; + m_impl = 0; +} + +WebCore::TestInterface* toWebCore(const WebDOMTestInterface& wrapper) +{ + return wrapper.impl(); +} + +WebDOMTestInterface toWebKit(WebCore::TestInterface* value) +{ + return WebDOMTestInterface(value); +} diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h b/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h new file mode 100644 index 0000000..d0cee5b --- /dev/null +++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * Copyright (C) Research In Motion Limited 2010. 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 WebDOMTestInterface_h +#define WebDOMTestInterface_h + +#include <WebDOMObject.h> +#include <WebDOMString.h> + +namespace WebCore { +class TestInterface; +}; + + +class WebDOMTestInterface : public WebDOMObject { +public: + WebDOMTestInterface(); + explicit WebDOMTestInterface(WebCore::TestInterface*); + WebDOMTestInterface(const WebDOMTestInterface&); + ~WebDOMTestInterface(); + + + WebCore::TestInterface* impl() const; + +protected: + struct WebDOMTestInterfacePrivate; + WebDOMTestInterfacePrivate* m_impl; +}; + +WebCore::TestInterface* toWebCore(const WebDOMTestInterface&); +WebDOMTestInterface toWebKit(WebCore::TestInterface*); + +#endif diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp new file mode 100644 index 0000000..e540a57 --- /dev/null +++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp @@ -0,0 +1,441 @@ +/* + * This file is part of the WebKit open source project. + * This file has been generated by generate-bindings.pl. DO NOT MODIFY! + * + * 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 "WebDOMTestObj.h" + +#include "AtomicString.h" +#include "KURL.h" +#include "SerializedScriptValue.h" +#include "TestObj.h" +#include "WebDOMString.h" +#include "WebExceptionHandler.h" +#include "WebNativeEventListener.h" +#include <wtf/GetPtr.h> +#include <wtf/RefPtr.h> + +struct WebDOMTestObj::WebDOMTestObjPrivate { + WebDOMTestObjPrivate(WebCore::TestObj* object = 0) + : impl(object) + { + } + + RefPtr<WebCore::TestObj> impl; +}; + +WebDOMTestObj::WebDOMTestObj() + : WebDOMObject() + , m_impl(0) +{ +} + +WebDOMTestObj::WebDOMTestObj(WebCore::TestObj* impl) + : WebDOMObject() + , m_impl(new WebDOMTestObjPrivate(impl)) +{ +} + +WebDOMTestObj::WebDOMTestObj(const WebDOMTestObj& copy) + : WebDOMObject() +{ + m_impl = copy.impl() ? new WebDOMTestObjPrivate(copy.impl()) : 0; +} + +WebCore::TestObj* WebDOMTestObj::impl() const +{ + return m_impl ? m_impl->impl.get() : 0; +} + +WebDOMTestObj::~WebDOMTestObj() +{ + delete m_impl; + m_impl = 0; +} + +int WebDOMTestObj::readOnlyIntAttr() const +{ + if (!impl()) + return 0; + + return impl()->readOnlyIntAttr(); +} + +WebDOMString WebDOMTestObj::readOnlyStringAttr() const +{ + if (!impl()) + return WebDOMString(); + + return static_cast<const WebCore::String&>(impl()->readOnlyStringAttr()); +} + +WebDOMTestObj WebDOMTestObj::readOnlyTestObjAttr() const +{ + if (!impl()) + return WebDOMTestObj(); + + return toWebKit(WTF::getPtr(impl()->readOnlyTestObjAttr())); +} + +int WebDOMTestObj::intAttr() const +{ + if (!impl()) + return 0; + + return impl()->intAttr(); +} + +void WebDOMTestObj::setIntAttr(int newIntAttr) +{ + if (!impl()) + return; + + impl()->setIntAttr(newIntAttr); +} + +long long WebDOMTestObj::longLongAttr() const +{ + if (!impl()) + return 0; + + return impl()->longLongAttr(); +} + +void WebDOMTestObj::setLongLongAttr(long long newLongLongAttr) +{ + if (!impl()) + return; + + impl()->setLongLongAttr(newLongLongAttr); +} + +unsigned long long WebDOMTestObj::unsignedLongLongAttr() const +{ + if (!impl()) + return 0; + + return impl()->unsignedLongLongAttr(); +} + +void WebDOMTestObj::setUnsignedLongLongAttr(unsigned long long newUnsignedLongLongAttr) +{ + if (!impl()) + return; + + impl()->setUnsignedLongLongAttr(newUnsignedLongLongAttr); +} + +WebDOMString WebDOMTestObj::stringAttr() const +{ + if (!impl()) + return WebDOMString(); + + return static_cast<const WebCore::String&>(impl()->stringAttr()); +} + +void WebDOMTestObj::setStringAttr(const WebDOMString& newStringAttr) +{ + if (!impl()) + return; + + impl()->setStringAttr(newStringAttr); +} + +WebDOMTestObj WebDOMTestObj::testObjAttr() const +{ + if (!impl()) + return WebDOMTestObj(); + + return toWebKit(WTF::getPtr(impl()->testObjAttr())); +} + +void WebDOMTestObj::setTestObjAttr(const WebDOMTestObj& newTestObjAttr) +{ + if (!impl()) + return; + + impl()->setTestObjAttr(toWebCore(newTestObjAttr)); +} + +int WebDOMTestObj::attrWithException() const +{ + if (!impl()) + return 0; + + return impl()->attrWithException(); +} + +void WebDOMTestObj::setAttrWithException(int newAttrWithException) +{ + if (!impl()) + return; + + impl()->setAttrWithException(newAttrWithException); +} + +int WebDOMTestObj::attrWithSetterException() const +{ + if (!impl()) + return 0; + + WebCore::ExceptionCode ec = 0; + int result = impl()->attrWithSetterException(ec); + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); + return result; +} + +void WebDOMTestObj::setAttrWithSetterException(int newAttrWithSetterException) +{ + if (!impl()) + return; + + WebCore::ExceptionCode ec = 0; + impl()->setAttrWithSetterException(newAttrWithSetterException, ec); + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); +} + +int WebDOMTestObj::attrWithGetterException() const +{ + if (!impl()) + return 0; + + return impl()->attrWithGetterException(); +} + +void WebDOMTestObj::setAttrWithGetterException(int newAttrWithGetterException) +{ + if (!impl()) + return; + + WebCore::ExceptionCode ec = 0; + impl()->setAttrWithGetterException(newAttrWithGetterException, ec); + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); +} + +WebDOMString WebDOMTestObj::scriptStringAttr() const +{ + if (!impl()) + return WebDOMString(); + + return static_cast<const WebCore::String&>(impl()->scriptStringAttr()); +} + +void WebDOMTestObj::voidMethod() +{ + if (!impl()) + return; + + impl()->voidMethod(); +} + +void WebDOMTestObj::voidMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg) +{ + if (!impl()) + return; + + impl()->voidMethodWithArgs(intArg, strArg, toWebCore(objArg)); +} + +int WebDOMTestObj::intMethod() +{ + if (!impl()) + return 0; + + return impl()->intMethod(); +} + +int WebDOMTestObj::intMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg) +{ + if (!impl()) + return 0; + + return impl()->intMethodWithArgs(intArg, strArg, toWebCore(objArg)); +} + +WebDOMTestObj WebDOMTestObj::objMethod() +{ + if (!impl()) + return WebDOMTestObj(); + + return toWebKit(WTF::getPtr(impl()->objMethod())); +} + +WebDOMTestObj WebDOMTestObj::objMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg) +{ + if (!impl()) + return WebDOMTestObj(); + + return toWebKit(WTF::getPtr(impl()->objMethodWithArgs(intArg, strArg, toWebCore(objArg)))); +} + +WebDOMTestObj WebDOMTestObj::methodThatRequiresAllArgs(const WebDOMString& strArg, const WebDOMTestObj& objArg) +{ + if (!impl()) + return WebDOMTestObj(); + + return toWebKit(WTF::getPtr(impl()->methodThatRequiresAllArgs(strArg, toWebCore(objArg)))); +} + +WebDOMTestObj WebDOMTestObj::methodThatRequiresAllArgsAndThrows(const WebDOMString& strArg, const WebDOMTestObj& objArg) +{ + if (!impl()) + return WebDOMTestObj(); + + WebCore::ExceptionCode ec = 0; + WebDOMTestObj result = toWebKit(WTF::getPtr(impl()->methodThatRequiresAllArgsAndThrows(strArg, toWebCore(objArg), ec))); + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); + return result; +} + +void WebDOMTestObj::serializedValue(const WebDOMString& serializedArg) +{ + if (!impl()) + return; + + impl()->serializedValue(WebCore::SerializedScriptValue::create(WebCore::String(serializedArg))); +} + +void WebDOMTestObj::methodWithException() +{ + if (!impl()) + return; + + WebCore::ExceptionCode ec = 0; + impl()->methodWithException(ec); + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); +} + +void WebDOMTestObj::addEventListener(const WebDOMString& type, const WebDOMEventListener& listener, bool useCapture) +{ + if (!impl()) + return; + + impl()->addEventListener(type, toWebCore(listener), useCapture); +} + +void WebDOMTestObj::removeEventListener(const WebDOMString& type, const WebDOMEventListener& listener, bool useCapture) +{ + if (!impl()) + return; + + impl()->removeEventListener(type, toWebCore(listener), useCapture); +} + +void WebDOMTestObj::withDynamicFrame() +{ + if (!impl()) + return; + + impl()->withDynamicFrame(); +} + +void WebDOMTestObj::withDynamicFrameAndArg(int intArg) +{ + if (!impl()) + return; + + impl()->withDynamicFrameAndArg(intArg); +} + +void WebDOMTestObj::withDynamicFrameAndOptionalArg(int intArg, int optionalArg) +{ + if (!impl()) + return; + + impl()->withDynamicFrameAndOptionalArg(intArg, optionalArg); +} + +void WebDOMTestObj::withScriptStateVoid() +{ + if (!impl()) + return; + + impl()->withScriptStateVoid(); +} + +WebDOMTestObj WebDOMTestObj::withScriptStateObj() +{ + if (!impl()) + return WebDOMTestObj(); + + return toWebKit(WTF::getPtr(impl()->withScriptStateObj())); +} + +void WebDOMTestObj::withScriptStateVoidException() +{ + if (!impl()) + return; + + WebCore::ExceptionCode ec = 0; + impl()->withScriptStateVoidException(ec); + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); +} + +WebDOMTestObj WebDOMTestObj::withScriptStateObjException() +{ + if (!impl()) + return WebDOMTestObj(); + + WebCore::ExceptionCode ec = 0; + WebDOMTestObj result = toWebKit(WTF::getPtr(impl()->withScriptStateObjException(ec))); + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); + return result; +} + +void WebDOMTestObj::withScriptExecutionContext() +{ + if (!impl()) + return; + + impl()->withScriptExecutionContext(); +} + +void WebDOMTestObj::methodWithOptionalArg(int opt) +{ + if (!impl()) + return; + + impl()->methodWithOptionalArg(opt); +} + +void WebDOMTestObj::methodWithNonOptionalArgAndOptionalArg(int nonOpt, int opt) +{ + if (!impl()) + return; + + impl()->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt); +} + +void WebDOMTestObj::methodWithNonOptionalArgAndTwoOptionalArgs(int nonOpt, int opt1, int opt2) +{ + if (!impl()) + return; + + impl()->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2); +} + +WebCore::TestObj* toWebCore(const WebDOMTestObj& wrapper) +{ + return wrapper.impl(); +} + +WebDOMTestObj toWebKit(WebCore::TestObj* value) +{ + return WebDOMTestObj(value); +} diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h new file mode 100644 index 0000000..7bcd988 --- /dev/null +++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h @@ -0,0 +1,105 @@ +/* + * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * Copyright (C) Research In Motion Limited 2010. 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 WebDOMTestObj_h +#define WebDOMTestObj_h + +#include <WebDOMObject.h> +#include <WebDOMString.h> + +namespace WebCore { +class TestObj; +}; + +class WebDOMEventListener; +class WebDOMString; +class WebDOMTestObj; + +class WebDOMTestObj : public WebDOMObject { +public: + WebDOMTestObj(); + explicit WebDOMTestObj(WebCore::TestObj*); + WebDOMTestObj(const WebDOMTestObj&); + ~WebDOMTestObj(); + + int readOnlyIntAttr() const; + WebDOMString readOnlyStringAttr() const; + WebDOMTestObj readOnlyTestObjAttr() const; + int intAttr() const; + void setIntAttr(int); + long long longLongAttr() const; + void setLongLongAttr(long long); + unsigned long long unsignedLongLongAttr() const; + void setUnsignedLongLongAttr(unsigned long long); + WebDOMString stringAttr() const; + void setStringAttr(const WebDOMString&); + WebDOMTestObj testObjAttr() const; + void setTestObjAttr(const WebDOMTestObj&); + int attrWithException() const; + void setAttrWithException(int); + int attrWithSetterException() const; + void setAttrWithSetterException(int); + int attrWithGetterException() const; + void setAttrWithGetterException(int); + int customAttr() const; + void setCustomAttr(int); + WebDOMString scriptStringAttr() const; + + void voidMethod(); + void voidMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg); + int intMethod(); + int intMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg); + WebDOMTestObj objMethod(); + WebDOMTestObj objMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg); + WebDOMTestObj methodThatRequiresAllArgs(const WebDOMString& strArg, const WebDOMTestObj& objArg); + WebDOMTestObj methodThatRequiresAllArgsAndThrows(const WebDOMString& strArg, const WebDOMTestObj& objArg); + void serializedValue(const WebDOMString& serializedArg); + void methodWithException(); + void customMethod(); + void customMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg); + void addEventListener(const WebDOMString& type, const WebDOMEventListener& listener, bool useCapture); + void removeEventListener(const WebDOMString& type, const WebDOMEventListener& listener, bool useCapture); + void withDynamicFrame(); + void withDynamicFrameAndArg(int intArg); + void withDynamicFrameAndOptionalArg(int intArg, int optionalArg); + void withDynamicFrameAndUserGesture(int intArg); + void withDynamicFrameAndUserGestureASAD(int intArg, int optionalArg); + void withScriptStateVoid(); + WebDOMTestObj withScriptStateObj(); + void withScriptStateVoidException(); + WebDOMTestObj withScriptStateObjException(); + void withScriptExecutionContext(); + void methodWithOptionalArg(int opt); + void methodWithNonOptionalArgAndOptionalArg(int nonOpt, int opt); + void methodWithNonOptionalArgAndTwoOptionalArgs(int nonOpt, int opt1, int opt2); + + WebCore::TestObj* impl() const; + +protected: + struct WebDOMTestObjPrivate; + WebDOMTestObjPrivate* m_impl; +}; + +WebCore::TestObj* toWebCore(const WebDOMTestObj&); +WebDOMTestObj toWebKit(WebCore::TestObj*); + +#endif diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp index 505b59b..a67b6ac 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp @@ -53,7 +53,7 @@ gpointer kit(WebCore::TestCallback* obj) } // namespace WebKit // gboolean -webkit_dom_test_callback_callback_with_class1param (WebKitDOMTestCallback *self, WebKitDOMClass1* class1param) +webkit_dom_test_callback_callback_with_class1param(WebKitDOMTestCallback* self, WebKitDOMClass1* class1param) { g_return_val_if_fail (self, 0); WebCore::TestCallback * item = WebKit::core(self); @@ -62,11 +62,10 @@ webkit_dom_test_callback_callback_with_class1param (WebKitDOMTestCallback *self, g_return_val_if_fail (_g_class1param, 0); gboolean res = item->callbackWithClass1Param(_g_class1param); return res; - } gboolean -webkit_dom_test_callback_callback_with_class2param (WebKitDOMTestCallback *self, WebKitDOMClass2* class2param, gchar* str_arg) +webkit_dom_test_callback_callback_with_class2param(WebKitDOMTestCallback* self, WebKitDOMClass2* class2param, gchar* str_arg) { g_return_val_if_fail (self, 0); WebCore::TestCallback * item = WebKit::core(self); @@ -77,11 +76,10 @@ webkit_dom_test_callback_callback_with_class2param (WebKitDOMTestCallback *self, WebCore::String _g_str_arg = WebCore::String::fromUTF8(str_arg); gboolean res = item->callbackWithClass2Param(_g_class2param, _g_str_arg); return res; - } glong -webkit_dom_test_callback_callback_with_non_bool_return_type (WebKitDOMTestCallback *self, WebKitDOMClass3* class3param) +webkit_dom_test_callback_callback_with_non_bool_return_type(WebKitDOMTestCallback* self, WebKitDOMClass3* class3param) { g_return_val_if_fail (self, 0); WebCore::TestCallback * item = WebKit::core(self); @@ -90,7 +88,6 @@ webkit_dom_test_callback_callback_with_non_bool_return_type (WebKitDOMTestCallba g_return_val_if_fail (_g_class3param, 0); glong res = item->callbackWithNonBoolReturnType(_g_class3param); return res; - } @@ -132,8 +129,8 @@ static void webkit_dom_test_callback_finalize(GObject* object) static void webkit_dom_test_callback_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec) { - switch (prop_id) { - default: + switch (prop_id) { + default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; } @@ -142,8 +139,8 @@ static void webkit_dom_test_callback_set_property(GObject* object, guint prop_id static void webkit_dom_test_callback_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec) { - switch (prop_id) { - default: + switch (prop_id) { + default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; } diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h index 088c457..cfc883d 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h @@ -47,13 +47,13 @@ WEBKIT_API GType webkit_dom_test_callback_get_type (void); WEBKIT_API gboolean -webkit_dom_test_callback_callback_with_class1param (WebKitDOMTestCallback *self, WebKitDOMClass1* class1param); +webkit_dom_test_callback_callback_with_class1param(WebKitDOMTestCallback* self, WebKitDOMClass1* class1param); WEBKIT_API gboolean -webkit_dom_test_callback_callback_with_class2param (WebKitDOMTestCallback *self, WebKitDOMClass2* class2param, gchar* str_arg); +webkit_dom_test_callback_callback_with_class2param(WebKitDOMTestCallback* self, WebKitDOMClass2* class2param, gchar* str_arg); WEBKIT_API glong -webkit_dom_test_callback_callback_with_non_bool_return_type (WebKitDOMTestCallback *self, WebKitDOMClass3* class3param); +webkit_dom_test_callback_callback_with_non_bool_return_type(WebKitDOMTestCallback* self, WebKitDOMClass3* class3param); G_END_DECLS diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp index 17548d9..0d0021d 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp @@ -85,8 +85,8 @@ static void webkit_dom_test_interface_finalize(GObject* object) static void webkit_dom_test_interface_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec) { - switch (prop_id) { - default: + switch (prop_id) { + default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; } @@ -95,8 +95,8 @@ static void webkit_dom_test_interface_set_property(GObject* object, guint prop_i static void webkit_dom_test_interface_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec) { - switch (prop_id) { - default: + switch (prop_id) { + default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; } diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp index 2fa8c00..5dfb255 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp @@ -49,16 +49,15 @@ gpointer kit(WebCore::TestObj* obj) } // namespace WebKit // void -webkit_dom_test_obj_void_method (WebKitDOMTestObj *self) +webkit_dom_test_obj_void_method(WebKitDOMTestObj* self) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); item->voidMethod(); - } void -webkit_dom_test_obj_void_method_with_args (WebKitDOMTestObj *self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg) +webkit_dom_test_obj_void_method_with_args(WebKitDOMTestObj* self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); @@ -68,21 +67,19 @@ webkit_dom_test_obj_void_method_with_args (WebKitDOMTestObj *self, glong int_arg WebCore::TestObj * _g_obj_arg = WebKit::core(obj_arg); g_return_if_fail (_g_obj_arg); item->voidMethodWithArgs(int_arg, _g_str_arg, _g_obj_arg); - } glong -webkit_dom_test_obj_int_method (WebKitDOMTestObj *self) +webkit_dom_test_obj_int_method(WebKitDOMTestObj* self) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); glong res = item->intMethod(); return res; - } glong -webkit_dom_test_obj_int_method_with_args (WebKitDOMTestObj *self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg) +webkit_dom_test_obj_int_method_with_args(WebKitDOMTestObj* self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); @@ -93,22 +90,20 @@ webkit_dom_test_obj_int_method_with_args (WebKitDOMTestObj *self, glong int_arg, g_return_val_if_fail (_g_obj_arg, 0); glong res = item->intMethodWithArgs(int_arg, _g_str_arg, _g_obj_arg); return res; - } WebKitDOMTestObj* -webkit_dom_test_obj_obj_method (WebKitDOMTestObj *self) +webkit_dom_test_obj_obj_method(WebKitDOMTestObj* self) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->objMethod()); WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); return res; - } WebKitDOMTestObj* -webkit_dom_test_obj_obj_method_with_args (WebKitDOMTestObj *self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg) +webkit_dom_test_obj_obj_method_with_args(WebKitDOMTestObj* self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); @@ -120,11 +115,10 @@ webkit_dom_test_obj_obj_method_with_args (WebKitDOMTestObj *self, glong int_arg, PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->objMethodWithArgs(int_arg, _g_str_arg, _g_obj_arg)); WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); return res; - } WebKitDOMTestObj* -webkit_dom_test_obj_method_that_requires_all_args (WebKitDOMTestObj *self, gchar* str_arg, WebKitDOMTestObj* obj_arg) +webkit_dom_test_obj_method_that_requires_all_args(WebKitDOMTestObj* self, gchar* str_arg, WebKitDOMTestObj* obj_arg) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); @@ -136,11 +130,10 @@ webkit_dom_test_obj_method_that_requires_all_args (WebKitDOMTestObj *self, gchar PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->methodThatRequiresAllArgs(_g_str_arg, _g_obj_arg)); WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); return res; - } WebKitDOMTestObj* -webkit_dom_test_obj_method_that_requires_all_args_and_throws (WebKitDOMTestObj *self, gchar* str_arg, WebKitDOMTestObj* obj_arg, GError **error) +webkit_dom_test_obj_method_that_requires_all_args_and_throws(WebKitDOMTestObj* self, gchar* str_arg, WebKitDOMTestObj* obj_arg, GError **error) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); @@ -158,11 +151,10 @@ webkit_dom_test_obj_method_that_requires_all_args_and_throws (WebKitDOMTestObj * } WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); return res; - } void -webkit_dom_test_obj_serialized_value (WebKitDOMTestObj *self, WebKitDOMSerializedScriptValue* serialized_arg) +webkit_dom_test_obj_serialized_value(WebKitDOMTestObj* self, WebKitDOMSerializedScriptValue* serialized_arg) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); @@ -170,11 +162,10 @@ webkit_dom_test_obj_serialized_value (WebKitDOMTestObj *self, WebKitDOMSerialize WebCore::SerializedScriptValue * _g_serialized_arg = WebKit::core(serialized_arg); g_return_if_fail (_g_serialized_arg); item->serializedValue(_g_serialized_arg); - } void -webkit_dom_test_obj_method_with_exception (WebKitDOMTestObj *self, GError **error) +webkit_dom_test_obj_method_with_exception(WebKitDOMTestObj* self, GError **error) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); @@ -185,7 +176,6 @@ webkit_dom_test_obj_method_with_exception (WebKitDOMTestObj *self, GError **erro WebCore::getExceptionCodeDescription(ec, ecdesc); g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); } - } @@ -195,72 +185,65 @@ webkit_dom_test_obj_method_with_exception (WebKitDOMTestObj *self, GError **erro /* TODO: event function webkit_dom_test_obj_remove_event_listener */ void -webkit_dom_test_obj_with_dynamic_frame (WebKitDOMTestObj *self) +webkit_dom_test_obj_with_dynamic_frame(WebKitDOMTestObj* self) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); item->withDynamicFrame(); - } void -webkit_dom_test_obj_with_dynamic_frame_and_arg (WebKitDOMTestObj *self, glong int_arg) +webkit_dom_test_obj_with_dynamic_frame_and_arg(WebKitDOMTestObj* self, glong int_arg) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); item->withDynamicFrameAndArg(int_arg); - } void -webkit_dom_test_obj_with_dynamic_frame_and_optional_arg (WebKitDOMTestObj *self, glong int_arg, glong optional_arg) +webkit_dom_test_obj_with_dynamic_frame_and_optional_arg(WebKitDOMTestObj* self, glong int_arg, glong optional_arg) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); item->withDynamicFrameAndOptionalArg(int_arg, optional_arg); - } void -webkit_dom_test_obj_with_dynamic_frame_and_user_gesture (WebKitDOMTestObj *self, glong int_arg) +webkit_dom_test_obj_with_dynamic_frame_and_user_gesture(WebKitDOMTestObj* self, glong int_arg) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); item->withDynamicFrameAndUserGesture(int_arg); - } void -webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad (WebKitDOMTestObj *self, glong int_arg, glong optional_arg) +webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad(WebKitDOMTestObj* self, glong int_arg, glong optional_arg) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); item->withDynamicFrameAndUserGestureASAD(int_arg, optional_arg); - } void -webkit_dom_test_obj_with_script_state_void (WebKitDOMTestObj *self) +webkit_dom_test_obj_with_script_state_void(WebKitDOMTestObj* self) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); item->withScriptStateVoid(); - } WebKitDOMTestObj* -webkit_dom_test_obj_with_script_state_obj (WebKitDOMTestObj *self) +webkit_dom_test_obj_with_script_state_obj(WebKitDOMTestObj* self) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->withScriptStateObj()); WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); return res; - } void -webkit_dom_test_obj_with_script_state_void_exception (WebKitDOMTestObj *self, GError **error) +webkit_dom_test_obj_with_script_state_void_exception(WebKitDOMTestObj* self, GError **error) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); @@ -271,11 +254,10 @@ webkit_dom_test_obj_with_script_state_void_exception (WebKitDOMTestObj *self, GE WebCore::getExceptionCodeDescription(ec, ecdesc); g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); } - } WebKitDOMTestObj* -webkit_dom_test_obj_with_script_state_obj_exception (WebKitDOMTestObj *self, GError **error) +webkit_dom_test_obj_with_script_state_obj_exception(WebKitDOMTestObj* self, GError **error) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); @@ -288,158 +270,150 @@ webkit_dom_test_obj_with_script_state_obj_exception (WebKitDOMTestObj *self, GEr } WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); return res; +} +void +webkit_dom_test_obj_with_script_execution_context(WebKitDOMTestObj* self) +{ + g_return_if_fail (self); + WebCore::TestObj * item = WebKit::core(self); + item->withScriptExecutionContext(); } void -webkit_dom_test_obj_method_with_optional_arg (WebKitDOMTestObj *self, glong opt) +webkit_dom_test_obj_method_with_optional_arg(WebKitDOMTestObj* self, glong opt) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); item->methodWithOptionalArg(opt); - } void -webkit_dom_test_obj_method_with_non_optional_arg_and_optional_arg (WebKitDOMTestObj *self, glong non_opt, glong opt) +webkit_dom_test_obj_method_with_non_optional_arg_and_optional_arg(WebKitDOMTestObj* self, glong non_opt, glong opt) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); item->methodWithNonOptionalArgAndOptionalArg(non_opt, opt); - } void -webkit_dom_test_obj_method_with_non_optional_arg_and_two_optional_args (WebKitDOMTestObj *self, glong non_opt, glong opt1, glong opt2) +webkit_dom_test_obj_method_with_non_optional_arg_and_two_optional_args(WebKitDOMTestObj* self, glong non_opt, glong opt1, glong opt2) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); item->methodWithNonOptionalArgAndTwoOptionalArgs(non_opt, opt1, opt2); - } glong -webkit_dom_test_obj_get_read_only_int_attr (WebKitDOMTestObj *self) +webkit_dom_test_obj_get_read_only_int_attr(WebKitDOMTestObj* self) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); glong res = item->readOnlyIntAttr(); return res; - } gchar* -webkit_dom_test_obj_get_read_only_string_attr (WebKitDOMTestObj *self) +webkit_dom_test_obj_get_read_only_string_attr(WebKitDOMTestObj* self) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); gchar* res = convertToUTF8String(item->readOnlyStringAttr()); return res; - } WebKitDOMTestObj* -webkit_dom_test_obj_get_read_only_test_obj_attr (WebKitDOMTestObj *self) +webkit_dom_test_obj_get_read_only_test_obj_attr(WebKitDOMTestObj* self) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->readOnlyTestObjAttr()); WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); return res; - } glong -webkit_dom_test_obj_get_int_attr (WebKitDOMTestObj *self) +webkit_dom_test_obj_get_int_attr(WebKitDOMTestObj* self) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); glong res = item->intAttr(); return res; - } void -webkit_dom_test_obj_set_int_attr (WebKitDOMTestObj *self, glong value) +webkit_dom_test_obj_set_int_attr(WebKitDOMTestObj* self, glong value) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); item->setIntAttr(value); - } gint64 -webkit_dom_test_obj_get_long_long_attr (WebKitDOMTestObj *self) +webkit_dom_test_obj_get_long_long_attr(WebKitDOMTestObj* self) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); gint64 res = item->longLongAttr(); return res; - } void -webkit_dom_test_obj_set_long_long_attr (WebKitDOMTestObj *self, gint64 value) +webkit_dom_test_obj_set_long_long_attr(WebKitDOMTestObj* self, gint64 value) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); item->setLongLongAttr(value); - } guint64 -webkit_dom_test_obj_get_unsigned_long_long_attr (WebKitDOMTestObj *self) +webkit_dom_test_obj_get_unsigned_long_long_attr(WebKitDOMTestObj* self) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); guint64 res = item->unsignedLongLongAttr(); return res; - } void -webkit_dom_test_obj_set_unsigned_long_long_attr (WebKitDOMTestObj *self, guint64 value) +webkit_dom_test_obj_set_unsigned_long_long_attr(WebKitDOMTestObj* self, guint64 value) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); item->setUnsignedLongLongAttr(value); - } gchar* -webkit_dom_test_obj_get_string_attr (WebKitDOMTestObj *self) +webkit_dom_test_obj_get_string_attr(WebKitDOMTestObj* self) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); gchar* res = convertToUTF8String(item->stringAttr()); return res; - } void -webkit_dom_test_obj_set_string_attr (WebKitDOMTestObj *self, gchar* value) +webkit_dom_test_obj_set_string_attr(WebKitDOMTestObj* self, gchar* value) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); g_return_if_fail (value); WebCore::String _g_value = WebCore::String::fromUTF8(value); item->setStringAttr(_g_value); - } WebKitDOMTestObj* -webkit_dom_test_obj_get_test_obj_attr (WebKitDOMTestObj *self) +webkit_dom_test_obj_get_test_obj_attr(WebKitDOMTestObj* self) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->testObjAttr()); WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); return res; - } void -webkit_dom_test_obj_set_test_obj_attr (WebKitDOMTestObj *self, WebKitDOMTestObj* value) +webkit_dom_test_obj_set_test_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); @@ -447,30 +421,27 @@ webkit_dom_test_obj_set_test_obj_attr (WebKitDOMTestObj *self, WebKitDOMTestObj* WebCore::TestObj * _g_value = WebKit::core(value); g_return_if_fail (_g_value); item->setTestObjAttr(_g_value); - } glong -webkit_dom_test_obj_get_attr_with_exception (WebKitDOMTestObj *self) +webkit_dom_test_obj_get_attr_with_exception(WebKitDOMTestObj* self) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); glong res = item->attrWithException(); return res; - } void -webkit_dom_test_obj_set_attr_with_exception (WebKitDOMTestObj *self, glong value) +webkit_dom_test_obj_set_attr_with_exception(WebKitDOMTestObj* self, glong value) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); item->setAttrWithException(value); - } glong -webkit_dom_test_obj_get_attr_with_setter_exception (WebKitDOMTestObj *self, GError **error) +webkit_dom_test_obj_get_attr_with_setter_exception(WebKitDOMTestObj* self, GError **error) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); @@ -482,11 +453,10 @@ webkit_dom_test_obj_get_attr_with_setter_exception (WebKitDOMTestObj *self, GErr g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); } return res; - } void -webkit_dom_test_obj_set_attr_with_setter_exception (WebKitDOMTestObj *self, glong value, GError **error) +webkit_dom_test_obj_set_attr_with_setter_exception(WebKitDOMTestObj* self, glong value, GError **error) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); @@ -497,21 +467,19 @@ webkit_dom_test_obj_set_attr_with_setter_exception (WebKitDOMTestObj *self, glon WebCore::getExceptionCodeDescription(ec, ecdesc); g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); } - } glong -webkit_dom_test_obj_get_attr_with_getter_exception (WebKitDOMTestObj *self) +webkit_dom_test_obj_get_attr_with_getter_exception(WebKitDOMTestObj* self) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); glong res = item->attrWithGetterException(); return res; - } void -webkit_dom_test_obj_set_attr_with_getter_exception (WebKitDOMTestObj *self, glong value, GError **error) +webkit_dom_test_obj_set_attr_with_getter_exception(WebKitDOMTestObj* self, glong value, GError **error) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); @@ -522,17 +490,50 @@ webkit_dom_test_obj_set_attr_with_getter_exception (WebKitDOMTestObj *self, glon WebCore::getExceptionCodeDescription(ec, ecdesc); g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); } - } gchar* -webkit_dom_test_obj_get_script_string_attr (WebKitDOMTestObj *self) +webkit_dom_test_obj_get_script_string_attr(WebKitDOMTestObj* self) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); gchar* res = convertToUTF8String(item->scriptStringAttr()); return res; +} +glong +webkit_dom_test_obj_get_description(WebKitDOMTestObj* self) +{ + g_return_val_if_fail (self, 0); + WebCore::TestObj * item = WebKit::core(self); + glong res = item->description(); + return res; +} + +glong +webkit_dom_test_obj_get_id(WebKitDOMTestObj* self) +{ + g_return_val_if_fail (self, 0); + WebCore::TestObj * item = WebKit::core(self); + glong res = item->id(); + return res; +} + +void +webkit_dom_test_obj_set_id(WebKitDOMTestObj* self, glong value) +{ + g_return_if_fail (self); + WebCore::TestObj * item = WebKit::core(self); + item->setId(value); +} + +gchar* +webkit_dom_test_obj_get_hash(WebKitDOMTestObj* self) +{ + g_return_val_if_fail (self, 0); + WebCore::TestObj * item = WebKit::core(self); + gchar* res = convertToUTF8String(item->hash()); + return res; } @@ -566,6 +567,9 @@ enum { PROP_ATTR_WITH_GETTER_EXCEPTION, PROP_CUSTOM_ATTR, PROP_SCRIPT_STRING_ATTR, + PROP_DESCRIPTION, + PROP_ID, + PROP_HASH, }; @@ -587,42 +591,47 @@ static void webkit_dom_test_obj_finalize(GObject* object) static void webkit_dom_test_obj_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec) { - WebKitDOMTestObj *self = WEBKIT_DOM_TEST_OBJ(object); + WebKitDOMTestObj* self = WEBKIT_DOM_TEST_OBJ(object); WebCore::TestObj* coreSelf = WebKit::core(self); - switch (prop_id) { + switch (prop_id) { case PROP_INT_ATTR: { - coreSelf->setIntAttr((g_value_get_long(value)) ); - break; + coreSelf->setIntAttr((g_value_get_long(value))); + break; } case PROP_UNSIGNED_LONG_LONG_ATTR: { - coreSelf->setUnsignedLongLongAttr((g_value_get_uint64(value)) ); - break; + coreSelf->setUnsignedLongLongAttr((g_value_get_uint64(value))); + break; } case PROP_STRING_ATTR: { - coreSelf->setStringAttr(WebCore::String::fromUTF8(g_value_get_string(value)) ); - break; + coreSelf->setStringAttr(WebCore::String::fromUTF8(g_value_get_string(value))); + break; } case PROP_ATTR_WITH_EXCEPTION: { - coreSelf->setAttrWithException((g_value_get_long(value)) ); - break; + coreSelf->setAttrWithException((g_value_get_long(value))); + break; } case PROP_ATTR_WITH_SETTER_EXCEPTION: { - WebCore::ExceptionCode ec = 0; - coreSelf->setAttrWithSetterException((g_value_get_long(value)) , ec ); - break; + WebCore::ExceptionCode ec = 0; + coreSelf->setAttrWithSetterException((g_value_get_long(value)), ec); + break; } case PROP_ATTR_WITH_GETTER_EXCEPTION: { - WebCore::ExceptionCode ec = 0; - coreSelf->setAttrWithGetterException((g_value_get_long(value)) , ec ); - break; + WebCore::ExceptionCode ec = 0; + coreSelf->setAttrWithGetterException((g_value_get_long(value)), ec); + break; } - default: + case PROP_ID: + { + coreSelf->setId((g_value_get_long(value))); + break; + } + default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; } @@ -631,73 +640,88 @@ static void webkit_dom_test_obj_set_property(GObject* object, guint prop_id, con static void webkit_dom_test_obj_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec) { - WebKitDOMTestObj* self = WEBKIT_DOM_TEST_OBJ(object); + WebKitDOMTestObj* self = WEBKIT_DOM_TEST_OBJ(object); WebCore::TestObj* coreSelf = WebKit::core(self); - switch (prop_id) { + switch (prop_id) { case PROP_READ_ONLY_INT_ATTR: { - g_value_set_long(value, coreSelf->readOnlyIntAttr()); - break; + g_value_set_long(value, coreSelf->readOnlyIntAttr()); + break; } case PROP_READ_ONLY_STRING_ATTR: { - g_value_take_string(value, convertToUTF8String(coreSelf->readOnlyStringAttr())); - break; + g_value_take_string(value, convertToUTF8String(coreSelf->readOnlyStringAttr())); + break; } case PROP_READ_ONLY_TEST_OBJ_ATTR: { - RefPtr<WebCore::TestObj> ptr = coreSelf->readOnlyTestObjAttr(); + RefPtr<WebCore::TestObj> ptr = coreSelf->readOnlyTestObjAttr(); g_value_set_object(value, WebKit::kit(ptr.get())); - break; + break; } case PROP_INT_ATTR: { - g_value_set_long(value, coreSelf->intAttr()); - break; + g_value_set_long(value, coreSelf->intAttr()); + break; } case PROP_LONG_LONG_ATTR: { - g_value_set_int64(value, coreSelf->longLongAttr()); - break; + g_value_set_int64(value, coreSelf->longLongAttr()); + break; } case PROP_UNSIGNED_LONG_LONG_ATTR: { - g_value_set_uint64(value, coreSelf->unsignedLongLongAttr()); - break; + g_value_set_uint64(value, coreSelf->unsignedLongLongAttr()); + break; } case PROP_STRING_ATTR: { - g_value_take_string(value, convertToUTF8String(coreSelf->stringAttr())); - break; + g_value_take_string(value, convertToUTF8String(coreSelf->stringAttr())); + break; } case PROP_TEST_OBJ_ATTR: { - RefPtr<WebCore::TestObj> ptr = coreSelf->testObjAttr(); + RefPtr<WebCore::TestObj> ptr = coreSelf->testObjAttr(); g_value_set_object(value, WebKit::kit(ptr.get())); - break; + break; } case PROP_ATTR_WITH_EXCEPTION: { - g_value_set_long(value, coreSelf->attrWithException()); - break; + g_value_set_long(value, coreSelf->attrWithException()); + break; } case PROP_ATTR_WITH_SETTER_EXCEPTION: { - WebCore::ExceptionCode ec = 0; - g_value_set_long(value, coreSelf->attrWithSetterException(ec)); - break; + WebCore::ExceptionCode ec = 0; + g_value_set_long(value, coreSelf->attrWithSetterException(ec)); + break; } case PROP_ATTR_WITH_GETTER_EXCEPTION: { - g_value_set_long(value, coreSelf->attrWithGetterException()); - break; + g_value_set_long(value, coreSelf->attrWithGetterException()); + break; } case PROP_SCRIPT_STRING_ATTR: { - g_value_take_string(value, convertToUTF8String(coreSelf->scriptStringAttr())); - break; + g_value_take_string(value, convertToUTF8String(coreSelf->scriptStringAttr())); + break; + } + case PROP_DESCRIPTION: + { + g_value_set_long(value, coreSelf->description()); + break; + } + case PROP_ID: + { + g_value_set_long(value, coreSelf->id()); + break; } - default: + case PROP_HASH: + { + g_value_take_string(value, convertToUTF8String(coreSelf->hash())); + break; + } + default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; } @@ -720,21 +744,21 @@ static void webkit_dom_test_obj_class_init(WebKitDOMTestObjClass* requestClass) G_MAXLONG, /* max */ 0, /* default */ WEBKIT_PARAM_READABLE)); - g_object_class_install_property(gobjectClass, + g_object_class_install_property(gobjectClass, PROP_READ_ONLY_STRING_ATTR, g_param_spec_string("read-only-string-attr", /* name */ "test_obj_read-only-string-attr", /* short description */ "read-only gchar* TestObj.read-only-string-attr", /* longer - could do with some extra doc stuff here */ "", /* default */ WEBKIT_PARAM_READABLE)); - g_object_class_install_property(gobjectClass, + g_object_class_install_property(gobjectClass, PROP_READ_ONLY_TEST_OBJ_ATTR, g_param_spec_object("read-only-test-obj-attr", /* name */ "test_obj_read-only-test-obj-attr", /* short description */ "read-only WebKitDOMTestObj* TestObj.read-only-test-obj-attr", /* longer - could do with some extra doc stuff here */ WEBKIT_TYPE_DOM_TEST_OBJ, /* gobject type */ WEBKIT_PARAM_READABLE)); - g_object_class_install_property(gobjectClass, + g_object_class_install_property(gobjectClass, PROP_INT_ATTR, g_param_spec_long("int-attr", /* name */ "test_obj_int-attr", /* short description */ @@ -743,7 +767,7 @@ G_MAXLONG, /* max */ G_MAXLONG, /* max */ 0, /* default */ WEBKIT_PARAM_READWRITE)); - g_object_class_install_property(gobjectClass, + g_object_class_install_property(gobjectClass, PROP_LONG_LONG_ATTR, g_param_spec_int64("long-long-attr", /* name */ "test_obj_long-long-attr", /* short description */ @@ -752,7 +776,7 @@ G_MAXLONG, /* max */ G_MAXINT64, /* max */ 0, /* default */ WEBKIT_PARAM_READWRITE)); - g_object_class_install_property(gobjectClass, + g_object_class_install_property(gobjectClass, PROP_UNSIGNED_LONG_LONG_ATTR, g_param_spec_uint64("unsigned-long-long-attr", /* name */ "test_obj_unsigned-long-long-attr", /* short description */ @@ -761,21 +785,21 @@ G_MAXINT64, /* max */ G_MAXUINT64, /* min */ 0, /* default */ WEBKIT_PARAM_READWRITE)); - g_object_class_install_property(gobjectClass, + g_object_class_install_property(gobjectClass, PROP_STRING_ATTR, g_param_spec_string("string-attr", /* name */ "test_obj_string-attr", /* short description */ "read-write gchar* TestObj.string-attr", /* longer - could do with some extra doc stuff here */ "", /* default */ WEBKIT_PARAM_READWRITE)); - g_object_class_install_property(gobjectClass, + g_object_class_install_property(gobjectClass, PROP_TEST_OBJ_ATTR, g_param_spec_object("test-obj-attr", /* name */ "test_obj_test-obj-attr", /* short description */ "read-write WebKitDOMTestObj* TestObj.test-obj-attr", /* longer - could do with some extra doc stuff here */ WEBKIT_TYPE_DOM_TEST_OBJ, /* gobject type */ WEBKIT_PARAM_READWRITE)); - g_object_class_install_property(gobjectClass, + g_object_class_install_property(gobjectClass, PROP_ATTR_WITH_EXCEPTION, g_param_spec_long("attr-with-exception", /* name */ "test_obj_attr-with-exception", /* short description */ @@ -784,7 +808,7 @@ G_MAXUINT64, /* min */ G_MAXLONG, /* max */ 0, /* default */ WEBKIT_PARAM_READWRITE)); - g_object_class_install_property(gobjectClass, + g_object_class_install_property(gobjectClass, PROP_ATTR_WITH_SETTER_EXCEPTION, g_param_spec_long("attr-with-setter-exception", /* name */ "test_obj_attr-with-setter-exception", /* short description */ @@ -793,7 +817,7 @@ G_MAXLONG, /* max */ G_MAXLONG, /* max */ 0, /* default */ WEBKIT_PARAM_READWRITE)); - g_object_class_install_property(gobjectClass, + g_object_class_install_property(gobjectClass, PROP_ATTR_WITH_GETTER_EXCEPTION, g_param_spec_long("attr-with-getter-exception", /* name */ "test_obj_attr-with-getter-exception", /* short description */ @@ -802,13 +826,38 @@ G_MAXLONG, /* max */ G_MAXLONG, /* max */ 0, /* default */ WEBKIT_PARAM_READWRITE)); - g_object_class_install_property(gobjectClass, + g_object_class_install_property(gobjectClass, PROP_SCRIPT_STRING_ATTR, g_param_spec_string("script-string-attr", /* name */ "test_obj_script-string-attr", /* short description */ "read-only gchar* TestObj.script-string-attr", /* longer - could do with some extra doc stuff here */ "", /* default */ WEBKIT_PARAM_READABLE)); + g_object_class_install_property(gobjectClass, + PROP_DESCRIPTION, + g_param_spec_long("description", /* name */ + "test_obj_description", /* short description */ + "read-only glong TestObj.description", /* longer - could do with some extra doc stuff here */ + G_MINLONG, /* min */ +G_MAXLONG, /* max */ +0, /* default */ + WEBKIT_PARAM_READABLE)); + g_object_class_install_property(gobjectClass, + PROP_ID, + g_param_spec_long("id", /* name */ + "test_obj_id", /* short description */ + "read-write glong TestObj.id", /* longer - could do with some extra doc stuff here */ + G_MINLONG, /* min */ +G_MAXLONG, /* max */ +0, /* default */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, + PROP_HASH, + g_param_spec_string("hash", /* name */ + "test_obj_hash", /* short description */ + "read-only gchar* TestObj.hash", /* longer - could do with some extra doc stuff here */ + "", /* default */ + WEBKIT_PARAM_READABLE)); } diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h index 282edb8..ef5ccb8 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h @@ -47,34 +47,34 @@ WEBKIT_API GType webkit_dom_test_obj_get_type (void); WEBKIT_API void -webkit_dom_test_obj_void_method (WebKitDOMTestObj *self); +webkit_dom_test_obj_void_method(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_void_method_with_args (WebKitDOMTestObj *self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg); +webkit_dom_test_obj_void_method_with_args(WebKitDOMTestObj* self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg); WEBKIT_API glong -webkit_dom_test_obj_int_method (WebKitDOMTestObj *self); +webkit_dom_test_obj_int_method(WebKitDOMTestObj* self); WEBKIT_API glong -webkit_dom_test_obj_int_method_with_args (WebKitDOMTestObj *self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg); +webkit_dom_test_obj_int_method_with_args(WebKitDOMTestObj* self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg); WEBKIT_API WebKitDOMTestObj* -webkit_dom_test_obj_obj_method (WebKitDOMTestObj *self); +webkit_dom_test_obj_obj_method(WebKitDOMTestObj* self); WEBKIT_API WebKitDOMTestObj* -webkit_dom_test_obj_obj_method_with_args (WebKitDOMTestObj *self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg); +webkit_dom_test_obj_obj_method_with_args(WebKitDOMTestObj* self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg); WEBKIT_API WebKitDOMTestObj* -webkit_dom_test_obj_method_that_requires_all_args (WebKitDOMTestObj *self, gchar* str_arg, WebKitDOMTestObj* obj_arg); +webkit_dom_test_obj_method_that_requires_all_args(WebKitDOMTestObj* self, gchar* str_arg, WebKitDOMTestObj* obj_arg); WEBKIT_API WebKitDOMTestObj* -webkit_dom_test_obj_method_that_requires_all_args_and_throws (WebKitDOMTestObj *self, gchar* str_arg, WebKitDOMTestObj* obj_arg, GError **error); +webkit_dom_test_obj_method_that_requires_all_args_and_throws(WebKitDOMTestObj* self, gchar* str_arg, WebKitDOMTestObj* obj_arg, GError **error); WEBKIT_API void -webkit_dom_test_obj_serialized_value (WebKitDOMTestObj *self, WebKitDOMSerializedScriptValue* serialized_arg); +webkit_dom_test_obj_serialized_value(WebKitDOMTestObj* self, WebKitDOMSerializedScriptValue* serialized_arg); WEBKIT_API void -webkit_dom_test_obj_method_with_exception (WebKitDOMTestObj *self, GError **error); +webkit_dom_test_obj_method_with_exception(WebKitDOMTestObj* self, GError **error); /* TODO: event function webkit_dom_test_obj_add_event_listener */ @@ -83,100 +83,115 @@ webkit_dom_test_obj_method_with_exception (WebKitDOMTestObj *self, GError **erro /* TODO: event function webkit_dom_test_obj_remove_event_listener */ WEBKIT_API void -webkit_dom_test_obj_with_dynamic_frame (WebKitDOMTestObj *self); +webkit_dom_test_obj_with_dynamic_frame(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_with_dynamic_frame_and_arg (WebKitDOMTestObj *self, glong int_arg); +webkit_dom_test_obj_with_dynamic_frame_and_arg(WebKitDOMTestObj* self, glong int_arg); WEBKIT_API void -webkit_dom_test_obj_with_dynamic_frame_and_optional_arg (WebKitDOMTestObj *self, glong int_arg, glong optional_arg); +webkit_dom_test_obj_with_dynamic_frame_and_optional_arg(WebKitDOMTestObj* self, glong int_arg, glong optional_arg); WEBKIT_API void -webkit_dom_test_obj_with_dynamic_frame_and_user_gesture (WebKitDOMTestObj *self, glong int_arg); +webkit_dom_test_obj_with_dynamic_frame_and_user_gesture(WebKitDOMTestObj* self, glong int_arg); WEBKIT_API void -webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad (WebKitDOMTestObj *self, glong int_arg, glong optional_arg); +webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad(WebKitDOMTestObj* self, glong int_arg, glong optional_arg); WEBKIT_API void -webkit_dom_test_obj_with_script_state_void (WebKitDOMTestObj *self); +webkit_dom_test_obj_with_script_state_void(WebKitDOMTestObj* self); WEBKIT_API WebKitDOMTestObj* -webkit_dom_test_obj_with_script_state_obj (WebKitDOMTestObj *self); +webkit_dom_test_obj_with_script_state_obj(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_with_script_state_void_exception (WebKitDOMTestObj *self, GError **error); +webkit_dom_test_obj_with_script_state_void_exception(WebKitDOMTestObj* self, GError **error); WEBKIT_API WebKitDOMTestObj* -webkit_dom_test_obj_with_script_state_obj_exception (WebKitDOMTestObj *self, GError **error); +webkit_dom_test_obj_with_script_state_obj_exception(WebKitDOMTestObj* self, GError **error); WEBKIT_API void -webkit_dom_test_obj_method_with_optional_arg (WebKitDOMTestObj *self, glong opt); +webkit_dom_test_obj_with_script_execution_context(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_method_with_non_optional_arg_and_optional_arg (WebKitDOMTestObj *self, glong non_opt, glong opt); +webkit_dom_test_obj_method_with_optional_arg(WebKitDOMTestObj* self, glong opt); WEBKIT_API void -webkit_dom_test_obj_method_with_non_optional_arg_and_two_optional_args (WebKitDOMTestObj *self, glong non_opt, glong opt1, glong opt2); +webkit_dom_test_obj_method_with_non_optional_arg_and_optional_arg(WebKitDOMTestObj* self, glong non_opt, glong opt); + +WEBKIT_API void +webkit_dom_test_obj_method_with_non_optional_arg_and_two_optional_args(WebKitDOMTestObj* self, glong non_opt, glong opt1, glong opt2); WEBKIT_API glong -webkit_dom_test_obj_get_read_only_int_attr (WebKitDOMTestObj *self); +webkit_dom_test_obj_get_read_only_int_attr(WebKitDOMTestObj* self); WEBKIT_API gchar* -webkit_dom_test_obj_get_read_only_string_attr (WebKitDOMTestObj *self); +webkit_dom_test_obj_get_read_only_string_attr(WebKitDOMTestObj* self); WEBKIT_API WebKitDOMTestObj* -webkit_dom_test_obj_get_read_only_test_obj_attr (WebKitDOMTestObj *self); +webkit_dom_test_obj_get_read_only_test_obj_attr(WebKitDOMTestObj* self); WEBKIT_API glong -webkit_dom_test_obj_get_int_attr (WebKitDOMTestObj *self); +webkit_dom_test_obj_get_int_attr(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_set_int_attr (WebKitDOMTestObj *self, glong value); +webkit_dom_test_obj_set_int_attr(WebKitDOMTestObj* self, glong value); WEBKIT_API gint64 -webkit_dom_test_obj_get_long_long_attr (WebKitDOMTestObj *self); +webkit_dom_test_obj_get_long_long_attr(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_set_long_long_attr (WebKitDOMTestObj *self, gint64 value); +webkit_dom_test_obj_set_long_long_attr(WebKitDOMTestObj* self, gint64 value); WEBKIT_API guint64 -webkit_dom_test_obj_get_unsigned_long_long_attr (WebKitDOMTestObj *self); +webkit_dom_test_obj_get_unsigned_long_long_attr(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_set_unsigned_long_long_attr (WebKitDOMTestObj *self, guint64 value); +webkit_dom_test_obj_set_unsigned_long_long_attr(WebKitDOMTestObj* self, guint64 value); WEBKIT_API gchar* -webkit_dom_test_obj_get_string_attr (WebKitDOMTestObj *self); +webkit_dom_test_obj_get_string_attr(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_set_string_attr (WebKitDOMTestObj *self, gchar* value); +webkit_dom_test_obj_set_string_attr(WebKitDOMTestObj* self, gchar* value); WEBKIT_API WebKitDOMTestObj* -webkit_dom_test_obj_get_test_obj_attr (WebKitDOMTestObj *self); +webkit_dom_test_obj_get_test_obj_attr(WebKitDOMTestObj* self); + +WEBKIT_API void +webkit_dom_test_obj_set_test_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value); + +WEBKIT_API glong +webkit_dom_test_obj_get_attr_with_exception(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_set_test_obj_attr (WebKitDOMTestObj *self, WebKitDOMTestObj* value); +webkit_dom_test_obj_set_attr_with_exception(WebKitDOMTestObj* self, glong value); WEBKIT_API glong -webkit_dom_test_obj_get_attr_with_exception (WebKitDOMTestObj *self); +webkit_dom_test_obj_get_attr_with_setter_exception(WebKitDOMTestObj* self, GError **error); WEBKIT_API void -webkit_dom_test_obj_set_attr_with_exception (WebKitDOMTestObj *self, glong value); +webkit_dom_test_obj_set_attr_with_setter_exception(WebKitDOMTestObj* self, glong value, GError **error); WEBKIT_API glong -webkit_dom_test_obj_get_attr_with_setter_exception (WebKitDOMTestObj *self, GError **error); +webkit_dom_test_obj_get_attr_with_getter_exception(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_set_attr_with_setter_exception (WebKitDOMTestObj *self, glong value, GError **error); +webkit_dom_test_obj_set_attr_with_getter_exception(WebKitDOMTestObj* self, glong value, GError **error); + +WEBKIT_API gchar* +webkit_dom_test_obj_get_script_string_attr(WebKitDOMTestObj* self); + +WEBKIT_API glong +webkit_dom_test_obj_get_description(WebKitDOMTestObj* self); WEBKIT_API glong -webkit_dom_test_obj_get_attr_with_getter_exception (WebKitDOMTestObj *self); +webkit_dom_test_obj_get_id(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_set_attr_with_getter_exception (WebKitDOMTestObj *self, glong value, GError **error); +webkit_dom_test_obj_set_id(WebKitDOMTestObj* self, glong value); WEBKIT_API gchar* -webkit_dom_test_obj_get_script_string_attr (WebKitDOMTestObj *self); +webkit_dom_test_obj_get_hash(WebKitDOMTestObj* self); G_END_DECLS diff --git a/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp b/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp index a230aef..693a48b 100644 --- a/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp +++ b/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp @@ -78,12 +78,12 @@ public: protected: static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | DOMConstructorObject::StructureFlags; - static JSObject* constructTestInterface(ExecState* exec, JSObject* constructor, const ArgList&) + static EncodedJSValue JSC_HOST_CALL constructTestInterface(ExecState* exec) { - ScriptExecutionContext* context = static_cast<JSTestInterfaceConstructor*>(constructor)->scriptExecutionContext(); + ScriptExecutionContext* context = static_cast<JSTestInterfaceConstructor*>(exec->callee())->scriptExecutionContext(); if (!context) - return throwError(exec, ReferenceError); - return asObject(toJS(exec, static_cast<JSTestInterfaceConstructor*>(constructor)->globalObject(), TestInterface::create(context))); + return throwVMError(exec, createReferenceError(exec, "Reference error")); + return JSValue::encode(asObject(toJS(exec, static_cast<JSTestInterfaceConstructor*>(exec->callee())->globalObject(), TestInterface::create(context)))); } virtual ConstructType getConstructData(ConstructData& constructData) { diff --git a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp index 1e563c6..09b69cd 100644 --- a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp +++ b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp @@ -46,7 +46,7 @@ ASSERT_CLASS_FITS_IN_CELL(JSTestObj); #define THUNK_GENERATOR(generator) #endif -static const HashTableValue JSTestObjTableValues[15] = +static const HashTableValue JSTestObjTableValues[18] = { { "readOnlyIntAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyIntAttr), (intptr_t)0 THUNK_GENERATOR(0) }, { "readOnlyStringAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyStringAttr), (intptr_t)0 THUNK_GENERATOR(0) }, @@ -61,12 +61,15 @@ static const HashTableValue JSTestObjTableValues[15] = { "attrWithGetterException", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttrWithGetterException), (intptr_t)setJSTestObjAttrWithGetterException THUNK_GENERATOR(0) }, { "customAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCustomAttr), (intptr_t)setJSTestObjCustomAttr THUNK_GENERATOR(0) }, { "scriptStringAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjScriptStringAttr), (intptr_t)0 THUNK_GENERATOR(0) }, + { "description", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjDescription), (intptr_t)0 THUNK_GENERATOR(0) }, + { "id", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjId), (intptr_t)setJSTestObjId THUNK_GENERATOR(0) }, + { "hash", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjHash), (intptr_t)0 THUNK_GENERATOR(0) }, { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, { 0, 0, 0, 0 THUNK_GENERATOR(0) } }; #undef THUNK_GENERATOR -static JSC_CONST_HASHTABLE HashTable JSTestObjTable = { 34, 31, JSTestObjTableValues, 0 }; +static JSC_CONST_HASHTABLE HashTable JSTestObjTable = { 65, 63, JSTestObjTableValues, 0 }; /* Hash table for constructor */ #if ENABLE(JIT) #define THUNK_GENERATOR(generator) , generator @@ -121,7 +124,7 @@ bool JSTestObjConstructor::getOwnPropertyDescriptor(ExecState* exec, const Ident #define THUNK_GENERATOR(generator) #endif -static const HashTableValue JSTestObjPrototypeTableValues[29] = +static const HashTableValue JSTestObjPrototypeTableValues[30] = { { "voidMethod", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionVoidMethod), (intptr_t)0 THUNK_GENERATOR(0) }, { "voidMethodWithArgs", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionVoidMethodWithArgs), (intptr_t)3 THUNK_GENERATOR(0) }, @@ -147,6 +150,7 @@ static const HashTableValue JSTestObjPrototypeTableValues[29] = { "withScriptStateObj", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptStateObj), (intptr_t)0 THUNK_GENERATOR(0) }, { "withScriptStateVoidException", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptStateVoidException), (intptr_t)0 THUNK_GENERATOR(0) }, { "withScriptStateObjException", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptStateObjException), (intptr_t)0 THUNK_GENERATOR(0) }, + { "withScriptExecutionContext", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptExecutionContext), (intptr_t)0 THUNK_GENERATOR(0) }, { "methodWithOptionalArg", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalArg), (intptr_t)1 THUNK_GENERATOR(0) }, { "methodWithNonOptionalArgAndOptionalArg", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg), (intptr_t)2 THUNK_GENERATOR(0) }, { "methodWithNonOptionalArgAndTwoOptionalArgs", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs), (intptr_t)3 THUNK_GENERATOR(0) }, @@ -316,6 +320,33 @@ JSValue jsTestObjScriptStringAttr(ExecState* exec, JSValue slotBase, const Ident return result; } +JSValue jsTestObjDescription(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsNumber(exec, imp->description()); + return result; +} + +JSValue jsTestObjId(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsNumber(exec, imp->id()); + return result; +} + +JSValue jsTestObjHash(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsString(exec, imp->hash()); + return result; +} + JSValue jsTestObjConstructor(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* domObject = static_cast<JSTestObj*>(asObject(slotBase)); @@ -391,28 +422,35 @@ void setJSTestObjCustomAttr(ExecState* exec, JSObject* thisObject, JSValue value static_cast<JSTestObj*>(thisObject)->setCustomAttr(exec, value); } +void setJSTestObjId(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + imp->setId(value.toInt32(exec)); +} + JSValue JSTestObj::getConstructor(ExecState* exec, JSGlobalObject* globalObject) { return getDOMConstructor<JSTestObjConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethod(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethod(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); imp->voidMethod(); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); int intArg = exec->argument(0).toInt32(exec); @@ -420,27 +458,27 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(ExecState* ex TestObj* objArg = toTestObj(exec->argument(2)); imp->voidMethodWithArgs(intArg, strArg, objArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethod(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethod(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); JSC::JSValue result = jsNumber(exec, imp->intMethod()); - return result; + return JSValue::encode(result); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); int intArg = exec->argument(0).toInt32(exec); @@ -449,27 +487,27 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(ExecState* exe JSC::JSValue result = jsNumber(exec, imp->intMethodWithArgs(intArg, strArg, objArg)); - return result; + return JSValue::encode(result); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethod(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethod(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->objMethod())); - return result; + return JSValue::encode(result); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); int intArg = exec->argument(0).toInt32(exec); @@ -478,35 +516,35 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(ExecState* exe JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->objMethodWithArgs(intArg, strArg, objArg))); - return result; + return JSValue::encode(result); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgs(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgs(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); if (exec->argumentCount() < 2) - return jsUndefined(); + return JSValue::encode(jsUndefined()); const String& strArg = ustringToString(exec->argument(0).toString(exec)); TestObj* objArg = toTestObj(exec->argument(1)); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->methodThatRequiresAllArgs(strArg, objArg))); - return result; + return JSValue::encode(result); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); if (exec->argumentCount() < 2) - return throwError(exec, SyntaxError, "Not enough arguments"); + return throwVMError(exec, createSyntaxError(exec, "Not enough arguments")); ExceptionCode ec = 0; const String& strArg = ustringToString(exec->argument(0).toString(exec)); TestObj* objArg = toTestObj(exec->argument(1)); @@ -514,59 +552,59 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThro JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->methodThatRequiresAllArgsAndThrows(strArg, objArg, ec))); setDOMException(exec, ec); - return result; + return JSValue::encode(result); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); RefPtr<SerializedScriptValue> serializedArg = SerializedScriptValue::create(exec, exec->argument(0)); imp->serializedValue(serializedArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithException(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithException(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); ExceptionCode ec = 0; imp->methodWithException(ec); setDOMException(exec, ec); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethod(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethod(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); - return castedThis->customMethod(exec); + return JSValue::encode(castedThis->customMethod(exec)); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethodWithArgs(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethodWithArgs(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); - return castedThis->customMethodWithArgs(exec); + return JSValue::encode(castedThis->customMethodWithArgs(exec)); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); ExceptionCode ec = 0; @@ -575,178 +613,178 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(ExecState imp->customArgsAndException(intArg, &callStack, ec); setDOMException(exec, ec); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAddEventListener(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAddEventListener(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); JSValue listener = exec->argument(1); if (!listener.isObject()) - return jsUndefined(); + return JSValue::encode(jsUndefined()); imp->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), exec->argument(2).toBoolean(exec)); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionRemoveEventListener(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionRemoveEventListener(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); JSValue listener = exec->argument(1); if (!listener.isObject()) - return jsUndefined(); + return JSValue::encode(jsUndefined()); imp->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec)); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); Frame* dynamicFrame = toDynamicFrame(exec); if (!dynamicFrame) - return jsUndefined(); + return JSValue::encode(jsUndefined()); imp->withDynamicFrame(dynamicFrame); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); Frame* dynamicFrame = toDynamicFrame(exec); if (!dynamicFrame) - return jsUndefined(); - int intArg = exec->argument(1).toInt32(exec); + return JSValue::encode(jsUndefined()); + int intArg = exec->argument(0).toInt32(exec); imp->withDynamicFrameAndArg(dynamicFrame, intArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); Frame* dynamicFrame = toDynamicFrame(exec); if (!dynamicFrame) - return jsUndefined(); - int intArg = exec->argument(1).toInt32(exec); + return JSValue::encode(jsUndefined()); + int intArg = exec->argument(0).toInt32(exec); int argsCount = exec->argumentCount(); - if (argsCount < 3) { + if (argsCount < 2) { imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } - int optionalArg = exec->argument(2).toInt32(exec); + int optionalArg = exec->argument(1).toInt32(exec); imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg, optionalArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); Frame* dynamicFrame = toDynamicFrame(exec); if (!dynamicFrame) - return jsUndefined(); - int intArg = exec->argument(1).toInt32(exec); + return JSValue::encode(jsUndefined()); + int intArg = exec->argument(0).toInt32(exec); imp->withDynamicFrameAndUserGesture(dynamicFrame, intArg, processingUserGesture(exec)); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); Frame* dynamicFrame = toDynamicFrame(exec); if (!dynamicFrame) - return jsUndefined(); - int intArg = exec->argument(1).toInt32(exec); + return JSValue::encode(jsUndefined()); + int intArg = exec->argument(0).toInt32(exec); int argsCount = exec->argumentCount(); - if (argsCount < 3) { + if (argsCount < 2) { imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } - int optionalArg = exec->argument(2).toInt32(exec); + int optionalArg = exec->argument(1).toInt32(exec); imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg, optionalArg, processingUserGesture(exec)); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoid(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoid(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); imp->withScriptStateVoid(exec); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObj(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObj(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->withScriptStateObj(exec))); if (exec->hadException()) - return jsUndefined(); - return result; + return JSValue::encode(jsUndefined()); + return JSValue::encode(result); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoidException(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoidException(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); ExceptionCode ec = 0; imp->withScriptStateVoidException(exec, ec); setDOMException(exec, ec); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); ExceptionCode ec = 0; @@ -755,35 +793,50 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(Exec JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->withScriptStateObjException(exec, ec))); setDOMException(exec, ec); if (exec->hadException()) - return jsUndefined(); - return result; + return JSValue::encode(jsUndefined()); + return JSValue::encode(result); +} + +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptExecutionContext(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwVMTypeError(exec); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext(); + if (!scriptContext) + return JSValue::encode(jsUndefined()); + + imp->withScriptExecutionContext(scriptContext); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); int argsCount = exec->argumentCount(); if (argsCount < 1) { imp->methodWithOptionalArg(); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } int opt = exec->argument(0).toInt32(exec); imp->methodWithOptionalArg(opt); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); int nonOpt = exec->argument(0).toInt32(exec); @@ -791,20 +844,20 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptio int argsCount = exec->argumentCount(); if (argsCount < 2) { imp->methodWithNonOptionalArgAndOptionalArg(nonOpt); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } int opt = exec->argument(1).toInt32(exec); imp->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); int nonOpt = exec->argument(0).toInt32(exec); @@ -812,35 +865,35 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOp int argsCount = exec->argumentCount(); if (argsCount < 2) { imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } int opt1 = exec->argument(1).toInt32(exec); int opt2 = exec->argument(2).toInt32(exec); imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod1(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod1(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); TestObj* objArg = toTestObj(exec->argument(0)); const String& strArg = ustringToString(exec->argument(1).toString(exec)); imp->overloadedMethod(objArg, strArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); TestObj* objArg = toTestObj(exec->argument(0)); @@ -848,52 +901,52 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2(ExecState* exe int argsCount = exec->argumentCount(); if (argsCount < 2) { imp->overloadedMethod(objArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } int intArg = exec->argument(1).toInt32(exec); imp->overloadedMethod(objArg, intArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod3(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod3(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); const String& strArg = ustringToString(exec->argument(0).toString(exec)); imp->overloadedMethod(strArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod4(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod4(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); int intArg = exec->argument(0).toInt32(exec); imp->overloadedMethod(intArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(ExecState* exec) { - if ((exec->argumentCount() == 2 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(JSTestObj::s_info) && (exec->argument(1).isNull() || exec->argument(1).isUndefined() || exec->argument(1).isString() || exec->argument(1).isObject()))) + if ((exec->argumentCount() == 2 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(&JSTestObj::s_info)) && (exec->argument(1).isNull() || exec->argument(1).isUndefined() || exec->argument(1).isString() || exec->argument(1).isObject()))) return jsTestObjPrototypeFunctionOverloadedMethod1(exec); - if ((exec->argumentCount() == 1 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(JSTestObj::s_info)) || (exec->argumentCount() == 2 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(JSTestObj::s_info))) + if ((exec->argumentCount() == 1 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(&JSTestObj::s_info))) || (exec->argumentCount() == 2 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(&JSTestObj::s_info)))) return jsTestObjPrototypeFunctionOverloadedMethod2(exec); if ((exec->argumentCount() == 1 && (exec->argument(0).isNull() || exec->argument(0).isUndefined() || exec->argument(0).isString() || exec->argument(0).isObject()))) return jsTestObjPrototypeFunctionOverloadedMethod3(exec); if (exec->argumentCount() == 1) return jsTestObjPrototypeFunctionOverloadedMethod4(exec); - return throwError(exec, TypeError); + return throwTypeError(exec); } JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestObj* object) diff --git a/WebCore/bindings/scripts/test/JS/JSTestObj.h b/WebCore/bindings/scripts/test/JS/JSTestObj.h index 38cf8c2..dd84005 100644 --- a/WebCore/bindings/scripts/test/JS/JSTestObj.h +++ b/WebCore/bindings/scripts/test/JS/JSTestObj.h @@ -86,34 +86,35 @@ protected: // Functions -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethod(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethod(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethod(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgs(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithException(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethod(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethodWithArgs(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAddEventListener(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionRemoveEventListener(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoid(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObj(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoidException(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethod(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethod(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethod(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgs(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithException(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethod(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethodWithArgs(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAddEventListener(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionRemoveEventListener(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoid(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObj(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoidException(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptExecutionContext(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(JSC::ExecState*); // Attributes JSC::JSValue jsTestObjReadOnlyIntAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); @@ -138,6 +139,10 @@ void setJSTestObjAttrWithGetterException(JSC::ExecState*, JSC::JSObject*, JSC::J JSC::JSValue jsTestObjCustomAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); void setJSTestObjCustomAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjScriptStringAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +JSC::JSValue jsTestObjDescription(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +JSC::JSValue jsTestObjId(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjId(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjHash(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); JSC::JSValue jsTestObjConstructor(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); } // namespace WebCore diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h index 247f4a3..6b50246 100644 --- a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h +++ b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h @@ -56,6 +56,10 @@ - (int)customAttr; - (void)setCustomAttr:(int)newCustomAttr; - (NSString *)scriptStringAttr; +- (int)descriptionName; +- (int)idName; +- (void)setIdName:(int)newIdName; +- (NSString *)hashName; - (void)voidMethod; - (void)voidMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg; - (int)intMethod; @@ -80,6 +84,7 @@ - (DOMTestObj *)withScriptStateObj; - (void)withScriptStateVoidException; - (DOMTestObj *)withScriptStateObjException; +- (void)withScriptExecutionContext; - (void)methodWithOptionalArg:(int)opt; - (void)methodWithNonOptionalArgAndOptionalArg:(int)nonOpt opt:(int)opt; - (void)methodWithNonOptionalArgAndTwoOptionalArgs:(int)nonOpt opt1:(int)opt1 opt2:(int)opt2; diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm index 0f3fb66..e57ed87 100644 --- a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm +++ b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm @@ -212,6 +212,30 @@ return IMPL->scriptStringAttr(); } +- (int)descriptionName +{ + WebCore::JSMainThreadNullState state; + return IMPL->description(); +} + +- (int)idName +{ + WebCore::JSMainThreadNullState state; + return IMPL->id(); +} + +- (void)setIdName:(int)newIdName +{ + WebCore::JSMainThreadNullState state; + IMPL->setId(newIdName); +} + +- (NSString *)hashName +{ + WebCore::JSMainThreadNullState state; + return IMPL->hash(); +} + - (void)voidMethod { WebCore::JSMainThreadNullState state; @@ -370,6 +394,12 @@ return result; } +- (void)withScriptExecutionContext +{ + WebCore::JSMainThreadNullState state; + IMPL->withScriptExecutionContext(); +} + - (void)methodWithOptionalArg:(int)opt { WebCore::JSMainThreadNullState state; diff --git a/WebCore/bindings/scripts/test/TestObj.idl b/WebCore/bindings/scripts/test/TestObj.idl index bda2586..1cb004c 100644 --- a/WebCore/bindings/scripts/test/TestObj.idl +++ b/WebCore/bindings/scripts/test/TestObj.idl @@ -87,6 +87,7 @@ module test { raises(DOMException); [CallWith=ScriptState] TestObj withScriptStateObjException() raises(DOMException); + [CallWith=ScriptExecutionContext] void withScriptExecutionContext(); // 'Optional' extended attribute void methodWithOptionalArg(in [Optional] long opt); @@ -103,5 +104,10 @@ module test { void overloadedMethod(in DOMString strArg); void overloadedMethod(in long intArg); #endif + + // ObjectiveC reserved words. + readonly attribute long description; + attribute long id; + readonly attribute DOMString hash; }; } diff --git a/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp b/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp index e8be71d..fef199a 100644 --- a/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp +++ b/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp @@ -29,6 +29,8 @@ #include "V8CustomVoidCallback.h" #include "V8DOMString.h" +#include <wtf/Assertions.h> + namespace WebCore { V8TestCallback::V8TestCallback(v8::Local<v8::Object> callback) @@ -54,8 +56,14 @@ bool V8TestCallback::callbackWithClass1Param(ScriptExecutionContext* context, Cl v8::Context::Scope scope(v8Context); + v8::Handle<v8::Value> class1ParamHandle = toV8(class1Param); + if (class1ParamHandle.IsEmpty()) { + CRASH(); + return true; + } + v8::Handle<v8::Value> argv[] = { - toV8(class1Param) + class1ParamHandle }; bool callbackReturnValue = false; @@ -72,9 +80,20 @@ bool V8TestCallback::callbackWithClass2Param(ScriptExecutionContext* context, Cl v8::Context::Scope scope(v8Context); + v8::Handle<v8::Value> class2ParamHandle = toV8(class2Param); + if (class2ParamHandle.IsEmpty()) { + CRASH(); + return true; + } + v8::Handle<v8::Value> strArgHandle = toV8(strArg); + if (strArgHandle.IsEmpty()) { + CRASH(); + return true; + } + v8::Handle<v8::Value> argv[] = { - toV8(class2Param), - toV8(strArg) + class2ParamHandle, + strArgHandle }; bool callbackReturnValue = false; diff --git a/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp index 449e086..69c57bb 100644 --- a/WebCore/bindings/scripts/test/V8/V8TestObj.cpp +++ b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp @@ -218,6 +218,36 @@ static v8::Handle<v8::Value> scriptStringAttrAttrGetter(v8::Local<v8::String> na return v8StringOrNull(imp->scriptStringAttr()); } +static v8::Handle<v8::Value> descriptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.description._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return v8::Integer::New(imp->description()); +} + +static v8::Handle<v8::Value> idAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.id._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return v8::Integer::New(imp->id()); +} + +static void idAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.id._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + int v = toInt32(value); + imp->setId(v); + return; +} + +static v8::Handle<v8::Value> hashAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.hash._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return v8String(imp->hash()); +} + static v8::Handle<v8::Value> voidMethodCallback(const v8::Arguments& args) { INC_STATS("DOM.TestObj.voidMethod"); @@ -507,6 +537,17 @@ static v8::Handle<v8::Value> withScriptStateObjExceptionCallback(const v8::Argum return v8::Handle<v8::Value>(); } +static v8::Handle<v8::Value> withScriptExecutionContextCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.withScriptExecutionContext"); + TestObj* imp = V8TestObj::toNative(args.Holder()); + ScriptExecutionContext* scriptContext = getScriptExecutionContext(); + if (!scriptContext) + return v8::Undefined(); + imp->withScriptExecutionContext(scriptContext); + return v8::Handle<v8::Value>(); +} + static v8::Handle<v8::Value> methodWithOptionalArgCallback(const v8::Arguments& args) { INC_STATS("DOM.TestObj.methodWithOptionalArg"); @@ -635,6 +676,12 @@ static const BatchedAttribute TestObjAttrs[] = { {"customAttr", V8TestObj::customAttrAccessorGetter, V8TestObj::customAttrAccessorSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'scriptStringAttr' (Type: 'readonly attribute' ExtAttr: 'ConvertScriptString') {"scriptStringAttr", TestObjInternal::scriptStringAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'description' (Type: 'readonly attribute' ExtAttr: '') + {"description", TestObjInternal::descriptionAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'id' (Type: 'attribute' ExtAttr: '') + {"id", TestObjInternal::idAttrGetter, TestObjInternal::idAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'hash' (Type: 'readonly attribute' ExtAttr: '') + {"hash", TestObjInternal::hashAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, }; static const BatchedCallback TestObjCallbacks[] = { {"voidMethod", TestObjInternal::voidMethodCallback}, @@ -655,6 +702,7 @@ static const BatchedCallback TestObjCallbacks[] = { {"withScriptStateObj", TestObjInternal::withScriptStateObjCallback}, {"withScriptStateVoidException", TestObjInternal::withScriptStateVoidExceptionCallback}, {"withScriptStateObjException", TestObjInternal::withScriptStateObjExceptionCallback}, + {"withScriptExecutionContext", TestObjInternal::withScriptExecutionContextCallback}, {"methodWithOptionalArg", TestObjInternal::methodWithOptionalArgCallback}, {"methodWithNonOptionalArgAndOptionalArg", TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback}, {"methodWithNonOptionalArgAndTwoOptionalArgs", TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback}, diff --git a/WebCore/bindings/v8/NPV8Object.cpp b/WebCore/bindings/v8/NPV8Object.cpp index d8076f3..af0933f 100644 --- a/WebCore/bindings/v8/NPV8Object.cpp +++ b/WebCore/bindings/v8/NPV8Object.cpp @@ -49,7 +49,6 @@ #endif #include <stdio.h> -#include <v8.h> #include <wtf/StringExtras.h> using namespace WebCore; diff --git a/WebCore/bindings/v8/ScriptArray.cpp b/WebCore/bindings/v8/ScriptArray.cpp index 01b0898..a199a6c 100644 --- a/WebCore/bindings/v8/ScriptArray.cpp +++ b/WebCore/bindings/v8/ScriptArray.cpp @@ -39,8 +39,6 @@ #include "V8Binding.h" #include "V8Proxy.h" -#include <v8.h> - namespace WebCore { ScriptArray::ScriptArray(ScriptState* scriptState, v8::Handle<v8::Array> v8Array) diff --git a/WebCore/bindings/v8/ScriptCallStack.cpp b/WebCore/bindings/v8/ScriptCallStack.cpp index 31b05ee..89809b2 100644 --- a/WebCore/bindings/v8/ScriptCallStack.cpp +++ b/WebCore/bindings/v8/ScriptCallStack.cpp @@ -37,7 +37,6 @@ #include "V8Binding.h" #include <v8-debug.h> -#include <v8.h> namespace WebCore { diff --git a/WebCore/bindings/v8/ScriptController.cpp b/WebCore/bindings/v8/ScriptController.cpp index f6cf3a4..d3ec33f 100644 --- a/WebCore/bindings/v8/ScriptController.cpp +++ b/WebCore/bindings/v8/ScriptController.cpp @@ -469,10 +469,12 @@ void ScriptController::updateDocument() void ScriptController::namedItemAdded(HTMLDocument* doc, const AtomicString& name) { + m_proxy->windowShell()->namedItemAdded(doc, name); } void ScriptController::namedItemRemoved(HTMLDocument* doc, const AtomicString& name) { + m_proxy->windowShell()->namedItemRemoved(doc, name); } } // namespace WebCore diff --git a/WebCore/bindings/v8/ScriptDebugServer.cpp b/WebCore/bindings/v8/ScriptDebugServer.cpp index fdbb26b..39e409e 100644 --- a/WebCore/bindings/v8/ScriptDebugServer.cpp +++ b/WebCore/bindings/v8/ScriptDebugServer.cpp @@ -256,6 +256,40 @@ void ScriptDebugServer::stepOutOfFunction() #endif } +bool ScriptDebugServer::editScriptSource(const String& sourceID, const String& newContent, String& newSourceOrErrorMessage) +{ +#if ENABLE(V8_SCRIPT_DEBUG_SERVER) + ensureDebuggerScriptCompiled(); + v8::HandleScope scope; + + OwnPtr<v8::Context::Scope> contextScope; + if (!m_pausedPage) + contextScope.set(new v8::Context::Scope(v8::Debug::GetDebugContext())); + + v8::Handle<v8::Function> function = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("editScriptSource"))); + v8::Handle<v8::Value> argv[] = { v8String(sourceID), v8String(newContent) }; + + v8::TryCatch tryCatch; + tryCatch.SetVerbose(false); + v8::Handle<v8::Value> result = function->Call(m_debuggerScript.get(), 2, argv); + if (tryCatch.HasCaught()) { + v8::Local<v8::Message> message = tryCatch.Message(); + if (!message.IsEmpty()) + newSourceOrErrorMessage = toWebCoreStringWithNullOrUndefinedCheck(message->Get()); + return false; + } + ASSERT(!result.IsEmpty()); + newSourceOrErrorMessage = toWebCoreStringWithNullOrUndefinedCheck(result); + + // Call stack may have changed after if the edited function was on the stack. + if (m_currentCallFrame) + m_currentCallFrame.clear(); + return true; +#else + return false; +#endif +} + PassRefPtr<JavaScriptCallFrame> ScriptDebugServer::currentCallFrame() { if (!m_currentCallFrame) { @@ -267,6 +301,11 @@ PassRefPtr<JavaScriptCallFrame> ScriptDebugServer::currentCallFrame() return m_currentCallFrame; } +bool ScriptDebugServer::isDebuggerAlwaysEnabled() +{ + return true; +} + #if ENABLE(V8_SCRIPT_DEBUG_SERVER) void ScriptDebugServer::v8DebugEventCallback(const v8::Debug::EventDetails& eventDetails) { @@ -320,7 +359,8 @@ void ScriptDebugServer::dispatchDidParseSource(ScriptDebugListener* listener, v8 toWebCoreStringWithNullOrUndefinedCheck(object->Get(v8::String::New("id"))), toWebCoreStringWithNullOrUndefinedCheck(object->Get(v8::String::New("name"))), toWebCoreStringWithNullOrUndefinedCheck(object->Get(v8::String::New("source"))), - object->Get(v8::String::New("lineOffset"))->ToInteger()->Value()); + object->Get(v8::String::New("lineOffset"))->ToInteger()->Value(), + static_cast<ScriptWorldType>(object->Get(v8::String::New("scriptWorldType"))->Int32Value())); } void ScriptDebugServer::ensureDebuggerScriptCompiled() diff --git a/WebCore/bindings/v8/ScriptDebugServer.h b/WebCore/bindings/v8/ScriptDebugServer.h index 7c8c5cc..9439c16 100644 --- a/WebCore/bindings/v8/ScriptDebugServer.h +++ b/WebCore/bindings/v8/ScriptDebugServer.h @@ -74,6 +74,8 @@ public: void stepOverStatement(); void stepOutOfFunction(); + bool editScriptSource(const String& sourceID, const String& newContent, String& newSourceOrErrorMessage); + void recompileAllJSFunctionsSoon() { } void recompileAllJSFunctions(Timer<ScriptDebugServer>* = 0) { } @@ -92,6 +94,8 @@ public: PassRefPtr<JavaScriptCallFrame> currentCallFrame(); + bool isDebuggerAlwaysEnabled(); + private: ScriptDebugServer(); ~ScriptDebugServer() { } diff --git a/WebCore/bindings/v8/ScriptEventListener.cpp b/WebCore/bindings/v8/ScriptEventListener.cpp index cad7a1c..57a2824 100644 --- a/WebCore/bindings/v8/ScriptEventListener.cpp +++ b/WebCore/bindings/v8/ScriptEventListener.cpp @@ -36,7 +36,7 @@ #include "EventListener.h" #include "Frame.h" #include "ScriptScope.h" -#include "Tokenizer.h" +#include "DocumentParser.h" #include "V8AbstractEventListener.h" #include "V8Binding.h" #include "XSSAuditor.h" @@ -64,10 +64,10 @@ PassRefPtr<V8LazyEventListener> createAttributeEventListener(Node* node, Attribu return 0; } - if (frame->document()->tokenizer()) { + if (frame->document()->parser()) { // FIXME: Change to use script->eventHandlerLineNumber() when implemented. - lineNumber = frame->document()->tokenizer()->lineNumber(); - columnNumber = frame->document()->tokenizer()->columnNumber(); + lineNumber = frame->document()->parser()->lineNumber(); + columnNumber = frame->document()->parser()->columnNumber(); } sourceURL = node->document()->url().string(); } @@ -97,10 +97,10 @@ PassRefPtr<V8LazyEventListener> createAttributeEventListener(Frame* frame, Attri return 0; } - if (frame->document()->tokenizer()) { + if (frame->document()->parser()) { // FIXME: Change to use script->eventHandlerLineNumber() when implemented. - lineNumber = frame->document()->tokenizer()->lineNumber(); - columnNumber = frame->document()->tokenizer()->columnNumber(); + lineNumber = frame->document()->parser()->lineNumber(); + columnNumber = frame->document()->parser()->columnNumber(); } sourceURL = frame->document()->url().string(); return V8LazyEventListener::create(attr->localName().string(), frame->document()->isSVGDocument(), attr->value(), sourceURL, lineNumber, columnNumber, WorldContextHandle(UseMainWorld)); diff --git a/WebCore/bindings/v8/ScriptProfiler.cpp b/WebCore/bindings/v8/ScriptProfiler.cpp index 1f09420..ab0b9fe 100644 --- a/WebCore/bindings/v8/ScriptProfiler.cpp +++ b/WebCore/bindings/v8/ScriptProfiler.cpp @@ -46,7 +46,9 @@ void ScriptProfiler::start(ScriptState* state, const String& title) PassRefPtr<ScriptProfile> ScriptProfiler::stop(ScriptState* state, const String& title) { v8::HandleScope hs; - const v8::CpuProfile* profile = v8::CpuProfiler::StopProfiling(v8String(title)); + const v8::CpuProfile* profile = state ? + v8::CpuProfiler::StopProfiling(v8String(title), state->context()->GetSecurityToken()) : + v8::CpuProfiler::StopProfiling(v8String(title)); return profile ? ScriptProfile::create(profile) : 0; } diff --git a/WebCore/bindings/v8/SerializedScriptValue.cpp b/WebCore/bindings/v8/SerializedScriptValue.cpp index 50ac86b..8e91920 100644 --- a/WebCore/bindings/v8/SerializedScriptValue.cpp +++ b/WebCore/bindings/v8/SerializedScriptValue.cpp @@ -38,13 +38,13 @@ #include "FileList.h" #include "ImageData.h" #include "SharedBuffer.h" +#include "V8Binding.h" #include "V8Blob.h" #include "V8File.h" #include "V8FileList.h" #include "V8ImageData.h" #include "V8Proxy.h" -#include <v8.h> #include <wtf/Assertions.h> #include <wtf/RefCounted.h> #include <wtf/Vector.h> @@ -1012,6 +1012,52 @@ private: } // namespace +void SerializedScriptValue::deserializeAndSetProperty(v8::Handle<v8::Object> object, const char* propertyName, + v8::PropertyAttribute attribute, SerializedScriptValue* value) +{ + if (!value) + return; + v8::Handle<v8::Value> deserialized = value->deserialize(); + object->ForceSet(v8::String::NewSymbol(propertyName), deserialized, attribute); +} + +PassRefPtr<SerializedScriptValue> SerializedScriptValue::create(v8::Handle<v8::Value> value, bool& didThrow) +{ + return adoptRef(new SerializedScriptValue(value, didThrow)); +} + +PassRefPtr<SerializedScriptValue> SerializedScriptValue::create(v8::Handle<v8::Value> value) +{ + bool didThrow; + return adoptRef(new SerializedScriptValue(value, didThrow)); +} + +PassRefPtr<SerializedScriptValue> SerializedScriptValue::createFromWire(String data) +{ + return adoptRef(new SerializedScriptValue(data, WireData)); +} + +PassRefPtr<SerializedScriptValue> SerializedScriptValue::create(String data) +{ + return adoptRef(new SerializedScriptValue(data, StringValue)); +} + +PassRefPtr<SerializedScriptValue> SerializedScriptValue::create() +{ + return adoptRef(new SerializedScriptValue()); +} + +PassRefPtr<SerializedScriptValue> SerializedScriptValue::release() +{ + RefPtr<SerializedScriptValue> result = adoptRef(new SerializedScriptValue(m_data, WireData)); + m_data = String(); + return result.release(); +} + +SerializedScriptValue::SerializedScriptValue() +{ +} + SerializedScriptValue::SerializedScriptValue(v8::Handle<v8::Value> value, bool& didThrow) { didThrow = false; diff --git a/WebCore/bindings/v8/SerializedScriptValue.h b/WebCore/bindings/v8/SerializedScriptValue.h index 8205a42..3710b5a 100644 --- a/WebCore/bindings/v8/SerializedScriptValue.h +++ b/WebCore/bindings/v8/SerializedScriptValue.h @@ -32,7 +32,6 @@ #define SerializedScriptValue_h #include "ScriptValue.h" -#include "V8Binding.h" #include <v8.h> #include <wtf/RefCounted.h> @@ -40,63 +39,21 @@ namespace WebCore { class SerializedScriptValue : public RefCounted<SerializedScriptValue> { public: - // Deserializes the given value and sets it as a property on the - // object. - static void deserializeAndSetProperty(v8::Handle<v8::Object> object, - const char* propertyName, - v8::PropertyAttribute attribute, - SerializedScriptValue* value) - { - if (!value) - return; - v8::Handle<v8::Value> deserialized = value->deserialize(); - object->ForceSet(v8::String::NewSymbol(propertyName), deserialized, attribute); - } + static void deserializeAndSetProperty(v8::Handle<v8::Object> object, const char* propertyName, + v8::PropertyAttribute, SerializedScriptValue*); - // Creates a serialized representation of the given V8 value. - static PassRefPtr<SerializedScriptValue> create(v8::Handle<v8::Value> value) - { - bool didThrow; - return adoptRef(new SerializedScriptValue(value, didThrow)); - } - - // Creates a serialized representation of the given V8 value. - // // If a serialization error occurs (e.g., cyclic input value) this // function returns an empty representation, schedules a V8 exception to // be thrown using v8::ThrowException(), and sets |didThrow|. In this case // the caller must not invoke any V8 operations until control returns to // V8. When serialization is successful, |didThrow| is false. - static PassRefPtr<SerializedScriptValue> create(v8::Handle<v8::Value> value, bool& didThrow) - { - return adoptRef(new SerializedScriptValue(value, didThrow)); - } - - // Creates a serialized value with the given data obtained from a - // prior call to toWireString(). - static PassRefPtr<SerializedScriptValue> createFromWire(String data) - { - return adoptRef(new SerializedScriptValue(data, WireData)); - } - - // Creates a serialized representation of WebCore string. - static PassRefPtr<SerializedScriptValue> create(String data) - { - return adoptRef(new SerializedScriptValue(data, StringValue)); - } + static PassRefPtr<SerializedScriptValue> create(v8::Handle<v8::Value> value, bool& didThrow); + static PassRefPtr<SerializedScriptValue> create(v8::Handle<v8::Value>); + static PassRefPtr<SerializedScriptValue> createFromWire(String data); + static PassRefPtr<SerializedScriptValue> create(String data); + static PassRefPtr<SerializedScriptValue> create(); - // Creates an empty serialized value. - static PassRefPtr<SerializedScriptValue> create() - { - return adoptRef(new SerializedScriptValue()); - } - - PassRefPtr<SerializedScriptValue> release() - { - RefPtr<SerializedScriptValue> result = adoptRef(new SerializedScriptValue(m_data, WireData)); - m_data = String(); - return result.release(); - } + PassRefPtr<SerializedScriptValue> release(); String toWireString() const { return m_data; } @@ -110,10 +67,8 @@ private: WireData }; - SerializedScriptValue() { } - + SerializedScriptValue(); SerializedScriptValue(v8::Handle<v8::Value>, bool& didThrow); - SerializedScriptValue(String data, StringDataMode mode); String m_data; diff --git a/WebCore/bindings/v8/V8Binding.cpp b/WebCore/bindings/v8/V8Binding.cpp index e0904d7..97805c0 100644 --- a/WebCore/bindings/v8/V8Binding.cpp +++ b/WebCore/bindings/v8/V8Binding.cpp @@ -44,8 +44,6 @@ #include "V8Proxy.h" #include <wtf/text/CString.h> -#include <v8.h> - namespace WebCore { // WebCoreStringResource is a helper class for v8ExternalString. It is used diff --git a/WebCore/bindings/v8/V8DOMWindowShell.cpp b/WebCore/bindings/v8/V8DOMWindowShell.cpp index c7c77d3..99fea4c 100644 --- a/WebCore/bindings/v8/V8DOMWindowShell.cpp +++ b/WebCore/bindings/v8/V8DOMWindowShell.cpp @@ -50,6 +50,7 @@ #include "V8DOMWindow.h" #include "V8Document.h" #include "V8GCForContextDispose.h" +#include "V8HTMLDocument.h" #include "V8HiddenPropertyName.h" #include "V8History.h" #include "V8Location.h" @@ -414,6 +415,12 @@ void V8DOMWindowShell::clearDocumentWrapper() } } +static void checkDocumentWrapper(v8::Handle<v8::Object> wrapper, Document* document) +{ + ASSERT(V8Document::toNative(wrapper) == document); + ASSERT(!document->isHTMLDocument() || (V8Document::toNative(v8::Handle<v8::Object>::Cast(wrapper->GetPrototype())) == document)); +} + void V8DOMWindowShell::updateDocumentWrapperCache() { v8::HandleScope handleScope; @@ -432,6 +439,10 @@ void V8DOMWindowShell::updateDocumentWrapperCache() } v8::Handle<v8::Value> documentWrapper = toV8(m_frame->document()); + ASSERT(documentWrapper == m_document || m_document.IsEmpty()); + if (m_document.IsEmpty()) + updateDocumentWrapper(v8::Handle<v8::Object>::Cast(documentWrapper)); + checkDocumentWrapper(m_document, m_frame->document()); // If instantiation of the document wrapper fails, clear the cache // and let the DOMWindow accessor handle access to the document. @@ -509,6 +520,39 @@ void V8DOMWindowShell::updateDocument() updateSecurityOrigin(); } +v8::Handle<v8::Value> getter(v8::Local<v8::String> property, const v8::AccessorInfo& info) +{ + // FIXME(antonm): consider passing AtomicStringImpl directly. + AtomicString name = v8StringToAtomicWebCoreString(property); + HTMLDocument* htmlDocument = V8HTMLDocument::toNative(info.Holder()); + ASSERT(htmlDocument); + return V8HTMLDocument::GetNamedProperty(htmlDocument, name); +} + +void V8DOMWindowShell::namedItemAdded(HTMLDocument* doc, const AtomicString& name) +{ + initContextIfNeeded(); + + v8::HandleScope handleScope; + v8::Context::Scope contextScope(m_context); + + ASSERT(!m_document.IsEmpty()); + checkDocumentWrapper(m_document, doc); + m_document->SetAccessor(v8String(name), getter); +} + +void V8DOMWindowShell::namedItemRemoved(HTMLDocument* doc, const AtomicString& name) +{ + initContextIfNeeded(); + + v8::HandleScope handleScope; + v8::Context::Scope contextScope(m_context); + + ASSERT(!m_document.IsEmpty()); + checkDocumentWrapper(m_document, doc); + m_document->Delete(v8String(name)); +} + void V8DOMWindowShell::updateSecurityOrigin() { v8::HandleScope scope; diff --git a/WebCore/bindings/v8/V8DOMWindowShell.h b/WebCore/bindings/v8/V8DOMWindowShell.h index f4eaff2..3cf1b52 100644 --- a/WebCore/bindings/v8/V8DOMWindowShell.h +++ b/WebCore/bindings/v8/V8DOMWindowShell.h @@ -31,6 +31,7 @@ #ifndef V8DOMWindowShell_h #define V8DOMWindowShell_h +#include "AtomicString.h" #include "WrapperTypeInfo.h" #include <wtf/HashMap.h> #include <wtf/PassRefPtr.h> @@ -41,6 +42,7 @@ namespace WebCore { class DOMWindow; class Frame; +class HTMLDocument; class String; // V8WindowShell represents all the per-global object state for a Frame that @@ -54,6 +56,9 @@ public: // Update document object of the frame. void updateDocument(); + void namedItemAdded(HTMLDocument*, const AtomicString&); + void namedItemRemoved(HTMLDocument*, const AtomicString&); + // Update the security origin of a document // (e.g., after setting docoument.domain). void updateSecurityOrigin(); diff --git a/WebCore/bindings/v8/V8DOMWrapper.cpp b/WebCore/bindings/v8/V8DOMWrapper.cpp index f8426dc..596090d 100644 --- a/WebCore/bindings/v8/V8DOMWrapper.cpp +++ b/WebCore/bindings/v8/V8DOMWrapper.cpp @@ -82,7 +82,6 @@ #include <algorithm> #include <utility> -#include <v8.h> #include <v8-debug.h> #include <wtf/Assertions.h> #include <wtf/OwnArrayPtr.h> @@ -286,6 +285,8 @@ v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(V8Proxy* proxy, WrapperT if (!instance.IsEmpty()) { // Avoid setting the DOM wrapper for failed allocations. setDOMWrapper(instance, type, impl); + if (type == &V8HTMLDocument::info) + instance = V8HTMLDocument::WrapInShadowObject(instance, static_cast<Node*>(impl)); } return instance; } diff --git a/WebCore/bindings/v8/V8GCController.cpp b/WebCore/bindings/v8/V8GCController.cpp index fa7c357..5611199 100644 --- a/WebCore/bindings/v8/V8GCController.cpp +++ b/WebCore/bindings/v8/V8GCController.cpp @@ -46,7 +46,6 @@ #include <algorithm> #include <utility> -#include <v8.h> #include <v8-debug.h> #include <wtf/HashMap.h> #include <wtf/StdLibExtras.h> diff --git a/WebCore/bindings/v8/V8IsolatedContext.cpp b/WebCore/bindings/v8/V8IsolatedContext.cpp index 3237ede..b5e4590 100644 --- a/WebCore/bindings/v8/V8IsolatedContext.cpp +++ b/WebCore/bindings/v8/V8IsolatedContext.cpp @@ -38,7 +38,6 @@ #include "ScriptController.h" #include "V8DOMWindow.h" #include "V8HiddenPropertyName.h" -#include <v8.h> namespace WebCore { diff --git a/WebCore/bindings/v8/V8NPObject.cpp b/WebCore/bindings/v8/V8NPObject.cpp index f9cc94a..7f2051e 100644 --- a/WebCore/bindings/v8/V8NPObject.cpp +++ b/WebCore/bindings/v8/V8NPObject.cpp @@ -243,6 +243,12 @@ v8::Handle<v8::Value> npObjectGetIndexedProperty(v8::Local<v8::Object> self, uin return npObjectGetProperty(self, identifier, v8::Number::New(index)); } +v8::Handle<v8::Integer> npObjectQueryProperty(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + NPIdentifier identifier = getStringIdentifier(name); + return npObjectGetProperty(info.Holder(), identifier, name).IsEmpty() ? v8::Handle<v8::Integer>() : v8::Integer::New(v8::None); +} + static v8::Handle<v8::Value> npObjectSetProperty(v8::Local<v8::Object> self, NPIdentifier identifier, v8::Local<v8::Value> value) { NPObject* npObject = v8ObjectToNPObject(self); @@ -373,7 +379,7 @@ v8::Local<v8::Object> createV8ObjectForNPObject(NPObject* object, NPObject* root if (npObjectDesc.IsEmpty()) { npObjectDesc = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New()); npObjectDesc->InstanceTemplate()->SetInternalFieldCount(npObjectInternalFieldCount); - npObjectDesc->InstanceTemplate()->SetNamedPropertyHandler(npObjectNamedPropertyGetter, npObjectNamedPropertySetter, 0, 0, npObjectNamedPropertyEnumerator); + npObjectDesc->InstanceTemplate()->SetNamedPropertyHandler(npObjectNamedPropertyGetter, npObjectNamedPropertySetter, npObjectQueryProperty, 0, npObjectNamedPropertyEnumerator); npObjectDesc->InstanceTemplate()->SetIndexedPropertyHandler(npObjectIndexedPropertyGetter, npObjectIndexedPropertySetter, 0, 0, npObjectIndexedPropertyEnumerator); npObjectDesc->InstanceTemplate()->SetCallAsFunctionHandler(npObjectInvokeDefaultHandler); } diff --git a/WebCore/bindings/v8/V8Proxy.cpp b/WebCore/bindings/v8/V8Proxy.cpp index 7f52374..7a5df96 100644 --- a/WebCore/bindings/v8/V8Proxy.cpp +++ b/WebCore/bindings/v8/V8Proxy.cpp @@ -67,7 +67,6 @@ #include <algorithm> #include <stdio.h> #include <utility> -#include <v8.h> #include <wtf/Assertions.h> #include <wtf/OwnArrayPtr.h> #include <wtf/StdLibExtras.h> diff --git a/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp b/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp index 6ae3a3e..2c89b95 100644 --- a/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp +++ b/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp @@ -36,7 +36,7 @@ #include "V8Binding.h" #include "V8Proxy.h" #include "V8Int8Array.h" -#include "V8FloatArray.h" +#include "V8Float32Array.h" #include "V8Int32Array.h" #include "V8Int16Array.h" #include "V8Uint8Array.h" @@ -52,7 +52,7 @@ v8::Handle<v8::Value> toV8(ArrayBufferView* impl) if (impl->isByteArray()) return toV8(static_cast<Int8Array*>(impl)); if (impl->isFloatArray()) - return toV8(static_cast<FloatArray*>(impl)); + return toV8(static_cast<Float32Array*>(impl)); if (impl->isIntArray()) return toV8(static_cast<Int32Array*>(impl)); if (impl->isShortArray()) diff --git a/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp b/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp index 4cc6ac2..7d1cfc1 100644 --- a/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp +++ b/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp @@ -33,8 +33,10 @@ #include "V8Console.h" #include "Console.h" +#include "MemoryInfo.h" #include "ScriptProfile.h" #include "V8Binding.h" +#include "V8MemoryInfo.h" #include "V8Proxy.h" #include "V8ScriptProfile.h" @@ -42,11 +44,23 @@ namespace WebCore { typedef Vector<RefPtr<ScriptProfile> > ProfilesArray; -v8::Handle<v8::Value> V8Console::profilesAccessorGetter(v8::Local<v8::String>, const v8::AccessorInfo&) +v8::Handle<v8::Value> V8Console::profilesAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.Console.profilesAccessorGetter"); - // FIXME: Provide a real implementation. - return v8::Array::New(0); + Console* imp = V8Console::toNative(info.Holder()); + const ProfilesArray& profiles = imp->profiles(); + v8::Handle<v8::Array> result = v8::Array::New(profiles.size()); + int index = 0; + ProfilesArray::const_iterator end = profiles.end(); + for (ProfilesArray::const_iterator iter = profiles.begin(); iter != end; ++iter) + result->Set(v8::Integer::New(index++), toV8(iter->get())); + return result; +} + +v8::Handle<v8::Value> V8Console::memoryAccessorGetter(v8::Local<v8::String>, const v8::AccessorInfo&) +{ + INC_STATS("DOM.Console.memoryAccessorGetter"); + return toV8(MemoryInfo::create()); } } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp b/WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp index 5e20e376..18f27cb 100644 --- a/WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp +++ b/WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp @@ -26,15 +26,16 @@ #include "config.h" #include "V8CustomPositionCallback.h" -#include "Frame.h" +#include "ScriptExecutionContext.h" #include "V8CustomVoidCallback.h" // For invokeCallback #include "V8Geoposition.h" +#include "V8Proxy.h" namespace WebCore { -V8CustomPositionCallback::V8CustomPositionCallback(v8::Local<v8::Object> callback, Frame* frame) - : m_callback(v8::Persistent<v8::Object>::New(callback)) - , m_frame(frame) +V8CustomPositionCallback::V8CustomPositionCallback(v8::Local<v8::Object> callback, ScriptExecutionContext* context) + : PositionCallback(context) + , m_callback(v8::Persistent<v8::Object>::New(callback)) { } @@ -47,7 +48,17 @@ void V8CustomPositionCallback::handleEvent(Geoposition* position) { v8::HandleScope handleScope; - v8::Handle<v8::Context> context = V8Proxy::context(m_frame.get()); + // ActiveDOMObject will null our pointer to the ScriptExecutionContext when it goes away. + ScriptExecutionContext* scriptContext = scriptExecutionContext(); + if (!scriptContext) + return; + + // The lookup of the proxy will fail if the Frame has been detached. + V8Proxy* proxy = V8Proxy::retrieve(scriptContext); + if (!proxy) + return; + + v8::Handle<v8::Context> context = proxy->context(); if (context.IsEmpty()) return; @@ -57,11 +68,11 @@ void V8CustomPositionCallback::handleEvent(Geoposition* position) toV8(position) }; - // Protect the frame until the callback returns. - RefPtr<Frame> protector(m_frame); + // Protect the script context until the callback returns. + RefPtr<ScriptExecutionContext> protector(scriptContext); bool callbackReturnValue = false; - invokeCallback(m_callback, 1, argv, callbackReturnValue, m_frame->document()); + invokeCallback(m_callback, 1, argv, callbackReturnValue, scriptContext); } } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8CustomPositionCallback.h b/WebCore/bindings/v8/custom/V8CustomPositionCallback.h index d2290ee..61db922 100644 --- a/WebCore/bindings/v8/custom/V8CustomPositionCallback.h +++ b/WebCore/bindings/v8/custom/V8CustomPositionCallback.h @@ -27,6 +27,7 @@ #define V8CustomPositionCallback_h #include "PositionCallback.h" + #include <v8.h> #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> @@ -35,23 +36,23 @@ namespace WebCore { class Frame; class Geoposition; +class ScriptExecutionContext; class V8CustomPositionCallback : public PositionCallback { public: - static PassRefPtr<V8CustomPositionCallback> create(v8::Local<v8::Value> value, Frame* frame) + static PassRefPtr<V8CustomPositionCallback> create(v8::Local<v8::Value> value, ScriptExecutionContext* context) { ASSERT(value->IsObject()); - return adoptRef(new V8CustomPositionCallback(value->ToObject(), frame)); + return adoptRef(new V8CustomPositionCallback(value->ToObject(), context)); } virtual ~V8CustomPositionCallback(); virtual void handleEvent(Geoposition*); private: - V8CustomPositionCallback(v8::Local<v8::Object>, Frame*); + V8CustomPositionCallback(v8::Local<v8::Object>, ScriptExecutionContext*); v8::Persistent<v8::Object> m_callback; - RefPtr<Frame> m_frame; }; } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp b/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp index bd42d94..36b5e04 100644 --- a/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp +++ b/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp @@ -26,15 +26,16 @@ #include "config.h" #include "V8CustomPositionErrorCallback.h" -#include "Frame.h" +#include "ScriptExecutionContext.h" #include "V8CustomVoidCallback.h" // For invokeCallback #include "V8PositionError.h" +#include "V8Proxy.h" namespace WebCore { -V8CustomPositionErrorCallback::V8CustomPositionErrorCallback(v8::Local<v8::Object> callback, Frame* frame) - : m_callback(v8::Persistent<v8::Object>::New(callback)) - , m_frame(frame) +V8CustomPositionErrorCallback::V8CustomPositionErrorCallback(v8::Local<v8::Object> callback, ScriptExecutionContext* context) + : PositionErrorCallback(context) + , m_callback(v8::Persistent<v8::Object>::New(callback)) { } @@ -47,7 +48,17 @@ void V8CustomPositionErrorCallback::handleEvent(PositionError* error) { v8::HandleScope handleScope; - v8::Handle<v8::Context> context = V8Proxy::context(m_frame.get()); + // ActiveDOMObject will null our pointer to the ScriptExecutionContext when it goes away. + ScriptExecutionContext* scriptContext = scriptExecutionContext(); + if (!scriptContext) + return; + + // The lookup of the proxy will fail if the Frame has been detached. + V8Proxy* proxy = V8Proxy::retrieve(scriptContext); + if (!proxy) + return; + + v8::Handle<v8::Context> context = proxy->context(); if (context.IsEmpty()) return; @@ -57,11 +68,11 @@ void V8CustomPositionErrorCallback::handleEvent(PositionError* error) toV8(error) }; - // Protect the frame until the callback returns. - RefPtr<Frame> protector(m_frame); + // Protect the script context until the callback returns. + RefPtr<ScriptExecutionContext> protector(scriptContext); bool callbackReturnValue = false; - invokeCallback(m_callback, 1, argv, callbackReturnValue, m_frame->document()); + invokeCallback(m_callback, 1, argv, callbackReturnValue, scriptContext); } } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.h b/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.h index aaf56a7..5211b60 100644 --- a/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.h +++ b/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.h @@ -27,6 +27,7 @@ #define V8CustomPositionErrorCallback_h #include "PositionErrorCallback.h" + #include <v8.h> #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> @@ -35,23 +36,23 @@ namespace WebCore { class Frame; class PositionError; +class ScriptExecutionContext; class V8CustomPositionErrorCallback : public PositionErrorCallback { public: - static PassRefPtr<V8CustomPositionErrorCallback> create(v8::Local<v8::Value> value, Frame* frame) + static PassRefPtr<V8CustomPositionErrorCallback> create(v8::Local<v8::Value> value, ScriptExecutionContext* context) { ASSERT(value->IsObject()); - return adoptRef(new V8CustomPositionErrorCallback(value->ToObject(), frame)); + return adoptRef(new V8CustomPositionErrorCallback(value->ToObject(), context)); } virtual ~V8CustomPositionErrorCallback(); virtual void handleEvent(PositionError*); private: - V8CustomPositionErrorCallback(v8::Local<v8::Object>, Frame*); + V8CustomPositionErrorCallback(v8::Local<v8::Object>, ScriptExecutionContext*); v8::Persistent<v8::Object> m_callback; - RefPtr<Frame> m_frame; }; } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp b/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp index 3bdc79b..6603344 100644 --- a/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp +++ b/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp @@ -39,6 +39,7 @@ #include "V8Proxy.h" #include "V8SQLError.h" #include "V8SQLTransaction.h" +#include <wtf/Assertions.h> namespace WebCore { @@ -52,9 +53,16 @@ bool V8SQLStatementErrorCallback::handleEvent(ScriptExecutionContext* context, S v8::Context::Scope scope(v8Context); + v8::Handle<v8::Value> transactionHandle = toV8(transaction); + v8::Handle<v8::Value> errorHandle = toV8(error); + if (transactionHandle.IsEmpty() || errorHandle.IsEmpty()) { + CRASH(); + return true; + } + v8::Handle<v8::Value> argv[] = { - toV8(transaction), - toV8(error) + transactionHandle, + errorHandle }; // Protect the context until the callback returns. diff --git a/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp b/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp index bc7bb6c..25e7e0d 100644 --- a/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp +++ b/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp @@ -40,6 +40,7 @@ namespace WebCore { V8CustomVoidCallback::V8CustomVoidCallback(v8::Local<v8::Object> callback, ScriptExecutionContext *context) : m_callback(v8::Persistent<v8::Object>::New(callback)) , m_scriptExecutionContext(context) + , m_worldContext(UseCurrentWorld) { } @@ -52,7 +53,7 @@ void V8CustomVoidCallback::handleEvent() { v8::HandleScope handleScope; - v8::Handle<v8::Context> v8Context = toV8Context(m_scriptExecutionContext.get(), WorldContextHandle(UseCurrentWorld)); + v8::Handle<v8::Context> v8Context = toV8Context(m_scriptExecutionContext.get(), m_worldContext); if (v8Context.IsEmpty()) return; diff --git a/WebCore/bindings/v8/custom/V8CustomVoidCallback.h b/WebCore/bindings/v8/custom/V8CustomVoidCallback.h index 03a47bc..94bb782 100644 --- a/WebCore/bindings/v8/custom/V8CustomVoidCallback.h +++ b/WebCore/bindings/v8/custom/V8CustomVoidCallback.h @@ -32,6 +32,7 @@ #define V8CustomVoidCallback_h #include "VoidCallback.h" +#include "WorldContextHandle.h" #include <v8.h> #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> @@ -56,6 +57,7 @@ private: v8::Persistent<v8::Object> m_callback; RefPtr<ScriptExecutionContext> m_scriptExecutionContext; + WorldContextHandle m_worldContext; }; // Returns false if callback failed (null, wrong type, or threw exception). diff --git a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp index 4867cfe..25564ee 100644 --- a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp +++ b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp @@ -72,7 +72,7 @@ #if ENABLE(3D_CANVAS) #include "V8ArrayBuffer.h" #include "V8Int8Array.h" -#include "V8FloatArray.h" +#include "V8Float32Array.h" #include "V8Int32Array.h" #include "V8Int16Array.h" #include "V8Uint8Array.h" @@ -308,7 +308,7 @@ v8::Handle<v8::Value> V8DOMWindow::WebGLUnsignedIntArrayAccessorGetter(v8::Local v8::Handle<v8::Value> V8DOMWindow::WebGLFloatArrayAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { DOMWindow* window = V8DOMWindow::toNative(info.Holder()); - return V8DOMWrapper::getConstructor(&V8FloatArray::info, window); + return V8DOMWrapper::getConstructor(&V8Float32Array::info, window); } #endif diff --git a/WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp b/WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp new file mode 100644 index 0000000..93c5e91 --- /dev/null +++ b/WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(3D_CANVAS) + +#include "ArrayBuffer.h" +#include "Float32Array.h" + +#include "V8Binding.h" +#include "V8ArrayBuffer.h" +#include "V8ArrayBufferViewCustom.h" +#include "V8Float32Array.h" +#include "V8Proxy.h" + +namespace WebCore { + +v8::Handle<v8::Value> V8Float32Array::constructorCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.Float32Array.Contructor"); + + return constructWebGLArray<Float32Array, float>(args, &info, v8::kExternalFloatArray); +} + +v8::Handle<v8::Value> V8Float32Array::setCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.Float32Array.set()"); + return setWebGLArrayHelper<Float32Array, V8Float32Array>(args); +} + +v8::Handle<v8::Value> toV8(Float32Array* impl) +{ + if (!impl) + return v8::Null(); + v8::Handle<v8::Object> wrapper = V8Float32Array::wrap(impl); + if (!wrapper.IsEmpty()) + wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), v8::kExternalFloatArray, impl->length()); + return wrapper; +} + +} // namespace WebCore + +#endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/v8/custom/V8FloatArrayCustom.cpp b/WebCore/bindings/v8/custom/V8FloatArrayCustom.cpp deleted file mode 100644 index ebc65db..0000000 --- a/WebCore/bindings/v8/custom/V8FloatArrayCustom.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(3D_CANVAS) - -#include "ArrayBuffer.h" -#include "FloatArray.h" - -#include "V8Binding.h" -#include "V8ArrayBuffer.h" -#include "V8ArrayBufferViewCustom.h" -#include "V8FloatArray.h" -#include "V8Proxy.h" - -namespace WebCore { - -v8::Handle<v8::Value> V8FloatArray::constructorCallback(const v8::Arguments& args) -{ - INC_STATS("DOM.FloatArray.Contructor"); - - return constructWebGLArray<FloatArray, float>(args, &info, v8::kExternalFloatArray); -} - -v8::Handle<v8::Value> V8FloatArray::setCallback(const v8::Arguments& args) -{ - INC_STATS("DOM.FloatArray.set()"); - return setWebGLArrayHelper<FloatArray, V8FloatArray>(args); -} - -v8::Handle<v8::Value> toV8(FloatArray* impl) -{ - if (!impl) - return v8::Null(); - v8::Handle<v8::Object> wrapper = V8FloatArray::wrap(impl); - if (!wrapper.IsEmpty()) - wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), v8::kExternalFloatArray, impl->length()); - return wrapper; -} - -} // namespace WebCore - -#endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp b/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp index 7173be1..649c45f 100644 --- a/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp +++ b/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp @@ -26,8 +26,8 @@ #include "config.h" #include "V8Geolocation.h" +#include "Frame.h" #include "Geolocation.h" - #include "V8Binding.h" #include "V8CustomPositionCallback.h" #include "V8CustomPositionErrorCallback.h" @@ -56,8 +56,7 @@ static PassRefPtr<PositionCallback> createPositionCallback(v8::Local<v8::Value> return 0; } - Frame* frame = V8Proxy::retrieveFrameForCurrentContext(); - return V8CustomPositionCallback::create(value, frame); + return V8CustomPositionCallback::create(value, getScriptExecutionContext()); } static PassRefPtr<PositionErrorCallback> createPositionErrorCallback(v8::Local<v8::Value> value, bool& succeeded) @@ -75,8 +74,7 @@ static PassRefPtr<PositionErrorCallback> createPositionErrorCallback(v8::Local<v return 0; } - Frame* frame = V8Proxy::retrieveFrameForCurrentContext(); - return V8CustomPositionErrorCallback::create(value, frame); + return V8CustomPositionErrorCallback::create(value, getScriptExecutionContext()); } static PassRefPtr<PositionOptions> createPositionOptions(v8::Local<v8::Value> value, bool& succeeded) diff --git a/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp index 66e326c..d2f8c96 100644 --- a/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp +++ b/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp @@ -105,7 +105,7 @@ v8::Handle<v8::Value> V8HTMLCanvasElement::toDataURLCallback(const v8::Arguments HTMLCanvasElement* canvas = V8HTMLCanvasElement::toNative(holder); String type = toWebCoreString(args[0]); ExceptionCode ec = 0; - String result = canvas->toDataURL(type, quality, ec); + String result = canvas->toDataURL(type, &quality, ec); V8Proxy::setDOMException(ec); return v8StringOrUndefined(result); } diff --git a/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp index 86f2eb5..e6f1b8f 100644 --- a/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp +++ b/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp @@ -49,48 +49,37 @@ namespace WebCore { -v8::Handle<v8::Boolean> V8HTMLDocument::namedPropertyDeleter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +v8::Local<v8::Object> V8HTMLDocument::WrapInShadowObject(v8::Local<v8::Object> wrapper, Node* impl) { - // Only handle document.all. Insert the marker object into the - // shadow internal field to signal that document.all is no longer - // shadowed. - AtomicString key = v8StringToAtomicWebCoreString(name); - DEFINE_STATIC_LOCAL(const AtomicString, all, ("all")); - if (key != all) - return deletionNotHandledByInterceptor(); - - ASSERT(info.Holder()->InternalFieldCount() == V8HTMLDocument::internalFieldCount); - v8::Local<v8::Value> marker = info.Holder()->GetInternalField(V8HTMLDocument::markerIndex); - info.Holder()->SetInternalField(V8HTMLDocument::shadowIndex, marker); - return v8::True(); -} - -v8::Handle<v8::Value> V8HTMLDocument::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) -{ - INC_STATS("DOM.HTMLDocument.NamedPropertyGetter"); - AtomicString key = v8StringToAtomicWebCoreString(name); - - // Special case for document.all. If the value in the shadow - // internal field is not the marker object, then document.all has - // been temporarily shadowed and we return the value. - DEFINE_STATIC_LOCAL(const AtomicString, all, ("all")); - if (key == all) { - ASSERT(info.Holder()->InternalFieldCount() == V8HTMLDocument::internalFieldCount); - v8::Local<v8::Value> marker = info.Holder()->GetInternalField(V8HTMLDocument::markerIndex); - v8::Local<v8::Value> value = info.Holder()->GetInternalField(V8HTMLDocument::shadowIndex); - if (marker != value) - return value; + DEFINE_STATIC_LOCAL(v8::Persistent<v8::Function>, shadowConstructor, ()); + if (shadowConstructor.IsEmpty()) { + v8::Local<v8::FunctionTemplate> shadowTemplate = v8::FunctionTemplate::New(); + if (shadowTemplate.IsEmpty()) + return v8::Local<v8::Object>(); + shadowTemplate->SetClassName(v8::String::New("HTMLDocument")); + shadowTemplate->Inherit(V8HTMLDocument::GetTemplate()); + shadowTemplate->InstanceTemplate()->SetInternalFieldCount(V8HTMLDocument::internalFieldCount); + shadowConstructor = v8::Persistent<v8::Function>::New(shadowTemplate->GetFunction()); + if (shadowConstructor.IsEmpty()) + return v8::Local<v8::Object>(); } - HTMLDocument* htmlDocument = V8HTMLDocument::toNative(info.Holder()); + ASSERT(!shadowConstructor.IsEmpty()); + v8::Local<v8::Object> shadow = shadowConstructor->NewInstance(); + if (shadow.IsEmpty()) + return v8::Local<v8::Object>(); + V8DOMWrapper::setDOMWrapper(shadow, &V8HTMLDocument::info, impl); + shadow->SetPrototype(wrapper); + return shadow; +} - // Fast case for named elements that are not there. - if (!htmlDocument->hasNamedItem(key.impl()) && !htmlDocument->hasExtraNamedItem(key.impl())) - return v8::Handle<v8::Value>(); +v8::Handle<v8::Value> V8HTMLDocument::GetNamedProperty(HTMLDocument* htmlDocument, const AtomicString& key) +{ + ASSERT(htmlDocument->hasNamedItem(key.impl()) || htmlDocument->hasExtraNamedItem(key.impl())); RefPtr<HTMLCollection> items = htmlDocument->documentNamedItems(key); if (!items->length()) - return notHandledByInterceptor(); + return v8::Handle<v8::Value>(); if (items->length() == 1) { Node* node = items->firstItem(); @@ -104,13 +93,6 @@ v8::Handle<v8::Value> V8HTMLDocument::namedPropertyGetter(v8::Local<v8::String> return toV8(items.release()); } -v8::Handle<v8::Value> V8HTMLDocument::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo &info) -{ - INC_STATS("DOM.HTMLDocument.IndexedPropertyGetter"); - v8::Local<v8::Integer> indexV8 = v8::Integer::NewFromUnsigned(index); - return namedPropertyGetter(indexV8->ToString(), info); -} - // HTMLDocument ---------------------------------------------------------------- // Concatenates "args" to a string. If args is empty, returns empty string. @@ -193,10 +175,8 @@ v8::Handle<v8::Value> V8HTMLDocument::allAccessorGetter(v8::Local<v8::String> na void V8HTMLDocument::allAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { - INC_STATS("DOM.HTMLDocument.all._set"); - v8::Handle<v8::Object> holder = info.Holder(); - ASSERT(info.Holder()->InternalFieldCount() == V8HTMLDocument::internalFieldCount); - info.Holder()->SetInternalField(V8HTMLDocument::shadowIndex, value); + // Just emulate a normal JS behaviour---install a property on this. + info.This()->ForceSet(name, value); } v8::Handle<v8::Value> toV8(HTMLDocument* impl, bool forceNewObject) @@ -210,12 +190,6 @@ v8::Handle<v8::Value> toV8(HTMLDocument* impl, bool forceNewObject) if (V8Proxy* proxy = V8Proxy::retrieve(impl->frame())) proxy->windowShell()->updateDocumentWrapper(wrapper); } - // Create marker object and insert it in two internal fields. - // This is used to implement temporary shadowing of document.all. - ASSERT(wrapper->InternalFieldCount() == V8HTMLDocument::internalFieldCount); - v8::Local<v8::Object> marker = v8::Object::New(); - wrapper->SetInternalField(V8HTMLDocument::markerIndex, marker); - wrapper->SetInternalField(V8HTMLDocument::shadowIndex, marker); return wrapper; } diff --git a/WebCore/bindings/v8/custom/V8NamedNodesCollection.cpp b/WebCore/bindings/v8/custom/V8NamedNodesCollection.cpp index 905b23d..d9da174 100644 --- a/WebCore/bindings/v8/custom/V8NamedNodesCollection.cpp +++ b/WebCore/bindings/v8/custom/V8NamedNodesCollection.cpp @@ -46,7 +46,7 @@ Node* V8NamedNodesCollection::itemWithName(const AtomicString& id) const { for (unsigned i = 0; i < m_nodes.size(); ++i) { Node* node = m_nodes[i].get(); - if (node->hasAttributes() && node->attributes()->id() == id) + if (node->hasID() && static_cast<Element*>(node)->getIdAttribute() == id) return node; } return 0; diff --git a/WebCore/bindings/v8/custom/V8NodeListCustom.cpp b/WebCore/bindings/v8/custom/V8NodeListCustom.cpp index 20a5471..8cc3983 100644 --- a/WebCore/bindings/v8/custom/V8NodeListCustom.cpp +++ b/WebCore/bindings/v8/custom/V8NodeListCustom.cpp @@ -45,7 +45,7 @@ v8::Handle<v8::Value> V8NodeList::namedPropertyGetter(v8::Local<v8::String> name { INC_STATS("DOM.NodeList.NamedPropertyGetter"); NodeList* list = V8NodeList::toNative(info.Holder()); - String key = toWebCoreString(name); + AtomicString key = v8ValueToAtomicWebCoreString(name); // Length property cannot be overridden. DEFINE_STATIC_LOCAL(const AtomicString, length, ("length")); diff --git a/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp b/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp index 51a57c0..58f34bf 100644 --- a/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp +++ b/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp @@ -35,8 +35,6 @@ #include "SerializedScriptValue.h" #include "V8Proxy.h" -#include <v8.h> - namespace WebCore { v8::Handle<v8::Value> V8PopStateEvent::stateAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) diff --git a/WebCore/bindings/v8/custom/V8StorageCustom.cpp b/WebCore/bindings/v8/custom/V8StorageCustom.cpp index 70d8a09..d0a0d92 100755 --- a/WebCore/bindings/v8/custom/V8StorageCustom.cpp +++ b/WebCore/bindings/v8/custom/V8StorageCustom.cpp @@ -79,6 +79,19 @@ v8::Handle<v8::Value> V8Storage::namedPropertyGetter(v8::Local<v8::String> name, return storageGetter(name, info); } +v8::Handle<v8::Integer> V8Storage::namedPropertyQuery(v8::Local<v8::String> v8Name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.Storage.NamedPropertyQuery"); + + Storage* storage = V8Storage::toNative(info.Holder()); + String name = toWebCoreString(v8Name); + + if (storage->contains(name) && name != "length") + return v8::Integer::New(v8::None); + + return v8::Handle<v8::Integer>(); +} + static v8::Handle<v8::Value> storageSetter(v8::Local<v8::String> v8Name, v8::Local<v8::Value> v8Value, const v8::AccessorInfo& info) { Storage* storage = V8Storage::toNative(info.Holder()); diff --git a/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp index 7a031b1..5da4b3e 100644 --- a/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp +++ b/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp @@ -44,7 +44,7 @@ #include "V8ArrayBufferView.h" #include "V8WebGLBuffer.h" #include "V8Int8Array.h" -#include "V8FloatArray.h" +#include "V8Float32Array.h" #include "V8WebGLFramebuffer.h" #include "V8Int32Array.h" #include "V8WebGLProgram.h" @@ -392,21 +392,21 @@ static v8::Handle<v8::Value> vertexAttribAndUniformHelperf(const v8::Arguments& FunctionToCall functionToCall) { // Forms: // * glUniform1fv(WebGLUniformLocation location, Array data); - // * glUniform1fv(WebGLUniformLocation location, FloatArray data); + // * glUniform1fv(WebGLUniformLocation location, Float32Array data); // * glUniform2fv(WebGLUniformLocation location, Array data); - // * glUniform2fv(WebGLUniformLocation location, FloatArray data); + // * glUniform2fv(WebGLUniformLocation location, Float32Array data); // * glUniform3fv(WebGLUniformLocation location, Array data); - // * glUniform3fv(WebGLUniformLocation location, FloatArray data); + // * glUniform3fv(WebGLUniformLocation location, Float32Array data); // * glUniform4fv(WebGLUniformLocation location, Array data); - // * glUniform4fv(WebGLUniformLocation location, FloatArray data); + // * glUniform4fv(WebGLUniformLocation location, Float32Array data); // * glVertexAttrib1fv(GLint index, Array data); - // * glVertexAttrib1fv(GLint index, FloatArray data); + // * glVertexAttrib1fv(GLint index, Float32Array data); // * glVertexAttrib2fv(GLint index, Array data); - // * glVertexAttrib2fv(GLint index, FloatArray data); + // * glVertexAttrib2fv(GLint index, Float32Array data); // * glVertexAttrib3fv(GLint index, Array data); - // * glVertexAttrib3fv(GLint index, FloatArray data); + // * glVertexAttrib3fv(GLint index, Float32Array data); // * glVertexAttrib4fv(GLint index, Array data); - // * glVertexAttrib4fv(GLint index, FloatArray data); + // * glVertexAttrib4fv(GLint index, Float32Array data); if (args.Length() != 2) { V8Proxy::setDOMException(SYNTAX_ERR); @@ -424,8 +424,8 @@ static v8::Handle<v8::Value> vertexAttribAndUniformHelperf(const v8::Arguments& WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder()); - if (V8FloatArray::HasInstance(args[1])) { - FloatArray* array = V8FloatArray::toNative(args[1]->ToObject()); + if (V8Float32Array::HasInstance(args[1])) { + Float32Array* array = V8Float32Array::toNative(args[1]->ToObject()); ASSERT(array != NULL); ExceptionCode ec = 0; switch (functionToCall) { @@ -592,13 +592,13 @@ static v8::Handle<v8::Value> uniformMatrixHelper(const v8::Arguments& args, { // Forms: // * glUniformMatrix2fv(GLint location, GLboolean transpose, Array data); - // * glUniformMatrix2fv(GLint location, GLboolean transpose, FloatArray data); + // * glUniformMatrix2fv(GLint location, GLboolean transpose, Float32Array data); // * glUniformMatrix3fv(GLint location, GLboolean transpose, Array data); - // * glUniformMatrix3fv(GLint location, GLboolean transpose, FloatArray data); + // * glUniformMatrix3fv(GLint location, GLboolean transpose, Float32Array data); // * glUniformMatrix4fv(GLint location, GLboolean transpose, Array data); - // * glUniformMatrix4fv(GLint location, GLboolean transpose, FloatArray data); + // * glUniformMatrix4fv(GLint location, GLboolean transpose, Float32Array data); // - // FIXME: need to change to accept FloatArray as well. + // FIXME: need to change to accept Float32Array as well. if (args.Length() != 3) { V8Proxy::setDOMException(SYNTAX_ERR); return notHandledByInterceptor(); @@ -610,8 +610,8 @@ static v8::Handle<v8::Value> uniformMatrixHelper(const v8::Arguments& args, WebGLUniformLocation* location = toWebGLUniformLocation(args[0], ok); bool transpose = args[1]->BooleanValue(); - if (V8FloatArray::HasInstance(args[2])) { - FloatArray* array = V8FloatArray::toNative(args[2]->ToObject()); + if (V8Float32Array::HasInstance(args[2])) { + Float32Array* array = V8Float32Array::toNative(args[2]->ToObject()); ASSERT(array != NULL); ExceptionCode ec = 0; switch (matrixSize) { diff --git a/WebCore/bridge/NP_jsobject.cpp b/WebCore/bridge/NP_jsobject.cpp index d983f6a..d454c74 100644 --- a/WebCore/bridge/NP_jsobject.cpp +++ b/WebCore/bridge/NP_jsobject.cpp @@ -183,7 +183,7 @@ bool _NPN_InvokeDefault(NPP, NPObject* o, const NPVariant* args, uint32_t argCou // Call the function object. JSValue function = obj->imp; CallData callData; - CallType callType = function.getCallData(callData); + CallType callType = getCallData(function, callData); if (callType == CallTypeNone) return false; @@ -232,7 +232,7 @@ bool _NPN_Invoke(NPP npp, NPObject* o, NPIdentifier methodName, const NPVariant* JSLock lock(SilenceAssertionsOnly); JSValue function = obj->imp->get(exec, identifierFromNPIdentifier(exec, i->string())); CallData callData; - CallType callType = function.getCallData(callData); + CallType callType = getCallData(function, callData); if (callType == CallTypeNone) return false; @@ -507,7 +507,7 @@ bool _NPN_Construct(NPP, NPObject* o, const NPVariant* args, uint32_t argCount, // Call the constructor object. JSValue constructor = obj->imp; ConstructData constructData; - ConstructType constructType = constructor.getConstructData(constructData); + ConstructType constructType = getConstructData(constructor, constructData); if (constructType == ConstructTypeNone) return false; diff --git a/WebCore/bridge/c/c_instance.cpp b/WebCore/bridge/c/c_instance.cpp index cbcc7b8..2db009e 100644 --- a/WebCore/bridge/c/c_instance.cpp +++ b/WebCore/bridge/c/c_instance.cpp @@ -73,7 +73,7 @@ void CInstance::moveGlobalExceptionToExecState(ExecState* exec) { JSLock lock(SilenceAssertionsOnly); - throwError(exec, GeneralError, globalExceptionString()); + throwError(exec, createError(exec, globalExceptionString())); } globalExceptionString() = UString(); @@ -131,7 +131,7 @@ JSValue CInstance::getMethod(ExecState* exec, const Identifier& propertyName) JSValue CInstance::invokeMethod(ExecState* exec, RuntimeMethod* runtimeMethod) { if (!asObject(runtimeMethod)->inherits(&CRuntimeMethod::s_info)) - return throwError(exec, TypeError, "Attempt to invoke non-plug-in method on plug-in object."); + return throwError(exec, createTypeError(exec, "Attempt to invoke non-plug-in method on plug-in object.")); const MethodList& methodList = *runtimeMethod->methods(); @@ -165,7 +165,7 @@ JSValue CInstance::invokeMethod(ExecState* exec, RuntimeMethod* runtimeMethod) } if (!retval) - throwError(exec, GeneralError, "Error calling method on NPObject!"); + throwError(exec, createError(exec, "Error calling method on NPObject!")); for (i = 0; i < count; i++) _NPN_ReleaseVariantValue(&cArgs[i]); @@ -200,7 +200,7 @@ JSValue CInstance::invokeDefaultMethod(ExecState* exec) } if (!retval) - throwError(exec, GeneralError, "Error calling method on NPObject!"); + throwError(exec, createError(exec, "Error calling method on NPObject!")); for (i = 0; i < count; i++) _NPN_ReleaseVariantValue(&cArgs[i]); @@ -239,7 +239,7 @@ JSValue CInstance::invokeConstruct(ExecState* exec, const ArgList& args) } if (!retval) - throwError(exec, GeneralError, "Error calling method on NPObject!"); + throwError(exec, createError(exec, "Error calling method on NPObject!")); for (i = 0; i < count; i++) _NPN_ReleaseVariantValue(&cArgs[i]); diff --git a/WebCore/bridge/jni/jni_jsobject.mm b/WebCore/bridge/jni/jni_jsobject.mm index 3fb794b..7793070 100644 --- a/WebCore/bridge/jni/jni_jsobject.mm +++ b/WebCore/bridge/jni/jni_jsobject.mm @@ -289,7 +289,7 @@ jobject JavaJSObject::call(jstring methodName, jobjectArray args) const Identifier identifier(exec, JavaString(methodName)); JSValue function = _imp->get(exec, identifier); CallData callData; - CallType callType = function.getCallData(callData); + CallType callType = getCallData(function, callData); if (callType == CallTypeNone) return 0; diff --git a/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp b/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp index 24e2b91..d5dc1cb 100644 --- a/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp +++ b/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp @@ -88,7 +88,7 @@ jvalue JavaField::dispatchValueFromInstance(ExecState* exec, const JavaInstance* args[0].l = jinstance; dispatchJNICall(exec, rootObject->nativeHandle(), fieldJInstance, false, returnType, mid, args, result, 0, exceptionDescription); if (exceptionDescription) - throwError(exec, GeneralError, exceptionDescription.toString(exec)); + throwError(exec, createError(exec, exceptionDescription.toString(exec))); } } } @@ -175,7 +175,7 @@ void JavaField::dispatchSetValueToInstance(ExecState* exec, const JavaInstance* args[1] = javaValue; dispatchJNICall(exec, rootObject->nativeHandle(), fieldJInstance, false, void_type, mid, args, result, 0, exceptionDescription); if (exceptionDescription) - throwError(exec, GeneralError, exceptionDescription.toString(exec)); + throwError(exec, createError(exec, exceptionDescription.toString(exec))); } } } diff --git a/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp b/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp index a87f062..84b06de 100644 --- a/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp +++ b/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp @@ -139,7 +139,7 @@ JSValue JavaInstance::getMethod(ExecState* exec, const Identifier& propertyName) JSValue JavaInstance::invokeMethod(ExecState* exec, RuntimeMethod* runtimeMethod) { if (!asObject(runtimeMethod)->inherits(&JavaRuntimeMethod::s_info)) - return throwError(exec, TypeError, "Attempt to invoke non-Java method on Java object."); + return throwError(exec, createTypeError(exec, "Attempt to invoke non-Java method on Java object.")); const MethodList& methodList = *runtimeMethod->methods(); @@ -193,7 +193,7 @@ JSValue JavaInstance::invokeMethod(ExecState* exec, RuntimeMethod* runtimeMethod const char *callingURL = 0; // FIXME, need to propagate calling URL to Java handled = dispatchJNICall(exec, rootObject->nativeHandle(), obj, jMethod->isStatic(), jMethod->JNIReturnType(), jMethod->methodID(obj), jArgs.data(), result, callingURL, exceptionDescription); if (exceptionDescription) { - throwError(exec, GeneralError, exceptionDescription.toString(exec)); + throwError(exec, createError(exec, exceptionDescription.toString(exec))); return jsUndefined(); } } diff --git a/WebCore/bridge/objc/objc_instance.mm b/WebCore/bridge/objc/objc_instance.mm index 3f9876c..2b518b1 100644 --- a/WebCore/bridge/objc/objc_instance.mm +++ b/WebCore/bridge/objc/objc_instance.mm @@ -86,7 +86,7 @@ void ObjcInstance::moveGlobalExceptionToExecState(ExecState* exec) if (!s_exceptionEnvironment || s_exceptionEnvironment == exec->dynamicGlobalObject()) { JSLock lock(SilenceAssertionsOnly); - throwError(exec, GeneralError, s_exception); + throwError(exec, s_exception); } HardRelease(s_exception); @@ -197,7 +197,7 @@ JSValue ObjcInstance::getMethod(ExecState* exec, const Identifier& propertyName) JSValue ObjcInstance::invokeMethod(ExecState* exec, RuntimeMethod* runtimeMethod) { if (!asObject(runtimeMethod)->inherits(&ObjCRuntimeMethod::s_info)) - return throwError(exec, TypeError, "Attempt to invoke non-plug-in method on plug-in object."); + return throwError(exec, createTypeError(exec, "Attempt to invoke non-plug-in method on plug-in object.")); const MethodList& methodList = *runtimeMethod->methods(); diff --git a/WebCore/bridge/objc/objc_runtime.mm b/WebCore/bridge/objc/objc_runtime.mm index b03b04a..e86cb1e 100644 --- a/WebCore/bridge/objc/objc_runtime.mm +++ b/WebCore/bridge/objc/objc_runtime.mm @@ -104,7 +104,7 @@ JSValue ObjcField::valueFromInstance(ExecState* exec, const Instance* instance) result = convertObjcValueToValue(exec, &objcValue, ObjcObjectType, instance->rootObject()); } @catch(NSException* localException) { JSLock::lock(SilenceAssertionsOnly); - throwError(exec, GeneralError, [localException reason]); + throwError(exec, [localException reason]); JSLock::unlock(SilenceAssertionsOnly); } @@ -132,7 +132,7 @@ void ObjcField::setValueToInstance(ExecState* exec, const Instance* instance, JS [targetObject setValue:value forKey:(NSString *)_name.get()]; } @catch(NSException* localException) { JSLock::lock(SilenceAssertionsOnly); - throwError(exec, GeneralError, [localException reason]); + throwError(exec, [localException reason]); JSLock::unlock(SilenceAssertionsOnly); } } @@ -148,12 +148,12 @@ ObjcArray::ObjcArray(ObjectStructPtr a, PassRefPtr<RootObject> rootObject) void ObjcArray::setValueAt(ExecState* exec, unsigned int index, JSValue aValue) const { if (![_array.get() respondsToSelector:@selector(insertObject:atIndex:)]) { - throwError(exec, TypeError, "Array is not mutable."); + throwError(exec, createTypeError(exec, "Array is not mutable.")); return; } if (index > [_array.get() count]) { - throwError(exec, RangeError, "Index exceeds array size."); + throwError(exec, createRangeError(exec, "Index exceeds array size.")); return; } @@ -164,20 +164,20 @@ void ObjcArray::setValueAt(ExecState* exec, unsigned int index, JSValue aValue) @try { [_array.get() insertObject:oValue.objectValue atIndex:index]; } @catch(NSException* localException) { - throwError(exec, GeneralError, "Objective-C exception."); + throwError(exec, createError(exec, "Objective-C exception.")); } } JSValue ObjcArray::valueAt(ExecState* exec, unsigned int index) const { if (index > [_array.get() count]) - return throwError(exec, RangeError, "Index exceeds array size."); + return throwError(exec, createRangeError(exec, "Index exceeds array size.")); @try { id obj = [_array.get() objectAtIndex:index]; if (obj) return convertObjcValueToValue (exec, &obj, ObjcObjectType, m_rootObject.get()); } @catch(NSException* localException) { - return throwError(exec, GeneralError, "Objective-C exception."); + return throwError(exec, createError(exec, "Objective-C exception.")); } return jsUndefined(); } @@ -215,11 +215,11 @@ void ObjcFallbackObjectImp::put(ExecState*, const Identifier&, JSValue, PutPrope { } -static JSValue JSC_HOST_CALL callObjCFallbackObject(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL callObjCFallbackObject(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&ObjCRuntimeObject::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSValue result = jsUndefined(); @@ -227,7 +227,7 @@ static JSValue JSC_HOST_CALL callObjCFallbackObject(ExecState* exec) ObjcInstance* objcInstance = runtimeObject->getInternalObjCInstance(); if (!objcInstance) - return RuntimeObject::throwInvalidAccessError(exec); + return JSValue::encode(RuntimeObject::throwInvalidAccessError(exec)); objcInstance->begin(); @@ -244,7 +244,7 @@ static JSValue JSC_HOST_CALL callObjCFallbackObject(ExecState* exec) objcInstance->end(); - return result; + return JSValue::encode(result); } CallType ObjcFallbackObjectImp::getCallData(CallData& callData) diff --git a/WebCore/bridge/objc/objc_utility.h b/WebCore/bridge/objc/objc_utility.h index c34be2a..4810752 100644 --- a/WebCore/bridge/objc/objc_utility.h +++ b/WebCore/bridge/objc/objc_utility.h @@ -80,7 +80,7 @@ ObjcValueType objcValueTypeForType(const char *type); bool convertJSMethodNameToObjc(const char *JSName, char *buffer, size_t bufferSize); -JSObject *throwError(ExecState *, ErrorType, NSString *message); +JSObject *throwError(ExecState *, NSString *message); } // namespace Bindings } // namespace JSC diff --git a/WebCore/bridge/objc/objc_utility.mm b/WebCore/bridge/objc/objc_utility.mm index bf59627..8eb7ba5 100644 --- a/WebCore/bridge/objc/objc_utility.mm +++ b/WebCore/bridge/objc/objc_utility.mm @@ -358,13 +358,13 @@ ObjcValueType objcValueTypeForType(const char *type) return objcValueType; } -JSObject *throwError(ExecState *exec, ErrorType type, NSString *message) +JSObject *throwError(ExecState *exec, NSString *message) { ASSERT(message); size_t length = [message length]; unichar *buffer = new unichar[length]; [message getCharacters:buffer]; - JSObject *error = throwError(exec, type, UString(buffer, length)); + JSObject *error = JSC::throwError(exec, JSC::createError(exec, UString(buffer, length))); delete [] buffer; return error; } diff --git a/WebCore/bridge/qt/qt_instance.cpp b/WebCore/bridge/qt/qt_instance.cpp index 5ffb41f..1229919 100644 --- a/WebCore/bridge/qt/qt_instance.cpp +++ b/WebCore/bridge/qt/qt_instance.cpp @@ -360,7 +360,7 @@ JSValue QtField::valueFromInstance(ExecState* exec, const Instance* inst) const return convertQVariantToValue(exec, inst->rootObject(), val); } QString msg = QString(QLatin1String("cannot access member `%1' of deleted QObject")).arg(QLatin1String(name())); - return throwError(exec, GeneralError, msg.toLatin1().constData()); + return throwError(exec, createError(exec, msg.toLatin1().constData())); } void QtField::setValueToInstance(ExecState* exec, const Instance* inst, JSValue aValue) const @@ -387,7 +387,7 @@ void QtField::setValueToInstance(ExecState* exec, const Instance* inst, JSValue #endif } else { QString msg = QString(QLatin1String("cannot access member `%1' of deleted QObject")).arg(QLatin1String(name())); - throwError(exec, GeneralError, msg.toLatin1().constData()); + throwError(exec, createError(exec, msg.toLatin1().constData())); } } diff --git a/WebCore/bridge/qt/qt_pixmapruntime.cpp b/WebCore/bridge/qt/qt_pixmapruntime.cpp index 7b6debe..ad26019 100644 --- a/WebCore/bridge/qt/qt_pixmapruntime.cpp +++ b/WebCore/bridge/qt/qt_pixmapruntime.cpp @@ -346,10 +346,17 @@ returnEmptyVariant: return QVariant::fromValue<QImage>(QImage()); return QVariant(); } -JSObject* QtPixmapInstance::createRuntimeObject(ExecState* exec, PassRefPtr<RootObject> root, const QVariant& data) + +RuntimeObject* QtPixmapInstance::newRuntimeObject(ExecState* exec) +{ + return new(exec) QtPixmapRuntimeObject(exec, exec->lexicalGlobalObject(), this); +} + +JSObject* QtPixmapInstance::createPixmapRuntimeObject(ExecState* exec, PassRefPtr<RootObject> root, const QVariant& data) { JSLock lock(SilenceAssertionsOnly); - return new(exec) QtPixmapRuntimeObject(exec, exec->lexicalGlobalObject(), new QtPixmapInstance(root, data)); + QtPixmapInstance* instance = new QtPixmapInstance(root, data); + return instance->createRuntimeObject(exec); } bool QtPixmapInstance::canHandle(QMetaType::Type hint) diff --git a/WebCore/bridge/qt/qt_pixmapruntime.h b/WebCore/bridge/qt/qt_pixmapruntime.h index 06e74eb..e2ae5e9 100644 --- a/WebCore/bridge/qt/qt_pixmapruntime.h +++ b/WebCore/bridge/qt/qt_pixmapruntime.h @@ -42,7 +42,8 @@ public: int height() const; QPixmap toPixmap(); QImage toImage(); - static JSObject* createRuntimeObject(ExecState*, PassRefPtr<RootObject>, const QVariant&); + RuntimeObject* newRuntimeObject(ExecState* exec); + static JSObject* createPixmapRuntimeObject(ExecState*, PassRefPtr<RootObject>, const QVariant&); static QVariant variantFromObject(JSObject*, QMetaType::Type hint); static bool canHandle(QMetaType::Type hint); }; diff --git a/WebCore/bridge/qt/qt_runtime.cpp b/WebCore/bridge/qt/qt_runtime.cpp index 47f7d4a1..6cea96e 100644 --- a/WebCore/bridge/qt/qt_runtime.cpp +++ b/WebCore/bridge/qt/qt_runtime.cpp @@ -877,7 +877,7 @@ JSValue convertQVariantToValue(ExecState* exec, PassRefPtr<RootObject> root, con } if (QtPixmapInstance::canHandle(static_cast<QMetaType::Type>(variant.type()))) - return QtPixmapInstance::createRuntimeObject(exec, root, variant); + return QtPixmapInstance::createPixmapRuntimeObject(exec, root, variant); if (type == qMetaTypeId<QWebElement>()) { if (!root->globalObject()->inherits(&JSDOMWindow::s_info)) @@ -1280,7 +1280,7 @@ static int findMethodIndex(ExecState* exec, QMetaMethod mtd = meta->method(conversionFailed.at(i)); message += QString::fromLatin1(" %0").arg(QString::fromLatin1(mtd.signature())); } - *pError = throwError(exec, TypeError, message.toLatin1().constData()); + *pError = throwError(exec, createTypeError(exec, message.toLatin1().constData())); } else if (!unresolved.isEmpty()) { QtMethodMatchData argsInstance = unresolved.first(); int unresolvedIndex = argsInstance.firstUnresolvedIndex(); @@ -1289,7 +1289,7 @@ static int findMethodIndex(ExecState* exec, QString message = QString::fromLatin1("cannot call %0(): unknown type `%1'") .arg(QString::fromLatin1(signature)) .arg(QLatin1String(unresolvedType.name())); - *pError = throwError(exec, TypeError, message.toLatin1().constData()); + *pError = throwError(exec, createTypeError(exec, message.toLatin1().constData())); } else { QString message = QString::fromLatin1("too few arguments in call to %0(); candidates are\n") .arg(QLatin1String(signature)); @@ -1299,7 +1299,7 @@ static int findMethodIndex(ExecState* exec, QMetaMethod mtd = meta->method(tooFewArgs.at(i)); message += QString::fromLatin1(" %0").arg(QString::fromLatin1(mtd.signature())); } - *pError = throwError(exec, SyntaxError, message.toLatin1().constData()); + *pError = throwError(exec, createSyntaxError(exec, message.toLatin1().constData())); } } @@ -1321,7 +1321,7 @@ static int findMethodIndex(ExecState* exec, message += QString::fromLatin1(" %0").arg(QString::fromLatin1(mtd.signature())); } } - *pError = throwError(exec, TypeError, message.toLatin1().constData()); + *pError = throwError(exec, createTypeError(exec, message.toLatin1().constData())); } else { chosenIndex = bestMatch.index; args = bestMatch.args; @@ -1377,13 +1377,13 @@ void QtRuntimeMetaMethod::markChildren(MarkStack& markStack) markStack.append(d->m_disconnect); } -JSValue QtRuntimeMetaMethod::call(ExecState* exec) +EncodedJSValue QtRuntimeMetaMethod::call(ExecState* exec) { QtRuntimeMetaMethodData* d = static_cast<QtRuntimeMetaMethod *>(exec->callee())->d_func(); // We're limited to 10 args if (exec->argumentCount() > 10) - return jsUndefined(); + return JSValue::encode(jsUndefined()); // We have to pick a method that matches.. JSLock lock(SilenceAssertionsOnly); @@ -1397,20 +1397,20 @@ JSValue QtRuntimeMetaMethod::call(ExecState* exec) JSObject* errorObj = 0; if ((methodIndex = findMethodIndex(exec, obj->metaObject(), d->m_signature, d->m_allowPrivate, vargs, (void **)qargs, &errorObj)) != -1) { if (QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod, methodIndex, qargs) >= 0) - return jsUndefined(); + return JSValue::encode(jsUndefined()); if (vargs[0].isValid()) - return convertQVariantToValue(exec, d->m_instance->rootObject(), vargs[0]); + return JSValue::encode(convertQVariantToValue(exec, d->m_instance->rootObject(), vargs[0])); } if (errorObj) - return errorObj; + return JSValue::encode(errorObj); } else { - return throwError(exec, GeneralError, "cannot call function of deleted QObject"); + return throwVMError(exec, createError(exec, "cannot call function of deleted QObject")); } // void functions return undefined - return jsUndefined(); + return JSValue::encode(jsUndefined()); } CallType QtRuntimeMetaMethod::getCallData(CallData& callData) @@ -1512,7 +1512,7 @@ QtRuntimeConnectionMethod::QtRuntimeConnectionMethod(ExecState* exec, const Iden d->m_isConnect = isConnect; } -JSValue QtRuntimeConnectionMethod::call(ExecState* exec) +EncodedJSValue QtRuntimeConnectionMethod::call(ExecState* exec) { QtRuntimeConnectionMethodData* d = static_cast<QtRuntimeConnectionMethod *>(exec->callee())->d_func(); @@ -1539,9 +1539,9 @@ JSValue QtRuntimeConnectionMethod::call(ExecState* exec) CallData callData; if (funcObject->getCallData(callData) == CallTypeNone) { if (d->m_isConnect) - return throwError(exec, TypeError, "QtMetaMethod.connect: target is not a function"); + return throwVMError(exec, createTypeError(exec, "QtMetaMethod.connect: target is not a function")); else - return throwError(exec, TypeError, "QtMetaMethod.disconnect: target is not a function"); + return throwVMError(exec, createTypeError(exec, "QtMetaMethod.disconnect: target is not a function")); } } else if (exec->argumentCount() >= 2) { if (exec->argument(0).isObject()) { @@ -1567,22 +1567,22 @@ JSValue QtRuntimeConnectionMethod::call(ExecState* exec) funcObject = asFuncObj; } else { if (d->m_isConnect) - return throwError(exec, TypeError, "QtMetaMethod.connect: target is not a function"); + return throwVMError(exec, createTypeError(exec, "QtMetaMethod.connect: target is not a function")); else - return throwError(exec, TypeError, "QtMetaMethod.disconnect: target is not a function"); + return throwVMError(exec, createTypeError(exec, "QtMetaMethod.disconnect: target is not a function")); } } } else { if (d->m_isConnect) - return throwError(exec, TypeError, "QtMetaMethod.connect: thisObject is not an object"); + return throwVMError(exec, createTypeError(exec, "QtMetaMethod.connect: thisObject is not an object")); else - return throwError(exec, TypeError, "QtMetaMethod.disconnect: thisObject is not an object"); + return throwVMError(exec, createTypeError(exec, "QtMetaMethod.disconnect: thisObject is not an object")); } } else { if (d->m_isConnect) - return throwError(exec, GeneralError, "QtMetaMethod.connect: no arguments given"); + return throwVMError(exec, createError(exec, "QtMetaMethod.connect: no arguments given")); else - return throwError(exec, GeneralError, "QtMetaMethod.disconnect: no arguments given"); + return throwVMError(exec, createError(exec, "QtMetaMethod.disconnect: no arguments given")); } if (d->m_isConnect) { @@ -1599,7 +1599,7 @@ JSValue QtRuntimeConnectionMethod::call(ExecState* exec) QString msg = QString(QLatin1String("QtMetaMethod.connect: failed to connect to %1::%2()")) .arg(QLatin1String(sender->metaObject()->className())) .arg(QLatin1String(d->m_signature)); - return throwError(exec, GeneralError, msg.toLatin1().constData()); + return throwVMError(exec, createError(exec, msg.toLatin1().constData())); } else { // Store connection @@ -1625,7 +1625,7 @@ JSValue QtRuntimeConnectionMethod::call(ExecState* exec) QString msg = QString(QLatin1String("QtMetaMethod.disconnect: failed to disconnect from %1::%2()")) .arg(QLatin1String(sender->metaObject()->className())) .arg(QLatin1String(d->m_signature)); - return throwError(exec, GeneralError, msg.toLatin1().constData()); + return throwVMError(exec, createError(exec, msg.toLatin1().constData())); } } } else { @@ -1633,13 +1633,13 @@ JSValue QtRuntimeConnectionMethod::call(ExecState* exec) .arg(QLatin1String(d->m_isConnect ? "connect": "disconnect")) .arg(QLatin1String(sender->metaObject()->className())) .arg(QLatin1String(d->m_signature)); - return throwError(exec, TypeError, msg.toLatin1().constData()); + return throwVMError(exec, createTypeError(exec, msg.toLatin1().constData())); } } else { - return throwError(exec, GeneralError, "cannot call function of deleted QObject"); + return throwVMError(exec, createError(exec, "cannot call function of deleted QObject")); } - return jsUndefined(); + return JSValue::encode(jsUndefined()); } CallType QtRuntimeConnectionMethod::getCallData(CallData& callData) diff --git a/WebCore/bridge/qt/qt_runtime.h b/WebCore/bridge/qt/qt_runtime.h index cc13e59..68bf865 100644 --- a/WebCore/bridge/qt/qt_runtime.h +++ b/WebCore/bridge/qt/qt_runtime.h @@ -182,7 +182,7 @@ protected: private: virtual CallType getCallData(CallData&); - static JSValue JSC_HOST_CALL call(ExecState* exec); + static EncodedJSValue JSC_HOST_CALL call(ExecState* exec); static JSValue lengthGetter(ExecState*, JSValue, const Identifier&); static JSValue connectGetter(ExecState*, JSValue, const Identifier&); static JSValue disconnectGetter(ExecState*, JSValue, const Identifier&); @@ -203,7 +203,7 @@ protected: private: virtual CallType getCallData(CallData&); - static JSValue JSC_HOST_CALL call(ExecState* exec); + static EncodedJSValue JSC_HOST_CALL call(ExecState* exec); static JSValue lengthGetter(ExecState*, JSValue, const Identifier&); static QMultiMap<QObject *, QtConnectionObject *> connections; friend class QtConnectionObject; diff --git a/WebCore/bridge/runtime_array.cpp b/WebCore/bridge/runtime_array.cpp index 1f2bfe7..2cd7d66 100644 --- a/WebCore/bridge/runtime_array.cpp +++ b/WebCore/bridge/runtime_array.cpp @@ -129,7 +129,7 @@ bool RuntimeArray::getOwnPropertySlot(ExecState *exec, unsigned index, PropertyS void RuntimeArray::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) { if (propertyName == exec->propertyNames().length) { - throwError(exec, RangeError); + throwError(exec, createRangeError(exec, "Range error")); return; } @@ -146,7 +146,7 @@ void RuntimeArray::put(ExecState* exec, const Identifier& propertyName, JSValue void RuntimeArray::put(ExecState* exec, unsigned index, JSValue value) { if (index >= getLength()) { - throwError(exec, RangeError); + throwError(exec, createRangeError(exec, "Range error")); return; } diff --git a/WebCore/bridge/runtime_method.cpp b/WebCore/bridge/runtime_method.cpp index 391129e..15e029c 100644 --- a/WebCore/bridge/runtime_method.cpp +++ b/WebCore/bridge/runtime_method.cpp @@ -87,12 +87,12 @@ bool RuntimeMethod::getOwnPropertyDescriptor(ExecState* exec, const Identifier& return InternalFunction::getOwnPropertyDescriptor(exec, propertyName, descriptor); } -static JSValue JSC_HOST_CALL callRuntimeMethod(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL callRuntimeMethod(ExecState* exec) { RuntimeMethod* method = static_cast<RuntimeMethod*>(exec->callee()); if (method->methods()->isEmpty()) - return jsUndefined(); + return JSValue::encode(jsUndefined()); RefPtr<Instance> instance; @@ -101,7 +101,7 @@ static JSValue JSC_HOST_CALL callRuntimeMethod(ExecState* exec) RuntimeObject* runtimeObject = static_cast<RuntimeObject*>(asObject(thisValue)); instance = runtimeObject->getInternalInstance(); if (!instance) - return RuntimeObject::throwInvalidAccessError(exec); + return JSValue::encode(RuntimeObject::throwInvalidAccessError(exec)); } else { // Calling a runtime object of a plugin element? if (thisValue.inherits(&JSHTMLElement::s_info)) { @@ -109,14 +109,14 @@ static JSValue JSC_HOST_CALL callRuntimeMethod(ExecState* exec) instance = pluginInstance(element); } if (!instance) - return throwError(exec, TypeError); + return throwVMTypeError(exec); } ASSERT(instance); instance->begin(); JSValue result = instance->invokeMethod(exec, method); instance->end(); - return result; + return JSValue::encode(result); } CallType RuntimeMethod::getCallData(CallData& callData) diff --git a/WebCore/bridge/runtime_object.cpp b/WebCore/bridge/runtime_object.cpp index 107b780..9c5d7b6 100644 --- a/WebCore/bridge/runtime_object.cpp +++ b/WebCore/bridge/runtime_object.cpp @@ -253,14 +253,14 @@ JSValue RuntimeObject::defaultValue(ExecState* exec, PreferredPrimitiveType hint return result; } -static JSValue JSC_HOST_CALL callRuntimeObject(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL callRuntimeObject(ExecState* exec) { ASSERT(exec->callee()->inherits(&RuntimeObject::s_info)); RefPtr<Instance> instance(static_cast<RuntimeObject*>(exec->callee())->getInternalInstance()); instance->begin(); JSValue result = instance->invokeDefaultMethod(exec); instance->end(); - return result; + return JSValue::encode(result); } CallType RuntimeObject::getCallData(CallData& callData) @@ -276,16 +276,18 @@ CallType RuntimeObject::getCallData(CallData& callData) return CallTypeHost; } -static JSObject* callRuntimeConstructor(ExecState* exec, JSObject* constructor, const ArgList& args) +static EncodedJSValue JSC_HOST_CALL callRuntimeConstructor(ExecState* exec) { + JSObject* constructor = exec->callee(); ASSERT(constructor->inherits(&RuntimeObject::s_info)); - RefPtr<Instance> instance(static_cast<RuntimeObject*>(constructor)->getInternalInstance()); + RefPtr<Instance> instance(static_cast<RuntimeObject*>(exec->callee())->getInternalInstance()); instance->begin(); + ArgList args(exec); JSValue result = instance->invokeConstruct(exec, args); instance->end(); ASSERT(result); - return result.isObject() ? static_cast<JSObject*>(result.asCell()) : constructor; + return JSValue::encode(result.isObject() ? static_cast<JSObject*>(result.asCell()) : constructor); } ConstructType RuntimeObject::getConstructData(ConstructData& constructData) @@ -317,7 +319,7 @@ void RuntimeObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray& prop JSObject* RuntimeObject::throwInvalidAccessError(ExecState* exec) { - return throwError(exec, ReferenceError, "Trying to access object from destroyed plug-in."); + return throwError(exec, createReferenceError(exec, "Trying to access object from destroyed plug-in.")); } } diff --git a/WebCore/config.h b/WebCore/config.h index 48f9543..d3980c5 100644 --- a/WebCore/config.h +++ b/WebCore/config.h @@ -321,3 +321,7 @@ typedef float CGFloat; #if PLATFORM(WIN) && PLATFORM(CG) #define WTF_USE_SAFARI_THEME 1 #endif + +#if defined(WTF_USE_V8) +#define USE_NEW_QUERY_CALLBACKS +#endif diff --git a/WebCore/css/CSSComputedStyleDeclaration.cpp b/WebCore/css/CSSComputedStyleDeclaration.cpp index 35fbb7d..23366cf 100644 --- a/WebCore/css/CSSComputedStyleDeclaration.cpp +++ b/WebCore/css/CSSComputedStyleDeclaration.cpp @@ -268,7 +268,8 @@ static const int computedProperties[] = { CSSPropertyWritingMode, CSSPropertyGlyphOrientationHorizontal, CSSPropertyGlyphOrientationVertical, - CSSPropertyWebkitSvgShadow + CSSPropertyWebkitSvgShadow, + CSSPropertyVectorEffect #endif #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR , diff --git a/WebCore/css/CSSCursorImageValue.cpp b/WebCore/css/CSSCursorImageValue.cpp index 239048d..f2e5d95 100644 --- a/WebCore/css/CSSCursorImageValue.cpp +++ b/WebCore/css/CSSCursorImageValue.cpp @@ -52,9 +52,9 @@ static inline SVGCursorElement* resourceReferencedByCursorElement(const String& } #endif -CSSCursorImageValue::CSSCursorImageValue(const String& url, const IntPoint& hotspot) +CSSCursorImageValue::CSSCursorImageValue(const String& url, const IntPoint& hotSpot) : CSSImageValue(url) - , m_hotspot(hotspot) + , m_hotSpot(hotSpot) { } @@ -90,11 +90,12 @@ bool CSSCursorImageValue::updateIfSVGCursorIsUsed(Element* element) return false; if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(url, element->document())) { + // FIXME: This will override hot spot specified in CSS, which is probably incorrect. float x = roundf(cursorElement->x().value(0)); - m_hotspot.setX(static_cast<int>(x)); + m_hotSpot.setX(static_cast<int>(x)); float y = roundf(cursorElement->y().value(0)); - m_hotspot.setY(static_cast<int>(y)); + m_hotSpot.setY(static_cast<int>(y)); if (cachedImageURL() != element->document()->completeURL(cursorElement->href())) clearCachedImage(); diff --git a/WebCore/css/CSSCursorImageValue.h b/WebCore/css/CSSCursorImageValue.h index efcdda6..742138c 100644 --- a/WebCore/css/CSSCursorImageValue.h +++ b/WebCore/css/CSSCursorImageValue.h @@ -32,14 +32,14 @@ class SVGElement; class CSSCursorImageValue : public CSSImageValue { public: - static PassRefPtr<CSSCursorImageValue> create(const String& url, const IntPoint& hotspot) + static PassRefPtr<CSSCursorImageValue> create(const String& url, const IntPoint& hotSpot) { - return adoptRef(new CSSCursorImageValue(url, hotspot)); + return adoptRef(new CSSCursorImageValue(url, hotSpot)); } virtual ~CSSCursorImageValue(); - IntPoint hotspot() const { return m_hotspot; } + IntPoint hotSpot() const { return m_hotSpot; } bool updateIfSVGCursorIsUsed(Element*); virtual StyleCachedImage* cachedImage(DocLoader*); @@ -49,9 +49,9 @@ public: #endif private: - CSSCursorImageValue(const String& url, const IntPoint& hotspot); + CSSCursorImageValue(const String& url, const IntPoint& hotSpot); - IntPoint m_hotspot; + IntPoint m_hotSpot; #if ENABLE(SVG) HashSet<SVGElement*> m_referencedElements; diff --git a/WebCore/css/CSSOMUtils.cpp b/WebCore/css/CSSOMUtils.cpp new file mode 100644 index 0000000..d1e9638 --- /dev/null +++ b/WebCore/css/CSSOMUtils.cpp @@ -0,0 +1,121 @@ +/* + * 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 "CSSOMUtils.h" + +#include "PlatformString.h" + +namespace WebCore { + +static void appendCharacter(UChar32 c, Vector<UChar>& appendTo) +{ + if (U16_LENGTH(c) == 1) + appendTo.append(static_cast<UChar>(c)); + else { + appendTo.append(U16_LEAD(c)); + appendTo.append(U16_TRAIL(c)); + } +} + +void serializeCharacter(UChar32 c, Vector<UChar>& appendTo) +{ + appendTo.append('\\'); + appendCharacter(c, appendTo); +} + +void serializeCharacterAsCodePoint(UChar32 c, Vector<UChar>& appendTo) +{ + append(appendTo, String::format("\\%x ", c)); +} + +void serializeIdentifier(const String& identifier, String& appendTo) +{ + Vector<UChar> addend; + serializeIdentifier(identifier, addend); + appendTo.append(String::adopt(addend)); +} + +void serializeIdentifier(const String& identifier, Vector<UChar>& appendTo) +{ + bool isFirst = true; + bool isSecond = false; + bool isFirstCharHyphen = false; + unsigned index = 0; + while (index < identifier.length()) { + UChar32 c = identifier.characterStartingAt(index); + index += U16_LENGTH(c); + + if (c <= 0x1f || (0x30 <= c && c <= 0x39 && (isFirst || (isSecond && isFirstCharHyphen)))) + serializeCharacterAsCodePoint(c, appendTo); + else if (c == 0x2d && isSecond && isFirstCharHyphen) + serializeCharacter(c, appendTo); + else if (0x80 <= c || c == 0x2d || c == 0x5f || (0x30 <= c && c <= 0x39) || (0x41 <= c && c <= 0x5a) || (0x61 <= c && c <= 0x7a)) + appendCharacter(c, appendTo); + else + serializeCharacter(c, appendTo); + + if (isFirst) { + isFirst = false; + isSecond = true; + isFirstCharHyphen = (c == 0x2d); + } else if (isSecond) { + isSecond = false; + } + } +} + +void serializeString(const String& string, String& appendTo) +{ + Vector<UChar> addend; + serializeString(string, addend); + appendTo.append(String::adopt(addend)); +} + +void serializeString(const String& string, Vector<UChar>& appendTo) +{ + appendTo.append('\"'); + + unsigned index = 0; + while (index < string.length()) { + UChar32 c = string.characterStartingAt(index); + index += U16_LENGTH(c); + if (c <= 0x1f) + serializeCharacterAsCodePoint(c, appendTo); + else if (c == 0x22 || c == 0x5c) + serializeCharacter(c, appendTo); + else + appendCharacter(c, appendTo); + } + + appendTo.append('\"'); +} + +} // namespace WebCore diff --git a/WebCore/css/CSSOMUtils.h b/WebCore/css/CSSOMUtils.h new file mode 100644 index 0000000..6602b35 --- /dev/null +++ b/WebCore/css/CSSOMUtils.h @@ -0,0 +1,53 @@ +/* + * 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 CSSOMUtils_h +#define CSSOMUtils_h + +#include <wtf/Vector.h> +#include <wtf/unicode/Unicode.h> + +// Utilities for CSSOM http://dev.w3.org/csswg/cssom/ + +namespace WebCore { + +class String; + +// Common serializing methods. See: http://dev.w3.org/csswg/cssom/#common-serializing-idioms +void serializeCharacter(UChar32, Vector<UChar>& appendTo); +void serializeCharacterAsCodePoint(UChar32, Vector<UChar>& appendTo); +void serializeIdentifier(const String& identifier, String& appendTo); +void serializeIdentifier(const String& identifier, Vector<UChar>& appendTo); +void serializeString(const String& string, String& appendTo); +void serializeString(const String& string, Vector<UChar>& appendTo); + +} // namespace WebCore + +#endif // CSSOMUtils_h diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp index 76f9fb1..8934656 100644 --- a/WebCore/css/CSSParser.cpp +++ b/WebCore/css/CSSParser.cpp @@ -89,7 +89,7 @@ using namespace std; using namespace WTF; #include "CSSPropertyNames.cpp" -#include "CSSValueKeywords.c" +#include "CSSValueKeywords.cpp" #ifdef ANDROID_INSTRUMENT #include "TimeCounter.h" @@ -894,17 +894,17 @@ bool CSSParser::parseValue(int propId, bool important) coords.append(int(value->fValue)); value = m_valueList->next(); } - IntPoint hotspot; + IntPoint hotSpot(-1, -1); int nrcoords = coords.size(); if (nrcoords > 0 && nrcoords != 2) return false; if (nrcoords == 2) - hotspot = IntPoint(coords[0], coords[1]); + hotSpot = IntPoint(coords[0], coords[1]); if (!uri.isNull() && m_styleSheet) { // FIXME: The completeURL call should be done when using the CSSCursorImageValue, // not when creating it. - list->append(CSSCursorImageValue::create(m_styleSheet->completeURL(uri), hotspot)); + list->append(CSSCursorImageValue::create(m_styleSheet->completeURL(uri), hotSpot)); } if ((m_strict && !value) || (value && !(value->unit == CSSParserValue::Operator && value->iValue == ','))) @@ -3855,7 +3855,7 @@ PassRefPtr<CSSPrimitiveValue> CSSParser::parseColor(CSSParserValue* value) return CSSPrimitiveValue::createColor(c); } -bool CSSParser::parseColorFromValue(CSSParserValue* value, RGBA32& c, bool svg) +bool CSSParser::parseColorFromValue(CSSParserValue* value, RGBA32& c) { if (!m_strict && value->unit == CSSPrimitiveValue::CSS_NUMBER && value->fValue >= 0. && value->fValue < 1000000.) { @@ -3875,7 +3875,7 @@ bool CSSParser::parseColorFromValue(CSSParserValue* value, RGBA32& c, bool svg) if (!parseColorParameters(value, colorValues, false)) return false; c = makeRGB(colorValues[0], colorValues[1], colorValues[2]); - } else if (!svg) { + } else { if (value->unit == CSSParserValue::Function && value->function->args != 0 && value->function->args->size() == 7 /* rgba + three commas */ && @@ -3902,8 +3902,7 @@ bool CSSParser::parseColorFromValue(CSSParserValue* value, RGBA32& c, bool svg) c = makeRGBAFromHSLA(colorValues[0], colorValues[1], colorValues[2], colorValues[3]); } else return false; - } else - return false; + } return true; } @@ -5628,7 +5627,7 @@ static int cssPropertyID(const UChar* propertyName, unsigned length) } } - const props* hashTableEntry = findProp(name, length); + const Property* hashTableEntry = findProperty(name, length); return hashTableEntry ? hashTableEntry->id : 0; } @@ -5670,7 +5669,7 @@ int cssValueKeywordID(const CSSParserString& string) } } - const css_value* hashTableEntry = findValue(buffer, length); + const Value* hashTableEntry = findValue(buffer, length); return hashTableEntry ? hashTableEntry->id : 0; } diff --git a/WebCore/css/CSSParser.h b/WebCore/css/CSSParser.h index 271e98e..81b1ae2 100644 --- a/WebCore/css/CSSParser.h +++ b/WebCore/css/CSSParser.h @@ -126,7 +126,7 @@ namespace WebCore { bool parseColorParameters(CSSParserValue*, int* colorValues, bool parseAlpha); bool parseHSLParameters(CSSParserValue*, double* colorValues, bool parseAlpha); PassRefPtr<CSSPrimitiveValue> parseColor(CSSParserValue* = 0); - bool parseColorFromValue(CSSParserValue*, RGBA32&, bool = false); + bool parseColorFromValue(CSSParserValue*, RGBA32&); void parseSelector(const String&, Document* doc, CSSSelectorList&); static bool parseColor(const String&, RGBA32& rgb, bool strict); diff --git a/WebCore/css/CSSPrimitiveValueMappings.h b/WebCore/css/CSSPrimitiveValueMappings.h index 0f302a0..f646b29 100644 --- a/WebCore/css/CSSPrimitiveValueMappings.h +++ b/WebCore/css/CSSPrimitiveValueMappings.h @@ -2,6 +2,8 @@ * Copyright (C) 2007 Alexey Proskuryakov <ap@nypop.com>. * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) + * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com> + * Copyright (C) Research In Motion Limited 2010. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -278,6 +280,18 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e) case MeterPart: m_value.ident = CSSValueMeter; break; + case RelevancyLevelIndicatorPart: + m_value.ident = CSSValueRelevancyLevelIndicator; + break; + case ContinuousCapacityLevelIndicatorPart: + m_value.ident = CSSValueContinuousCapacityLevelIndicator; + break; + case DiscreteCapacityLevelIndicatorPart: + m_value.ident = CSSValueDiscreteCapacityLevelIndicator; + break; + case RatingLevelIndicatorPart: + m_value.ident = CSSValueRatingLevelIndicator; + break; case OuterSpinButtonPart: m_value.ident = CSSValueOuterSpinButton; break; @@ -2587,6 +2601,33 @@ template<> inline CSSPrimitiveValue::operator EWritingMode() const return static_cast<EWritingMode>(m_value.ident - CSSValueLrTb); } +template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EVectorEffect e) + : m_type(CSS_IDENT) + , m_hasCachedCSSText(false) +{ + switch (e) { + case VE_NONE: + m_value.ident = CSSValueNone; + break; + case VE_NON_SCALING_STROKE: + m_value.ident = CSSValueNonScalingStroke; + break; + } +} + +template<> inline CSSPrimitiveValue::operator EVectorEffect() const +{ + switch (m_value.ident) { + case CSSValueNone: + return VE_NONE; + case CSSValueNonScalingStroke: + return VE_NON_SCALING_STROKE; + default: + ASSERT_NOT_REACHED(); + return VE_NONE; + } +} + #endif } diff --git a/WebCore/css/CSSSelector.cpp b/WebCore/css/CSSSelector.cpp index 5add90b..e45bf4c 100644 --- a/WebCore/css/CSSSelector.cpp +++ b/WebCore/css/CSSSelector.cpp @@ -25,9 +25,9 @@ #include "config.h" #include "CSSSelector.h" -#include "wtf/Assertions.h" +#include "CSSOMUtils.h" #include "HTMLNames.h" - +#include <wtf/Assertions.h> #include <wtf/HashMap.h> #include <wtf/StdLibExtras.h> @@ -585,10 +585,10 @@ String CSSSelector::selectorText() const while (true) { if (cs->m_match == CSSSelector::Id) { str += "#"; - str += cs->m_value; + serializeIdentifier(cs->m_value, str); } else if (cs->m_match == CSSSelector::Class) { str += "."; - str += cs->m_value; + serializeIdentifier(cs->m_value, str); } else if (cs->m_match == CSSSelector::PseudoClass || cs->m_match == CSSSelector::PagePseudoClass) { str += ":"; str += cs->m_value; @@ -640,9 +640,8 @@ String CSSSelector::selectorText() const break; } if (cs->m_match != CSSSelector::Set) { - str += "\""; - str += cs->m_value; - str += "\"]"; + serializeString(cs->m_value, str); + str += "]"; } } if (cs->relation() != CSSSelector::SubSelector || !cs->tagHistory()) diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp index 92ba843..13bdeb9 100644 --- a/WebCore/css/CSSStyleSelector.cpp +++ b/WebCore/css/CSSStyleSelector.cpp @@ -2,7 +2,7 @@ * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) - * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) @@ -357,7 +357,8 @@ public: typedef HashMap<AtomicStringImpl*, CSSRuleDataList*> AtomRuleMap; void addRulesFromSheet(CSSStyleSheet*, const MediaQueryEvaluator&, CSSStyleSelector* = 0); - + + void addStyleRule(StyleBase* item); void addRule(CSSStyleRule* rule, CSSSelector* sel); void addPageRule(CSSStyleRule* rule, CSSSelector* sel); void addToRuleSet(AtomicStringImpl* key, AtomRuleMap& map, @@ -666,7 +667,7 @@ void CSSStyleSelector::matchRules(CSSRuleSet* rules, int& firstRuleIndex, int& l // We need to collect the rules for id, class, tag, and everything else into a buffer and // then sort the buffer. if (m_element->hasID()) - matchRulesForList(rules->getIDRules(m_element->getIDAttribute().impl()), firstRuleIndex, lastRuleIndex); + matchRulesForList(rules->getIDRules(m_element->idForStyleResolution().impl()), firstRuleIndex, lastRuleIndex); if (m_element->hasClass()) { ASSERT(m_styledElement); const SpaceSplitString& classNames = m_styledElement->classNames(); @@ -2037,7 +2038,7 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme return e->hasClass() && static_cast<StyledElement*>(e)->classNames().contains(sel->m_value); if (sel->m_match == CSSSelector::Id) - return e->hasID() && e->getIDAttribute() == sel->m_value; + return e->hasID() && e->idForStyleResolution() == sel->m_value; const QualifiedName& attr = sel->attribute(); @@ -2768,14 +2769,7 @@ void CSSRuleSet::addRulesFromSheet(CSSStyleSheet* sheet, const MediaQueryEvaluat for (int i = 0; i < len; i++) { StyleBase* item = sheet->item(i); if (item->isStyleRule()) { - if (item->isPageRule()) { - CSSPageRule* pageRule = static_cast<CSSPageRule*>(item); - addPageRule(pageRule, pageRule->selectorList().first()); - } else { - CSSStyleRule* rule = static_cast<CSSStyleRule*>(item); - for (CSSSelector* s = rule->selectorList().first(); s; s = CSSSelectorList::next(s)) - addRule(rule, s); - } + addStyleRule(item); } else if (item->isImportRule()) { CSSImportRule* import = static_cast<CSSImportRule*>(item); @@ -2792,9 +2786,7 @@ void CSSRuleSet::addRulesFromSheet(CSSStyleSheet* sheet, const MediaQueryEvaluat CSSRule *childItem = rules->item(j); if (childItem->isStyleRule()) { // It is a StyleRule, so append it to our list - CSSStyleRule* rule = static_cast<CSSStyleRule*>(childItem); - for (CSSSelector* s = rule->selectorList().first(); s; s = CSSSelectorList::next(s)) - addRule(rule, s); + addStyleRule(childItem); } else if (childItem->isFontFaceRule() && styleSelector) { // Add this font face to our set. const CSSFontFaceRule* fontFaceRule = static_cast<CSSFontFaceRule*>(childItem); @@ -2819,6 +2811,18 @@ void CSSRuleSet::addRulesFromSheet(CSSStyleSheet* sheet, const MediaQueryEvaluat } } +void CSSRuleSet::addStyleRule(StyleBase* item) +{ + if (item->isPageRule()) { + CSSPageRule* pageRule = static_cast<CSSPageRule*>(item); + addPageRule(pageRule, pageRule->selectorList().first()); + } else { + CSSStyleRule* rule = static_cast<CSSStyleRule*>(item); + for (CSSSelector* s = rule->selectorList().first(); s; s = CSSSelectorList::next(s)) + addRule(rule, s); + } +} + // ------------------------------------------------------------------------------------- // this is mostly boring stuff on how to apply a certain rule to the renderstyle... @@ -3393,7 +3397,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) // StyleImage. RefPtr<StyleCachedImage> styleCachedImage(image->cachedImage(m_element->document()->docLoader())); if (styleCachedImage) - m_style->addCursor(styleCachedImage->cachedImage(), image->hotspot()); + m_style->addCursor(styleCachedImage->cachedImage(), image->hotSpot()); } else if (type == CSSPrimitiveValue::CSS_IDENT) m_style->setCursor(*primitiveValue); } diff --git a/WebCore/css/CSSStyleSheet.cpp b/WebCore/css/CSSStyleSheet.cpp index fb25374..ad63265 100644 --- a/WebCore/css/CSSStyleSheet.cpp +++ b/WebCore/css/CSSStyleSheet.cpp @@ -207,7 +207,7 @@ void CSSStyleSheet::checkLoaded() if (parent()) parent()->checkLoaded(); - // Avoid |this| being deleted by scripts that run via HTMLTokenizer::executeScriptsWaitingForStylesheets(). + // Avoid |this| being deleted by scripts that run via HTMLDocumentParser::executeScriptsWaitingForStylesheets(). // See <rdar://problem/6622300>. RefPtr<CSSStyleSheet> protector(this); m_loadCompleted = ownerNode() ? ownerNode()->sheetLoaded() : true; @@ -245,8 +245,7 @@ void CSSStyleSheet::addSubresourceStyleURLs(ListHashSet<KURL>& urls) styleSheetQueue.append(this); while (!styleSheetQueue.isEmpty()) { - CSSStyleSheet* styleSheet = styleSheetQueue.first(); - styleSheetQueue.removeFirst(); + CSSStyleSheet* styleSheet = styleSheetQueue.takeFirst(); for (unsigned i = 0; i < styleSheet->length(); ++i) { StyleBase* styleBase = styleSheet->item(i); diff --git a/WebCore/css/CSSValueKeywords.in b/WebCore/css/CSSValueKeywords.in index a20e64f..154183b 100644 --- a/WebCore/css/CSSValueKeywords.in +++ b/WebCore/css/CSSValueKeywords.in @@ -604,8 +604,12 @@ searchfield-results-decoration searchfield-results-button searchfield-cancel-button textfield -textarea caps-lock-indicator +relevancy-level-indicator +continuous-capacity-level-indicator +discrete-capacity-level-indicator +rating-level-indicator +textarea # # CSS_PROP_BORDER_IMAGE diff --git a/WebCore/css/MediaQuery.cpp b/WebCore/css/MediaQuery.cpp index ff57372..187a33d 100644 --- a/WebCore/css/MediaQuery.cpp +++ b/WebCore/css/MediaQuery.cpp @@ -2,6 +2,7 @@ * CSS Media Query * * Copyright (C) 2005, 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,69 +30,100 @@ #include "MediaQuery.h" #include "MediaQueryExp.h" +#include "StringBuilder.h" + +#include <algorithm> namespace WebCore { -MediaQuery::MediaQuery(Restrictor r, const String& mediaType, Vector<MediaQueryExp*>* exprs) +// http://dev.w3.org/csswg/cssom/#serialize-a-media-query +String MediaQuery::serialize() const +{ + StringBuilder result; + + switch (m_restrictor) { + case MediaQuery::Only: + result.append("only "); + break; + case MediaQuery::Not: + result.append("not "); + break; + case MediaQuery::None: + break; + } + + if (m_expressions->isEmpty()) { + result.append(m_mediaType); + return result.toString(); + } + + if (m_mediaType != "all" || m_restrictor != None) { + result.append(m_mediaType); + result.append(" and "); + } + + result.append(m_expressions->at(0)->serialize()); + for (size_t i = 1; i < m_expressions->size(); ++i) { + result.append(" and "); + result.append(m_expressions->at(i)->serialize()); + } + return result.toString(); +} + +static bool expressionCompare(const MediaQueryExp* a, const MediaQueryExp* b) +{ + return codePointCompare(a->serialize(), b->serialize()) < 0; +} + +MediaQuery::MediaQuery(Restrictor r, const String& mediaType, PassOwnPtr<Vector<MediaQueryExp*> > exprs) : m_restrictor(r) - , m_mediaType(mediaType) - , m_expressions(exprs) + , m_mediaType(mediaType.lower()) + , m_expressions(exprs.release()) + , m_ignored(false) { - if (!m_expressions) + if (!m_expressions) { m_expressions = new Vector<MediaQueryExp*>; + return; + } + + std::sort(m_expressions->begin(), m_expressions->end(), expressionCompare); + + // remove all duplicated expressions + String key; + for (int i = m_expressions->size() - 1; i >= 0; --i) { + + // if not all of the expressions is valid the media query must be ignored. + if (!m_ignored) + m_ignored = !m_expressions->at(i)->isValid(); + + if (m_expressions->at(i)->serialize() == key) { + MediaQueryExp* item = m_expressions->at(i); + m_expressions->remove(i); + delete item; + } else + key = m_expressions->at(i)->serialize(); + } } MediaQuery::~MediaQuery() { - if (m_expressions) { - deleteAllValues(*m_expressions); - delete m_expressions; - } + deleteAllValues(*m_expressions); + delete m_expressions; } +// http://dev.w3.org/csswg/cssom/#compare-media-queries bool MediaQuery::operator==(const MediaQuery& other) const { - if (m_restrictor != other.m_restrictor - || m_mediaType != other.m_mediaType - || m_expressions->size() != other.m_expressions->size()) - return false; - - for (size_t i = 0; i < m_expressions->size(); ++i) { - MediaQueryExp* exp = m_expressions->at(i); - MediaQueryExp* oexp = other.m_expressions->at(i); - if (!(*exp == *oexp)) - return false; - } - - return true; + return cssText() == other.cssText(); } +// http://dev.w3.org/csswg/cssom/#serialize-a-list-of-media-queries String MediaQuery::cssText() const { - String text; - switch (m_restrictor) { - case MediaQuery::Only: - text += "only "; - break; - case MediaQuery::Not: - text += "not "; - break; - case MediaQuery::None: - default: - break; - } - text += m_mediaType; - for (size_t i = 0; i < m_expressions->size(); ++i) { - MediaQueryExp* exp = m_expressions->at(i); - text += " and ("; - text += exp->mediaFeature(); - if (exp->value()) { - text += ": "; - text += exp->value()->cssText(); - } - text += ")"; - } - return text; + if (m_serializationCache.isNull()) + const_cast<MediaQuery*>(this)->m_serializationCache = serialize(); + + return m_serializationCache; } } //namespace diff --git a/WebCore/css/MediaQuery.h b/WebCore/css/MediaQuery.h index 7cbd3bf..ccc59ac 100644 --- a/WebCore/css/MediaQuery.h +++ b/WebCore/css/MediaQuery.h @@ -2,6 +2,7 @@ * CSS Media Query * * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,7 +30,9 @@ #define MediaQuery_h #include "PlatformString.h" +#include <wtf/PassOwnPtr.h> #include <wtf/Vector.h> +#include <wtf/text/StringHash.h> namespace WebCore { class MediaQueryExp; @@ -40,20 +43,24 @@ public: Only, Not, None }; - MediaQuery(Restrictor r, const String& mediaType, Vector<MediaQueryExp*>* exprs); + MediaQuery(Restrictor r, const String& mediaType, PassOwnPtr<Vector<MediaQueryExp*> > exprs); ~MediaQuery(); Restrictor restrictor() const { return m_restrictor; } const Vector<MediaQueryExp*>* expressions() const { return m_expressions; } String mediaType() const { return m_mediaType; } bool operator==(const MediaQuery& other) const; - void append(MediaQueryExp* newExp) { m_expressions->append(newExp); } String cssText() const; + bool ignored() const { return m_ignored; } private: Restrictor m_restrictor; String m_mediaType; Vector<MediaQueryExp*>* m_expressions; + bool m_ignored; + String m_serializationCache; + + String serialize() const; }; } // namespace diff --git a/WebCore/css/MediaQueryEvaluator.cpp b/WebCore/css/MediaQueryEvaluator.cpp index 20c7bb9..9d5822f 100644 --- a/WebCore/css/MediaQueryEvaluator.cpp +++ b/WebCore/css/MediaQueryEvaluator.cpp @@ -144,6 +144,9 @@ bool MediaQueryEvaluator::eval(const MediaList* mediaList, CSSStyleSelector* sty for (size_t i = 0; i < queries.size() && !result; ++i) { MediaQuery* query = queries.at(i); + if (query->ignored()) + continue; + if (mediaTypeMatch(query->mediaType())) { const Vector<MediaQueryExp*>* exps = query->expressions(); // iterate through expressions, stop if any of them eval to false diff --git a/WebCore/css/MediaQueryExp.cpp b/WebCore/css/MediaQueryExp.cpp index 53c0b73..a93ddcc 100644 --- a/WebCore/css/MediaQueryExp.cpp +++ b/WebCore/css/MediaQueryExp.cpp @@ -2,6 +2,7 @@ * CSS Media Query * * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,6 +32,7 @@ #include "CSSParser.h" #include "CSSPrimitiveValue.h" #include "CSSValueList.h" +#include "StringBuilder.h" namespace WebCore { @@ -82,4 +84,22 @@ MediaQueryExp::~MediaQueryExp() { } +String MediaQueryExp::serialize() const +{ + if (!m_serializationCache.isNull()) + return m_serializationCache; + + StringBuilder result; + result.append("("); + result.append(m_mediaFeature.lower()); + if (m_value) { + result.append(": "); + result.append(m_value->cssText()); + } + result.append(")"); + + const_cast<MediaQueryExp*>(this)->m_serializationCache = result.toString(); + return m_serializationCache; +} + } // namespace diff --git a/WebCore/css/MediaQueryExp.h b/WebCore/css/MediaQueryExp.h index 9272402..24f2207 100644 --- a/WebCore/css/MediaQueryExp.h +++ b/WebCore/css/MediaQueryExp.h @@ -2,6 +2,7 @@ * CSS Media Query * * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -64,10 +65,14 @@ public: m_mediaFeature == MediaFeatureNames::aspect_ratioMediaFeature || m_mediaFeature == MediaFeatureNames::min_aspect_ratioMediaFeature || m_mediaFeature == MediaFeatureNames::max_aspect_ratioMediaFeature; } + + String serialize() const; + private: AtomicString m_mediaFeature; RefPtr<CSSValue> m_value; bool m_isValid; + String m_serializationCache; }; } // namespace diff --git a/WebCore/css/SVGCSSComputedStyleDeclaration.cpp b/WebCore/css/SVGCSSComputedStyleDeclaration.cpp index 25da148..00cb308 100644 --- a/WebCore/css/SVGCSSComputedStyleDeclaration.cpp +++ b/WebCore/css/SVGCSSComputedStyleDeclaration.cpp @@ -168,6 +168,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getSVGPropertyCSSValue(int pro } case CSSPropertyWebkitSvgShadow: return valueForShadow(svgStyle->shadow(), propertyID); + case CSSPropertyVectorEffect: + return CSSPrimitiveValue::create(svgStyle->vectorEffect()); case CSSPropertyMarker: case CSSPropertyEnableBackground: case CSSPropertyColorProfile: diff --git a/WebCore/css/SVGCSSParser.cpp b/WebCore/css/SVGCSSParser.cpp index 0986f1c..0d5cde6 100644 --- a/WebCore/css/SVGCSSParser.cpp +++ b/WebCore/css/SVGCSSParser.cpp @@ -183,7 +183,7 @@ bool CSSParser::parseSVGValue(int propId, bool important) parsedValue = SVGPaint::create(SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR); else if (value->unit == CSSPrimitiveValue::CSS_URI) { RGBA32 c = Color::transparent; - if (m_valueList->next() && parseColorFromValue(m_valueList->current(), c, true)) { + if (m_valueList->next() && parseColorFromValue(m_valueList->current(), c)) { parsedValue = SVGPaint::create(value->string, c); } else parsedValue = SVGPaint::create(SVGPaint::SVG_PAINTTYPE_URI, value->string); @@ -221,6 +221,11 @@ bool CSSParser::parseSVGValue(int propId, bool important) m_valueList->next(); break; + + case CSSPropertyVectorEffect: // none | non-scaling-stroke | inherit + if (id == CSSValueNone || id == CSSValueNonScalingStroke) + valid_primitive = true; + break; case CSSPropertyWritingMode: // lr-tb | rl_tb | tb-rl | lr | rl | tb | inherit @@ -330,7 +335,7 @@ PassRefPtr<CSSValue> CSSParser::parseSVGStrokeDasharray() PassRefPtr<CSSValue> CSSParser::parseSVGPaint() { RGBA32 c = Color::transparent; - if (!parseColorFromValue(m_valueList->current(), c, true)) + if (!parseColorFromValue(m_valueList->current(), c)) return SVGPaint::create(); return SVGPaint::create(Color(c)); } @@ -338,7 +343,7 @@ PassRefPtr<CSSValue> CSSParser::parseSVGPaint() PassRefPtr<CSSValue> CSSParser::parseSVGColor() { RGBA32 c = Color::transparent; - if (!parseColorFromValue(m_valueList->current(), c, true)) + if (!parseColorFromValue(m_valueList->current(), c)) return 0; return SVGColor::create(Color(c)); } diff --git a/WebCore/css/SVGCSSPropertyNames.in b/WebCore/css/SVGCSSPropertyNames.in index 9f97146..7c157a8 100644 --- a/WebCore/css/SVGCSSPropertyNames.in +++ b/WebCore/css/SVGCSSPropertyNames.in @@ -45,6 +45,7 @@ glyph-orientation-horizontal glyph-orientation-vertical kerning text-anchor +vector-effect writing-mode -webkit-svg-shadow diff --git a/WebCore/css/SVGCSSStyleSelector.cpp b/WebCore/css/SVGCSSStyleSelector.cpp index 1deb259..3b38890 100644 --- a/WebCore/css/SVGCSSStyleSelector.cpp +++ b/WebCore/css/SVGCSSStyleSelector.cpp @@ -552,6 +552,14 @@ void CSSStyleSelector::applySVGProperty(int id, CSSValue* value) svgstyle->setShadow(shadowData); return; } + case CSSPropertyVectorEffect: { + HANDLE_INHERIT_AND_INITIAL(vectorEffect, VectorEffect) + if (!primitiveValue) + break; + + svgstyle->setVectorEffect(*primitiveValue); + break; + } default: // If you crash here, it's because you added a css property and are not handling it // in either this switch statement or the one in CSSStyleSelector::applyProperty diff --git a/WebCore/css/SVGCSSValueKeywords.in b/WebCore/css/SVGCSSValueKeywords.in index 91fb57e..420fbd8 100644 --- a/WebCore/css/SVGCSSValueKeywords.in +++ b/WebCore/css/SVGCSSValueKeywords.in @@ -273,6 +273,11 @@ reset-size # middle # end +# CSS_PROP_VECTOR_EFFECT +# none +non-scaling-stroke + + # CSS_PROP_WRITING_MODE lr-tb rl-tb diff --git a/WebCore/css/StyleSheet.idl b/WebCore/css/StyleSheet.idl index 4f53689..5b52a33 100644 --- a/WebCore/css/StyleSheet.idl +++ b/WebCore/css/StyleSheet.idl @@ -33,6 +33,12 @@ module stylesheets { readonly attribute [ConvertNullStringTo=Null] DOMString href; readonly attribute [ConvertNullStringTo=Null] DOMString title; readonly attribute MediaList media; + +#if defined(LANGUAGE_CPP) && LANGUAGE_CPP + // Extra WebCore methods exposed to allowe compile-time casting in C++ + boolean isCSSStyleSheet(); +#endif + }; } diff --git a/WebCore/css/makeprop.pl b/WebCore/css/makeprop.pl index 115969f..0fd1f08 100644 --- a/WebCore/css/makeprop.pl +++ b/WebCore/css/makeprop.pl @@ -5,6 +5,7 @@ # Copyright (C) 1999 Waldo Bastian (bastian@kde.org) # Copyright (C) 2007, 2008 Apple Inc. All rights reserved. # Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) +# Copyright (C) 2010 Andras Becsi (abecsi@inf.u-szeged.hu), University of Szeged # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public @@ -39,10 +40,20 @@ print GPERF << "EOF"; /* This file is automatically generated from CSSPropertyNames.in by makeprop, do not edit */ #include \"CSSPropertyNames.h\" %} -struct props { +%struct-type +struct Property { const char* name; int id; }; +%language=ANSI-C +%readonly-tables +%global-table +%compare-strncmp +%define lookup-function-name findProperty +%define hash-function-name propery_hash_function +%define word-array-name property_wordlist +%includes +%enum %% EOF @@ -88,12 +99,13 @@ print HEADER << "EOF"; const char* getPropertyName(CSSPropertyID); -#endif +#endif // CSSPropertyNames_h + EOF close HEADER; -system("gperf -a -L ANSI-C -E -C -c -o -t --key-positions=\"*\" -NfindProp -Hhash_prop -Wwordlist_prop -D -s 2 CSSPropertyNames.gperf > CSSPropertyNames.cpp") == 0 || die "calling gperf failed: $?"; +system("gperf --key-positions=\"*\" -D -n -s 2 CSSPropertyNames.gperf > CSSPropertyNames.cpp") == 0 || die "calling gperf failed: $?"; open C, ">>CSSPropertyNames.cpp" || die "Could not open CSSPropertyNames.cpp for writing"; print C "static const char * const propertyNameStrings[$num] = {\n"; diff --git a/WebCore/css/makevalues.pl b/WebCore/css/makevalues.pl index e49981d..421e470 100644 --- a/WebCore/css/makevalues.pl +++ b/WebCore/css/makevalues.pl @@ -5,6 +5,7 @@ # Copyright (C) 1999 Waldo Bastian (bastian@kde.org) # Copyright (C) 2007 Apple Inc. All rights reserved. # Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) +# Copyright (C) 2010 Andras Becsi (abecsi@inf.u-szeged.hu), University of Szeged # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public @@ -40,10 +41,19 @@ print GPERF << "EOF"; #include \"CSSValueKeywords.h\" %} -struct css_value { +%struct-type +struct Value { const char* name; int id; }; +%language=ANSI-C +%readonly-tables +%compare-strncmp +%define lookup-function-name findValue +%define hash-function-name value_hash_function +%define word-array-name value_word_list +%includes +%enum %% EOF @@ -59,8 +69,8 @@ open HEADER, ">CSSValueKeywords.h" || die "Could not open CSSValueKeywords.h for print HEADER << "EOF"; /* This file is automatically generated from CSSValueKeywords.in by makevalues, do not edit */ -#ifndef CSSValues_h -#define CSSValues_h +#ifndef CSSValueKeywords_h +#define CSSValueKeywords_h const int CSSValueInvalid = 0; EOF @@ -82,13 +92,13 @@ print HEADER << "EOF"; const char* getValueName(unsigned short id); -#endif +#endif // CSSValueKeywords_h EOF close HEADER; -system("gperf -L ANSI-C -E -C -n -o -t --key-positions=\"*\" -NfindValue -Hhash_val -Wwordlist_value -D CSSValueKeywords.gperf > CSSValueKeywords.c") == 0 || die "calling gperf failed: $?"; +system("gperf --key-positions=\"*\" -D -n -s 2 CSSValueKeywords.gperf > CSSValueKeywords.cpp") == 0 || die "calling gperf failed: $?"; -open C, ">>CSSValueKeywords.c" || die "Could not open CSSValueKeywords.c for writing"; +open C, ">>CSSValueKeywords.cpp" || die "Could not open CSSValueKeywords.cpp for writing"; print C "static const char * const valueList[] = {\n"; print C "\"\",\n"; foreach my $name (@names) { diff --git a/WebCore/dom/Attr.cpp b/WebCore/dom/Attr.cpp index 597f9ba..59daa59 100644 --- a/WebCore/dom/Attr.cpp +++ b/WebCore/dom/Attr.cpp @@ -3,7 +3,7 @@ * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2001 Peter Kelly (pmk@post.com) * (C) 2001 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2004, 2005, 2006, 2007, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -23,9 +23,9 @@ #include "config.h" #include "Attr.h" -#include "Document.h" #include "Element.h" #include "ExceptionCode.h" +#include "HTMLNames.h" #include "Text.h" #include "XMLNSNames.h" @@ -175,7 +175,7 @@ void Attr::childrenChanged(bool changedByParser, Node* beforeChange, Node* after bool Attr::isId() const { - return qualifiedName().matches(m_element ? m_element->idAttributeName() : idAttr); + return qualifiedName().matches(document()->idAttributeName()); } } diff --git a/WebCore/dom/CanvasSurface.cpp b/WebCore/dom/CanvasSurface.cpp index ea29113..988864b 100644 --- a/WebCore/dom/CanvasSurface.cpp +++ b/WebCore/dom/CanvasSurface.cpp @@ -78,7 +78,7 @@ void CanvasSurface::setSurfaceSize(const IntSize& size) m_imageBuffer.clear(); } -String CanvasSurface::toDataURL(const String& mimeType, double quality, ExceptionCode& ec) +String CanvasSurface::toDataURL(const String& mimeType, const double* quality, ExceptionCode& ec) { if (!m_originClean) { ec = SECURITY_ERR; diff --git a/WebCore/dom/CanvasSurface.h b/WebCore/dom/CanvasSurface.h index 3660c05..3601381 100644 --- a/WebCore/dom/CanvasSurface.h +++ b/WebCore/dom/CanvasSurface.h @@ -59,9 +59,8 @@ public: int width() const { return m_size.width(); } int height() const { return m_size.height(); } - String toDataURL(const String& mimeType, double quality, ExceptionCode&); - - String toDataURL(const String& mimeType, ExceptionCode& ec) { return toDataURL(mimeType, 1.0, ec); } + String toDataURL(const String& mimeType, const double* quality, ExceptionCode&); + String toDataURL(const String& mimeType, ExceptionCode& ec) { return toDataURL(mimeType, 0, ec); } const IntSize& size() const { return m_size; } diff --git a/WebCore/dom/ContainerNode.cpp b/WebCore/dom/ContainerNode.cpp index 9e27dea..fddccdd 100644 --- a/WebCore/dom/ContainerNode.cpp +++ b/WebCore/dom/ContainerNode.cpp @@ -36,6 +36,7 @@ #include "InspectorController.h" #include "MutationEvent.h" #include "Page.h" +#include "RenderBox.h" #include "RenderTheme.h" #include "RootInlineBox.h" #include "loader.h" diff --git a/WebCore/dom/CustomEvent.idl b/WebCore/dom/CustomEvent.idl index 1ab468c..aa673b8 100644 --- a/WebCore/dom/CustomEvent.idl +++ b/WebCore/dom/CustomEvent.idl @@ -25,6 +25,7 @@ module events { +#if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP // Introduced in DOM Level 3: interface CustomEvent : Event { @@ -35,5 +36,6 @@ module events { in boolean cancelableArg, in DOMObject detailArg); }; +#endif } diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp index 4500626..c41b87e 100644 --- a/WebCore/dom/Document.cpp +++ b/WebCore/dom/Document.cpp @@ -76,10 +76,10 @@ #include "HTMLMapElement.h" #include "HTMLNameCollection.h" #include "HTMLNames.h" -#include "HTMLParser.h" +#include "LegacyHTMLTreeConstructor.h" #include "HTMLStyleElement.h" #include "HTMLTitleElement.h" -#include "HTMLTokenizer.h" +#include "HTMLDocumentParser.h" #include "HTTPParsers.h" #include "HistoryItem.h" #include "HitTestRequest.h" @@ -107,6 +107,7 @@ #include "ProgressEvent.h" #include "RegisteredEventListener.h" #include "RenderArena.h" +#include "RenderLayer.h" #include "RenderTextControl.h" #include "RenderView.h" #include "RenderWidget.h" @@ -134,7 +135,7 @@ #include "XMLHttpRequest.h" #include "XMLNSNames.h" #include "XMLNames.h" -#include "XMLTokenizer.h" +#include "XMLDocumentParser.h" #include "htmlediting.h" #include <wtf/CurrentTime.h> #include <wtf/HashFunctions.h> @@ -418,6 +419,7 @@ Document::Document(Frame* frame, bool isXHTML, bool isHTML) , m_containsWMLContent(false) #endif , m_weakReference(DocumentWeakReference::create(this)) + , m_idAttributeName(idAttr) { m_document = this; @@ -508,7 +510,7 @@ void Document::removedLastRef() deleteAllValues(m_markers); m_markers.clear(); - m_tokenizer.clear(); + m_parser.clear(); m_cssCanvasElements.clear(); @@ -542,7 +544,7 @@ Document::~Document() destroyAllWrapperCaches(); #endif - m_tokenizer.clear(); + m_parser.clear(); m_document = 0; m_docLoader.clear(); @@ -903,7 +905,7 @@ PassRefPtr<Element> Document::createElement(const QualifiedName& qName, bool cre else if (qName.namespaceURI() == MathMLNames::mathmlNamespaceURI) e = MathMLElementFactory::createMathMLElement(qName, this, createdByParser); #endif - + if (!e) e = Element::create(qName, document()); @@ -947,7 +949,7 @@ Element* Document::getElementById(const AtomicString& elementId) const for (Node *n = traverseNextNode(); n != 0; n = n->traverseNextNode()) { if (n->isElementNode()) { element = static_cast<Element*>(n); - if (element->hasID() && element->getAttribute(element->idAttributeName()) == elementId) { + if (element->hasID() && element->getIdAttribute() == elementId) { m_duplicateIds.remove(elementId.impl()); m_elementsById.set(elementId.impl(), element); return element; @@ -1706,10 +1708,10 @@ void Document::setVisuallyOrdered() renderer()->style()->setVisuallyOrdered(true); } -Tokenizer* Document::createTokenizer() +DocumentParser* Document::createParser() { // FIXME: this should probably pass the frame instead - return new XMLTokenizer(this, view()); + return new XMLDocumentParser(this, view()); } void Document::open(Document* ownerDocument) @@ -1721,7 +1723,7 @@ void Document::open(Document* ownerDocument) } if (m_frame) { - if (m_frame->loader()->isLoadingMainResource() || (tokenizer() && tokenizer()->executingScript())) + if (m_frame->loader()->isLoadingMainResource() || (parser() && parser()->executingScript())) return; if (m_frame->loader()->state() == FrameStateProvisional) @@ -1739,12 +1741,12 @@ void Document::open(Document* ownerDocument) void Document::cancelParsing() { - if (m_tokenizer) { - // We have to clear the tokenizer to avoid possibly triggering + if (m_parser) { + // We have to clear the parser to avoid possibly triggering // the onload handler when closing as a side effect of a cancel-style // change, such as opening a new document or closing the window while // still parsing - m_tokenizer.clear(); + m_parser.clear(); close(); } } @@ -1753,15 +1755,15 @@ void Document::implicitOpen() { cancelParsing(); - m_tokenizer.clear(); + m_parser.clear(); removeChildren(); - m_tokenizer = createTokenizer(); + m_parser = createParser(); setParsing(true); if (m_frame) - m_tokenizer->setXSSAuditor(m_frame->script()->xssAuditor()); + m_parser->setXSSAuditor(m_frame->script()->xssAuditor()); // If we reload, the animation controller sticks around and has // a stale animation time. We need to update it here. @@ -1839,18 +1841,18 @@ void Document::implicitClose() } bool wasLocationChangePending = frame() && frame()->redirectScheduler()->locationChangePending(); - bool doload = !parsing() && m_tokenizer && !m_processingLoadEvent && !wasLocationChangePending; + bool doload = !parsing() && m_parser && !m_processingLoadEvent && !wasLocationChangePending; if (!doload) return; m_processingLoadEvent = true; - m_wellFormed = m_tokenizer && m_tokenizer->wellFormed(); + m_wellFormed = m_parser && m_parser->wellFormed(); - // We have to clear the tokenizer, in case someone document.write()s from the + // We have to clear the parser, in case someone document.write()s from the // onLoad event handler, as in Radar 3206524. - m_tokenizer.clear(); + m_parser.clear(); // Parser should have picked up all preloads by now m_docLoader->clearPreloads(); @@ -1998,21 +2000,21 @@ void Document::write(const SegmentedString& text, Document* ownerDocument) printf("Beginning a document.write at %d\n", elapsedTime()); #endif - if (!m_tokenizer) + if (!m_parser) open(ownerDocument); - ASSERT(m_tokenizer); + ASSERT(m_parser); bool wasForcedSynchronous = false; - HTMLTokenizer* tokenizer = m_tokenizer->asHTMLTokenizer(); - if (tokenizer) { - wasForcedSynchronous = tokenizer->forceSynchronous(); - tokenizer->setForceSynchronous(true); + HTMLDocumentParser* parser = m_parser->asHTMLDocumentParser(); + if (parser) { + wasForcedSynchronous = parser->forceSynchronous(); + parser->setForceSynchronous(true); } - m_tokenizer->write(text, false); + m_parser->write(text, false); - if (m_tokenizer && tokenizer && m_tokenizer->asHTMLTokenizer() == tokenizer) - tokenizer->setForceSynchronous(wasForcedSynchronous); + if (m_parser && parser && m_parser->asHTMLDocumentParser() == parser) + parser->setForceSynchronous(wasForcedSynchronous); #ifdef INSTRUMENT_LAYOUT_SCHEDULING if (!ownerElement()) @@ -2038,13 +2040,13 @@ void Document::finishParsing() printf("Received all data at %d\n", elapsedTime()); #endif - // Let the tokenizer go through as much data as it can. There will be three possible outcomes after + // Let the parser go through as much data as it can. There will be three possible outcomes after // finish() is called: // (1) All remaining data is parsed, document isn't loaded yet - // (2) All remaining data is parsed, document is loaded, tokenizer gets deleted + // (2) All remaining data is parsed, document is loaded, parser gets deleted // (3) Data is still remaining to be parsed. - if (m_tokenizer) - m_tokenizer->finish(); + if (m_parser) + m_parser->finish(); } const KURL& Document::virtualURL() const @@ -2622,8 +2624,8 @@ void Document::removePendingSheet() updateStyleSelector(); - if (!m_pendingStylesheets && m_tokenizer) - m_tokenizer->executeScriptsWaitingForStylesheets(); + if (!m_pendingStylesheets && m_parser) + m_parser->executeScriptsWaitingForStylesheets(); if (!m_pendingStylesheets && m_gotoAnchorNeededAfterStylesheetsLoad && view()) view()->scrollToFragment(m_frame->loader()->url()); @@ -4715,7 +4717,9 @@ void Document::updateURLForPushOrReplaceState(const KURL& url) if (!f) return; + // FIXME: Eliminate this redundancy. setURL(url); + f->loader()->setURL(url); f->loader()->documentLoader()->replaceRequestURLForSameDocumentNavigation(url); } diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h index e772233..0e86df4 100644 --- a/WebCore/dom/Document.h +++ b/WebCore/dom/Document.h @@ -34,6 +34,7 @@ #include "Color.h" #include "Document.h" #include "DocumentMarker.h" +#include "QualifiedName.h" #include "ScriptExecutionContext.h" #include "Timer.h" #include <wtf/HashCountedSet.h> @@ -108,7 +109,7 @@ namespace WebCore { class StyleSheetList; class Text; class TextResourceDecoder; - class Tokenizer; + class DocumentParser; class TreeWalker; class XMLHttpRequest; @@ -319,7 +320,7 @@ public: String xmlVersion() const { return m_xmlVersion; } bool xmlStandalone() const { return m_xmlStandalone; } - void setXMLEncoding(const String& encoding) { m_xmlEncoding = encoding; } // read-only property, only to be set from XMLTokenizer + void setXMLEncoding(const String& encoding) { m_xmlEncoding = encoding; } // read-only property, only to be set from XMLDocumentParser void setXMLVersion(const String&, ExceptionCode&); void setXMLStandalone(bool, ExceptionCode&); @@ -535,8 +536,8 @@ public: CSSStyleSheet* elementSheet(); CSSStyleSheet* mappedElementSheet(); - virtual Tokenizer* createTokenizer(); - Tokenizer* tokenizer() { return m_tokenizer.get(); } + virtual DocumentParser* createParser(); + DocumentParser* parser() { return m_parser.get(); } bool printing() const { return m_printing; } void setPrinting(bool p) { m_printing = p; } @@ -988,6 +989,8 @@ public: void removeMediaCanStartListener(MediaCanStartListener*); MediaCanStartListener* takeAnyMediaCanStartListener(); + const QualifiedName& idAttributeName() const { return m_idAttributeName; } + protected: Document(Frame*, bool isXHTML, bool isHTML); @@ -1039,7 +1042,7 @@ private: Frame* m_frame; OwnPtr<DocLoader> m_docLoader; - OwnPtr<Tokenizer> m_tokenizer; + OwnPtr<DocumentParser> m_parser; bool m_wellFormed; // Document URLs. @@ -1267,6 +1270,8 @@ private: RefPtr<DocumentWeakReference> m_weakReference; HashSet<MediaCanStartListener*> m_mediaCanStartListeners; + + QualifiedName m_idAttributeName; }; inline bool Document::hasElementWithId(AtomicStringImpl* id) const diff --git a/WebCore/dom/Document.idl b/WebCore/dom/Document.idl index cd877b3..9599d76 100644 --- a/WebCore/dom/Document.idl +++ b/WebCore/dom/Document.idl @@ -219,9 +219,11 @@ module core { #endif +#if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C [V8Custom] DOMObject getCSSCanvasContext(in DOMString contextId, in DOMString name, in long width, in long height); #endif +#endif // HTML 5 NodeList getElementsByClassName(in DOMString tagname); @@ -311,6 +313,12 @@ module core { attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchend; attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchcancel; #endif + +#if defined(LANGUAGE_CPP) && LANGUAGE_CPP + // Extra WebCore methods exposed to allow compile-time casting in C++ + boolean isHTMLDocument(); +#endif + }; } diff --git a/WebCore/dom/DocumentParser.h b/WebCore/dom/DocumentParser.h new file mode 100644 index 0000000..c7eea06 --- /dev/null +++ b/WebCore/dom/DocumentParser.h @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2000 Peter Kelly (pmk@post.com) + * Copyright (C) 2005, 2006 Apple Computer, Inc. + * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) + * + * 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 DocumentParser_h +#define DocumentParser_h + +namespace WebCore { + + class LegacyHTMLTreeConstructor; + class HTMLDocumentParser; + class SegmentedString; + class XSSAuditor; + + class DocumentParser : public Noncopyable { + public: + virtual ~DocumentParser() { } + + // Script output must be prepended, while new data + // received during executing a script must be appended, hence the + // extra bool to be able to distinguish between both cases. + // document.write() always uses false, while the loader uses true. + virtual void write(const SegmentedString&, bool appendData) = 0; + virtual void finish() = 0; + virtual bool isWaitingForScripts() const = 0; + virtual void stopParsing() { m_parserStopped = true; } + virtual bool processingData() const { return false; } + virtual int executingScript() const { return 0; } + + virtual bool wantsRawData() const { return false; } + virtual bool writeRawData(const char* /*data*/, int /*length*/) { return false; } + + bool inViewSourceMode() const { return m_inViewSourceMode; } + void setInViewSourceMode(bool mode) { m_inViewSourceMode = mode; } + + virtual bool wellFormed() const { return true; } + + virtual int lineNumber() const { return -1; } + virtual int columnNumber() const { return -1; } + + virtual void executeScriptsWaitingForStylesheets() {} + + virtual LegacyHTMLTreeConstructor* htmlTreeConstructor() const { return 0; } + virtual HTMLDocumentParser* asHTMLDocumentParser() { return 0; } + + XSSAuditor* xssAuditor() const { return m_XSSAuditor; } + void setXSSAuditor(XSSAuditor* auditor) { m_XSSAuditor = auditor; } + + protected: + DocumentParser(bool viewSourceMode = false) + : m_parserStopped(false) + , m_inViewSourceMode(viewSourceMode) + , m_XSSAuditor(0) + { + } + + // The parser has buffers, so parsing may continue even after + // it stops receiving data. We use m_parserStopped to stop the parser + // even when it has buffered data. + bool m_parserStopped; + bool m_inViewSourceMode; + + // The XSSAuditor associated with this document parser. + XSSAuditor* m_XSSAuditor; + }; + +} // namespace WebCore + +#endif // DocumentParser_h diff --git a/WebCore/dom/DynamicNodeList.cpp b/WebCore/dom/DynamicNodeList.cpp index 3f0744b..c7609a1 100644 --- a/WebCore/dom/DynamicNodeList.cpp +++ b/WebCore/dom/DynamicNodeList.cpp @@ -2,7 +2,7 @@ * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2001 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -137,7 +137,8 @@ Node* DynamicNodeList::itemWithName(const AtomicString& elementId) const unsigned length = this->length(); for (unsigned i = 0; i < length; i++) { Node* node = item(i); - if (node->isElementNode() && static_cast<Element*>(node)->getIDAttribute() == elementId) + // FIXME: This should probably be using getIdAttribute instead of idForStyleResolution. + if (node->hasID() && static_cast<Element*>(node)->idForStyleResolution() == elementId) return node; } diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp index d95403a..c1c798b 100644 --- a/WebCore/dom/Element.cpp +++ b/WebCore/dom/Element.cpp @@ -42,16 +42,17 @@ #include "FrameView.h" #include "HTMLElement.h" #include "HTMLNames.h" -#include "HTMLTokenizer.h" +#include "HTMLDocumentParser.h" #include "InspectorController.h" #include "NodeList.h" #include "NodeRenderStyle.h" #include "Page.h" +#include "RenderLayer.h" #include "RenderView.h" #include "RenderWidget.h" #include "TextIterator.h" #include "XMLNames.h" -#include "XMLTokenizer.h" +#include "XMLDocumentParser.h" #include <wtf/text/CString.h> #if ENABLE(SVG) @@ -206,21 +207,6 @@ Node::NodeType Element::nodeType() const return ELEMENT_NODE; } -const AtomicString& Element::getIDAttribute() const -{ - // FIXME: There are two problems with this function for general purpose use. - // - // 1) If this is not a StyledElement, then the result will always be null. - // 2) If the document this element is part of is in compatibility mode - // (inCompatMode), then the ID will be lowercased. - // - // See StyledElement::parseMappedAttribute for details. Because of these issues, - // this function and NamedNodeMap::id should both probably be renamed to make it - // clear this does not give the same result as getAttribute. - - return namedAttrMap ? namedAttrMap->id() : nullAtom; -} - bool Element::hasAttribute(const QualifiedName& name) const { return hasAttributeNS(name.namespaceURI(), name.localName()); @@ -541,10 +527,11 @@ const AtomicString& Element::getAttribute(const String& name) const } #endif - if (namedAttrMap) + if (namedAttrMap) { if (Attribute* attribute = namedAttrMap->getAttributeItem(name, ignoreCase)) return attribute->value(); - + } + return nullAtom; } @@ -562,12 +549,15 @@ void Element::setAttribute(const AtomicString& name, const AtomicString& value, const AtomicString& localName = shouldIgnoreAttributeCase(this) ? name.lower() : name; - // allocate attributemap if necessary + // Allocate attribute map if necessary. Attribute* old = attributes(false)->getAttributeItem(localName, false); document()->incDOMTreeVersion(); - if (localName == idAttributeName().localName()) + // FIXME: This check is probably not correct for the case where the document has an id attribute + // with a non-null namespace, because it will return true if the local name happens to match + // but the namespace does not. + if (localName == document()->idAttributeName().localName()) updateId(old ? old->value() : nullAtom, value); if (old && value.isNull()) @@ -593,10 +583,10 @@ void Element::setAttribute(const QualifiedName& name, const AtomicString& value, { document()->incDOMTreeVersion(); - // allocate attributemap if necessary + // Allocate attribute map if necessary. Attribute* old = attributes(false)->getAttributeItem(name); - if (name == idAttributeName()) + if (isIdAttributeName(name)) updateId(old ? old->value() : nullAtom, value); if (old && value.isNull()) @@ -678,7 +668,7 @@ void Element::setAttributeMap(PassRefPtr<NamedNodeMap> list, FragmentScriptingPe // If setting the whole map changes the id attribute, we need to call updateId. - const QualifiedName& idName = idAttributeName(); + const QualifiedName& idName = document()->idAttributeName(); Attribute* oldId = namedAttrMap ? namedAttrMap->getAttributeItem(idName) : 0; Attribute* newId = list ? list->getAttributeItem(idName) : 0; @@ -802,7 +792,7 @@ void Element::insertedIntoDocument() if (hasID()) { if (NamedNodeMap* attrs = namedAttrMap.get()) { - Attribute* idItem = attrs->getAttributeItem(idAttributeName()); + Attribute* idItem = attrs->getAttributeItem(document()->idAttributeName()); if (idItem && !idItem->isNull()) updateId(nullAtom, idItem->value()); } @@ -813,7 +803,7 @@ void Element::removedFromDocument() { if (hasID()) { if (NamedNodeMap* attrs = namedAttrMap.get()) { - Attribute* idItem = attrs->getAttributeItem(idAttributeName()); + Attribute* idItem = attrs->getAttributeItem(document()->idAttributeName()); if (idItem && !idItem->isNull()) updateId(idItem->value(), nullAtom); } @@ -1162,7 +1152,7 @@ void Element::formatForDebugger(char* buffer, unsigned length) const result += s; } - s = getAttribute(idAttributeName()); + s = getIdAttribute(); if (s.length() > 0) { if (result.length() > 0) result += "; "; @@ -1320,8 +1310,12 @@ void Element::focus(bool restorePreviousSelection) return; } - if (Page* page = doc->page()) + RefPtr<Node> protect; + if (Page* page = doc->page()) { + // Focus and change event handlers can cause us to lose our last ref. + protect = this; page->focusController()->setFocusedNode(this, doc->frame()); + } // Setting the focused node above might have invalidated the layout due to scripts. doc->updateLayoutIgnorePendingStylesheets(); @@ -1537,9 +1531,4 @@ KURL Element::getURLAttribute(const QualifiedName& name) const return document()->completeURL(deprecatedParseURL(getAttribute(name))); } -const QualifiedName& Element::rareIDAttributeName() const -{ - return rareData()->m_idAttributeName; -} - } // namespace WebCore diff --git a/WebCore/dom/Element.h b/WebCore/dom/Element.h index 8da2892..c6eebcb 100644 --- a/WebCore/dom/Element.h +++ b/WebCore/dom/Element.h @@ -3,7 +3,7 @@ * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2001 Peter Kelly (pmk@post.com) * (C) 2001 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -25,19 +25,14 @@ #ifndef Element_h #define Element_h -#include "ContainerNode.h" #include "Document.h" -#include "HTMLNames.h" #include "MappedAttributeEntry.h" #include "NamedNodeMap.h" -#include "QualifiedName.h" #include "ScrollTypes.h" namespace WebCore { -class Attr; class Attribute; -class CSSStyleDeclaration; class ClientRect; class ClientRectList; class ElementRareData; @@ -111,9 +106,6 @@ public: bool fastHasAttribute(const QualifiedName&) const; const AtomicString& fastGetAttribute(const QualifiedName&) const; - // Call this to get the value of the id attribute. Faster than calling fastGetAttribute. - const AtomicString& getIDAttribute() const; - bool hasAttributes() const; bool hasAttribute(const String& name) const; @@ -125,7 +117,14 @@ public: void setAttribute(const AtomicString& name, const AtomicString& value, ExceptionCode&); void setAttributeNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& value, ExceptionCode&, FragmentScriptingPermission = FragmentScriptingAllowed); - const QualifiedName& idAttributeName() const; + bool isIdAttributeName(const QualifiedName&) const; + const AtomicString& getIdAttribute() const; + void setIdAttribute(const AtomicString&); + + // Call this to get the value of the id attribute for style resolution purposes. + // The value will already be lowercased if the document is in compatibility mode, + // so this function is not suitable for non-style uses. + const AtomicString& idForStyleResolution() const; void scrollIntoView(bool alignToTop = true); void scrollIntoViewIfNeeded(bool centerIfNeeded = true); @@ -304,7 +303,6 @@ private: virtual bool childTypeAllowed(NodeType); virtual PassRefPtr<Attribute> createAttribute(const QualifiedName&, const AtomicString& value); - const QualifiedName& rareIDAttributeName() const; #ifndef NDEBUG virtual void formatForDebugger(char* buffer, unsigned length) const; @@ -362,11 +360,6 @@ inline Element* Node::parentElement() const return parent && parent->isElementNode() ? static_cast<Element*>(parent) : 0; } -inline const QualifiedName& Element::idAttributeName() const -{ - return hasRareData() ? rareIDAttributeName() : HTMLNames::idAttr; -} - inline NamedNodeMap* Element::attributes(bool readonly) const { if (!isStyleAttributeValid()) @@ -411,6 +404,31 @@ inline const AtomicString& Element::fastGetAttribute(const QualifiedName& name) return nullAtom; } -} //namespace +inline const AtomicString& Element::idForStyleResolution() const +{ + ASSERT(hasID()); + return namedAttrMap->idForStyleResolution(); +} + +inline bool Element::isIdAttributeName(const QualifiedName& attributeName) const +{ + // FIXME: This check is probably not correct for the case where the document has an id attribute + // with a non-null namespace, because it will return false, a false negative, if the prefixes + // don't match but the local name and namespace both do. However, since this has been like this + // for a while and the code paths may be hot, we'll have to measure performance if we fix it. + return attributeName == document()->idAttributeName(); +} + +inline const AtomicString& Element::getIdAttribute() const +{ + return fastGetAttribute(document()->idAttributeName()); +} + +inline void Element::setIdAttribute(const AtomicString& value) +{ + setAttribute(document()->idAttributeName(), value); +} + +} // namespace #endif diff --git a/WebCore/dom/ElementRareData.h b/WebCore/dom/ElementRareData.h index f23ad8e..b444d99 100644 --- a/WebCore/dom/ElementRareData.h +++ b/WebCore/dom/ElementRareData.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2008 David Smith <catfish.man@gmail.com> * * This library is free software; you can redistribute it and/or @@ -27,8 +27,6 @@ namespace WebCore { -using namespace HTMLNames; - class ElementRareData : public NodeRareData { public: ElementRareData(); @@ -40,7 +38,6 @@ public: IntSize m_minimumSizeForResizing; RefPtr<RenderStyle> m_computedStyle; - QualifiedName m_idAttributeName; }; inline IntSize defaultMinimumSizeForResizing() @@ -50,7 +47,6 @@ inline IntSize defaultMinimumSizeForResizing() inline ElementRareData::ElementRareData() : m_minimumSizeForResizing(defaultMinimumSizeForResizing()) - , m_idAttributeName(idAttr) { } diff --git a/WebCore/dom/Event.idl b/WebCore/dom/Event.idl index 919fc90..b8b590f 100644 --- a/WebCore/dom/Event.idl +++ b/WebCore/dom/Event.idl @@ -79,6 +79,13 @@ module events { readonly attribute [Custom] Clipboard clipboardData; #endif +#if defined(LANGUAGE_CPP) && LANGUAGE_CPP + // Extra WebCore methods exposed to allow compile-time casting in C++ + boolean isMutationEvent(); + boolean isMouseEvent(); + boolean isUIEvent(); +#endif + }; } diff --git a/WebCore/dom/EventListener.h b/WebCore/dom/EventListener.h index 3ecfae7..ff02204 100644 --- a/WebCore/dom/EventListener.h +++ b/WebCore/dom/EventListener.h @@ -36,14 +36,17 @@ namespace WebCore { class EventListener : public RefCounted<EventListener> { public: - enum Type { JSEventListenerType, - ImageEventListenerType, - InspectorDOMAgentType, - InspectorDOMStorageResourceType, - ObjCEventListenerType, - ConditionEventListenerType, - GObjectEventListenerType }; - + enum Type { + JSEventListenerType, + ImageEventListenerType, + InspectorDOMAgentType, + InspectorDOMStorageResourceType, + ObjCEventListenerType, + CPPEventListenerType, + ConditionEventListenerType, + GObjectEventListenerType + }; + virtual ~EventListener() { } virtual bool operator==(const EventListener&) = 0; virtual void handleEvent(ScriptExecutionContext*, Event*) = 0; diff --git a/WebCore/dom/EventTarget.h b/WebCore/dom/EventTarget.h index 2aaeef5..0e8c343 100644 --- a/WebCore/dom/EventTarget.h +++ b/WebCore/dom/EventTarget.h @@ -166,6 +166,8 @@ namespace WebCore { void fireEventListeners(Event*, EventTargetData*, EventListenerVector&); }; + // FIXME: These macros should be split into separate DEFINE and DECLARE + // macros to avoid causing so many header includes. #define DEFINE_ATTRIBUTE_EVENT_LISTENER(attribute) \ EventListener* on##attribute() { return getAttributeEventListener(eventNames().attribute##Event); } \ void setOn##attribute(PassRefPtr<EventListener> listener) { setAttributeEventListener(eventNames().attribute##Event, listener); } \ diff --git a/WebCore/dom/NamedNodeMap.cpp b/WebCore/dom/NamedNodeMap.cpp index e310ff8..7c9298a 100644 --- a/WebCore/dom/NamedNodeMap.cpp +++ b/WebCore/dom/NamedNodeMap.cpp @@ -225,8 +225,8 @@ void NamedNodeMap::setAttributes(const NamedNodeMap& other) // If assigning the map changes the id attribute, we need to call // updateId. - Attribute* oldId = getAttributeItem(m_element->idAttributeName()); - Attribute* newId = other.getAttributeItem(m_element->idAttributeName()); + Attribute* oldId = getAttributeItem(m_element->document()->idAttributeName()); + Attribute* newId = other.getAttributeItem(m_element->document()->idAttributeName()); if (oldId || newId) m_element->updateId(oldId ? oldId->value() : nullAtom, newId ? newId->value() : nullAtom); diff --git a/WebCore/dom/NamedNodeMap.h b/WebCore/dom/NamedNodeMap.h index 50cb4cb..c3c2cd9 100644 --- a/WebCore/dom/NamedNodeMap.h +++ b/WebCore/dom/NamedNodeMap.h @@ -3,7 +3,7 @@ * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2001 Peter Kelly (pmk@post.com) * (C) 2001 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2010 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -28,10 +28,6 @@ #include "Attribute.h" #include "SpaceSplitString.h" -#ifdef __OBJC__ -#define id id_AVOID_KEYWORD -#endif - namespace WebCore { class Node; @@ -85,8 +81,8 @@ public: addAttribute(newAttribute); } - const AtomicString& id() const { return m_id; } - void setID(const AtomicString& newId) { m_id = newId; } + const AtomicString& idForStyleResolution() const { return m_idForStyleResolution; } + void setIdForStyleResolution(const AtomicString& newId) { m_idForStyleResolution = newId; } // FIXME: These two functions should be merged if possible. bool mapsEquivalent(const NamedNodeMap* otherMap) const; @@ -124,7 +120,7 @@ private: SpaceSplitString m_classNames; Element* m_element; Vector<RefPtr<Attribute> > m_attributes; - AtomicString m_id; + AtomicString m_idForStyleResolution; }; inline Attribute* NamedNodeMap::getAttributeItem(const QualifiedName& name) const @@ -138,7 +134,7 @@ inline Attribute* NamedNodeMap::getAttributeItem(const QualifiedName& name) cons } // We use a boolean parameter instead of calling shouldIgnoreAttributeCase so that the caller -// can tune the behaviour (hasAttribute is case sensitive whereas getAttribute is not). +// can tune the behavior (hasAttribute is case sensitive whereas getAttribute is not). inline Attribute* NamedNodeMap::getAttributeItem(const String& name, bool shouldIgnoreAttributeCase) const { unsigned len = length(); @@ -161,6 +157,4 @@ inline Attribute* NamedNodeMap::getAttributeItem(const String& name, bool should } // namespace WebCore -#undef id - #endif // NamedNodeMap_h diff --git a/WebCore/dom/Node.cpp b/WebCore/dom/Node.cpp index 2fe4bfb..840b967 100644 --- a/WebCore/dom/Node.cpp +++ b/WebCore/dom/Node.cpp @@ -71,7 +71,7 @@ #include "ProcessingInstruction.h" #include "ProgressEvent.h" #include "RegisteredEventListener.h" -#include "RenderObject.h" +#include "RenderBox.h" #include "ScriptController.h" #include "SelectorNodeList.h" #include "StringBuilder.h" diff --git a/WebCore/dom/Node.idl b/WebCore/dom/Node.idl index 2db9c27..dec6b19 100644 --- a/WebCore/dom/Node.idl +++ b/WebCore/dom/Node.idl @@ -132,6 +132,7 @@ module core { readonly attribute boolean isContentEditable; #endif /* defined(LANGUAGE_OBJECTIVE_C) */ +#if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C #if !defined(LANGUAGE_GOBJECT) || !LANGUAGE_GOBJECT void addEventListener(in DOMString type, @@ -144,6 +145,19 @@ module core { raises(EventException); #endif #endif +#endif + +#if defined(LANGUAGE_CPP) && LANGUAGE_CPP + [Custom] void addEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); + [Custom] void removeEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); + boolean dispatchEvent(in Event event) + raises(EventException); +#endif + }; } diff --git a/WebCore/dom/PopStateEvent.idl b/WebCore/dom/PopStateEvent.idl index 28da9e6..adc9074 100644 --- a/WebCore/dom/PopStateEvent.idl +++ b/WebCore/dom/PopStateEvent.idl @@ -26,6 +26,7 @@ module events { +#if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP interface PopStateEvent : Event { void initPopStateEvent(in DOMString typeArg, in boolean canBubbleArg, @@ -34,5 +35,6 @@ module events { readonly attribute [V8CustomGetter] any state; }; +#endif } diff --git a/WebCore/dom/ProcessingInstruction.cpp b/WebCore/dom/ProcessingInstruction.cpp index 544882c..739d62f 100644 --- a/WebCore/dom/ProcessingInstruction.cpp +++ b/WebCore/dom/ProcessingInstruction.cpp @@ -30,7 +30,7 @@ #include "Frame.h" #include "FrameLoader.h" #include "XSLStyleSheet.h" -#include "XMLTokenizer.h" // for parseAttributes() +#include "XMLDocumentParser.h" // for parseAttributes() #include "MediaList.h" namespace WebCore { diff --git a/WebCore/dom/StaticNodeList.cpp b/WebCore/dom/StaticNodeList.cpp index 99fd818..0a19a05 100644 --- a/WebCore/dom/StaticNodeList.cpp +++ b/WebCore/dom/StaticNodeList.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2007, 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 @@ -50,7 +50,8 @@ Node* StaticNodeList::itemWithName(const AtomicString& elementId) const size_t length = m_nodes.size(); for (size_t i = 0; i < length; ++i) { Node* node = m_nodes[i].get(); - if (node->isElementNode() && static_cast<Element*>(node)->getIDAttribute() == elementId) + // FIXME: This should probably be using getIdAttribute instead of idForStyleResolution. + if (node->hasID() && static_cast<Element*>(node)->getIdAttribute() == elementId) return node; } diff --git a/WebCore/dom/StyledElement.cpp b/WebCore/dom/StyledElement.cpp index 34a593c..994b084 100644 --- a/WebCore/dom/StyledElement.cpp +++ b/WebCore/dom/StyledElement.cpp @@ -3,7 +3,7 @@ * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2001 Peter Kelly (pmk@post.com) * (C) 2001 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2008, 2010 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -194,6 +194,7 @@ void StyledElement::attributeChanged(Attribute* attr, bool preserveDecls) if (namedAttrMap) mappedAttributes()->declAdded(); } + updateAfterAttributeChanged(attr); } @@ -227,16 +228,15 @@ void StyledElement::classAttributeChanged(const AtomicString& newClassString) void StyledElement::parseMappedAttribute(Attribute* attr) { - if (attr->name() == idAttributeName()) { - // unique id + if (isIdAttributeName(attr->name())) { setHasID(!attr->isNull()); if (namedAttrMap) { if (attr->isNull()) - namedAttrMap->setID(nullAtom); + namedAttrMap->setIdForStyleResolution(nullAtom); else if (document()->inCompatMode()) - namedAttrMap->setID(attr->value().lower()); + namedAttrMap->setIdForStyleResolution(attr->value().lower()); else - namedAttrMap->setID(attr->value()); + namedAttrMap->setIdForStyleResolution(attr->value()); } setNeedsStyleRecalc(); } else if (attr->name() == classAttr) diff --git a/WebCore/dom/Tokenizer.h b/WebCore/dom/Tokenizer.h deleted file mode 100644 index d6ac1a8..0000000 --- a/WebCore/dom/Tokenizer.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2000 Peter Kelly (pmk@post.com) - * Copyright (C) 2005, 2006 Apple Computer, Inc. - * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) - * - * 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 Tokenizer_h -#define Tokenizer_h - -namespace WebCore { - - class HTMLTokenizer; - class SegmentedString; - class XSSAuditor; - - // FIXME: This class should renamed DocumentParser or similar to express - // that it does more than tokenizing. It manages the lifetime of of the - // parser as well as handles various tag-handling hacks for HTML/XML. - class Tokenizer : public Noncopyable { - public: - virtual ~Tokenizer() { } - - // Script output must be prepended, while new data - // received during executing a script must be appended, hence the - // extra bool to be able to distinguish between both cases. - // document.write() always uses false, while the loader uses true. - virtual void write(const SegmentedString&, bool appendData) = 0; - virtual void finish() = 0; - virtual bool isWaitingForScripts() const = 0; - virtual void stopParsing() { m_parserStopped = true; } - virtual bool processingData() const { return false; } - virtual int executingScript() const { return 0; } - - virtual bool wantsRawData() const { return false; } - virtual bool writeRawData(const char* /*data*/, int /*length*/) { return false; } - - bool inViewSourceMode() const { return m_inViewSourceMode; } - void setInViewSourceMode(bool mode) { m_inViewSourceMode = mode; } - - virtual bool wellFormed() const { return true; } - - virtual int lineNumber() const { return -1; } - virtual int columnNumber() const { return -1; } - - virtual void executeScriptsWaitingForStylesheets() {} - - virtual bool isHTMLTokenizer() const { return false; } - virtual HTMLTokenizer* asHTMLTokenizer() { return 0; } - - XSSAuditor* xssAuditor() const { return m_XSSAuditor; } - void setXSSAuditor(XSSAuditor* auditor) { m_XSSAuditor = auditor; } - - protected: - Tokenizer(bool viewSourceMode = false) - : m_parserStopped(false) - , m_inViewSourceMode(viewSourceMode) - , m_XSSAuditor(0) - { - } - - // The tokenizer has buffers, so parsing may continue even after - // it stops receiving data. We use m_parserStopped to stop the tokenizer - // even when it has buffered data. - bool m_parserStopped; - bool m_inViewSourceMode; - - // The XSSAuditor associated with this tokenizer. - XSSAuditor* m_XSSAuditor; - }; - -} // namespace WebCore - -#endif // Tokenizer_h diff --git a/WebCore/dom/ViewportArguments.cpp b/WebCore/dom/ViewportArguments.cpp index d585896..23d0297 100644 --- a/WebCore/dom/ViewportArguments.cpp +++ b/WebCore/dom/ViewportArguments.cpp @@ -33,7 +33,7 @@ #include "Frame.h" #include "Page.h" #include "PlatformString.h" -#include "Tokenizer.h" +#include "DocumentParser.h" namespace WebCore { @@ -105,7 +105,7 @@ static MessageLevel viewportErrorMessageLevel(ViewportErrorCode errorCode) void reportViewportWarning(Document* document, ViewportErrorCode errorCode, const String& replacement) { - Tokenizer* tokenizer = document->tokenizer(); + DocumentParser* parser = document->parser(); Frame* frame = document->frame(); if (!frame) @@ -114,7 +114,7 @@ void reportViewportWarning(Document* document, ViewportErrorCode errorCode, cons String message = viewportErrorMessageTemplate(errorCode); message.replace("%replacement", replacement); - frame->domWindow()->console()->addMessage(HTMLMessageSource, LogMessageType, viewportErrorMessageLevel(errorCode), message, tokenizer ? tokenizer->lineNumber() + 1 : 0, document->url().string()); + frame->domWindow()->console()->addMessage(HTMLMessageSource, LogMessageType, viewportErrorMessageLevel(errorCode), message, parser ? parser->lineNumber() + 1 : 0, document->url().string()); } } // namespace WebCore diff --git a/WebCore/dom/XMLDocumentParser.cpp b/WebCore/dom/XMLDocumentParser.cpp new file mode 100644 index 0000000..987e9b1 --- /dev/null +++ b/WebCore/dom/XMLDocumentParser.cpp @@ -0,0 +1,356 @@ +/* + * Copyright (C) 2000 Peter Kelly (pmk@post.com) + * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) + * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2008 Holger Hans Peter Freyther + * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) + * + * 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 "XMLDocumentParser.h" + +#include "CDATASection.h" +#include "CachedScript.h" +#include "Comment.h" +#include "DocLoader.h" +#include "Document.h" +#include "DocumentFragment.h" +#include "DocumentType.h" +#include "Frame.h" +#include "FrameLoader.h" +#include "FrameView.h" +#include "HTMLLinkElement.h" +#include "HTMLNames.h" +#include "HTMLStyleElement.h" +#include "ImageLoader.h" +#include "ProcessingInstruction.h" +#include "ResourceError.h" +#include "ResourceHandle.h" +#include "ResourceRequest.h" +#include "ResourceResponse.h" +#include "ScriptController.h" +#include "ScriptElement.h" +#include "ScriptSourceCode.h" +#include "ScriptValue.h" +#include "TextResourceDecoder.h" +#include "TreeDepthLimit.h" +#include <wtf/text/CString.h> +#include <wtf/StringExtras.h> +#include <wtf/Threading.h> +#include <wtf/Vector.h> + +#if ENABLE(SVG) +#include "SVGNames.h" +#include "SVGStyleElement.h" +#endif + +using namespace std; + +namespace WebCore { + +using namespace HTMLNames; + +const int maxErrors = 25; + +#if ENABLE(WML) +bool XMLDocumentParser::isWMLDocument() const +{ + if (m_doc) + return m_doc->isWMLDocument(); + + return false; +} +#endif + +void XMLDocumentParser::pushCurrentNode(Node* n) +{ + ASSERT(n); + ASSERT(m_currentNode); + if (n != m_doc) + n->ref(); + m_currentNodeStack.append(m_currentNode); + m_currentNode = n; + if (m_currentNodeStack.size() > maxDOMTreeDepth) + handleError(fatal, "Excessive node nesting.", lineNumber(), columnNumber()); +} + +void XMLDocumentParser::popCurrentNode() +{ + if (!m_currentNode) + return; + ASSERT(m_currentNodeStack.size()); + + if (m_currentNode != m_doc) + m_currentNode->deref(); + + m_currentNode = m_currentNodeStack.last(); + m_currentNodeStack.removeLast(); +} + +void XMLDocumentParser::clearCurrentNodeStack() +{ + if (m_currentNode && m_currentNode != m_doc) + m_currentNode->deref(); + m_currentNode = 0; + + if (m_currentNodeStack.size()) { // Aborted parsing. + for (size_t i = m_currentNodeStack.size() - 1; i != 0; --i) + m_currentNodeStack[i]->deref(); + if (m_currentNodeStack[0] && m_currentNodeStack[0] != m_doc) + m_currentNodeStack[0]->deref(); + m_currentNodeStack.clear(); + } +} + +void XMLDocumentParser::write(const SegmentedString& s, bool /*appendData*/) +{ + String parseString = s.toString(); + + if (m_sawXSLTransform || !m_sawFirstElement) + m_originalSourceForTransform += parseString; + + if (m_parserStopped || m_sawXSLTransform) + return; + + if (m_parserPaused) { + m_pendingSrc.append(s); + return; + } + + doWrite(s.toString()); + + // After parsing, go ahead and dispatch image beforeload events. + ImageLoader::dispatchPendingBeforeLoadEvents(); +} + +void XMLDocumentParser::handleError(ErrorType type, const char* m, int lineNumber, int columnNumber) +{ + if (type == fatal || (m_errorCount < maxErrors && m_lastErrorLine != lineNumber && m_lastErrorColumn != columnNumber)) { + switch (type) { + case warning: + m_errorMessages += String::format("warning on line %d at column %d: %s", lineNumber, columnNumber, m); + break; + case fatal: + case nonFatal: + m_errorMessages += String::format("error on line %d at column %d: %s", lineNumber, columnNumber, m); + } + + m_lastErrorLine = lineNumber; + m_lastErrorColumn = columnNumber; + ++m_errorCount; + } + + if (type != warning) + m_sawError = true; + + if (type == fatal) + stopParsing(); +} + +bool XMLDocumentParser::enterText() +{ +#if !USE(QXMLSTREAM) + ASSERT(m_bufferedText.size() == 0); +#endif + RefPtr<Node> newNode = Text::create(m_doc, ""); + if (!m_currentNode->addChild(newNode.get())) + return false; + pushCurrentNode(newNode.get()); + return true; +} + +#if !USE(QXMLSTREAM) +static inline String toString(const xmlChar* str, unsigned len) +{ + return UTF8Encoding().decode(reinterpret_cast<const char*>(str), len); +} +#endif + + +void XMLDocumentParser::exitText() +{ + if (m_parserStopped) + return; + + if (!m_currentNode || !m_currentNode->isTextNode()) + return; + +#if !USE(QXMLSTREAM) + ExceptionCode ec = 0; + static_cast<Text*>(m_currentNode)->appendData(toString(m_bufferedText.data(), m_bufferedText.size()), ec); + Vector<xmlChar> empty; + m_bufferedText.swap(empty); +#endif + + if (m_view && m_currentNode && !m_currentNode->attached()) + m_currentNode->attach(); + + popCurrentNode(); +} + +void XMLDocumentParser::end() +{ + doEnd(); + + // doEnd() could process a script tag, thus pausing parsing. + if (m_parserPaused) + return; + + if (m_sawError) + insertErrorMessageBlock(); + else { + exitText(); + m_doc->updateStyleSelector(); + } + + clearCurrentNodeStack(); + if (!m_parsingFragment) + m_doc->finishedParsing(); +} + +void XMLDocumentParser::finish() +{ + if (m_parserPaused) + m_finishCalled = true; + else + end(); +} + +static inline RefPtr<Element> createXHTMLParserErrorHeader(Document* doc, const String& errorMessages) +{ + RefPtr<Element> reportElement = doc->createElement(QualifiedName(nullAtom, "parsererror", xhtmlNamespaceURI), false); + reportElement->setAttribute(styleAttr, "display: block; white-space: pre; border: 2px solid #c77; padding: 0 1em 0 1em; margin: 1em; background-color: #fdd; color: black"); + + ExceptionCode ec = 0; + RefPtr<Element> h3 = doc->createElement(h3Tag, false); + reportElement->appendChild(h3.get(), ec); + h3->appendChild(doc->createTextNode("This page contains the following errors:"), ec); + + RefPtr<Element> fixed = doc->createElement(divTag, false); + reportElement->appendChild(fixed.get(), ec); + fixed->setAttribute(styleAttr, "font-family:monospace;font-size:12px"); + fixed->appendChild(doc->createTextNode(errorMessages), ec); + + h3 = doc->createElement(h3Tag, false); + reportElement->appendChild(h3.get(), ec); + h3->appendChild(doc->createTextNode("Below is a rendering of the page up to the first error."), ec); + + return reportElement; +} + +void XMLDocumentParser::insertErrorMessageBlock() +{ +#if USE(QXMLSTREAM) + if (m_parsingFragment) + return; +#endif + // One or more errors occurred during parsing of the code. Display an error block to the user above + // the normal content (the DOM tree is created manually and includes line/col info regarding + // where the errors are located) + + // Create elements for display + ExceptionCode ec = 0; + Document* doc = m_doc; + Node* documentElement = doc->documentElement(); + if (!documentElement) { + RefPtr<Node> rootElement = doc->createElement(htmlTag, false); + doc->appendChild(rootElement, ec); + RefPtr<Node> body = doc->createElement(bodyTag, false); + rootElement->appendChild(body, ec); + documentElement = body.get(); + } +#if ENABLE(SVG) + else if (documentElement->namespaceURI() == SVGNames::svgNamespaceURI) { + RefPtr<Node> rootElement = doc->createElement(htmlTag, false); + RefPtr<Node> body = doc->createElement(bodyTag, false); + rootElement->appendChild(body, ec); + body->appendChild(documentElement, ec); + doc->appendChild(rootElement.get(), ec); + documentElement = body.get(); + } +#endif +#if ENABLE(WML) + else if (isWMLDocument()) { + RefPtr<Node> rootElement = doc->createElement(htmlTag, false); + RefPtr<Node> body = doc->createElement(bodyTag, false); + rootElement->appendChild(body, ec); + body->appendChild(documentElement, ec); + doc->appendChild(rootElement.get(), ec); + documentElement = body.get(); + } +#endif + + RefPtr<Element> reportElement = createXHTMLParserErrorHeader(doc, m_errorMessages); + documentElement->insertBefore(reportElement, documentElement->firstChild(), ec); +#if ENABLE(XSLT) + if (doc->transformSourceDocument()) { + RefPtr<Element> par = doc->createElement(pTag, false); + reportElement->appendChild(par, ec); + par->setAttribute(styleAttr, "white-space: normal"); + par->appendChild(doc->createTextNode("This document was created as the result of an XSL transformation. The line and column numbers given are from the transformed result."), ec); + } +#endif + doc->updateStyleIfNeeded(); +} + +void XMLDocumentParser::notifyFinished(CachedResource* unusedResource) +{ + ASSERT_UNUSED(unusedResource, unusedResource == m_pendingScript); + ASSERT(m_pendingScript->accessCount() > 0); + + ScriptSourceCode sourceCode(m_pendingScript.get()); + bool errorOccurred = m_pendingScript->errorOccurred(); + + m_pendingScript->removeClient(this); + m_pendingScript = 0; + + RefPtr<Element> e = m_scriptElement; + m_scriptElement = 0; + + ScriptElement* scriptElement = toScriptElement(e.get()); + ASSERT(scriptElement); + + if (errorOccurred) + scriptElement->dispatchErrorEvent(); + else { + m_view->frame()->script()->executeScript(sourceCode); + scriptElement->dispatchLoadEvent(); + } + + m_scriptElement = 0; + + if (!m_requestingScript) + resumeParsing(); +} + +bool XMLDocumentParser::isWaitingForScripts() const +{ + return m_pendingScript; +} + +void XMLDocumentParser::pauseParsing() +{ + if (m_parsingFragment) + return; + + m_parserPaused = true; +} + +} diff --git a/WebCore/dom/XMLDocumentParser.h b/WebCore/dom/XMLDocumentParser.h new file mode 100644 index 0000000..bc10415 --- /dev/null +++ b/WebCore/dom/XMLDocumentParser.h @@ -0,0 +1,326 @@ +/* + * Copyright (C) 2000 Peter Kelly (pmk@post.com) + * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) + * + * 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 XMLTokenizer_h +#define XMLTokenizer_h + +#if USE(EXPAT) + +#include "CachedResourceClient.h" +#include "SegmentedString.h" +#include "StringHash.h" +#include "Tokenizer.h" +#include <libexpat/expat.h> +#include <wtf/HashMap.h> +#include <wtf/OwnPtr.h> + +namespace WebCore { + + class Node; + class CachedScript; + class DocumentFragment; + class Document; + class Element; + class FrameView; + class PendingCallbacks; + + class XMLTokenizer : public Tokenizer, public CachedResourceClient { + public: + XMLTokenizer(Document *, FrameView * = 0); + XMLTokenizer(DocumentFragment *, Element *); + ~XMLTokenizer(); + + enum ErrorType { warning, nonFatal, fatal }; + + // from Tokenizer + virtual bool write(const SegmentedString &str, bool); + virtual void finish(); + virtual bool isWaitingForScripts() const; + virtual void stopParsing(); + virtual bool wellFormed() const { return !m_sawError; } + virtual int lineNumber() const; + virtual int columnNumber() const; + + // from CachedObjectClient + virtual void notifyFinished(CachedResource *finishedObj); + + // callbacks from parser expat + void startElementNs(const XML_Char *name, const XML_Char **atts); + void endElementNs(); + void characters(const XML_Char *s, int len); + void processingInstruction(const XML_Char *target, const XML_Char *data); + void comment(const XML_Char *s); + void startCdata(); + void endCdata(); + + void error(ErrorType type, const char* m, int lineNumber, int columnNumber); + + // utilities + XML_Parser getXMLParser() const { return m_parser; } + void setXMLParser(XML_Parser parser) { m_parser = parser; } + + private: + void setCurrentNode(Node*); + + void end(); + + void pauseParsing(); + void resumeParsing(); + + void reportError(); + void insertErrorMessageBlock(); + + bool enterText(); + void exitText(); + + Document *m_doc; + FrameView *m_view; + + XML_Parser m_parser; + + Node *m_currentNode; + bool m_currentNodeIsReferenced; + + bool m_sawError; + bool m_sawXSLTransform; + bool m_sawFirstElement; + + bool m_parserPaused; + bool m_requestingScript; + bool m_finishCalled; + + int m_errorCount; + String m_errorMessages; + + CachedScript *m_pendingScript; + RefPtr<Element> m_scriptElement; + int m_scriptStartLine; + + bool m_parsingFragment; + String m_defaultNamespaceURI; + + typedef HashMap<String, String> PrefixForNamespaceMap; + PrefixForNamespaceMap m_prefixToNamespaceMap; + + OwnPtr<PendingCallbacks> m_pendingCallbacks; + SegmentedString m_pendingSrc; + }; + +HashMap<String, String> parseAttributes(const String&, bool& attrsOK); +bool parseXMLDocumentFragment(const String&, DocumentFragment*, Element* parent = 0); + +} // namespace WebCore + +#else // USE(EXPAT) + +#include "CachedResourceClient.h" +#include "CachedResourceHandle.h" +#include "MappedAttributeEntry.h" +#include "SegmentedString.h" +#include "StringHash.h" +#include "DocumentParser.h" +#include <wtf/HashMap.h> +#include <wtf/OwnPtr.h> + +#if USE(QXMLSTREAM) +#include <qxmlstream.h> +#else +#include <libxml/tree.h> +#include <libxml/xmlstring.h> +#endif + +namespace WebCore { + + class Node; + class CachedScript; + class DocLoader; + class DocumentFragment; + class Document; + class Element; + class FrameView; + class PendingCallbacks; + class ScriptElement; + +#if !USE(QXMLSTREAM) + class XMLParserContext : public RefCounted<XMLParserContext> { + public: + static PassRefPtr<XMLParserContext> createMemoryParser(xmlSAXHandlerPtr, void*, const char*); + static PassRefPtr<XMLParserContext> createStringParser(xmlSAXHandlerPtr, void*); + ~XMLParserContext(); + xmlParserCtxtPtr context() const { return m_context; } + + private: + XMLParserContext(xmlParserCtxtPtr context) + : m_context(context) + { + } + xmlParserCtxtPtr m_context; + }; +#endif + + class XMLDocumentParser : public DocumentParser, public CachedResourceClient { + public: + XMLDocumentParser(Document*, FrameView* = 0); + XMLDocumentParser(DocumentFragment*, Element*, FragmentScriptingPermission); + ~XMLDocumentParser(); + + enum ErrorType { warning, nonFatal, fatal }; + + // from DocumentParser + virtual void write(const SegmentedString&, bool appendData); + virtual void finish(); + virtual bool isWaitingForScripts() const; + virtual void stopParsing(); + + void end(); + + void pauseParsing(); + void resumeParsing(); + + void setIsXHTMLDocument(bool isXHTML) { m_isXHTMLDocument = isXHTML; } + bool isXHTMLDocument() const { return m_isXHTMLDocument; } +#if ENABLE(XHTMLMP) + void setIsXHTMLMPDocument(bool isXHTML) { m_isXHTMLMPDocument = isXHTML; } + bool isXHTMLMPDocument() const { return m_isXHTMLMPDocument; } +#endif +#if ENABLE(WML) + bool isWMLDocument() const; +#endif + + // from CachedResourceClient + virtual void notifyFinished(CachedResource* finishedObj); + + + void handleError(ErrorType type, const char* m, int lineNumber, int columnNumber); + + virtual bool wellFormed() const { return !m_sawError; } + + int lineNumber() const; + int columnNumber() const; + +#if USE(QXMLSTREAM) +private: + void parse(); + void startDocument(); + void parseStartElement(); + void parseEndElement(); + void parseCharacters(); + void parseProcessingInstruction(); + void parseCdata(); + void parseComment(); + void endDocument(); + void parseDtd(); + bool hasError() const; +#else +public: + // callbacks from parser SAX + void error(ErrorType, const char* message, va_list args) WTF_ATTRIBUTE_PRINTF(3, 0); + void startElementNs(const xmlChar* xmlLocalName, const xmlChar* xmlPrefix, const xmlChar* xmlURI, int nb_namespaces, + const xmlChar** namespaces, int nb_attributes, int nb_defaulted, const xmlChar** libxmlAttributes); + void endElementNs(); + void characters(const xmlChar* s, int len); + void processingInstruction(const xmlChar* target, const xmlChar* data); + void cdataBlock(const xmlChar* s, int len); + void comment(const xmlChar* s); + void startDocument(const xmlChar* version, const xmlChar* encoding, int standalone); + void internalSubset(const xmlChar* name, const xmlChar* externalID, const xmlChar* systemID); + void endDocument(); +#endif + private: + friend bool parseXMLDocumentFragment(const String&, DocumentFragment*, Element*, FragmentScriptingPermission); + + void initializeParserContext(const char* chunk = 0); + + void pushCurrentNode(Node*); + void popCurrentNode(); + void clearCurrentNodeStack(); + + void insertErrorMessageBlock(); + + bool enterText(); + void exitText(); + + void doWrite(const String&); + void doEnd(); + + Document* m_doc; + FrameView* m_view; + + String m_originalSourceForTransform; + +#if USE(QXMLSTREAM) + QXmlStreamReader m_stream; + bool m_wroteText; +#else + xmlParserCtxtPtr context() const { return m_context ? m_context->context() : 0; }; + RefPtr<XMLParserContext> m_context; + OwnPtr<PendingCallbacks> m_pendingCallbacks; + Vector<xmlChar> m_bufferedText; +#endif + Node* m_currentNode; + Vector<Node*> m_currentNodeStack; + + bool m_sawError; + bool m_sawXSLTransform; + bool m_sawFirstElement; + bool m_isXHTMLDocument; +#if ENABLE(XHTMLMP) + bool m_isXHTMLMPDocument; + bool m_hasDocTypeDeclaration; +#endif + + bool m_parserPaused; + bool m_requestingScript; + bool m_finishCalled; + + int m_errorCount; + int m_lastErrorLine; + int m_lastErrorColumn; + String m_errorMessages; + + CachedResourceHandle<CachedScript> m_pendingScript; + RefPtr<Element> m_scriptElement; + int m_scriptStartLine; + + bool m_parsingFragment; + String m_defaultNamespaceURI; + + typedef HashMap<String, String> PrefixForNamespaceMap; + PrefixForNamespaceMap m_prefixToNamespaceMap; + SegmentedString m_pendingSrc; + FragmentScriptingPermission m_scriptingPermission; + }; + +#if ENABLE(XSLT) +void* xmlDocPtrForString(DocLoader*, const String& source, const String& url); +#endif + +HashMap<String, String> parseAttributes(const String&, bool& attrsOK); +bool parseXMLDocumentFragment(const String&, DocumentFragment*, Element* parent = 0, FragmentScriptingPermission = FragmentScriptingAllowed); + +} // namespace WebCore + +#endif // USE(EXPAT) + +#endif // XMLTokenizer_h diff --git a/WebCore/dom/XMLDocumentParserLibxml2.cpp b/WebCore/dom/XMLDocumentParserLibxml2.cpp new file mode 100644 index 0000000..2a1bac6 --- /dev/null +++ b/WebCore/dom/XMLDocumentParserLibxml2.cpp @@ -0,0 +1,1456 @@ +/* + * Copyright (C) 2000 Peter Kelly (pmk@post.com) + * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) + * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2008 Holger Hans Peter Freyther + * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) + * + * 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 "XMLDocumentParser.h" + +#include "CDATASection.h" +#include "CachedScript.h" +#include "Comment.h" +#include "DocLoader.h" +#include "Document.h" +#include "DocumentFragment.h" +#include "DocumentType.h" +#include "Frame.h" +#include "FrameLoader.h" +#include "FrameView.h" +#include "HTMLLinkElement.h" +#include "HTMLStyleElement.h" +#include "HTMLDocumentParser.h" // for decodeNamedEntity +#include "ProcessingInstruction.h" +#include "ResourceError.h" +#include "ResourceHandle.h" +#include "ResourceRequest.h" +#include "ResourceResponse.h" +#include "ScriptController.h" +#include "ScriptElement.h" +#include "ScriptSourceCode.h" +#include "ScriptValue.h" +#include "TextResourceDecoder.h" +#include "TransformSource.h" +#include "XMLNSNames.h" +#include "XMLDocumentParserScope.h" +#include <libxml/parser.h> +#include <libxml/parserInternals.h> +#include <wtf/text/CString.h> +#include <wtf/StringExtras.h> +#include <wtf/Threading.h> +#include <wtf/UnusedParam.h> +#include <wtf/Vector.h> + +#if ENABLE(XSLT) +#include <libxslt/xslt.h> +#endif + +#if ENABLE(XHTMLMP) +#include "HTMLNames.h" +#include "HTMLScriptElement.h" +#endif + +using namespace std; + +namespace WebCore { + +class PendingCallbacks : public Noncopyable { +public: + ~PendingCallbacks() + { + deleteAllValues(m_callbacks); + } + + void appendStartElementNSCallback(const xmlChar* xmlLocalName, const xmlChar* xmlPrefix, const xmlChar* xmlURI, int nb_namespaces, + const xmlChar** namespaces, int nb_attributes, int nb_defaulted, const xmlChar** attributes) + { + PendingStartElementNSCallback* callback = new PendingStartElementNSCallback; + + callback->xmlLocalName = xmlStrdup(xmlLocalName); + callback->xmlPrefix = xmlStrdup(xmlPrefix); + callback->xmlURI = xmlStrdup(xmlURI); + callback->nb_namespaces = nb_namespaces; + callback->namespaces = static_cast<xmlChar**>(xmlMalloc(sizeof(xmlChar*) * nb_namespaces * 2)); + for (int i = 0; i < nb_namespaces * 2 ; i++) + callback->namespaces[i] = xmlStrdup(namespaces[i]); + callback->nb_attributes = nb_attributes; + callback->nb_defaulted = nb_defaulted; + callback->attributes = static_cast<xmlChar**>(xmlMalloc(sizeof(xmlChar*) * nb_attributes * 5)); + for (int i = 0; i < nb_attributes; i++) { + // Each attribute has 5 elements in the array: + // name, prefix, uri, value and an end pointer. + + for (int j = 0; j < 3; j++) + callback->attributes[i * 5 + j] = xmlStrdup(attributes[i * 5 + j]); + + int len = attributes[i * 5 + 4] - attributes[i * 5 + 3]; + + callback->attributes[i * 5 + 3] = xmlStrndup(attributes[i * 5 + 3], len); + callback->attributes[i * 5 + 4] = callback->attributes[i * 5 + 3] + len; + } + + m_callbacks.append(callback); + } + + void appendEndElementNSCallback() + { + PendingEndElementNSCallback* callback = new PendingEndElementNSCallback; + + m_callbacks.append(callback); + } + + void appendCharactersCallback(const xmlChar* s, int len) + { + PendingCharactersCallback* callback = new PendingCharactersCallback; + + callback->s = xmlStrndup(s, len); + callback->len = len; + + m_callbacks.append(callback); + } + + void appendProcessingInstructionCallback(const xmlChar* target, const xmlChar* data) + { + PendingProcessingInstructionCallback* callback = new PendingProcessingInstructionCallback; + + callback->target = xmlStrdup(target); + callback->data = xmlStrdup(data); + + m_callbacks.append(callback); + } + + void appendCDATABlockCallback(const xmlChar* s, int len) + { + PendingCDATABlockCallback* callback = new PendingCDATABlockCallback; + + callback->s = xmlStrndup(s, len); + callback->len = len; + + m_callbacks.append(callback); + } + + void appendCommentCallback(const xmlChar* s) + { + PendingCommentCallback* callback = new PendingCommentCallback; + + callback->s = xmlStrdup(s); + + m_callbacks.append(callback); + } + + void appendInternalSubsetCallback(const xmlChar* name, const xmlChar* externalID, const xmlChar* systemID) + { + PendingInternalSubsetCallback* callback = new PendingInternalSubsetCallback; + + callback->name = xmlStrdup(name); + callback->externalID = xmlStrdup(externalID); + callback->systemID = xmlStrdup(systemID); + + m_callbacks.append(callback); + } + + void appendErrorCallback(XMLDocumentParser::ErrorType type, const xmlChar* message, int lineNumber, int columnNumber) + { + PendingErrorCallback* callback = new PendingErrorCallback; + + callback->message = xmlStrdup(message); + callback->type = type; + callback->lineNumber = lineNumber; + callback->columnNumber = columnNumber; + + m_callbacks.append(callback); + } + + void callAndRemoveFirstCallback(XMLDocumentParser* parser) + { + OwnPtr<PendingCallback> callback(m_callbacks.takeFirst()); + callback->call(parser); + } + + bool isEmpty() const { return m_callbacks.isEmpty(); } + +private: + struct PendingCallback { + virtual ~PendingCallback() { } + virtual void call(XMLDocumentParser* parser) = 0; + }; + + struct PendingStartElementNSCallback : public PendingCallback { + virtual ~PendingStartElementNSCallback() + { + xmlFree(xmlLocalName); + xmlFree(xmlPrefix); + xmlFree(xmlURI); + for (int i = 0; i < nb_namespaces * 2; i++) + xmlFree(namespaces[i]); + xmlFree(namespaces); + for (int i = 0; i < nb_attributes; i++) + for (int j = 0; j < 4; j++) + xmlFree(attributes[i * 5 + j]); + xmlFree(attributes); + } + + virtual void call(XMLDocumentParser* parser) + { + parser->startElementNs(xmlLocalName, xmlPrefix, xmlURI, + nb_namespaces, const_cast<const xmlChar**>(namespaces), + nb_attributes, nb_defaulted, const_cast<const xmlChar**>(attributes)); + } + + xmlChar* xmlLocalName; + xmlChar* xmlPrefix; + xmlChar* xmlURI; + int nb_namespaces; + xmlChar** namespaces; + int nb_attributes; + int nb_defaulted; + xmlChar** attributes; + }; + + struct PendingEndElementNSCallback : public PendingCallback { + virtual void call(XMLDocumentParser* parser) + { + parser->endElementNs(); + } + }; + + struct PendingCharactersCallback : public PendingCallback { + virtual ~PendingCharactersCallback() + { + xmlFree(s); + } + + virtual void call(XMLDocumentParser* parser) + { + parser->characters(s, len); + } + + xmlChar* s; + int len; + }; + + struct PendingProcessingInstructionCallback : public PendingCallback { + virtual ~PendingProcessingInstructionCallback() + { + xmlFree(target); + xmlFree(data); + } + + virtual void call(XMLDocumentParser* parser) + { + parser->processingInstruction(target, data); + } + + xmlChar* target; + xmlChar* data; + }; + + struct PendingCDATABlockCallback : public PendingCallback { + virtual ~PendingCDATABlockCallback() + { + xmlFree(s); + } + + virtual void call(XMLDocumentParser* parser) + { + parser->cdataBlock(s, len); + } + + xmlChar* s; + int len; + }; + + struct PendingCommentCallback : public PendingCallback { + virtual ~PendingCommentCallback() + { + xmlFree(s); + } + + virtual void call(XMLDocumentParser* parser) + { + parser->comment(s); + } + + xmlChar* s; + }; + + struct PendingInternalSubsetCallback : public PendingCallback { + virtual ~PendingInternalSubsetCallback() + { + xmlFree(name); + xmlFree(externalID); + xmlFree(systemID); + } + + virtual void call(XMLDocumentParser* parser) + { + parser->internalSubset(name, externalID, systemID); + } + + xmlChar* name; + xmlChar* externalID; + xmlChar* systemID; + }; + + struct PendingErrorCallback: public PendingCallback { + virtual ~PendingErrorCallback() + { + xmlFree(message); + } + + virtual void call(XMLDocumentParser* parser) + { + parser->handleError(type, reinterpret_cast<char*>(message), lineNumber, columnNumber); + } + + XMLDocumentParser::ErrorType type; + xmlChar* message; + int lineNumber; + int columnNumber; + }; + + Deque<PendingCallback*> m_callbacks; +}; +// -------------------------------- + +static int globalDescriptor = 0; +static ThreadIdentifier libxmlLoaderThread = 0; + +static int matchFunc(const char*) +{ + // Only match loads initiated due to uses of libxml2 from within XMLDocumentParser to avoid + // interfering with client applications that also use libxml2. http://bugs.webkit.org/show_bug.cgi?id=17353 + return XMLDocumentParserScope::currentDocLoader && currentThread() == libxmlLoaderThread; +} + +class OffsetBuffer { +public: + OffsetBuffer(const Vector<char>& b) : m_buffer(b), m_currentOffset(0) { } + + int readOutBytes(char* outputBuffer, unsigned askedToRead) + { + unsigned bytesLeft = m_buffer.size() - m_currentOffset; + unsigned lenToCopy = min(askedToRead, bytesLeft); + if (lenToCopy) { + memcpy(outputBuffer, m_buffer.data() + m_currentOffset, lenToCopy); + m_currentOffset += lenToCopy; + } + return lenToCopy; + } + +private: + Vector<char> m_buffer; + unsigned m_currentOffset; +}; + +static bool shouldAllowExternalLoad(const KURL& url) +{ + String urlString = url.string(); + + // On non-Windows platforms libxml asks for this URL, the + // "XML_XML_DEFAULT_CATALOG", on initialization. + if (urlString == "file:///etc/xml/catalog") + return false; + + // On Windows, libxml computes a URL relative to where its DLL resides. + if (urlString.startsWith("file:///", false) && urlString.endsWith("/etc/catalog", false)) + return false; + + // The most common DTD. There isn't much point in hammering www.w3c.org + // by requesting this URL for every XHTML document. + if (urlString.startsWith("http://www.w3.org/TR/xhtml", false)) + return false; + + // Similarly, there isn't much point in requesting the SVG DTD. + if (urlString.startsWith("http://www.w3.org/Graphics/SVG", false)) + return false; + + // The libxml doesn't give us a lot of context for deciding whether to + // allow this request. In the worst case, this load could be for an + // external entity and the resulting document could simply read the + // retrieved content. If we had more context, we could potentially allow + // the parser to load a DTD. As things stand, we take the conservative + // route and allow same-origin requests only. + if (!XMLDocumentParserScope::currentDocLoader->doc()->securityOrigin()->canRequest(url)) { + XMLDocumentParserScope::currentDocLoader->printAccessDeniedMessage(url); + return false; + } + + return true; +} + +static void* openFunc(const char* uri) +{ + ASSERT(XMLDocumentParserScope::currentDocLoader); + ASSERT(currentThread() == libxmlLoaderThread); + + KURL url(KURL(), uri); + + if (!shouldAllowExternalLoad(url)) + return &globalDescriptor; + + ResourceError error; + ResourceResponse response; + Vector<char> data; + + + { + DocLoader* docLoader = XMLDocumentParserScope::currentDocLoader; + XMLDocumentParserScope scope(0); + // FIXME: We should restore the original global error handler as well. + + if (docLoader->frame()) + docLoader->frame()->loader()->loadResourceSynchronously(url, AllowStoredCredentials, error, response, data); + } + + // We have to check the URL again after the load to catch redirects. + // See <https://bugs.webkit.org/show_bug.cgi?id=21963>. + if (!shouldAllowExternalLoad(response.url())) + return &globalDescriptor; + + return new OffsetBuffer(data); +} + +static int readFunc(void* context, char* buffer, int len) +{ + // Do 0-byte reads in case of a null descriptor + if (context == &globalDescriptor) + return 0; + + OffsetBuffer* data = static_cast<OffsetBuffer*>(context); + return data->readOutBytes(buffer, len); +} + +static int writeFunc(void*, const char*, int) +{ + // Always just do 0-byte writes + return 0; +} + +static int closeFunc(void* context) +{ + if (context != &globalDescriptor) { + OffsetBuffer* data = static_cast<OffsetBuffer*>(context); + delete data; + } + return 0; +} + +#if ENABLE(XSLT) +static void errorFunc(void*, const char*, ...) +{ + // FIXME: It would be nice to display error messages somewhere. +} +#endif + +static bool didInit = false; + +PassRefPtr<XMLParserContext> XMLParserContext::createStringParser(xmlSAXHandlerPtr handlers, void* userData) +{ + if (!didInit) { + xmlInitParser(); + xmlRegisterInputCallbacks(matchFunc, openFunc, readFunc, closeFunc); + xmlRegisterOutputCallbacks(matchFunc, openFunc, writeFunc, closeFunc); + libxmlLoaderThread = currentThread(); + didInit = true; + } + + xmlParserCtxtPtr parser = xmlCreatePushParserCtxt(handlers, 0, 0, 0, 0); + parser->_private = userData; + parser->replaceEntities = true; + const UChar BOM = 0xFEFF; + const unsigned char BOMHighByte = *reinterpret_cast<const unsigned char*>(&BOM); + xmlSwitchEncoding(parser, BOMHighByte == 0xFF ? XML_CHAR_ENCODING_UTF16LE : XML_CHAR_ENCODING_UTF16BE); + + return adoptRef(new XMLParserContext(parser)); +} + + +// Chunk should be encoded in UTF-8 +PassRefPtr<XMLParserContext> XMLParserContext::createMemoryParser(xmlSAXHandlerPtr handlers, void* userData, const char* chunk) +{ + if (!didInit) { + xmlInitParser(); + xmlRegisterInputCallbacks(matchFunc, openFunc, readFunc, closeFunc); + xmlRegisterOutputCallbacks(matchFunc, openFunc, writeFunc, closeFunc); + libxmlLoaderThread = currentThread(); + didInit = true; + } + + xmlParserCtxtPtr parser = xmlCreateMemoryParserCtxt(chunk, xmlStrlen((const xmlChar*)chunk)); + + if (!parser) + return 0; + + // Copy the sax handler + memcpy(parser->sax, handlers, sizeof(xmlSAXHandler)); + + // Set parser options. + // XML_PARSE_NODICT: default dictionary option. + // XML_PARSE_NOENT: force entities substitutions. + xmlCtxtUseOptions(parser, XML_PARSE_NODICT | XML_PARSE_NOENT); + + // Internal initialization + parser->sax2 = 1; + parser->instate = XML_PARSER_CONTENT; // We are parsing a CONTENT + parser->depth = 0; + parser->str_xml = xmlDictLookup(parser->dict, BAD_CAST "xml", 3); + parser->str_xmlns = xmlDictLookup(parser->dict, BAD_CAST "xmlns", 5); + parser->str_xml_ns = xmlDictLookup(parser->dict, XML_XML_NAMESPACE, 36); + parser->_private = userData; + + return adoptRef(new XMLParserContext(parser)); +} + +// -------------------------------- + +XMLDocumentParser::XMLDocumentParser(Document* _doc, FrameView* _view) + : m_doc(_doc) + , m_view(_view) + , m_context(0) + , m_pendingCallbacks(new PendingCallbacks) + , m_currentNode(_doc) + , m_sawError(false) + , m_sawXSLTransform(false) + , m_sawFirstElement(false) + , m_isXHTMLDocument(false) +#if ENABLE(XHTMLMP) + , m_isXHTMLMPDocument(false) + , m_hasDocTypeDeclaration(false) +#endif + , m_parserPaused(false) + , m_requestingScript(false) + , m_finishCalled(false) + , m_errorCount(0) + , m_lastErrorLine(0) + , m_lastErrorColumn(0) + , m_pendingScript(0) + , m_scriptStartLine(0) + , m_parsingFragment(false) + , m_scriptingPermission(FragmentScriptingAllowed) +{ +} + +XMLDocumentParser::XMLDocumentParser(DocumentFragment* fragment, Element* parentElement, FragmentScriptingPermission scriptingPermission) + : m_doc(fragment->document()) + , m_view(0) + , m_context(0) + , m_pendingCallbacks(new PendingCallbacks) + , m_currentNode(fragment) + , m_sawError(false) + , m_sawXSLTransform(false) + , m_sawFirstElement(false) + , m_isXHTMLDocument(false) +#if ENABLE(XHTMLMP) + , m_isXHTMLMPDocument(false) + , m_hasDocTypeDeclaration(false) +#endif + , m_parserPaused(false) + , m_requestingScript(false) + , m_finishCalled(false) + , m_errorCount(0) + , m_lastErrorLine(0) + , m_lastErrorColumn(0) + , m_pendingScript(0) + , m_scriptStartLine(0) + , m_parsingFragment(true) + , m_scriptingPermission(scriptingPermission) +{ + fragment->ref(); + if (m_doc) + m_doc->ref(); + + // Add namespaces based on the parent node + Vector<Element*> elemStack; + while (parentElement) { + elemStack.append(parentElement); + + Node* n = parentElement->parentNode(); + if (!n || !n->isElementNode()) + break; + parentElement = static_cast<Element*>(n); + } + + if (elemStack.isEmpty()) + return; + + for (Element* element = elemStack.last(); !elemStack.isEmpty(); elemStack.removeLast()) { + if (NamedNodeMap* attrs = element->attributes()) { + for (unsigned i = 0; i < attrs->length(); i++) { + Attribute* attr = attrs->attributeItem(i); + if (attr->localName() == xmlnsAtom) + m_defaultNamespaceURI = attr->value(); + else if (attr->prefix() == xmlnsAtom) + m_prefixToNamespaceMap.set(attr->localName(), attr->value()); + } + } + } + + // If the parent element is not in document tree, there may be no xmlns attribute; just default to the parent's namespace. + if (m_defaultNamespaceURI.isNull() && !parentElement->inDocument()) + m_defaultNamespaceURI = parentElement->namespaceURI(); +} + +XMLParserContext::~XMLParserContext() +{ + if (m_context->myDoc) + xmlFreeDoc(m_context->myDoc); + xmlFreeParserCtxt(m_context); +} + +XMLDocumentParser::~XMLDocumentParser() +{ + clearCurrentNodeStack(); + if (m_parsingFragment && m_doc) + m_doc->deref(); + if (m_pendingScript) + m_pendingScript->removeClient(this); +} + +void XMLDocumentParser::doWrite(const String& parseString) +{ + if (!m_context) + initializeParserContext(); + + // Protect the libxml context from deletion during a callback + RefPtr<XMLParserContext> context = m_context; + + // libXML throws an error if you try to switch the encoding for an empty string. + if (parseString.length()) { + // Hack around libxml2's lack of encoding overide support by manually + // resetting the encoding to UTF-16 before every chunk. Otherwise libxml + // will detect <?xml version="1.0" encoding="<encoding name>"?> blocks + // and switch encodings, causing the parse to fail. + const UChar BOM = 0xFEFF; + const unsigned char BOMHighByte = *reinterpret_cast<const unsigned char*>(&BOM); + xmlSwitchEncoding(context->context(), BOMHighByte == 0xFF ? XML_CHAR_ENCODING_UTF16LE : XML_CHAR_ENCODING_UTF16BE); + + XMLDocumentParserScope scope(m_doc->docLoader()); + xmlParseChunk(context->context(), reinterpret_cast<const char*>(parseString.characters()), sizeof(UChar) * parseString.length(), 0); + } + + if (m_doc->decoder() && m_doc->decoder()->sawError()) { + // If the decoder saw an error, report it as fatal (stops parsing) + handleError(fatal, "Encoding error", context->context()->input->line, context->context()->input->col); + } + + return; +} + +static inline String toString(const xmlChar* str, unsigned len) +{ + return UTF8Encoding().decode(reinterpret_cast<const char*>(str), len); +} + +static inline String toString(const xmlChar* str) +{ + if (!str) + return String(); + + return UTF8Encoding().decode(reinterpret_cast<const char*>(str), strlen(reinterpret_cast<const char*>(str))); +} + +struct _xmlSAX2Namespace { + const xmlChar* prefix; + const xmlChar* uri; +}; +typedef struct _xmlSAX2Namespace xmlSAX2Namespace; + +static inline void handleElementNamespaces(Element* newElement, const xmlChar** libxmlNamespaces, int nb_namespaces, ExceptionCode& ec, FragmentScriptingPermission scriptingPermission) +{ + xmlSAX2Namespace* namespaces = reinterpret_cast<xmlSAX2Namespace*>(libxmlNamespaces); + for (int i = 0; i < nb_namespaces; i++) { + AtomicString namespaceQName = xmlnsAtom; + String namespaceURI = toString(namespaces[i].uri); + if (namespaces[i].prefix) + namespaceQName = "xmlns:" + toString(namespaces[i].prefix); + newElement->setAttributeNS(XMLNSNames::xmlnsNamespaceURI, namespaceQName, namespaceURI, ec, scriptingPermission); + if (ec) // exception setting attributes + return; + } +} + +struct _xmlSAX2Attributes { + const xmlChar* localname; + const xmlChar* prefix; + const xmlChar* uri; + const xmlChar* value; + const xmlChar* end; +}; +typedef struct _xmlSAX2Attributes xmlSAX2Attributes; + +static inline void handleElementAttributes(Element* newElement, const xmlChar** libxmlAttributes, int nb_attributes, ExceptionCode& ec, FragmentScriptingPermission scriptingPermission) +{ + xmlSAX2Attributes* attributes = reinterpret_cast<xmlSAX2Attributes*>(libxmlAttributes); + for (int i = 0; i < nb_attributes; i++) { + String attrLocalName = toString(attributes[i].localname); + int valueLength = (int) (attributes[i].end - attributes[i].value); + String attrValue = toString(attributes[i].value, valueLength); + String attrPrefix = toString(attributes[i].prefix); + String attrURI = attrPrefix.isEmpty() ? String() : toString(attributes[i].uri); + String attrQName = attrPrefix.isEmpty() ? attrLocalName : attrPrefix + ":" + attrLocalName; + + newElement->setAttributeNS(attrURI, attrQName, attrValue, ec, scriptingPermission); + if (ec) // exception setting attributes + return; + } +} + +void XMLDocumentParser::startElementNs(const xmlChar* xmlLocalName, const xmlChar* xmlPrefix, const xmlChar* xmlURI, int nb_namespaces, + const xmlChar** libxmlNamespaces, int nb_attributes, int nb_defaulted, const xmlChar** libxmlAttributes) +{ + if (m_parserStopped) + return; + + if (m_parserPaused) { + m_pendingCallbacks->appendStartElementNSCallback(xmlLocalName, xmlPrefix, xmlURI, nb_namespaces, libxmlNamespaces, + nb_attributes, nb_defaulted, libxmlAttributes); + return; + } + +#if ENABLE(XHTMLMP) + // check if the DOCTYPE Declaration of XHTMLMP document exists + if (!m_hasDocTypeDeclaration && m_doc->isXHTMLMPDocument()) { + handleError(fatal, "DOCTYPE declaration lost.", lineNumber(), columnNumber()); + return; + } +#endif + + exitText(); + + String localName = toString(xmlLocalName); + String uri = toString(xmlURI); + String prefix = toString(xmlPrefix); + + if (m_parsingFragment && uri.isNull()) { + if (!prefix.isNull()) + uri = m_prefixToNamespaceMap.get(prefix); + else + uri = m_defaultNamespaceURI; + } + +#if ENABLE(XHTMLMP) + if (!m_sawFirstElement && isXHTMLMPDocument()) { + // As per the section 7.1 of OMA-WAP-XHTMLMP-V1_1-20061020-A.pdf, + // we should make sure that the root element MUST be 'html' and + // ensure the name of the default namespace on the root elment 'html' + // MUST be 'http://www.w3.org/1999/xhtml' + if (localName != HTMLNames::htmlTag.localName()) { + handleError(fatal, "XHTMLMP document expects 'html' as root element.", lineNumber(), columnNumber()); + return; + } + + if (uri.isNull()) { + m_defaultNamespaceURI = HTMLNames::xhtmlNamespaceURI; + uri = m_defaultNamespaceURI; + } + } +#endif + + bool isFirstElement = !m_sawFirstElement; + m_sawFirstElement = true; + + QualifiedName qName(prefix, localName, uri); + RefPtr<Element> newElement = m_doc->createElement(qName, true); + if (!newElement) { + stopParsing(); + return; + } + + ExceptionCode ec = 0; + handleElementNamespaces(newElement.get(), libxmlNamespaces, nb_namespaces, ec, m_scriptingPermission); + if (ec) { + stopParsing(); + return; + } + + ScriptController* jsProxy = m_doc->frame() ? m_doc->frame()->script() : 0; + if (jsProxy && m_doc->frame()->script()->canExecuteScripts(NotAboutToExecuteScript)) + jsProxy->setEventHandlerLineNumber(lineNumber()); + + handleElementAttributes(newElement.get(), libxmlAttributes, nb_attributes, ec, m_scriptingPermission); + if (ec) { + stopParsing(); + return; + } + + if (jsProxy) + jsProxy->setEventHandlerLineNumber(0); + + newElement->beginParsingChildren(); + + ScriptElement* scriptElement = toScriptElement(newElement.get()); + if (scriptElement) + m_scriptStartLine = lineNumber(); + + if (!m_currentNode->addChild(newElement.get())) { + stopParsing(); + return; + } + + pushCurrentNode(newElement.get()); + if (m_view && !newElement->attached()) + newElement->attach(); + + if (!m_parsingFragment && isFirstElement && m_doc->frame()) + m_doc->frame()->loader()->dispatchDocumentElementAvailable(); +} + +void XMLDocumentParser::endElementNs() +{ + if (m_parserStopped) + return; + + if (m_parserPaused) { + m_pendingCallbacks->appendEndElementNSCallback(); + return; + } + + exitText(); + + Node* n = m_currentNode; + n->finishParsingChildren(); + + if (m_scriptingPermission == FragmentScriptingNotAllowed && n->isElementNode() && toScriptElement(static_cast<Element*>(n))) { + popCurrentNode(); + ExceptionCode ec; + n->remove(ec); + return; + } + + if (!n->isElementNode() || !m_view) { + popCurrentNode(); + return; + } + + Element* element = static_cast<Element*>(n); + + // The element's parent may have already been removed from document. + // Parsing continues in this case, but scripts aren't executed. + if (!element->inDocument()) { + popCurrentNode(); + return; + } + + ScriptElement* scriptElement = toScriptElement(element); + if (!scriptElement) { + popCurrentNode(); + return; + } + + // Don't load external scripts for standalone documents (for now). + ASSERT(!m_pendingScript); + m_requestingScript = true; + +#if ENABLE(XHTMLMP) + if (!scriptElement->shouldExecuteAsJavaScript()) + m_doc->setShouldProcessNoscriptElement(true); + else +#endif + { + String scriptHref = scriptElement->sourceAttributeValue(); + if (!scriptHref.isEmpty()) { + // we have a src attribute + String scriptCharset = scriptElement->scriptCharset(); + if (element->dispatchBeforeLoadEvent(scriptHref) && + (m_pendingScript = m_doc->docLoader()->requestScript(scriptHref, scriptCharset))) { + m_scriptElement = element; + m_pendingScript->addClient(this); + + // m_pendingScript will be 0 if script was already loaded and ref() executed it + if (m_pendingScript) + pauseParsing(); + } else + m_scriptElement = 0; + } else + m_view->frame()->script()->executeScript(ScriptSourceCode(scriptElement->scriptContent(), m_doc->url(), m_scriptStartLine)); + } + m_requestingScript = false; + popCurrentNode(); +} + +void XMLDocumentParser::characters(const xmlChar* s, int len) +{ + if (m_parserStopped) + return; + + if (m_parserPaused) { + m_pendingCallbacks->appendCharactersCallback(s, len); + return; + } + + if (m_currentNode->isTextNode() || enterText()) + m_bufferedText.append(s, len); +} + +void XMLDocumentParser::error(ErrorType type, const char* message, va_list args) +{ + if (m_parserStopped) + return; + +#if COMPILER(MSVC) || COMPILER(RVCT) + char m[1024]; + vsnprintf(m, sizeof(m) - 1, message, args); +#else + char* m; + if (vasprintf(&m, message, args) == -1) + return; +#endif + + if (m_parserPaused) + m_pendingCallbacks->appendErrorCallback(type, reinterpret_cast<const xmlChar*>(m), lineNumber(), columnNumber()); + else + handleError(type, m, lineNumber(), columnNumber()); + +#if !COMPILER(MSVC) && !COMPILER(RVCT) + free(m); +#endif +} + +void XMLDocumentParser::processingInstruction(const xmlChar* target, const xmlChar* data) +{ + if (m_parserStopped) + return; + + if (m_parserPaused) { + m_pendingCallbacks->appendProcessingInstructionCallback(target, data); + return; + } + + exitText(); + + // ### handle exceptions + int exception = 0; + RefPtr<ProcessingInstruction> pi = m_doc->createProcessingInstruction( + toString(target), toString(data), exception); + if (exception) + return; + + pi->setCreatedByParser(true); + + if (!m_currentNode->addChild(pi.get())) + return; + if (m_view && !pi->attached()) + pi->attach(); + + pi->finishParsingChildren(); + +#if ENABLE(XSLT) + m_sawXSLTransform = !m_sawFirstElement && pi->isXSL(); + if (m_sawXSLTransform && !m_doc->transformSourceDocument()) + stopParsing(); +#endif +} + +void XMLDocumentParser::cdataBlock(const xmlChar* s, int len) +{ + if (m_parserStopped) + return; + + if (m_parserPaused) { + m_pendingCallbacks->appendCDATABlockCallback(s, len); + return; + } + + exitText(); + + RefPtr<Node> newNode = CDATASection::create(m_doc, toString(s, len)); + if (!m_currentNode->addChild(newNode.get())) + return; + if (m_view && !newNode->attached()) + newNode->attach(); +} + +void XMLDocumentParser::comment(const xmlChar* s) +{ + if (m_parserStopped) + return; + + if (m_parserPaused) { + m_pendingCallbacks->appendCommentCallback(s); + return; + } + + exitText(); + + RefPtr<Node> newNode = Comment::create(m_doc, toString(s)); + m_currentNode->addChild(newNode.get()); + if (m_view && !newNode->attached()) + newNode->attach(); +} + +void XMLDocumentParser::startDocument(const xmlChar* version, const xmlChar* encoding, int standalone) +{ + ExceptionCode ec = 0; + + if (version) + m_doc->setXMLVersion(toString(version), ec); + m_doc->setXMLStandalone(standalone == 1, ec); // possible values are 0, 1, and -1 + if (encoding) + m_doc->setXMLEncoding(toString(encoding)); +} + +void XMLDocumentParser::endDocument() +{ + exitText(); +#if ENABLE(XHTMLMP) + m_hasDocTypeDeclaration = false; +#endif +} + +void XMLDocumentParser::internalSubset(const xmlChar* name, const xmlChar* externalID, const xmlChar* systemID) +{ + if (m_parserStopped) + return; + + if (m_parserPaused) { + m_pendingCallbacks->appendInternalSubsetCallback(name, externalID, systemID); + return; + } + + if (m_doc) { +#if ENABLE(WML) || ENABLE(XHTMLMP) + String extId = toString(externalID); +#endif +#if ENABLE(WML) + if (isWMLDocument() + && extId != "-//WAPFORUM//DTD WML 1.3//EN" + && extId != "-//WAPFORUM//DTD WML 1.2//EN" + && extId != "-//WAPFORUM//DTD WML 1.1//EN" + && extId != "-//WAPFORUM//DTD WML 1.0//EN") + handleError(fatal, "Invalid DTD Public ID", lineNumber(), columnNumber()); +#endif +#if ENABLE(XHTMLMP) + String dtdName = toString(name); + if (extId == "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" + || extId == "-//WAPFORUM//DTD XHTML Mobile 1.1//EN") { + if (dtdName != HTMLNames::htmlTag.localName()) { + handleError(fatal, "Invalid DOCTYPE declaration, expected 'html' as root element.", lineNumber(), columnNumber()); + return; + } + + if (m_doc->isXHTMLMPDocument()) + setIsXHTMLMPDocument(true); + else + setIsXHTMLDocument(true); + + m_hasDocTypeDeclaration = true; + } +#endif + + m_doc->addChild(DocumentType::create(m_doc, toString(name), toString(externalID), toString(systemID))); + } +} + +static inline XMLDocumentParser* getParser(void* closure) +{ + xmlParserCtxtPtr ctxt = static_cast<xmlParserCtxtPtr>(closure); + return static_cast<XMLDocumentParser*>(ctxt->_private); +} + +// This is a hack around http://bugzilla.gnome.org/show_bug.cgi?id=159219 +// Otherwise libxml seems to call all the SAX callbacks twice for any replaced entity. +static inline bool hackAroundLibXMLEntityBug(void* closure) +{ +#if LIBXML_VERSION >= 20627 + UNUSED_PARAM(closure); + + // This bug has been fixed in libxml 2.6.27. + return false; +#else + return static_cast<xmlParserCtxtPtr>(closure)->node; +#endif +} + +static void startElementNsHandler(void* closure, const xmlChar* localname, const xmlChar* prefix, const xmlChar* uri, int nb_namespaces, const xmlChar** namespaces, int nb_attributes, int nb_defaulted, const xmlChar** libxmlAttributes) +{ + if (hackAroundLibXMLEntityBug(closure)) + return; + + getParser(closure)->startElementNs(localname, prefix, uri, nb_namespaces, namespaces, nb_attributes, nb_defaulted, libxmlAttributes); +} + +static void endElementNsHandler(void* closure, const xmlChar*, const xmlChar*, const xmlChar*) +{ + if (hackAroundLibXMLEntityBug(closure)) + return; + + getParser(closure)->endElementNs(); +} + +static void charactersHandler(void* closure, const xmlChar* s, int len) +{ + if (hackAroundLibXMLEntityBug(closure)) + return; + + getParser(closure)->characters(s, len); +} + +static void processingInstructionHandler(void* closure, const xmlChar* target, const xmlChar* data) +{ + if (hackAroundLibXMLEntityBug(closure)) + return; + + getParser(closure)->processingInstruction(target, data); +} + +static void cdataBlockHandler(void* closure, const xmlChar* s, int len) +{ + if (hackAroundLibXMLEntityBug(closure)) + return; + + getParser(closure)->cdataBlock(s, len); +} + +static void commentHandler(void* closure, const xmlChar* comment) +{ + if (hackAroundLibXMLEntityBug(closure)) + return; + + getParser(closure)->comment(comment); +} + +WTF_ATTRIBUTE_PRINTF(2, 3) +static void warningHandler(void* closure, const char* message, ...) +{ + va_list args; + va_start(args, message); + getParser(closure)->error(XMLDocumentParser::warning, message, args); + va_end(args); +} + +WTF_ATTRIBUTE_PRINTF(2, 3) +static void fatalErrorHandler(void* closure, const char* message, ...) +{ + va_list args; + va_start(args, message); + getParser(closure)->error(XMLDocumentParser::fatal, message, args); + va_end(args); +} + +WTF_ATTRIBUTE_PRINTF(2, 3) +static void normalErrorHandler(void* closure, const char* message, ...) +{ + va_list args; + va_start(args, message); + getParser(closure)->error(XMLDocumentParser::nonFatal, message, args); + va_end(args); +} + +// Using a static entity and marking it XML_INTERNAL_PREDEFINED_ENTITY is +// a hack to avoid malloc/free. Using a global variable like this could cause trouble +// if libxml implementation details were to change +static xmlChar sharedXHTMLEntityResult[5] = {0, 0, 0, 0, 0}; + +static xmlEntityPtr sharedXHTMLEntity() +{ + static xmlEntity entity; + if (!entity.type) { + entity.type = XML_ENTITY_DECL; + entity.orig = sharedXHTMLEntityResult; + entity.content = sharedXHTMLEntityResult; + entity.etype = XML_INTERNAL_PREDEFINED_ENTITY; + } + return &entity; +} + +static xmlEntityPtr getXHTMLEntity(const xmlChar* name) +{ + UChar c = decodeNamedEntity(reinterpret_cast<const char*>(name)); + if (!c) + return 0; + + CString value = String(&c, 1).utf8(); + ASSERT(value.length() < 5); + xmlEntityPtr entity = sharedXHTMLEntity(); + entity->length = value.length(); + entity->name = name; + memcpy(sharedXHTMLEntityResult, value.data(), entity->length + 1); + + return entity; +} + +static xmlEntityPtr getEntityHandler(void* closure, const xmlChar* name) +{ + xmlParserCtxtPtr ctxt = static_cast<xmlParserCtxtPtr>(closure); + xmlEntityPtr ent = xmlGetPredefinedEntity(name); + if (ent) { + ent->etype = XML_INTERNAL_PREDEFINED_ENTITY; + return ent; + } + + ent = xmlGetDocEntity(ctxt->myDoc, name); + if (!ent && (getParser(closure)->isXHTMLDocument() +#if ENABLE(XHTMLMP) + || getParser(closure)->isXHTMLMPDocument() +#endif +#if ENABLE(WML) + || getParser(closure)->isWMLDocument() +#endif + )) { + ent = getXHTMLEntity(name); + if (ent) + ent->etype = XML_INTERNAL_GENERAL_ENTITY; + } + + return ent; +} + +static void startDocumentHandler(void* closure) +{ + xmlParserCtxt* ctxt = static_cast<xmlParserCtxt*>(closure); + getParser(closure)->startDocument(ctxt->version, ctxt->encoding, ctxt->standalone); + xmlSAX2StartDocument(closure); +} + +static void endDocumentHandler(void* closure) +{ + getParser(closure)->endDocument(); + xmlSAX2EndDocument(closure); +} + +static void internalSubsetHandler(void* closure, const xmlChar* name, const xmlChar* externalID, const xmlChar* systemID) +{ + getParser(closure)->internalSubset(name, externalID, systemID); + xmlSAX2InternalSubset(closure, name, externalID, systemID); +} + +static void externalSubsetHandler(void* closure, const xmlChar*, const xmlChar* externalId, const xmlChar*) +{ + String extId = toString(externalId); + if ((extId == "-//W3C//DTD XHTML 1.0 Transitional//EN") + || (extId == "-//W3C//DTD XHTML 1.1//EN") + || (extId == "-//W3C//DTD XHTML 1.0 Strict//EN") + || (extId == "-//W3C//DTD XHTML 1.0 Frameset//EN") + || (extId == "-//W3C//DTD XHTML Basic 1.0//EN") + || (extId == "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN") + || (extId == "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN") + || (extId == "-//WAPFORUM//DTD XHTML Mobile 1.0//EN") + ) + getParser(closure)->setIsXHTMLDocument(true); // controls if we replace entities or not. +} + +static void ignorableWhitespaceHandler(void*, const xmlChar*, int) +{ + // nothing to do, but we need this to work around a crasher + // http://bugzilla.gnome.org/show_bug.cgi?id=172255 + // http://bugs.webkit.org/show_bug.cgi?id=5792 +} + +void XMLDocumentParser::initializeParserContext(const char* chunk) +{ + xmlSAXHandler sax; + memset(&sax, 0, sizeof(sax)); + + sax.error = normalErrorHandler; + sax.fatalError = fatalErrorHandler; + sax.characters = charactersHandler; + sax.processingInstruction = processingInstructionHandler; + sax.cdataBlock = cdataBlockHandler; + sax.comment = commentHandler; + sax.warning = warningHandler; + sax.startElementNs = startElementNsHandler; + sax.endElementNs = endElementNsHandler; + sax.getEntity = getEntityHandler; + sax.startDocument = startDocumentHandler; + sax.endDocument = endDocumentHandler; + sax.internalSubset = internalSubsetHandler; + sax.externalSubset = externalSubsetHandler; + sax.ignorableWhitespace = ignorableWhitespaceHandler; + sax.entityDecl = xmlSAX2EntityDecl; + sax.initialized = XML_SAX2_MAGIC; + m_parserStopped = false; + m_sawError = false; + m_sawXSLTransform = false; + m_sawFirstElement = false; + + XMLDocumentParserScope scope(m_doc->docLoader()); + if (m_parsingFragment) + m_context = XMLParserContext::createMemoryParser(&sax, this, chunk); + else + m_context = XMLParserContext::createStringParser(&sax, this); +} + +void XMLDocumentParser::doEnd() +{ +#if ENABLE(XSLT) + if (m_sawXSLTransform) { + void* doc = xmlDocPtrForString(m_doc->docLoader(), m_originalSourceForTransform, m_doc->url().string()); + m_doc->setTransformSource(new TransformSource(doc)); + + m_doc->setParsing(false); // Make the doc think it's done, so it will apply xsl sheets. + m_doc->updateStyleSelector(); + m_doc->setParsing(true); + m_parserStopped = true; + } +#endif + + if (m_parserStopped) + return; + + if (m_context) { + // Tell libxml we're done. + { + XMLDocumentParserScope scope(m_doc->docLoader()); + xmlParseChunk(context(), 0, 0, 1); + } + + m_context = 0; + } +} + +#if ENABLE(XSLT) +void* xmlDocPtrForString(DocLoader* docLoader, const String& source, const String& url) +{ + if (source.isEmpty()) + return 0; + + // Parse in a single chunk into an xmlDocPtr + // FIXME: Hook up error handlers so that a failure to parse the main document results in + // good error messages. + const UChar BOM = 0xFEFF; + const unsigned char BOMHighByte = *reinterpret_cast<const unsigned char*>(&BOM); + + XMLDocumentParserScope scope(docLoader, errorFunc, 0); + xmlDocPtr sourceDoc = xmlReadMemory(reinterpret_cast<const char*>(source.characters()), + source.length() * sizeof(UChar), + url.latin1().data(), + BOMHighByte == 0xFF ? "UTF-16LE" : "UTF-16BE", + XSLT_PARSE_OPTIONS); + return sourceDoc; +} +#endif + +int XMLDocumentParser::lineNumber() const +{ + return context() ? context()->input->line : 1; +} + +int XMLDocumentParser::columnNumber() const +{ + return context() ? context()->input->col : 1; +} + +void XMLDocumentParser::stopParsing() +{ + DocumentParser::stopParsing(); + if (context()) + xmlStopParser(context()); +} + +void XMLDocumentParser::resumeParsing() +{ + ASSERT(m_parserPaused); + + m_parserPaused = false; + + // First, execute any pending callbacks + while (!m_pendingCallbacks->isEmpty()) { + m_pendingCallbacks->callAndRemoveFirstCallback(this); + + // A callback paused the parser + if (m_parserPaused) + return; + } + + // Then, write any pending data + SegmentedString rest = m_pendingSrc; + m_pendingSrc.clear(); + write(rest, false); + + // Finally, if finish() has been called and write() didn't result + // in any further callbacks being queued, call end() + if (m_finishCalled && m_pendingCallbacks->isEmpty()) + end(); +} + +bool parseXMLDocumentFragment(const String& chunk, DocumentFragment* fragment, Element* parent, FragmentScriptingPermission scriptingPermission) +{ + if (!chunk.length()) + return true; + + XMLDocumentParser parser(fragment, parent, scriptingPermission); + + CString chunkAsUtf8 = chunk.utf8(); + parser.initializeParserContext(chunkAsUtf8.data()); + + xmlParseContent(parser.context()); + + parser.endDocument(); + + // Check if all the chunk has been processed. + long bytesProcessed = xmlByteConsumed(parser.context()); + if (bytesProcessed == -1 || ((unsigned long)bytesProcessed) != chunkAsUtf8.length()) + return false; + + // No error if the chunk is well formed or it is not but we have no error. + return parser.context()->wellFormed || xmlCtxtGetLastError(parser.context()) == 0; +} + +// -------------------------------- + +struct AttributeParseState { + HashMap<String, String> attributes; + bool gotAttributes; +}; + +static void attributesStartElementNsHandler(void* closure, const xmlChar* xmlLocalName, const xmlChar* /*xmlPrefix*/, + const xmlChar* /*xmlURI*/, int /*nb_namespaces*/, const xmlChar** /*namespaces*/, + int nb_attributes, int /*nb_defaulted*/, const xmlChar** libxmlAttributes) +{ + if (strcmp(reinterpret_cast<const char*>(xmlLocalName), "attrs") != 0) + return; + + xmlParserCtxtPtr ctxt = static_cast<xmlParserCtxtPtr>(closure); + AttributeParseState* state = static_cast<AttributeParseState*>(ctxt->_private); + + state->gotAttributes = true; + + xmlSAX2Attributes* attributes = reinterpret_cast<xmlSAX2Attributes*>(libxmlAttributes); + for (int i = 0; i < nb_attributes; i++) { + String attrLocalName = toString(attributes[i].localname); + int valueLength = (int) (attributes[i].end - attributes[i].value); + String attrValue = toString(attributes[i].value, valueLength); + String attrPrefix = toString(attributes[i].prefix); + String attrQName = attrPrefix.isEmpty() ? attrLocalName : attrPrefix + ":" + attrLocalName; + + state->attributes.set(attrQName, attrValue); + } +} + +HashMap<String, String> parseAttributes(const String& string, bool& attrsOK) +{ + AttributeParseState state; + state.gotAttributes = false; + + xmlSAXHandler sax; + memset(&sax, 0, sizeof(sax)); + sax.startElementNs = attributesStartElementNsHandler; + sax.initialized = XML_SAX2_MAGIC; + RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state); + String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; + xmlParseChunk(parser->context(), reinterpret_cast<const char*>(parseString.characters()), parseString.length() * sizeof(UChar), 1); + attrsOK = state.gotAttributes; + return state.attributes; +} + +} diff --git a/WebCore/dom/XMLDocumentParserQt.cpp b/WebCore/dom/XMLDocumentParserQt.cpp new file mode 100644 index 0000000..89f542f --- /dev/null +++ b/WebCore/dom/XMLDocumentParserQt.cpp @@ -0,0 +1,717 @@ +/* + * Copyright (C) 2000 Peter Kelly (pmk@post.com) + * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) + * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2008 Holger Hans Peter Freyther + * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) + * + * 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 "XMLDocumentParser.h" + +#include "CDATASection.h" +#include "CachedScript.h" +#include "Comment.h" +#include "DocLoader.h" +#include "Document.h" +#include "DocumentFragment.h" +#include "DocumentType.h" +#include "Frame.h" +#include "FrameLoader.h" +#include "FrameView.h" +#include "HTMLLinkElement.h" +#include "HTMLStyleElement.h" +#include "HTMLDocumentParser.h" +#include "ProcessingInstruction.h" +#include "ResourceError.h" +#include "ResourceHandle.h" +#include "ResourceRequest.h" +#include "ResourceResponse.h" +#include "ScriptController.h" +#include "ScriptElement.h" +#include "ScriptSourceCode.h" +#include "ScriptValue.h" +#include "TextResourceDecoder.h" +#include "TransformSource.h" +#include <QDebug> +#include <wtf/StringExtras.h> +#include <wtf/Threading.h> +#include <wtf/Vector.h> +#include <wtf/text/CString.h> + +#if ENABLE(XHTMLMP) +#include "HTMLNames.h" +#include "HTMLScriptElement.h" +#endif + +using namespace std; + +namespace WebCore { + +class EntityResolver : public QXmlStreamEntityResolver { + virtual QString resolveUndeclaredEntity(const QString &name); +}; + +QString EntityResolver::resolveUndeclaredEntity(const QString &name) +{ + UChar c = decodeNamedEntity(name.toUtf8().constData()); + return QString(c); +} + +// -------------------------------- + +XMLDocumentParser::XMLDocumentParser(Document* _doc, FrameView* _view) + : m_doc(_doc) + , m_view(_view) + , m_wroteText(false) + , m_currentNode(_doc) + , m_sawError(false) + , m_sawXSLTransform(false) + , m_sawFirstElement(false) + , m_isXHTMLDocument(false) +#if ENABLE(XHTMLMP) + , m_isXHTMLMPDocument(false) + , m_hasDocTypeDeclaration(false) +#endif + , m_parserPaused(false) + , m_requestingScript(false) + , m_finishCalled(false) + , m_errorCount(0) + , m_lastErrorLine(0) + , m_lastErrorColumn(0) + , m_pendingScript(0) + , m_scriptStartLine(0) + , m_parsingFragment(false) + , m_scriptingPermission(FragmentScriptingAllowed) +{ + m_stream.setEntityResolver(new EntityResolver); +} + +XMLDocumentParser::XMLDocumentParser(DocumentFragment* fragment, Element* parentElement, FragmentScriptingPermission permission) + : m_doc(fragment->document()) + , m_view(0) + , m_wroteText(false) + , m_currentNode(fragment) + , m_sawError(false) + , m_sawXSLTransform(false) + , m_sawFirstElement(false) + , m_isXHTMLDocument(false) +#if ENABLE(XHTMLMP) + , m_isXHTMLMPDocument(false) + , m_hasDocTypeDeclaration(false) +#endif + , m_parserPaused(false) + , m_requestingScript(false) + , m_finishCalled(false) + , m_errorCount(0) + , m_lastErrorLine(0) + , m_lastErrorColumn(0) + , m_pendingScript(0) + , m_scriptStartLine(0) + , m_parsingFragment(true) + , m_scriptingPermission(permission) +{ + fragment->ref(); + if (m_doc) + m_doc->ref(); + + // Add namespaces based on the parent node + Vector<Element*> elemStack; + while (parentElement) { + elemStack.append(parentElement); + + Node* n = parentElement->parentNode(); + if (!n || !n->isElementNode()) + break; + parentElement = static_cast<Element*>(n); + } + + if (elemStack.isEmpty()) + return; + + QXmlStreamNamespaceDeclarations namespaces; + for (Element* element = elemStack.last(); !elemStack.isEmpty(); elemStack.removeLast()) { + if (NamedNodeMap* attrs = element->attributes()) { + for (unsigned i = 0; i < attrs->length(); i++) { + Attribute* attr = attrs->attributeItem(i); + if (attr->localName() == "xmlns") + m_defaultNamespaceURI = attr->value(); + else if (attr->prefix() == "xmlns") + namespaces.append(QXmlStreamNamespaceDeclaration(attr->localName(), attr->value())); + } + } + } + m_stream.addExtraNamespaceDeclarations(namespaces); + m_stream.setEntityResolver(new EntityResolver); + + // If the parent element is not in document tree, there may be no xmlns attribute; just default to the parent's namespace. + if (m_defaultNamespaceURI.isNull() && !parentElement->inDocument()) + m_defaultNamespaceURI = parentElement->namespaceURI(); +} + +XMLDocumentParser::~XMLDocumentParser() +{ + clearCurrentNodeStack(); + if (m_parsingFragment && m_doc) + m_doc->deref(); + if (m_pendingScript) + m_pendingScript->removeClient(this); + delete m_stream.entityResolver(); +} + +void XMLDocumentParser::doWrite(const String& parseString) +{ + m_wroteText = true; + + if (m_doc->decoder() && m_doc->decoder()->sawError()) { + // If the decoder saw an error, report it as fatal (stops parsing) + handleError(fatal, "Encoding error", lineNumber(), columnNumber()); + return; + } + + QString data(parseString); + if (!data.isEmpty()) { + m_stream.addData(data); + parse(); + } + + return; +} + +void XMLDocumentParser::initializeParserContext(const char*) +{ + m_parserStopped = false; + m_sawError = false; + m_sawXSLTransform = false; + m_sawFirstElement = false; +} + +void XMLDocumentParser::doEnd() +{ +#if ENABLE(XSLT) + if (m_sawXSLTransform) { + m_doc->setTransformSource(new TransformSource(m_originalSourceForTransform)); + m_doc->setParsing(false); // Make the doc think it's done, so it will apply xsl sheets. + m_doc->updateStyleSelector(); + m_doc->setParsing(true); + m_parserStopped = true; + } +#endif + + if (m_stream.error() == QXmlStreamReader::PrematureEndOfDocumentError + || (m_wroteText && !m_sawFirstElement && !m_sawXSLTransform && !m_sawError)) + handleError(fatal, qPrintable(m_stream.errorString()), lineNumber(), columnNumber()); +} + +int XMLDocumentParser::lineNumber() const +{ + return m_stream.lineNumber(); +} + +int XMLDocumentParser::columnNumber() const +{ + return m_stream.columnNumber(); +} + +void XMLDocumentParser::stopParsing() +{ + DocumentParser::stopParsing(); +} + +void XMLDocumentParser::resumeParsing() +{ + ASSERT(m_parserPaused); + + m_parserPaused = false; + + // First, execute any pending callbacks + parse(); + if (m_parserPaused) + return; + + // Then, write any pending data + SegmentedString rest = m_pendingSrc; + m_pendingSrc.clear(); + write(rest, false); + + // Finally, if finish() has been called and write() didn't result + // in any further callbacks being queued, call end() + if (m_finishCalled && !m_parserPaused && !m_pendingScript) + end(); +} + +bool parseXMLDocumentFragment(const String& chunk, DocumentFragment* fragment, Element* parent, FragmentScriptingPermission scriptingPermission) +{ + if (!chunk.length()) + return true; + + XMLDocumentParser parser(fragment, parent, scriptingPermission); + + parser.write(String("<qxmlstreamdummyelement>"), false); + parser.write(chunk, false); + parser.write(String("</qxmlstreamdummyelement>"), false); + parser.finish(); + return !parser.hasError(); +} + +// -------------------------------- + +struct AttributeParseState { + HashMap<String, String> attributes; + bool gotAttributes; +}; + +static void attributesStartElementNsHandler(AttributeParseState* state, const QXmlStreamAttributes& attrs) +{ + if (attrs.count() <= 0) + return; + + state->gotAttributes = true; + + for (int i = 0; i < attrs.count(); i++) { + const QXmlStreamAttribute& attr = attrs[i]; + String attrLocalName = attr.name(); + String attrValue = attr.value(); + String attrURI = attr.namespaceUri(); + String attrQName = attr.qualifiedName(); + state->attributes.set(attrQName, attrValue); + } +} + +HashMap<String, String> parseAttributes(const String& string, bool& attrsOK) +{ + AttributeParseState state; + state.gotAttributes = false; + + QXmlStreamReader stream; + QString dummy = QString(QLatin1String("<?xml version=\"1.0\"?><attrs %1 />")).arg(string); + stream.addData(dummy); + while (!stream.atEnd()) { + stream.readNext(); + if (stream.isStartElement()) { + attributesStartElementNsHandler(&state, stream.attributes()); + } + } + attrsOK = state.gotAttributes; + return state.attributes; +} + +static inline String prefixFromQName(const QString& qName) +{ + const int offset = qName.indexOf(QLatin1Char(':')); + if (offset <= 0) + return String(); + else + return qName.left(offset); +} + +static inline void handleElementNamespaces(Element* newElement, const QXmlStreamNamespaceDeclarations &ns, + ExceptionCode& ec, FragmentScriptingPermission scriptingPermission) +{ + for (int i = 0; i < ns.count(); ++i) { + const QXmlStreamNamespaceDeclaration &decl = ns[i]; + String namespaceURI = decl.namespaceUri(); + String namespaceQName = decl.prefix().isEmpty() ? String("xmlns") : String("xmlns:") + String(decl.prefix()); + newElement->setAttributeNS("http://www.w3.org/2000/xmlns/", namespaceQName, namespaceURI, ec, scriptingPermission); + if (ec) // exception setting attributes + return; + } +} + +static inline void handleElementAttributes(Element* newElement, const QXmlStreamAttributes &attrs, ExceptionCode& ec, + FragmentScriptingPermission scriptingPermission) +{ + for (int i = 0; i < attrs.count(); ++i) { + const QXmlStreamAttribute &attr = attrs[i]; + String attrLocalName = attr.name(); + String attrValue = attr.value(); + String attrURI = attr.namespaceUri().isEmpty() ? String() : String(attr.namespaceUri()); + String attrQName = attr.qualifiedName(); + newElement->setAttributeNS(attrURI, attrQName, attrValue, ec, scriptingPermission); + if (ec) // exception setting attributes + return; + } +} + +void XMLDocumentParser::parse() +{ + while (!m_parserStopped && !m_parserPaused && !m_stream.atEnd()) { + m_stream.readNext(); + switch (m_stream.tokenType()) { + case QXmlStreamReader::StartDocument: { + startDocument(); + } + break; + case QXmlStreamReader::EndDocument: { + endDocument(); + } + break; + case QXmlStreamReader::StartElement: { +#if ENABLE(XHTMLMP) + if (m_doc->isXHTMLMPDocument() && !m_hasDocTypeDeclaration) { + handleError(fatal, "DOCTYPE declaration lost.", lineNumber(), columnNumber()); + break; + } +#endif + parseStartElement(); + } + break; + case QXmlStreamReader::EndElement: { + parseEndElement(); + } + break; + case QXmlStreamReader::Characters: { + if (m_stream.isCDATA()) { + //cdata + parseCdata(); + } else { + //characters + parseCharacters(); + } + } + break; + case QXmlStreamReader::Comment: { + parseComment(); + } + break; + case QXmlStreamReader::DTD: { + //qDebug()<<"------------- DTD"; + parseDtd(); +#if ENABLE(XHTMLMP) + m_hasDocTypeDeclaration = true; +#endif + } + break; + case QXmlStreamReader::EntityReference: { + //qDebug()<<"---------- ENTITY = "<<m_stream.name().toString() + // <<", t = "<<m_stream.text().toString(); + if (isXHTMLDocument() +#if ENABLE(XHTMLMP) + || isXHTMLMPDocument() +#endif +#if ENABLE(WML) + || isWMLDocument() +#endif + ) { + QString entity = m_stream.name().toString(); + UChar c = decodeNamedEntity(entity.toUtf8().constData()); + if (m_currentNode->isTextNode() || enterText()) { + ExceptionCode ec = 0; + String str(&c, 1); + //qDebug()<<" ------- adding entity "<<str; + static_cast<Text*>(m_currentNode)->appendData(str, ec); + } + } + } + break; + case QXmlStreamReader::ProcessingInstruction: { + parseProcessingInstruction(); + } + break; + default: { + if (m_stream.error() != QXmlStreamReader::PrematureEndOfDocumentError) { + ErrorType type = (m_stream.error() == QXmlStreamReader::NotWellFormedError) ? + fatal : warning; + handleError(type, qPrintable(m_stream.errorString()), lineNumber(), + columnNumber()); + } + } + break; + } + } +} + +void XMLDocumentParser::startDocument() +{ + initializeParserContext(); + ExceptionCode ec = 0; + + if (!m_parsingFragment) { + m_doc->setXMLStandalone(m_stream.isStandaloneDocument(), ec); + + QStringRef version = m_stream.documentVersion(); + if (!version.isEmpty()) + m_doc->setXMLVersion(version, ec); + QStringRef encoding = m_stream.documentEncoding(); + if (!encoding.isEmpty()) + m_doc->setXMLEncoding(encoding); + } +} + +void XMLDocumentParser::parseStartElement() +{ + if (!m_sawFirstElement && m_parsingFragment) { + // skip dummy element for fragments + m_sawFirstElement = true; + return; + } + + exitText(); + + String localName = m_stream.name(); + String uri = m_stream.namespaceUri(); + String prefix = prefixFromQName(m_stream.qualifiedName().toString()); + + if (m_parsingFragment && uri.isNull()) { + Q_ASSERT(prefix.isNull()); + uri = m_defaultNamespaceURI; + } + + QualifiedName qName(prefix, localName, uri); + RefPtr<Element> newElement = m_doc->createElement(qName, true); + if (!newElement) { + stopParsing(); + return; + } + +#if ENABLE(XHTMLMP) + if (!m_sawFirstElement && isXHTMLMPDocument()) { + // As per 7.1 section of OMA-WAP-XHTMLMP-V1_1-20061020-A.pdf, + // we should make sure that the root element MUST be 'html' and + // ensure the name of the default namespace on the root elment 'html' + // MUST be 'http://www.w3.org/1999/xhtml' + if (localName != HTMLNames::htmlTag.localName()) { + handleError(fatal, "XHTMLMP document expects 'html' as root element.", lineNumber(), columnNumber()); + return; + } + + if (uri.isNull()) { + m_defaultNamespaceURI = HTMLNames::xhtmlNamespaceURI; + uri = m_defaultNamespaceURI; + m_stream.addExtraNamespaceDeclaration(QXmlStreamNamespaceDeclaration(prefix, HTMLNames::xhtmlNamespaceURI)); + } + } +#endif + + bool isFirstElement = !m_sawFirstElement; + m_sawFirstElement = true; + + ExceptionCode ec = 0; + handleElementNamespaces(newElement.get(), m_stream.namespaceDeclarations(), ec, m_scriptingPermission); + if (ec) { + stopParsing(); + return; + } + + handleElementAttributes(newElement.get(), m_stream.attributes(), ec, m_scriptingPermission); + if (ec) { + stopParsing(); + return; + } + + ScriptElement* scriptElement = toScriptElement(newElement.get()); + if (scriptElement) + m_scriptStartLine = lineNumber(); + + if (!m_currentNode->addChild(newElement.get())) { + stopParsing(); + return; + } + + pushCurrentNode(newElement.get()); + if (m_view && !newElement->attached()) + newElement->attach(); + + if (isFirstElement && m_doc->frame()) + m_doc->frame()->loader()->dispatchDocumentElementAvailable(); +} + +void XMLDocumentParser::parseEndElement() +{ + exitText(); + + Node* n = m_currentNode; + n->finishParsingChildren(); + + if (m_scriptingPermission == FragmentScriptingNotAllowed && n->isElementNode() && toScriptElement(static_cast<Element*>(n))) { + popCurrentNode(); + ExceptionCode ec; + n->remove(ec); + return; + } + + if (!n->isElementNode() || !m_view) { + if (!m_currentNodeStack.isEmpty()) + popCurrentNode(); + return; + } + + Element* element = static_cast<Element*>(n); + + // The element's parent may have already been removed from document. + // Parsing continues in this case, but scripts aren't executed. + if (!element->inDocument()) { + popCurrentNode(); + return; + } + + ScriptElement* scriptElement = toScriptElement(element); + if (!scriptElement) { + popCurrentNode(); + return; + } + + // don't load external scripts for standalone documents (for now) + ASSERT(!m_pendingScript); + m_requestingScript = true; + +#if ENABLE(XHTMLMP) + if (!scriptElement->shouldExecuteAsJavaScript()) + m_doc->setShouldProcessNoscriptElement(true); + else +#endif + { + String scriptHref = scriptElement->sourceAttributeValue(); + if (!scriptHref.isEmpty()) { + // we have a src attribute + String scriptCharset = scriptElement->scriptCharset(); + if (element->dispatchBeforeLoadEvent(scriptHref) && + (m_pendingScript = m_doc->docLoader()->requestScript(scriptHref, scriptCharset))) { + m_scriptElement = element; + m_pendingScript->addClient(this); + + // m_pendingScript will be 0 if script was already loaded and ref() executed it + if (m_pendingScript) + pauseParsing(); + } else + m_scriptElement = 0; + } else + m_view->frame()->script()->executeScript(ScriptSourceCode(scriptElement->scriptContent(), m_doc->url(), m_scriptStartLine)); + } + m_requestingScript = false; + popCurrentNode(); +} + +void XMLDocumentParser::parseCharacters() +{ + if (m_currentNode->isTextNode() || enterText()) { + ExceptionCode ec = 0; + static_cast<Text*>(m_currentNode)->appendData(m_stream.text(), ec); + } +} + +void XMLDocumentParser::parseProcessingInstruction() +{ + exitText(); + + // ### handle exceptions + int exception = 0; + RefPtr<ProcessingInstruction> pi = m_doc->createProcessingInstruction( + m_stream.processingInstructionTarget(), + m_stream.processingInstructionData(), exception); + if (exception) + return; + + pi->setCreatedByParser(true); + + if (!m_currentNode->addChild(pi.get())) + return; + if (m_view && !pi->attached()) + pi->attach(); + + pi->finishParsingChildren(); + +#if ENABLE(XSLT) + m_sawXSLTransform = !m_sawFirstElement && pi->isXSL(); + if (m_sawXSLTransform && !m_doc->transformSourceDocument()) + stopParsing(); +#endif +} + +void XMLDocumentParser::parseCdata() +{ + exitText(); + + RefPtr<Node> newNode = CDATASection::create(m_doc, m_stream.text()); + if (!m_currentNode->addChild(newNode.get())) + return; + if (m_view && !newNode->attached()) + newNode->attach(); +} + +void XMLDocumentParser::parseComment() +{ + exitText(); + + RefPtr<Node> newNode = Comment::create(m_doc, m_stream.text()); + m_currentNode->addChild(newNode.get()); + if (m_view && !newNode->attached()) + newNode->attach(); +} + +void XMLDocumentParser::endDocument() +{ +#if ENABLE(XHTMLMP) + m_hasDocTypeDeclaration = false; +#endif +} + +bool XMLDocumentParser::hasError() const +{ + return m_stream.hasError(); +} + +void XMLDocumentParser::parseDtd() +{ + QStringRef name = m_stream.dtdName(); + QStringRef publicId = m_stream.dtdPublicId(); + QStringRef systemId = m_stream.dtdSystemId(); + + //qDebug() << dtd << name << publicId << systemId; + if ((publicId == QLatin1String("-//W3C//DTD XHTML 1.0 Transitional//EN")) + || (publicId == QLatin1String("-//W3C//DTD XHTML 1.1//EN")) + || (publicId == QLatin1String("-//W3C//DTD XHTML 1.0 Strict//EN")) + || (publicId == QLatin1String("-//W3C//DTD XHTML 1.0 Frameset//EN")) + || (publicId == QLatin1String("-//W3C//DTD XHTML Basic 1.0//EN")) + || (publicId == QLatin1String("-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN")) + || (publicId == QLatin1String("-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN")) +#if !ENABLE(XHTMLMP) + || (publicId == QLatin1String("-//WAPFORUM//DTD XHTML Mobile 1.0//EN")) +#endif + ) + setIsXHTMLDocument(true); // controls if we replace entities or not. +#if ENABLE(XHTMLMP) + else if ((publicId == QLatin1String("-//WAPFORUM//DTD XHTML Mobile 1.1//EN")) + || (publicId == QLatin1String("-//WAPFORUM//DTD XHTML Mobile 1.0//EN"))) { + if (AtomicString(name) != HTMLNames::htmlTag.localName()) { + handleError(fatal, "Invalid DOCTYPE declaration, expected 'html' as root element.", lineNumber(), columnNumber()); + return; + } + + if (m_doc->isXHTMLMPDocument()) // check if the MIME type is correct with this method + setIsXHTMLMPDocument(true); + else + setIsXHTMLDocument(true); + } +#endif +#if ENABLE(WML) + else if (m_doc->isWMLDocument() + && publicId != QLatin1String("-//WAPFORUM//DTD WML 1.3//EN") + && publicId != QLatin1String("-//WAPFORUM//DTD WML 1.2//EN") + && publicId != QLatin1String("-//WAPFORUM//DTD WML 1.1//EN") + && publicId != QLatin1String("-//WAPFORUM//DTD WML 1.0//EN")) + handleError(fatal, "Invalid DTD Public ID", lineNumber(), columnNumber()); +#endif + if (!m_parsingFragment) + m_doc->addChild(DocumentType::create(m_doc, name, publicId, systemId)); + +} +} + diff --git a/WebCore/dom/XMLDocumentParserScope.cpp b/WebCore/dom/XMLDocumentParserScope.cpp new file mode 100644 index 0000000..8afe49d --- /dev/null +++ b/WebCore/dom/XMLDocumentParserScope.cpp @@ -0,0 +1,68 @@ +/* + * 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. + */ + +#include "config.h" +#include "XMLDocumentParserScope.h" + +namespace WebCore { + +DocLoader* XMLDocumentParserScope::currentDocLoader = 0; + +XMLDocumentParserScope::XMLDocumentParserScope(DocLoader* docLoader) + : m_oldDocLoader(currentDocLoader) +#if ENABLE(XSLT) + , m_oldGenericErrorFunc(xmlGenericError) + , m_oldStructuredErrorFunc(xmlStructuredError) + , m_oldErrorContext(xmlGenericErrorContext) +#endif +{ + currentDocLoader = docLoader; +} + +#if ENABLE(XSLT) +XMLDocumentParserScope::XMLDocumentParserScope(DocLoader* docLoader, xmlGenericErrorFunc genericErrorFunc, xmlStructuredErrorFunc structuredErrorFunc, void* errorContext) + : m_oldDocLoader(currentDocLoader) + , m_oldGenericErrorFunc(xmlGenericError) + , m_oldStructuredErrorFunc(xmlStructuredError) + , m_oldErrorContext(xmlGenericErrorContext) +{ + currentDocLoader = docLoader; + if (genericErrorFunc) + xmlSetGenericErrorFunc(errorContext, genericErrorFunc); + if (structuredErrorFunc) + xmlSetStructuredErrorFunc(errorContext, structuredErrorFunc); +} +#endif + +XMLDocumentParserScope::~XMLDocumentParserScope() +{ + currentDocLoader = m_oldDocLoader; +#if ENABLE(XSLT) + xmlSetGenericErrorFunc(m_oldErrorContext, m_oldGenericErrorFunc); + xmlSetStructuredErrorFunc(m_oldErrorContext, m_oldStructuredErrorFunc); +#endif +} + +} diff --git a/WebCore/dom/XMLDocumentParserScope.h b/WebCore/dom/XMLDocumentParserScope.h new file mode 100644 index 0000000..89740d2 --- /dev/null +++ b/WebCore/dom/XMLDocumentParserScope.h @@ -0,0 +1,62 @@ +/* + * 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 XMLTokenizerScope_h +#define XMLTokenizerScope_h + +#include <wtf/Noncopyable.h> + +#if ENABLE(XSLT) +#include <libxml/tree.h> +#endif + +namespace WebCore { + + class DocLoader; + + class XMLDocumentParserScope : public Noncopyable { + public: + XMLDocumentParserScope(DocLoader* docLoader); + ~XMLDocumentParserScope(); + + static DocLoader* currentDocLoader; + +#if ENABLE(XSLT) + XMLDocumentParserScope(DocLoader* docLoader, xmlGenericErrorFunc genericErrorFunc, xmlStructuredErrorFunc structuredErrorFunc = 0, void* errorContext = 0); +#endif + + private: + DocLoader* m_oldDocLoader; + +#if ENABLE(XSLT) + xmlGenericErrorFunc m_oldGenericErrorFunc; + xmlStructuredErrorFunc m_oldStructuredErrorFunc; + void* m_oldErrorContext; +#endif + }; + +} // namespace WebCore + +#endif // XMLTokenizerScope_h diff --git a/WebCore/dom/XMLTokenizer.cpp b/WebCore/dom/XMLTokenizer.cpp deleted file mode 100644 index 1d98dfe..0000000 --- a/WebCore/dom/XMLTokenizer.cpp +++ /dev/null @@ -1,356 +0,0 @@ -/* - * Copyright (C) 2000 Peter Kelly (pmk@post.com) - * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. - * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) - * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) - * Copyright (C) 2008 Holger Hans Peter Freyther - * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) - * - * 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 "XMLTokenizer.h" - -#include "CDATASection.h" -#include "CachedScript.h" -#include "Comment.h" -#include "DocLoader.h" -#include "Document.h" -#include "DocumentFragment.h" -#include "DocumentType.h" -#include "Frame.h" -#include "FrameLoader.h" -#include "FrameView.h" -#include "HTMLLinkElement.h" -#include "HTMLNames.h" -#include "HTMLStyleElement.h" -#include "ImageLoader.h" -#include "ProcessingInstruction.h" -#include "ResourceError.h" -#include "ResourceHandle.h" -#include "ResourceRequest.h" -#include "ResourceResponse.h" -#include "ScriptController.h" -#include "ScriptElement.h" -#include "ScriptSourceCode.h" -#include "ScriptValue.h" -#include "TextResourceDecoder.h" -#include "TreeDepthLimit.h" -#include <wtf/text/CString.h> -#include <wtf/StringExtras.h> -#include <wtf/Threading.h> -#include <wtf/Vector.h> - -#if ENABLE(SVG) -#include "SVGNames.h" -#include "SVGStyleElement.h" -#endif - -using namespace std; - -namespace WebCore { - -using namespace HTMLNames; - -const int maxErrors = 25; - -#if ENABLE(WML) -bool XMLTokenizer::isWMLDocument() const -{ - if (m_doc) - return m_doc->isWMLDocument(); - - return false; -} -#endif - -void XMLTokenizer::pushCurrentNode(Node* n) -{ - ASSERT(n); - ASSERT(m_currentNode); - if (n != m_doc) - n->ref(); - m_currentNodeStack.append(m_currentNode); - m_currentNode = n; - if (m_currentNodeStack.size() > maxDOMTreeDepth) - handleError(fatal, "Excessive node nesting.", lineNumber(), columnNumber()); -} - -void XMLTokenizer::popCurrentNode() -{ - if (!m_currentNode) - return; - ASSERT(m_currentNodeStack.size()); - - if (m_currentNode != m_doc) - m_currentNode->deref(); - - m_currentNode = m_currentNodeStack.last(); - m_currentNodeStack.removeLast(); -} - -void XMLTokenizer::clearCurrentNodeStack() -{ - if (m_currentNode && m_currentNode != m_doc) - m_currentNode->deref(); - m_currentNode = 0; - - if (m_currentNodeStack.size()) { // Aborted parsing. - for (size_t i = m_currentNodeStack.size() - 1; i != 0; --i) - m_currentNodeStack[i]->deref(); - if (m_currentNodeStack[0] && m_currentNodeStack[0] != m_doc) - m_currentNodeStack[0]->deref(); - m_currentNodeStack.clear(); - } -} - -void XMLTokenizer::write(const SegmentedString& s, bool /*appendData*/) -{ - String parseString = s.toString(); - - if (m_sawXSLTransform || !m_sawFirstElement) - m_originalSourceForTransform += parseString; - - if (m_parserStopped || m_sawXSLTransform) - return; - - if (m_parserPaused) { - m_pendingSrc.append(s); - return; - } - - doWrite(s.toString()); - - // After parsing, go ahead and dispatch image beforeload events. - ImageLoader::dispatchPendingBeforeLoadEvents(); -} - -void XMLTokenizer::handleError(ErrorType type, const char* m, int lineNumber, int columnNumber) -{ - if (type == fatal || (m_errorCount < maxErrors && m_lastErrorLine != lineNumber && m_lastErrorColumn != columnNumber)) { - switch (type) { - case warning: - m_errorMessages += String::format("warning on line %d at column %d: %s", lineNumber, columnNumber, m); - break; - case fatal: - case nonFatal: - m_errorMessages += String::format("error on line %d at column %d: %s", lineNumber, columnNumber, m); - } - - m_lastErrorLine = lineNumber; - m_lastErrorColumn = columnNumber; - ++m_errorCount; - } - - if (type != warning) - m_sawError = true; - - if (type == fatal) - stopParsing(); -} - -bool XMLTokenizer::enterText() -{ -#if !USE(QXMLSTREAM) - ASSERT(m_bufferedText.size() == 0); -#endif - RefPtr<Node> newNode = Text::create(m_doc, ""); - if (!m_currentNode->addChild(newNode.get())) - return false; - pushCurrentNode(newNode.get()); - return true; -} - -#if !USE(QXMLSTREAM) -static inline String toString(const xmlChar* str, unsigned len) -{ - return UTF8Encoding().decode(reinterpret_cast<const char*>(str), len); -} -#endif - - -void XMLTokenizer::exitText() -{ - if (m_parserStopped) - return; - - if (!m_currentNode || !m_currentNode->isTextNode()) - return; - -#if !USE(QXMLSTREAM) - ExceptionCode ec = 0; - static_cast<Text*>(m_currentNode)->appendData(toString(m_bufferedText.data(), m_bufferedText.size()), ec); - Vector<xmlChar> empty; - m_bufferedText.swap(empty); -#endif - - if (m_view && m_currentNode && !m_currentNode->attached()) - m_currentNode->attach(); - - popCurrentNode(); -} - -void XMLTokenizer::end() -{ - doEnd(); - - // doEnd() could process a script tag, thus pausing parsing. - if (m_parserPaused) - return; - - if (m_sawError) - insertErrorMessageBlock(); - else { - exitText(); - m_doc->updateStyleSelector(); - } - - clearCurrentNodeStack(); - if (!m_parsingFragment) - m_doc->finishedParsing(); -} - -void XMLTokenizer::finish() -{ - if (m_parserPaused) - m_finishCalled = true; - else - end(); -} - -static inline RefPtr<Element> createXHTMLParserErrorHeader(Document* doc, const String& errorMessages) -{ - RefPtr<Element> reportElement = doc->createElement(QualifiedName(nullAtom, "parsererror", xhtmlNamespaceURI), false); - reportElement->setAttribute(styleAttr, "display: block; white-space: pre; border: 2px solid #c77; padding: 0 1em 0 1em; margin: 1em; background-color: #fdd; color: black"); - - ExceptionCode ec = 0; - RefPtr<Element> h3 = doc->createElement(h3Tag, false); - reportElement->appendChild(h3.get(), ec); - h3->appendChild(doc->createTextNode("This page contains the following errors:"), ec); - - RefPtr<Element> fixed = doc->createElement(divTag, false); - reportElement->appendChild(fixed.get(), ec); - fixed->setAttribute(styleAttr, "font-family:monospace;font-size:12px"); - fixed->appendChild(doc->createTextNode(errorMessages), ec); - - h3 = doc->createElement(h3Tag, false); - reportElement->appendChild(h3.get(), ec); - h3->appendChild(doc->createTextNode("Below is a rendering of the page up to the first error."), ec); - - return reportElement; -} - -void XMLTokenizer::insertErrorMessageBlock() -{ -#if USE(QXMLSTREAM) - if (m_parsingFragment) - return; -#endif - // One or more errors occurred during parsing of the code. Display an error block to the user above - // the normal content (the DOM tree is created manually and includes line/col info regarding - // where the errors are located) - - // Create elements for display - ExceptionCode ec = 0; - Document* doc = m_doc; - Node* documentElement = doc->documentElement(); - if (!documentElement) { - RefPtr<Node> rootElement = doc->createElement(htmlTag, false); - doc->appendChild(rootElement, ec); - RefPtr<Node> body = doc->createElement(bodyTag, false); - rootElement->appendChild(body, ec); - documentElement = body.get(); - } -#if ENABLE(SVG) - else if (documentElement->namespaceURI() == SVGNames::svgNamespaceURI) { - RefPtr<Node> rootElement = doc->createElement(htmlTag, false); - RefPtr<Node> body = doc->createElement(bodyTag, false); - rootElement->appendChild(body, ec); - body->appendChild(documentElement, ec); - doc->appendChild(rootElement.get(), ec); - documentElement = body.get(); - } -#endif -#if ENABLE(WML) - else if (isWMLDocument()) { - RefPtr<Node> rootElement = doc->createElement(htmlTag, false); - RefPtr<Node> body = doc->createElement(bodyTag, false); - rootElement->appendChild(body, ec); - body->appendChild(documentElement, ec); - doc->appendChild(rootElement.get(), ec); - documentElement = body.get(); - } -#endif - - RefPtr<Element> reportElement = createXHTMLParserErrorHeader(doc, m_errorMessages); - documentElement->insertBefore(reportElement, documentElement->firstChild(), ec); -#if ENABLE(XSLT) - if (doc->transformSourceDocument()) { - RefPtr<Element> par = doc->createElement(pTag, false); - reportElement->appendChild(par, ec); - par->setAttribute(styleAttr, "white-space: normal"); - par->appendChild(doc->createTextNode("This document was created as the result of an XSL transformation. The line and column numbers given are from the transformed result."), ec); - } -#endif - doc->updateStyleIfNeeded(); -} - -void XMLTokenizer::notifyFinished(CachedResource* unusedResource) -{ - ASSERT_UNUSED(unusedResource, unusedResource == m_pendingScript); - ASSERT(m_pendingScript->accessCount() > 0); - - ScriptSourceCode sourceCode(m_pendingScript.get()); - bool errorOccurred = m_pendingScript->errorOccurred(); - - m_pendingScript->removeClient(this); - m_pendingScript = 0; - - RefPtr<Element> e = m_scriptElement; - m_scriptElement = 0; - - ScriptElement* scriptElement = toScriptElement(e.get()); - ASSERT(scriptElement); - - if (errorOccurred) - scriptElement->dispatchErrorEvent(); - else { - m_view->frame()->script()->executeScript(sourceCode); - scriptElement->dispatchLoadEvent(); - } - - m_scriptElement = 0; - - if (!m_requestingScript) - resumeParsing(); -} - -bool XMLTokenizer::isWaitingForScripts() const -{ - return m_pendingScript; -} - -void XMLTokenizer::pauseParsing() -{ - if (m_parsingFragment) - return; - - m_parserPaused = true; -} - -} diff --git a/WebCore/dom/XMLTokenizer.h b/WebCore/dom/XMLTokenizer.h deleted file mode 100644 index 92e2830..0000000 --- a/WebCore/dom/XMLTokenizer.h +++ /dev/null @@ -1,326 +0,0 @@ -/* - * Copyright (C) 2000 Peter Kelly (pmk@post.com) - * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved. - * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) - * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) - * - * 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 XMLTokenizer_h -#define XMLTokenizer_h - -#if USE(EXPAT) - -#include "CachedResourceClient.h" -#include "SegmentedString.h" -#include "StringHash.h" -#include "Tokenizer.h" -#include <libexpat/expat.h> -#include <wtf/HashMap.h> -#include <wtf/OwnPtr.h> - -namespace WebCore { - - class Node; - class CachedScript; - class DocumentFragment; - class Document; - class Element; - class FrameView; - class PendingCallbacks; - - class XMLTokenizer : public Tokenizer, public CachedResourceClient { - public: - XMLTokenizer(Document *, FrameView * = 0); - XMLTokenizer(DocumentFragment *, Element *); - ~XMLTokenizer(); - - enum ErrorType { warning, nonFatal, fatal }; - - // from Tokenizer - virtual bool write(const SegmentedString &str, bool); - virtual void finish(); - virtual bool isWaitingForScripts() const; - virtual void stopParsing(); - virtual bool wellFormed() const { return !m_sawError; } - virtual int lineNumber() const; - virtual int columnNumber() const; - - // from CachedObjectClient - virtual void notifyFinished(CachedResource *finishedObj); - - // callbacks from parser expat - void startElementNs(const XML_Char *name, const XML_Char **atts); - void endElementNs(); - void characters(const XML_Char *s, int len); - void processingInstruction(const XML_Char *target, const XML_Char *data); - void comment(const XML_Char *s); - void startCdata(); - void endCdata(); - - void error(ErrorType type, const char* m, int lineNumber, int columnNumber); - - // utilities - XML_Parser getXMLParser() const { return m_parser; } - void setXMLParser(XML_Parser parser) { m_parser = parser; } - - private: - void setCurrentNode(Node*); - - void end(); - - void pauseParsing(); - void resumeParsing(); - - void reportError(); - void insertErrorMessageBlock(); - - bool enterText(); - void exitText(); - - Document *m_doc; - FrameView *m_view; - - XML_Parser m_parser; - - Node *m_currentNode; - bool m_currentNodeIsReferenced; - - bool m_sawError; - bool m_sawXSLTransform; - bool m_sawFirstElement; - - bool m_parserPaused; - bool m_requestingScript; - bool m_finishCalled; - - int m_errorCount; - String m_errorMessages; - - CachedScript *m_pendingScript; - RefPtr<Element> m_scriptElement; - int m_scriptStartLine; - - bool m_parsingFragment; - String m_defaultNamespaceURI; - - typedef HashMap<String, String> PrefixForNamespaceMap; - PrefixForNamespaceMap m_prefixToNamespaceMap; - - OwnPtr<PendingCallbacks> m_pendingCallbacks; - SegmentedString m_pendingSrc; - }; - -HashMap<String, String> parseAttributes(const String&, bool& attrsOK); -bool parseXMLDocumentFragment(const String&, DocumentFragment*, Element* parent = 0); - -} // namespace WebCore - -#else // USE(EXPAT) - -#include "CachedResourceClient.h" -#include "CachedResourceHandle.h" -#include "MappedAttributeEntry.h" -#include "SegmentedString.h" -#include "StringHash.h" -#include "Tokenizer.h" -#include <wtf/HashMap.h> -#include <wtf/OwnPtr.h> - -#if USE(QXMLSTREAM) -#include <qxmlstream.h> -#else -#include <libxml/tree.h> -#include <libxml/xmlstring.h> -#endif - -namespace WebCore { - - class Node; - class CachedScript; - class DocLoader; - class DocumentFragment; - class Document; - class Element; - class FrameView; - class PendingCallbacks; - class ScriptElement; - -#if !USE(QXMLSTREAM) - class XMLParserContext : public RefCounted<XMLParserContext> { - public: - static PassRefPtr<XMLParserContext> createMemoryParser(xmlSAXHandlerPtr, void*, const char*); - static PassRefPtr<XMLParserContext> createStringParser(xmlSAXHandlerPtr, void*); - ~XMLParserContext(); - xmlParserCtxtPtr context() const { return m_context; } - - private: - XMLParserContext(xmlParserCtxtPtr context) - : m_context(context) - { - } - xmlParserCtxtPtr m_context; - }; -#endif - - class XMLTokenizer : public Tokenizer, public CachedResourceClient { - public: - XMLTokenizer(Document*, FrameView* = 0); - XMLTokenizer(DocumentFragment*, Element*, FragmentScriptingPermission); - ~XMLTokenizer(); - - enum ErrorType { warning, nonFatal, fatal }; - - // from Tokenizer - virtual void write(const SegmentedString&, bool appendData); - virtual void finish(); - virtual bool isWaitingForScripts() const; - virtual void stopParsing(); - - void end(); - - void pauseParsing(); - void resumeParsing(); - - void setIsXHTMLDocument(bool isXHTML) { m_isXHTMLDocument = isXHTML; } - bool isXHTMLDocument() const { return m_isXHTMLDocument; } -#if ENABLE(XHTMLMP) - void setIsXHTMLMPDocument(bool isXHTML) { m_isXHTMLMPDocument = isXHTML; } - bool isXHTMLMPDocument() const { return m_isXHTMLMPDocument; } -#endif -#if ENABLE(WML) - bool isWMLDocument() const; -#endif - - // from CachedResourceClient - virtual void notifyFinished(CachedResource* finishedObj); - - - void handleError(ErrorType type, const char* m, int lineNumber, int columnNumber); - - virtual bool wellFormed() const { return !m_sawError; } - - int lineNumber() const; - int columnNumber() const; - -#if USE(QXMLSTREAM) -private: - void parse(); - void startDocument(); - void parseStartElement(); - void parseEndElement(); - void parseCharacters(); - void parseProcessingInstruction(); - void parseCdata(); - void parseComment(); - void endDocument(); - void parseDtd(); - bool hasError() const; -#else -public: - // callbacks from parser SAX - void error(ErrorType, const char* message, va_list args) WTF_ATTRIBUTE_PRINTF(3, 0); - void startElementNs(const xmlChar* xmlLocalName, const xmlChar* xmlPrefix, const xmlChar* xmlURI, int nb_namespaces, - const xmlChar** namespaces, int nb_attributes, int nb_defaulted, const xmlChar** libxmlAttributes); - void endElementNs(); - void characters(const xmlChar* s, int len); - void processingInstruction(const xmlChar* target, const xmlChar* data); - void cdataBlock(const xmlChar* s, int len); - void comment(const xmlChar* s); - void startDocument(const xmlChar* version, const xmlChar* encoding, int standalone); - void internalSubset(const xmlChar* name, const xmlChar* externalID, const xmlChar* systemID); - void endDocument(); -#endif - private: - friend bool parseXMLDocumentFragment(const String&, DocumentFragment*, Element*, FragmentScriptingPermission); - - void initializeParserContext(const char* chunk = 0); - - void pushCurrentNode(Node*); - void popCurrentNode(); - void clearCurrentNodeStack(); - - void insertErrorMessageBlock(); - - bool enterText(); - void exitText(); - - void doWrite(const String&); - void doEnd(); - - Document* m_doc; - FrameView* m_view; - - String m_originalSourceForTransform; - -#if USE(QXMLSTREAM) - QXmlStreamReader m_stream; - bool m_wroteText; -#else - xmlParserCtxtPtr context() const { return m_context ? m_context->context() : 0; }; - RefPtr<XMLParserContext> m_context; - OwnPtr<PendingCallbacks> m_pendingCallbacks; - Vector<xmlChar> m_bufferedText; -#endif - Node* m_currentNode; - Vector<Node*> m_currentNodeStack; - - bool m_sawError; - bool m_sawXSLTransform; - bool m_sawFirstElement; - bool m_isXHTMLDocument; -#if ENABLE(XHTMLMP) - bool m_isXHTMLMPDocument; - bool m_hasDocTypeDeclaration; -#endif - - bool m_parserPaused; - bool m_requestingScript; - bool m_finishCalled; - - int m_errorCount; - int m_lastErrorLine; - int m_lastErrorColumn; - String m_errorMessages; - - CachedResourceHandle<CachedScript> m_pendingScript; - RefPtr<Element> m_scriptElement; - int m_scriptStartLine; - - bool m_parsingFragment; - String m_defaultNamespaceURI; - - typedef HashMap<String, String> PrefixForNamespaceMap; - PrefixForNamespaceMap m_prefixToNamespaceMap; - SegmentedString m_pendingSrc; - FragmentScriptingPermission m_scriptingPermission; - }; - -#if ENABLE(XSLT) -void* xmlDocPtrForString(DocLoader*, const String& source, const String& url); -#endif - -HashMap<String, String> parseAttributes(const String&, bool& attrsOK); -bool parseXMLDocumentFragment(const String&, DocumentFragment*, Element* parent = 0, FragmentScriptingPermission = FragmentScriptingAllowed); - -} // namespace WebCore - -#endif // USE(EXPAT) - -#endif // XMLTokenizer_h diff --git a/WebCore/dom/XMLTokenizerLibxml2.cpp b/WebCore/dom/XMLTokenizerLibxml2.cpp deleted file mode 100644 index 06cf4a5..0000000 --- a/WebCore/dom/XMLTokenizerLibxml2.cpp +++ /dev/null @@ -1,1457 +0,0 @@ -/* - * Copyright (C) 2000 Peter Kelly (pmk@post.com) - * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. - * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) - * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) - * Copyright (C) 2008 Holger Hans Peter Freyther - * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) - * - * 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 "XMLTokenizer.h" - -#include "CDATASection.h" -#include "CachedScript.h" -#include "Comment.h" -#include "DocLoader.h" -#include "Document.h" -#include "DocumentFragment.h" -#include "DocumentType.h" -#include "Frame.h" -#include "FrameLoader.h" -#include "FrameView.h" -#include "HTMLLinkElement.h" -#include "HTMLStyleElement.h" -#include "HTMLTokenizer.h" // for decodeNamedEntity -#include "ProcessingInstruction.h" -#include "ResourceError.h" -#include "ResourceHandle.h" -#include "ResourceRequest.h" -#include "ResourceResponse.h" -#include "ScriptController.h" -#include "ScriptElement.h" -#include "ScriptSourceCode.h" -#include "ScriptValue.h" -#include "TextResourceDecoder.h" -#include "TransformSource.h" -#include "XMLNSNames.h" -#include "XMLTokenizerScope.h" -#include <libxml/parser.h> -#include <libxml/parserInternals.h> -#include <wtf/text/CString.h> -#include <wtf/StringExtras.h> -#include <wtf/Threading.h> -#include <wtf/UnusedParam.h> -#include <wtf/Vector.h> - -#if ENABLE(XSLT) -#include <libxslt/xslt.h> -#endif - -#if ENABLE(XHTMLMP) -#include "HTMLNames.h" -#include "HTMLScriptElement.h" -#endif - -using namespace std; - -namespace WebCore { - -class PendingCallbacks : public Noncopyable { -public: - ~PendingCallbacks() - { - deleteAllValues(m_callbacks); - } - - void appendStartElementNSCallback(const xmlChar* xmlLocalName, const xmlChar* xmlPrefix, const xmlChar* xmlURI, int nb_namespaces, - const xmlChar** namespaces, int nb_attributes, int nb_defaulted, const xmlChar** attributes) - { - PendingStartElementNSCallback* callback = new PendingStartElementNSCallback; - - callback->xmlLocalName = xmlStrdup(xmlLocalName); - callback->xmlPrefix = xmlStrdup(xmlPrefix); - callback->xmlURI = xmlStrdup(xmlURI); - callback->nb_namespaces = nb_namespaces; - callback->namespaces = static_cast<xmlChar**>(xmlMalloc(sizeof(xmlChar*) * nb_namespaces * 2)); - for (int i = 0; i < nb_namespaces * 2 ; i++) - callback->namespaces[i] = xmlStrdup(namespaces[i]); - callback->nb_attributes = nb_attributes; - callback->nb_defaulted = nb_defaulted; - callback->attributes = static_cast<xmlChar**>(xmlMalloc(sizeof(xmlChar*) * nb_attributes * 5)); - for (int i = 0; i < nb_attributes; i++) { - // Each attribute has 5 elements in the array: - // name, prefix, uri, value and an end pointer. - - for (int j = 0; j < 3; j++) - callback->attributes[i * 5 + j] = xmlStrdup(attributes[i * 5 + j]); - - int len = attributes[i * 5 + 4] - attributes[i * 5 + 3]; - - callback->attributes[i * 5 + 3] = xmlStrndup(attributes[i * 5 + 3], len); - callback->attributes[i * 5 + 4] = callback->attributes[i * 5 + 3] + len; - } - - m_callbacks.append(callback); - } - - void appendEndElementNSCallback() - { - PendingEndElementNSCallback* callback = new PendingEndElementNSCallback; - - m_callbacks.append(callback); - } - - void appendCharactersCallback(const xmlChar* s, int len) - { - PendingCharactersCallback* callback = new PendingCharactersCallback; - - callback->s = xmlStrndup(s, len); - callback->len = len; - - m_callbacks.append(callback); - } - - void appendProcessingInstructionCallback(const xmlChar* target, const xmlChar* data) - { - PendingProcessingInstructionCallback* callback = new PendingProcessingInstructionCallback; - - callback->target = xmlStrdup(target); - callback->data = xmlStrdup(data); - - m_callbacks.append(callback); - } - - void appendCDATABlockCallback(const xmlChar* s, int len) - { - PendingCDATABlockCallback* callback = new PendingCDATABlockCallback; - - callback->s = xmlStrndup(s, len); - callback->len = len; - - m_callbacks.append(callback); - } - - void appendCommentCallback(const xmlChar* s) - { - PendingCommentCallback* callback = new PendingCommentCallback; - - callback->s = xmlStrdup(s); - - m_callbacks.append(callback); - } - - void appendInternalSubsetCallback(const xmlChar* name, const xmlChar* externalID, const xmlChar* systemID) - { - PendingInternalSubsetCallback* callback = new PendingInternalSubsetCallback; - - callback->name = xmlStrdup(name); - callback->externalID = xmlStrdup(externalID); - callback->systemID = xmlStrdup(systemID); - - m_callbacks.append(callback); - } - - void appendErrorCallback(XMLTokenizer::ErrorType type, const xmlChar* message, int lineNumber, int columnNumber) - { - PendingErrorCallback* callback = new PendingErrorCallback; - - callback->message = xmlStrdup(message); - callback->type = type; - callback->lineNumber = lineNumber; - callback->columnNumber = columnNumber; - - m_callbacks.append(callback); - } - - void callAndRemoveFirstCallback(XMLTokenizer* tokenizer) - { - OwnPtr<PendingCallback> callback(m_callbacks.first()); - m_callbacks.removeFirst(); - callback->call(tokenizer); - } - - bool isEmpty() const { return m_callbacks.isEmpty(); } - -private: - struct PendingCallback { - virtual ~PendingCallback() { } - virtual void call(XMLTokenizer* tokenizer) = 0; - }; - - struct PendingStartElementNSCallback : public PendingCallback { - virtual ~PendingStartElementNSCallback() - { - xmlFree(xmlLocalName); - xmlFree(xmlPrefix); - xmlFree(xmlURI); - for (int i = 0; i < nb_namespaces * 2; i++) - xmlFree(namespaces[i]); - xmlFree(namespaces); - for (int i = 0; i < nb_attributes; i++) - for (int j = 0; j < 4; j++) - xmlFree(attributes[i * 5 + j]); - xmlFree(attributes); - } - - virtual void call(XMLTokenizer* tokenizer) - { - tokenizer->startElementNs(xmlLocalName, xmlPrefix, xmlURI, - nb_namespaces, const_cast<const xmlChar**>(namespaces), - nb_attributes, nb_defaulted, const_cast<const xmlChar**>(attributes)); - } - - xmlChar* xmlLocalName; - xmlChar* xmlPrefix; - xmlChar* xmlURI; - int nb_namespaces; - xmlChar** namespaces; - int nb_attributes; - int nb_defaulted; - xmlChar** attributes; - }; - - struct PendingEndElementNSCallback : public PendingCallback { - virtual void call(XMLTokenizer* tokenizer) - { - tokenizer->endElementNs(); - } - }; - - struct PendingCharactersCallback : public PendingCallback { - virtual ~PendingCharactersCallback() - { - xmlFree(s); - } - - virtual void call(XMLTokenizer* tokenizer) - { - tokenizer->characters(s, len); - } - - xmlChar* s; - int len; - }; - - struct PendingProcessingInstructionCallback : public PendingCallback { - virtual ~PendingProcessingInstructionCallback() - { - xmlFree(target); - xmlFree(data); - } - - virtual void call(XMLTokenizer* tokenizer) - { - tokenizer->processingInstruction(target, data); - } - - xmlChar* target; - xmlChar* data; - }; - - struct PendingCDATABlockCallback : public PendingCallback { - virtual ~PendingCDATABlockCallback() - { - xmlFree(s); - } - - virtual void call(XMLTokenizer* tokenizer) - { - tokenizer->cdataBlock(s, len); - } - - xmlChar* s; - int len; - }; - - struct PendingCommentCallback : public PendingCallback { - virtual ~PendingCommentCallback() - { - xmlFree(s); - } - - virtual void call(XMLTokenizer* tokenizer) - { - tokenizer->comment(s); - } - - xmlChar* s; - }; - - struct PendingInternalSubsetCallback : public PendingCallback { - virtual ~PendingInternalSubsetCallback() - { - xmlFree(name); - xmlFree(externalID); - xmlFree(systemID); - } - - virtual void call(XMLTokenizer* tokenizer) - { - tokenizer->internalSubset(name, externalID, systemID); - } - - xmlChar* name; - xmlChar* externalID; - xmlChar* systemID; - }; - - struct PendingErrorCallback: public PendingCallback { - virtual ~PendingErrorCallback() - { - xmlFree(message); - } - - virtual void call(XMLTokenizer* tokenizer) - { - tokenizer->handleError(type, reinterpret_cast<char*>(message), lineNumber, columnNumber); - } - - XMLTokenizer::ErrorType type; - xmlChar* message; - int lineNumber; - int columnNumber; - }; - - Deque<PendingCallback*> m_callbacks; -}; -// -------------------------------- - -static int globalDescriptor = 0; -static ThreadIdentifier libxmlLoaderThread = 0; - -static int matchFunc(const char*) -{ - // Only match loads initiated due to uses of libxml2 from within XMLTokenizer to avoid - // interfering with client applications that also use libxml2. http://bugs.webkit.org/show_bug.cgi?id=17353 - return XMLTokenizerScope::currentDocLoader && currentThread() == libxmlLoaderThread; -} - -class OffsetBuffer { -public: - OffsetBuffer(const Vector<char>& b) : m_buffer(b), m_currentOffset(0) { } - - int readOutBytes(char* outputBuffer, unsigned askedToRead) - { - unsigned bytesLeft = m_buffer.size() - m_currentOffset; - unsigned lenToCopy = min(askedToRead, bytesLeft); - if (lenToCopy) { - memcpy(outputBuffer, m_buffer.data() + m_currentOffset, lenToCopy); - m_currentOffset += lenToCopy; - } - return lenToCopy; - } - -private: - Vector<char> m_buffer; - unsigned m_currentOffset; -}; - -static bool shouldAllowExternalLoad(const KURL& url) -{ - String urlString = url.string(); - - // On non-Windows platforms libxml asks for this URL, the - // "XML_XML_DEFAULT_CATALOG", on initialization. - if (urlString == "file:///etc/xml/catalog") - return false; - - // On Windows, libxml computes a URL relative to where its DLL resides. - if (urlString.startsWith("file:///", false) && urlString.endsWith("/etc/catalog", false)) - return false; - - // The most common DTD. There isn't much point in hammering www.w3c.org - // by requesting this URL for every XHTML document. - if (urlString.startsWith("http://www.w3.org/TR/xhtml", false)) - return false; - - // Similarly, there isn't much point in requesting the SVG DTD. - if (urlString.startsWith("http://www.w3.org/Graphics/SVG", false)) - return false; - - // The libxml doesn't give us a lot of context for deciding whether to - // allow this request. In the worst case, this load could be for an - // external entity and the resulting document could simply read the - // retrieved content. If we had more context, we could potentially allow - // the parser to load a DTD. As things stand, we take the conservative - // route and allow same-origin requests only. - if (!XMLTokenizerScope::currentDocLoader->doc()->securityOrigin()->canRequest(url)) { - XMLTokenizerScope::currentDocLoader->printAccessDeniedMessage(url); - return false; - } - - return true; -} - -static void* openFunc(const char* uri) -{ - ASSERT(XMLTokenizerScope::currentDocLoader); - ASSERT(currentThread() == libxmlLoaderThread); - - KURL url(KURL(), uri); - - if (!shouldAllowExternalLoad(url)) - return &globalDescriptor; - - ResourceError error; - ResourceResponse response; - Vector<char> data; - - - { - DocLoader* docLoader = XMLTokenizerScope::currentDocLoader; - XMLTokenizerScope scope(0); - // FIXME: We should restore the original global error handler as well. - - if (docLoader->frame()) - docLoader->frame()->loader()->loadResourceSynchronously(url, AllowStoredCredentials, error, response, data); - } - - // We have to check the URL again after the load to catch redirects. - // See <https://bugs.webkit.org/show_bug.cgi?id=21963>. - if (!shouldAllowExternalLoad(response.url())) - return &globalDescriptor; - - return new OffsetBuffer(data); -} - -static int readFunc(void* context, char* buffer, int len) -{ - // Do 0-byte reads in case of a null descriptor - if (context == &globalDescriptor) - return 0; - - OffsetBuffer* data = static_cast<OffsetBuffer*>(context); - return data->readOutBytes(buffer, len); -} - -static int writeFunc(void*, const char*, int) -{ - // Always just do 0-byte writes - return 0; -} - -static int closeFunc(void* context) -{ - if (context != &globalDescriptor) { - OffsetBuffer* data = static_cast<OffsetBuffer*>(context); - delete data; - } - return 0; -} - -#if ENABLE(XSLT) -static void errorFunc(void*, const char*, ...) -{ - // FIXME: It would be nice to display error messages somewhere. -} -#endif - -static bool didInit = false; - -PassRefPtr<XMLParserContext> XMLParserContext::createStringParser(xmlSAXHandlerPtr handlers, void* userData) -{ - if (!didInit) { - xmlInitParser(); - xmlRegisterInputCallbacks(matchFunc, openFunc, readFunc, closeFunc); - xmlRegisterOutputCallbacks(matchFunc, openFunc, writeFunc, closeFunc); - libxmlLoaderThread = currentThread(); - didInit = true; - } - - xmlParserCtxtPtr parser = xmlCreatePushParserCtxt(handlers, 0, 0, 0, 0); - parser->_private = userData; - parser->replaceEntities = true; - const UChar BOM = 0xFEFF; - const unsigned char BOMHighByte = *reinterpret_cast<const unsigned char*>(&BOM); - xmlSwitchEncoding(parser, BOMHighByte == 0xFF ? XML_CHAR_ENCODING_UTF16LE : XML_CHAR_ENCODING_UTF16BE); - - return adoptRef(new XMLParserContext(parser)); -} - - -// Chunk should be encoded in UTF-8 -PassRefPtr<XMLParserContext> XMLParserContext::createMemoryParser(xmlSAXHandlerPtr handlers, void* userData, const char* chunk) -{ - if (!didInit) { - xmlInitParser(); - xmlRegisterInputCallbacks(matchFunc, openFunc, readFunc, closeFunc); - xmlRegisterOutputCallbacks(matchFunc, openFunc, writeFunc, closeFunc); - libxmlLoaderThread = currentThread(); - didInit = true; - } - - xmlParserCtxtPtr parser = xmlCreateMemoryParserCtxt(chunk, xmlStrlen((const xmlChar*)chunk)); - - if (!parser) - return 0; - - // Copy the sax handler - memcpy(parser->sax, handlers, sizeof(xmlSAXHandler)); - - // Set parser options. - // XML_PARSE_NODICT: default dictionary option. - // XML_PARSE_NOENT: force entities substitutions. - xmlCtxtUseOptions(parser, XML_PARSE_NODICT | XML_PARSE_NOENT); - - // Internal initialization - parser->sax2 = 1; - parser->instate = XML_PARSER_CONTENT; // We are parsing a CONTENT - parser->depth = 0; - parser->str_xml = xmlDictLookup(parser->dict, BAD_CAST "xml", 3); - parser->str_xmlns = xmlDictLookup(parser->dict, BAD_CAST "xmlns", 5); - parser->str_xml_ns = xmlDictLookup(parser->dict, XML_XML_NAMESPACE, 36); - parser->_private = userData; - - return adoptRef(new XMLParserContext(parser)); -} - -// -------------------------------- - -XMLTokenizer::XMLTokenizer(Document* _doc, FrameView* _view) - : m_doc(_doc) - , m_view(_view) - , m_context(0) - , m_pendingCallbacks(new PendingCallbacks) - , m_currentNode(_doc) - , m_sawError(false) - , m_sawXSLTransform(false) - , m_sawFirstElement(false) - , m_isXHTMLDocument(false) -#if ENABLE(XHTMLMP) - , m_isXHTMLMPDocument(false) - , m_hasDocTypeDeclaration(false) -#endif - , m_parserPaused(false) - , m_requestingScript(false) - , m_finishCalled(false) - , m_errorCount(0) - , m_lastErrorLine(0) - , m_lastErrorColumn(0) - , m_pendingScript(0) - , m_scriptStartLine(0) - , m_parsingFragment(false) - , m_scriptingPermission(FragmentScriptingAllowed) -{ -} - -XMLTokenizer::XMLTokenizer(DocumentFragment* fragment, Element* parentElement, FragmentScriptingPermission scriptingPermission) - : m_doc(fragment->document()) - , m_view(0) - , m_context(0) - , m_pendingCallbacks(new PendingCallbacks) - , m_currentNode(fragment) - , m_sawError(false) - , m_sawXSLTransform(false) - , m_sawFirstElement(false) - , m_isXHTMLDocument(false) -#if ENABLE(XHTMLMP) - , m_isXHTMLMPDocument(false) - , m_hasDocTypeDeclaration(false) -#endif - , m_parserPaused(false) - , m_requestingScript(false) - , m_finishCalled(false) - , m_errorCount(0) - , m_lastErrorLine(0) - , m_lastErrorColumn(0) - , m_pendingScript(0) - , m_scriptStartLine(0) - , m_parsingFragment(true) - , m_scriptingPermission(scriptingPermission) -{ - fragment->ref(); - if (m_doc) - m_doc->ref(); - - // Add namespaces based on the parent node - Vector<Element*> elemStack; - while (parentElement) { - elemStack.append(parentElement); - - Node* n = parentElement->parentNode(); - if (!n || !n->isElementNode()) - break; - parentElement = static_cast<Element*>(n); - } - - if (elemStack.isEmpty()) - return; - - for (Element* element = elemStack.last(); !elemStack.isEmpty(); elemStack.removeLast()) { - if (NamedNodeMap* attrs = element->attributes()) { - for (unsigned i = 0; i < attrs->length(); i++) { - Attribute* attr = attrs->attributeItem(i); - if (attr->localName() == xmlnsAtom) - m_defaultNamespaceURI = attr->value(); - else if (attr->prefix() == xmlnsAtom) - m_prefixToNamespaceMap.set(attr->localName(), attr->value()); - } - } - } - - // If the parent element is not in document tree, there may be no xmlns attribute; just default to the parent's namespace. - if (m_defaultNamespaceURI.isNull() && !parentElement->inDocument()) - m_defaultNamespaceURI = parentElement->namespaceURI(); -} - -XMLParserContext::~XMLParserContext() -{ - if (m_context->myDoc) - xmlFreeDoc(m_context->myDoc); - xmlFreeParserCtxt(m_context); -} - -XMLTokenizer::~XMLTokenizer() -{ - clearCurrentNodeStack(); - if (m_parsingFragment && m_doc) - m_doc->deref(); - if (m_pendingScript) - m_pendingScript->removeClient(this); -} - -void XMLTokenizer::doWrite(const String& parseString) -{ - if (!m_context) - initializeParserContext(); - - // Protect the libxml context from deletion during a callback - RefPtr<XMLParserContext> context = m_context; - - // libXML throws an error if you try to switch the encoding for an empty string. - if (parseString.length()) { - // Hack around libxml2's lack of encoding overide support by manually - // resetting the encoding to UTF-16 before every chunk. Otherwise libxml - // will detect <?xml version="1.0" encoding="<encoding name>"?> blocks - // and switch encodings, causing the parse to fail. - const UChar BOM = 0xFEFF; - const unsigned char BOMHighByte = *reinterpret_cast<const unsigned char*>(&BOM); - xmlSwitchEncoding(context->context(), BOMHighByte == 0xFF ? XML_CHAR_ENCODING_UTF16LE : XML_CHAR_ENCODING_UTF16BE); - - XMLTokenizerScope scope(m_doc->docLoader()); - xmlParseChunk(context->context(), reinterpret_cast<const char*>(parseString.characters()), sizeof(UChar) * parseString.length(), 0); - } - - if (m_doc->decoder() && m_doc->decoder()->sawError()) { - // If the decoder saw an error, report it as fatal (stops parsing) - handleError(fatal, "Encoding error", context->context()->input->line, context->context()->input->col); - } - - return; -} - -static inline String toString(const xmlChar* str, unsigned len) -{ - return UTF8Encoding().decode(reinterpret_cast<const char*>(str), len); -} - -static inline String toString(const xmlChar* str) -{ - if (!str) - return String(); - - return UTF8Encoding().decode(reinterpret_cast<const char*>(str), strlen(reinterpret_cast<const char*>(str))); -} - -struct _xmlSAX2Namespace { - const xmlChar* prefix; - const xmlChar* uri; -}; -typedef struct _xmlSAX2Namespace xmlSAX2Namespace; - -static inline void handleElementNamespaces(Element* newElement, const xmlChar** libxmlNamespaces, int nb_namespaces, ExceptionCode& ec, FragmentScriptingPermission scriptingPermission) -{ - xmlSAX2Namespace* namespaces = reinterpret_cast<xmlSAX2Namespace*>(libxmlNamespaces); - for (int i = 0; i < nb_namespaces; i++) { - AtomicString namespaceQName = xmlnsAtom; - String namespaceURI = toString(namespaces[i].uri); - if (namespaces[i].prefix) - namespaceQName = "xmlns:" + toString(namespaces[i].prefix); - newElement->setAttributeNS(XMLNSNames::xmlnsNamespaceURI, namespaceQName, namespaceURI, ec, scriptingPermission); - if (ec) // exception setting attributes - return; - } -} - -struct _xmlSAX2Attributes { - const xmlChar* localname; - const xmlChar* prefix; - const xmlChar* uri; - const xmlChar* value; - const xmlChar* end; -}; -typedef struct _xmlSAX2Attributes xmlSAX2Attributes; - -static inline void handleElementAttributes(Element* newElement, const xmlChar** libxmlAttributes, int nb_attributes, ExceptionCode& ec, FragmentScriptingPermission scriptingPermission) -{ - xmlSAX2Attributes* attributes = reinterpret_cast<xmlSAX2Attributes*>(libxmlAttributes); - for (int i = 0; i < nb_attributes; i++) { - String attrLocalName = toString(attributes[i].localname); - int valueLength = (int) (attributes[i].end - attributes[i].value); - String attrValue = toString(attributes[i].value, valueLength); - String attrPrefix = toString(attributes[i].prefix); - String attrURI = attrPrefix.isEmpty() ? String() : toString(attributes[i].uri); - String attrQName = attrPrefix.isEmpty() ? attrLocalName : attrPrefix + ":" + attrLocalName; - - newElement->setAttributeNS(attrURI, attrQName, attrValue, ec, scriptingPermission); - if (ec) // exception setting attributes - return; - } -} - -void XMLTokenizer::startElementNs(const xmlChar* xmlLocalName, const xmlChar* xmlPrefix, const xmlChar* xmlURI, int nb_namespaces, - const xmlChar** libxmlNamespaces, int nb_attributes, int nb_defaulted, const xmlChar** libxmlAttributes) -{ - if (m_parserStopped) - return; - - if (m_parserPaused) { - m_pendingCallbacks->appendStartElementNSCallback(xmlLocalName, xmlPrefix, xmlURI, nb_namespaces, libxmlNamespaces, - nb_attributes, nb_defaulted, libxmlAttributes); - return; - } - -#if ENABLE(XHTMLMP) - // check if the DOCTYPE Declaration of XHTMLMP document exists - if (!m_hasDocTypeDeclaration && m_doc->isXHTMLMPDocument()) { - handleError(fatal, "DOCTYPE declaration lost.", lineNumber(), columnNumber()); - return; - } -#endif - - exitText(); - - String localName = toString(xmlLocalName); - String uri = toString(xmlURI); - String prefix = toString(xmlPrefix); - - if (m_parsingFragment && uri.isNull()) { - if (!prefix.isNull()) - uri = m_prefixToNamespaceMap.get(prefix); - else - uri = m_defaultNamespaceURI; - } - -#if ENABLE(XHTMLMP) - if (!m_sawFirstElement && isXHTMLMPDocument()) { - // As per the section 7.1 of OMA-WAP-XHTMLMP-V1_1-20061020-A.pdf, - // we should make sure that the root element MUST be 'html' and - // ensure the name of the default namespace on the root elment 'html' - // MUST be 'http://www.w3.org/1999/xhtml' - if (localName != HTMLNames::htmlTag.localName()) { - handleError(fatal, "XHTMLMP document expects 'html' as root element.", lineNumber(), columnNumber()); - return; - } - - if (uri.isNull()) { - m_defaultNamespaceURI = HTMLNames::xhtmlNamespaceURI; - uri = m_defaultNamespaceURI; - } - } -#endif - - bool isFirstElement = !m_sawFirstElement; - m_sawFirstElement = true; - - QualifiedName qName(prefix, localName, uri); - RefPtr<Element> newElement = m_doc->createElement(qName, true); - if (!newElement) { - stopParsing(); - return; - } - - ExceptionCode ec = 0; - handleElementNamespaces(newElement.get(), libxmlNamespaces, nb_namespaces, ec, m_scriptingPermission); - if (ec) { - stopParsing(); - return; - } - - ScriptController* jsProxy = m_doc->frame() ? m_doc->frame()->script() : 0; - if (jsProxy && m_doc->frame()->script()->canExecuteScripts(NotAboutToExecuteScript)) - jsProxy->setEventHandlerLineNumber(lineNumber()); - - handleElementAttributes(newElement.get(), libxmlAttributes, nb_attributes, ec, m_scriptingPermission); - if (ec) { - stopParsing(); - return; - } - - if (jsProxy) - jsProxy->setEventHandlerLineNumber(0); - - newElement->beginParsingChildren(); - - ScriptElement* scriptElement = toScriptElement(newElement.get()); - if (scriptElement) - m_scriptStartLine = lineNumber(); - - if (!m_currentNode->addChild(newElement.get())) { - stopParsing(); - return; - } - - pushCurrentNode(newElement.get()); - if (m_view && !newElement->attached()) - newElement->attach(); - - if (!m_parsingFragment && isFirstElement && m_doc->frame()) - m_doc->frame()->loader()->dispatchDocumentElementAvailable(); -} - -void XMLTokenizer::endElementNs() -{ - if (m_parserStopped) - return; - - if (m_parserPaused) { - m_pendingCallbacks->appendEndElementNSCallback(); - return; - } - - exitText(); - - Node* n = m_currentNode; - n->finishParsingChildren(); - - if (m_scriptingPermission == FragmentScriptingNotAllowed && n->isElementNode() && toScriptElement(static_cast<Element*>(n))) { - popCurrentNode(); - ExceptionCode ec; - n->remove(ec); - return; - } - - if (!n->isElementNode() || !m_view) { - popCurrentNode(); - return; - } - - Element* element = static_cast<Element*>(n); - - // The element's parent may have already been removed from document. - // Parsing continues in this case, but scripts aren't executed. - if (!element->inDocument()) { - popCurrentNode(); - return; - } - - ScriptElement* scriptElement = toScriptElement(element); - if (!scriptElement) { - popCurrentNode(); - return; - } - - // Don't load external scripts for standalone documents (for now). - ASSERT(!m_pendingScript); - m_requestingScript = true; - -#if ENABLE(XHTMLMP) - if (!scriptElement->shouldExecuteAsJavaScript()) - m_doc->setShouldProcessNoscriptElement(true); - else -#endif - { - String scriptHref = scriptElement->sourceAttributeValue(); - if (!scriptHref.isEmpty()) { - // we have a src attribute - String scriptCharset = scriptElement->scriptCharset(); - if (element->dispatchBeforeLoadEvent(scriptHref) && - (m_pendingScript = m_doc->docLoader()->requestScript(scriptHref, scriptCharset))) { - m_scriptElement = element; - m_pendingScript->addClient(this); - - // m_pendingScript will be 0 if script was already loaded and ref() executed it - if (m_pendingScript) - pauseParsing(); - } else - m_scriptElement = 0; - } else - m_view->frame()->script()->executeScript(ScriptSourceCode(scriptElement->scriptContent(), m_doc->url(), m_scriptStartLine)); - } - m_requestingScript = false; - popCurrentNode(); -} - -void XMLTokenizer::characters(const xmlChar* s, int len) -{ - if (m_parserStopped) - return; - - if (m_parserPaused) { - m_pendingCallbacks->appendCharactersCallback(s, len); - return; - } - - if (m_currentNode->isTextNode() || enterText()) - m_bufferedText.append(s, len); -} - -void XMLTokenizer::error(ErrorType type, const char* message, va_list args) -{ - if (m_parserStopped) - return; - -#if COMPILER(MSVC) || COMPILER(RVCT) - char m[1024]; - vsnprintf(m, sizeof(m) - 1, message, args); -#else - char* m; - if (vasprintf(&m, message, args) == -1) - return; -#endif - - if (m_parserPaused) - m_pendingCallbacks->appendErrorCallback(type, reinterpret_cast<const xmlChar*>(m), lineNumber(), columnNumber()); - else - handleError(type, m, lineNumber(), columnNumber()); - -#if !COMPILER(MSVC) && !COMPILER(RVCT) - free(m); -#endif -} - -void XMLTokenizer::processingInstruction(const xmlChar* target, const xmlChar* data) -{ - if (m_parserStopped) - return; - - if (m_parserPaused) { - m_pendingCallbacks->appendProcessingInstructionCallback(target, data); - return; - } - - exitText(); - - // ### handle exceptions - int exception = 0; - RefPtr<ProcessingInstruction> pi = m_doc->createProcessingInstruction( - toString(target), toString(data), exception); - if (exception) - return; - - pi->setCreatedByParser(true); - - if (!m_currentNode->addChild(pi.get())) - return; - if (m_view && !pi->attached()) - pi->attach(); - - pi->finishParsingChildren(); - -#if ENABLE(XSLT) - m_sawXSLTransform = !m_sawFirstElement && pi->isXSL(); - if (m_sawXSLTransform && !m_doc->transformSourceDocument()) - stopParsing(); -#endif -} - -void XMLTokenizer::cdataBlock(const xmlChar* s, int len) -{ - if (m_parserStopped) - return; - - if (m_parserPaused) { - m_pendingCallbacks->appendCDATABlockCallback(s, len); - return; - } - - exitText(); - - RefPtr<Node> newNode = CDATASection::create(m_doc, toString(s, len)); - if (!m_currentNode->addChild(newNode.get())) - return; - if (m_view && !newNode->attached()) - newNode->attach(); -} - -void XMLTokenizer::comment(const xmlChar* s) -{ - if (m_parserStopped) - return; - - if (m_parserPaused) { - m_pendingCallbacks->appendCommentCallback(s); - return; - } - - exitText(); - - RefPtr<Node> newNode = Comment::create(m_doc, toString(s)); - m_currentNode->addChild(newNode.get()); - if (m_view && !newNode->attached()) - newNode->attach(); -} - -void XMLTokenizer::startDocument(const xmlChar* version, const xmlChar* encoding, int standalone) -{ - ExceptionCode ec = 0; - - if (version) - m_doc->setXMLVersion(toString(version), ec); - m_doc->setXMLStandalone(standalone == 1, ec); // possible values are 0, 1, and -1 - if (encoding) - m_doc->setXMLEncoding(toString(encoding)); -} - -void XMLTokenizer::endDocument() -{ - exitText(); -#if ENABLE(XHTMLMP) - m_hasDocTypeDeclaration = false; -#endif -} - -void XMLTokenizer::internalSubset(const xmlChar* name, const xmlChar* externalID, const xmlChar* systemID) -{ - if (m_parserStopped) - return; - - if (m_parserPaused) { - m_pendingCallbacks->appendInternalSubsetCallback(name, externalID, systemID); - return; - } - - if (m_doc) { -#if ENABLE(WML) || ENABLE(XHTMLMP) - String extId = toString(externalID); -#endif -#if ENABLE(WML) - if (isWMLDocument() - && extId != "-//WAPFORUM//DTD WML 1.3//EN" - && extId != "-//WAPFORUM//DTD WML 1.2//EN" - && extId != "-//WAPFORUM//DTD WML 1.1//EN" - && extId != "-//WAPFORUM//DTD WML 1.0//EN") - handleError(fatal, "Invalid DTD Public ID", lineNumber(), columnNumber()); -#endif -#if ENABLE(XHTMLMP) - String dtdName = toString(name); - if (extId == "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" - || extId == "-//WAPFORUM//DTD XHTML Mobile 1.1//EN") { - if (dtdName != HTMLNames::htmlTag.localName()) { - handleError(fatal, "Invalid DOCTYPE declaration, expected 'html' as root element.", lineNumber(), columnNumber()); - return; - } - - if (m_doc->isXHTMLMPDocument()) - setIsXHTMLMPDocument(true); - else - setIsXHTMLDocument(true); - - m_hasDocTypeDeclaration = true; - } -#endif - - m_doc->addChild(DocumentType::create(m_doc, toString(name), toString(externalID), toString(systemID))); - } -} - -static inline XMLTokenizer* getTokenizer(void* closure) -{ - xmlParserCtxtPtr ctxt = static_cast<xmlParserCtxtPtr>(closure); - return static_cast<XMLTokenizer*>(ctxt->_private); -} - -// This is a hack around http://bugzilla.gnome.org/show_bug.cgi?id=159219 -// Otherwise libxml seems to call all the SAX callbacks twice for any replaced entity. -static inline bool hackAroundLibXMLEntityBug(void* closure) -{ -#if LIBXML_VERSION >= 20627 - UNUSED_PARAM(closure); - - // This bug has been fixed in libxml 2.6.27. - return false; -#else - return static_cast<xmlParserCtxtPtr>(closure)->node; -#endif -} - -static void startElementNsHandler(void* closure, const xmlChar* localname, const xmlChar* prefix, const xmlChar* uri, int nb_namespaces, const xmlChar** namespaces, int nb_attributes, int nb_defaulted, const xmlChar** libxmlAttributes) -{ - if (hackAroundLibXMLEntityBug(closure)) - return; - - getTokenizer(closure)->startElementNs(localname, prefix, uri, nb_namespaces, namespaces, nb_attributes, nb_defaulted, libxmlAttributes); -} - -static void endElementNsHandler(void* closure, const xmlChar*, const xmlChar*, const xmlChar*) -{ - if (hackAroundLibXMLEntityBug(closure)) - return; - - getTokenizer(closure)->endElementNs(); -} - -static void charactersHandler(void* closure, const xmlChar* s, int len) -{ - if (hackAroundLibXMLEntityBug(closure)) - return; - - getTokenizer(closure)->characters(s, len); -} - -static void processingInstructionHandler(void* closure, const xmlChar* target, const xmlChar* data) -{ - if (hackAroundLibXMLEntityBug(closure)) - return; - - getTokenizer(closure)->processingInstruction(target, data); -} - -static void cdataBlockHandler(void* closure, const xmlChar* s, int len) -{ - if (hackAroundLibXMLEntityBug(closure)) - return; - - getTokenizer(closure)->cdataBlock(s, len); -} - -static void commentHandler(void* closure, const xmlChar* comment) -{ - if (hackAroundLibXMLEntityBug(closure)) - return; - - getTokenizer(closure)->comment(comment); -} - -WTF_ATTRIBUTE_PRINTF(2, 3) -static void warningHandler(void* closure, const char* message, ...) -{ - va_list args; - va_start(args, message); - getTokenizer(closure)->error(XMLTokenizer::warning, message, args); - va_end(args); -} - -WTF_ATTRIBUTE_PRINTF(2, 3) -static void fatalErrorHandler(void* closure, const char* message, ...) -{ - va_list args; - va_start(args, message); - getTokenizer(closure)->error(XMLTokenizer::fatal, message, args); - va_end(args); -} - -WTF_ATTRIBUTE_PRINTF(2, 3) -static void normalErrorHandler(void* closure, const char* message, ...) -{ - va_list args; - va_start(args, message); - getTokenizer(closure)->error(XMLTokenizer::nonFatal, message, args); - va_end(args); -} - -// Using a static entity and marking it XML_INTERNAL_PREDEFINED_ENTITY is -// a hack to avoid malloc/free. Using a global variable like this could cause trouble -// if libxml implementation details were to change -static xmlChar sharedXHTMLEntityResult[5] = {0, 0, 0, 0, 0}; - -static xmlEntityPtr sharedXHTMLEntity() -{ - static xmlEntity entity; - if (!entity.type) { - entity.type = XML_ENTITY_DECL; - entity.orig = sharedXHTMLEntityResult; - entity.content = sharedXHTMLEntityResult; - entity.etype = XML_INTERNAL_PREDEFINED_ENTITY; - } - return &entity; -} - -static xmlEntityPtr getXHTMLEntity(const xmlChar* name) -{ - UChar c = decodeNamedEntity(reinterpret_cast<const char*>(name)); - if (!c) - return 0; - - CString value = String(&c, 1).utf8(); - ASSERT(value.length() < 5); - xmlEntityPtr entity = sharedXHTMLEntity(); - entity->length = value.length(); - entity->name = name; - memcpy(sharedXHTMLEntityResult, value.data(), entity->length + 1); - - return entity; -} - -static xmlEntityPtr getEntityHandler(void* closure, const xmlChar* name) -{ - xmlParserCtxtPtr ctxt = static_cast<xmlParserCtxtPtr>(closure); - xmlEntityPtr ent = xmlGetPredefinedEntity(name); - if (ent) { - ent->etype = XML_INTERNAL_PREDEFINED_ENTITY; - return ent; - } - - ent = xmlGetDocEntity(ctxt->myDoc, name); - if (!ent && (getTokenizer(closure)->isXHTMLDocument() -#if ENABLE(XHTMLMP) - || getTokenizer(closure)->isXHTMLMPDocument() -#endif -#if ENABLE(WML) - || getTokenizer(closure)->isWMLDocument() -#endif - )) { - ent = getXHTMLEntity(name); - if (ent) - ent->etype = XML_INTERNAL_GENERAL_ENTITY; - } - - return ent; -} - -static void startDocumentHandler(void* closure) -{ - xmlParserCtxt* ctxt = static_cast<xmlParserCtxt*>(closure); - getTokenizer(closure)->startDocument(ctxt->version, ctxt->encoding, ctxt->standalone); - xmlSAX2StartDocument(closure); -} - -static void endDocumentHandler(void* closure) -{ - getTokenizer(closure)->endDocument(); - xmlSAX2EndDocument(closure); -} - -static void internalSubsetHandler(void* closure, const xmlChar* name, const xmlChar* externalID, const xmlChar* systemID) -{ - getTokenizer(closure)->internalSubset(name, externalID, systemID); - xmlSAX2InternalSubset(closure, name, externalID, systemID); -} - -static void externalSubsetHandler(void* closure, const xmlChar*, const xmlChar* externalId, const xmlChar*) -{ - String extId = toString(externalId); - if ((extId == "-//W3C//DTD XHTML 1.0 Transitional//EN") - || (extId == "-//W3C//DTD XHTML 1.1//EN") - || (extId == "-//W3C//DTD XHTML 1.0 Strict//EN") - || (extId == "-//W3C//DTD XHTML 1.0 Frameset//EN") - || (extId == "-//W3C//DTD XHTML Basic 1.0//EN") - || (extId == "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN") - || (extId == "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN") - || (extId == "-//WAPFORUM//DTD XHTML Mobile 1.0//EN") - ) - getTokenizer(closure)->setIsXHTMLDocument(true); // controls if we replace entities or not. -} - -static void ignorableWhitespaceHandler(void*, const xmlChar*, int) -{ - // nothing to do, but we need this to work around a crasher - // http://bugzilla.gnome.org/show_bug.cgi?id=172255 - // http://bugs.webkit.org/show_bug.cgi?id=5792 -} - -void XMLTokenizer::initializeParserContext(const char* chunk) -{ - xmlSAXHandler sax; - memset(&sax, 0, sizeof(sax)); - - sax.error = normalErrorHandler; - sax.fatalError = fatalErrorHandler; - sax.characters = charactersHandler; - sax.processingInstruction = processingInstructionHandler; - sax.cdataBlock = cdataBlockHandler; - sax.comment = commentHandler; - sax.warning = warningHandler; - sax.startElementNs = startElementNsHandler; - sax.endElementNs = endElementNsHandler; - sax.getEntity = getEntityHandler; - sax.startDocument = startDocumentHandler; - sax.endDocument = endDocumentHandler; - sax.internalSubset = internalSubsetHandler; - sax.externalSubset = externalSubsetHandler; - sax.ignorableWhitespace = ignorableWhitespaceHandler; - sax.entityDecl = xmlSAX2EntityDecl; - sax.initialized = XML_SAX2_MAGIC; - m_parserStopped = false; - m_sawError = false; - m_sawXSLTransform = false; - m_sawFirstElement = false; - - XMLTokenizerScope scope(m_doc->docLoader()); - if (m_parsingFragment) - m_context = XMLParserContext::createMemoryParser(&sax, this, chunk); - else - m_context = XMLParserContext::createStringParser(&sax, this); -} - -void XMLTokenizer::doEnd() -{ -#if ENABLE(XSLT) - if (m_sawXSLTransform) { - void* doc = xmlDocPtrForString(m_doc->docLoader(), m_originalSourceForTransform, m_doc->url().string()); - m_doc->setTransformSource(new TransformSource(doc)); - - m_doc->setParsing(false); // Make the doc think it's done, so it will apply xsl sheets. - m_doc->updateStyleSelector(); - m_doc->setParsing(true); - m_parserStopped = true; - } -#endif - - if (m_parserStopped) - return; - - if (m_context) { - // Tell libxml we're done. - { - XMLTokenizerScope scope(m_doc->docLoader()); - xmlParseChunk(context(), 0, 0, 1); - } - - m_context = 0; - } -} - -#if ENABLE(XSLT) -void* xmlDocPtrForString(DocLoader* docLoader, const String& source, const String& url) -{ - if (source.isEmpty()) - return 0; - - // Parse in a single chunk into an xmlDocPtr - // FIXME: Hook up error handlers so that a failure to parse the main document results in - // good error messages. - const UChar BOM = 0xFEFF; - const unsigned char BOMHighByte = *reinterpret_cast<const unsigned char*>(&BOM); - - XMLTokenizerScope scope(docLoader, errorFunc, 0); - xmlDocPtr sourceDoc = xmlReadMemory(reinterpret_cast<const char*>(source.characters()), - source.length() * sizeof(UChar), - url.latin1().data(), - BOMHighByte == 0xFF ? "UTF-16LE" : "UTF-16BE", - XSLT_PARSE_OPTIONS); - return sourceDoc; -} -#endif - -int XMLTokenizer::lineNumber() const -{ - return context() ? context()->input->line : 1; -} - -int XMLTokenizer::columnNumber() const -{ - return context() ? context()->input->col : 1; -} - -void XMLTokenizer::stopParsing() -{ - Tokenizer::stopParsing(); - if (context()) - xmlStopParser(context()); -} - -void XMLTokenizer::resumeParsing() -{ - ASSERT(m_parserPaused); - - m_parserPaused = false; - - // First, execute any pending callbacks - while (!m_pendingCallbacks->isEmpty()) { - m_pendingCallbacks->callAndRemoveFirstCallback(this); - - // A callback paused the parser - if (m_parserPaused) - return; - } - - // Then, write any pending data - SegmentedString rest = m_pendingSrc; - m_pendingSrc.clear(); - write(rest, false); - - // Finally, if finish() has been called and write() didn't result - // in any further callbacks being queued, call end() - if (m_finishCalled && m_pendingCallbacks->isEmpty()) - end(); -} - -bool parseXMLDocumentFragment(const String& chunk, DocumentFragment* fragment, Element* parent, FragmentScriptingPermission scriptingPermission) -{ - if (!chunk.length()) - return true; - - XMLTokenizer tokenizer(fragment, parent, scriptingPermission); - - CString chunkAsUtf8 = chunk.utf8(); - tokenizer.initializeParserContext(chunkAsUtf8.data()); - - xmlParseContent(tokenizer.context()); - - tokenizer.endDocument(); - - // Check if all the chunk has been processed. - long bytesProcessed = xmlByteConsumed(tokenizer.context()); - if (bytesProcessed == -1 || ((unsigned long)bytesProcessed) != chunkAsUtf8.length()) - return false; - - // No error if the chunk is well formed or it is not but we have no error. - return tokenizer.context()->wellFormed || xmlCtxtGetLastError(tokenizer.context()) == 0; -} - -// -------------------------------- - -struct AttributeParseState { - HashMap<String, String> attributes; - bool gotAttributes; -}; - -static void attributesStartElementNsHandler(void* closure, const xmlChar* xmlLocalName, const xmlChar* /*xmlPrefix*/, - const xmlChar* /*xmlURI*/, int /*nb_namespaces*/, const xmlChar** /*namespaces*/, - int nb_attributes, int /*nb_defaulted*/, const xmlChar** libxmlAttributes) -{ - if (strcmp(reinterpret_cast<const char*>(xmlLocalName), "attrs") != 0) - return; - - xmlParserCtxtPtr ctxt = static_cast<xmlParserCtxtPtr>(closure); - AttributeParseState* state = static_cast<AttributeParseState*>(ctxt->_private); - - state->gotAttributes = true; - - xmlSAX2Attributes* attributes = reinterpret_cast<xmlSAX2Attributes*>(libxmlAttributes); - for (int i = 0; i < nb_attributes; i++) { - String attrLocalName = toString(attributes[i].localname); - int valueLength = (int) (attributes[i].end - attributes[i].value); - String attrValue = toString(attributes[i].value, valueLength); - String attrPrefix = toString(attributes[i].prefix); - String attrQName = attrPrefix.isEmpty() ? attrLocalName : attrPrefix + ":" + attrLocalName; - - state->attributes.set(attrQName, attrValue); - } -} - -HashMap<String, String> parseAttributes(const String& string, bool& attrsOK) -{ - AttributeParseState state; - state.gotAttributes = false; - - xmlSAXHandler sax; - memset(&sax, 0, sizeof(sax)); - sax.startElementNs = attributesStartElementNsHandler; - sax.initialized = XML_SAX2_MAGIC; - RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state); - String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; - xmlParseChunk(parser->context(), reinterpret_cast<const char*>(parseString.characters()), parseString.length() * sizeof(UChar), 1); - attrsOK = state.gotAttributes; - return state.attributes; -} - -} diff --git a/WebCore/dom/XMLTokenizerQt.cpp b/WebCore/dom/XMLTokenizerQt.cpp deleted file mode 100644 index 2f76b28..0000000 --- a/WebCore/dom/XMLTokenizerQt.cpp +++ /dev/null @@ -1,717 +0,0 @@ -/* - * Copyright (C) 2000 Peter Kelly (pmk@post.com) - * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. - * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) - * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) - * Copyright (C) 2008 Holger Hans Peter Freyther - * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) - * - * 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 "XMLTokenizer.h" - -#include "CDATASection.h" -#include "CachedScript.h" -#include "Comment.h" -#include "DocLoader.h" -#include "Document.h" -#include "DocumentFragment.h" -#include "DocumentType.h" -#include "Frame.h" -#include "FrameLoader.h" -#include "FrameView.h" -#include "HTMLLinkElement.h" -#include "HTMLStyleElement.h" -#include "HTMLTokenizer.h" -#include "ProcessingInstruction.h" -#include "ResourceError.h" -#include "ResourceHandle.h" -#include "ResourceRequest.h" -#include "ResourceResponse.h" -#include "ScriptController.h" -#include "ScriptElement.h" -#include "ScriptSourceCode.h" -#include "ScriptValue.h" -#include "TextResourceDecoder.h" -#include "TransformSource.h" -#include <QDebug> -#include <wtf/StringExtras.h> -#include <wtf/Threading.h> -#include <wtf/Vector.h> -#include <wtf/text/CString.h> - -#if ENABLE(XHTMLMP) -#include "HTMLNames.h" -#include "HTMLScriptElement.h" -#endif - -using namespace std; - -namespace WebCore { - -class EntityResolver : public QXmlStreamEntityResolver { - virtual QString resolveUndeclaredEntity(const QString &name); -}; - -QString EntityResolver::resolveUndeclaredEntity(const QString &name) -{ - UChar c = decodeNamedEntity(name.toUtf8().constData()); - return QString(c); -} - -// -------------------------------- - -XMLTokenizer::XMLTokenizer(Document* _doc, FrameView* _view) - : m_doc(_doc) - , m_view(_view) - , m_wroteText(false) - , m_currentNode(_doc) - , m_sawError(false) - , m_sawXSLTransform(false) - , m_sawFirstElement(false) - , m_isXHTMLDocument(false) -#if ENABLE(XHTMLMP) - , m_isXHTMLMPDocument(false) - , m_hasDocTypeDeclaration(false) -#endif - , m_parserPaused(false) - , m_requestingScript(false) - , m_finishCalled(false) - , m_errorCount(0) - , m_lastErrorLine(0) - , m_lastErrorColumn(0) - , m_pendingScript(0) - , m_scriptStartLine(0) - , m_parsingFragment(false) - , m_scriptingPermission(FragmentScriptingAllowed) -{ - m_stream.setEntityResolver(new EntityResolver); -} - -XMLTokenizer::XMLTokenizer(DocumentFragment* fragment, Element* parentElement, FragmentScriptingPermission permission) - : m_doc(fragment->document()) - , m_view(0) - , m_wroteText(false) - , m_currentNode(fragment) - , m_sawError(false) - , m_sawXSLTransform(false) - , m_sawFirstElement(false) - , m_isXHTMLDocument(false) -#if ENABLE(XHTMLMP) - , m_isXHTMLMPDocument(false) - , m_hasDocTypeDeclaration(false) -#endif - , m_parserPaused(false) - , m_requestingScript(false) - , m_finishCalled(false) - , m_errorCount(0) - , m_lastErrorLine(0) - , m_lastErrorColumn(0) - , m_pendingScript(0) - , m_scriptStartLine(0) - , m_parsingFragment(true) - , m_scriptingPermission(permission) -{ - fragment->ref(); - if (m_doc) - m_doc->ref(); - - // Add namespaces based on the parent node - Vector<Element*> elemStack; - while (parentElement) { - elemStack.append(parentElement); - - Node* n = parentElement->parentNode(); - if (!n || !n->isElementNode()) - break; - parentElement = static_cast<Element*>(n); - } - - if (elemStack.isEmpty()) - return; - - QXmlStreamNamespaceDeclarations namespaces; - for (Element* element = elemStack.last(); !elemStack.isEmpty(); elemStack.removeLast()) { - if (NamedNodeMap* attrs = element->attributes()) { - for (unsigned i = 0; i < attrs->length(); i++) { - Attribute* attr = attrs->attributeItem(i); - if (attr->localName() == "xmlns") - m_defaultNamespaceURI = attr->value(); - else if (attr->prefix() == "xmlns") - namespaces.append(QXmlStreamNamespaceDeclaration(attr->localName(), attr->value())); - } - } - } - m_stream.addExtraNamespaceDeclarations(namespaces); - m_stream.setEntityResolver(new EntityResolver); - - // If the parent element is not in document tree, there may be no xmlns attribute; just default to the parent's namespace. - if (m_defaultNamespaceURI.isNull() && !parentElement->inDocument()) - m_defaultNamespaceURI = parentElement->namespaceURI(); -} - -XMLTokenizer::~XMLTokenizer() -{ - clearCurrentNodeStack(); - if (m_parsingFragment && m_doc) - m_doc->deref(); - if (m_pendingScript) - m_pendingScript->removeClient(this); - delete m_stream.entityResolver(); -} - -void XMLTokenizer::doWrite(const String& parseString) -{ - m_wroteText = true; - - if (m_doc->decoder() && m_doc->decoder()->sawError()) { - // If the decoder saw an error, report it as fatal (stops parsing) - handleError(fatal, "Encoding error", lineNumber(), columnNumber()); - return; - } - - QString data(parseString); - if (!data.isEmpty()) { - m_stream.addData(data); - parse(); - } - - return; -} - -void XMLTokenizer::initializeParserContext(const char*) -{ - m_parserStopped = false; - m_sawError = false; - m_sawXSLTransform = false; - m_sawFirstElement = false; -} - -void XMLTokenizer::doEnd() -{ -#if ENABLE(XSLT) - if (m_sawXSLTransform) { - m_doc->setTransformSource(new TransformSource(m_originalSourceForTransform)); - m_doc->setParsing(false); // Make the doc think it's done, so it will apply xsl sheets. - m_doc->updateStyleSelector(); - m_doc->setParsing(true); - m_parserStopped = true; - } -#endif - - if (m_stream.error() == QXmlStreamReader::PrematureEndOfDocumentError - || (m_wroteText && !m_sawFirstElement && !m_sawXSLTransform && !m_sawError)) - handleError(fatal, qPrintable(m_stream.errorString()), lineNumber(), columnNumber()); -} - -int XMLTokenizer::lineNumber() const -{ - return m_stream.lineNumber(); -} - -int XMLTokenizer::columnNumber() const -{ - return m_stream.columnNumber(); -} - -void XMLTokenizer::stopParsing() -{ - Tokenizer::stopParsing(); -} - -void XMLTokenizer::resumeParsing() -{ - ASSERT(m_parserPaused); - - m_parserPaused = false; - - // First, execute any pending callbacks - parse(); - if (m_parserPaused) - return; - - // Then, write any pending data - SegmentedString rest = m_pendingSrc; - m_pendingSrc.clear(); - write(rest, false); - - // Finally, if finish() has been called and write() didn't result - // in any further callbacks being queued, call end() - if (m_finishCalled && !m_parserPaused && !m_pendingScript) - end(); -} - -bool parseXMLDocumentFragment(const String& chunk, DocumentFragment* fragment, Element* parent, FragmentScriptingPermission scriptingPermission) -{ - if (!chunk.length()) - return true; - - XMLTokenizer tokenizer(fragment, parent, scriptingPermission); - - tokenizer.write(String("<qxmlstreamdummyelement>"), false); - tokenizer.write(chunk, false); - tokenizer.write(String("</qxmlstreamdummyelement>"), false); - tokenizer.finish(); - return !tokenizer.hasError(); -} - -// -------------------------------- - -struct AttributeParseState { - HashMap<String, String> attributes; - bool gotAttributes; -}; - -static void attributesStartElementNsHandler(AttributeParseState* state, const QXmlStreamAttributes& attrs) -{ - if (attrs.count() <= 0) - return; - - state->gotAttributes = true; - - for (int i = 0; i < attrs.count(); i++) { - const QXmlStreamAttribute& attr = attrs[i]; - String attrLocalName = attr.name(); - String attrValue = attr.value(); - String attrURI = attr.namespaceUri(); - String attrQName = attr.qualifiedName(); - state->attributes.set(attrQName, attrValue); - } -} - -HashMap<String, String> parseAttributes(const String& string, bool& attrsOK) -{ - AttributeParseState state; - state.gotAttributes = false; - - QXmlStreamReader stream; - QString dummy = QString(QLatin1String("<?xml version=\"1.0\"?><attrs %1 />")).arg(string); - stream.addData(dummy); - while (!stream.atEnd()) { - stream.readNext(); - if (stream.isStartElement()) { - attributesStartElementNsHandler(&state, stream.attributes()); - } - } - attrsOK = state.gotAttributes; - return state.attributes; -} - -static inline String prefixFromQName(const QString& qName) -{ - const int offset = qName.indexOf(QLatin1Char(':')); - if (offset <= 0) - return String(); - else - return qName.left(offset); -} - -static inline void handleElementNamespaces(Element* newElement, const QXmlStreamNamespaceDeclarations &ns, - ExceptionCode& ec, FragmentScriptingPermission scriptingPermission) -{ - for (int i = 0; i < ns.count(); ++i) { - const QXmlStreamNamespaceDeclaration &decl = ns[i]; - String namespaceURI = decl.namespaceUri(); - String namespaceQName = decl.prefix().isEmpty() ? String("xmlns") : String("xmlns:") + String(decl.prefix()); - newElement->setAttributeNS("http://www.w3.org/2000/xmlns/", namespaceQName, namespaceURI, ec, scriptingPermission); - if (ec) // exception setting attributes - return; - } -} - -static inline void handleElementAttributes(Element* newElement, const QXmlStreamAttributes &attrs, ExceptionCode& ec, - FragmentScriptingPermission scriptingPermission) -{ - for (int i = 0; i < attrs.count(); ++i) { - const QXmlStreamAttribute &attr = attrs[i]; - String attrLocalName = attr.name(); - String attrValue = attr.value(); - String attrURI = attr.namespaceUri().isEmpty() ? String() : String(attr.namespaceUri()); - String attrQName = attr.qualifiedName(); - newElement->setAttributeNS(attrURI, attrQName, attrValue, ec, scriptingPermission); - if (ec) // exception setting attributes - return; - } -} - -void XMLTokenizer::parse() -{ - while (!m_parserStopped && !m_parserPaused && !m_stream.atEnd()) { - m_stream.readNext(); - switch (m_stream.tokenType()) { - case QXmlStreamReader::StartDocument: { - startDocument(); - } - break; - case QXmlStreamReader::EndDocument: { - endDocument(); - } - break; - case QXmlStreamReader::StartElement: { -#if ENABLE(XHTMLMP) - if (m_doc->isXHTMLMPDocument() && !m_hasDocTypeDeclaration) { - handleError(fatal, "DOCTYPE declaration lost.", lineNumber(), columnNumber()); - break; - } -#endif - parseStartElement(); - } - break; - case QXmlStreamReader::EndElement: { - parseEndElement(); - } - break; - case QXmlStreamReader::Characters: { - if (m_stream.isCDATA()) { - //cdata - parseCdata(); - } else { - //characters - parseCharacters(); - } - } - break; - case QXmlStreamReader::Comment: { - parseComment(); - } - break; - case QXmlStreamReader::DTD: { - //qDebug()<<"------------- DTD"; - parseDtd(); -#if ENABLE(XHTMLMP) - m_hasDocTypeDeclaration = true; -#endif - } - break; - case QXmlStreamReader::EntityReference: { - //qDebug()<<"---------- ENTITY = "<<m_stream.name().toString() - // <<", t = "<<m_stream.text().toString(); - if (isXHTMLDocument() -#if ENABLE(XHTMLMP) - || isXHTMLMPDocument() -#endif -#if ENABLE(WML) - || isWMLDocument() -#endif - ) { - QString entity = m_stream.name().toString(); - UChar c = decodeNamedEntity(entity.toUtf8().constData()); - if (m_currentNode->isTextNode() || enterText()) { - ExceptionCode ec = 0; - String str(&c, 1); - //qDebug()<<" ------- adding entity "<<str; - static_cast<Text*>(m_currentNode)->appendData(str, ec); - } - } - } - break; - case QXmlStreamReader::ProcessingInstruction: { - parseProcessingInstruction(); - } - break; - default: { - if (m_stream.error() != QXmlStreamReader::PrematureEndOfDocumentError) { - ErrorType type = (m_stream.error() == QXmlStreamReader::NotWellFormedError) ? - fatal : warning; - handleError(type, qPrintable(m_stream.errorString()), lineNumber(), - columnNumber()); - } - } - break; - } - } -} - -void XMLTokenizer::startDocument() -{ - initializeParserContext(); - ExceptionCode ec = 0; - - if (!m_parsingFragment) { - m_doc->setXMLStandalone(m_stream.isStandaloneDocument(), ec); - - QStringRef version = m_stream.documentVersion(); - if (!version.isEmpty()) - m_doc->setXMLVersion(version, ec); - QStringRef encoding = m_stream.documentEncoding(); - if (!encoding.isEmpty()) - m_doc->setXMLEncoding(encoding); - } -} - -void XMLTokenizer::parseStartElement() -{ - if (!m_sawFirstElement && m_parsingFragment) { - // skip dummy element for fragments - m_sawFirstElement = true; - return; - } - - exitText(); - - String localName = m_stream.name(); - String uri = m_stream.namespaceUri(); - String prefix = prefixFromQName(m_stream.qualifiedName().toString()); - - if (m_parsingFragment && uri.isNull()) { - Q_ASSERT(prefix.isNull()); - uri = m_defaultNamespaceURI; - } - - QualifiedName qName(prefix, localName, uri); - RefPtr<Element> newElement = m_doc->createElement(qName, true); - if (!newElement) { - stopParsing(); - return; - } - -#if ENABLE(XHTMLMP) - if (!m_sawFirstElement && isXHTMLMPDocument()) { - // As per 7.1 section of OMA-WAP-XHTMLMP-V1_1-20061020-A.pdf, - // we should make sure that the root element MUST be 'html' and - // ensure the name of the default namespace on the root elment 'html' - // MUST be 'http://www.w3.org/1999/xhtml' - if (localName != HTMLNames::htmlTag.localName()) { - handleError(fatal, "XHTMLMP document expects 'html' as root element.", lineNumber(), columnNumber()); - return; - } - - if (uri.isNull()) { - m_defaultNamespaceURI = HTMLNames::xhtmlNamespaceURI; - uri = m_defaultNamespaceURI; - m_stream.addExtraNamespaceDeclaration(QXmlStreamNamespaceDeclaration(prefix, HTMLNames::xhtmlNamespaceURI)); - } - } -#endif - - bool isFirstElement = !m_sawFirstElement; - m_sawFirstElement = true; - - ExceptionCode ec = 0; - handleElementNamespaces(newElement.get(), m_stream.namespaceDeclarations(), ec, m_scriptingPermission); - if (ec) { - stopParsing(); - return; - } - - handleElementAttributes(newElement.get(), m_stream.attributes(), ec, m_scriptingPermission); - if (ec) { - stopParsing(); - return; - } - - ScriptElement* scriptElement = toScriptElement(newElement.get()); - if (scriptElement) - m_scriptStartLine = lineNumber(); - - if (!m_currentNode->addChild(newElement.get())) { - stopParsing(); - return; - } - - pushCurrentNode(newElement.get()); - if (m_view && !newElement->attached()) - newElement->attach(); - - if (isFirstElement && m_doc->frame()) - m_doc->frame()->loader()->dispatchDocumentElementAvailable(); -} - -void XMLTokenizer::parseEndElement() -{ - exitText(); - - Node* n = m_currentNode; - n->finishParsingChildren(); - - if (m_scriptingPermission == FragmentScriptingNotAllowed && n->isElementNode() && toScriptElement(static_cast<Element*>(n))) { - popCurrentNode(); - ExceptionCode ec; - n->remove(ec); - return; - } - - if (!n->isElementNode() || !m_view) { - if (!m_currentNodeStack.isEmpty()) - popCurrentNode(); - return; - } - - Element* element = static_cast<Element*>(n); - - // The element's parent may have already been removed from document. - // Parsing continues in this case, but scripts aren't executed. - if (!element->inDocument()) { - popCurrentNode(); - return; - } - - ScriptElement* scriptElement = toScriptElement(element); - if (!scriptElement) { - popCurrentNode(); - return; - } - - // don't load external scripts for standalone documents (for now) - ASSERT(!m_pendingScript); - m_requestingScript = true; - -#if ENABLE(XHTMLMP) - if (!scriptElement->shouldExecuteAsJavaScript()) - m_doc->setShouldProcessNoscriptElement(true); - else -#endif - { - String scriptHref = scriptElement->sourceAttributeValue(); - if (!scriptHref.isEmpty()) { - // we have a src attribute - String scriptCharset = scriptElement->scriptCharset(); - if (element->dispatchBeforeLoadEvent(scriptHref) && - (m_pendingScript = m_doc->docLoader()->requestScript(scriptHref, scriptCharset))) { - m_scriptElement = element; - m_pendingScript->addClient(this); - - // m_pendingScript will be 0 if script was already loaded and ref() executed it - if (m_pendingScript) - pauseParsing(); - } else - m_scriptElement = 0; - } else - m_view->frame()->script()->executeScript(ScriptSourceCode(scriptElement->scriptContent(), m_doc->url(), m_scriptStartLine)); - } - m_requestingScript = false; - popCurrentNode(); -} - -void XMLTokenizer::parseCharacters() -{ - if (m_currentNode->isTextNode() || enterText()) { - ExceptionCode ec = 0; - static_cast<Text*>(m_currentNode)->appendData(m_stream.text(), ec); - } -} - -void XMLTokenizer::parseProcessingInstruction() -{ - exitText(); - - // ### handle exceptions - int exception = 0; - RefPtr<ProcessingInstruction> pi = m_doc->createProcessingInstruction( - m_stream.processingInstructionTarget(), - m_stream.processingInstructionData(), exception); - if (exception) - return; - - pi->setCreatedByParser(true); - - if (!m_currentNode->addChild(pi.get())) - return; - if (m_view && !pi->attached()) - pi->attach(); - - pi->finishParsingChildren(); - -#if ENABLE(XSLT) - m_sawXSLTransform = !m_sawFirstElement && pi->isXSL(); - if (m_sawXSLTransform && !m_doc->transformSourceDocument()) - stopParsing(); -#endif -} - -void XMLTokenizer::parseCdata() -{ - exitText(); - - RefPtr<Node> newNode = CDATASection::create(m_doc, m_stream.text()); - if (!m_currentNode->addChild(newNode.get())) - return; - if (m_view && !newNode->attached()) - newNode->attach(); -} - -void XMLTokenizer::parseComment() -{ - exitText(); - - RefPtr<Node> newNode = Comment::create(m_doc, m_stream.text()); - m_currentNode->addChild(newNode.get()); - if (m_view && !newNode->attached()) - newNode->attach(); -} - -void XMLTokenizer::endDocument() -{ -#if ENABLE(XHTMLMP) - m_hasDocTypeDeclaration = false; -#endif -} - -bool XMLTokenizer::hasError() const -{ - return m_stream.hasError(); -} - -void XMLTokenizer::parseDtd() -{ - QStringRef name = m_stream.dtdName(); - QStringRef publicId = m_stream.dtdPublicId(); - QStringRef systemId = m_stream.dtdSystemId(); - - //qDebug() << dtd << name << publicId << systemId; - if ((publicId == QLatin1String("-//W3C//DTD XHTML 1.0 Transitional//EN")) - || (publicId == QLatin1String("-//W3C//DTD XHTML 1.1//EN")) - || (publicId == QLatin1String("-//W3C//DTD XHTML 1.0 Strict//EN")) - || (publicId == QLatin1String("-//W3C//DTD XHTML 1.0 Frameset//EN")) - || (publicId == QLatin1String("-//W3C//DTD XHTML Basic 1.0//EN")) - || (publicId == QLatin1String("-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN")) - || (publicId == QLatin1String("-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN")) -#if !ENABLE(XHTMLMP) - || (publicId == QLatin1String("-//WAPFORUM//DTD XHTML Mobile 1.0//EN")) -#endif - ) - setIsXHTMLDocument(true); // controls if we replace entities or not. -#if ENABLE(XHTMLMP) - else if ((publicId == QLatin1String("-//WAPFORUM//DTD XHTML Mobile 1.1//EN")) - || (publicId == QLatin1String("-//WAPFORUM//DTD XHTML Mobile 1.0//EN"))) { - if (AtomicString(name) != HTMLNames::htmlTag.localName()) { - handleError(fatal, "Invalid DOCTYPE declaration, expected 'html' as root element.", lineNumber(), columnNumber()); - return; - } - - if (m_doc->isXHTMLMPDocument()) // check if the MIME type is correct with this method - setIsXHTMLMPDocument(true); - else - setIsXHTMLDocument(true); - } -#endif -#if ENABLE(WML) - else if (m_doc->isWMLDocument() - && publicId != QLatin1String("-//WAPFORUM//DTD WML 1.3//EN") - && publicId != QLatin1String("-//WAPFORUM//DTD WML 1.2//EN") - && publicId != QLatin1String("-//WAPFORUM//DTD WML 1.1//EN") - && publicId != QLatin1String("-//WAPFORUM//DTD WML 1.0//EN")) - handleError(fatal, "Invalid DTD Public ID", lineNumber(), columnNumber()); -#endif - if (!m_parsingFragment) - m_doc->addChild(DocumentType::create(m_doc, name, publicId, systemId)); - -} -} - diff --git a/WebCore/dom/XMLTokenizerScope.cpp b/WebCore/dom/XMLTokenizerScope.cpp deleted file mode 100644 index 3769f59..0000000 --- a/WebCore/dom/XMLTokenizerScope.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - -#include "config.h" -#include "XMLTokenizerScope.h" - -namespace WebCore { - -DocLoader* XMLTokenizerScope::currentDocLoader = 0; - -XMLTokenizerScope::XMLTokenizerScope(DocLoader* docLoader) - : m_oldDocLoader(currentDocLoader) -#if ENABLE(XSLT) - , m_oldGenericErrorFunc(xmlGenericError) - , m_oldStructuredErrorFunc(xmlStructuredError) - , m_oldErrorContext(xmlGenericErrorContext) -#endif -{ - currentDocLoader = docLoader; -} - -#if ENABLE(XSLT) -XMLTokenizerScope::XMLTokenizerScope(DocLoader* docLoader, xmlGenericErrorFunc genericErrorFunc, xmlStructuredErrorFunc structuredErrorFunc, void* errorContext) - : m_oldDocLoader(currentDocLoader) - , m_oldGenericErrorFunc(xmlGenericError) - , m_oldStructuredErrorFunc(xmlStructuredError) - , m_oldErrorContext(xmlGenericErrorContext) -{ - currentDocLoader = docLoader; - if (genericErrorFunc) - xmlSetGenericErrorFunc(errorContext, genericErrorFunc); - if (structuredErrorFunc) - xmlSetStructuredErrorFunc(errorContext, structuredErrorFunc); -} -#endif - -XMLTokenizerScope::~XMLTokenizerScope() -{ - currentDocLoader = m_oldDocLoader; -#if ENABLE(XSLT) - xmlSetGenericErrorFunc(m_oldErrorContext, m_oldGenericErrorFunc); - xmlSetStructuredErrorFunc(m_oldErrorContext, m_oldStructuredErrorFunc); -#endif -} - -} diff --git a/WebCore/dom/XMLTokenizerScope.h b/WebCore/dom/XMLTokenizerScope.h deleted file mode 100644 index c29b796..0000000 --- a/WebCore/dom/XMLTokenizerScope.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 XMLTokenizerScope_h -#define XMLTokenizerScope_h - -#include <wtf/Noncopyable.h> - -#if ENABLE(XSLT) -#include <libxml/tree.h> -#endif - -namespace WebCore { - - class DocLoader; - - class XMLTokenizerScope : public Noncopyable { - public: - XMLTokenizerScope(DocLoader* docLoader); - ~XMLTokenizerScope(); - - static DocLoader* currentDocLoader; - -#if ENABLE(XSLT) - XMLTokenizerScope(DocLoader* docLoader, xmlGenericErrorFunc genericErrorFunc, xmlStructuredErrorFunc structuredErrorFunc = 0, void* errorContext = 0); -#endif - - private: - DocLoader* m_oldDocLoader; - -#if ENABLE(XSLT) - xmlGenericErrorFunc m_oldGenericErrorFunc; - xmlStructuredErrorFunc m_oldStructuredErrorFunc; - void* m_oldErrorContext; -#endif - }; - -} // namespace WebCore - -#endif // XMLTokenizerScope_h diff --git a/WebCore/dom/make_names.pl b/WebCore/dom/make_names.pl index 04a68bb..a675438 100755 --- a/WebCore/dom/make_names.pl +++ b/WebCore/dom/make_names.pl @@ -868,7 +868,7 @@ static v8::Handle<v8::Value> create${JSInterfaceName}Wrapper($parameters{namespa { Settings* settings = element->document()->settings(); if (!MediaPlayer::isAvailable() || (settings && !settings->isMediaEnabled())) - return toV8(static_cast<$parameters{namespace}Element*>(element)); + return V8$parameters{namespace}Element::wrap(element); return toV8(static_cast<${JSInterfaceName}*>(element)); } diff --git a/WebCore/editing/DeleteButtonController.cpp b/WebCore/editing/DeleteButtonController.cpp index 4f527af..8b23eaa 100644 --- a/WebCore/editing/DeleteButtonController.cpp +++ b/WebCore/editing/DeleteButtonController.cpp @@ -187,7 +187,7 @@ void DeleteButtonController::respondToChangedSelection(const VisibleSelection& o void DeleteButtonController::createDeletionUI() { RefPtr<HTMLDivElement> container = HTMLDivElement::create(m_target->document()); - container->setAttribute(container->idAttributeName(), containerElementIdentifier); + container->setIdAttribute(containerElementIdentifier); CSSMutableStyleDeclaration* style = container->getInlineStyleDecl(); style->setProperty(CSSPropertyWebkitUserDrag, CSSValueNone); @@ -202,7 +202,7 @@ void DeleteButtonController::createDeletionUI() style->setProperty(CSSPropertyLeft, "0"); RefPtr<HTMLDivElement> outline = HTMLDivElement::create(m_target->document()); - outline->setAttribute(outline->idAttributeName(), outlineElementIdentifier); + outline->setIdAttribute(outlineElementIdentifier); const int borderWidth = 4; const int borderRadius = 6; @@ -225,7 +225,7 @@ void DeleteButtonController::createDeletionUI() return; RefPtr<DeleteButton> button = DeleteButton::create(m_target->document()); - button->setAttribute(button->idAttributeName(), buttonElementIdentifier); + button->setIdAttribute(buttonElementIdentifier); const int buttonWidth = 30; const int buttonHeight = 30; diff --git a/WebCore/editing/EditingAllInOne.cpp b/WebCore/editing/EditingAllInOne.cpp new file mode 100644 index 0000000..dda2501 --- /dev/null +++ b/WebCore/editing/EditingAllInOne.cpp @@ -0,0 +1,74 @@ +/* + * 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 + * 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. + */ + +// This all-in-one cpp file cuts down on template bloat to allow us to build our Windows release build. + +#include <AppendNodeCommand.cpp> +#include <ApplyStyleCommand.cpp> +#include <BreakBlockquoteCommand.cpp> +#include <CompositeEditCommand.cpp> +#include <CreateLinkCommand.cpp> +#include <DeleteButton.cpp> +#include <DeleteButtonController.cpp> +#include <DeleteFromTextNodeCommand.cpp> +#include <DeleteSelectionCommand.cpp> +#include <EditCommand.cpp> +#include <Editor.cpp> +#include <EditorCommand.cpp> +#include <FormatBlockCommand.cpp> +#include <HTMLInterchange.cpp> +#include <IndentOutdentCommand.cpp> +#include <InsertIntoTextNodeCommand.cpp> +#include <InsertLineBreakCommand.cpp> +#include <InsertListCommand.cpp> +#include <InsertNodeBeforeCommand.cpp> +#include <InsertParagraphSeparatorCommand.cpp> +#include <InsertTextCommand.cpp> +#include <JoinTextNodesCommand.cpp> +#include <MergeIdenticalElementsCommand.cpp> +#include <ModifySelectionListLevel.cpp> +#include <MoveSelectionCommand.cpp> +#include <RemoveCSSPropertyCommand.cpp> +#include <RemoveFormatCommand.cpp> +#include <RemoveNodeCommand.cpp> +#include <RemoveNodePreservingChildrenCommand.cpp> +#include <ReplaceNodeWithSpanCommand.cpp> +#include <ReplaceSelectionCommand.cpp> +#include <SelectionController.cpp> +#include <SetNodeAttributeCommand.cpp> +#include <SmartReplace.cpp> +#include <SmartReplaceCF.cpp> +#include <SplitElementCommand.cpp> +#include <SplitTextNodeCommand.cpp> +#include <SplitTextNodeContainingElementCommand.cpp> +#include <TextIterator.cpp> +#include <TypingCommand.cpp> +#include <UnlinkCommand.cpp> +#include <VisiblePosition.cpp> +#include <VisibleSelection.cpp> +#include <WrapContentsInDummySpanCommand.cpp> +#include <htmlediting.cpp> +#include <markup.cpp> +#include <visible_units.cpp> diff --git a/WebCore/editing/EditingBehavior.h b/WebCore/editing/EditingBehavior.h new file mode 100644 index 0000000..fe09e1b --- /dev/null +++ b/WebCore/editing/EditingBehavior.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * 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 EditingBehavior_h +#define EditingBehavior_h + +#include "EditingBehaviorTypes.h" + +namespace WebCore { + +class EditingBehavior { + +public: + EditingBehavior(EditingBehaviorType type) + : m_type(type) + { + } + + // Individual functions for each case where we have more than one style of editing behavior. + // Create a new function for any platform difference so we can control it here. + + // When extending a selection beyond the top or bottom boundary of an editable area, + // maintain the horizontal position on Windows but extend it to the boundary of the editable + // content on Mac. + bool shouldMoveCaretToHorizontalBoundaryWhenPastTopOrBottom() const { return m_type != EditingWindowsBehavior; } + + // On Windows, selections should always be considered as directional, regardless if it is + // mouse-based or keyboard-based. + bool shouldConsiderSelectionAsDirectional() const { return m_type != EditingMacBehavior; } + + // On Mac, when revealing a selection (for example as a result of a Find operation on the Browser), + // content should be scrolled such that the selection gets certer aligned. + bool shouldCenterAlignWhenSelectionIsRevealed() const { return m_type == EditingMacBehavior; } + +private: + EditingBehaviorType m_type; +}; + +} // namespace WebCore + +#endif // EditingBehavior_h diff --git a/WebCore/editing/EditingBehaviorTypes.h b/WebCore/editing/EditingBehaviorTypes.h new file mode 100644 index 0000000..26ba18e --- /dev/null +++ b/WebCore/editing/EditingBehaviorTypes.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * 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 EditingBehaviorTypes_h +#define EditingBehaviorTypes_h + +namespace WebCore { + +// There are multiple editing details that are different on Windows than Macintosh. +// We use a single switch for all of them. Some examples: +// +// 1) Clicking below the last line of an editable area puts the caret at the end +// of the last line on Mac, but in the middle of the last line on Windows. +// 2) Pushing the down arrow key on the last line puts the caret at the end of the +// last line on Mac, but does nothing on Windows. A similar case exists on the +// top line. +// +// This setting is intended to control these sorts of behaviors. There are some other +// behaviors with individual function calls on EditorClient (smart copy and paste and +// selecting the space after a double click) that could be combined with this if +// if possible in the future. +enum EditingBehaviorType { + EditingMacBehavior, + EditingWindowsBehavior +}; + +} // WebCore namespace + +#endif // EditingBehaviorTypes_h diff --git a/WebCore/editing/Editor.cpp b/WebCore/editing/Editor.cpp index 8041159..8ae1313 100644 --- a/WebCore/editing/Editor.cpp +++ b/WebCore/editing/Editor.cpp @@ -63,6 +63,7 @@ #include "RenderBlock.h" #include "RenderPart.h" #include "ReplaceSelectionCommand.h" +#include "Settings.h" #include "Sound.h" #include "Text.h" #include "TextIterator.h" @@ -97,6 +98,15 @@ VisibleSelection Editor::selectionForCommand(Event* event) return selection; } +// Function considers Mac editing behavior a fallback when Page or Settings is not available. +EditingBehavior Editor::behavior() const +{ + if (!m_frame || !m_frame->settings()) + return EditingBehavior(EditingMacBehavior); + + return EditingBehavior(m_frame->settings()->editingBehaviorType()); +} + EditorClient* Editor::client() const { if (Page* page = m_frame->page()) diff --git a/WebCore/editing/Editor.h b/WebCore/editing/Editor.h index 17dd3bb..3e223dc 100644 --- a/WebCore/editing/Editor.h +++ b/WebCore/editing/Editor.h @@ -29,6 +29,7 @@ #include "ClipboardAccessPolicy.h" #include "Color.h" #include "EditAction.h" +#include "EditingBehavior.h" #include "EditorDeleteAction.h" #include "EditorInsertAction.h" #include "SelectionController.h" @@ -281,6 +282,8 @@ public: KillRing* killRing() const { return m_killRing.get(); } + EditingBehavior behavior() const; + PassRefPtr<Range> selectedRange(); // We should make these functions private when their callers in Frame are moved over here to Editor diff --git a/WebCore/editing/EditorCommand.cpp b/WebCore/editing/EditorCommand.cpp index 75085fb..6bd75d6 100644 --- a/WebCore/editing/EditorCommand.cpp +++ b/WebCore/editing/EditorCommand.cpp @@ -49,6 +49,7 @@ #include "InsertListCommand.h" #include "KillRing.h" #include "Page.h" +#include "RenderBox.h" #include "ReplaceSelectionCommand.h" #include "Scrollbar.h" #include "Settings.h" @@ -166,7 +167,7 @@ static bool executeToggleStyle(Frame* frame, EditorCommandSource source, EditAct // other: present throughout the selection Settings* settings = frame->document()->settings(); bool styleIsPresent; - if (settings && settings->editingBehavior() == EditingMacBehavior) + if (settings && settings->editingBehaviorType() == EditingMacBehavior) styleIsPresent = frame->editor()->selectionStartHasStyle(style.get()); else styleIsPresent = frame->editor()->selectionHasStyle(style.get()) == TrueTriState; @@ -474,7 +475,7 @@ static bool executeInsertHorizontalRule(Frame* frame, Event*, EditorCommandSourc { RefPtr<HTMLHRElement> rule = HTMLHRElement::create(frame->document()); if (!value.isEmpty()) - rule->setAttribute(rule->idAttributeName(), value); + rule->setIdAttribute(value); return executeInsertNode(frame, rule.release()); } diff --git a/WebCore/editing/InsertListCommand.cpp b/WebCore/editing/InsertListCommand.cpp index cd6838b..07b612f 100644 --- a/WebCore/editing/InsertListCommand.cpp +++ b/WebCore/editing/InsertListCommand.cpp @@ -143,134 +143,153 @@ void InsertListCommand::doApply() if (!listNode->hasTagName(listTag)) // listChildNode will be removed from the list and a list of type m_type will be created. switchListType = true; - Node* nextListChild; - Node* previousListChild; - VisiblePosition start; - VisiblePosition end; - if (listChildNode->hasTagName(liTag)) { - start = firstDeepEditingPositionForNode(listChildNode); - end = lastDeepEditingPositionForNode(listChildNode); - nextListChild = listChildNode->nextSibling(); - previousListChild = listChildNode->previousSibling(); - } else { - // A paragraph is visually a list item minus a list marker. The paragraph will be moved. - start = startOfParagraph(endingSelection().visibleStart()); - end = endOfParagraph(endingSelection().visibleEnd()); - nextListChild = enclosingListChild(end.next().deepEquivalent().node()); - ASSERT(nextListChild != listChildNode); - if (enclosingList(nextListChild) != listNode) - nextListChild = 0; - previousListChild = enclosingListChild(start.previous().deepEquivalent().node()); - ASSERT(previousListChild != listChildNode); - if (enclosingList(previousListChild) != listNode) - previousListChild = 0; - } - // When removing a list, we must always create a placeholder to act as a point of insertion - // for the list content being removed. - RefPtr<Element> placeholder = createBreakElement(document()); - RefPtr<Element> nodeToInsert = placeholder; - // If the content of the list item will be moved into another list, put it in a list item - // so that we don't create an orphaned list child. - if (enclosingList(listNode)) { - nodeToInsert = createListItemElement(document()); - appendNode(placeholder, nodeToInsert); - } - - if (nextListChild && previousListChild) { - // We want to pull listChildNode out of listNode, and place it before nextListChild - // and after previousListChild, so we split listNode and insert it between the two lists. - // But to split listNode, we must first split ancestors of listChildNode between it and listNode, - // if any exist. - // FIXME: We appear to split at nextListChild as opposed to listChildNode so that when we remove - // listChildNode below in moveParagraphs, previousListChild will be removed along with it if it is - // unrendered. But we ought to remove nextListChild too, if it is unrendered. - splitElement(listNode, splitTreeToNode(nextListChild, listNode)); - insertNodeBefore(nodeToInsert, listNode); - } else if (nextListChild || listChildNode->parentNode() != listNode) { - // Just because listChildNode has no previousListChild doesn't mean there isn't any content - // in listNode that comes before listChildNode, as listChildNode could have ancestors - // between it and listNode. So, we split up to listNode before inserting the placeholder - // where we're about to move listChildNode to. - if (listChildNode->parentNode() != listNode) - splitElement(listNode, splitTreeToNode(listChildNode, listNode).get()); - insertNodeBefore(nodeToInsert, listNode); - } else - insertNodeAfter(nodeToInsert, listNode); - - VisiblePosition insertionPoint = VisiblePosition(Position(placeholder.get(), 0)); - moveParagraphs(start, end, insertionPoint, true); + + unlistifyParagraph(endingSelection().visibleStart(), listNode, listChildNode); } - if (!listChildNode || switchListType || m_forceCreateList) { - // Create list. - VisiblePosition originalStart = endingSelection().visibleStart(); - VisiblePosition start = startOfParagraph(originalStart); - VisiblePosition end = endOfParagraph(endingSelection().visibleEnd()); - - // Check for adjoining lists. - VisiblePosition previousPosition = start.previous(true); - VisiblePosition nextPosition = end.next(true); - RefPtr<HTMLElement> listItemElement = createListItemElement(document()); - RefPtr<HTMLElement> placeholder = createBreakElement(document()); - appendNode(placeholder, listItemElement); - Element* previousList = outermostEnclosingList(previousPosition.deepEquivalent().node()); - Element* nextList = outermostEnclosingList(nextPosition.deepEquivalent().node()); - Node* startNode = start.deepEquivalent().node(); - Node* previousCell = enclosingTableCell(previousPosition.deepEquivalent()); - Node* nextCell = enclosingTableCell(nextPosition.deepEquivalent()); - Node* currentCell = enclosingTableCell(start.deepEquivalent()); - if (previousList && (!previousList->hasTagName(listTag) || startNode->isDescendantOf(previousList) || previousCell != currentCell)) - previousList = 0; - if (nextList && (!nextList->hasTagName(listTag) || startNode->isDescendantOf(nextList) || nextCell != currentCell)) - nextList = 0; - // Place list item into adjoining lists. - if (previousList) - appendNode(listItemElement, previousList); - else if (nextList) - insertNodeAt(listItemElement, Position(nextList, 0)); - else { - // Create the list. - RefPtr<HTMLElement> listElement = m_type == OrderedList ? createOrderedListElement(document()) : createUnorderedListElement(document()); - m_listElement = listElement; - appendNode(listItemElement, listElement); - - if (start == end && isBlock(start.deepEquivalent().node())) { - // Inserting the list into an empty paragraph that isn't held open - // by a br or a '\n', will invalidate start and end. Insert - // a placeholder and then recompute start and end. - RefPtr<Node> placeholder = insertBlockPlaceholder(start.deepEquivalent()); - start = VisiblePosition(Position(placeholder.get(), 0)); - end = start; - } - - // Insert the list at a position visually equivalent to start of the - // paragraph that is being moved into the list. - // Try to avoid inserting it somewhere where it will be surrounded by - // inline ancestors of start, since it is easier for editing to produce - // clean markup when inline elements are pushed down as far as possible. - Position insertionPos(start.deepEquivalent().upstream()); - // Also avoid the containing list item. - Node* listChild = enclosingListChild(insertionPos.node()); - if (listChild && listChild->hasTagName(liTag)) - insertionPos = positionInParentBeforeNode(listChild); - insertNodeAt(listElement, insertionPos); + if (!listChildNode || switchListType || m_forceCreateList) + m_listElement = listifyParagraph(endingSelection().visibleStart(), listTag); +} + +void InsertListCommand::unlistifyParagraph(const VisiblePosition& originalStart, HTMLElement* listNode, Node* listChildNode) +{ + Node* nextListChild; + Node* previousListChild; + VisiblePosition start; + VisiblePosition end; + if (listChildNode->hasTagName(liTag)) { + start = firstDeepEditingPositionForNode(listChildNode); + end = lastDeepEditingPositionForNode(listChildNode); + nextListChild = listChildNode->nextSibling(); + previousListChild = listChildNode->previousSibling(); + } else { + // A paragraph is visually a list item minus a list marker. The paragraph will be moved. + start = startOfParagraph(originalStart); + end = endOfParagraph(start); + nextListChild = enclosingListChild(end.next().deepEquivalent().node()); + ASSERT(nextListChild != listChildNode); + if (enclosingList(nextListChild) != listNode) + nextListChild = 0; + previousListChild = enclosingListChild(start.previous().deepEquivalent().node()); + ASSERT(previousListChild != listChildNode); + if (enclosingList(previousListChild) != listNode) + previousListChild = 0; + } + // When removing a list, we must always create a placeholder to act as a point of insertion + // for the list content being removed. + RefPtr<Element> placeholder = createBreakElement(document()); + RefPtr<Element> nodeToInsert = placeholder; + // If the content of the list item will be moved into another list, put it in a list item + // so that we don't create an orphaned list child. + if (enclosingList(listNode)) { + nodeToInsert = createListItemElement(document()); + appendNode(placeholder, nodeToInsert); + } + + if (nextListChild && previousListChild) { + // We want to pull listChildNode out of listNode, and place it before nextListChild + // and after previousListChild, so we split listNode and insert it between the two lists. + // But to split listNode, we must first split ancestors of listChildNode between it and listNode, + // if any exist. + // FIXME: We appear to split at nextListChild as opposed to listChildNode so that when we remove + // listChildNode below in moveParagraphs, previousListChild will be removed along with it if it is + // unrendered. But we ought to remove nextListChild too, if it is unrendered. + splitElement(listNode, splitTreeToNode(nextListChild, listNode)); + insertNodeBefore(nodeToInsert, listNode); + } else if (nextListChild || listChildNode->parentNode() != listNode) { + // Just because listChildNode has no previousListChild doesn't mean there isn't any content + // in listNode that comes before listChildNode, as listChildNode could have ancestors + // between it and listNode. So, we split up to listNode before inserting the placeholder + // where we're about to move listChildNode to. + if (listChildNode->parentNode() != listNode) + splitElement(listNode, splitTreeToNode(listChildNode, listNode).get()); + insertNodeBefore(nodeToInsert, listNode); + } else + insertNodeAfter(nodeToInsert, listNode); + + VisiblePosition insertionPoint = VisiblePosition(Position(placeholder.get(), 0)); + moveParagraphs(start, end, insertionPoint, true); +} - // We inserted the list at the start of the content we're about to move - // Update the start of content, so we don't try to move the list into itself. bug 19066 - if (insertionPos == start.deepEquivalent()) - start = startOfParagraph(originalStart); - previousList = outermostEnclosingList(previousPosition.deepEquivalent().node(), enclosingList(listElement.get())); - nextList = outermostEnclosingList(nextPosition.deepEquivalent().node(), enclosingList(listElement.get())); +PassRefPtr<HTMLElement> InsertListCommand::listifyParagraph(const VisiblePosition& originalStart, const QualifiedName& listTag) +{ + VisiblePosition start = startOfParagraph(originalStart); + VisiblePosition end = endOfParagraph(start); + + // Check for adjoining lists. + VisiblePosition previousPosition = start.previous(true); + VisiblePosition nextPosition = end.next(true); + RefPtr<HTMLElement> listItemElement = createListItemElement(document()); + RefPtr<HTMLElement> placeholder = createBreakElement(document()); + appendNode(placeholder, listItemElement); + Element* previousList = outermostEnclosingList(previousPosition.deepEquivalent().node()); + Element* nextList = outermostEnclosingList(nextPosition.deepEquivalent().node()); + Node* startNode = start.deepEquivalent().node(); + Node* previousCell = enclosingTableCell(previousPosition.deepEquivalent()); + Node* nextCell = enclosingTableCell(nextPosition.deepEquivalent()); + Node* currentCell = enclosingTableCell(start.deepEquivalent()); + if (previousList && (!previousList->hasTagName(listTag) || startNode->isDescendantOf(previousList) || previousCell != currentCell)) + previousList = 0; + if (nextList && (!nextList->hasTagName(listTag) || startNode->isDescendantOf(nextList) || nextCell != currentCell)) + nextList = 0; + // Place list item into adjoining lists. + RefPtr<HTMLElement> listElement; + if (previousList) + appendNode(listItemElement, previousList); + else if (nextList) + insertNodeAt(listItemElement, Position(nextList, 0)); + else { + // Create the list. + listElement = createHTMLElement(document(), listTag); + appendNode(listItemElement, listElement); + + if (start == end && isBlock(start.deepEquivalent().node())) { + // Inserting the list into an empty paragraph that isn't held open + // by a br or a '\n', will invalidate start and end. Insert + // a placeholder and then recompute start and end. + RefPtr<Node> placeholder = insertBlockPlaceholder(start.deepEquivalent()); + start = VisiblePosition(Position(placeholder.get(), 0)); + end = start; } - moveParagraph(start, end, VisiblePosition(Position(placeholder.get(), 0)), true); - if (m_listElement) { - if (canMergeLists(previousList, m_listElement.get())) - mergeIdenticalElements(previousList, m_listElement.get()); - if (canMergeLists(m_listElement.get(), nextList)) - mergeIdenticalElements(m_listElement.get(), nextList); - } else if (canMergeLists(nextList, previousList)) - mergeIdenticalElements(previousList, nextList); + + // Insert the list at a position visually equivalent to start of the + // paragraph that is being moved into the list. + // Try to avoid inserting it somewhere where it will be surrounded by + // inline ancestors of start, since it is easier for editing to produce + // clean markup when inline elements are pushed down as far as possible. + Position insertionPos(start.deepEquivalent().upstream()); + // Also avoid the containing list item. + Node* listChild = enclosingListChild(insertionPos.node()); + if (listChild && listChild->hasTagName(liTag)) + insertionPos = positionInParentBeforeNode(listChild); + + insertNodeAt(listElement, insertionPos); + + // We inserted the list at the start of the content we're about to move + // Update the start of content, so we don't try to move the list into itself. bug 19066 + if (insertionPos == start.deepEquivalent()) + start = startOfParagraph(originalStart); + previousList = outermostEnclosingList(previousPosition.deepEquivalent().node(), enclosingList(listElement.get())); + nextList = outermostEnclosingList(nextPosition.deepEquivalent().node(), enclosingList(listElement.get())); } + + moveParagraph(start, end, VisiblePosition(Position(placeholder.get(), 0)), true); + + // FIXME: listifyParagraph should not depend on a member variable. + // Since fixOrphanedListChild is the only other method that updates m_listElement, + // we should fix unlistifyParagraph to support orphaned list child to get rid of this assignment. + if (!listElement && m_listElement) + listElement = m_listElement; + + if (listElement) { + if (canMergeLists(previousList, listElement.get())) + mergeIdenticalElements(previousList, listElement.get()); + if (canMergeLists(listElement.get(), nextList)) + mergeIdenticalElements(listElement.get(), nextList); + } else if (canMergeLists(nextList, previousList)) + mergeIdenticalElements(previousList, nextList); + + return listElement; } } diff --git a/WebCore/editing/InsertListCommand.h b/WebCore/editing/InsertListCommand.h index ecdd2cf..7f3b07d 100644 --- a/WebCore/editing/InsertListCommand.h +++ b/WebCore/editing/InsertListCommand.h @@ -53,6 +53,8 @@ private: HTMLElement* fixOrphanedListChild(Node*); bool modifyRange(); + void unlistifyParagraph(const VisiblePosition& originalStart, HTMLElement* listNode, Node* listChildNode); + PassRefPtr<HTMLElement> listifyParagraph(const VisiblePosition& originalStart, const QualifiedName& listTag); RefPtr<HTMLElement> m_listElement; Type m_type; bool m_forceCreateList; diff --git a/WebCore/editing/SelectionController.cpp b/WebCore/editing/SelectionController.cpp index f9b39bb..ca18bc1 100644 --- a/WebCore/editing/SelectionController.cpp +++ b/WebCore/editing/SelectionController.cpp @@ -44,6 +44,7 @@ #include "HitTestResult.h" #include "Page.h" #include "Range.h" +#include "RenderLayer.h" #include "RenderTheme.h" #include "RenderView.h" #include "SecureTextInput.h" @@ -164,7 +165,7 @@ void SelectionController::setSelection(const VisibleSelection& s, bool closeTypi if (userTriggered) { ScrollAlignment alignment; - if (m_frame->settings() && m_frame->settings()->editingBehavior() == EditingMacBehavior) + if (m_frame->editor()->behavior().shouldCenterAlignWhenSelectionIsRevealed()) alignment = (align == AlignCursorOnScrollAlways) ? ScrollAlignment::alignCenterAlways : ScrollAlignment::alignCenterIfNeeded; else alignment = (align == AlignCursorOnScrollAlways) ? ScrollAlignment::alignTopAlways : ScrollAlignment::alignToEdgeIfNeeded; @@ -243,8 +244,7 @@ void SelectionController::nodeWillBeRemoved(Node *node) void SelectionController::setIsDirectional(bool isDirectional) { - Settings* settings = m_frame ? m_frame->settings() : 0; - m_isDirectional = !settings || settings->editingBehavior() != EditingMacBehavior || isDirectional; + m_isDirectional = !m_frame || m_frame->editor()->behavior().shouldConsiderSelectionAsDirectional() || isDirectional; } void SelectionController::willBeModified(EAlteration alter, EDirection direction) @@ -299,7 +299,7 @@ VisiblePosition SelectionController::positionForPlatform(bool isGetStart) const { Position pos; Settings* settings = m_frame ? m_frame->settings() : 0; - if (settings && settings->editingBehavior() == EditingMacBehavior) + if (settings && settings->editingBehaviorType() == EditingMacBehavior) pos = isGetStart ? m_selection.start() : m_selection.end(); else { // Linux and Windows always extend selections from the extent endpoint. @@ -685,7 +685,7 @@ bool SelectionController::modify(EAlteration alter, EDirection direction, TextGr moveTo(position, userTriggered); break; case AlterationExtend: - if (!settings || settings->editingBehavior() != EditingMacBehavior || m_selection.isCaret() || !isBoundary(granularity)) + if (!settings || settings->editingBehaviorType() != EditingMacBehavior || m_selection.isCaret() || !isBoundary(granularity)) setExtent(position, userTriggered); else { // Standard Mac behavior when extending to a boundary is grow the selection rather diff --git a/WebCore/editing/SetNodeAttributeCommand.h b/WebCore/editing/SetNodeAttributeCommand.h index 899ac62..ce3a1ec 100644 --- a/WebCore/editing/SetNodeAttributeCommand.h +++ b/WebCore/editing/SetNodeAttributeCommand.h @@ -27,7 +27,6 @@ #define SetNodeAttributeCommand_h #include "EditCommand.h" -#include "QualifiedName.h" namespace WebCore { diff --git a/WebCore/editing/htmlediting.cpp b/WebCore/editing/htmlediting.cpp index 3356ed9..9f73167 100644 --- a/WebCore/editing/htmlediting.cpp +++ b/WebCore/editing/htmlediting.cpp @@ -869,7 +869,35 @@ bool isTableCell(const Node* node) bool isEmptyTableCell(const Node* node) { - return node && node->renderer() && (node->renderer()->isTableCell() || (node->renderer()->isBR() && node->parentNode()->renderer() && node->parentNode()->renderer()->isTableCell())); + // Returns true IFF the passed in node is one of: + // .) a table cell with no children, + // .) a table cell with a single BR child, and which has no other child renderers, including :before and :after renderers + // .) the BR child of such a table cell + + // Find rendered node + while (node && !node->renderer()) + node = node->parent(); + if (!node) + return false; + + // Make sure the rendered node is a table cell or <br>. + // If it's a <br>, then the parent node has to be a table cell. + RenderObject* renderer = node->renderer(); + if (renderer->isBR()) { + renderer = renderer->parent(); + if (!renderer) + return false; + } + if (!renderer->isTableCell()) + return false; + + // Check that the table cell contains no child renderers except for perhaps a single <br>. + RenderObject* childRenderer = renderer->firstChild(); + if (!childRenderer) + return true; + if (!childRenderer->isBR()) + return false; + return !childRenderer->nextSibling(); } PassRefPtr<HTMLElement> createDefaultParagraphElement(Document* document) diff --git a/WebCore/editing/markup.cpp b/WebCore/editing/markup.cpp index 46f0e94..17f5680 100644 --- a/WebCore/editing/markup.cpp +++ b/WebCore/editing/markup.cpp @@ -41,7 +41,6 @@ #include "CSSValue.h" #include "CSSValueKeywords.h" #include "DeleteButtonController.h" -#include "Document.h" #include "DocumentFragment.h" #include "DocumentType.h" #include "Editor.h" @@ -52,7 +51,6 @@ #include "KURL.h" #include "Logging.h" #include "ProcessingInstruction.h" -#include "QualifiedName.h" #include "Range.h" #include "VisibleSelection.h" #include "TextIterator.h" diff --git a/WebCore/history/BackForwardList.cpp b/WebCore/history/BackForwardList.cpp index 721d949..656cce2 100644 --- a/WebCore/history/BackForwardList.cpp +++ b/WebCore/history/BackForwardList.cpp @@ -82,13 +82,15 @@ void BackForwardList::addItem(PassRefPtr<HistoryItem> prpItem) m_entryHash.remove(item); pageCache()->remove(item.get()); m_current--; - m_page->mainFrame()->loader()->client()->dispatchDidRemoveBackForwardItem(item.get()); + if (m_page) + m_page->mainFrame()->loader()->client()->dispatchDidRemoveBackForwardItem(item.get()); } - + m_entryHash.add(prpItem.get()); m_entries.insert(m_current + 1, prpItem); m_current++; - m_page->mainFrame()->loader()->client()->dispatchDidAddBackForwardItem(currentItem()); + if (m_page) + m_page->mainFrame()->loader()->client()->dispatchDidAddBackForwardItem(currentItem()); } void BackForwardList::goBack() @@ -96,7 +98,8 @@ void BackForwardList::goBack() ASSERT(m_current > 0); if (m_current > 0) { m_current--; - m_page->mainFrame()->loader()->client()->dispatchDidChangeBackForwardIndex(); + if (m_page) + m_page->mainFrame()->loader()->client()->dispatchDidChangeBackForwardIndex(); } } @@ -105,7 +108,8 @@ void BackForwardList::goForward() ASSERT(m_current < m_entries.size() - 1); if (m_current < m_entries.size() - 1) { m_current++; - m_page->mainFrame()->loader()->client()->dispatchDidChangeBackForwardIndex(); + if (m_page) + m_page->mainFrame()->loader()->client()->dispatchDidChangeBackForwardIndex(); } } @@ -120,7 +124,8 @@ void BackForwardList::goToItem(HistoryItem* item) break; if (index < m_entries.size()) { m_current = index; - m_page->mainFrame()->loader()->client()->dispatchDidChangeBackForwardIndex(); + if (m_page) + m_page->mainFrame()->loader()->client()->dispatchDidChangeBackForwardIndex(); } } @@ -189,7 +194,8 @@ void BackForwardList::setCapacity(int size) m_current = NoCurrentItemIndex; else if (m_current > m_entries.size() - 1) { m_current = m_entries.size() - 1; - m_page->mainFrame()->loader()->client()->dispatchDidChangeBackForwardIndex(); + if (m_page) + m_page->mainFrame()->loader()->client()->dispatchDidChangeBackForwardIndex(); } m_capacity = size; } diff --git a/WebCore/history/PageCache.cpp b/WebCore/history/PageCache.cpp index 9a3ecd7..72fca86 100644 --- a/WebCore/history/PageCache.cpp +++ b/WebCore/history/PageCache.cpp @@ -26,11 +26,21 @@ #include "config.h" #include "PageCache.h" +#include "ApplicationCacheHost.h" +#include "BackForwardList.h" #include "Cache.h" #include "CachedPage.h" +#include "DOMWindow.h" +#include "Document.h" +#include "DocumentLoader.h" +#include "Frame.h" #include "FrameLoader.h" +#include "FrameLoaderClient.h" #include "HistoryItem.h" #include "Logging.h" +#include "Page.h" +#include "Settings.h" +#include "SharedWorkerRepository.h" #include "SystemTime.h" #include <wtf/CurrentTime.h> @@ -40,6 +50,173 @@ namespace WebCore { static const double autoreleaseInterval = 3; +#ifndef NDEBUG + +static String& pageCacheLogPrefix(int indentLevel) +{ + static int previousIndent = -1; + DEFINE_STATIC_LOCAL(String, prefix, ()); + + if (indentLevel != previousIndent) { + previousIndent = indentLevel; + prefix.truncate(0); + for (int i = 0; i < previousIndent; ++i) + prefix += " "; + } + + return prefix; +} + +static void pageCacheLog(const String& prefix, const String& message) +{ + LOG(PageCache, "%s%s", prefix.utf8().data(), message.utf8().data()); +} + +#define PCLOG(...) pageCacheLog(pageCacheLogPrefix(indentLevel), String::format(__VA_ARGS__)) + +static bool logCanCacheFrameDecision(Frame* frame, int indentLevel) +{ + // Only bother logging for frames that have actually loaded and have content. + if (frame->loader()->creatingInitialEmptyDocument()) + return false; + KURL currentURL = frame->loader()->documentLoader() ? frame->loader()->documentLoader()->url() : KURL(); + if (currentURL.isEmpty()) + return false; + + PCLOG("+---"); + KURL newURL = frame->loader()->provisionalDocumentLoader() ? frame->loader()->provisionalDocumentLoader()->url() : KURL(); + if (!newURL.isEmpty()) + PCLOG(" Determining if frame can be cached navigating from (%s) to (%s):", currentURL.string().utf8().data(), newURL.string().utf8().data()); + else + PCLOG(" Determining if subframe with URL (%s) can be cached:", currentURL.string().utf8().data()); + + bool cannotCache = false; + + do { + if (!frame->loader()->documentLoader()) { + PCLOG(" -There is no DocumentLoader object"); + cannotCache = true; + break; + } + if (!frame->loader()->documentLoader()->mainDocumentError().isNull()) { + PCLOG(" -Main document has an error"); + cannotCache = true; + } + if (frame->loader()->containsPlugins()) { + PCLOG(" -Frame contains plugins"); + cannotCache = true; + } + if (frame->loader()->url().protocolIs("https")) { + PCLOG(" -Frame is HTTPS"); + cannotCache = true; + } + if (frame->domWindow() && frame->domWindow()->hasEventListeners(eventNames().unloadEvent)) { + PCLOG(" -Frame has an unload event listener"); + cannotCache = true; + } +#if ENABLE(DATABASE) + if (frame->document()->hasOpenDatabases()) { + PCLOG(" -Frame has open database handles"); + cannotCache = true; + } +#endif +#if ENABLE(SHARED_WORKERS) + if (SharedWorkerRepository::hasSharedWorkers(frame->document())) { + PCLOG(" -Frame has associated SharedWorkers"); + cannotCache = true; + } +#endif + if (frame->document()->usingGeolocation()) { + PCLOG(" -Frame uses Geolocation"); + cannotCache = true; + } + if (!frame->loader()->history()->currentItem()) { + PCLOG(" -No current history item"); + cannotCache = true; + } + if (frame->loader()->quickRedirectComing()) { + PCLOG(" -Quick redirect is coming"); + cannotCache = true; + } + if (frame->loader()->documentLoader()->isLoadingInAPISense()) { + PCLOG(" -DocumentLoader is still loading in API sense"); + cannotCache = true; + } + if (frame->loader()->documentLoader()->isStopping()) { + PCLOG(" -DocumentLoader is in the middle of stopping"); + cannotCache = true; + } + if (!frame->document()->canSuspendActiveDOMObjects()) { + PCLOG(" -The document cannot suspect its active DOM Objects"); + cannotCache = true; + } +#if ENABLE(OFFLINE_WEB_APPLICATIONS) + if (!frame->loader()->documentLoader()->applicationCacheHost()->canCacheInPageCache()) { + PCLOG(" -The DocumentLoader uses an application cache"); + cannotCache = true; + } +#endif + if (!frame->loader()->client()->canCachePage()) { + PCLOG(" -The client says this frame cannot be cached"); + cannotCache = true; + } + } while (false); + + for (Frame* child = frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) + if (!logCanCacheFrameDecision(child, indentLevel + 1)) + cannotCache = true; + + PCLOG(cannotCache ? " Frame CANNOT be cached" : " Frame CAN be cached"); + PCLOG("+---"); + + return !cannotCache; +} + +static void logCanCachePageDecision(Page* page) +{ + // Only bother logging for main frames that have actually loaded and have content. + if (page->mainFrame()->loader()->creatingInitialEmptyDocument()) + return; + KURL currentURL = page->mainFrame()->loader()->documentLoader() ? page->mainFrame()->loader()->documentLoader()->url() : KURL(); + if (currentURL.isEmpty()) + return; + + int indentLevel = 0; + PCLOG("--------\n Determining if page can be cached:"); + + bool cannotCache = !logCanCacheFrameDecision(page->mainFrame(), 1); + + FrameLoadType loadType = page->mainFrame()->loader()->loadType(); + if (!page->backForwardList()->enabled()) { + PCLOG(" -The back/forward list is disabled"); + cannotCache = true; + } + if (!(page->backForwardList()->capacity() > 0)) { + PCLOG(" -The back/forward list has a 0 capacity"); + cannotCache = true; + } + if (!page->settings()->usesPageCache()) { + PCLOG(" -Page settings says b/f cache disabled"); + cannotCache = true; + } + if (loadType == FrameLoadTypeReload) { + PCLOG(" -Load type is: Reload"); + cannotCache = true; + } + if (loadType == FrameLoadTypeReloadFromOrigin) { + PCLOG(" -Load type is: Reload from origin"); + cannotCache = true; + } + if (loadType == FrameLoadTypeSame) { + PCLOG(" -Load type is: Same"); + cannotCache = true; + } + + PCLOG(cannotCache ? " Page CANNOT be cached\n--------" : " Page CAN be cached\n--------"); +} + +#endif + PageCache* pageCache() { static PageCache* staticPageCache = new PageCache; @@ -54,6 +231,74 @@ PageCache::PageCache() , m_autoreleaseTimer(this, &PageCache::releaseAutoreleasedPagesNowOrReschedule) { } + +bool PageCache::canCachePageContainingThisFrame(Frame* frame) +{ + for (Frame* child = frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) { + if (!canCachePageContainingThisFrame(child)) + return false; + } + + return frame->loader()->documentLoader() + && frame->loader()->documentLoader()->mainDocumentError().isNull() + // FIXME: If we ever change this so that frames with plug-ins will be cached, + // we need to make sure that we don't cache frames that have outstanding NPObjects + // (objects created by the plug-in). Since there is no way to pause/resume a Netscape plug-in, + // they would need to be destroyed and then recreated, and there is no way that we can recreate + // the right NPObjects. See <rdar://problem/5197041> for more information. + && !frame->loader()->containsPlugins() + && !frame->loader()->url().protocolIs("https") + && (!frame->domWindow() || !frame->domWindow()->hasEventListeners(eventNames().unloadEvent)) +#if ENABLE(DATABASE) + && !frame->document()->hasOpenDatabases() +#endif +#if ENABLE(SHARED_WORKERS) + && !SharedWorkerRepository::hasSharedWorkers(frame->document()) +#endif + && !frame->document()->usingGeolocation() + && frame->loader()->history()->currentItem() + && !frame->loader()->quickRedirectComing() + && !frame->loader()->documentLoader()->isLoadingInAPISense() + && !frame->loader()->documentLoader()->isStopping() + && frame->document()->canSuspendActiveDOMObjects() +#if ENABLE(OFFLINE_WEB_APPLICATIONS) + // FIXME: We should investigating caching frames that have an associated + // application cache. <rdar://problem/5917899> tracks that work. + && frame->loader()->documentLoader()->applicationCacheHost()->canCacheInPageCache() +#endif +#if ENABLE(WML) + && !frame->document()->containsWMLContent() + && !frame->document()->isWMLDocument(); +#endif + && frame->loader()->client()->canCachePage(); +} + +bool PageCache::canCache(Page* page) +{ + if (!page) + return false; + +#ifndef NDEBUG + logCanCachePageDecision(page); +#endif + + // Cache the page, if possible. + // Don't write to the cache if in the middle of a redirect, since we will want to + // store the final page we end up on. + // No point writing to the cache on a reload or loadSame, since we will just write + // over it again when we leave that page. + // FIXME: <rdar://problem/4886592> - We should work out the complexities of caching pages with frames as they + // are the most interesting pages on the web, and often those that would benefit the most from caching! + FrameLoadType loadType = page->mainFrame()->loader()->loadType(); + + return canCachePageContainingThisFrame(page->mainFrame()) + && page->backForwardList()->enabled() + && page->backForwardList()->capacity() > 0 + && page->settings()->usesPageCache() + && loadType != FrameLoadTypeReload + && loadType != FrameLoadTypeReloadFromOrigin + && loadType != FrameLoadTypeSame; +} void PageCache::setCapacity(int capacity) { @@ -80,10 +325,11 @@ int PageCache::autoreleasedPageCount() const return m_autoreleaseSet.size(); } -void PageCache::add(PassRefPtr<HistoryItem> prpItem, PassRefPtr<CachedPage> cachedPage) +void PageCache::add(PassRefPtr<HistoryItem> prpItem, Page* page) { ASSERT(prpItem); - ASSERT(cachedPage); + ASSERT(page); + ASSERT(canCache(page)); HistoryItem* item = prpItem.releaseRef(); // Balanced in remove(). @@ -91,13 +337,31 @@ void PageCache::add(PassRefPtr<HistoryItem> prpItem, PassRefPtr<CachedPage> cach if (item->m_cachedPage) remove(item); - item->m_cachedPage = cachedPage; + item->m_cachedPage = CachedPage::create(page); addToLRUList(item); ++m_size; prune(); } +CachedPage* PageCache::get(HistoryItem* item) +{ + if (!item) + return 0; + + if (CachedPage* cachedPage = item->m_cachedPage.get()) { + // FIXME: 1800 should not be hardcoded, it should come from + // WebKitBackForwardCacheExpirationIntervalKey in WebKit. + // Or we should remove WebKitBackForwardCacheExpirationIntervalKey. + if (currentTime() - cachedPage->timeStamp() <= 1800) + return cachedPage; + + LOG(PageCache, "Not restoring page for %s from back/forward cache because cache entry has expired", item->url().string().ascii().data()); + pageCache()->remove(item); + } + return 0; +} + void PageCache::remove(HistoryItem* item) { // Safely ignore attempts to remove items not in the cache. diff --git a/WebCore/history/PageCache.h b/WebCore/history/PageCache.h index 607a87d..71ae5ad 100644 --- a/WebCore/history/PageCache.h +++ b/WebCore/history/PageCache.h @@ -35,18 +35,22 @@ namespace WebCore { class CachedPage; + class Frame; class HistoryItem; + class Page; class PageCache : public Noncopyable { public: friend PageCache* pageCache(); + + static bool canCache(Page*); void setCapacity(int); // number of pages to cache int capacity() { return m_capacity; } - void add(PassRefPtr<HistoryItem>, PassRefPtr<CachedPage>); // Prunes if capacity() is exceeded. + void add(PassRefPtr<HistoryItem>, Page*); // Prunes if capacity() is exceeded. void remove(HistoryItem*); - CachedPage* get(HistoryItem* item) { return item ? item->m_cachedPage.get() : 0; } + CachedPage* get(HistoryItem* item); void releaseAutoreleasedPagesNow(); @@ -59,6 +63,8 @@ namespace WebCore { PageCache(); // Use pageCache() instead. ~PageCache(); // Not implemented to make sure nobody accidentally calls delete -- WebCore does not delete singletons. + + static bool canCachePageContainingThisFrame(Frame*); void addToLRUList(HistoryItem*); // Adds to the head of the list. void removeFromLRUList(HistoryItem*); diff --git a/WebCore/html/AsyncImageResizer.cpp b/WebCore/html/AsyncImageResizer.cpp new file mode 100644 index 0000000..4bb74c9 --- /dev/null +++ b/WebCore/html/AsyncImageResizer.cpp @@ -0,0 +1,77 @@ +/* + * 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" +#if ENABLE(IMAGE_RESIZER) + +#include "AsyncImageResizer.h" + +#include "CachedImage.h" +#include "ImageResizerThread.h" +#include "SharedBuffer.h" +#include <utility> + +namespace WebCore { + +PassRefPtr<AsyncImageResizer> AsyncImageResizer::create(CachedImage* cachedImage, OutputType outputType, IntSize desiredBounds, ScriptValue successCallback, ScriptValue errorCallback, float quality, AspectRatioOption aspectRatioOption, OrientationOption orientationOption) +{ + return adoptRef(new AsyncImageResizer(cachedImage, outputType, desiredBounds, successCallback, errorCallback, quality, aspectRatioOption, orientationOption)); +} + +AsyncImageResizer::AsyncImageResizer(CachedImage* cachedImage, OutputType outputType, IntSize desiredBounds, ScriptValue successCallback, ScriptValue errorCallback, float quality, AspectRatioOption aspectRatioOption, OrientationOption orientationOption) + : m_cachedImage(cachedImage) + , m_successCallback(successCallback) + , m_errorCallback(errorCallback) + , m_outputType(outputType) + , m_desiredBounds(desiredBounds) + , m_quality(quality) + , m_aspectRatioOption(aspectRatioOption) + , m_orientationOption(orientationOption) +{ + ASSERT(m_successCallback.isObject()); + m_cachedImage->addClient(this); +} + +AsyncImageResizer::~AsyncImageResizer() +{ +} + +void AsyncImageResizer::notifyFinished(CachedResource* cachedResource) +{ + RefPtr<SharedBuffer> imageData = cachedResource->data()->copy(); + cachedResource->removeClient(this); + CallbackInfo* callbackInfo = new CallbackInfo(this); + if (!ImageResizerThread::start(imageData, callbackInfo, m_outputType, m_desiredBounds, m_quality, m_aspectRatioOption, m_orientationOption)) + resizeError(); +} + +} // namespace WebCore + +#endif // ENABLE(IMAGE_RESIZER) diff --git a/WebCore/html/AsyncImageResizer.h b/WebCore/html/AsyncImageResizer.h new file mode 100644 index 0000000..3eeeead --- /dev/null +++ b/WebCore/html/AsyncImageResizer.h @@ -0,0 +1,107 @@ +/* + * 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 AsyncImageResizer_h +#define AsyncImageResizer_h + +#if ENABLE(IMAGE_RESIZER) + +#include "Blob.h" +#include "CachedResourceClient.h" +#include "ScriptValue.h" + +namespace WebCore { + +class CachedImage; +class ImageResizerThread; + +// AsyncImageResizer waits for the CachedImage that is passed in to load completely, +// then starts an ImageResizerThread to resize the image. Once created, ImageResizerThread +// becomes in charge of its own lifetime and that of AsyncImageResizer. After the callbacks +// occur, both objects are destroyed. If the document is destroyed during resizing, +// AsyncImageResizer will receive a notification and subsequently block the callbacks from +// occurring. +class AsyncImageResizer : public CachedResourceClient, public RefCounted<AsyncImageResizer> { +public: + struct CallbackInfo { + CallbackInfo(PassRefPtr<AsyncImageResizer> asyncImageResizer) + : asyncImageResizer(asyncImageResizer) + , blob(0) + { + } + + RefPtr<AsyncImageResizer> asyncImageResizer; + RefPtr<Blob> blob; + }; + + enum OutputType { + JPEG, + PNG + }; + + enum AspectRatioOption { + PreserveAspectRatio, + IgnoreAspectRatio + }; + + enum OrientationOption { + CorrectOrientation, + IgnoreOrientation + }; + + static PassRefPtr<AsyncImageResizer> create(CachedImage*, OutputType, IntSize desiredBounds, ScriptValue successCallback, ScriptValue errorCallback, float quality, AspectRatioOption, OrientationOption); + ~AsyncImageResizer(); + + // FIXME: Insert override function for notification of document destruction (change m_callbacksOk). + + void resizeComplete(RefPtr<Blob>) { /* FIXME: Not yet implemented. */ } + void resizeError() { /* FIXME: Not yet implemented. */ } + +private: + AsyncImageResizer(CachedImage*, OutputType, IntSize desiredBounds, ScriptValue successCallback, ScriptValue errorCallback, float quality, AspectRatioOption, OrientationOption); + virtual void notifyFinished(CachedResource*); + + CachedImage* m_cachedImage; + ScriptValue m_successCallback; + ScriptValue m_errorCallback; + + // Parameters to pass into ImageResizerThread. + OutputType m_outputType; + IntSize m_desiredBounds; + float m_quality; + AspectRatioOption m_aspectRatioOption; + OrientationOption m_orientationOption; +}; + +} // namespace WebCore + +#endif // ENABLE(IMAGE_RESIZER) + +#endif // AsyncImageResizer_h diff --git a/WebCore/html/Blob.cpp b/WebCore/html/Blob.cpp index 83bbdc0..0546f1c 100644 --- a/WebCore/html/Blob.cpp +++ b/WebCore/html/Blob.cpp @@ -31,88 +31,65 @@ #include "config.h" #include "Blob.h" +#include "BlobItem.h" #include "FileSystem.h" namespace WebCore { -#if ENABLE(BLOB_SLICE) -const int Blob::toEndOfFile = -1; -const double Blob::doNotCheckFileChange = 0; -#endif - Blob::Blob(const String& path) - : m_path(path) -#if ENABLE(BLOB_SLICE) - , m_start(0) - , m_length(toEndOfFile) - , m_snapshotCaptured(false) - , m_snapshotSize(0) - , m_snapshotModificationTime(doNotCheckFileChange) -#endif -{ -} - -#if ENABLE(BLOB_SLICE) -Blob::Blob(const String& path, long long start, long long length, long long snapshotSize, double snapshotModificationTime) - : m_path(path) - , m_start(start) - , m_length(length) - , m_snapshotCaptured(true) - , m_snapshotSize(snapshotSize) - , m_snapshotModificationTime(snapshotModificationTime) { - ASSERT(start >= 0 && length >= 0 && start + length <= snapshotSize && snapshotModificationTime); + // Note: this doesn't initialize the type unlike File(path). + append(FileBlobItem::create(path)); } -#endif unsigned long long Blob::size() const { // FIXME: JavaScript cannot represent sizes as large as unsigned long long, we need to // come up with an exception to throw if file size is not represetable. -#if ENABLE(BLOB_SLICE) - if (m_snapshotCaptured) - return m_length; -#endif - long long size; - if (!getFileSize(m_path, size)) - return 0; - return static_cast<unsigned long long>(size); + unsigned long long size = 0; + for (size_t i = 0; i < m_items.size(); ++i) + size += m_items[i]->size(); + return size; +} + +const String& Blob::path() const +{ + ASSERT(m_items.size() == 1 && m_items[0]->toFileBlobItem()); + return m_items[0]->toFileBlobItem()->path(); +} + +void Blob::append(PassRefPtr<BlobItem> item) +{ + m_items.append(item); } #if ENABLE(BLOB_SLICE) PassRefPtr<Blob> Blob::slice(long long start, long long length) const { - // When we slice a file for the first time, we obtain a snapshot of the file by capturing its current size and modification time. - // The modification time will be used to verify if the file has been changed or not, when the underlying data are accessed. - long long snapshotSize; - double snapshotModificationTime; - if (m_snapshotCaptured) { - snapshotSize = m_snapshotSize; - snapshotModificationTime = m_snapshotModificationTime; - } else { - // If we fail to retrieve the size or modification time, probably due to that the file has been deleted, an empty blob will be returned. - time_t modificationTime; - if (!getFileSize(m_path, snapshotSize) || !getFileModificationTime(m_path, modificationTime)) { - snapshotSize = 0; - snapshotModificationTime = 0; - } else - snapshotModificationTime = modificationTime; - } - - // Clamp the range if it exceeds the size limit. if (start < 0) start = 0; if (length < 0) length = 0; - if (start > snapshotSize) { + // Clamp the range if it exceeds the size limit. + unsigned long long totalSize = size(); + if (static_cast<unsigned long long>(start) > totalSize) { start = 0; length = 0; - } else if (start + length > snapshotSize) - length = snapshotSize - start; + } else if (static_cast<unsigned long long>(start + length) > totalSize) + length = totalSize - start; - return adoptRef(new Blob(m_path, m_start + start, length, snapshotSize, snapshotModificationTime)); + size_t i = 0; + RefPtr<Blob> blob = Blob::create(); + for (; i < m_items.size() && static_cast<unsigned long long>(start) >= m_items[i]->size(); ++i) + start -= m_items[i]->size(); + for (; length > 0 && i < m_items.size(); ++i) { + blob->m_items.append(m_items[i]->slice(start, length)); + length -= blob->m_items.last()->size(); + start = 0; + } + return blob.release(); } -#endif +#endif // ENABLE(BLOB_SLICE) } // namespace WebCore diff --git a/WebCore/html/Blob.h b/WebCore/html/Blob.h index e8b5f3f..39177b5 100644 --- a/WebCore/html/Blob.h +++ b/WebCore/html/Blob.h @@ -31,21 +31,24 @@ #ifndef Blob_h #define Blob_h -#include "ExceptionCode.h" +#include "BlobItem.h" #include "PlatformString.h" -#include <time.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> +#include <wtf/Vector.h> namespace WebCore { class Blob : public RefCounted<Blob> { public: -#if ENABLE(BLOB_SLICE) - static const int toEndOfFile; - static const double doNotCheckFileChange; -#endif + static PassRefPtr<Blob> create() + { + return adoptRef(new Blob()); + } + // FIXME: Deprecated method. This is called only from + // bindings/v8/SerializedScriptValue.cpp and the usage in it will become invalid once + // BlobBuilder is introduced. static PassRefPtr<Blob> create(const String& path) { return adoptRef(new Blob(path)); @@ -53,47 +56,28 @@ public: virtual ~Blob() { } + unsigned long long size() const; + const String& type() const { return m_type; } virtual bool isFile() const { return false; } -#if ENABLE(BLOB_SLICE) - PassRefPtr<Blob> slice(long long start, long long length) const; -#endif - - const String& path() const { return m_path; } - unsigned long long size() const; -#if ENABLE(BLOB_SLICE) - long long start() const { return m_start; } - long long length() const { return m_length; } - double modificationTime() const { return m_snapshotModificationTime; } -#endif + // FIXME: Deprecated method. + const String& path() const; -protected: - Blob(const String& path); + void append(PassRefPtr<BlobItem>); + const BlobItemList& items() const { return m_items; } -private: #if ENABLE(BLOB_SLICE) - Blob(const String& path, long long start, long long length, long long snapshotSize, double snapshotModificationTime); + PassRefPtr<Blob> slice(long long start, long long length) const; #endif - // The underlying path of the file-based blob. - String m_path; - -#if ENABLE(BLOB_SLICE) - // The starting position of the file-based blob. - long long m_start; - - // The length of the file-based blob. The value of -1 means to the end of the file. - long long m_length; - - // A flag to tell if a snapshot has been captured. - bool m_snapshotCaptured; +protected: + Blob() { } - // The size of the file when a snapshot is captured. It can be 0 if the file is empty. - long long m_snapshotSize; + // FIXME: Deprecated constructor. See also the comment for Blob::create(path). + Blob(const String& path); - // The last modification time of the file when a snapshot is captured. The value of 0 also means that the snapshot is not captured. - double m_snapshotModificationTime; -#endif + BlobItemList m_items; + String m_type; }; } // namespace WebCore diff --git a/WebCore/html/DocTypeStrings.gperf b/WebCore/html/DocTypeStrings.gperf index 398626e..5c213b0 100644 --- a/WebCore/html/DocTypeStrings.gperf +++ b/WebCore/html/DocTypeStrings.gperf @@ -1,3 +1,4 @@ +%struct-type struct PubIDInfo { enum eMode { eQuirks, @@ -9,6 +10,15 @@ struct PubIDInfo { eMode mode_if_no_sysid; eMode mode_if_sysid; } +%language=ANSI-C +%readonly-tables +%global-table +%compare-strncmp +%define initializer-suffix ,PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards +%define lookup-function-name findDoctypeEntry +%define hash-function-name doctype_hash_function +%includes +%enum %% "+//silmaril//dtd html pro v0r11 19970101//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 "-//advasoft ltd//dtd html 3.0 aswedit + extensions//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 diff --git a/WebCore/html/File.cpp b/WebCore/html/File.cpp index 97fdc45..2c9ce53 100644 --- a/WebCore/html/File.cpp +++ b/WebCore/html/File.cpp @@ -33,12 +33,17 @@ namespace WebCore { File::File(const String& path) : Blob(path) - , m_name(pathGetFileName(path)) { // We don't use MIMETypeRegistry::getMIMETypeForPath() because it returns "application/octet-stream" upon failure. - int index = m_name.reverseFind('.'); + const String& fileName = name(); + int index = fileName.reverseFind('.'); if (index != -1) - m_type = MIMETypeRegistry::getMIMETypeForExtension(m_name.substring(index + 1)); + m_type = MIMETypeRegistry::getMIMETypeForExtension(fileName.substring(index + 1)); +} + +const String& File::name() const +{ + return items().at(0)->toFileBlobItem()->name(); } } // namespace WebCore diff --git a/WebCore/html/File.h b/WebCore/html/File.h index 065dd86..582db28 100644 --- a/WebCore/html/File.h +++ b/WebCore/html/File.h @@ -41,18 +41,14 @@ public: virtual bool isFile() const { return true; } - const String& name() const { return m_name; } - const String& type() const { return m_type; } + const String& name() const; // FIXME: obsolete attributes. To be removed. - const String& fileName() const { return m_name; } + const String& fileName() const { return name(); } unsigned long long fileSize() const { return size(); } private: File(const String& path); - - String m_name; - String m_type; }; } // namespace WebCore diff --git a/WebCore/html/FileReader.cpp b/WebCore/html/FileReader.cpp index 3442342..2e020c1 100644 --- a/WebCore/html/FileReader.cpp +++ b/WebCore/html/FileReader.cpp @@ -85,6 +85,7 @@ void FileReader::stop() void FileReader::readAsBinaryString(Blob* fileBlob) { + // FIXME: needs to handle non-file blobs. LOG(FileAPI, "FileReader: reading as binary: %s\n", fileBlob->path().utf8().data()); readInternal(fileBlob, ReadFileAsBinaryString); @@ -92,6 +93,7 @@ void FileReader::readAsBinaryString(Blob* fileBlob) void FileReader::readAsText(Blob* fileBlob, const String& encoding) { + // FIXME: needs to handle non-file blobs. LOG(FileAPI, "FileReader: reading as text: %s\n", fileBlob->path().utf8().data()); if (!encoding.isEmpty()) diff --git a/WebCore/html/FileStream.cpp b/WebCore/html/FileStream.cpp index 9a06eed..f859b63 100644 --- a/WebCore/html/FileStream.cpp +++ b/WebCore/html/FileStream.cpp @@ -72,48 +72,53 @@ void FileStream::openForRead(Blob* blob) if (isHandleValid(m_handle)) return; + // FIXME: Need to handle multiple items that may include non-file ones when BlobBuilder is introduced. + ASSERT(blob->items().size() >= 1); + const FileBlobItem* fileItem = blob->items().at(0)->toFileBlobItem(); + if (!fileItem) { + ASSERT(false); + m_client->didFail(NOT_READABLE_ERR); + return; + } + // Check if the file exists by querying its modification time. We choose not to call fileExists() in order to save an // extra file system call when the modification time is needed to check the validity of the sliced file blob. // Per the spec, we need to return different error codes to differentiate between non-existent file and permission error. // openFile() could not tell use the failure reason. time_t currentModificationTime; - if (!getFileModificationTime(blob->path(), currentModificationTime)) { + if (!getFileModificationTime(fileItem->path(), currentModificationTime)) { m_client->didFail(NOT_FOUND_ERR); return; } // Open the file blob. - m_handle = openFile(blob->path(), OpenForRead); + m_handle = openFile(fileItem->path(), OpenForRead); if (!isHandleValid(m_handle)) { m_client->didFail(NOT_READABLE_ERR); return; } #if ENABLE(BLOB_SLICE) - // Check the modificationt time for the possible file change. - if (blob->modificationTime() != Blob::doNotCheckFileChange && static_cast<time_t>(blob->modificationTime()) != currentModificationTime) { - m_client->didFail(NOT_READABLE_ERR); - return; - } - - // Jump to the beginning position if the file has been sliced. - if (blob->start() > 0) { - if (!seekFile(m_handle, blob->start(), SeekFromBeginning)) { + const FileRangeBlobItem* fileRangeItem = fileItem->toFileRangeBlobItem(); + if (fileRangeItem) { + // Check the modificationt time for the possible file change. + if (static_cast<time_t>(fileRangeItem->snapshotModificationTime()) != currentModificationTime) { m_client->didFail(NOT_READABLE_ERR); return; } + + // Jump to the beginning position if the file has been sliced. + if (fileRangeItem->start() > 0) { + if (seekFile(m_handle, fileRangeItem->start(), SeekFromBeginning) < 0) { + m_client->didFail(NOT_READABLE_ERR); + return; + } + } } #endif // Get the size. -#if ENABLE(BLOB_SLICE) - m_totalBytesToRead = blob->length(); - if (m_totalBytesToRead == Blob::toEndOfFile) - m_totalBytesToRead = blob->size() - blob->start(); -#else m_totalBytesToRead = blob->size(); -#endif - m_client->didGetSize(m_totalBytesToRead); } diff --git a/WebCore/html/FormDataList.cpp b/WebCore/html/FormDataList.cpp index 281c9fe..0f62595 100644 --- a/WebCore/html/FormDataList.cpp +++ b/WebCore/html/FormDataList.cpp @@ -28,64 +28,22 @@ FormDataList::FormDataList(const TextEncoding& c) { } -void FormDataList::appendString(const CString& s) +void FormDataList::appendString(const String& s) { - m_list.append(s); + m_items.append(StringBlobItem::create(s, EndingCRLF, m_encoding)); } -// Change plain CR and plain LF to CRLF pairs. -static CString fixLineBreaks(const CString& s) +void FormDataList::appendString(const CString& s) { - // Compute the length. - unsigned newLen = 0; - const char* p = s.data(); - while (char c = *p++) { - if (c == '\r') { - // Safe to look ahead because of trailing '\0'. - if (*p != '\n') { - // Turn CR into CRLF. - newLen += 2; - } - } else if (c == '\n') { - // Turn LF into CRLF. - newLen += 2; - } else { - // Leave other characters alone. - newLen += 1; - } - } - if (newLen == s.length()) { - return s; - } - - // Make a copy of the string. - p = s.data(); - char* q; - CString result = CString::newUninitialized(newLen, q); - while (char c = *p++) { - if (c == '\r') { - // Safe to look ahead because of trailing '\0'. - if (*p != '\n') { - // Turn CR into CRLF. - *q++ = '\r'; - *q++ = '\n'; - } - } else if (c == '\n') { - // Turn LF into CRLF. - *q++ = '\r'; - *q++ = '\n'; - } else { - // Leave other characters alone. - *q++ = c; - } - } - return result; + m_items.append(StringBlobItem::create(s)); } -void FormDataList::appendString(const String& s) +void FormDataList::appendBlob(const String& key, PassRefPtr<Blob> blob) { - CString cstr = fixLineBreaks(m_encoding.encode(s.characters(), s.length(), EntitiesForUnencodables)); - m_list.append(cstr); + appendString(key); + const BlobItemList& items = blob->items(); + for (size_t i = 0; i < items.size(); ++i) + m_items.append(items.at(i)); } } // namespace diff --git a/WebCore/html/FormDataList.h b/WebCore/html/FormDataList.h index 8ecf64e..f4bb905 100644 --- a/WebCore/html/FormDataList.h +++ b/WebCore/html/FormDataList.h @@ -46,27 +46,9 @@ public: appendString(key); appendString(String::number(value)); } - void appendBlob(const String& key, PassRefPtr<Blob> blob) - { - appendString(key); - m_list.append(blob); - } - - class Item { - public: - Item() { } - Item(const WTF::CString& data) : m_data(data) { } - Item(PassRefPtr<Blob> blob) : m_blob(blob) { } - - const WTF::CString& data() const { return m_data; } - Blob* blob() const { return m_blob.get(); } - - private: - WTF::CString m_data; - RefPtr<Blob> m_blob; - }; + void appendBlob(const String& key, PassRefPtr<Blob>); - const Vector<Item>& list() const { return m_list; } + const BlobItemList& items() const { return m_items; } const TextEncoding& encoding() const { return m_encoding; } private: @@ -74,7 +56,7 @@ private: void appendString(const String&); TextEncoding m_encoding; - Vector<Item> m_list; + BlobItemList m_items; }; } // namespace WebCore diff --git a/WebCore/html/HTML5DocumentParser.cpp b/WebCore/html/HTML5DocumentParser.cpp new file mode 100644 index 0000000..28df14e --- /dev/null +++ b/WebCore/html/HTML5DocumentParser.cpp @@ -0,0 +1,310 @@ +/* + * Copyright (C) 2010 Google, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "HTML5DocumentParser.h" + +#include "Element.h" +#include "Frame.h" +#include "HTML5Lexer.h" +#include "HTML5ScriptRunner.h" +#include "HTML5TreeBuilder.h" +#include "HTMLDocument.h" +#include "Node.h" +#include "NotImplemented.h" +#include "XSSAuditor.h" + +#if ENABLE(INSPECTOR) +#include "InspectorTimelineAgent.h" +#endif + +namespace WebCore { + +namespace { + +class NestingLevelIncrementer : public Noncopyable { +public: + NestingLevelIncrementer(int& counter) + : m_counter(&counter) + { + ++(*m_counter); + } + + ~NestingLevelIncrementer() + { + --(*m_counter); + } + +private: + int* m_counter; +}; + +} // namespace + +HTML5DocumentParser::HTML5DocumentParser(HTMLDocument* document, bool reportErrors) + : DocumentParser() + , m_document(document) + , m_lexer(new HTML5Lexer) + , m_scriptRunner(new HTML5ScriptRunner(document, this)) + , m_treeConstructor(new HTML5TreeBuilder(m_lexer.get(), document, reportErrors)) + , m_endWasDelayed(false) + , m_writeNestingLevel(0) +{ + begin(); +} + +HTML5DocumentParser::~HTML5DocumentParser() +{ + // FIXME: We'd like to ASSERT that normal operation of this class clears + // out any delayed actions, but we can't because we're unceremoniously + // deleted. If there were a required call to some sort of cancel function, + // then we could ASSERT some invariants here. +} + +void HTML5DocumentParser::begin() +{ + // FIXME: Should we reset the lexer? +} + +void HTML5DocumentParser::pumpLexerIfPossible() +{ + if (m_parserStopped || m_treeConstructor->isPaused()) + return; + pumpLexer(); +} + +void HTML5DocumentParser::pumpLexer() +{ + // We tell the InspectorTimelineAgent about every pump, even if we + // end up pumping nothing. It can filter out empty pumps itself. + willPumpLexer(); + + ASSERT(!m_parserStopped); + ASSERT(!m_treeConstructor->isPaused()); + while (!m_parserStopped && m_lexer->nextToken(m_input.current(), m_token)) { + if (ScriptController* scriptController = script()) + scriptController->setEventHandlerLineNumber(lineNumber() + 1); + + m_treeConstructor->constructTreeFromToken(m_token); + m_token.clear(); + + if (ScriptController* scriptController = script()) + scriptController->setEventHandlerLineNumber(0); + + if (!m_treeConstructor->isPaused()) + continue; + + // The parser will pause itself when waiting on a script to load or run. + // ScriptRunner executes scripts at the right times and handles reentrancy. + int scriptStartLine = 0; + RefPtr<Element> scriptElement = m_treeConstructor->takeScriptToProcess(scriptStartLine); + bool shouldContinueParsing = m_scriptRunner->execute(scriptElement.release(), scriptStartLine); + m_treeConstructor->setPaused(!shouldContinueParsing); + if (!shouldContinueParsing) + return; + } + + didPumpLexer(); +} + +void HTML5DocumentParser::willPumpLexer() +{ +#if ENABLE(INSPECTOR) + // FIXME: m_input.current().length() is only accurate if we + // end up parsing the whole buffer in this pump. We should pass how + // much we parsed as part of didWriteHTML instead of willWriteHTML. + if (InspectorTimelineAgent* timelineAgent = m_document->inspectorTimelineAgent()) + timelineAgent->willWriteHTML(m_input.current().length(), m_lexer->lineNumber()); +#endif +} + +void HTML5DocumentParser::didPumpLexer() +{ +#if ENABLE(INSPECTOR) + if (InspectorTimelineAgent* timelineAgent = m_document->inspectorTimelineAgent()) + timelineAgent->didWriteHTML(m_lexer->lineNumber()); +#endif +} + +void HTML5DocumentParser::write(const SegmentedString& source, bool appendData) +{ + if (m_parserStopped) + return; + + NestingLevelIncrementer nestingLevelIncrementer(m_writeNestingLevel); + + if (appendData) { + m_input.appendToEnd(source); + if (m_writeNestingLevel > 1) { + // We've gotten data off the network in a nested call to write(). + // We don't want to consume any more of the input stream now. Do + // not worry. We'll consume this data in a less-nested write(). + return; + } + } else + m_input.insertAtCurrentInsertionPoint(source); + + pumpLexerIfPossible(); + endIfDelayed(); +} + +void HTML5DocumentParser::end() +{ + pumpLexerIfPossible(); + // Informs the the rest of WebCore that parsing is really finished. + m_treeConstructor->finished(); +} + +void HTML5DocumentParser::attemptToEnd() +{ + // finish() indicates we will not receive any more data. If we are waiting on + // an external script to load, we can't finish parsing quite yet. + + if (inWrite() || isWaitingForScripts() || executingScript()) { + m_endWasDelayed = true; + return; + } + end(); +} + +void HTML5DocumentParser::endIfDelayed() +{ + if (!m_endWasDelayed || isWaitingForScripts() || executingScript()) + return; + + m_endWasDelayed = false; + end(); +} + +void HTML5DocumentParser::finish() +{ + // We're not going to get any more data off the network, so we close the + // input stream to indicate EOF. + m_input.close(); + attemptToEnd(); +} + +int HTML5DocumentParser::executingScript() const +{ + return m_scriptRunner->inScriptExecution(); +} + +int HTML5DocumentParser::lineNumber() const +{ + return m_lexer->lineNumber(); +} + +int HTML5DocumentParser::columnNumber() const +{ + return m_lexer->columnNumber(); +} + +LegacyHTMLTreeConstructor* HTML5DocumentParser::htmlTreeConstructor() const +{ + return m_treeConstructor->legacyTreeConstructor(); +} + +bool HTML5DocumentParser::isWaitingForScripts() const +{ + return m_treeConstructor->isPaused(); +} + +void HTML5DocumentParser::resumeParsingAfterScriptExecution() +{ + ASSERT(!m_scriptRunner->inScriptExecution()); + ASSERT(!m_treeConstructor->isPaused()); + pumpLexerIfPossible(); + + // The document already finished parsing we were just waiting on scripts when finished() was called. + endIfDelayed(); +} + +void HTML5DocumentParser::watchForLoad(CachedResource* cachedScript) +{ + ASSERT(!cachedScript->isLoaded()); + // addClient would call notifyFinished if the load were complete. + // Callers do not expect to be re-entered from this call, so they should + // not an already-loaded CachedResource. + cachedScript->addClient(this); +} + +void HTML5DocumentParser::stopWatchingForLoad(CachedResource* cachedScript) +{ + cachedScript->removeClient(this); +} + +bool HTML5DocumentParser::shouldLoadExternalScriptFromSrc(const AtomicString& srcValue) +{ + if (!m_XSSAuditor) + return true; + return m_XSSAuditor->canLoadExternalScriptFromSrc(srcValue); +} + +void HTML5DocumentParser::executeScript(const ScriptSourceCode& sourceCode) +{ + ASSERT(m_scriptRunner->inScriptExecution()); + if (!m_document->frame()) + return; + InsertionPointRecord savedInsertionPoint(m_input); + m_document->frame()->script()->executeScript(sourceCode); +} + +void HTML5DocumentParser::notifyFinished(CachedResource* cachedResource) +{ + ASSERT(!m_scriptRunner->inScriptExecution()); + ASSERT(m_treeConstructor->isPaused()); + // Note: We only ever wait on one script at a time, so we always know this + // is the one we were waiting on and can un-pause the tree builder. + m_treeConstructor->setPaused(false); + bool shouldContinueParsing = m_scriptRunner->executeScriptsWaitingForLoad(cachedResource); + m_treeConstructor->setPaused(!shouldContinueParsing); + if (shouldContinueParsing) + resumeParsingAfterScriptExecution(); +} + +void HTML5DocumentParser::executeScriptsWaitingForStylesheets() +{ + // Ignore calls unless we have a script blocking the parser waiting on a + // stylesheet load. Otherwise we are currently parsing and this + // is a re-entrant call from encountering a </ style> tag. + if (!m_scriptRunner->hasScriptsWaitingForStylesheets()) + return; + ASSERT(!m_scriptRunner->inScriptExecution()); + ASSERT(m_treeConstructor->isPaused()); + // Note: We only ever wait on one script at a time, so we always know this + // is the one we were waiting on and can un-pause the tree builder. + m_treeConstructor->setPaused(false); + bool shouldContinueParsing = m_scriptRunner->executeScriptsWaitingForStylesheets(); + m_treeConstructor->setPaused(!shouldContinueParsing); + if (shouldContinueParsing) + resumeParsingAfterScriptExecution(); +} + +ScriptController* HTML5DocumentParser::script() const +{ + return m_document->frame() ? m_document->frame()->script() : 0; +} + +} diff --git a/WebCore/html/HTML5DocumentParser.h b/WebCore/html/HTML5DocumentParser.h new file mode 100644 index 0000000..4a75cec --- /dev/null +++ b/WebCore/html/HTML5DocumentParser.h @@ -0,0 +1,192 @@ +/* + * Copyright (C) 2010 Google, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 HTML5Tokenizer_h +#define HTML5Tokenizer_h + +#include "CachedResourceClient.h" +#include "HTML5ScriptRunnerHost.h" +#include "HTML5Token.h" +#include "SegmentedString.h" +#include "DocumentParser.h" +#include <wtf/OwnPtr.h> + +namespace WebCore { + +class HTMLDocument; +class LegacyHTMLTreeConstructor; +class HTML5Lexer; +class HTML5ScriptRunner; +class HTML5TreeBuilder; +class ScriptController; +class ScriptSourceCode; + +class HTML5DocumentParser : public DocumentParser, HTML5ScriptRunnerHost, CachedResourceClient { +public: + HTML5DocumentParser(HTMLDocument*, bool reportErrors); + virtual ~HTML5DocumentParser(); + + // DocumentParser + virtual void begin(); + virtual void write(const SegmentedString&, bool appendData); + virtual void end(); + virtual void finish(); + virtual int executingScript() const; + virtual bool isWaitingForScripts() const; + virtual void executeScriptsWaitingForStylesheets(); + virtual int lineNumber() const; + virtual int columnNumber() const; + // FIXME: HTMLFormControlElement accesses the LegacyHTMLTreeConstructor via this method. + // Remove this when the LegacyHTMLTreeConstructor is no longer used. + virtual LegacyHTMLTreeConstructor* htmlTreeConstructor() const; + + // HTML5ScriptRunnerHost + virtual void watchForLoad(CachedResource*); + virtual void stopWatchingForLoad(CachedResource*); + virtual bool shouldLoadExternalScriptFromSrc(const AtomicString&); + virtual void executeScript(const ScriptSourceCode&); + + // CachedResourceClient + virtual void notifyFinished(CachedResource*); + +private: + // The InputStream is made up of a sequence of SegmentedStrings: + // + // [--current--][--next--][--next--] ... [--next--] + // /\ (also called m_last) + // L_ current insertion point + // + // The current segmented string is stored in InputStream. Each of the + // afterInsertionPoint buffers are stored in InsertionPointRecords on the + // stack. + // + // We remove characters from the "current" string in the InputStream. + // document.write() will add characters at the current insertion point, + // which appends them to the "current" string. + // + // m_last is a pointer to the last of the afterInsertionPoint strings. + // The network adds data at the end of the InputStream, which appends + // them to the "last" string. + class InputStream { + public: + InputStream() + : m_last(&m_first) + { + } + + void appendToEnd(const SegmentedString& string) + { + m_last->append(string); + } + + void insertAtCurrentInsertionPoint(const SegmentedString& string) + { + m_first.append(string); + } + + void close() { m_last->close(); } + + SegmentedString& current() { return m_first; } + + void splitInto(SegmentedString& next) + { + next = m_first; + m_first = SegmentedString(); + if (m_last == &m_first) { + // We used to only have one SegmentedString in the InputStream + // but now we have two. That means m_first is no longer also + // the m_last string, |next| is now the last one. + m_last = &next; + } + } + + void mergeFrom(SegmentedString& next) + { + m_first.append(next); + if (m_last == &next) { + // The string |next| used to be the last SegmentedString in + // the InputStream. Now that it's been merged into m_first, + // that makes m_first the last one. + m_last = &m_first; + } + if (next.isClosed()) { + // We also need to merge the "closed" state from next to + // m_first. Arguably, this work could be done in append(). + m_first.close(); + } + } + + private: + SegmentedString m_first; + SegmentedString* m_last; + }; + + class InsertionPointRecord { + public: + InsertionPointRecord(InputStream& inputStream) + : m_inputStream(&inputStream) + { + m_inputStream->splitInto(m_next); + } + + ~InsertionPointRecord() + { + m_inputStream->mergeFrom(m_next); + } + + private: + InputStream* m_inputStream; + SegmentedString m_next; + }; + + void willPumpLexer(); + void didPumpLexer(); + + void pumpLexer(); + void pumpLexerIfPossible(); + void resumeParsingAfterScriptExecution(); + + void attemptToEnd(); + void endIfDelayed(); + bool inWrite() const { return m_writeNestingLevel > 0; } + + ScriptController* script() const; + + InputStream m_input; + + // We hold m_token here because it might be partially complete. + HTML5Token m_token; + + HTMLDocument* m_document; + OwnPtr<HTML5Lexer> m_lexer; + OwnPtr<HTML5ScriptRunner> m_scriptRunner; + OwnPtr<HTML5TreeBuilder> m_treeConstructor; + bool m_endWasDelayed; + int m_writeNestingLevel; +}; + +} + +#endif diff --git a/WebCore/html/HTML5EntityParser.cpp b/WebCore/html/HTML5EntityParser.cpp new file mode 100644 index 0000000..f168245 --- /dev/null +++ b/WebCore/html/HTML5EntityParser.cpp @@ -0,0 +1,242 @@ +/* + * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/ + * Copyright (C) 2010 Google, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "HTML5EntityParser.h" + +#include <wtf/Vector.h> + +// Use __GNUC__ instead of PLATFORM(GCC) to stay consistent with the gperf generated c file +#ifdef __GNUC__ +// The main parser includes this too so we are getting two copies of the data. However, this way the code gets inlined. +#include "HTMLEntityNames.cpp" +#else +// Not inlined for non-GCC compilers +struct Entity { + const char* name; + int code; +}; +const struct Entity* findEntity(register const char* str, register unsigned int len); +#endif + +using namespace WTF; + +namespace WebCore { + +namespace { + +static const UChar windowsLatin1ExtensionArray[32] = { + 0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, // 80-87 + 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008D, 0x017D, 0x008F, // 88-8F + 0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, // 90-97 + 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x009D, 0x017E, 0x0178, // 98-9F +}; + +inline UChar adjustEntity(unsigned value) +{ + if ((value & ~0x1F) != 0x0080) + return value; + return windowsLatin1ExtensionArray[value - 0x80]; +} + +inline unsigned legalEntityFor(unsigned value) +{ + // FIXME: A number of specific entity values generate parse errors. + if (value == 0 || value > 0x10FFFF || (value >= 0xD800 && value <= 0xDFFF)) + return 0xFFFD; + if (value < 0xFFFF) + return adjustEntity(value); + return value; +} + +inline bool isHexDigit(UChar cc) +{ + return (cc >= '0' && cc <= '9') || (cc >= 'a' && cc <= 'f') || (cc >= 'A' && cc <= 'F'); +} + +inline bool isAlphaNumeric(UChar cc) +{ + return (cc >= '0' && cc <= '9') || (cc >= 'a' && cc <= 'z') || (cc >= 'A' && cc <= 'Z'); +} + +void unconsumeCharacters(SegmentedString& source, const Vector<UChar, 10>& consumedCharacters) +{ + if (consumedCharacters.size() == 1) + source.push(consumedCharacters[0]); + else if (consumedCharacters.size() == 2) { + source.push(consumedCharacters[0]); + source.push(consumedCharacters[1]); + } else + source.prepend(SegmentedString(String(consumedCharacters.data(), consumedCharacters.size()))); +} + +} + +unsigned consumeHTML5Entity(SegmentedString& source, bool& notEnoughCharacters, UChar additionalAllowedCharacter) +{ + ASSERT(!additionalAllowedCharacter || additionalAllowedCharacter == '"' || additionalAllowedCharacter == '\'' || additionalAllowedCharacter == '>'); + ASSERT(!notEnoughCharacters); + + enum EntityState { + Initial, + NumberType, + MaybeHexLowerCaseX, + MaybeHexUpperCaseX, + Hex, + Decimal, + Named + }; + EntityState entityState = Initial; + unsigned result = 0; + Vector<UChar, 10> consumedCharacters; + Vector<char, 10> entityName; + + while (!source.isEmpty()) { + UChar cc = *source; + switch (entityState) { + case Initial: { + if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ' || cc == '<' || cc == '&') + return 0; + if (additionalAllowedCharacter && cc == additionalAllowedCharacter) + return 0; + if (cc == '#') { + entityState = NumberType; + break; + } + if ((cc >= 'a' && cc <= 'z') || (cc >= 'A' && cc <= 'Z')) { + entityState = Named; + continue; + } + return 0; + } + case NumberType: { + if (cc == 'x') { + entityState = MaybeHexLowerCaseX; + break; + } + if (cc == 'X') { + entityState = MaybeHexUpperCaseX; + break; + } + if (cc >= '0' && cc <= '9') { + entityState = Decimal; + continue; + } + source.push('#'); + return 0; + } + case MaybeHexLowerCaseX: { + if (isHexDigit(cc)) { + entityState = Hex; + continue; + } + source.push('#'); + source.push('x'); + return 0; + } + case MaybeHexUpperCaseX: { + if (isHexDigit(cc)) { + entityState = Hex; + continue; + } + source.push('#'); + source.push('X'); + return 0; + } + case Hex: { + if (cc >= '0' && cc <= '9') + result = result * 16 + cc - '0'; + else if (cc >= 'a' && cc <= 'f') + result = result * 16 + 10 + cc - 'a'; + else if (cc >= 'A' && cc <= 'F') + result = result * 16 + 10 + cc - 'A'; + else if (cc == ';') { + source.advancePastNonNewline(); + return legalEntityFor(result); + } else + return legalEntityFor(result); + break; + } + case Decimal: { + if (cc >= '0' && cc <= '9') + result = result * 10 + cc - '0'; + else if (cc == ';') { + source.advancePastNonNewline(); + return legalEntityFor(result); + } else + return legalEntityFor(result); + break; + } + case Named: { + // FIXME: This code is wrong. We need to find the longest matching entity. + // The examples from the spec are: + // I'm ¬it; I tell you + // I'm ∉ I tell you + // In the first case, "¬" is the entity. In the second + // case, "∉" is the entity. + // FIXME: Our list of HTML entities is incomplete. + // FIXME: The number 8 below is bogus. + while (!source.isEmpty() && entityName.size() <= 8) { + cc = *source; + if (cc == ';') { + const Entity* entity = findEntity(entityName.data(), entityName.size()); + if (entity) { + source.advanceAndASSERT(';'); + return entity->code; + } + break; + } + if (!isAlphaNumeric(cc)) { + const Entity* entity = findEntity(entityName.data(), entityName.size()); + if (entity) { + // HTML5 tells us to ignore this entity, for historical reasons, + // if the lookhead character is '='. + if (additionalAllowedCharacter && cc == '=') + break; + return entity->code; + } + break; + } + entityName.append(cc); + consumedCharacters.append(cc); + source.advanceAndASSERT(cc); + } + notEnoughCharacters = source.isEmpty(); + unconsumeCharacters(source, consumedCharacters); + return 0; + } + } + consumedCharacters.append(cc); + source.advanceAndASSERT(cc); + } + ASSERT(source.isEmpty()); + notEnoughCharacters = true; + unconsumeCharacters(source, consumedCharacters); + return 0; +} + +} // namespace WebCore diff --git a/WebCore/html/HTML5EntityParser.h b/WebCore/html/HTML5EntityParser.h new file mode 100644 index 0000000..f0a921f --- /dev/null +++ b/WebCore/html/HTML5EntityParser.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright (C) 2010 Google, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 HTML5EntityParser_h +#define HTML5EntityParser_h + +#include "SegmentedString.h" + +namespace WebCore { + +unsigned consumeHTML5Entity(SegmentedString&, bool& notEnoughCharacters, UChar additionalAllowedCharacter = '\0'); + +} + +#endif diff --git a/WebCore/html/HTML5Lexer.cpp b/WebCore/html/HTML5Lexer.cpp index 6c23bb0..0cc4ed1 100644 --- a/WebCore/html/HTML5Lexer.cpp +++ b/WebCore/html/HTML5Lexer.cpp @@ -29,6 +29,7 @@ #include "HTML5Lexer.h" #include "AtomicString.h" +#include "HTML5EntityParser.h" #include "HTML5Token.h" #include "HTMLNames.h" #include "NotImplemented.h" @@ -37,20 +38,6 @@ #include <wtf/text/CString.h> #include <wtf/unicode/Unicode.h> - -// Use __GNUC__ instead of PLATFORM(GCC) to stay consistent with the gperf generated c file -#ifdef __GNUC__ -// The main tokenizer includes this too so we are getting two copies of the data. However, this way the code gets inlined. -#include "HTMLEntityNames.c" -#else -// Not inlined for non-GCC compilers -struct Entity { - const char* name; - int code; -}; -const struct Entity* findEntity(register const char* str, register unsigned int len); -#endif - using namespace WTF; namespace WebCore { @@ -59,13 +46,6 @@ using namespace HTMLNames; namespace { -static const UChar windowsLatin1ExtensionArray[32] = { - 0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, // 80-87 - 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008D, 0x017D, 0x008F, // 88-8F - 0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, // 90-97 - 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x009D, 0x017E, 0x0178, // 98-9F -}; - inline UChar toLowerCase(UChar cc) { ASSERT(cc >= 'A' && cc <= 'Z'); @@ -89,44 +69,6 @@ inline bool vectorEqualsString(const Vector<UChar, 32>& vector, const String& st return !memcmp(stringData, vectorData, vector.size() * sizeof(UChar)); } -inline UChar adjustEntity(unsigned value) -{ - if ((value & ~0x1F) != 0x0080) - return value; - return windowsLatin1ExtensionArray[value - 0x80]; -} - -inline unsigned legalEntityFor(unsigned value) -{ - // FIXME: A number of specific entity values generate parse errors. - if (value == 0 || value > 0x10FFFF || (value >= 0xD800 && value <= 0xDFFF)) - return 0xFFFD; - if (value < 0xFFFF) - return adjustEntity(value); - return value; -} - -inline bool isHexDigit(UChar cc) -{ - return (cc >= '0' && cc <= '9') || (cc >= 'a' && cc <= 'f') || (cc >= 'A' && cc <= 'F'); -} - -inline bool isAlphaNumeric(UChar cc) -{ - return (cc >= '0' && cc <= '9') || (cc >= 'a' && cc <= 'z') || (cc >= 'A' && cc <= 'Z'); -} - -void unconsumeCharacters(SegmentedString& source, const Vector<UChar, 10>& consumedCharacters) -{ - if (consumedCharacters.size() == 1) - source.push(consumedCharacters[0]); - else if (consumedCharacters.size() == 2) { - source.push(consumedCharacters[0]); - source.push(consumedCharacters[1]); - } else - source.prepend(SegmentedString(String(consumedCharacters.data(), consumedCharacters.size()))); -} - inline bool isEndTagBufferingState(HTML5Lexer::State state) { return state == HTML5Lexer::RCDATAEndTagOpenState @@ -154,160 +96,15 @@ void HTML5Lexer::reset() { m_state = DataState; m_token = 0; + m_lineNumber = 0; m_skipLeadingNewLineForListing = false; - m_emitPending = false; m_additionalAllowedCharacter = '\0'; } -unsigned HTML5Lexer::consumeEntity(SegmentedString& source, bool& notEnoughCharacters) -{ - ASSERT(m_state != CharacterReferenceInAttributeValueState || m_additionalAllowedCharacter == '"' || m_additionalAllowedCharacter == '\'' || m_additionalAllowedCharacter == '>'); - ASSERT(!notEnoughCharacters); - - enum EntityState { - Initial, - NumberType, - MaybeHexLowerCaseX, - MaybeHexUpperCaseX, - Hex, - Decimal, - Named - }; - EntityState entityState = Initial; - unsigned result = 0; - Vector<UChar, 10> consumedCharacters; - Vector<char, 10> entityName; - - while (!source.isEmpty()) { - UChar cc = *source; - switch (entityState) { - case Initial: { - if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ' || cc == '<' || cc == '&') - return 0; - if (m_state == CharacterReferenceInAttributeValueState && cc == m_additionalAllowedCharacter) - return 0; - if (cc == '#') { - entityState = NumberType; - break; - } - if ((cc >= 'a' && cc <= 'z') || (cc >= 'A' && cc <= 'Z')) { - entityState = Named; - continue; - } - return 0; - } - case NumberType: { - if (cc == 'x') { - entityState = MaybeHexLowerCaseX; - break; - } - if (cc == 'X') { - entityState = MaybeHexUpperCaseX; - break; - } - if (cc >= '0' && cc <= '9') { - entityState = Decimal; - continue; - } - source.push('#'); - return 0; - } - case MaybeHexLowerCaseX: { - if (isHexDigit(cc)) { - entityState = Hex; - continue; - } - source.push('#'); - source.push('x'); - return 0; - } - case MaybeHexUpperCaseX: { - if (isHexDigit(cc)) { - entityState = Hex; - continue; - } - source.push('#'); - source.push('X'); - return 0; - } - case Hex: { - if (cc >= '0' && cc <= '9') - result = result * 16 + cc - '0'; - else if (cc >= 'a' && cc <= 'f') - result = result * 16 + 10 + cc - 'a'; - else if (cc >= 'A' && cc <= 'F') - result = result * 16 + 10 + cc - 'A'; - else if (cc == ';') { - source.advance(); - return legalEntityFor(result); - } else - return legalEntityFor(result); - break; - } - case Decimal: { - if (cc >= '0' && cc <= '9') - result = result * 10 + cc - '0'; - else if (cc == ';') { - source.advance(); - return legalEntityFor(result); - } else - return legalEntityFor(result); - break; - } - case Named: { - // FIXME: This code is wrong. We need to find the longest matching entity. - // The examples from the spec are: - // I'm ¬it; I tell you - // I'm ∉ I tell you - // In the first case, "¬" is the entity. In the second - // case, "∉" is the entity. - // FIXME: Our list of HTML entities is incomplete. - // FIXME: The number 8 below is bogus. - while (!source.isEmpty() && entityName.size() <= 8) { - cc = *source; - if (cc == ';') { - const Entity* entity = findEntity(entityName.data(), entityName.size()); - if (entity) { - source.advanceAndASSERT(';'); - return entity->code; - } - emitParseError(); - break; - } - if (!isAlphaNumeric(cc)) { - const Entity* entity = findEntity(entityName.data(), entityName.size()); - if (entity) { - // HTML5 tells us to ignore this entity, for historical reasons, - // if the lookhead character is '='. - if (m_state == CharacterReferenceInAttributeValueState && cc == '=') - break; - emitParseError(); - return entity->code; - } - break; - } - entityName.append(cc); - consumedCharacters.append(cc); - source.advanceAndASSERT(cc); - } - notEnoughCharacters = source.isEmpty(); - unconsumeCharacters(source, consumedCharacters); - return 0; - } - } - consumedCharacters.append(cc); - source.advanceAndASSERT(cc); - } - ASSERT(source.isEmpty()); - notEnoughCharacters = true; - unconsumeCharacters(source, consumedCharacters); - return 0; -} - inline bool HTML5Lexer::processEntity(SegmentedString& source) { bool notEnoughCharacters = false; - unsigned value = consumeEntity(source, notEnoughCharacters); + unsigned value = consumeHTML5Entity(source, notEnoughCharacters); if (notEnoughCharacters) return false; if (!value) @@ -317,6 +114,88 @@ inline bool HTML5Lexer::processEntity(SegmentedString& source) return true; } +#if COMPILER(MSVC) +// We need to disable the "unreachable code" warning because we want to assert +// that some code points aren't reached in the state machine. +#pragma warning(disable: 4702) +#endif + +#define BEGIN_STATE(stateName) case stateName: stateName: +#define END_STATE() ASSERT_NOT_REACHED(); break; + +// We use this macro when the HTML5 spec says "reconsume the current input +// character in the <mumble> state." +#define RECONSUME_IN(stateName) \ + do { \ + m_state = stateName; \ + goto stateName; \ + } while (false) + +// We use this macro when the HTML5 spec says "consume the next input +// character ... and switch to the <mumble> state." +#define ADVANCE_TO(stateName) \ + do { \ + m_state = stateName; \ + if (!m_inputStreamPreprocessor.advance(source, m_lineNumber)) \ + return shouldEmitBufferedCharacterToken(source); \ + cc = m_inputStreamPreprocessor.nextInputCharacter(); \ + goto stateName; \ + } while (false) + +// Sometimes there's more complicated logic in the spec that separates when +// we consume the next input character and when we switch to a particular +// state. We handle those cases by advancing the source directly and using +// this macro to switch to the indicated state. +#define SWITCH_TO(stateName) \ + do { \ + m_state = stateName; \ + if (!m_inputStreamPreprocessor.peek(source, m_lineNumber)) \ + return shouldEmitBufferedCharacterToken(source); \ + cc = m_inputStreamPreprocessor.nextInputCharacter(); \ + goto stateName; \ + } while (false) + +// We use this macro when the HTML5 spec says "Emit the current <mumble> +// token. Switch to the <mumble> state." We use the word "resume" instead of +// switch to indicate that this macro actually returns and that we'll end up +// in the state when we "resume" (i.e., are called again). +#define EMIT_AND_RESUME_IN(stateName) \ + do { \ + m_state = stateName; \ + source.advance(m_lineNumber); \ + emitCurrentToken(); \ + return true; \ + } while (false) + +#define _FLUSH_BUFFERED_END_TAG() \ + do { \ + ASSERT(m_token->type() == HTML5Token::Character || \ + m_token->type() == HTML5Token::Uninitialized); \ + source.advance(m_lineNumber); \ + if (m_token->type() == HTML5Token::Character) \ + return true; \ + m_token->beginEndTag(m_bufferedEndTagName); \ + m_bufferedEndTagName.clear(); \ + } while (false) + +#define FLUSH_AND_ADVANCE_TO(stateName) \ + do { \ + m_state = stateName; \ + _FLUSH_BUFFERED_END_TAG(); \ + if (source.isEmpty() \ + || !m_inputStreamPreprocessor.peek(source, m_lineNumber)) \ + return shouldEmitBufferedCharacterToken(source); \ + cc = m_inputStreamPreprocessor.nextInputCharacter(); \ + goto stateName; \ + } while (false) + +#define FLUSH_EMIT_AND_RESUME_IN(stateName) \ + do { \ + m_state = stateName; \ + _FLUSH_BUFFERED_END_TAG(); \ + return true; \ + } while (false) + bool HTML5Lexer::nextToken(SegmentedString& source, HTML5Token& token) { // If we have a token in progress, then we're supposed to be called back @@ -335,1189 +214,1222 @@ bool HTML5Lexer::nextToken(SegmentedString& source, HTML5Token& token) } } + if (source.isEmpty() || !m_inputStreamPreprocessor.peek(source, m_lineNumber)) + return shouldEmitBufferedCharacterToken(source); + UChar cc = m_inputStreamPreprocessor.nextInputCharacter(); + // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#parsing-main-inbody - if (m_skipLeadingNewLineForListing && m_state == DataState && !source.isEmpty() && *source == '\x0A') - source.advanceAndASSERT('\x0A'); - m_skipLeadingNewLineForListing = false; + // Note that this logic is different than the generic \r\n collapsing + // handled in the input stream preprocessor. This logic is here as an + // "authoring convenience" so folks can write: + // + // <pre> + // lorem ipsum + // lorem ipsum + // </pre> + // + // without getting an extra newline at the start of their <pre> element. + if (m_skipLeadingNewLineForListing) { + m_skipLeadingNewLineForListing = false; + if (m_state == DataState && cc == '\n') + ADVANCE_TO(DataState); + } // Source: http://www.whatwg.org/specs/web-apps/current-work/#tokenisation0 - // FIXME: This while should stop as soon as we have a token to return. - while (!source.isEmpty()) { - UChar cc = *source; - switch (m_state) { - case DataState: { - if (cc == '&') - m_state = CharacterReferenceInDataState; - else if (cc == '<') { - if (m_token->type() == HTML5Token::Character) { - // We have a bunch of character tokens queued up that we - // are emitting lazily here. - return true; - } - m_state = TagOpenState; - } else - emitCharacter(cc); - break; + switch (m_state) { + BEGIN_STATE(DataState) { + if (cc == '&') + ADVANCE_TO(CharacterReferenceInDataState); + else if (cc == '<') { + if (m_token->type() == HTML5Token::Character) { + // We have a bunch of character tokens queued up that we + // are emitting lazily here. + return true; + } + ADVANCE_TO(TagOpenState); + } else { + emitCharacter(cc); + ADVANCE_TO(DataState); } - case CharacterReferenceInDataState: { - if (!processEntity(source)) - return shouldEmitBufferedCharacterToken(source); - m_state = DataState; - continue; + } + END_STATE() + + BEGIN_STATE(CharacterReferenceInDataState) { + if (!processEntity(source)) + return shouldEmitBufferedCharacterToken(source); + SWITCH_TO(DataState); + } + END_STATE() + + BEGIN_STATE(RCDATAState) { + if (cc == '&') + ADVANCE_TO(CharacterReferenceInRCDATAState); + else if (cc == '<') + ADVANCE_TO(RCDATALessThanSignState); + else { + emitCharacter(cc); + ADVANCE_TO(RCDATAState); } - case RCDATAState: { - if (cc == '&') - m_state = CharacterReferenceInRCDATAState; - else if (cc == '<') - m_state = RCDATALessThanSignState; - else - emitCharacter(cc); - break; + } + END_STATE() + + BEGIN_STATE(CharacterReferenceInRCDATAState) { + if (!processEntity(source)) + return shouldEmitBufferedCharacterToken(source); + SWITCH_TO(RCDATAState); + } + END_STATE() + + BEGIN_STATE(RAWTEXTState) { + if (cc == '<') + ADVANCE_TO(RAWTEXTLessThanSignState); + else { + emitCharacter(cc); + ADVANCE_TO(RAWTEXTState); } - case CharacterReferenceInRCDATAState: { - if (!processEntity(source)) - return shouldEmitBufferedCharacterToken(source); - m_state = RCDATAState; - continue; + } + END_STATE() + + BEGIN_STATE(ScriptDataState) { + if (cc == '<') + ADVANCE_TO(ScriptDataLessThanSignState); + else { + emitCharacter(cc); + ADVANCE_TO(ScriptDataState); } - case RAWTEXTState: { - if (cc == '<') - m_state = RAWTEXTLessThanSignState; - else - emitCharacter(cc); - break; + } + END_STATE() + + BEGIN_STATE(PLAINTEXTState) { + emitCharacter(cc); + ADVANCE_TO(PLAINTEXTState); + } + END_STATE() + + BEGIN_STATE(TagOpenState) { + if (cc == '!') + ADVANCE_TO(MarkupDeclarationOpenState); + else if (cc == '/') + ADVANCE_TO(EndTagOpenState); + else if (cc >= 'A' && cc <= 'Z') { + m_token->beginStartTag(toLowerCase(cc)); + ADVANCE_TO(TagNameState); + } else if (cc >= 'a' && cc <= 'z') { + m_token->beginStartTag(cc); + ADVANCE_TO(TagNameState); + } else if (cc == '?') { + emitParseError(); + // The spec consumes the current character before switching + // to the bogus comment state, but it's easier to implement + // if we reconsume the current character. + RECONSUME_IN(BogusCommentState); + } else { + emitParseError(); + emitCharacter('<'); + RECONSUME_IN(DataState); } - case ScriptDataState: { - if (cc == '<') - m_state = ScriptDataLessThanSignState; - else - emitCharacter(cc); - break; + } + END_STATE() + + BEGIN_STATE(EndTagOpenState) { + if (cc >= 'A' && cc <= 'Z') { + m_token->beginEndTag(toLowerCase(cc)); + ADVANCE_TO(TagNameState); + } else if (cc >= 'a' && cc <= 'z') { + m_token->beginEndTag(cc); + ADVANCE_TO(TagNameState); + } else if (cc == '>') { + emitParseError(); + ADVANCE_TO(DataState); + } else { + emitParseError(); + RECONSUME_IN(BogusCommentState); } - case PLAINTEXTState: { - emitCharacter(cc); - break; + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(TagNameState) { + if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') + ADVANCE_TO(BeforeAttributeNameState); + else if (cc == '/') + ADVANCE_TO(SelfClosingStartTagState); + else if (cc == '>') + EMIT_AND_RESUME_IN(DataState); + else if (cc >= 'A' && cc <= 'Z') { + m_token->appendToName(toLowerCase(cc)); + ADVANCE_TO(TagNameState); + } else { + m_token->appendToName(cc); + ADVANCE_TO(TagNameState); + } + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(RCDATALessThanSignState) { + if (cc == '/') { + m_temporaryBuffer.clear(); + ASSERT(m_bufferedEndTagName.isEmpty()); + ADVANCE_TO(RCDATAEndTagOpenState); + } else { + emitCharacter('<'); + RECONSUME_IN(RCDATAState); } - case TagOpenState: { - if (cc == '!') - m_state = MarkupDeclarationOpenState; - else if (cc == '/') - m_state = EndTagOpenState; - else if (cc >= 'A' && cc <= 'Z') { - m_token->beginStartTag(toLowerCase(cc)); - m_state = TagNameState; - } else if (cc >= 'a' && cc <= 'z') { - m_token->beginStartTag(cc); - m_state = TagNameState; - } else if (cc == '?') { - emitParseError(); - m_state = BogusCommentState; - // The spec consumes the current character before switching - // to the bogus comment state, but it's easier to implement - // if we reconsume the current character. - continue; - } else { - emitParseError(); - m_state = DataState; - emitCharacter('<'); - continue; - } - break; + } + END_STATE() + + BEGIN_STATE(RCDATAEndTagOpenState) { + if (cc >= 'A' && cc <= 'Z') { + m_temporaryBuffer.append(cc); + addToPossibleEndTag(toLowerCase(cc)); + ADVANCE_TO(RCDATAEndTagNameState); + } else if (cc >= 'a' && cc <= 'z') { + m_temporaryBuffer.append(cc); + addToPossibleEndTag(cc); + ADVANCE_TO(RCDATAEndTagNameState); + } else { + emitCharacter('<'); + emitCharacter('/'); + RECONSUME_IN(RCDATAState); } - case EndTagOpenState: { - if (cc >= 'A' && cc <= 'Z') { - m_token->beginEndTag(toLowerCase(cc)); - m_state = TagNameState; - } else if (cc >= 'a' && cc <= 'z') { - m_token->beginEndTag(cc); - m_state = TagNameState; + } + END_STATE() + + BEGIN_STATE(RCDATAEndTagNameState) { + if (cc >= 'A' && cc <= 'Z') { + m_temporaryBuffer.append(cc); + addToPossibleEndTag(toLowerCase(cc)); + ADVANCE_TO(RCDATAEndTagNameState); + } else if (cc >= 'a' && cc <= 'z') { + m_temporaryBuffer.append(cc); + addToPossibleEndTag(cc); + ADVANCE_TO(RCDATAEndTagNameState); + } else { + if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') { + if (isAppropriateEndTag()) + FLUSH_AND_ADVANCE_TO(BeforeAttributeNameState); + } else if (cc == '/') { + if (isAppropriateEndTag()) + FLUSH_AND_ADVANCE_TO(SelfClosingStartTagState); } else if (cc == '>') { - emitParseError(); - m_state = DataState; - } else { - emitParseError(); - m_state = BogusCommentState; - continue; + if (isAppropriateEndTag()) + FLUSH_EMIT_AND_RESUME_IN(DataState); } - // FIXME: Handle EOF properly. - break; + emitCharacter('<'); + emitCharacter('/'); + m_token->appendToCharacter(m_temporaryBuffer); + m_bufferedEndTagName.clear(); + RECONSUME_IN(RCDATAState); } - case TagNameState: { - if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') - m_state = BeforeAttributeNameState; - else if (cc == '/') - m_state = SelfClosingStartTagState; - else if (cc == '>') { - emitCurrentToken(); - m_state = DataState; - } else if (cc >= 'A' && cc <= 'Z') - m_token->appendToName(toLowerCase(cc)); - else - m_token->appendToName(cc); - // FIXME: Handle EOF properly. - break; + } + END_STATE() + + BEGIN_STATE(RAWTEXTLessThanSignState) { + if (cc == '/') { + m_temporaryBuffer.clear(); + ASSERT(m_bufferedEndTagName.isEmpty()); + ADVANCE_TO(RAWTEXTEndTagOpenState); + } else { + emitCharacter('<'); + RECONSUME_IN(RAWTEXTState); } - case RCDATALessThanSignState: { - if (cc == '/') { - m_temporaryBuffer.clear(); - ASSERT(m_bufferedEndTagName.isEmpty()); - m_state = RCDATAEndTagOpenState; - } else { - emitCharacter('<'); - m_state = RCDATAState; - continue; - } - break; + } + END_STATE() + + BEGIN_STATE(RAWTEXTEndTagOpenState) { + if (cc >= 'A' && cc <= 'Z') { + m_temporaryBuffer.append(cc); + addToPossibleEndTag(toLowerCase(cc)); + ADVANCE_TO(RAWTEXTEndTagNameState); + } else if (cc >= 'a' && cc <= 'z') { + m_temporaryBuffer.append(cc); + addToPossibleEndTag(cc); + ADVANCE_TO(RAWTEXTEndTagNameState); + } else { + emitCharacter('<'); + emitCharacter('/'); + RECONSUME_IN(RAWTEXTState); } - case RCDATAEndTagOpenState: { - if (cc >= 'A' && cc <= 'Z') { - m_temporaryBuffer.append(cc); - addToPossibleEndTag(toLowerCase(cc)); - m_state = RCDATAEndTagNameState; - } else if (cc >= 'a' && cc <= 'z') { - m_temporaryBuffer.append(cc); - addToPossibleEndTag(cc); - m_state = RCDATAEndTagNameState; - } else { - emitCharacter('<'); - emitCharacter('/'); - m_state = RCDATAState; - continue; + } + END_STATE() + + BEGIN_STATE(RAWTEXTEndTagNameState) { + if (cc >= 'A' && cc <= 'Z') { + m_temporaryBuffer.append(cc); + addToPossibleEndTag(toLowerCase(cc)); + ADVANCE_TO(RAWTEXTEndTagNameState); + } else if (cc >= 'a' && cc <= 'z') { + m_temporaryBuffer.append(cc); + addToPossibleEndTag(cc); + ADVANCE_TO(RAWTEXTEndTagNameState); + } else { + if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') { + if (isAppropriateEndTag()) + FLUSH_AND_ADVANCE_TO(BeforeAttributeNameState); + } else if (cc == '/') { + if (isAppropriateEndTag()) + FLUSH_AND_ADVANCE_TO(SelfClosingStartTagState); + } else if (cc == '>') { + if (isAppropriateEndTag()) + FLUSH_EMIT_AND_RESUME_IN(DataState); } - break; + emitCharacter('<'); + emitCharacter('/'); + m_token->appendToCharacter(m_temporaryBuffer); + m_bufferedEndTagName.clear(); + RECONSUME_IN(RAWTEXTState); } - case RCDATAEndTagNameState: { - if (cc >= 'A' && cc <= 'Z') { - m_temporaryBuffer.append(cc); - addToPossibleEndTag(toLowerCase(cc)); - } else if (cc >= 'a' && cc <= 'z') { - m_temporaryBuffer.append(cc); - addToPossibleEndTag(cc); - } else { - if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') { - if (isAppropriateEndTag()) { - m_state = BeforeAttributeNameState; - maybeFlushBufferedEndTag(); - break; - } - } else if (cc == '/') { - if (isAppropriateEndTag()) { - m_state = SelfClosingStartTagState; - maybeFlushBufferedEndTag(); - break; - } - } else if (cc == '>') { - if (isAppropriateEndTag()) { - m_state = DataState; - maybeFlushBufferedEndTag(); - break; - } - } - emitCharacter('<'); - emitCharacter('/'); - m_token->appendToCharacter(m_temporaryBuffer); - m_bufferedEndTagName.clear(); - m_state = RCDATAState; - continue; - } - break; + } + END_STATE() + + BEGIN_STATE(ScriptDataLessThanSignState) { + if (cc == '/') { + m_temporaryBuffer.clear(); + ASSERT(m_bufferedEndTagName.isEmpty()); + ADVANCE_TO(ScriptDataEndTagOpenState); + } else if (cc == '!') { + emitCharacter('<'); + emitCharacter('!'); + ADVANCE_TO(ScriptDataEscapeStartState); + } else { + emitCharacter('<'); + RECONSUME_IN(ScriptDataState); } - case RAWTEXTLessThanSignState: { - if (cc == '/') { - m_temporaryBuffer.clear(); - ASSERT(m_bufferedEndTagName.isEmpty()); - m_state = RAWTEXTEndTagOpenState; - } else { - emitCharacter('<'); - m_state = RAWTEXTState; - continue; - } - break; + } + END_STATE() + + BEGIN_STATE(ScriptDataEndTagOpenState) { + if (cc >= 'A' && cc <= 'Z') { + m_temporaryBuffer.append(cc); + addToPossibleEndTag(toLowerCase(cc)); + ADVANCE_TO(ScriptDataEndTagNameState); + } else if (cc >= 'a' && cc <= 'z') { + m_temporaryBuffer.append(cc); + addToPossibleEndTag(cc); + ADVANCE_TO(ScriptDataEndTagNameState); + } else { + emitCharacter('<'); + emitCharacter('/'); + RECONSUME_IN(ScriptDataState); } - case RAWTEXTEndTagOpenState: { - if (cc >= 'A' && cc <= 'Z') { - m_temporaryBuffer.append(cc); - addToPossibleEndTag(toLowerCase(cc)); - m_state = RAWTEXTEndTagNameState; - } else if (cc >= 'a' && cc <= 'z') { - m_temporaryBuffer.append(cc); - addToPossibleEndTag(cc); - m_state = RAWTEXTEndTagNameState; - } else { - emitCharacter('<'); - emitCharacter('/'); - m_state = RAWTEXTState; - continue; + } + END_STATE() + + BEGIN_STATE(ScriptDataEndTagNameState) { + if (cc >= 'A' && cc <= 'Z') { + m_temporaryBuffer.append(cc); + addToPossibleEndTag(toLowerCase(cc)); + ADVANCE_TO(ScriptDataEndTagNameState); + } else if (cc >= 'a' && cc <= 'z') { + m_temporaryBuffer.append(cc); + addToPossibleEndTag(cc); + ADVANCE_TO(ScriptDataEndTagNameState); + } else { + if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') { + if (isAppropriateEndTag()) + FLUSH_AND_ADVANCE_TO(BeforeAttributeNameState); + } else if (cc == '/') { + if (isAppropriateEndTag()) + FLUSH_AND_ADVANCE_TO(SelfClosingStartTagState); + } else if (cc == '>') { + if (isAppropriateEndTag()) + FLUSH_EMIT_AND_RESUME_IN(DataState); } - break; + emitCharacter('<'); + emitCharacter('/'); + m_token->appendToCharacter(m_temporaryBuffer); + m_bufferedEndTagName.clear(); + RECONSUME_IN(ScriptDataState); } - case RAWTEXTEndTagNameState: { - if (cc >= 'A' && cc <= 'Z') { - m_temporaryBuffer.append(cc); - addToPossibleEndTag(toLowerCase(cc)); - } else if (cc >= 'a' && cc <= 'z') { - m_temporaryBuffer.append(cc); - addToPossibleEndTag(cc); - } else { - if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') { - if (isAppropriateEndTag()) { - m_state = BeforeAttributeNameState; - maybeFlushBufferedEndTag(); - break; - } - } else if (cc == '/') { - if (isAppropriateEndTag()) { - m_state = SelfClosingStartTagState; - maybeFlushBufferedEndTag(); - break; - } - } else if (cc == '>') { - if (isAppropriateEndTag()) { - m_state = DataState; - maybeFlushBufferedEndTag(); - break; - } - } - emitCharacter('<'); - emitCharacter('/'); - m_token->appendToCharacter(m_temporaryBuffer); - m_bufferedEndTagName.clear(); - m_state = RAWTEXTState; - continue; - } - break; + } + END_STATE() + + BEGIN_STATE(ScriptDataEscapeStartState) { + if (cc == '-') { + emitCharacter(cc); + ADVANCE_TO(ScriptDataEscapeStartDashState); + } else + RECONSUME_IN(ScriptDataState); + } + END_STATE() + + BEGIN_STATE(ScriptDataEscapeStartDashState) { + if (cc == '-') { + emitCharacter(cc); + ADVANCE_TO(ScriptDataEscapedDashDashState); + } else + RECONSUME_IN(ScriptDataState); + } + END_STATE() + + BEGIN_STATE(ScriptDataEscapedState) { + if (cc == '-') { + emitCharacter(cc); + ADVANCE_TO(ScriptDataEscapedDashState); + } else if (cc == '<') + ADVANCE_TO(ScriptDataEscapedLessThanSignState); + else { + emitCharacter(cc); + ADVANCE_TO(ScriptDataEscapedState); } - case ScriptDataLessThanSignState: { - if (cc == '/') { - m_temporaryBuffer.clear(); - ASSERT(m_bufferedEndTagName.isEmpty()); - m_state = ScriptDataEndTagOpenState; - } else if (cc == '!') { - emitCharacter('<'); - emitCharacter('!'); - m_state = ScriptDataEscapeStartState; - } else { - emitCharacter('<'); - m_state = ScriptDataState; - continue; - } - break; + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(ScriptDataEscapedDashState) { + if (cc == '-') { + emitCharacter(cc); + ADVANCE_TO(ScriptDataEscapedDashDashState); + } else if (cc == '<') + ADVANCE_TO(ScriptDataEscapedLessThanSignState); + else { + emitCharacter(cc); + ADVANCE_TO(ScriptDataEscapedState); } - case ScriptDataEndTagOpenState: { - if (cc >= 'A' && cc <= 'Z') { - m_temporaryBuffer.append(cc); - addToPossibleEndTag(toLowerCase(cc)); - m_state = ScriptDataEndTagNameState; - } else if (cc >= 'a' && cc <= 'z') { - m_temporaryBuffer.append(cc); - addToPossibleEndTag(cc); - m_state = ScriptDataEndTagNameState; - } else { - emitCharacter('<'); - emitCharacter('/'); - m_state = ScriptDataState; - continue; - } - break; + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(ScriptDataEscapedDashDashState) { + if (cc == '-') { + emitCharacter(cc); + ADVANCE_TO(ScriptDataEscapedDashDashState); + } else if (cc == '<') + ADVANCE_TO(ScriptDataEscapedLessThanSignState); + else if (cc == '>') { + emitCharacter(cc); + ADVANCE_TO(ScriptDataState); + } else { + emitCharacter(cc); + ADVANCE_TO(ScriptDataEscapedState); } - case ScriptDataEndTagNameState: { - if (cc >= 'A' && cc <= 'Z') { - m_temporaryBuffer.append(cc); - addToPossibleEndTag(toLowerCase(cc)); - } else if (cc >= 'a' && cc <= 'z') { - m_temporaryBuffer.append(cc); - addToPossibleEndTag(cc); - } else { - if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') { - if (isAppropriateEndTag()) { - m_state = BeforeAttributeNameState; - maybeFlushBufferedEndTag(); - break; - } - } else if (cc == '/') { - if (isAppropriateEndTag()) { - m_state = SelfClosingStartTagState; - maybeFlushBufferedEndTag(); - break; - } - } else if (cc == '>') { - if (isAppropriateEndTag()) { - m_state = DataState; - maybeFlushBufferedEndTag(); - break; - } - } - emitCharacter('<'); - emitCharacter('/'); - m_token->appendToCharacter(m_temporaryBuffer); - m_bufferedEndTagName.clear(); - m_state = ScriptDataState; - continue; - } - break; + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(ScriptDataEscapedLessThanSignState) { + if (cc == '/') { + m_temporaryBuffer.clear(); + ASSERT(m_bufferedEndTagName.isEmpty()); + ADVANCE_TO(ScriptDataEscapedEndTagOpenState); + } else if (cc >= 'A' && cc <= 'Z') { + emitCharacter('<'); + emitCharacter(cc); + m_temporaryBuffer.clear(); + m_temporaryBuffer.append(toLowerCase(cc)); + ADVANCE_TO(ScriptDataDoubleEscapeStartState); + } else if (cc >= 'a' && cc <= 'z') { + emitCharacter('<'); + emitCharacter(cc); + m_temporaryBuffer.clear(); + m_temporaryBuffer.append(cc); + ADVANCE_TO(ScriptDataDoubleEscapeStartState); + } else { + emitCharacter('<'); + RECONSUME_IN(ScriptDataEscapedState); } - case ScriptDataEscapeStartState: { - if (cc == '-') { - emitCharacter(cc); - m_state = ScriptDataEscapeStartDashState; - } else { - m_state = ScriptDataState; - continue; - } - break; + } + END_STATE() + + BEGIN_STATE(ScriptDataEscapedEndTagOpenState) { + if (cc >= 'A' && cc <= 'Z') { + m_temporaryBuffer.append(cc); + addToPossibleEndTag(toLowerCase(cc)); + ADVANCE_TO(ScriptDataEscapedEndTagNameState); + } else if (cc >= 'a' && cc <= 'z') { + m_temporaryBuffer.append(cc); + addToPossibleEndTag(cc); + ADVANCE_TO(ScriptDataEscapedEndTagNameState); + } else { + emitCharacter('<'); + emitCharacter('/'); + RECONSUME_IN(ScriptDataEscapedState); } - case ScriptDataEscapeStartDashState: { - if (cc == '-') { - emitCharacter(cc); - m_state = ScriptDataEscapedDashDashState; - } else { - m_state = ScriptDataState; - continue; + } + END_STATE() + + BEGIN_STATE(ScriptDataEscapedEndTagNameState) { + if (cc >= 'A' && cc <= 'Z') { + m_temporaryBuffer.append(cc); + addToPossibleEndTag(toLowerCase(cc)); + ADVANCE_TO(ScriptDataEscapedEndTagNameState); + } else if (cc >= 'a' && cc <= 'z') { + m_temporaryBuffer.append(cc); + addToPossibleEndTag(cc); + ADVANCE_TO(ScriptDataEscapedEndTagNameState); + } else { + if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') { + if (isAppropriateEndTag()) + FLUSH_AND_ADVANCE_TO(BeforeAttributeNameState); + } else if (cc == '/') { + if (isAppropriateEndTag()) + FLUSH_AND_ADVANCE_TO(SelfClosingStartTagState); + } else if (cc == '>') { + if (isAppropriateEndTag()) + FLUSH_EMIT_AND_RESUME_IN(DataState); } - break; + emitCharacter('<'); + emitCharacter('/'); + m_token->appendToCharacter(m_temporaryBuffer); + m_bufferedEndTagName.clear(); + RECONSUME_IN(ScriptDataEscapedState); } - case ScriptDataEscapedState: { - if (cc == '-') { - emitCharacter(cc); - m_state = ScriptDataEscapedDashState; - } else if (cc == '<') - m_state = ScriptDataEscapedLessThanSignState; + } + END_STATE() + + BEGIN_STATE(ScriptDataDoubleEscapeStartState) { + if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ' || cc == '/' || cc == '>') { + emitCharacter(cc); + if (temporaryBufferIs(scriptTag.localName())) + ADVANCE_TO(ScriptDataDoubleEscapedState); else - emitCharacter(cc); - // FIXME: Handle EOF properly. - break; - } - case ScriptDataEscapedDashState: { - if (cc == '-') { - emitCharacter(cc); - m_state = ScriptDataEscapedDashDashState; - } else if (cc == '<') - m_state = ScriptDataEscapedLessThanSignState; - else { - emitCharacter(cc); - m_state = ScriptDataEscapedState; - } - // FIXME: Handle EOF properly. - break; - } - case ScriptDataEscapedDashDashState: { - if (cc == '-') - emitCharacter(cc); - else if (cc == '<') - m_state = ScriptDataEscapedLessThanSignState; - else if (cc == '>') { - emitCharacter(cc); - m_state = ScriptDataState; - } else { - emitCharacter(cc); - m_state = ScriptDataEscapedState; - } - // FIXME: Handle EOF properly. - break; - } - case ScriptDataEscapedLessThanSignState: { - if (cc == '/') { - m_temporaryBuffer.clear(); - ASSERT(m_bufferedEndTagName.isEmpty()); - m_state = ScriptDataEscapedEndTagOpenState; - } else if (cc >= 'A' && cc <= 'Z') { - emitCharacter('<'); - emitCharacter(cc); - m_temporaryBuffer.clear(); - m_temporaryBuffer.append(toLowerCase(cc)); - m_state = ScriptDataDoubleEscapeStartState; - } else if (cc >= 'a' && cc <= 'z') { - emitCharacter('<'); - emitCharacter(cc); - m_temporaryBuffer.clear(); - m_temporaryBuffer.append(cc); - m_state = ScriptDataDoubleEscapeStartState; - } else { - emitCharacter('<'); - m_state = ScriptDataEscapedState; - continue; - } - break; - } - case ScriptDataEscapedEndTagOpenState: { - if (cc >= 'A' && cc <= 'Z') { - m_temporaryBuffer.append(cc); - addToPossibleEndTag(toLowerCase(cc)); - m_state = ScriptDataEscapedEndTagNameState; - } else if (cc >= 'a' && cc <= 'z') { - m_temporaryBuffer.append(cc); - addToPossibleEndTag(cc); - m_state = ScriptDataEscapedEndTagNameState; - } else { - emitCharacter('<'); - emitCharacter('/'); - m_state = ScriptDataEscapedState; - continue; - } - break; - } - case ScriptDataEscapedEndTagNameState: { - if (cc >= 'A' && cc <= 'Z') { - m_temporaryBuffer.append(cc); - addToPossibleEndTag(toLowerCase(cc)); - } else if (cc >= 'a' && cc <= 'z') { - m_temporaryBuffer.append(cc); - addToPossibleEndTag(cc); - } else { - if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') { - if (isAppropriateEndTag()) { - m_state = BeforeAttributeNameState; - maybeFlushBufferedEndTag(); - break; - } - } else if (cc == '/') { - if (isAppropriateEndTag()) { - m_state = SelfClosingStartTagState; - maybeFlushBufferedEndTag(); - break; - } - } else if (cc == '>') { - if (isAppropriateEndTag()) { - m_state = DataState; - maybeFlushBufferedEndTag(); - break; - } - } - emitCharacter('<'); - emitCharacter('/'); - m_token->appendToCharacter(m_temporaryBuffer); - m_bufferedEndTagName.clear(); - m_state = ScriptDataEscapedState; - continue; - } - break; - } - case ScriptDataDoubleEscapeStartState: { - if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ' || cc == '/' || cc == '>') { - emitCharacter(cc); - if (temporaryBufferIs(scriptTag.localName())) - m_state = ScriptDataDoubleEscapedState; - else - m_state = ScriptDataEscapedState; - } else if (cc >= 'A' && cc <= 'Z') { - emitCharacter(cc); - m_temporaryBuffer.append(toLowerCase(cc)); - } else if (cc >= 'a' && cc <= 'z') { - emitCharacter(cc); - m_temporaryBuffer.append(cc); - } else { - m_state = ScriptDataEscapedState; - continue; - } - break; - } - case ScriptDataDoubleEscapedState: { - if (cc == '-') { - emitCharacter(cc); - m_state = ScriptDataDoubleEscapedDashState; - } else if (cc == '<') { - emitCharacter(cc); - m_state = ScriptDataDoubleEscapedLessThanSignState; - } else - emitCharacter(cc); - // FIXME: Handle EOF properly. - break; - } - case ScriptDataDoubleEscapedDashState: { - if (cc == '-') { - emitCharacter(cc); - m_state = ScriptDataDoubleEscapedDashDashState; - } else if (cc == '<') { - emitCharacter(cc); - m_state = ScriptDataDoubleEscapedLessThanSignState; - } else { - emitCharacter(cc); - m_state = ScriptDataDoubleEscapedState; - } - // FIXME: Handle EOF properly. - break; - } - case ScriptDataDoubleEscapedDashDashState: { - if (cc == '-') - emitCharacter(cc); - else if (cc == '<') { - emitCharacter(cc); - m_state = ScriptDataDoubleEscapedLessThanSignState; - } else if (cc == '>') { - emitCharacter(cc); - m_state = ScriptDataState; - } else { - emitCharacter(cc); - m_state = ScriptDataDoubleEscapedState; - } - // FIXME: Handle EOF properly. - break; + ADVANCE_TO(ScriptDataEscapedState); + } else if (cc >= 'A' && cc <= 'Z') { + emitCharacter(cc); + m_temporaryBuffer.append(toLowerCase(cc)); + ADVANCE_TO(ScriptDataDoubleEscapeStartState); + } else if (cc >= 'a' && cc <= 'z') { + emitCharacter(cc); + m_temporaryBuffer.append(cc); + ADVANCE_TO(ScriptDataDoubleEscapeStartState); + } else + RECONSUME_IN(ScriptDataEscapedState); + } + END_STATE() + + BEGIN_STATE(ScriptDataDoubleEscapedState) { + if (cc == '-') { + emitCharacter(cc); + ADVANCE_TO(ScriptDataDoubleEscapedDashState); + } else if (cc == '<') { + emitCharacter(cc); + ADVANCE_TO(ScriptDataDoubleEscapedLessThanSignState); + } else { + emitCharacter(cc); + ADVANCE_TO(ScriptDataDoubleEscapedState); } - case ScriptDataDoubleEscapedLessThanSignState: { - if (cc == '/') { - emitCharacter(cc); - m_temporaryBuffer.clear(); - m_state = ScriptDataDoubleEscapeEndState; - } else { - m_state = ScriptDataDoubleEscapedState; - continue; - } - break; + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(ScriptDataDoubleEscapedDashState) { + if (cc == '-') { + emitCharacter(cc); + ADVANCE_TO(ScriptDataDoubleEscapedDashDashState); + } else if (cc == '<') { + emitCharacter(cc); + ADVANCE_TO(ScriptDataDoubleEscapedLessThanSignState); + } else { + emitCharacter(cc); + ADVANCE_TO(ScriptDataDoubleEscapedState); } - case ScriptDataDoubleEscapeEndState: { - if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ' || cc == '/' || cc == '>') { - emitCharacter(cc); - if (temporaryBufferIs(scriptTag.localName())) - m_state = ScriptDataEscapedState; - else - m_state = ScriptDataDoubleEscapedState; - } else if (cc >= 'A' && cc <= 'Z') { - emitCharacter(cc); - m_temporaryBuffer.append(toLowerCase(cc)); - } else if (cc >= 'a' && cc <= 'z') { - emitCharacter(cc); - m_temporaryBuffer.append(cc); - } else { - m_state = ScriptDataDoubleEscapedState; - continue; - } - break; + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(ScriptDataDoubleEscapedDashDashState) { + if (cc == '-') { + emitCharacter(cc); + ADVANCE_TO(ScriptDataDoubleEscapedDashDashState); + } else if (cc == '<') { + emitCharacter(cc); + ADVANCE_TO(ScriptDataDoubleEscapedLessThanSignState); + } else if (cc == '>') { + emitCharacter(cc); + ADVANCE_TO(ScriptDataState); + } else { + emitCharacter(cc); + ADVANCE_TO(ScriptDataDoubleEscapedState); } - case BeforeAttributeNameState: { - if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') - break; - else if (cc == '/') - m_state = SelfClosingStartTagState; - else if (cc == '>') { - emitCurrentToken(); - m_state = DataState; - } else if (cc >= 'A' && cc <= 'Z') { - m_token->addNewAttribute(); - m_token->appendToAttributeName(toLowerCase(cc)); - m_state = AttributeNameState; - } else { - if (cc == '"' || cc == '\'' || cc == '<' || cc == '=') - emitParseError(); - m_token->addNewAttribute(); - m_token->appendToAttributeName(cc); - m_state = AttributeNameState; - } - // FIXME: Handle EOF properly. - break; + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(ScriptDataDoubleEscapedLessThanSignState) { + if (cc == '/') { + emitCharacter(cc); + m_temporaryBuffer.clear(); + ADVANCE_TO(ScriptDataDoubleEscapeEndState); + } else + RECONSUME_IN(ScriptDataDoubleEscapedState); + } + END_STATE() + + BEGIN_STATE(ScriptDataDoubleEscapeEndState) { + if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ' || cc == '/' || cc == '>') { + emitCharacter(cc); + if (temporaryBufferIs(scriptTag.localName())) + ADVANCE_TO(ScriptDataEscapedState); + else + ADVANCE_TO(ScriptDataDoubleEscapedState); + } else if (cc >= 'A' && cc <= 'Z') { + emitCharacter(cc); + m_temporaryBuffer.append(toLowerCase(cc)); + ADVANCE_TO(ScriptDataDoubleEscapeEndState); + } else if (cc >= 'a' && cc <= 'z') { + emitCharacter(cc); + m_temporaryBuffer.append(cc); + ADVANCE_TO(ScriptDataDoubleEscapeEndState); + } else + RECONSUME_IN(ScriptDataDoubleEscapedState); + } + END_STATE() + + BEGIN_STATE(BeforeAttributeNameState) { + if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') + ADVANCE_TO(BeforeAttributeNameState); + else if (cc == '/') + ADVANCE_TO(SelfClosingStartTagState); + else if (cc == '>') + EMIT_AND_RESUME_IN(DataState); + else if (cc >= 'A' && cc <= 'Z') { + m_token->addNewAttribute(); + m_token->appendToAttributeName(toLowerCase(cc)); + ADVANCE_TO(AttributeNameState); + } else { + if (cc == '"' || cc == '\'' || cc == '<' || cc == '=') + emitParseError(); + m_token->addNewAttribute(); + m_token->appendToAttributeName(cc); + ADVANCE_TO(AttributeNameState); } - case AttributeNameState: { - if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') - m_state = AfterAttributeNameState; - else if (cc == '/') - m_state = SelfClosingStartTagState; - else if (cc == '=') - m_state = BeforeAttributeValueState; - else if (cc == '>') { - emitCurrentToken(); - m_state = DataState; - } else if (cc >= 'A' && cc <= 'Z') - m_token->appendToAttributeName(toLowerCase(cc)); - else { - if (cc == '"' || cc == '\'' || cc == '<' || cc == '=') - emitParseError(); - m_token->appendToAttributeName(cc); - m_state = AttributeNameState; - } - // FIXME: Handle EOF properly. - break; + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(AttributeNameState) { + if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') + ADVANCE_TO(AfterAttributeNameState); + else if (cc == '/') + ADVANCE_TO(SelfClosingStartTagState); + else if (cc == '=') + ADVANCE_TO(BeforeAttributeValueState); + else if (cc == '>') + EMIT_AND_RESUME_IN(DataState); + else if (cc >= 'A' && cc <= 'Z') { + m_token->appendToAttributeName(toLowerCase(cc)); + ADVANCE_TO(AttributeNameState); + } else { + if (cc == '"' || cc == '\'' || cc == '<' || cc == '=') + emitParseError(); + m_token->appendToAttributeName(cc); + ADVANCE_TO(AttributeNameState); } - case AfterAttributeNameState: { - if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') - break; - else if (cc == '/') - m_state = SelfClosingStartTagState; - else if (cc == '=') - m_state = BeforeAttributeValueState; - else if (cc == '=') { - emitCurrentToken(); - m_state = DataState; - } else if (cc >= 'A' && cc <= 'Z') { - m_token->addNewAttribute(); - m_token->appendToAttributeName(toLowerCase(cc)); - m_state = AttributeNameState; - } else { - if (cc == '"' || cc == '\'' || cc == '<') - emitParseError(); - m_token->addNewAttribute(); - m_token->appendToAttributeName(cc); - m_state = AttributeNameState; - } - // FIXME: Handle EOF properly. - break; + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(AfterAttributeNameState) { + if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') + ADVANCE_TO(AfterAttributeNameState); + else if (cc == '/') + ADVANCE_TO(SelfClosingStartTagState); + else if (cc == '=') + ADVANCE_TO(BeforeAttributeValueState); + else if (cc == '>') + EMIT_AND_RESUME_IN(DataState); + else if (cc >= 'A' && cc <= 'Z') { + m_token->addNewAttribute(); + m_token->appendToAttributeName(toLowerCase(cc)); + ADVANCE_TO(AttributeNameState); + } else { + if (cc == '"' || cc == '\'' || cc == '<') + emitParseError(); + m_token->addNewAttribute(); + m_token->appendToAttributeName(cc); + ADVANCE_TO(AttributeNameState); } - case BeforeAttributeValueState: { - if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') - break; - else if (cc == '"') - m_state = AttributeValueDoubleQuotedState; - else if (cc == '&') { - m_state = AttributeValueUnquotedState; - continue; - } else if (cc == '\'') - m_state = AttributeValueSingleQuotedState; - else if (cc == '>') { + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(BeforeAttributeValueState) { + if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') + ADVANCE_TO(BeforeAttributeValueState); + else if (cc == '"') + ADVANCE_TO(AttributeValueDoubleQuotedState); + else if (cc == '&') + RECONSUME_IN(AttributeValueUnquotedState); + else if (cc == '\'') + ADVANCE_TO(AttributeValueSingleQuotedState); + else if (cc == '>') { + emitParseError(); + EMIT_AND_RESUME_IN(DataState); + } else { + if (cc == '<' || cc == '=' || cc == '`') emitParseError(); - emitCurrentToken(); - m_state = DataState; - } else { - if (cc == '<' || cc == '=' || cc == '`') - emitParseError(); - m_token->appendToAttributeValue(cc); - m_state = AttributeValueUnquotedState; - } - break; + m_token->appendToAttributeValue(cc); + ADVANCE_TO(AttributeValueUnquotedState); } - case AttributeValueDoubleQuotedState: { - if (cc == '"') - m_state = AfterAttributeValueQuotedState; - else if (cc == '&') { - m_state = CharacterReferenceInAttributeValueState; - m_additionalAllowedCharacter = '"'; - } else - m_token->appendToAttributeValue(cc); - // FIXME: Handle EOF properly. - break; + } + END_STATE() + + BEGIN_STATE(AttributeValueDoubleQuotedState) { + if (cc == '"') + ADVANCE_TO(AfterAttributeValueQuotedState); + else if (cc == '&') { + m_additionalAllowedCharacter = '"'; + ADVANCE_TO(CharacterReferenceInAttributeValueState); + } else { + m_token->appendToAttributeValue(cc); + ADVANCE_TO(AttributeValueDoubleQuotedState); + } + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(AttributeValueSingleQuotedState) { + if (cc == '\'') + ADVANCE_TO(AfterAttributeValueQuotedState); + else if (cc == '&') { + m_additionalAllowedCharacter = '\''; + ADVANCE_TO(CharacterReferenceInAttributeValueState); + } else { + m_token->appendToAttributeValue(cc); + ADVANCE_TO(AttributeValueSingleQuotedState); + } + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(AttributeValueUnquotedState) { + if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') + ADVANCE_TO(BeforeAttributeNameState); + else if (cc == '&') { + m_additionalAllowedCharacter = '>'; + ADVANCE_TO(CharacterReferenceInAttributeValueState); + } else if (cc == '>') + EMIT_AND_RESUME_IN(DataState); + else { + if (cc == '"' || cc == '\'' || cc == '<' || cc == '=' || cc == '`') + emitParseError(); + m_token->appendToAttributeValue(cc); + ADVANCE_TO(AttributeValueUnquotedState); } - case AttributeValueSingleQuotedState: { - if (cc == '\'') - m_state = AfterAttributeValueQuotedState; - else if (cc == '&') { - m_state = CharacterReferenceInAttributeValueState; - m_additionalAllowedCharacter = '\''; - } else - m_token->appendToAttributeValue(cc); - // FIXME: Handle EOF properly. - break; + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(CharacterReferenceInAttributeValueState) { + bool notEnoughCharacters = false; + unsigned value = consumeHTML5Entity(source, notEnoughCharacters, m_additionalAllowedCharacter); + if (notEnoughCharacters) + return shouldEmitBufferedCharacterToken(source); + if (!value) + m_token->appendToAttributeValue('&'); + else if (value < 0xFFFF) + m_token->appendToAttributeValue(value); + else { + m_token->appendToAttributeValue(U16_LEAD(value)); + m_token->appendToAttributeValue(U16_TRAIL(value)); + } + // We're supposed to switch back to the attribute value state that + // we were in when we were switched into this state. Rather than + // keeping track of this explictly, we observe that the previous + // state can be determined by m_additionalAllowedCharacter. + if (m_additionalAllowedCharacter == '"') + SWITCH_TO(AttributeValueDoubleQuotedState); + else if (m_additionalAllowedCharacter == '\'') + SWITCH_TO(AttributeValueSingleQuotedState); + else if (m_additionalAllowedCharacter == '>') + SWITCH_TO(AttributeValueUnquotedState); + else + ASSERT_NOT_REACHED(); + } + END_STATE() + + BEGIN_STATE(AfterAttributeValueQuotedState) { + if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') + ADVANCE_TO(BeforeAttributeNameState); + else if (cc == '/') + ADVANCE_TO(SelfClosingStartTagState); + else if (cc == '>') + EMIT_AND_RESUME_IN(DataState); + else { + emitParseError(); + RECONSUME_IN(BeforeAttributeNameState); } - case AttributeValueUnquotedState: { - if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') - m_state = BeforeAttributeNameState; - else if (cc == '&') { - m_state = CharacterReferenceInAttributeValueState; - m_additionalAllowedCharacter = '>'; - } else if (cc == '>') { - emitCurrentToken(); - m_state = DataState; - } else { - if (cc == '"' || cc == '\'' || cc == '<' || cc == '=' || cc == '`') - emitParseError(); - m_token->appendToAttributeValue(cc); - } - // FIXME: Handle EOF properly. - break; + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(SelfClosingStartTagState) { + if (cc == '>') { + notImplemented(); + EMIT_AND_RESUME_IN(DataState); + } else { + emitParseError(); + RECONSUME_IN(BeforeAttributeNameState); } - case CharacterReferenceInAttributeValueState: { - bool notEnoughCharacters = false; - unsigned value = consumeEntity(source, notEnoughCharacters); - if (notEnoughCharacters) + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(BogusCommentState) { + // FIXME: This state isn't correct because we'll terminate the + // comment early if we don't have the whole input stream available. + m_token->beginComment(); + while (!source.isEmpty()) { + cc = m_inputStreamPreprocessor.nextInputCharacter(); + if (cc == '>') + EMIT_AND_RESUME_IN(DataState); + m_token->appendToComment(cc); + m_inputStreamPreprocessor.advance(source, m_lineNumber); + // We ignore the return value (which indicates that |source| is + // empty) because it's checked by the loop condition above. + } + m_state = DataState; + return true; + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(MarkupDeclarationOpenState) { + DEFINE_STATIC_LOCAL(String, dashDashString, ("--")); + DEFINE_STATIC_LOCAL(String, doctypeString, ("doctype")); + if (cc == '-') { + SegmentedString::LookAheadResult result = source.lookAhead(dashDashString); + if (result == SegmentedString::DidMatch) { + source.advanceAndASSERT('-'); + source.advanceAndASSERT('-'); + m_token->beginComment(); + SWITCH_TO(CommentStartState); + } else if (result == SegmentedString::NotEnoughCharacters) + return shouldEmitBufferedCharacterToken(source); + } else if (cc == 'D' || cc == 'd') { + SegmentedString::LookAheadResult result = source.lookAheadIgnoringCase(doctypeString); + if (result == SegmentedString::DidMatch) { + advanceStringAndASSERTIgnoringCase(source, "doctype"); + SWITCH_TO(DOCTYPEState); + } else if (result == SegmentedString::NotEnoughCharacters) return shouldEmitBufferedCharacterToken(source); - if (!value) - m_token->appendToAttributeValue('&'); - else if (value < 0xFFFF) - m_token->appendToAttributeValue(value); - else { - m_token->appendToAttributeValue(U16_LEAD(value)); - m_token->appendToAttributeValue(U16_TRAIL(value)); - } - // We're supposed to switch back to the attribute value state that - // we were in when we were switched into this state. Rather than - // keeping track of this explictly, we observe that the previous - // state can be determined by m_additionalAllowedCharacter. - if (m_additionalAllowedCharacter == '"') - m_state = AttributeValueDoubleQuotedState; - else if (m_additionalAllowedCharacter == '\'') - m_state = AttributeValueSingleQuotedState; - else if (m_additionalAllowedCharacter == '>') - m_state = AttributeValueUnquotedState; - else - ASSERT_NOT_REACHED(); - continue; } - case AfterAttributeValueQuotedState: { - if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') - m_state = BeforeAttributeNameState; - else if (cc == '/') - m_state = SelfClosingStartTagState; - else if (cc == '>') { - emitCurrentToken(); - m_state = DataState; - } else { - emitParseError(); - m_state = BeforeAttributeNameState; - continue; - } - // FIXME: Handle EOF properly. - break; + notImplemented(); + // FIXME: We're still missing the bits about the insertion mode being in foreign content: + // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#markup-declaration-open-state + emitParseError(); + RECONSUME_IN(BogusCommentState); + } + END_STATE() + + BEGIN_STATE(CommentStartState) { + if (cc == '-') + ADVANCE_TO(CommentStartDashState); + else if (cc == '>') { + emitParseError(); + EMIT_AND_RESUME_IN(DataState); + } else { + m_token->appendToComment(cc); + ADVANCE_TO(CommentState); } - case SelfClosingStartTagState: { - if (cc == '>') { - notImplemented(); - emitCurrentToken(); - m_state = DataState; - } else { - emitParseError(); - m_state = BeforeAttributeNameState; - continue; - } - // FIXME: Handle EOF properly. - break; + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(CommentStartDashState) { + if (cc == '-') + ADVANCE_TO(CommentEndState); + else if (cc == '>') { + emitParseError(); + EMIT_AND_RESUME_IN(DataState); + } else { + m_token->appendToComment('-'); + m_token->appendToComment(cc); + ADVANCE_TO(CommentState); } - case BogusCommentState: { - m_token->beginComment(); - while (!source.isEmpty()) { - cc = *source; - if (cc == '>') - break; - m_token->appendToComment(cc); - source.advance(); - } - emitCurrentToken(); - m_state = DataState; - if (source.isEmpty()) - return true; - // FIXME: Handle EOF properly. - break; + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(CommentState) { + if (cc == '-') + ADVANCE_TO(CommentEndDashState); + else { + m_token->appendToComment(cc); + ADVANCE_TO(CommentState); + } + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(CommentEndDashState) { + if (cc == '-') + ADVANCE_TO(CommentEndState); + else { + m_token->appendToComment('-'); + m_token->appendToComment(cc); + ADVANCE_TO(CommentState); + } + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(CommentEndState) { + if (cc == '>') + EMIT_AND_RESUME_IN(DataState); + else if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') { + emitParseError(); + m_token->appendToComment('-'); + m_token->appendToComment('-'); + m_token->appendToComment(cc); + ADVANCE_TO(CommentEndSpaceState); + } else if (cc == '!') { + emitParseError(); + ADVANCE_TO(CommentEndBangState); + } else if (cc == '-') { + emitParseError(); + m_token->appendToComment('-'); + m_token->appendToComment(cc); + ADVANCE_TO(CommentEndState); + } else { + emitParseError(); + m_token->appendToComment('-'); + m_token->appendToComment('-'); + m_token->appendToComment(cc); + ADVANCE_TO(CommentState); + } + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(CommentEndBangState) { + if (cc == '-') { + m_token->appendToComment('-'); + m_token->appendToComment('-'); + m_token->appendToComment('!'); + ADVANCE_TO(CommentEndDashState); + } else if (cc == '>') + EMIT_AND_RESUME_IN(DataState); + else { + m_token->appendToComment('-'); + m_token->appendToComment('-'); + m_token->appendToComment('!'); + m_token->appendToComment(cc); + ADVANCE_TO(CommentState); + } + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(CommentEndSpaceState) { + if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') { + m_token->appendToComment(cc); + ADVANCE_TO(CommentEndSpaceState); + } else if (cc == '-') + ADVANCE_TO(CommentEndDashState); + else if (cc == '>') + EMIT_AND_RESUME_IN(DataState); + else { + m_token->appendToComment(cc); + ADVANCE_TO(CommentState); + } + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(DOCTYPEState) { + if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') + ADVANCE_TO(BeforeDOCTYPENameState); + else { + emitParseError(); + RECONSUME_IN(BeforeDOCTYPENameState); } - case MarkupDeclarationOpenState: { - DEFINE_STATIC_LOCAL(String, dashDashString, ("--")); - DEFINE_STATIC_LOCAL(String, doctypeString, ("doctype")); - if (cc == '-') { - SegmentedString::LookAheadResult result = source.lookAhead(dashDashString); + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(BeforeDOCTYPENameState) { + if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') + ADVANCE_TO(BeforeDOCTYPENameState); + else if (cc >= 'A' && cc <= 'Z') { + m_token->beginDOCTYPE(toLowerCase(cc)); + ADVANCE_TO(DOCTYPENameState); + } else if (cc == '>') { + emitParseError(); + m_token->beginDOCTYPE(); + m_token->setForceQuirks(); + EMIT_AND_RESUME_IN(DataState); + } else { + m_token->beginDOCTYPE(cc); + ADVANCE_TO(DOCTYPENameState); + } + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(DOCTYPENameState) { + if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') + ADVANCE_TO(AfterDOCTYPENameState); + else if (cc == '>') + EMIT_AND_RESUME_IN(DataState); + else if (cc >= 'A' && cc <= 'Z') { + m_token->appendToName(toLowerCase(cc)); + ADVANCE_TO(DOCTYPENameState); + } else { + m_token->appendToName(cc); + ADVANCE_TO(DOCTYPENameState); + } + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(AfterDOCTYPENameState) { + if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') + ADVANCE_TO(AfterDOCTYPENameState); + if (cc == '>') + EMIT_AND_RESUME_IN(DataState); + else { + DEFINE_STATIC_LOCAL(String, publicString, ("public")); + DEFINE_STATIC_LOCAL(String, systemString, ("system")); + if (cc == 'P' || cc == 'p') { + SegmentedString::LookAheadResult result = source.lookAheadIgnoringCase(publicString); if (result == SegmentedString::DidMatch) { - source.advanceAndASSERT('-'); - source.advanceAndASSERT('-'); - m_token->beginComment(); - m_state = CommentStartState; - continue; + advanceStringAndASSERTIgnoringCase(source, "public"); + SWITCH_TO(AfterDOCTYPEPublicKeywordState); } else if (result == SegmentedString::NotEnoughCharacters) return shouldEmitBufferedCharacterToken(source); - } else if (cc == 'D' || cc == 'd') { - SegmentedString::LookAheadResult result = source.lookAheadIgnoringCase(doctypeString); + } else if (cc == 'S' || cc == 's') { + SegmentedString::LookAheadResult result = source.lookAheadIgnoringCase(systemString); if (result == SegmentedString::DidMatch) { - advanceStringAndASSERTIgnoringCase(source, "doctype"); - m_state = DOCTYPEState; - continue; + advanceStringAndASSERTIgnoringCase(source, "system"); + SWITCH_TO(AfterDOCTYPESystemKeywordState); } else if (result == SegmentedString::NotEnoughCharacters) return shouldEmitBufferedCharacterToken(source); } - notImplemented(); - // FIXME: We're still missing the bits about the insertion mode being in foreign content: - // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#markup-declaration-open-state emitParseError(); - m_state = BogusCommentState; - continue; - } - case CommentStartState: { - if (cc == '-') - m_state = CommentStartDashState; - else if (cc == '>') { - emitParseError(); - emitCurrentToken(); - m_state = DataState; - } else { - m_token->appendToComment(cc); - m_state = CommentState; - } - // FIXME: Handle EOF properly. - break; - } - case CommentStartDashState: { - if (cc == '-') - m_state = CommentEndState; - else if (cc == '>') { - emitParseError(); - emitCurrentToken(); - m_state = DataState; - } else { - m_token->appendToComment('-'); - m_token->appendToComment(cc); - m_state = CommentState; - } - // FIXME: Handle EOF properly. - break; - } - case CommentState: { - if (cc == '-') - m_state = CommentEndDashState; - else - m_token->appendToComment(cc); - // FIXME: Handle EOF properly. - break; - } - case CommentEndDashState: { - if (cc == '-') - m_state = CommentEndState; - else { - m_token->appendToComment('-'); - m_token->appendToComment(cc); - m_state = CommentState; - } - // FIXME: Handle EOF properly. - break; - } - case CommentEndState: { - if (cc == '>') { - emitCurrentToken(); - m_state = DataState; - } else if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') { - emitParseError(); - m_token->appendToComment('-'); - m_token->appendToComment('-'); - m_token->appendToComment(cc); - m_state = CommentEndSpaceState; - } else if (cc == '!') { - emitParseError(); - m_state = CommentEndBangState; - } else if (cc == '-') { - emitParseError(); - m_token->appendToComment('-'); - m_token->appendToComment(cc); - } else { - emitParseError(); - m_token->appendToComment('-'); - m_token->appendToComment('-'); - m_token->appendToComment(cc); - m_state = CommentState; - } - // FIXME: Handle EOF properly. - break; - } - case CommentEndBangState: { - if (cc == '-') { - m_token->appendToComment('-'); - m_token->appendToComment('-'); - m_token->appendToComment('!'); - m_state = CommentEndDashState; - } else if (cc == '>') { - emitCurrentToken(); - m_state = DataState; - } else { - m_token->appendToComment('-'); - m_token->appendToComment('-'); - m_token->appendToComment('!'); - m_token->appendToComment(cc); - m_state = CommentState; - } - // FIXME: Handle EOF properly. - break; - } - case CommentEndSpaceState: { - if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') - m_token->appendToComment(cc); - else if (cc == '-') - m_state = CommentEndDashState; - else if (cc == '>') { - emitCurrentToken(); - m_state = DataState; - } else { - m_token->appendToComment(cc); - m_state = CommentState; - } - // FIXME: Handle EOF properly. - break; - } - case DOCTYPEState: { - if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') - m_state = BeforeDOCTYPENameState; - else { - emitParseError(); - m_state = BeforeDOCTYPENameState; - continue; - } - // FIXME: Handle EOF properly. - break; - } - case BeforeDOCTYPENameState: { - if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') - break; - else if (cc >= 'A' && cc <= 'Z') { - m_token->beginDOCTYPE(toLowerCase(cc)); - m_state = DOCTYPENameState; - } else if (cc == '>') { - emitParseError(); - m_token->beginDOCTYPE(); - notImplemented(); - emitCurrentToken(); - m_state = DataState; - } else { - m_token->beginDOCTYPE(cc); - m_state = DOCTYPENameState; - } - // FIXME: Handle EOF properly. - break; - } - case DOCTYPENameState: { - if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') - m_state = AfterDOCTYPENameState; - else if (cc == '>') { - emitCurrentToken(); - m_state = DataState; - } else if (cc >= 'A' && cc <= 'Z') - m_token->appendToName(toLowerCase(cc)); - else - m_token->appendToName(cc); - // FIXME: Handle EOF properly. - break; - } - case AfterDOCTYPENameState: { - if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') - break; - if (cc == '>') { - emitCurrentToken(); - m_state = DataState; - } else { - DEFINE_STATIC_LOCAL(String, publicString, ("public")); - DEFINE_STATIC_LOCAL(String, systemString, ("system")); - if (cc == 'P' || cc == 'p') { - SegmentedString::LookAheadResult result = source.lookAheadIgnoringCase(publicString); - if (result == SegmentedString::DidMatch) { - advanceStringAndASSERTIgnoringCase(source, "public"); - m_state = AfterDOCTYPEPublicKeywordState; - continue; - } else if (result == SegmentedString::NotEnoughCharacters) - return shouldEmitBufferedCharacterToken(source); - } else if (cc == 'S' || cc == 's') { - SegmentedString::LookAheadResult result = source.lookAheadIgnoringCase(systemString); - if (result == SegmentedString::DidMatch) { - advanceStringAndASSERTIgnoringCase(source, "system"); - m_state = AfterDOCTYPESystemKeywordState; - continue; - } else if (result == SegmentedString::NotEnoughCharacters) - return shouldEmitBufferedCharacterToken(source); - } - emitParseError(); - notImplemented(); - m_state = BogusDOCTYPEState; - } - // FIXME: Handle EOF properly. - break; - } - case AfterDOCTYPEPublicKeywordState: { - if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') - m_state = BeforeDOCTYPEPublicIdentifierState; - else if (cc == '"') { - emitParseError(); - m_token->setPublicIdentifierToEmptyString(); - m_state = DOCTYPEPublicIdentifierDoubleQuotedState; - } else if (cc == '\'') { - emitParseError(); - m_token->setPublicIdentifierToEmptyString(); - m_state = DOCTYPEPublicIdentifierSingleQuotedState; - } else if (cc == '>') { - emitParseError(); - notImplemented(); - emitCurrentToken(); - m_state = DataState; - } else { - emitParseError(); - notImplemented(); - m_state = BogusDOCTYPEState; - } - // FIXME: Handle EOF properly. - break; - } - case BeforeDOCTYPEPublicIdentifierState: { - if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') - break; - else if (cc == '"') { - m_token->setPublicIdentifierToEmptyString(); - m_state = DOCTYPEPublicIdentifierDoubleQuotedState; - } else if (cc == '\'') { - m_token->setPublicIdentifierToEmptyString(); - m_state = DOCTYPEPublicIdentifierSingleQuotedState; - } else if (cc == '>') { - emitParseError(); - notImplemented(); - emitCurrentToken(); - m_state = DataState; - } else { - emitParseError(); - notImplemented(); - m_state = BogusDOCTYPEState; - } - // FIXME: Handle EOF properly. - break; - } - case DOCTYPEPublicIdentifierDoubleQuotedState: { - if (cc == '"') - m_state = AfterDOCTYPEPublicIdentifierState; - else if (cc == '>') { - emitParseError(); - notImplemented(); - emitCurrentToken(); - m_state = DataState; - } else - m_token->appendToPublicIdentifier(cc); - // FIXME: Handle EOF properly. - break; - } - case DOCTYPEPublicIdentifierSingleQuotedState: { - if (cc == '\'') - m_state = AfterDOCTYPEPublicIdentifierState; - else if (cc == '>') { - emitParseError(); - notImplemented(); - emitCurrentToken(); - m_state = DataState; - } else - m_token->appendToPublicIdentifier(cc); - // FIXME: Handle EOF properly. - break; + m_token->setForceQuirks(); + ADVANCE_TO(BogusDOCTYPEState); } - case AfterDOCTYPEPublicIdentifierState: { - if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') - m_state = BetweenDOCTYPEPublicAndSystemIdentifiersState; - else if (cc == '>') { - emitCurrentToken(); - m_state = DataState; - } else if (cc == '"') { - emitParseError(); - m_token->setPublicIdentifierToEmptyString(); - m_state = DOCTYPESystemIdentifierDoubleQuotedState; - } else if (cc == '\'') { - emitParseError(); - m_token->setPublicIdentifierToEmptyString(); - m_state = DOCTYPESystemIdentifierSingleQuotedState; - } else { - emitParseError(); - notImplemented(); - m_state = BogusDOCTYPEState; - } - // FIXME: Handle EOF properly. - break; + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(AfterDOCTYPEPublicKeywordState) { + if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') + ADVANCE_TO(BeforeDOCTYPEPublicIdentifierState); + else if (cc == '"') { + emitParseError(); + m_token->setPublicIdentifierToEmptyString(); + ADVANCE_TO(DOCTYPEPublicIdentifierDoubleQuotedState); + } else if (cc == '\'') { + emitParseError(); + m_token->setPublicIdentifierToEmptyString(); + ADVANCE_TO(DOCTYPEPublicIdentifierSingleQuotedState); + } else if (cc == '>') { + emitParseError(); + m_token->setForceQuirks(); + EMIT_AND_RESUME_IN(DataState); + } else { + emitParseError(); + m_token->setForceQuirks(); + ADVANCE_TO(BogusDOCTYPEState); } - case BetweenDOCTYPEPublicAndSystemIdentifiersState: { - if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') - m_state = BetweenDOCTYPEPublicAndSystemIdentifiersState; - else if (cc == '>') { - emitCurrentToken(); - m_state = DataState; - } else if (cc == '"') { - m_token->setSystemIdentifierToEmptyString(); - m_state = DOCTYPESystemIdentifierDoubleQuotedState; - } else if (cc == '\'') { - m_token->setSystemIdentifierToEmptyString(); - m_state = DOCTYPESystemIdentifierSingleQuotedState; - } else { - emitParseError(); - notImplemented(); - m_state = BogusDOCTYPEState; - } - // FIXME: Handle EOF properly. - break; + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(BeforeDOCTYPEPublicIdentifierState) { + if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') + ADVANCE_TO(BeforeDOCTYPEPublicIdentifierState); + else if (cc == '"') { + m_token->setPublicIdentifierToEmptyString(); + ADVANCE_TO(DOCTYPEPublicIdentifierDoubleQuotedState); + } else if (cc == '\'') { + m_token->setPublicIdentifierToEmptyString(); + ADVANCE_TO(DOCTYPEPublicIdentifierSingleQuotedState); + } else if (cc == '>') { + emitParseError(); + m_token->setForceQuirks(); + EMIT_AND_RESUME_IN(DataState); + } else { + emitParseError(); + m_token->setForceQuirks(); + ADVANCE_TO(BogusDOCTYPEState); } - case AfterDOCTYPESystemKeywordState: { - if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') - m_state = BeforeDOCTYPESystemIdentifierState; - else if (cc == '"') { - emitParseError(); - m_token->setSystemIdentifierToEmptyString(); - m_state = DOCTYPESystemIdentifierDoubleQuotedState; - } else if (cc == '\'') { - emitParseError(); - m_token->setSystemIdentifierToEmptyString(); - m_state = DOCTYPESystemIdentifierSingleQuotedState; - } else if (cc == '>') { - emitParseError(); - notImplemented(); - emitCurrentToken(); - m_state = DataState; - } else { - emitParseError(); - notImplemented(); - m_state = BogusDOCTYPEState; - } - // FIXME: Handle EOF properly. - break; + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(DOCTYPEPublicIdentifierDoubleQuotedState) { + if (cc == '"') + ADVANCE_TO(AfterDOCTYPEPublicIdentifierState); + else if (cc == '>') { + emitParseError(); + m_token->setForceQuirks(); + EMIT_AND_RESUME_IN(DataState); + } else { + m_token->appendToPublicIdentifier(cc); + ADVANCE_TO(DOCTYPEPublicIdentifierDoubleQuotedState); } - case BeforeDOCTYPESystemIdentifierState: { - if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') - break; - if (cc == '"') { - m_token->setSystemIdentifierToEmptyString(); - m_state = DOCTYPESystemIdentifierDoubleQuotedState; - } else if (cc == '\'') { - m_token->setSystemIdentifierToEmptyString(); - m_state = DOCTYPESystemIdentifierSingleQuotedState; - } else if (cc == '>') { - emitParseError(); - notImplemented(); - emitCurrentToken(); - m_state = DataState; - } else { - emitParseError(); - notImplemented(); - m_state = BogusDOCTYPEState; - } - // FIXME: Handle EOF properly. - break; + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(DOCTYPEPublicIdentifierSingleQuotedState) { + if (cc == '\'') + ADVANCE_TO(AfterDOCTYPEPublicIdentifierState); + else if (cc == '>') { + emitParseError(); + m_token->setForceQuirks(); + EMIT_AND_RESUME_IN(DataState); + } else { + m_token->appendToPublicIdentifier(cc); + ADVANCE_TO(DOCTYPEPublicIdentifierSingleQuotedState); } - case DOCTYPESystemIdentifierDoubleQuotedState: { - if (cc == '"') - m_state = AfterDOCTYPESystemIdentifierState; - else if (cc == '>') { - emitParseError(); - notImplemented(); - emitCurrentToken(); - m_state = DataState; - } else - m_token->appendToSystemIdentifier(cc); - // FIXME: Handle EOF properly. - break; + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(AfterDOCTYPEPublicIdentifierState) { + if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') + ADVANCE_TO(BetweenDOCTYPEPublicAndSystemIdentifiersState); + else if (cc == '>') + EMIT_AND_RESUME_IN(DataState); + else if (cc == '"') { + emitParseError(); + m_token->setPublicIdentifierToEmptyString(); + ADVANCE_TO(DOCTYPESystemIdentifierDoubleQuotedState); + } else if (cc == '\'') { + emitParseError(); + m_token->setPublicIdentifierToEmptyString(); + ADVANCE_TO(DOCTYPESystemIdentifierSingleQuotedState); + } else { + emitParseError(); + m_token->setForceQuirks(); + ADVANCE_TO(BogusDOCTYPEState); } - case DOCTYPESystemIdentifierSingleQuotedState: { - if (cc == '\'') - m_state = AfterDOCTYPESystemIdentifierState; - else if (cc == '>') { - emitParseError(); - notImplemented(); - emitCurrentToken(); - m_state = DataState; - } else - m_token->appendToSystemIdentifier(cc); - // FIXME: Handle EOF properly. - break; + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(BetweenDOCTYPEPublicAndSystemIdentifiersState) { + if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') + ADVANCE_TO(BetweenDOCTYPEPublicAndSystemIdentifiersState); + else if (cc == '>') + EMIT_AND_RESUME_IN(DataState); + else if (cc == '"') { + m_token->setSystemIdentifierToEmptyString(); + ADVANCE_TO(DOCTYPESystemIdentifierDoubleQuotedState); + } else if (cc == '\'') { + m_token->setSystemIdentifierToEmptyString(); + ADVANCE_TO(DOCTYPESystemIdentifierSingleQuotedState); + } else { + emitParseError(); + m_token->setForceQuirks(); + ADVANCE_TO(BogusDOCTYPEState); } - case AfterDOCTYPESystemIdentifierState: { - if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') - break; - else if (cc == '>') { - emitCurrentToken(); - m_state = DataState; - } else { - emitParseError(); - m_state = BogusDOCTYPEState; - } - // FIXME: Handle EOF properly. - break; + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(AfterDOCTYPESystemKeywordState) { + if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') + ADVANCE_TO(BeforeDOCTYPESystemIdentifierState); + else if (cc == '"') { + emitParseError(); + m_token->setSystemIdentifierToEmptyString(); + ADVANCE_TO(DOCTYPESystemIdentifierDoubleQuotedState); + } else if (cc == '\'') { + emitParseError(); + m_token->setSystemIdentifierToEmptyString(); + ADVANCE_TO(DOCTYPESystemIdentifierSingleQuotedState); + } else if (cc == '>') { + emitParseError(); + m_token->setForceQuirks(); + EMIT_AND_RESUME_IN(DataState); + } else { + emitParseError(); + m_token->setForceQuirks(); + ADVANCE_TO(BogusDOCTYPEState); } - case BogusDOCTYPEState: { - if (cc == '>') { - emitCurrentToken(); - m_state = DataState; - } - // FIXME: Handle EOF properly. - break; + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(BeforeDOCTYPESystemIdentifierState) { + if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') + ADVANCE_TO(BeforeDOCTYPESystemIdentifierState); + if (cc == '"') { + m_token->setSystemIdentifierToEmptyString(); + ADVANCE_TO(DOCTYPESystemIdentifierDoubleQuotedState); + } else if (cc == '\'') { + m_token->setSystemIdentifierToEmptyString(); + ADVANCE_TO(DOCTYPESystemIdentifierSingleQuotedState); + } else if (cc == '>') { + emitParseError(); + m_token->setForceQuirks(); + EMIT_AND_RESUME_IN(DataState); + } else { + emitParseError(); + m_token->setForceQuirks(); + ADVANCE_TO(BogusDOCTYPEState); } - case CDATASectionState: { - notImplemented(); - break; + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(DOCTYPESystemIdentifierDoubleQuotedState) { + if (cc == '"') + ADVANCE_TO(AfterDOCTYPESystemIdentifierState); + else if (cc == '>') { + emitParseError(); + m_token->setForceQuirks(); + EMIT_AND_RESUME_IN(DataState); + } else { + m_token->appendToSystemIdentifier(cc); + ADVANCE_TO(DOCTYPESystemIdentifierDoubleQuotedState); } + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(DOCTYPESystemIdentifierSingleQuotedState) { + if (cc == '\'') + ADVANCE_TO(AfterDOCTYPESystemIdentifierState); + else if (cc == '>') { + emitParseError(); + m_token->setForceQuirks(); + EMIT_AND_RESUME_IN(DataState); + } else { + m_token->appendToSystemIdentifier(cc); + ADVANCE_TO(DOCTYPESystemIdentifierSingleQuotedState); } - source.advance(); - if (m_emitPending) { - m_emitPending = false; - return true; + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(AfterDOCTYPESystemIdentifierState) { + if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') + ADVANCE_TO(AfterDOCTYPESystemIdentifierState); + else if (cc == '>') + EMIT_AND_RESUME_IN(DataState); + else { + emitParseError(); + ADVANCE_TO(BogusDOCTYPEState); } + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(BogusDOCTYPEState) { + if (cc == '>') + EMIT_AND_RESUME_IN(DataState); + ADVANCE_TO(BogusDOCTYPEState); + // FIXME: Handle EOF properly. + } + END_STATE() + + BEGIN_STATE(CDATASectionState) { + notImplemented(); + ADVANCE_TO(CDATASectionState); } - // We've reached the end of the input stream. If we have a character - // token buffered, we should emit it. - return shouldEmitBufferedCharacterToken(source); + END_STATE() + + } + + ASSERT_NOT_REACHED(); + return false; } inline bool HTML5Lexer::temporaryBufferIs(const String& expectedString) @@ -1533,7 +1445,7 @@ inline void HTML5Lexer::addToPossibleEndTag(UChar cc) inline bool HTML5Lexer::isAppropriateEndTag() { - return vectorEqualsString(m_bufferedEndTagName, m_appropriateEndTagName); + return m_bufferedEndTagName == m_appropriateEndTagName; } inline void HTML5Lexer::emitCharacter(UChar character) @@ -1560,30 +1472,9 @@ inline void HTML5Lexer::emitParseError() notImplemented(); } -inline void HTML5Lexer::maybeFlushBufferedEndTag() -{ - ASSERT(m_token->type() == HTML5Token::Character || m_token->type() == HTML5Token::Uninitialized); - if (m_token->type() == HTML5Token::Character) { - // We have a character token queued up. We need to emit it before we - // can start begin the buffered end tag token. - emitCurrentToken(); - return; - } - flushBufferedEndTag(); -} - -inline void HTML5Lexer::flushBufferedEndTag() -{ - m_token->beginEndTag(m_bufferedEndTagName); - m_bufferedEndTagName.clear(); - if (m_state == DataState) - emitCurrentToken(); -} - inline void HTML5Lexer::emitCurrentToken() { ASSERT(m_token->type() != HTML5Token::Uninitialized); - m_emitPending = true; if (m_token->type() == HTML5Token::StartTag) m_appropriateEndTagName = m_token->name(); } @@ -1594,3 +1485,4 @@ inline bool HTML5Lexer::shouldEmitBufferedCharacterToken(const SegmentedString& } } + diff --git a/WebCore/html/HTML5Lexer.h b/WebCore/html/HTML5Lexer.h index 08612e6..fe321e2 100644 --- a/WebCore/html/HTML5Lexer.h +++ b/WebCore/html/HTML5Lexer.h @@ -120,6 +120,9 @@ namespace WebCore { // they call reset() first). bool nextToken(SegmentedString&, HTML5Token&); + int lineNumber() const { return m_lineNumber; } + int columnNumber() const { return 1; } // Matches HTMLDocumentParser.h behavior. + void setState(State state) { m_state = state; } // Hack to skip leading newline in <pre>/<listing> for authoring ease. @@ -127,12 +130,65 @@ namespace WebCore { void skipLeadingNewLineForListing() { m_skipLeadingNewLineForListing = true; } private: + // http://www.whatwg.org/specs/web-apps/current-work/#preprocessing-the-input-stream + class InputStreamPreprocessor : public Noncopyable { + public: + InputStreamPreprocessor() + : m_nextInputCharacter('\0') + , m_skipNextNewLine(false) + { + } + + UChar nextInputCharacter() const { return m_nextInputCharacter; } + + // Returns whether we succeeded in peeking at the next character. + // The only way we can fail to peek is if there are no more + // characters in |source| (after collapsing \r\n, etc). + bool peek(SegmentedString& source, int& lineNumber) + { + m_nextInputCharacter = *source; + if (m_nextInputCharacter == '\n' && m_skipNextNewLine) { + m_skipNextNewLine = false; + source.advancePastNewline(lineNumber); + if (source.isEmpty()) + return false; + m_nextInputCharacter = *source; + } + if (m_nextInputCharacter == '\r') { + m_nextInputCharacter = '\n'; + m_skipNextNewLine = true; + } else { + m_skipNextNewLine = false; + // FIXME: The spec indicates that the surrogate pair range as well as + // a number of specific character values are parse errors and should be replaced + // by the replacement character. We suspect this is a problem with the spec as doing + // that filtering breaks surrogate pair handling and causes us not to match Minefield. + if (m_nextInputCharacter == '\0') + m_nextInputCharacter = 0xFFFD; + } + return true; + } + + // Returns whether there are more characters in |source| after advancing. + bool advance(SegmentedString& source, int& lineNumber) + { + source.advance(lineNumber); + if (source.isEmpty()) + return false; + return peek(source, lineNumber); + } + + private: + // http://www.whatwg.org/specs/web-apps/current-work/#next-input-character + UChar m_nextInputCharacter; + bool m_skipNextNewLine; + }; + inline void emitCharacter(UChar); inline void emitParseError(); inline void emitCurrentToken(); inline void emitCodePoint(unsigned); - unsigned consumeEntity(SegmentedString&, bool& notEnoughCharacters); inline bool processEntity(SegmentedString& source); inline bool temporaryBufferIs(const String&); @@ -142,21 +198,19 @@ namespace WebCore { // functions help manage these state. inline void addToPossibleEndTag(UChar cc); inline bool isAppropriateEndTag(); - inline void maybeFlushBufferedEndTag(); - inline void flushBufferedEndTag(); inline bool shouldEmitBufferedCharacterToken(const SegmentedString&); State m_state; - AtomicString m_appropriateEndTagName; + Vector<UChar, 32> m_appropriateEndTagName; // m_token is owned by the caller. If nextToken is not on the stack, // this member might be pointing to unallocated memory. HTML5Token* m_token; + int m_lineNumber; bool m_skipLeadingNewLineForListing; - bool m_emitPending; // http://www.whatwg.org/specs/web-apps/current-work/#temporary-buffer Vector<UChar, 32> m_temporaryBuffer; @@ -168,6 +222,9 @@ namespace WebCore { // http://www.whatwg.org/specs/web-apps/current-work/#additional-allowed-character UChar m_additionalAllowedCharacter; + + // http://www.whatwg.org/specs/web-apps/current-work/#preprocessing-the-input-stream + InputStreamPreprocessor m_inputStreamPreprocessor; }; } diff --git a/WebCore/html/HTML5ScriptRunner.cpp b/WebCore/html/HTML5ScriptRunner.cpp index 3e0cd7f..aef5ce4 100644 --- a/WebCore/html/HTML5ScriptRunner.cpp +++ b/WebCore/html/HTML5ScriptRunner.cpp @@ -48,6 +48,7 @@ HTML5ScriptRunner::HTML5ScriptRunner(Document* document, HTML5ScriptRunnerHost* , m_scriptNestingLevel(0) , m_hasScriptsWaitingForStylesheets(false) { + ASSERT(m_host); } HTML5ScriptRunner::~HTML5ScriptRunner() @@ -84,8 +85,7 @@ ScriptSourceCode HTML5ScriptRunner::sourceFromPendingScript(const PendingScript& return ScriptSourceCode(script.cachedScript.get()); } errorOccurred = false; - // FIXME: Line numbers are wrong. - return ScriptSourceCode(script.element->textContent(), documentURLForScriptExecution(m_document)); + return ScriptSourceCode(script.element->textContent(), documentURLForScriptExecution(m_document), script.startingLineNumber); } bool HTML5ScriptRunner::isPendingScriptReady(const PendingScript& script) @@ -127,6 +127,10 @@ void HTML5ScriptRunner::executePendingScript() void HTML5ScriptRunner::executeScript(Element* element, const ScriptSourceCode& sourceCode) { + // FIXME: We do not block inline <script> tags on stylesheets for now. + // When we do, || !element->hasAttribute(srcAttr) should be removed from + // the ASSERT below. See https://bugs.webkit.org/show_bug.cgi?id=40047 + ASSERT(m_document->haveStylesheetsLoaded() || !element->hasAttribute(srcAttr)); ScriptElement* scriptElement = toScriptElement(element); ASSERT(scriptElement); if (!scriptElement->shouldExecuteAsJavaScript()) @@ -153,26 +157,31 @@ void HTML5ScriptRunner::stopWatchingForLoad(PendingScript& pendingScript) // This function should match 10.2.5.11 "An end tag whose tag name is 'script'" // Script handling lives outside the tree builder to keep the each class simple. -bool HTML5ScriptRunner::execute(PassRefPtr<Element> scriptElement) +bool HTML5ScriptRunner::execute(PassRefPtr<Element> scriptElement, int startLine) { ASSERT(scriptElement); // FIXME: If scripting is disabled, always just return true; // Try to execute the script given to us. - runScript(scriptElement.get()); - if (m_scriptNestingLevel) - return false; // Don't continue parsing. - if (!executeParsingBlockingScripts()) - return false; + runScript(scriptElement.get(), startLine); - notImplemented(); // Restore insertion point? - // FIXME: Handle re-entrant scripts and m_pendingParsingBlockinScript. - return true; + if (haveParsingBlockingScript()) { + if (m_scriptNestingLevel) + return false; // Block the parser. Unwind to the outermost HTML5ScriptRunner::execute before continuing parsing. + if (!executeParsingBlockingScripts()) + return false; // We still have a parsing blocking script, block the parser. + } + return true; // Scripts executed as expected, continue parsing. +} + +bool HTML5ScriptRunner::haveParsingBlockingScript() const +{ + return !!m_parsingBlockingScript.element; } bool HTML5ScriptRunner::executeParsingBlockingScripts() { - while (m_parsingBlockingScript.element) { + while (haveParsingBlockingScript()) { // We only really need to check once. if (!isPendingScriptReady(m_parsingBlockingScript)) return false; @@ -184,7 +193,7 @@ bool HTML5ScriptRunner::executeParsingBlockingScripts() bool HTML5ScriptRunner::executeScriptsWaitingForLoad(CachedResource*) { ASSERT(!m_scriptNestingLevel); - ASSERT(m_parsingBlockingScript.element); + ASSERT(haveParsingBlockingScript()); ASSERT(m_parsingBlockingScript.cachedScript->isLoaded()); return executeParsingBlockingScripts(); } @@ -203,6 +212,10 @@ void HTML5ScriptRunner::requestScript(Element* script) { ASSERT(!m_parsingBlockingScript.element); AtomicString srcValue = script->getAttribute(srcAttr); + // Allow the host to disllow script loads (using the XSSAuditor, etc.) + if (!m_host->shouldLoadExternalScriptFromSrc(srcValue)) + return; + // FIXME: We need to resolve the url relative to the element. m_parsingBlockingScript.element = script; if (!script->dispatchBeforeLoadEvent(srcValue)) // Part of HTML5? @@ -224,9 +237,9 @@ void HTML5ScriptRunner::requestScript(Element* script) // This method is meant to match the HTML5 definition of "running a script" // http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.html#running-a-script -void HTML5ScriptRunner::runScript(Element* script) +void HTML5ScriptRunner::runScript(Element* script, int startingLineNumber) { - ASSERT(!m_parsingBlockingScript.element); + ASSERT(!haveParsingBlockingScript()); m_scriptNestingLevel++; // Check script type and language, current code uses ScriptElement::shouldExecuteAsJavaScript(), but that may not be HTML5 compliant. notImplemented(); // event for support @@ -234,11 +247,10 @@ void HTML5ScriptRunner::runScript(Element* script) if (script->hasAttribute(srcAttr)) { // FIXME: Handle defer and async requestScript(script); - } else if (!m_document->haveStylesheetsLoaded()) { - m_parsingBlockingScript.element = script; } else { - // FIXME: Need a line numbers implemenation. - ScriptSourceCode sourceCode(script->textContent(), documentURLForScriptExecution(m_document), 0); + // FIXME: We do not block inline <script> tags on stylesheets to match the + // old parser for now. See https://bugs.webkit.org/show_bug.cgi?id=40047 + ScriptSourceCode sourceCode(script->textContent(), documentURLForScriptExecution(m_document), startingLineNumber); executeScript(script, sourceCode); } m_scriptNestingLevel--; diff --git a/WebCore/html/HTML5ScriptRunner.h b/WebCore/html/HTML5ScriptRunner.h index c6a03fb..19e70a6 100644 --- a/WebCore/html/HTML5ScriptRunner.h +++ b/WebCore/html/HTML5ScriptRunner.h @@ -47,7 +47,7 @@ public: ~HTML5ScriptRunner(); // Processes the passed in script and any pending scripts if possible. - bool execute(PassRefPtr<Element> scriptToProcess); + bool execute(PassRefPtr<Element> scriptToProcess, int scriptStartLine); // Processes any pending scripts. bool executeScriptsWaitingForLoad(CachedResource*); bool hasScriptsWaitingForStylesheets() const { return m_hasScriptsWaitingForStylesheets; } @@ -59,23 +59,26 @@ private: struct PendingScript { PendingScript() : watchingForLoad(false) + , startingLineNumber(0) { } RefPtr<Element> element; CachedResourceHandle<CachedScript> cachedScript; bool watchingForLoad; // Did we pass the cachedScript to the HTML5ScriptRunnerHost. + int startingLineNumber; // Only used for inline script tags. // HTML5 has an isReady parameter, however isReady ends up equivalent to // m_document->haveStylesheetsLoaded() && cachedScript->isLoaded() }; Frame* frame() const; + bool haveParsingBlockingScript() const; bool executeParsingBlockingScripts(); void executePendingScript(); void requestScript(Element*); - void runScript(Element*); + void runScript(Element*, int startingLineNumber); // Helpers for dealing with HTML5ScriptRunnerHost void watchForLoad(PendingScript&); diff --git a/WebCore/html/HTML5ScriptRunnerHost.h b/WebCore/html/HTML5ScriptRunnerHost.h index 730e0fc..9a77385 100644 --- a/WebCore/html/HTML5ScriptRunnerHost.h +++ b/WebCore/html/HTML5ScriptRunnerHost.h @@ -28,6 +28,7 @@ namespace WebCore { +class AtomicString; class CachedResource; class ScriptSourceCode; @@ -40,6 +41,8 @@ public: // Implementors must call cachedResource->removeClient() immediately. virtual void stopWatchingForLoad(CachedResource*) = 0; + // Implementors can block certain script loads (for XSSAuditor, etc.) + virtual bool shouldLoadExternalScriptFromSrc(const AtomicString&) = 0; // Implementors should handle possible rentry before/after calling ScriptController::executeScript virtual void executeScript(const ScriptSourceCode&) = 0; }; diff --git a/WebCore/html/HTML5Token.h b/WebCore/html/HTML5Token.h index b4188d3..6b0fdc8 100644 --- a/WebCore/html/HTML5Token.h +++ b/WebCore/html/HTML5Token.h @@ -50,7 +50,7 @@ public: WTF::Vector<UChar, 32> m_value; }; - typedef WTF::Vector<Attribute> AttributeList; + typedef WTF::Vector<Attribute, 10> AttributeList; typedef WTF::Vector<UChar, 1024> DataVector; HTML5Token() { clear(); } @@ -64,7 +64,7 @@ public: { ASSERT(m_type == Uninitialized); m_type = StartTag; - clearData(); + m_data.clear(); m_selfClosing = false; m_currentAttribute = 0; m_attributes.clear(); @@ -77,7 +77,7 @@ public: { ASSERT(m_type == Uninitialized); m_type = EndTag; - clearData(); + m_data.clear(); m_selfClosing = false; m_currentAttribute = 0; m_attributes.clear(); @@ -89,7 +89,7 @@ public: { ASSERT(m_type == Uninitialized); m_type = Character; - clearData(); + m_data.clear(); m_data.append(character); } @@ -97,14 +97,14 @@ public: { ASSERT(m_type == Uninitialized); m_type = Comment; - clearData(); + m_data.clear(); } void beginDOCTYPE() { ASSERT(m_type == Uninitialized); m_type = DOCTYPE; - clearData(); + m_data.clear(); m_doctypeData.set(new DoctypeData()); } @@ -166,48 +166,24 @@ public: return m_attributes; } - AtomicString name() + const DataVector& name() { ASSERT(m_type == StartTag || m_type == EndTag || m_type == DOCTYPE); - if (!m_data.isEmpty() && m_dataAsNameAtom.isEmpty()) - m_dataAsNameAtom = AtomicString(adoptDataAsStringImpl()); - return m_dataAsNameAtom; - } - - PassRefPtr<StringImpl> adoptDataAsStringImpl() - { - ASSERT(!m_dataAsNameAtom); // An attempt to make sure this isn't called twice. - return StringImpl::adopt(m_data); + return m_data; } const DataVector& characters() { ASSERT(m_type == Character); - ASSERT(!m_dataAsNameAtom); return m_data; } const DataVector& comment() { ASSERT(m_type == Comment); - ASSERT(!m_dataAsNameAtom); return m_data; } - // FIXME: Should be removed once we stop using the old parser. - String takeCharacters() - { - ASSERT(m_type == Character); - return String(adoptDataAsStringImpl()); - } - - // FIXME: Should be removed once we stop using the old parser. - String takeComment() - { - ASSERT(m_type == Comment); - return String(adoptDataAsStringImpl()); - } - // FIXME: Distinguish between a missing public identifer and an empty one. const WTF::Vector<UChar>& publicIdentifier() { @@ -236,6 +212,18 @@ public: m_doctypeData->m_systemIdentifier.clear(); } + bool forceQuirks() + { + ASSERT(m_type == DOCTYPE); + return m_doctypeData->m_forceQuirks; + } + + void setForceQuirks() + { + ASSERT(m_type == DOCTYPE); + m_doctypeData->m_forceQuirks = true; + } + void appendToPublicIdentifier(UChar character) { ASSERT(m_type == DOCTYPE); @@ -267,19 +255,12 @@ private: WTF::Vector<UChar> m_systemIdentifier; }; - void clearData() - { - m_data.clear(); - m_dataAsNameAtom = AtomicString(); - } - Type m_type; // "name" for DOCTYPE, StartTag, and EndTag // "characters" for Character // "data" for Comment DataVector m_data; - AtomicString m_dataAsNameAtom; // For DOCTYPE OwnPtr<DoctypeData> m_doctypeData; diff --git a/WebCore/html/HTML5Tokenizer.cpp b/WebCore/html/HTML5Tokenizer.cpp deleted file mode 100644 index 0feace5..0000000 --- a/WebCore/html/HTML5Tokenizer.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (C) 2010 Google, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "HTML5Tokenizer.h" - -#include "Element.h" -#include "Frame.h" -#include "HTML5Lexer.h" -#include "HTML5ScriptRunner.h" -#include "HTML5TreeBuilder.h" -#include "HTMLDocument.h" -#include "Node.h" -#include "NotImplemented.h" - -namespace WebCore { - -HTML5Tokenizer::HTML5Tokenizer(HTMLDocument* document, bool reportErrors) - : Tokenizer() - , m_document(document) - , m_lexer(new HTML5Lexer) - , m_scriptRunner(new HTML5ScriptRunner(document, this)) - , m_treeBuilder(new HTML5TreeBuilder(m_lexer.get(), document, reportErrors)) - , m_wasWaitingOnScriptsDuringFinish(false) -{ - begin(); -} - -HTML5Tokenizer::~HTML5Tokenizer() -{ -} - -void HTML5Tokenizer::begin() -{ -} - -void HTML5Tokenizer::pumpLexer() -{ - ASSERT(!m_treeBuilder->isPaused()); - while (m_lexer->nextToken(m_source, m_token)) { - m_treeBuilder->constructTreeFromToken(m_token); - m_token.clear(); - - if (!m_treeBuilder->isPaused()) - continue; - - // The parser will pause itself when waiting on a script to load or run. - // ScriptRunner executes scripts at the right times and handles reentrancy. - bool shouldContinueParsing = m_scriptRunner->execute(m_treeBuilder->takeScriptToProcess()); - m_treeBuilder->setPaused(!shouldContinueParsing); - if (!shouldContinueParsing) - return; - } -} - -void HTML5Tokenizer::write(const SegmentedString& source, bool) -{ - // HTML5Tokenizer::executeScript is responsible for handling saving m_source before re-entry. - m_source.append(source); - if (!m_treeBuilder->isPaused()) - pumpLexer(); -} - -void HTML5Tokenizer::end() -{ - m_source.close(); - if (!m_treeBuilder->isPaused()) - pumpLexer(); - m_treeBuilder->finished(); -} - -void HTML5Tokenizer::finish() -{ - // finish() indicates we will not receive any more data. If we are waiting on - // an external script to load, we can't finish parsing quite yet. - if (isWaitingForScripts()) { - // FIXME: We might want to use real state enum instead of a bool here. - m_wasWaitingOnScriptsDuringFinish = true; - return; - } - // We can't call m_source.close() yet as we may have a <script> execution - // pending which will call document.write(). No more data off the network though. - end(); -} - -int HTML5Tokenizer::executingScript() const -{ - return m_scriptRunner->inScriptExecution(); -} - -bool HTML5Tokenizer::isWaitingForScripts() const -{ - return m_treeBuilder->isPaused(); -} - -void HTML5Tokenizer::resumeParsingAfterScriptExecution() -{ - ASSERT(!m_scriptRunner->inScriptExecution()); - ASSERT(!m_treeBuilder->isPaused()); - pumpLexer(); - ASSERT(m_treeBuilder->isPaused() || m_source.isEmpty()); - if (m_source.isEmpty() && m_wasWaitingOnScriptsDuringFinish) - end(); // The document already finished parsing we were just waiting on scripts when finished() was called. -} - -void HTML5Tokenizer::watchForLoad(CachedResource* cachedScript) -{ - ASSERT(!cachedScript->isLoaded()); - // addClient would call notifyFinished if the load were complete. - // Callers do not expect to be re-entered from this call, so they should - // not an already-loaded CachedResource. - cachedScript->addClient(this); -} - -void HTML5Tokenizer::stopWatchingForLoad(CachedResource* cachedScript) -{ - cachedScript->removeClient(this); -} - -void HTML5Tokenizer::executeScript(const ScriptSourceCode& sourceCode) -{ - ASSERT(m_scriptRunner->inScriptExecution()); - if (!m_document->frame()) - return; - - SegmentedString oldInsertionPoint = m_source; - m_source = SegmentedString(); - m_document->frame()->script()->executeScript(sourceCode); - // Append oldInsertionPoint onto the new (likely empty) m_source instead of - // oldInsertionPoint.prepent(m_source) as that would ASSERT if - // m_source.escaped() (it had characters pushed back onto it). - m_source.append(oldInsertionPoint); -} - -void HTML5Tokenizer::notifyFinished(CachedResource* cachedResource) -{ - ASSERT(!m_scriptRunner->inScriptExecution()); - ASSERT(m_treeBuilder->isPaused()); - bool shouldContinueParsing = m_scriptRunner->executeScriptsWaitingForLoad(cachedResource); - m_treeBuilder->setPaused(!shouldContinueParsing); - if (shouldContinueParsing) - resumeParsingAfterScriptExecution(); -} - -void HTML5Tokenizer::executeScriptsWaitingForStylesheets() -{ - // Ignore calls unless we have a script blocking the parser waiting on a - // stylesheet load. Otherwise we are currently parsing and this - // is a re-entrant call from encountering a </ style> tag. - if (!m_scriptRunner->hasScriptsWaitingForStylesheets()) - return; - ASSERT(!m_scriptRunner->inScriptExecution()); - ASSERT(m_treeBuilder->isPaused()); - bool shouldContinueParsing = m_scriptRunner->executeScriptsWaitingForStylesheets(); - m_treeBuilder->setPaused(!shouldContinueParsing); - if (shouldContinueParsing) - resumeParsingAfterScriptExecution(); -} - -} diff --git a/WebCore/html/HTML5Tokenizer.h b/WebCore/html/HTML5Tokenizer.h deleted file mode 100644 index b96866d..0000000 --- a/WebCore/html/HTML5Tokenizer.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2010 Google, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 HTML5Tokenizer_h -#define HTML5Tokenizer_h - -#include "CachedResourceClient.h" -#include "HTML5ScriptRunnerHost.h" -#include "HTML5Token.h" -#include "SegmentedString.h" -#include "Tokenizer.h" -#include <wtf/OwnPtr.h> - -namespace WebCore { - -class HTML5Lexer; -class HTML5ScriptRunner; -class HTML5TreeBuilder; -class HTMLDocument; -class ScriptSourceCode; - -// FIXME: The whole Tokenizer class system should be renamed "Parser" -// or "ParserController" as the job of this class is to drive parsing process -// but it does not itself Tokenize. -class HTML5Tokenizer : public Tokenizer, HTML5ScriptRunnerHost, CachedResourceClient { -public: - HTML5Tokenizer(HTMLDocument*, bool reportErrors); - virtual ~HTML5Tokenizer(); - - // Tokenizer - virtual void begin(); - virtual void write(const SegmentedString&, bool appendData); - virtual void end(); - virtual void finish(); - virtual int executingScript() const; - virtual bool isWaitingForScripts() const; - virtual void executeScriptsWaitingForStylesheets(); - - // HTML5ScriptRunnerHost - virtual void watchForLoad(CachedResource*); - virtual void stopWatchingForLoad(CachedResource*); - virtual void executeScript(const ScriptSourceCode&); - - // CachedResourceClient - virtual void notifyFinished(CachedResource*); - -private: - void pumpLexer(); - void resumeParsingAfterScriptExecution(); - - SegmentedString m_source; - - // We hold m_token here because it might be partially complete. - HTML5Token m_token; - - HTMLDocument* m_document; - OwnPtr<HTML5Lexer> m_lexer; - OwnPtr<HTML5ScriptRunner> m_scriptRunner; - OwnPtr<HTML5TreeBuilder> m_treeBuilder; - bool m_wasWaitingOnScriptsDuringFinish; -}; - -} - -#endif diff --git a/WebCore/html/HTML5TreeBuilder.cpp b/WebCore/html/HTML5TreeBuilder.cpp index 0153e94..79e1e0e 100644 --- a/WebCore/html/HTML5TreeBuilder.cpp +++ b/WebCore/html/HTML5TreeBuilder.cpp @@ -31,8 +31,8 @@ #include "HTML5Token.h" #include "HTMLDocument.h" #include "HTMLNames.h" -#include "HTMLParser.h" -#include "HTMLTokenizer.h" +#include "LegacyHTMLTreeConstructor.h" +#include "HTMLDocumentParser.h" #include "NotImplemented.h" #include <wtf/UnusedParam.h> @@ -40,12 +40,17 @@ namespace WebCore { using namespace HTMLNames; +static const int uninitializedLineNumberValue = -1; + HTML5TreeBuilder::HTML5TreeBuilder(HTML5Lexer* lexer, HTMLDocument* document, bool reportErrors) : m_document(document) , m_reportErrors(reportErrors) , m_isPaused(false) + , m_insertionMode(Initial) , m_lexer(lexer) - , m_legacyHTMLParser(new HTMLParser(document, reportErrors)) + , m_legacyTreeConstructor(new LegacyHTMLTreeConstructor(document, reportErrors)) + , m_lastScriptElementStartLine(uninitializedLineNumberValue) + , m_scriptToProcessStartLine(uninitializedLineNumberValue) { } @@ -68,7 +73,7 @@ static void convertToOldStyle(HTML5Token& token, Token& oldStyleToken) case HTML5Token::EndTag: { oldStyleToken.beginTag = (token.type() == HTML5Token::StartTag); oldStyleToken.selfClosingTag = token.selfClosing(); - oldStyleToken.tagName = token.name(); + oldStyleToken.tagName = AtomicString(token.name().data(), token.name().size()); HTML5Token::AttributeList& attributes = token.attributes(); for (HTML5Token::AttributeList::iterator iter = attributes.begin(); iter != attributes.end(); ++iter) { @@ -85,11 +90,11 @@ static void convertToOldStyle(HTML5Token& token, Token& oldStyleToken) } case HTML5Token::Comment: oldStyleToken.tagName = commentAtom; - oldStyleToken.text = token.takeComment().impl(); + oldStyleToken.text = StringImpl::create(token.comment().data(), token.comment().size()); break; case HTML5Token::Character: oldStyleToken.tagName = textAtom; - oldStyleToken.text = token.takeCharacters().impl(); + oldStyleToken.text = StringImpl::create(token.characters().data(), token.characters().size()); break; } } @@ -101,23 +106,29 @@ void HTML5TreeBuilder::handleScriptStartTag() notImplemented(); // Save insertion mode. } -void HTML5TreeBuilder::handleScriptEndTag(Element* scriptElement) +void HTML5TreeBuilder::handleScriptEndTag(Element* scriptElement, int scriptStartLine) { ASSERT(!m_scriptToProcess); // Caller never called takeScriptToProcess! + ASSERT(m_scriptToProcessStartLine == uninitializedLineNumberValue); // Caller never called takeScriptToProcess! notImplemented(); // Save insertion mode and insertion point? // Pause ourselves so that parsing stops until the script can be processed by the caller. m_isPaused = true; m_scriptToProcess = scriptElement; + // Lexer line numbers are 0-based, ScriptSourceCode expects 1-based lines, + // so we convert here before passing the line number off to HTML5ScriptRunner. + m_scriptToProcessStartLine = scriptStartLine + 1; } -PassRefPtr<Element> HTML5TreeBuilder::takeScriptToProcess() +PassRefPtr<Element> HTML5TreeBuilder::takeScriptToProcess(int& scriptStartLine) { // Unpause ourselves, callers may pause us again when processing the script. // The HTML5 spec is written as though scripts are executed inside the tree // builder. We pause the parser to exit the tree builder, and then resume // before running scripts. m_isPaused = false; + scriptStartLine = m_scriptToProcessStartLine; + m_scriptToProcessStartLine = uninitializedLineNumberValue; return m_scriptToProcess.release(); } @@ -125,11 +136,12 @@ PassRefPtr<Node> HTML5TreeBuilder::passTokenToLegacyParser(HTML5Token& token) { if (token.type() == HTML5Token::DOCTYPE) { DoctypeToken doctypeToken; - doctypeToken.m_name.append(token.name().characters(), token.name().length()); + doctypeToken.m_name.append(token.name().data(), token.name().size()); doctypeToken.m_publicID = token.publicIdentifier(); doctypeToken.m_systemID = token.systemIdentifier(); + doctypeToken.m_forceQuirks = token.forceQuirks(); - m_legacyHTMLParser->parseDoctypeToken(&doctypeToken); + m_legacyTreeConstructor->parseDoctypeToken(&doctypeToken); return 0; } @@ -137,31 +149,35 @@ PassRefPtr<Node> HTML5TreeBuilder::passTokenToLegacyParser(HTML5Token& token) Token oldStyleToken; convertToOldStyle(token, oldStyleToken); - RefPtr<Node> result = m_legacyHTMLParser->parseToken(&oldStyleToken); + RefPtr<Node> result = m_legacyTreeConstructor->parseToken(&oldStyleToken); if (token.type() == HTML5Token::StartTag) { // This work is supposed to be done by the parser, but // when using the old parser for we have to do this manually. - if (token.name() == scriptTag) { + if (oldStyleToken.tagName == scriptTag) { handleScriptStartTag(); m_lastScriptElement = static_pointer_cast<Element>(result); - } else if (token.name() == textareaTag || token.name() == titleTag) + m_lastScriptElementStartLine = m_lexer->lineNumber(); + } else if (oldStyleToken.tagName == textareaTag || oldStyleToken.tagName == titleTag) m_lexer->setState(HTML5Lexer::RCDATAState); - else if (token.name() == styleTag || token.name() == iframeTag - || token.name() == xmpTag || token.name() == noembedTag) { + else if (oldStyleToken.tagName == styleTag || oldStyleToken.tagName == iframeTag + || oldStyleToken.tagName == xmpTag || oldStyleToken.tagName == noembedTag) { // FIXME: noscript and noframes may conditionally enter this state as well. m_lexer->setState(HTML5Lexer::RAWTEXTState); - } else if (token.name() == plaintextTag) + } else if (oldStyleToken.tagName == plaintextTag) m_lexer->setState(HTML5Lexer::PLAINTEXTState); - else if (token.name() == preTag || token.name() == listingTag) + else if (oldStyleToken.tagName == preTag || oldStyleToken.tagName == listingTag) m_lexer->skipLeadingNewLineForListing(); } if (token.type() == HTML5Token::EndTag) { - if (token.name() == scriptTag) { + if (oldStyleToken.tagName == scriptTag && insertionMode() != AfterFrameset) { if (m_lastScriptElement) { - handleScriptEndTag(m_lastScriptElement.get()); + ASSERT(m_lastScriptElementStartLine != uninitializedLineNumberValue); + handleScriptEndTag(m_lastScriptElement.get(), m_lastScriptElementStartLine); m_lastScriptElement = 0; + m_lastScriptElementStartLine = uninitializedLineNumberValue; } - } + } else if (oldStyleToken.tagName == framesetTag) + setInsertionMode(AfterFrameset); } return result.release(); } @@ -197,8 +213,8 @@ PassRefPtr<Node> HTML5TreeBuilder::processToken(HTML5Token& token, UChar current void HTML5TreeBuilder::finished() { // We should call m_document->finishedParsing() here, except - // m_legacyHTMLParser->finished() does it for us. - m_legacyHTMLParser->finished(); + // m_legacyTreeConstructor->finished() does it for us. + m_legacyTreeConstructor->finished(); } } diff --git a/WebCore/html/HTML5TreeBuilder.h b/WebCore/html/HTML5TreeBuilder.h index ee5ba47..a61bb7f 100644 --- a/WebCore/html/HTML5TreeBuilder.h +++ b/WebCore/html/HTML5TreeBuilder.h @@ -39,7 +39,7 @@ class Frame; class HTML5Lexer; class HTML5Token; class HTMLDocument; -class HTMLParser; +class LegacyHTMLTreeConstructor; class Node; class HTML5TreeBuilder : public Noncopyable { @@ -53,29 +53,53 @@ public: // The token really should be passed as a const& since it's never modified. PassRefPtr<Node> constructTreeFromToken(HTML5Token&); // Must be called when parser is paused before calling the parser again. - PassRefPtr<Element> takeScriptToProcess(); + PassRefPtr<Element> takeScriptToProcess(int& scriptStartLine); // Done, close any open tags, etc. void finished(); + // FIXME: This is a dirty, rotten hack to keep HTMLFormControlElement happy + // until we stop using the legacy parser. DO NOT CALL THIS METHOD. + LegacyHTMLTreeConstructor* legacyTreeConstructor() const { return m_legacyTreeConstructor.get(); } + private: + // Represents HTML5 "insertion mode" + // http://www.w3.org/TR/html5/syntax.html#insertion-mode + // FIXME: Implement remainder of states. + enum InsertionMode { + Initial, + AfterFrameset, + }; + PassRefPtr<Node> passTokenToLegacyParser(HTML5Token&); PassRefPtr<Node> processToken(HTML5Token&, UChar currentCharacter = 0); void handleScriptStartTag(); - void handleScriptEndTag(Element*); + void handleScriptEndTag(Element*, int scriptStartLine); + + void setInsertionMode(InsertionMode value) { m_insertionMode = value; } + InsertionMode insertionMode() const { return m_insertionMode; } Document* m_document; // This is only used by the m_legacyParser for now. bool m_reportErrors; bool m_isPaused; + + InsertionMode m_insertionMode; + // HTML5 spec requires that we be able to change the state of the lexer // from within parser actions. HTML5Lexer* m_lexer; - // We're re-using logic from the old HTMLParser while this class is being written. - OwnPtr<HTMLParser> m_legacyHTMLParser; - RefPtr<Element> m_lastScriptElement; // FIXME: This is a hack for <script> support. - RefPtr<Element> m_scriptToProcess; // Set to a <script> tag which needs processing. + // We're re-using logic from the old LegacyHTMLTreeConstructor while this class is being written. + OwnPtr<LegacyHTMLTreeConstructor> m_legacyTreeConstructor; + + // These members are intentionally duplicated as the first set is a hack + // on top of the legacy parser which will eventually be removed. + RefPtr<Element> m_lastScriptElement; // FIXME: Hack for <script> support on top of the old parser. + int m_lastScriptElementStartLine; // FIXME: Hack for <script> support on top of the old parser. + + RefPtr<Element> m_scriptToProcess; // <script> tag which needs processing before resuming the parser. + int m_scriptToProcessStartLine; // Starting line number of the script tag needing processing. }; } diff --git a/WebCore/html/HTMLAppletElement.cpp b/WebCore/html/HTMLAppletElement.cpp index 79fcfba..537d615 100644 --- a/WebCore/html/HTMLAppletElement.cpp +++ b/WebCore/html/HTMLAppletElement.cpp @@ -63,7 +63,7 @@ void HTMLAppletElement::parseMappedAttribute(Attribute* attr) document->addNamedItem(newName); } m_name = newName; - } else if (attr->name() == idAttributeName()) { + } else if (isIdAttributeName(attr->name())) { const AtomicString& newId = attr->value(); if (inDocument() && document()->isHTMLDocument()) { HTMLDocument* document = static_cast<HTMLDocument*>(this->document()); @@ -118,7 +118,7 @@ RenderObject* HTMLAppletElement::createRenderer(RenderArena*, RenderStyle* style if (!codeBase.isNull()) args.set("codeBase", codeBase); - const AtomicString& name = getAttribute(document()->isHTMLDocument() ? nameAttr : idAttributeName()); + const AtomicString& name = document()->isHTMLDocument() ? getAttribute(nameAttr) : getIdAttribute(); if (!name.isNull()) args.set("name", name); const AtomicString& archive = getAttribute(archiveAttr); diff --git a/WebCore/html/HTMLAttributeNames.in b/WebCore/html/HTMLAttributeNames.in index 7cde32f..90b249a 100644 --- a/WebCore/html/HTMLAttributeNames.in +++ b/WebCore/html/HTMLAttributeNames.in @@ -24,6 +24,7 @@ aria-expanded aria-flowto aria-grabbed aria-haspopup +aria-help aria-hidden aria-label aria-labeledby diff --git a/WebCore/html/HTMLCanvasElement.cpp b/WebCore/html/HTMLCanvasElement.cpp index c9e4620..72343aa 100644 --- a/WebCore/html/HTMLCanvasElement.cpp +++ b/WebCore/html/HTMLCanvasElement.cpp @@ -156,7 +156,11 @@ CanvasRenderingContext* HTMLCanvasElement::getContext(const String& type, Canvas } #if ENABLE(3D_CANVAS) Settings* settings = document()->settings(); - if (settings && settings->webGLEnabled() && settings->acceleratedCompositingEnabled()) { + if (settings && settings->webGLEnabled() +#if !PLATFORM(CHROMIUM) && !PLATFORM(QT) + && settings->acceleratedCompositingEnabled() +#endif + ) { // Accept the legacy "webkit-3d" name as well as the provisional "experimental-webgl" name. // Once ratified, we will also accept "webgl" as the context name. if ((type == "webkit-3d") || diff --git a/WebCore/html/HTMLCanvasElement.idl b/WebCore/html/HTMLCanvasElement.idl index 656d6ae..3a56330 100644 --- a/WebCore/html/HTMLCanvasElement.idl +++ b/WebCore/html/HTMLCanvasElement.idl @@ -27,7 +27,8 @@ module html { interface [ - CustomMarkFunction + CustomMarkFunction, + GenerateNativeConverter ] HTMLCanvasElement : HTMLElement { attribute long width; @@ -36,10 +37,12 @@ module html { [Custom] DOMString toDataURL(in [ConvertUndefinedOrNullToNullString] DOMString type) raises(DOMException); +#if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C // The custom binding is needed to handle context creation attributes. [Custom] DOMObject getContext(in DOMString contextId); #endif +#endif }; diff --git a/WebCore/html/HTMLCollection.cpp b/WebCore/html/HTMLCollection.cpp index 8a942c3..8a202ae 100644 --- a/WebCore/html/HTMLCollection.cpp +++ b/WebCore/html/HTMLCollection.cpp @@ -266,7 +266,7 @@ bool HTMLCollection::checkForNameMatch(Element* element, bool checkName, const A HTMLElement* e = static_cast<HTMLElement*>(element); if (!checkName) - return e->getAttribute(e->idAttributeName()) == name; + return e->getIdAttribute() == name; // document.all returns only images, forms, applets, objects and embeds // by name (though everything by id) @@ -277,7 +277,7 @@ bool HTMLCollection::checkForNameMatch(Element* element, bool checkName, const A e->hasLocalName(selectTag))) return false; - return e->getAttribute(nameAttr) == name && e->getAttribute(e->idAttributeName()) != name; + return e->getAttribute(nameAttr) == name && e->getIdAttribute() != name; } Node* HTMLCollection::namedItem(const AtomicString& name) const @@ -319,7 +319,7 @@ void HTMLCollection::updateNameCache() const if (!element->isHTMLElement()) continue; HTMLElement* e = static_cast<HTMLElement*>(element); - const AtomicString& idAttrVal = e->getAttribute(e->idAttributeName()); + const AtomicString& idAttrVal = e->getIdAttribute(); const AtomicString& nameAttrVal = e->getAttribute(nameAttr); if (!idAttrVal.isEmpty()) { // add to id cache diff --git a/WebCore/html/HTMLDataGridColElement.cpp b/WebCore/html/HTMLDataGridColElement.cpp index be2b7f2..8486d4d 100644 --- a/WebCore/html/HTMLDataGridColElement.cpp +++ b/WebCore/html/HTMLDataGridColElement.cpp @@ -60,7 +60,7 @@ void HTMLDataGridColElement::ensureColumn() { if (m_column) return; - m_column = DataGridColumn::create(getAttribute(idAttributeName()), label(), type(), primary(), sortable()); + m_column = DataGridColumn::create(getIdAttribute(), label(), type(), primary(), sortable()); } void HTMLDataGridColElement::insertedIntoTree(bool deep) @@ -167,8 +167,8 @@ void HTMLDataGridColElement::parseMappedAttribute(Attribute* attr) column()->setSortable(sortable()); else if (attr->name() == sortdirectionAttr) column()->setSortDirection(sortDirection()); - else if (attr->name() == idAttributeName()) - column()->setId(getAttribute(idAttributeName())); + else if (isIdAttributeName(attr->name())) + column()->setId(getIdAttribute()); } } // namespace WebCore diff --git a/WebCore/html/HTMLDocument.cpp b/WebCore/html/HTMLDocument.cpp index f060adb..b066f8a 100644 --- a/WebCore/html/HTMLDocument.cpp +++ b/WebCore/html/HTMLDocument.cpp @@ -64,11 +64,11 @@ #include "FrameLoader.h" #include "FrameTree.h" #include "FrameView.h" -#include "HTML5Tokenizer.h" +#include "HTML5DocumentParser.h" #include "HTMLBodyElement.h" #include "HTMLElementFactory.h" #include "HTMLNames.h" -#include "HTMLTokenizer.h" +#include "HTMLDocumentParser.h" #include "InspectorController.h" #include "KURL.h" #include "Page.h" @@ -283,7 +283,7 @@ void HTMLDocument::releaseEvents() { } -Tokenizer* HTMLDocument::createTokenizer() +DocumentParser* HTMLDocument::createParser() { bool reportErrors = false; #if ENABLE(INSPECTOR) @@ -292,9 +292,9 @@ Tokenizer* HTMLDocument::createTokenizer() #endif if (settings() && settings()->html5ParserEnabled()) - return new HTML5Tokenizer(this, reportErrors); + return new HTML5DocumentParser(this, reportErrors); - return new HTMLTokenizer(this, reportErrors); + return new HTMLDocumentParser(this, reportErrors); } // -------------------------------------------------------------------------- diff --git a/WebCore/html/HTMLDocument.h b/WebCore/html/HTMLDocument.h index 55cf8ad..5b1f636 100644 --- a/WebCore/html/HTMLDocument.h +++ b/WebCore/html/HTMLDocument.h @@ -96,7 +96,7 @@ private: virtual PassRefPtr<Element> createElement(const AtomicString& tagName, ExceptionCode&); virtual bool isFrameSet() const; - virtual Tokenizer* createTokenizer(); + virtual DocumentParser* createParser(); virtual void determineParseMode(); void addItemToMap(HashCountedSet<AtomicStringImpl*>&, const AtomicString&); diff --git a/WebCore/html/HTMLDocument.idl b/WebCore/html/HTMLDocument.idl index a79b913..9684373 100644 --- a/WebCore/html/HTMLDocument.idl +++ b/WebCore/html/HTMLDocument.idl @@ -23,7 +23,7 @@ module html { interface [ HasOverridingNameGetter ] HTMLDocument : Document { - [Custom] void open(); + [Custom, NoCPPCustom] void open(); void close(); [Custom] void write(in DOMString text); [Custom] void writeln(in DOMString text); diff --git a/WebCore/html/HTMLDocumentParser.cpp b/WebCore/html/HTMLDocumentParser.cpp new file mode 100644 index 0000000..ba2688f --- /dev/null +++ b/WebCore/html/HTMLDocumentParser.cpp @@ -0,0 +1,2136 @@ +/* + Copyright (C) 1997 Martin Jones (mjones@kde.org) + (C) 1997 Torben Weis (weis@kde.org) + (C) 1998 Waldo Bastian (bastian@kde.org) + (C) 1999 Lars Knoll (knoll@kde.org) + (C) 1999 Antti Koivisto (koivisto@kde.org) + (C) 2001 Dirk Mueller (mueller@kde.org) + Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + Copyright (C) 2005, 2006 Alexey Proskuryakov (ap@nypop.com) + Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) + + 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 "HTMLDocumentParser.h" + +#include "Attribute.h" +#include "CSSHelper.h" +#include "Cache.h" +#include "CachedScript.h" +#include "DocLoader.h" +#include "DocumentFragment.h" +#include "Event.h" +#include "EventNames.h" +#include "Frame.h" +#include "FrameLoader.h" +#include "FrameView.h" +#include "HTMLElement.h" +#include "HTMLNames.h" +#include "LegacyHTMLTreeConstructor.h" +#include "HTMLScriptElement.h" +#include "HTMLViewSourceDocument.h" +#include "ImageLoader.h" +#include "InspectorTimelineAgent.h" +#include "Page.h" +#include "PreloadScanner.h" +#include "ScriptController.h" +#include "ScriptSourceCode.h" +#include "ScriptValue.h" +#include "XSSAuditor.h" +#include <wtf/ASCIICType.h> +#include <wtf/CurrentTime.h> + +#include "HTMLEntityNames.cpp" + +#ifdef ANDROID_INSTRUMENT +#include "TimeCounter.h" +#endif + +#define PRELOAD_SCANNER_ENABLED 1 + +using namespace WTF; +using namespace std; + +namespace WebCore { + +using namespace HTMLNames; + +// This value is used to define how many characters the parser will process before +// yeilding control. +// To increase responsivness reduce the parser chunk size. +static const int defaultTokenizerChunkSize = 4096; + +// FIXME: We would like this constant to be 200ms. +// Yielding more aggressively results in increased responsiveness and better incremental rendering. +// It slows down overall page-load on slower machines, though, so for now we set a value of 500. +// For smaller chunks (above) decrease the value of TimerDelay as the the parser should not +// yield for as long a period otherwise it will take way to long to load a page. +static const double defaultTokenizerTimeDelay = 0.500; + +static const char commentStart [] = "<!--"; +static const char doctypeStart [] = "<!doctype"; +static const char publicStart [] = "public"; +static const char systemStart [] = "system"; +static const char scriptEnd [] = "</script"; +static const char xmpEnd [] = "</xmp"; +static const char styleEnd [] = "</style"; +static const char textareaEnd [] = "</textarea"; +static const char titleEnd [] = "</title"; +static const char iframeEnd [] = "</iframe"; + +// Full support for MS Windows extensions to Latin-1. +// Technically these extensions should only be activated for pages +// marked "windows-1252" or "cp1252", but +// in the standard Microsoft way, these extensions infect hundreds of thousands +// of web pages. Note that people with non-latin-1 Microsoft extensions +// are SOL. +// +// See: http://www.microsoft.com/globaldev/reference/WinCP.asp +// http://www.bbsinc.com/iso8859.html +// http://www.obviously.com/ +// +// There may be better equivalents + +// We only need this for entities. For non-entity text, we handle this in the text encoding. + +static const UChar windowsLatin1ExtensionArray[32] = { + 0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, // 80-87 + 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008D, 0x017D, 0x008F, // 88-8F + 0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, // 90-97 + 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x009D, 0x017E, 0x0178 // 98-9F +}; + +static inline UChar fixUpChar(UChar c) +{ + if ((c & ~0x1F) != 0x0080) + return c; + return windowsLatin1ExtensionArray[c - 0x80]; +} + +static inline bool tagMatch(const char* s1, const UChar* s2, unsigned length) +{ + for (unsigned i = 0; i != length; ++i) { + unsigned char c1 = s1[i]; + unsigned char uc1 = toASCIIUpper(static_cast<char>(c1)); + UChar c2 = s2[i]; + if (c1 != c2 && uc1 != c2) + return false; + } + return true; +} + +inline void Token::addAttribute(AtomicString& attrName, const AtomicString& attributeValue, bool viewSourceMode) +{ + if (!attrName.isEmpty()) { + ASSERT(!attrName.contains('/')); + RefPtr<Attribute> a = Attribute::createMapped(attrName, attributeValue); + if (!attrs) { + attrs = NamedNodeMap::create(); + attrs->reserveInitialCapacity(10); + } + attrs->insertAttribute(a.release(), viewSourceMode); + } + + attrName = emptyAtom; +} + +// ---------------------------------------------------------------------------- + +HTMLDocumentParser::HTMLDocumentParser(HTMLDocument* doc, bool reportErrors) + : DocumentParser() + , m_buffer(0) + , m_scriptCode(0) + , m_scriptCodeSize(0) + , m_scriptCodeCapacity(0) + , m_scriptCodeResync(0) + , m_executingScript(0) + , m_requestingScript(false) + , m_hasScriptsWaitingForStylesheets(false) + , m_timer(this, &HTMLDocumentParser::timerFired) + , m_externalScriptsTimer(this, &HTMLDocumentParser::executeExternalScriptsTimerFired) + , m_doc(doc) + , m_treeConstructor(new LegacyHTMLTreeConstructor(doc, reportErrors)) + , m_inWrite(false) + , m_fragment(false) + , m_scriptingPermission(FragmentScriptingAllowed) +{ + begin(); +} + +HTMLDocumentParser::HTMLDocumentParser(HTMLViewSourceDocument* doc) + : DocumentParser(true) + , m_buffer(0) + , m_scriptCode(0) + , m_scriptCodeSize(0) + , m_scriptCodeCapacity(0) + , m_scriptCodeResync(0) + , m_executingScript(0) + , m_requestingScript(false) + , m_hasScriptsWaitingForStylesheets(false) + , m_timer(this, &HTMLDocumentParser::timerFired) + , m_externalScriptsTimer(this, &HTMLDocumentParser::executeExternalScriptsTimerFired) + , m_doc(doc) + , m_inWrite(false) + , m_fragment(false) + , m_scriptingPermission(FragmentScriptingAllowed) +{ + begin(); +} + +HTMLDocumentParser::HTMLDocumentParser(DocumentFragment* frag, FragmentScriptingPermission scriptingPermission) + : m_buffer(0) + , m_scriptCode(0) + , m_scriptCodeSize(0) + , m_scriptCodeCapacity(0) + , m_scriptCodeResync(0) + , m_executingScript(0) + , m_requestingScript(false) + , m_hasScriptsWaitingForStylesheets(false) + , m_timer(this, &HTMLDocumentParser::timerFired) + , m_externalScriptsTimer(this, &HTMLDocumentParser::executeExternalScriptsTimerFired) + , m_doc(frag->document()) + , m_treeConstructor(new LegacyHTMLTreeConstructor(frag, scriptingPermission)) + , m_inWrite(false) + , m_fragment(true) + , m_scriptingPermission(scriptingPermission) +{ + begin(); +} + +void HTMLDocumentParser::reset() +{ + ASSERT(m_executingScript == 0); + + while (!m_pendingScripts.isEmpty()) { + CachedScript* cs = m_pendingScripts.takeFirst().get(); + ASSERT(cache()->disabled() || cs->accessCount() > 0); + cs->removeClient(this); + } + + fastFree(m_buffer); + m_buffer = m_dest = 0; + m_bufferSize = 0; + + fastFree(m_scriptCode); + m_scriptCode = 0; + m_scriptCodeSize = m_scriptCodeCapacity = m_scriptCodeResync = 0; + + m_timer.stop(); + m_externalScriptsTimer.stop(); + + m_state.setAllowYield(false); + m_state.setForceSynchronous(false); + + m_currentToken.reset(); + m_doctypeToken.reset(); + m_doctypeSearchCount = 0; + m_doctypeSecondarySearchCount = 0; + m_hasScriptsWaitingForStylesheets = false; +} + +void HTMLDocumentParser::begin() +{ + m_executingScript = 0; + m_requestingScript = false; + m_hasScriptsWaitingForStylesheets = false; + m_state.setLoadingExtScript(false); + reset(); + m_bufferSize = 254; + m_buffer = static_cast<UChar*>(fastMalloc(sizeof(UChar) * 254)); + m_dest = m_buffer; + tquote = NoQuote; + searchCount = 0; + m_state.setEntityState(NoEntity); + m_scriptTagSrcAttrValue = String(); + m_pendingSrc.clear(); + m_currentPrependingSrc = 0; + m_noMoreData = false; + m_brokenComments = false; + m_brokenServer = false; + m_lineNumber = 0; + m_currentScriptTagStartLineNumber = 0; + m_currentTagStartLineNumber = 0; + m_state.setForceSynchronous(false); + + Page* page = m_doc->page(); + if (page && page->hasCustomHTMLTokenizerTimeDelay()) + m_tokenizerTimeDelay = page->customHTMLTokenizerTimeDelay(); + else + m_tokenizerTimeDelay = defaultTokenizerTimeDelay; + + if (page && page->hasCustomHTMLTokenizerChunkSize()) + m_tokenizerChunkSize = page->customHTMLTokenizerChunkSize(); + else + m_tokenizerChunkSize = defaultTokenizerChunkSize; +} + +void HTMLDocumentParser::setForceSynchronous(bool force) +{ + m_state.setForceSynchronous(force); +} + +HTMLDocumentParser::State HTMLDocumentParser::processListing(SegmentedString list, State state) +{ + // This function adds the listing 'list' as + // preformatted text-tokens to the token-collection + while (!list.isEmpty()) { + if (state.skipLF()) { + state.setSkipLF(false); + if (*list == '\n') { + list.advance(); + continue; + } + } + + checkBuffer(); + + if (*list == '\n' || *list == '\r') { + if (state.discardLF()) + // Ignore this LF + state.setDiscardLF(false); // We have discarded 1 LF + else + *m_dest++ = '\n'; + + /* Check for MS-DOS CRLF sequence */ + if (*list == '\r') + state.setSkipLF(true); + + list.advance(); + } else { + state.setDiscardLF(false); + *m_dest++ = *list; + list.advance(); + } + } + + return state; +} + +HTMLDocumentParser::State HTMLDocumentParser::parseNonHTMLText(SegmentedString& src, State state) +{ + ASSERT(state.inTextArea() || state.inTitle() || state.inIFrame() || !state.hasEntityState()); + ASSERT(!state.hasTagState()); + ASSERT(state.inXmp() + state.inTextArea() + state.inTitle() + state.inStyle() + state.inScript() + state.inIFrame() == 1); + if (state.inScript() && !m_currentScriptTagStartLineNumber) + m_currentScriptTagStartLineNumber = m_lineNumber; + + if (state.inComment()) + state = parseComment(src, state); + + int lastDecodedEntityPosition = -1; + while (!src.isEmpty()) { + checkScriptBuffer(); + UChar ch = *src; + + if (!m_scriptCodeResync && !m_brokenComments && + !state.inXmp() && ch == '-' && m_scriptCodeSize >= 3 && !src.escaped() && + m_scriptCode[m_scriptCodeSize - 3] == '<' && m_scriptCode[m_scriptCodeSize - 2] == '!' && m_scriptCode[m_scriptCodeSize - 1] == '-' && + (lastDecodedEntityPosition < m_scriptCodeSize - 3)) { + state.setInComment(true); + state = parseComment(src, state); + continue; + } + if (m_scriptCodeResync && !tquote && ch == '>') { + src.advancePastNonNewline(); + m_scriptCodeSize = m_scriptCodeResync - 1; + m_scriptCodeResync = 0; + m_scriptCode[m_scriptCodeSize] = m_scriptCode[m_scriptCodeSize + 1] = 0; + if (state.inScript()) + state = scriptHandler(state); + else { + state = processListing(SegmentedString(m_scriptCode, m_scriptCodeSize), state); + processToken(); + if (state.inStyle()) { + m_currentToken.tagName = styleTag.localName(); + m_currentToken.beginTag = false; + } else if (state.inTextArea()) { + m_currentToken.tagName = textareaTag.localName(); + m_currentToken.beginTag = false; + } else if (state.inTitle()) { + m_currentToken.tagName = titleTag.localName(); + m_currentToken.beginTag = false; + } else if (state.inXmp()) { + m_currentToken.tagName = xmpTag.localName(); + m_currentToken.beginTag = false; + } else if (state.inIFrame()) { + m_currentToken.tagName = iframeTag.localName(); + m_currentToken.beginTag = false; + } + processToken(); + state.setInStyle(false); + state.setInScript(false); + state.setInTextArea(false); + state.setInTitle(false); + state.setInXmp(false); + state.setInIFrame(false); + tquote = NoQuote; + m_scriptCodeSize = m_scriptCodeResync = 0; + } + return state; + } + // possible end of tagname, lets check. + if (!m_scriptCodeResync && !state.escaped() && !src.escaped() && (ch == '>' || ch == '/' || isASCIISpace(ch)) && + m_scriptCodeSize >= m_searchStopperLength && + tagMatch(m_searchStopper, m_scriptCode + m_scriptCodeSize - m_searchStopperLength, m_searchStopperLength) && + (lastDecodedEntityPosition < m_scriptCodeSize - m_searchStopperLength)) { + m_scriptCodeResync = m_scriptCodeSize-m_searchStopperLength+1; + tquote = NoQuote; + continue; + } + if (m_scriptCodeResync && !state.escaped()) { + if (ch == '\"') + tquote = (tquote == NoQuote) ? DoubleQuote : ((tquote == SingleQuote) ? SingleQuote : NoQuote); + else if (ch == '\'') + tquote = (tquote == NoQuote) ? SingleQuote : (tquote == DoubleQuote) ? DoubleQuote : NoQuote; + else if (tquote != NoQuote && (ch == '\r' || ch == '\n')) + tquote = NoQuote; + } + state.setEscaped(!state.escaped() && ch == '\\'); + if (!m_scriptCodeResync && (state.inTextArea() || state.inTitle() || state.inIFrame()) && !src.escaped() && ch == '&') { + UChar* scriptCodeDest = m_scriptCode + m_scriptCodeSize; + src.advancePastNonNewline(); + state = parseEntity(src, scriptCodeDest, state, m_cBufferPos, true, false); + if (scriptCodeDest == m_scriptCode + m_scriptCodeSize) + lastDecodedEntityPosition = m_scriptCodeSize; + else + m_scriptCodeSize = scriptCodeDest - m_scriptCode; + } else { + m_scriptCode[m_scriptCodeSize++] = ch; + src.advance(m_lineNumber); + } + } + + return state; +} + +HTMLDocumentParser::State HTMLDocumentParser::scriptHandler(State state) +{ + // We are inside a <script> + bool doScriptExec = false; + int startLine = m_currentScriptTagStartLineNumber + 1; // Script line numbers are 1 based, HTMLTokenzier line numbers are 0 based + + // Reset m_currentScriptTagStartLineNumber to indicate that we've finished parsing the current script element + m_currentScriptTagStartLineNumber = 0; + + // (Bugzilla 3837) Scripts following a frameset element should not execute or, + // in the case of extern scripts, even load. + bool followingFrameset = (m_doc->body() && m_doc->body()->hasTagName(framesetTag)); + + CachedScript* cs = 0; + // don't load external scripts for standalone documents (for now) + if (!inViewSourceMode()) { + if (!m_scriptTagSrcAttrValue.isEmpty() && m_doc->frame()) { + // forget what we just got; load from src url instead + if (!m_treeConstructor->skipMode() && !followingFrameset) { + // The parser might have been stopped by for example a window.close call in an earlier script. + // If so, we don't want to load scripts. + if (!m_parserStopped && m_scriptNode->dispatchBeforeLoadEvent(m_scriptTagSrcAttrValue) && + (cs = m_doc->docLoader()->requestScript(m_scriptTagSrcAttrValue, m_scriptTagCharsetAttrValue))) + m_pendingScripts.append(cs); + else + m_scriptNode = 0; + } else + m_scriptNode = 0; + m_scriptTagSrcAttrValue = String(); + } else { + // Parse m_scriptCode containing <script> info + doScriptExec = m_scriptNode->shouldExecuteAsJavaScript(); +#if ENABLE(XHTMLMP) + if (!doScriptExec) + m_doc->setShouldProcessNoscriptElement(true); +#endif + m_scriptNode = 0; + } + } + + state = processListing(SegmentedString(m_scriptCode, m_scriptCodeSize), state); + RefPtr<Node> node = processToken(); + + if (node && m_scriptingPermission == FragmentScriptingNotAllowed) { + ExceptionCode ec; + node->remove(ec); + node = 0; + } + + String scriptString = node ? node->textContent() : ""; + m_currentToken.tagName = scriptTag.localName(); + m_currentToken.beginTag = false; + processToken(); + + state.setInScript(false); + m_scriptCodeSize = m_scriptCodeResync = 0; + + // FIXME: The script should be syntax highlighted. + if (inViewSourceMode()) + return state; + + SegmentedString* savedPrependingSrc = m_currentPrependingSrc; + SegmentedString prependingSrc; + m_currentPrependingSrc = &prependingSrc; + +<<<<<<< HEAD:WebCore/html/HTMLTokenizer.cpp +#ifdef ANDROID_INSTRUMENT + android::TimeCounter::recordNoCounter(android::TimeCounter::ParsingTimeCounter, __FUNCTION__); +#endif + + if (!m_parser->skipMode() && !followingFrameset) { +======= + if (!m_treeConstructor->skipMode() && !followingFrameset) { +>>>>>>> Webkit.org at r61121:WebCore/html/HTMLDocumentParser.cpp + if (cs) { + if (savedPrependingSrc) + savedPrependingSrc->append(m_src); + else + m_pendingSrc.prepend(m_src); + setSrc(SegmentedString()); + + // the ref() call below may call notifyFinished if the script is already in cache, + // and that mucks with the state directly, so we must write it back to the object. + m_state = state; + bool savedRequestingScript = m_requestingScript; + m_requestingScript = true; + cs->addClient(this); + m_requestingScript = savedRequestingScript; + state = m_state; + // will be 0 if script was already loaded and ref() executed it + if (!m_pendingScripts.isEmpty()) + state.setLoadingExtScript(true); + } else if (!m_fragment && doScriptExec) { + if (!m_executingScript) + m_pendingSrc.prepend(m_src); + else + prependingSrc = m_src; + setSrc(SegmentedString()); + state = scriptExecution(ScriptSourceCode(scriptString, m_doc->frame() ? m_doc->frame()->document()->url() : KURL(), startLine), state); + } + } + +#ifdef ANDROID_INSTRUMENT + android::TimeCounter::start(android::TimeCounter::ParsingTimeCounter); +#endif + + if (!m_executingScript && !state.loadingExtScript()) { + m_src.append(m_pendingSrc); + m_pendingSrc.clear(); + } else if (!prependingSrc.isEmpty()) { + // restore first so that the write appends in the right place + // (does not hurt to do it again below) + m_currentPrependingSrc = savedPrependingSrc; + + // we need to do this slightly modified bit of one of the write() cases + // because we want to prepend to m_pendingSrc rather than appending + // if there's no previous prependingSrc + if (!m_pendingScripts.isEmpty()) { + if (m_currentPrependingSrc) + m_currentPrependingSrc->append(prependingSrc); + else + m_pendingSrc.prepend(prependingSrc); + } else { + m_state = state; + write(prependingSrc, false); + state = m_state; + } + } + +#if PRELOAD_SCANNER_ENABLED + if (!m_pendingScripts.isEmpty() && !m_executingScript) { + if (!m_preloadScanner) + m_preloadScanner.set(new PreloadScanner(m_doc)); + if (!m_preloadScanner->inProgress()) { + m_preloadScanner->begin(); + m_preloadScanner->write(m_pendingSrc); + } + } +#endif + m_currentPrependingSrc = savedPrependingSrc; + + return state; +} + +HTMLDocumentParser::State HTMLDocumentParser::scriptExecution(const ScriptSourceCode& sourceCode, State state) +{ + if (m_fragment || !m_doc->frame()) + return state; + m_executingScript++; + + SegmentedString* savedPrependingSrc = m_currentPrependingSrc; + SegmentedString prependingSrc; + m_currentPrependingSrc = &prependingSrc; + + m_state = state; + m_doc->frame()->script()->executeScript(sourceCode); + state = m_state; + + state.setAllowYield(true); + + m_executingScript--; + + if (!m_executingScript && !state.loadingExtScript()) { + m_pendingSrc.prepend(prependingSrc); + m_src.append(m_pendingSrc); + m_pendingSrc.clear(); + } else if (!prependingSrc.isEmpty()) { + // restore first so that the write appends in the right place + // (does not hurt to do it again below) + m_currentPrependingSrc = savedPrependingSrc; + + // we need to do this slightly modified bit of one of the write() cases + // because we want to prepend to m_pendingSrc rather than appending + // if there's no previous prependingSrc + if (!m_pendingScripts.isEmpty()) { + if (m_currentPrependingSrc) + m_currentPrependingSrc->append(prependingSrc); + else + m_pendingSrc.prepend(prependingSrc); + +#if PRELOAD_SCANNER_ENABLED + // We are stuck waiting for another script. Lets check the source that + // was just document.write()n for anything to load. + PreloadScanner documentWritePreloadScanner(m_doc); + documentWritePreloadScanner.begin(); + documentWritePreloadScanner.write(prependingSrc); + documentWritePreloadScanner.end(); +#endif + } else { + m_state = state; + write(prependingSrc, false); + state = m_state; + } + } + + m_currentPrependingSrc = savedPrependingSrc; + + return state; +} + +HTMLDocumentParser::State HTMLDocumentParser::parseComment(SegmentedString& src, State state) +{ + // FIXME: Why does this code even run for comments inside <script> and <style>? This seems bogus. + checkScriptBuffer(src.length()); + while (!src.isEmpty()) { + UChar ch = *src; + m_scriptCode[m_scriptCodeSize++] = ch; + if (ch == '>') { + bool handleBrokenComments = m_brokenComments && !(state.inScript() || state.inStyle()); + int endCharsCount = 1; // start off with one for the '>' character + if (m_scriptCodeSize > 2 && m_scriptCode[m_scriptCodeSize-3] == '-' && m_scriptCode[m_scriptCodeSize-2] == '-') { + endCharsCount = 3; + } else if (m_scriptCodeSize > 3 && m_scriptCode[m_scriptCodeSize-4] == '-' && m_scriptCode[m_scriptCodeSize-3] == '-' && + m_scriptCode[m_scriptCodeSize-2] == '!') { + // Other browsers will accept --!> as a close comment, even though it's + // not technically valid. + endCharsCount = 4; + } + if (handleBrokenComments || endCharsCount > 1) { + src.advancePastNonNewline(); + if (!(state.inTitle() || state.inScript() || state.inXmp() || state.inTextArea() || state.inStyle() || state.inIFrame())) { + checkScriptBuffer(); + m_scriptCode[m_scriptCodeSize] = 0; + m_scriptCode[m_scriptCodeSize + 1] = 0; + m_currentToken.tagName = commentAtom; + m_currentToken.beginTag = true; + state = processListing(SegmentedString(m_scriptCode, m_scriptCodeSize - endCharsCount), state); + processToken(); + m_currentToken.tagName = commentAtom; + m_currentToken.beginTag = false; + processToken(); + m_scriptCodeSize = 0; + } + state.setInComment(false); + return state; // Finished parsing comment + } + } + src.advance(m_lineNumber); + } + + return state; +} + +HTMLDocumentParser::State HTMLDocumentParser::parseServer(SegmentedString& src, State state) +{ + checkScriptBuffer(src.length()); + while (!src.isEmpty()) { + UChar ch = *src; + m_scriptCode[m_scriptCodeSize++] = ch; + if (ch == '>' && m_scriptCodeSize > 1 && m_scriptCode[m_scriptCodeSize - 2] == '%') { + src.advancePastNonNewline(); + state.setInServer(false); + m_scriptCodeSize = 0; + return state; // Finished parsing server include + } + src.advance(m_lineNumber); + } + return state; +} + +HTMLDocumentParser::State HTMLDocumentParser::parseProcessingInstruction(SegmentedString& src, State state) +{ + UChar oldchar = 0; + while (!src.isEmpty()) { + UChar chbegin = *src; + if (chbegin == '\'') + tquote = tquote == SingleQuote ? NoQuote : SingleQuote; + else if (chbegin == '\"') + tquote = tquote == DoubleQuote ? NoQuote : DoubleQuote; + // Look for '?>' + // Some crappy sites omit the "?" before it, so + // we look for an unquoted '>' instead. (IE compatible) + else if (chbegin == '>' && (!tquote || oldchar == '?')) { + // We got a '?>' sequence + state.setInProcessingInstruction(false); + src.advancePastNonNewline(); + state.setDiscardLF(true); + return state; // Finished parsing comment! + } + src.advance(m_lineNumber); + oldchar = chbegin; + } + + return state; +} + +HTMLDocumentParser::State HTMLDocumentParser::parseText(SegmentedString& src, State state) +{ + while (!src.isEmpty()) { + UChar cc = *src; + + if (state.skipLF()) { + state.setSkipLF(false); + if (cc == '\n') { + src.advancePastNewline(m_lineNumber); + continue; + } + } + + // do we need to enlarge the buffer? + checkBuffer(); + + if (cc == '\r') { + state.setSkipLF(true); + *m_dest++ = '\n'; + } else + *m_dest++ = cc; + src.advance(m_lineNumber); + } + + return state; +} + + +HTMLDocumentParser::State HTMLDocumentParser::parseEntity(SegmentedString& src, UChar*& dest, State state, unsigned& cBufferPos, bool start, bool parsingTag) +{ + if (start) { + cBufferPos = 0; + state.setEntityState(SearchEntity); + EntityUnicodeValue = 0; + } + + while (!src.isEmpty()) { + UChar cc = *src; + switch (state.entityState()) { + case NoEntity: + ASSERT(state.entityState() != NoEntity); + return state; + + case SearchEntity: + if (cc == '#') { + m_cBuffer[cBufferPos++] = cc; + src.advancePastNonNewline(); + state.setEntityState(NumericSearch); + } else + state.setEntityState(EntityName); + break; + + case NumericSearch: + if (cc == 'x' || cc == 'X') { + m_cBuffer[cBufferPos++] = cc; + src.advancePastNonNewline(); + state.setEntityState(Hexadecimal); + } else if (cc >= '0' && cc <= '9') + state.setEntityState(Decimal); + else + state.setEntityState(SearchSemicolon); + break; + + case Hexadecimal: { + int ll = min(src.length(), 10 - cBufferPos); + while (ll--) { + cc = *src; + if (!((cc >= '0' && cc <= '9') || (cc >= 'a' && cc <= 'f') || (cc >= 'A' && cc <= 'F'))) { + state.setEntityState(SearchSemicolon); + break; + } + int digit; + if (cc < 'A') + digit = cc - '0'; + else + digit = (cc - 'A' + 10) & 0xF; // handle both upper and lower case without a branch + EntityUnicodeValue = EntityUnicodeValue * 16 + digit; + m_cBuffer[cBufferPos++] = cc; + src.advancePastNonNewline(); + } + if (cBufferPos == 10) + state.setEntityState(SearchSemicolon); + break; + } + case Decimal: + { + int ll = min(src.length(), 9-cBufferPos); + while (ll--) { + cc = *src; + + if (!(cc >= '0' && cc <= '9')) { + state.setEntityState(SearchSemicolon); + break; + } + + EntityUnicodeValue = EntityUnicodeValue * 10 + (cc - '0'); + m_cBuffer[cBufferPos++] = cc; + src.advancePastNonNewline(); + } + if (cBufferPos == 9) + state.setEntityState(SearchSemicolon); + break; + } + case EntityName: + { + int ll = min(src.length(), 9-cBufferPos); + while (ll--) { + cc = *src; + + if (!((cc >= 'a' && cc <= 'z') || (cc >= '0' && cc <= '9') || (cc >= 'A' && cc <= 'Z'))) { + state.setEntityState(SearchSemicolon); + break; + } + + m_cBuffer[cBufferPos++] = cc; + src.advancePastNonNewline(); + } + if (cBufferPos == 9) + state.setEntityState(SearchSemicolon); + if (state.entityState() == SearchSemicolon) { + if (cBufferPos > 1) { + // Since the maximum length of entity name is 9, + // so a single char array which is allocated on + // the stack, its length is 10, should be OK. + // Also if we have an illegal character, we treat it + // as illegal entity name. + unsigned testedEntityNameLen = 0; + char tmpEntityNameBuffer[10]; + + ASSERT(cBufferPos < 10); + for (; testedEntityNameLen < cBufferPos; ++testedEntityNameLen) { + if (m_cBuffer[testedEntityNameLen] > 0x7e) + break; + tmpEntityNameBuffer[testedEntityNameLen] = m_cBuffer[testedEntityNameLen]; + } + + const Entity *e; + + if (testedEntityNameLen == cBufferPos) + e = findEntity(tmpEntityNameBuffer, cBufferPos); + else + e = 0; + + if (e) + EntityUnicodeValue = e->code; + + // be IE compatible + if (parsingTag && EntityUnicodeValue > 255 && *src != ';') + EntityUnicodeValue = 0; + } + } + else + break; + } + case SearchSemicolon: + // Don't allow values that are more than 21 bits. + if (EntityUnicodeValue > 0 && EntityUnicodeValue <= 0x10FFFF) { + if (!inViewSourceMode()) { + if (*src == ';') + src.advancePastNonNewline(); + if (EntityUnicodeValue <= 0xFFFF) { + checkBuffer(); + src.push(fixUpChar(EntityUnicodeValue)); + } else { + // Convert to UTF-16, using surrogate code points. + checkBuffer(2); + src.push(U16_LEAD(EntityUnicodeValue)); + src.push(U16_TRAIL(EntityUnicodeValue)); + } + } else { + // FIXME: We should eventually colorize entities by sending them as a special token. + // 12 bytes required: up to 10 bytes in m_cBuffer plus the + // leading '&' and trailing ';' + checkBuffer(12); + *dest++ = '&'; + for (unsigned i = 0; i < cBufferPos; i++) + dest[i] = m_cBuffer[i]; + dest += cBufferPos; + if (*src == ';') { + *dest++ = ';'; + src.advancePastNonNewline(); + } + } + } else { + // 11 bytes required: up to 10 bytes in m_cBuffer plus the + // leading '&' + checkBuffer(11); + // ignore the sequence, add it to the buffer as plaintext + *dest++ = '&'; + for (unsigned i = 0; i < cBufferPos; i++) + dest[i] = m_cBuffer[i]; + dest += cBufferPos; + } + + state.setEntityState(NoEntity); + return state; + } + } + + return state; +} + +HTMLDocumentParser::State HTMLDocumentParser::parseDoctype(SegmentedString& src, State state) +{ + ASSERT(state.inDoctype()); + while (!src.isEmpty() && state.inDoctype()) { + UChar c = *src; + bool isWhitespace = c == '\r' || c == '\n' || c == '\t' || c == ' '; + switch (m_doctypeToken.state()) { + case DoctypeBegin: { + m_doctypeToken.setState(DoctypeBeforeName); + if (isWhitespace) { + src.advance(m_lineNumber); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } + break; + } + case DoctypeBeforeName: { + if (c == '>') { + // Malformed. Just exit. + src.advancePastNonNewline(); + state.setInDoctype(false); + if (inViewSourceMode()) + processDoctypeToken(); + } else if (isWhitespace) { + src.advance(m_lineNumber); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } else + m_doctypeToken.setState(DoctypeName); + break; + } + case DoctypeName: { + if (c == '>') { + // Valid doctype. Emit it. + src.advancePastNonNewline(); + state.setInDoctype(false); + processDoctypeToken(); + } else if (isWhitespace) { + m_doctypeSearchCount = 0; // Used now to scan for PUBLIC + m_doctypeSecondarySearchCount = 0; // Used now to scan for SYSTEM + m_doctypeToken.setState(DoctypeAfterName); + src.advance(m_lineNumber); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } else { + src.advancePastNonNewline(); + m_doctypeToken.m_name.append(c); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } + break; + } + case DoctypeAfterName: { + if (c == '>') { + // Valid doctype. Emit it. + src.advancePastNonNewline(); + state.setInDoctype(false); + processDoctypeToken(); + } else if (!isWhitespace) { + src.advancePastNonNewline(); + if (toASCIILower(c) == publicStart[m_doctypeSearchCount]) { + m_doctypeSearchCount++; + if (m_doctypeSearchCount == 6) + // Found 'PUBLIC' sequence + m_doctypeToken.setState(DoctypeBeforePublicID); + } else if (m_doctypeSearchCount > 0) { + m_doctypeSearchCount = 0; + m_doctypeToken.setState(DoctypeBogus); + } else if (toASCIILower(c) == systemStart[m_doctypeSecondarySearchCount]) { + m_doctypeSecondarySearchCount++; + if (m_doctypeSecondarySearchCount == 6) + // Found 'SYSTEM' sequence + m_doctypeToken.setState(DoctypeBeforeSystemID); + } else { + m_doctypeSecondarySearchCount = 0; + m_doctypeToken.setState(DoctypeBogus); + } + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } else { + src.advance(m_lineNumber); // Whitespace keeps us in the after name state. + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } + break; + } + case DoctypeBeforePublicID: { + if (c == '\"' || c == '\'') { + tquote = c == '\"' ? DoubleQuote : SingleQuote; + m_doctypeToken.setState(DoctypePublicID); + src.advancePastNonNewline(); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } else if (c == '>') { + // Considered bogus. Don't process the doctype. + src.advancePastNonNewline(); + state.setInDoctype(false); + if (inViewSourceMode()) + processDoctypeToken(); + } else if (isWhitespace) { + src.advance(m_lineNumber); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } else + m_doctypeToken.setState(DoctypeBogus); + break; + } + case DoctypePublicID: { + if ((c == '\"' && tquote == DoubleQuote) || (c == '\'' && tquote == SingleQuote)) { + src.advancePastNonNewline(); + m_doctypeToken.setState(DoctypeAfterPublicID); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } else if (c == '>') { + // Considered bogus. Don't process the doctype. + src.advancePastNonNewline(); + state.setInDoctype(false); + if (inViewSourceMode()) + processDoctypeToken(); + } else { + m_doctypeToken.m_publicID.append(c); + src.advance(m_lineNumber); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } + break; + } + case DoctypeAfterPublicID: + if (c == '\"' || c == '\'') { + tquote = c == '\"' ? DoubleQuote : SingleQuote; + m_doctypeToken.setState(DoctypeSystemID); + src.advancePastNonNewline(); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } else if (c == '>') { + // Valid doctype. Emit it now. + src.advancePastNonNewline(); + state.setInDoctype(false); + processDoctypeToken(); + } else if (isWhitespace) { + src.advance(m_lineNumber); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } else + m_doctypeToken.setState(DoctypeBogus); + break; + case DoctypeBeforeSystemID: + if (c == '\"' || c == '\'') { + tquote = c == '\"' ? DoubleQuote : SingleQuote; + m_doctypeToken.setState(DoctypeSystemID); + src.advancePastNonNewline(); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } else if (c == '>') { + // Considered bogus. Don't process the doctype. + src.advancePastNonNewline(); + state.setInDoctype(false); + } else if (isWhitespace) { + src.advance(m_lineNumber); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } else + m_doctypeToken.setState(DoctypeBogus); + break; + case DoctypeSystemID: + if ((c == '\"' && tquote == DoubleQuote) || (c == '\'' && tquote == SingleQuote)) { + src.advancePastNonNewline(); + m_doctypeToken.setState(DoctypeAfterSystemID); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } else if (c == '>') { + // Considered bogus. Don't process the doctype. + src.advancePastNonNewline(); + state.setInDoctype(false); + if (inViewSourceMode()) + processDoctypeToken(); + } else { + m_doctypeToken.m_systemID.append(c); + src.advance(m_lineNumber); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } + break; + case DoctypeAfterSystemID: + if (c == '>') { + // Valid doctype. Emit it now. + src.advancePastNonNewline(); + state.setInDoctype(false); + processDoctypeToken(); + } else if (isWhitespace) { + src.advance(m_lineNumber); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } else + m_doctypeToken.setState(DoctypeBogus); + break; + case DoctypeBogus: + if (c == '>') { + // Done with the bogus doctype. + src.advancePastNonNewline(); + state.setInDoctype(false); + if (inViewSourceMode()) + processDoctypeToken(); + } else { + src.advance(m_lineNumber); // Just keep scanning for '>' + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } + break; + default: + break; + } + } + return state; +} + +HTMLDocumentParser::State HTMLDocumentParser::parseTag(SegmentedString& src, State state) +{ + ASSERT(!state.hasEntityState()); + + unsigned cBufferPos = m_cBufferPos; + + bool lastIsSlash = false; + + while (!src.isEmpty()) { + checkBuffer(); + switch (state.tagState()) { + case NoTag: + { + m_cBufferPos = cBufferPos; + return state; + } + case TagName: + { + if (searchCount > 0) { + if (*src == commentStart[searchCount]) { + searchCount++; + if (searchCount == 2) + m_doctypeSearchCount++; // A '!' is also part of a doctype, so we are moving through that still as well. + else + m_doctypeSearchCount = 0; + if (searchCount == 4) { + // Found '<!--' sequence + src.advancePastNonNewline(); + m_dest = m_buffer; // ignore the previous part of this tag + state.setInComment(true); + state.setTagState(NoTag); + + // Fix bug 34302 at kde.bugs.org. Go ahead and treat + // <!--> as a valid comment, since both mozilla and IE on windows + // can handle this case. Only do this in quirks mode. -dwh + if (!src.isEmpty() && *src == '>' && m_doc->inCompatMode()) { + state.setInComment(false); + src.advancePastNonNewline(); + if (!src.isEmpty()) + m_cBuffer[cBufferPos++] = *src; + } else + state = parseComment(src, state); + + m_cBufferPos = cBufferPos; + return state; // Finished parsing tag! + } + m_cBuffer[cBufferPos++] = *src; + src.advancePastNonNewline(); + break; + } else + searchCount = 0; // Stop looking for '<!--' sequence + } + + if (m_doctypeSearchCount > 0) { + if (toASCIILower(*src) == doctypeStart[m_doctypeSearchCount]) { + m_doctypeSearchCount++; + m_cBuffer[cBufferPos++] = *src; + src.advancePastNonNewline(); + if (m_doctypeSearchCount == 9) { + // Found '<!DOCTYPE' sequence + state.setInDoctype(true); + state.setTagState(NoTag); + m_doctypeToken.reset(); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(m_cBuffer, cBufferPos); + state = parseDoctype(src, state); + m_cBufferPos = cBufferPos; + return state; + } + break; + } else + m_doctypeSearchCount = 0; // Stop looking for '<!DOCTYPE' sequence + } + + bool finish = false; + unsigned int ll = min(src.length(), CBUFLEN - cBufferPos); + while (ll--) { + UChar curchar = *src; + if (isASCIISpace(curchar) || curchar == '>' || curchar == '<') { + finish = true; + break; + } + + // tolower() shows up on profiles. This is faster! + if (curchar >= 'A' && curchar <= 'Z' && !inViewSourceMode()) + m_cBuffer[cBufferPos++] = curchar + ('a' - 'A'); + else + m_cBuffer[cBufferPos++] = curchar; + src.advancePastNonNewline(); + } + + // Disadvantage: we add the possible rest of the tag + // as attribute names. ### judge if this causes problems + if (finish || CBUFLEN == cBufferPos) { + bool beginTag; + UChar* ptr = m_cBuffer; + unsigned int len = cBufferPos; + m_cBuffer[cBufferPos] = '\0'; + if ((cBufferPos > 0) && (*ptr == '/')) { + // End Tag + beginTag = false; + ptr++; + len--; + } + else + // Start Tag + beginTag = true; + + // Ignore the / in fake xml tags like <br/>. We trim off the "/" so that we'll get "br" as the tag name and not "br/". + if (len > 1 && ptr[len-1] == '/' && !inViewSourceMode()) + ptr[--len] = '\0'; + + // Now that we've shaved off any invalid / that might have followed the name), make the tag. + // FIXME: FireFox and WinIE turn !foo nodes into comments, we ignore comments. (fast/parser/tag-with-exclamation-point.html) + if (ptr[0] != '!' || inViewSourceMode()) { + m_currentToken.tagName = AtomicString(ptr); + m_currentToken.beginTag = beginTag; + } + m_dest = m_buffer; + state.setTagState(SearchAttribute); + cBufferPos = 0; + } + break; + } + case SearchAttribute: + while (!src.isEmpty()) { + UChar curchar = *src; + // In this mode just ignore any quotes we encounter and treat them like spaces. + if (!isASCIISpace(curchar) && curchar != '\'' && curchar != '"') { + if (curchar == '<' || curchar == '>') + state.setTagState(SearchEnd); + else + state.setTagState(AttributeName); + + cBufferPos = 0; + break; + } + if (inViewSourceMode()) + m_currentToken.addViewSourceChar(curchar); + src.advance(m_lineNumber); + } + break; + case AttributeName: + { + m_rawAttributeBeforeValue.clear(); + int ll = min(src.length(), CBUFLEN - cBufferPos); + while (ll--) { + UChar curchar = *src; + // If we encounter a "/" when scanning an attribute name, treat it as a delimiter. This allows the + // cases like <input type=checkbox checked/> to work (and accommodates XML-style syntax as per HTML5). + if (curchar <= '>' && (curchar >= '<' || isASCIISpace(curchar) || curchar == '/')) { + m_cBuffer[cBufferPos] = '\0'; + m_attrName = AtomicString(m_cBuffer); + m_dest = m_buffer; + *m_dest++ = 0; + state.setTagState(SearchEqual); + if (inViewSourceMode()) + m_currentToken.addViewSourceChar('a'); + break; + } + + // tolower() shows up on profiles. This is faster! + if (curchar >= 'A' && curchar <= 'Z' && !inViewSourceMode()) + m_cBuffer[cBufferPos++] = curchar + ('a' - 'A'); + else + m_cBuffer[cBufferPos++] = curchar; + + m_rawAttributeBeforeValue.append(curchar); + src.advance(m_lineNumber); + } + if (cBufferPos == CBUFLEN) { + m_cBuffer[cBufferPos] = '\0'; + m_attrName = AtomicString(m_cBuffer); + m_dest = m_buffer; + *m_dest++ = 0; + state.setTagState(SearchEqual); + if (inViewSourceMode()) + m_currentToken.addViewSourceChar('a'); + } + break; + } + case SearchEqual: + while (!src.isEmpty()) { + UChar curchar = *src; + + if (lastIsSlash && curchar == '>') { + // This is a quirk (with a long sad history). We have to do this + // since widgets do <script src="foo.js"/> and expect the tag to close. + if (m_currentToken.tagName == scriptTag) + m_currentToken.selfClosingTag = true; + m_currentToken.brokenXMLStyle = true; + } + + // In this mode just ignore any quotes or slashes we encounter and treat them like spaces. + if (!isASCIISpace(curchar) && curchar != '\'' && curchar != '"' && curchar != '/') { + if (curchar == '=') { + state.setTagState(SearchValue); + if (inViewSourceMode()) + m_currentToken.addViewSourceChar(curchar); + m_rawAttributeBeforeValue.append(curchar); + src.advancePastNonNewline(); + } else { + m_currentToken.addAttribute(m_attrName, emptyAtom, inViewSourceMode()); + m_dest = m_buffer; + state.setTagState(SearchAttribute); + lastIsSlash = false; + } + break; + } + + lastIsSlash = curchar == '/'; + + if (inViewSourceMode()) + m_currentToken.addViewSourceChar(curchar); + m_rawAttributeBeforeValue.append(curchar); + src.advance(m_lineNumber); + } + break; + case SearchValue: + while (!src.isEmpty()) { + UChar curchar = *src; + if (!isASCIISpace(curchar)) { + if (curchar == '\'' || curchar == '\"') { + tquote = curchar == '\"' ? DoubleQuote : SingleQuote; + state.setTagState(QuotedValue); + if (inViewSourceMode()) + m_currentToken.addViewSourceChar(curchar); + m_rawAttributeBeforeValue.append(curchar); + src.advancePastNonNewline(); + } else + state.setTagState(Value); + + break; + } + if (inViewSourceMode()) + m_currentToken.addViewSourceChar(curchar); + m_rawAttributeBeforeValue.append(curchar); + src.advance(m_lineNumber); + } + break; + case QuotedValue: + while (!src.isEmpty()) { + checkBuffer(); + + UChar curchar = *src; + if (curchar <= '>' && !src.escaped()) { + if (curchar == '>' && m_attrName.isEmpty()) { + // Handle a case like <img '>. Just go ahead and be willing + // to close the whole tag. Don't consume the character and + // just go back into SearchEnd while ignoring the whole + // value. + // FIXME: Note that this is actually not a very good solution. + // It doesn't handle the general case of + // unmatched quotes among attributes that have names. -dwh + while (m_dest > m_buffer + 1 && (m_dest[-1] == '\n' || m_dest[-1] == '\r')) + m_dest--; // remove trailing newlines + AtomicString attributeValue(m_buffer + 1, m_dest - m_buffer - 1); + if (!attributeValue.contains('/')) + m_attrName = attributeValue; // Just make the name/value match. (FIXME: Is this some WinIE quirk?) + m_currentToken.addAttribute(m_attrName, attributeValue, inViewSourceMode()); + if (inViewSourceMode()) + m_currentToken.addViewSourceChar('x'); + state.setTagState(SearchAttribute); + m_dest = m_buffer; + tquote = NoQuote; + break; + } + + if (curchar == '&') { + src.advancePastNonNewline(); + state = parseEntity(src, m_dest, state, cBufferPos, true, true); + break; + } + + if ((tquote == SingleQuote && curchar == '\'') || (tquote == DoubleQuote && curchar == '\"')) { + // some <input type=hidden> rely on trailing spaces. argh + while (m_dest > m_buffer + 1 && (m_dest[-1] == '\n' || m_dest[-1] == '\r')) + m_dest--; // remove trailing newlines + AtomicString attributeValue(m_buffer + 1, m_dest - m_buffer - 1); + if (m_attrName.isEmpty() && !attributeValue.contains('/')) { + m_attrName = attributeValue; // Make the name match the value. (FIXME: Is this a WinIE quirk?) + if (inViewSourceMode()) + m_currentToken.addViewSourceChar('x'); + } else if (inViewSourceMode()) + m_currentToken.addViewSourceChar('v'); + + if (m_currentToken.beginTag && m_currentToken.tagName == scriptTag && !inViewSourceMode() && !m_treeConstructor->skipMode() && m_attrName == srcAttr) { + String context(m_rawAttributeBeforeValue.data(), m_rawAttributeBeforeValue.size()); + if (m_XSSAuditor && !m_XSSAuditor->canLoadExternalScriptFromSrc(attributeValue)) + attributeValue = blankURL().string(); + } + + m_currentToken.addAttribute(m_attrName, attributeValue, inViewSourceMode()); + m_dest = m_buffer; + state.setTagState(SearchAttribute); + tquote = NoQuote; + if (inViewSourceMode()) + m_currentToken.addViewSourceChar(curchar); + src.advancePastNonNewline(); + break; + } + } + + *m_dest++ = curchar; + src.advance(m_lineNumber); + } + break; + case Value: + while (!src.isEmpty()) { + checkBuffer(); + UChar curchar = *src; + if (curchar <= '>' && !src.escaped()) { + // parse Entities + if (curchar == '&') { + src.advancePastNonNewline(); + state = parseEntity(src, m_dest, state, cBufferPos, true, true); + break; + } + // no quotes. Every space means end of value + // '/' does not delimit in IE! + if (isASCIISpace(curchar) || curchar == '>') { + AtomicString attributeValue(m_buffer + 1, m_dest - m_buffer - 1); + + if (m_currentToken.beginTag && m_currentToken.tagName == scriptTag && !inViewSourceMode() && !m_treeConstructor->skipMode() && m_attrName == srcAttr) { + String context(m_rawAttributeBeforeValue.data(), m_rawAttributeBeforeValue.size()); + if (m_XSSAuditor && !m_XSSAuditor->canLoadExternalScriptFromSrc(attributeValue)) + attributeValue = blankURL().string(); + } + + m_currentToken.addAttribute(m_attrName, attributeValue, inViewSourceMode()); + if (inViewSourceMode()) + m_currentToken.addViewSourceChar('v'); + m_dest = m_buffer; + state.setTagState(SearchAttribute); + break; + } + } + + *m_dest++ = curchar; + src.advance(m_lineNumber); + } + break; + case SearchEnd: + { + while (!src.isEmpty()) { + UChar ch = *src; + if (ch == '>' || ch == '<') + break; + if (ch == '/') + m_currentToken.selfClosingTag = true; + if (inViewSourceMode()) + m_currentToken.addViewSourceChar(ch); + src.advance(m_lineNumber); + } + if (src.isEmpty()) + break; + + searchCount = 0; // Stop looking for '<!--' sequence + state.setTagState(NoTag); + tquote = NoQuote; + + if (*src != '<') + src.advance(m_lineNumber); + + if (m_currentToken.tagName == nullAtom) { //stop if tag is unknown + m_cBufferPos = cBufferPos; + return state; + } + + AtomicString tagName = m_currentToken.tagName; + + // Handle <script src="foo"/> like Mozilla/Opera. We have to do this now for Dashboard + // compatibility. + bool isSelfClosingScript = m_currentToken.selfClosingTag && m_currentToken.beginTag && m_currentToken.tagName == scriptTag; + bool beginTag = !m_currentToken.selfClosingTag && m_currentToken.beginTag; + if (m_currentToken.beginTag && m_currentToken.tagName == scriptTag && !inViewSourceMode() && !m_treeConstructor->skipMode()) { + Attribute* a = 0; + m_scriptTagSrcAttrValue = String(); + m_scriptTagCharsetAttrValue = String(); + if (m_currentToken.attrs && !m_fragment) { + if (m_doc->frame() && m_doc->frame()->script()->canExecuteScripts(NotAboutToExecuteScript)) { + if ((a = m_currentToken.attrs->getAttributeItem(srcAttr))) + m_scriptTagSrcAttrValue = m_doc->completeURL(deprecatedParseURL(a->value())).string(); + } + } + } + + RefPtr<Node> n = processToken(); + m_cBufferPos = cBufferPos; + if (n || inViewSourceMode()) { + State savedState = state; + SegmentedString savedSrc = src; + long savedLineno = m_lineNumber; + if ((tagName == preTag || tagName == listingTag) && !inViewSourceMode()) { + if (beginTag) + state.setDiscardLF(true); // Discard the first LF after we open a pre. + } else if (tagName == scriptTag) { + ASSERT(!m_scriptNode); + m_scriptNode = static_pointer_cast<HTMLScriptElement>(n); + if (m_scriptNode) + m_scriptTagCharsetAttrValue = m_scriptNode->scriptCharset(); + if (beginTag) { + m_searchStopper = scriptEnd; + m_searchStopperLength = 8; + state.setInScript(true); + state = parseNonHTMLText(src, state); + } else if (isSelfClosingScript) { // Handle <script src="foo"/> + state.setInScript(true); + state = scriptHandler(state); + } + } else if (tagName == styleTag) { + if (beginTag) { + m_searchStopper = styleEnd; + m_searchStopperLength = 7; + state.setInStyle(true); + state = parseNonHTMLText(src, state); + } + } else if (tagName == textareaTag) { + if (beginTag) { + m_searchStopper = textareaEnd; + m_searchStopperLength = 10; + state.setInTextArea(true); + state = parseNonHTMLText(src, state); + } + } else if (tagName == titleTag) { + if (beginTag) { + m_searchStopper = titleEnd; + m_searchStopperLength = 7; + state.setInTitle(true); + state = parseNonHTMLText(src, state); + } + } else if (tagName == xmpTag) { + if (beginTag) { + m_searchStopper = xmpEnd; + m_searchStopperLength = 5; + state.setInXmp(true); + state = parseNonHTMLText(src, state); + } + } else if (tagName == iframeTag) { + if (beginTag) { + m_searchStopper = iframeEnd; + m_searchStopperLength = 8; + state.setInIFrame(true); + state = parseNonHTMLText(src, state); + } + } + if (src.isEmpty() && (state.inTitle() || inViewSourceMode()) && !state.inComment() && !(state.inScript() && m_currentScriptTagStartLineNumber)) { + // We just ate the rest of the document as the #text node under the special tag! + // Reset the state then retokenize without special handling. + // Let the parser clean up the missing close tag. + // FIXME: This is incorrect, because src.isEmpty() doesn't mean we're + // at the end of the document unless m_noMoreData is also true. We need + // to detect this case elsewhere, and save the state somewhere other + // than a local variable. + state = savedState; + src = savedSrc; + m_lineNumber = savedLineno; + m_scriptCodeSize = 0; + } + } + if (tagName == plaintextTag) + state.setInPlainText(beginTag); + return state; // Finished parsing tag! + } + } // end switch + } + m_cBufferPos = cBufferPos; + return state; +} + +inline bool HTMLDocumentParser::continueProcessing(int& processedCount, double startTime, State &state) +{ + // We don't want to be checking elapsed time with every character, so we only check after we've + // processed a certain number of characters. + bool allowedYield = state.allowYield(); + state.setAllowYield(false); + if (!state.loadingExtScript() && !state.forceSynchronous() && !m_executingScript && (processedCount > m_tokenizerChunkSize || allowedYield)) { + processedCount = 0; + if (currentTime() - startTime > m_tokenizerTimeDelay) { + /* FIXME: We'd like to yield aggressively to give stylesheets the opportunity to + load, but this hurts overall performance on slower machines. For now turn this + off. + || (!m_doc->haveStylesheetsLoaded() && + (m_doc->documentElement()->id() != ID_HTML || m_doc->body()))) {*/ + // Schedule the timer to keep processing as soon as possible. + m_timer.startOneShot(0); + return false; + } + } + + processedCount++; + return true; +} + +// Turns the statemachine one crank using the passed in State object. +// This does not modify m_state directly in order to be reentrant. +ALWAYS_INLINE void HTMLDocumentParser::advance(State& state) +{ + // do we need to enlarge the buffer? + checkBuffer(); + + UChar cc = *m_src; + + bool wasSkipLF = state.skipLF(); + if (wasSkipLF) + state.setSkipLF(false); + + if (wasSkipLF && (cc == '\n')) + m_src.advance(); + else if (state.needsSpecialWriteHandling()) { + // it's important to keep needsSpecialWriteHandling with the flags this block tests + if (state.hasEntityState()) + state = parseEntity(m_src, m_dest, state, m_cBufferPos, false, state.hasTagState()); + else if (state.inPlainText()) + state = parseText(m_src, state); + else if (state.inAnyNonHTMLText()) + state = parseNonHTMLText(m_src, state); + else if (state.inComment()) + state = parseComment(m_src, state); + else if (state.inDoctype()) + state = parseDoctype(m_src, state); + else if (state.inServer()) + state = parseServer(m_src, state); + else if (state.inProcessingInstruction()) + state = parseProcessingInstruction(m_src, state); + else if (state.hasTagState()) + state = parseTag(m_src, state); + else if (state.startTag()) { + state.setStartTag(false); + + switch (cc) { + case '/': + break; + case '!': { + // <!-- comment --> or <!DOCTYPE ...> + searchCount = 1; // Look for '<!--' sequence to start comment or '<!DOCTYPE' sequence to start doctype + m_doctypeSearchCount = 1; + break; + } + case '?': { + // xml processing instruction + state.setInProcessingInstruction(true); + tquote = NoQuote; + state = parseProcessingInstruction(m_src, state); + return; + } + case '%': + if (!m_brokenServer) { + // <% server stuff, handle as comment %> + state.setInServer(true); + tquote = NoQuote; + state = parseServer(m_src, state); + return; + } + // else fall through + default: { + if (((cc >= 'a') && (cc <= 'z')) || ((cc >= 'A') && (cc <= 'Z'))) { + // Start of a Start-Tag + } else { + // Invalid tag + // Add as is + *m_dest = '<'; + m_dest++; + return; + } + } + }; // end case + + processToken(); + + m_cBufferPos = 0; + state.setTagState(TagName); + state = parseTag(m_src, state); + } + } else if (cc == '&' && !m_src.escaped()) { + m_src.advancePastNonNewline(); + state = parseEntity(m_src, m_dest, state, m_cBufferPos, true, state.hasTagState()); + } else if (cc == '<' && !m_src.escaped()) { + m_currentTagStartLineNumber = m_lineNumber; + m_src.advancePastNonNewline(); + state.setStartTag(true); + state.setDiscardLF(false); + } else if (cc == '\n' || cc == '\r') { + if (state.discardLF()) + // Ignore this LF + state.setDiscardLF(false); // We have discarded 1 LF + else { + // Process this LF + *m_dest++ = '\n'; + if (cc == '\r' && !m_src.excludeLineNumbers()) + m_lineNumber++; + } + + /* Check for MS-DOS CRLF sequence */ + if (cc == '\r') + state.setSkipLF(true); + m_src.advance(m_lineNumber); + } else { + state.setDiscardLF(false); + *m_dest++ = cc; + m_src.advancePastNonNewline(); + } +} + +void HTMLDocumentParser::willWriteHTML(const SegmentedString& source) +{ + #if ENABLE(INSPECTOR) + if (InspectorTimelineAgent* timelineAgent = m_doc->inspectorTimelineAgent()) + timelineAgent->willWriteHTML(source.length(), m_lineNumber); + #endif +} + +void HTMLDocumentParser::didWriteHTML() +{ + #if ENABLE(INSPECTOR) + if (InspectorTimelineAgent* timelineAgent = m_doc->inspectorTimelineAgent()) + timelineAgent->didWriteHTML(m_lineNumber); + #endif +} + +void HTMLDocumentParser::write(const SegmentedString& str, bool appendData) +{ + if (!m_buffer) + return; + + if (m_parserStopped) + return; + + SegmentedString source(str); + if (m_executingScript) + source.setExcludeLineNumbers(); + + if ((m_executingScript && appendData) || !m_pendingScripts.isEmpty()) { + // don't parse; we will do this later + if (m_currentPrependingSrc) + m_currentPrependingSrc->append(source); + else { + m_pendingSrc.append(source); +#if PRELOAD_SCANNER_ENABLED + if (m_preloadScanner && m_preloadScanner->inProgress() && appendData) + m_preloadScanner->write(source); +#endif + } + return; + } + +#if PRELOAD_SCANNER_ENABLED + if (m_preloadScanner && m_preloadScanner->inProgress() && appendData) + m_preloadScanner->end(); +#endif + + if (!m_src.isEmpty()) + m_src.append(source); + else + setSrc(source); + + // Once a timer is set, it has control of when the parser continues. + if (m_timer.isActive()) + return; + + bool wasInWrite = m_inWrite; + m_inWrite = true; + +#ifdef ANDROID_INSTRUMENT + android::TimeCounter::start(android::TimeCounter::ParsingTimeCounter); +#endif + + willWriteHTML(source); + + Frame* frame = m_doc->frame(); + State state = m_state; + int processedCount = 0; + double startTime = currentTime(); + + while (!m_src.isEmpty() && (!frame || !frame->redirectScheduler()->locationChangePending())) { + if (!continueProcessing(processedCount, startTime, state)) + break; + advance(state); + } + + didWriteHTML(); + + m_inWrite = wasInWrite; + m_state = state; + +#ifdef ANDROID_INSTRUMENT + android::TimeCounter::record(android::TimeCounter::ParsingTimeCounter, __FUNCTION__); +#endif + + if (m_noMoreData && !m_inWrite && !state.loadingExtScript() && !m_executingScript && !m_timer.isActive()) + end(); // this actually causes us to be deleted + + // After parsing, go ahead and dispatch image beforeload events. + ImageLoader::dispatchPendingBeforeLoadEvents(); +} + +void HTMLDocumentParser::stopParsing() +{ + DocumentParser::stopParsing(); + m_timer.stop(); + + // FIXME: Why is HTMLDocumentParser the only DocumentParser which calls checkCompleted? + // The FrameLoader needs to know that the parser has finished with its data, + // regardless of whether it happened naturally or due to manual intervention. + if (!m_fragment && m_doc->frame()) + m_doc->frame()->loader()->checkCompleted(); +} + +bool HTMLDocumentParser::processingData() const +{ + return m_timer.isActive() || m_inWrite; +} + +void HTMLDocumentParser::timerFired(Timer<HTMLDocumentParser>*) +{ + if (m_doc->view() && m_doc->view()->layoutPending() && !m_doc->minimumLayoutDelay()) { + // Restart the timer and let layout win. This is basically a way of ensuring that the layout + // timer has higher priority than our timer. + m_timer.startOneShot(0); + return; + } + + // Invoke write() as though more data came in. This might cause us to get deleted. + write(SegmentedString(), true); +} + +void HTMLDocumentParser::end() +{ + ASSERT(!m_timer.isActive()); + m_timer.stop(); // Only helps if assertion above fires, but do it anyway. + + if (m_buffer) { + // parseTag is using the buffer for different matters + if (!m_state.hasTagState()) + processToken(); + + fastFree(m_scriptCode); + m_scriptCode = 0; + m_scriptCodeSize = m_scriptCodeCapacity = m_scriptCodeResync = 0; + + fastFree(m_buffer); + m_buffer = 0; + } + + if (!inViewSourceMode()) + m_treeConstructor->finished(); + else + m_doc->finishedParsing(); +} + +void HTMLDocumentParser::finish() +{ + // do this as long as we don't find matching comment ends + while ((m_state.inComment() || m_state.inServer()) && m_scriptCode && m_scriptCodeSize) { + // we've found an unmatched comment start + if (m_state.inComment()) + m_brokenComments = true; + else + m_brokenServer = true; + checkScriptBuffer(); + m_scriptCode[m_scriptCodeSize] = 0; + m_scriptCode[m_scriptCodeSize + 1] = 0; + int pos; + String food; + if (m_state.inScript() || m_state.inStyle() || m_state.inTextArea()) + food = String(m_scriptCode, m_scriptCodeSize); + else if (m_state.inServer()) { + food = "<"; + food.append(m_scriptCode, m_scriptCodeSize); + } else { + pos = find(m_scriptCode, m_scriptCodeSize, '>'); + food = String(m_scriptCode + pos + 1, m_scriptCodeSize - pos - 1); + } + fastFree(m_scriptCode); + m_scriptCode = 0; + m_scriptCodeSize = m_scriptCodeCapacity = m_scriptCodeResync = 0; + m_state.setInComment(false); + m_state.setInServer(false); + if (!food.isEmpty()) + write(food, true); + } + // this indicates we will not receive any more data... but if we are waiting on + // an external script to load, we can't finish parsing until that is done + m_noMoreData = true; + if (!m_inWrite && !m_state.loadingExtScript() && !m_executingScript && !m_timer.isActive()) + end(); // this actually causes us to be deleted +} + +PassRefPtr<Node> HTMLDocumentParser::processToken() +{ + ScriptController* scriptController = (!m_fragment && m_doc->frame()) ? m_doc->frame()->script() : 0; + if (scriptController && scriptController->canExecuteScripts(NotAboutToExecuteScript)) + // FIXME: Why isn't this m_currentScriptTagStartLineNumber? I suspect this is wrong. + scriptController->setEventHandlerLineNumber(m_currentTagStartLineNumber + 1); // Script line numbers are 1 based. + if (m_dest > m_buffer) { + m_currentToken.text = StringImpl::createStrippingNullCharacters(m_buffer, m_dest - m_buffer); + if (m_currentToken.tagName != commentAtom) + m_currentToken.tagName = textAtom; + } else if (m_currentToken.tagName == nullAtom) { + m_currentToken.reset(); + if (scriptController) + scriptController->setEventHandlerLineNumber(m_lineNumber + 1); // Script line numbers are 1 based. + return 0; + } + + m_dest = m_buffer; + + RefPtr<Node> n; + + if (!m_parserStopped) { + if (NamedNodeMap* map = m_currentToken.attrs.get()) + map->shrinkToLength(); + if (inViewSourceMode()) + static_cast<HTMLViewSourceDocument*>(m_doc)->addViewSourceToken(&m_currentToken); + else + // pass the token over to the parser, the parser DOES NOT delete the token + n = m_treeConstructor->parseToken(&m_currentToken); + } + m_currentToken.reset(); + if (scriptController) + scriptController->setEventHandlerLineNumber(0); + + return n.release(); +} + +void HTMLDocumentParser::processDoctypeToken() +{ + if (inViewSourceMode()) + static_cast<HTMLViewSourceDocument*>(m_doc)->addViewSourceDoctypeToken(&m_doctypeToken); + else + m_treeConstructor->parseDoctypeToken(&m_doctypeToken); +} + +HTMLDocumentParser::~HTMLDocumentParser() +{ + ASSERT(!m_inWrite); + reset(); +} + + +void HTMLDocumentParser::enlargeBuffer(int len) +{ + // Resize policy: Always at least double the size of the buffer each time. + int delta = max(len, m_bufferSize); + + // Check for overflow. + // For now, handle overflow the same way we handle fastRealloc failure, with CRASH. + static const int maxSize = INT_MAX / sizeof(UChar); + if (delta > maxSize - m_bufferSize) + CRASH(); + + int newSize = m_bufferSize + delta; + int oldOffset = m_dest - m_buffer; + m_buffer = static_cast<UChar*>(fastRealloc(m_buffer, newSize * sizeof(UChar))); + m_dest = m_buffer + oldOffset; + m_bufferSize = newSize; +} + +void HTMLDocumentParser::enlargeScriptBuffer(int len) +{ + // Resize policy: Always at least double the size of the buffer each time. + int delta = max(len, m_scriptCodeCapacity); + + // Check for overflow. + // For now, handle overflow the same way we handle fastRealloc failure, with CRASH. + static const int maxSize = INT_MAX / sizeof(UChar); + if (delta > maxSize - m_scriptCodeCapacity) + CRASH(); + + int newSize = m_scriptCodeCapacity + delta; + // If we allow fastRealloc(ptr, 0), it will call CRASH(). We run into this + // case if the HTML being parsed begins with "<!--" and there's more data + // coming. + if (!newSize) { + ASSERT(!m_scriptCode); + return; + } + + m_scriptCode = static_cast<UChar*>(fastRealloc(m_scriptCode, newSize * sizeof(UChar))); + m_scriptCodeCapacity = newSize; +} + +void HTMLDocumentParser::executeScriptsWaitingForStylesheets() +{ + ASSERT(m_doc->haveStylesheetsLoaded()); + + if (m_hasScriptsWaitingForStylesheets) + notifyFinished(0); +} + +void HTMLDocumentParser::notifyFinished(CachedResource*) +{ + executeExternalScriptsIfReady(); +} + +void HTMLDocumentParser::executeExternalScriptsIfReady() +{ + ASSERT(!m_pendingScripts.isEmpty()); + + // Make external scripts wait for external stylesheets. + // FIXME: This needs to be done for inline scripts too. + m_hasScriptsWaitingForStylesheets = !m_doc->haveStylesheetsLoaded(); + if (m_hasScriptsWaitingForStylesheets) + return; + + bool finished = false; + + double startTime = currentTime(); + while (!finished && m_pendingScripts.first()->isLoaded()) { + if (!continueExecutingExternalScripts(startTime)) + break; + + CachedScript* cs = m_pendingScripts.takeFirst().get(); + ASSERT(cache()->disabled() || cs->accessCount() > 0); + + setSrc(SegmentedString()); + + // make sure we forget about the script before we execute the new one + // infinite recursion might happen otherwise + ScriptSourceCode sourceCode(cs); + bool errorOccurred = cs->errorOccurred(); + cs->removeClient(this); + + RefPtr<Node> n = m_scriptNode.release(); + + if (errorOccurred) + n->dispatchEvent(Event::create(eventNames().errorEvent, true, false)); + else { + if (static_cast<HTMLScriptElement*>(n.get())->shouldExecuteAsJavaScript()) + m_state = scriptExecution(sourceCode, m_state); +#if ENABLE(XHTMLMP) + else + m_doc->setShouldProcessNoscriptElement(true); +#endif + n->dispatchEvent(Event::create(eventNames().loadEvent, false, false)); + } + + // The state of m_pendingScripts.isEmpty() can change inside the scriptExecution() + // call above, so test afterwards. + finished = m_pendingScripts.isEmpty(); + if (finished) { + ASSERT(!m_hasScriptsWaitingForStylesheets); + m_state.setLoadingExtScript(false); + } else if (m_hasScriptsWaitingForStylesheets) { + // m_hasScriptsWaitingForStylesheets flag might have changed during the script execution. + // If it did we are now blocked waiting for stylesheets and should not execute more scripts until they arrive. + finished = true; + } + + // 'm_requestingScript' is true when we are called synchronously from + // scriptHandler(). In that case scriptHandler() will take care + // of m_pendingSrc. + if (!m_requestingScript) { + SegmentedString rest = m_pendingSrc; + m_pendingSrc.clear(); + write(rest, false); + // we might be deleted at this point, do not access any members. + } + } +} + +void HTMLDocumentParser::executeExternalScriptsTimerFired(Timer<HTMLDocumentParser>*) +{ + if (m_doc->view() && m_doc->view()->layoutPending() && !m_doc->minimumLayoutDelay()) { + // Restart the timer and do layout first. + m_externalScriptsTimer.startOneShot(0); + return; + } + + // Continue executing external scripts. + executeExternalScriptsIfReady(); +} + +bool HTMLDocumentParser::continueExecutingExternalScripts(double startTime) +{ + if (m_externalScriptsTimer.isActive()) + return false; + + if (currentTime() - startTime > m_tokenizerTimeDelay) { + // Schedule the timer to keep processing as soon as possible. + m_externalScriptsTimer.startOneShot(0); + return false; + } + return true; +} + +bool HTMLDocumentParser::isWaitingForScripts() const +{ + return m_state.loadingExtScript(); +} + +void HTMLDocumentParser::setSrc(const SegmentedString& source) +{ + m_src = source; +} + +void parseHTMLDocumentFragment(const String& source, DocumentFragment* fragment, FragmentScriptingPermission scriptingPermission) +{ + HTMLDocumentParser parser(fragment, scriptingPermission); + parser.setForceSynchronous(true); + parser.write(source, true); + parser.finish(); + ASSERT(!parser.processingData()); // make sure we're done (see 3963151) +} + +UChar decodeNamedEntity(const char* name) +{ + const Entity* e = findEntity(name, strlen(name)); + return e ? e->code : 0; +} + +} diff --git a/WebCore/html/HTMLDocumentParser.h b/WebCore/html/HTMLDocumentParser.h new file mode 100644 index 0000000..6072a7e --- /dev/null +++ b/WebCore/html/HTMLDocumentParser.h @@ -0,0 +1,448 @@ +/* + Copyright (C) 1997 Martin Jones (mjones@kde.org) + (C) 1997 Torben Weis (weis@kde.org) + (C) 1998 Waldo Bastian (bastian@kde.org) + (C) 2001 Dirk Mueller (mueller@kde.org) + Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + 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 HTMLTokenizer_h +#define HTMLTokenizer_h + +#include "CachedResourceClient.h" +#include "CachedResourceHandle.h" +#include "MappedAttributeEntry.h" +#include "NamedNodeMap.h" +#include "SegmentedString.h" +#include "Timer.h" +#include "DocumentParser.h" +#include <wtf/Deque.h> +#include <wtf/OwnPtr.h> +#include <wtf/Vector.h> + +namespace WebCore { + +class CachedScript; +class DocumentFragment; +class Document; +class HTMLDocument; +class HTMLScriptElement; +class HTMLViewSourceDocument; +class FrameView; +class LegacyHTMLTreeConstructor; +class Node; +class PreloadScanner; +class ScriptSourceCode; + +/** + * @internal + * represents one HTML tag. Consists of a numerical id, and the list + * of attributes. Can also represent text. In this case the id = 0 and + * text contains the text. + */ +struct Token { + Token() + : beginTag(true) + , selfClosingTag(false) + , brokenXMLStyle(false) + , m_sourceInfo(0) + { } + ~Token() { } + + void addAttribute(AtomicString& attrName, const AtomicString& v, bool viewSourceMode); + + bool isOpenTag(const QualifiedName& fullName) const { return beginTag && fullName.localName() == tagName; } + bool isCloseTag(const QualifiedName& fullName) const { return !beginTag && fullName.localName() == tagName; } + + void reset() + { + attrs = 0; + text = 0; + tagName = nullAtom; + beginTag = true; + selfClosingTag = false; + brokenXMLStyle = false; + if (m_sourceInfo) + m_sourceInfo->clear(); + } + + void addViewSourceChar(UChar c) { if (!m_sourceInfo.get()) m_sourceInfo.set(new Vector<UChar>); m_sourceInfo->append(c); } + + RefPtr<NamedNodeMap> attrs; + RefPtr<StringImpl> text; + AtomicString tagName; + bool beginTag; + bool selfClosingTag; + bool brokenXMLStyle; + OwnPtr<Vector<UChar> > m_sourceInfo; +}; + +enum DoctypeState { + DoctypeBegin, + DoctypeBeforeName, + DoctypeName, + DoctypeAfterName, + DoctypeBeforePublicID, + DoctypePublicID, + DoctypeAfterPublicID, + DoctypeBeforeSystemID, + DoctypeSystemID, + DoctypeAfterSystemID, + DoctypeBogus +}; + +class DoctypeToken { +public: + DoctypeToken() {} + + void reset() + { + m_name.clear(); + m_publicID.clear(); + m_systemID.clear(); + m_state = DoctypeBegin; + m_source.clear(); + m_forceQuirks = false; + } + + DoctypeState state() { return m_state; } + void setState(DoctypeState s) { m_state = s; } + + Vector<UChar> m_name; + Vector<UChar> m_publicID; + Vector<UChar> m_systemID; + DoctypeState m_state; + + Vector<UChar> m_source; + + bool m_forceQuirks; // Used by the HTML5 parser. +}; + +//----------------------------------------------------------------------------- + +// FIXME: This class does too much. Right now it is both an HTML lexer as well +// as handling all of the non-lexer-specific junk related to tokenizing HTML +// (like dealing with <script> tags). The HTML lexer bits should be pushed +// down into a separate HTML lexer class. + +class HTMLDocumentParser : public DocumentParser, public CachedResourceClient { +public: + HTMLDocumentParser(HTMLDocument*, bool reportErrors); + HTMLDocumentParser(HTMLViewSourceDocument*); + HTMLDocumentParser(DocumentFragment*, FragmentScriptingPermission = FragmentScriptingAllowed); + virtual ~HTMLDocumentParser(); + + virtual void write(const SegmentedString&, bool appendData); + virtual void finish(); + virtual bool forceSynchronous() const { return m_state.forceSynchronous(); } + virtual void setForceSynchronous(bool force); + virtual bool isWaitingForScripts() const; + virtual void stopParsing(); + virtual bool processingData() const; + virtual int executingScript() const { return m_executingScript; } + + virtual int lineNumber() const { return m_lineNumber; } + virtual int columnNumber() const { return 1; } + + bool processingContentWrittenByScript() const { return m_src.excludeLineNumbers(); } + + virtual void executeScriptsWaitingForStylesheets(); + + virtual LegacyHTMLTreeConstructor* htmlTreeConstructor() const { return m_treeConstructor.get(); } + virtual HTMLDocumentParser* asHTMLDocumentParser() { return this; } + +private: + class State; + + // Where we are in parsing a tag + void begin(); + void end(); + + void reset(); + + void willWriteHTML(const SegmentedString&); + ALWAYS_INLINE void advance(State&); + void didWriteHTML(); + + PassRefPtr<Node> processToken(); + void processDoctypeToken(); + + State processListing(SegmentedString, State); + State parseComment(SegmentedString&, State); + State parseDoctype(SegmentedString&, State); + State parseServer(SegmentedString&, State); + State parseText(SegmentedString&, State); + State parseNonHTMLText(SegmentedString&, State); + State parseTag(SegmentedString&, State); + State parseEntity(SegmentedString&, UChar*& dest, State, unsigned& cBufferPos, bool start, bool parsingTag); + State parseProcessingInstruction(SegmentedString&, State); + State scriptHandler(State); + State scriptExecution(const ScriptSourceCode&, State); + void setSrc(const SegmentedString&); + + // check if we have enough space in the buffer. + // if not enlarge it + inline void checkBuffer(int len = 10) + { + if ((m_dest - m_buffer) > m_bufferSize - len) + enlargeBuffer(len); + } + + inline void checkScriptBuffer(int len = 10) + { + if (m_scriptCodeSize + len >= m_scriptCodeCapacity) + enlargeScriptBuffer(len); + } + + void enlargeBuffer(int len); + void enlargeScriptBuffer(int len); + + bool continueProcessing(int& processedCount, double startTime, State&); + void timerFired(Timer<HTMLDocumentParser>*); + void allDataProcessed(); + + // from CachedResourceClient + void notifyFinished(CachedResource*); + + void executeExternalScriptsIfReady(); + void executeExternalScriptsTimerFired(Timer<HTMLDocumentParser>*); + bool continueExecutingExternalScripts(double startTime); + + // Internal buffers + /////////////////// + UChar* m_buffer; + int m_bufferSize; + UChar* m_dest; + + Token m_currentToken; + + // This buffer holds the raw characters we've seen between the beginning of + // the attribute name and the first character of the attribute value. + Vector<UChar, 32> m_rawAttributeBeforeValue; + + // DocumentParser flags + ////////////////// + // are we in quotes within a html tag + enum { NoQuote, SingleQuote, DoubleQuote } tquote; + + // Are we in a &... character entity description? + enum EntityState { + NoEntity = 0, + SearchEntity = 1, + NumericSearch = 2, + Hexadecimal = 3, + Decimal = 4, + EntityName = 5, + SearchSemicolon = 6 + }; + unsigned EntityUnicodeValue; + + enum TagState { + NoTag = 0, + TagName = 1, + SearchAttribute = 2, + AttributeName = 3, + SearchEqual = 4, + SearchValue = 5, + QuotedValue = 6, + Value = 7, + SearchEnd = 8 + }; + + class State { + public: + State() : m_bits(0) { } + + TagState tagState() const { return static_cast<TagState>(m_bits & TagMask); } + void setTagState(TagState t) { m_bits = (m_bits & ~TagMask) | t; } + EntityState entityState() const { return static_cast<EntityState>((m_bits & EntityMask) >> EntityShift); } + void setEntityState(EntityState e) { m_bits = (m_bits & ~EntityMask) | (e << EntityShift); } + + bool inScript() const { return testBit(InScript); } + void setInScript(bool v) { setBit(InScript, v); } + bool inStyle() const { return testBit(InStyle); } + void setInStyle(bool v) { setBit(InStyle, v); } + bool inXmp() const { return testBit(InXmp); } + void setInXmp(bool v) { setBit(InXmp, v); } + bool inTitle() const { return testBit(InTitle); } + void setInTitle(bool v) { setBit(InTitle, v); } + bool inIFrame() const { return testBit(InIFrame); } + void setInIFrame(bool v) { setBit(InIFrame, v); } + bool inPlainText() const { return testBit(InPlainText); } + void setInPlainText(bool v) { setBit(InPlainText, v); } + bool inProcessingInstruction() const { return testBit(InProcessingInstruction); } + void setInProcessingInstruction(bool v) { return setBit(InProcessingInstruction, v); } + bool inComment() const { return testBit(InComment); } + void setInComment(bool v) { setBit(InComment, v); } + bool inDoctype() const { return testBit(InDoctype); } + void setInDoctype(bool v) { setBit(InDoctype, v); } + bool inTextArea() const { return testBit(InTextArea); } + void setInTextArea(bool v) { setBit(InTextArea, v); } + bool escaped() const { return testBit(Escaped); } + void setEscaped(bool v) { setBit(Escaped, v); } + bool inServer() const { return testBit(InServer); } + void setInServer(bool v) { setBit(InServer, v); } + bool skipLF() const { return testBit(SkipLF); } + void setSkipLF(bool v) { setBit(SkipLF, v); } + bool startTag() const { return testBit(StartTag); } + void setStartTag(bool v) { setBit(StartTag, v); } + bool discardLF() const { return testBit(DiscardLF); } + void setDiscardLF(bool v) { setBit(DiscardLF, v); } + bool allowYield() const { return testBit(AllowYield); } + void setAllowYield(bool v) { setBit(AllowYield, v); } + bool loadingExtScript() const { return testBit(LoadingExtScript); } + void setLoadingExtScript(bool v) { setBit(LoadingExtScript, v); } + bool forceSynchronous() const { return testBit(ForceSynchronous); } + void setForceSynchronous(bool v) { setBit(ForceSynchronous, v); } + + bool inAnyNonHTMLText() const { return m_bits & (InScript | InStyle | InXmp | InTextArea | InTitle | InIFrame); } + bool hasTagState() const { return m_bits & TagMask; } + bool hasEntityState() const { return m_bits & EntityMask; } + + bool needsSpecialWriteHandling() const { return m_bits & (InScript | InStyle | InXmp | InTextArea | InTitle | InIFrame | TagMask | EntityMask | InPlainText | InComment | InDoctype | InServer | InProcessingInstruction | StartTag); } + + private: + static const int EntityShift = 4; + enum StateBits { + TagMask = (1 << 4) - 1, + EntityMask = (1 << 7) - (1 << 4), + InScript = 1 << 7, + InStyle = 1 << 8, + // Bit 9 unused + InXmp = 1 << 10, + InTitle = 1 << 11, + InPlainText = 1 << 12, + InProcessingInstruction = 1 << 13, + InComment = 1 << 14, + InTextArea = 1 << 15, + Escaped = 1 << 16, + InServer = 1 << 17, + SkipLF = 1 << 18, + StartTag = 1 << 19, + DiscardLF = 1 << 20, // FIXME: should clarify difference between skip and discard + AllowYield = 1 << 21, + LoadingExtScript = 1 << 22, + ForceSynchronous = 1 << 23, + InIFrame = 1 << 24, + InDoctype = 1 << 25 + }; + + void setBit(StateBits bit, bool value) + { + if (value) + m_bits |= bit; + else + m_bits &= ~bit; + } + bool testBit(StateBits bit) const { return m_bits & bit; } + + unsigned m_bits; + }; + + State m_state; + + DoctypeToken m_doctypeToken; + int m_doctypeSearchCount; + int m_doctypeSecondarySearchCount; + + bool m_brokenServer; + + // Name of an attribute that we just scanned. + AtomicString m_attrName; + + // Used to store the code of a scripting sequence + UChar* m_scriptCode; + // Size of the script sequenze stored in @ref #scriptCode + int m_scriptCodeSize; + // Maximal size that can be stored in @ref #scriptCode + int m_scriptCodeCapacity; + // resync point of script code size + int m_scriptCodeResync; + + // Stores characters if we are scanning for a string like "</script>" + UChar searchBuffer[10]; + + // Counts where we are in the string we are scanning for + int searchCount; + // the stopper string + const char* m_searchStopper; + int m_searchStopperLength; + + // if no more data is coming, just parse what we have (including ext scripts that + // may be still downloading) and finish + bool m_noMoreData; + // URL to get source code of script from + String m_scriptTagSrcAttrValue; + String m_scriptTagCharsetAttrValue; + // the HTML code we will parse after the external script we are waiting for has loaded + SegmentedString m_pendingSrc; + + // the HTML code we will parse after this particular script has + // loaded, but before all pending HTML + SegmentedString* m_currentPrependingSrc; + + // true if we are executing a script while parsing a document. This causes the parsing of + // the output of the script to be postponed until after the script has finished executing + int m_executingScript; + Deque<CachedResourceHandle<CachedScript> > m_pendingScripts; + RefPtr<HTMLScriptElement> m_scriptNode; + + bool m_requestingScript; + bool m_hasScriptsWaitingForStylesheets; + + // if we found one broken comment, there are most likely others as well + // store a flag to get rid of the O(n^2) behaviour in such a case. + bool m_brokenComments; + // current line number + int m_lineNumber; + int m_currentScriptTagStartLineNumber; + int m_currentTagStartLineNumber; + + double m_tokenizerTimeDelay; + int m_tokenizerChunkSize; + + // The timer for continued processing. + Timer<HTMLDocumentParser> m_timer; + + // The timer for continued executing external scripts. + Timer<HTMLDocumentParser> m_externalScriptsTimer; + +// This buffer can hold arbitrarily long user-defined attribute names, such as in EMBED tags. +// So any fixed number might be too small, but rather than rewriting all usage of this buffer +// we'll just make it large enough to handle all imaginable cases. +#define CBUFLEN 1024 + UChar m_cBuffer[CBUFLEN + 2]; + unsigned int m_cBufferPos; + + SegmentedString m_src; + Document* m_doc; + OwnPtr<LegacyHTMLTreeConstructor> m_treeConstructor; + bool m_inWrite; + bool m_fragment; + FragmentScriptingPermission m_scriptingPermission; + + OwnPtr<PreloadScanner> m_preloadScanner; +}; + +void parseHTMLDocumentFragment(const String&, DocumentFragment*, FragmentScriptingPermission = FragmentScriptingAllowed); + +UChar decodeNamedEntity(const char*); + +} // namespace WebCore + +#endif // HTMLTokenizer_h diff --git a/WebCore/html/HTMLElement.cpp b/WebCore/html/HTMLElement.cpp index d95a236..8f2bead 100644 --- a/WebCore/html/HTMLElement.cpp +++ b/WebCore/html/HTMLElement.cpp @@ -39,13 +39,13 @@ #include "HTMLElementFactory.h" #include "HTMLFormElement.h" #include "HTMLNames.h" -#include "HTMLTokenizer.h" +#include "HTMLDocumentParser.h" #include "RenderWordBreak.h" #include "ScriptEventListener.h" #include "Settings.h" #include "Text.h" #include "TextIterator.h" -#include "XMLTokenizer.h" +#include "XMLDocumentParser.h" #include "markup.h" #include <wtf/StdLibExtras.h> @@ -144,7 +144,7 @@ bool HTMLElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry void HTMLElement::parseMappedAttribute(Attribute* attr) { - if (attr->name() == idAttributeName() || attr->name() == classAttr || attr->name() == styleAttr) + if (isIdAttributeName(attr->name()) || attr->name() == classAttr || attr->name() == styleAttr) return StyledElement::parseMappedAttribute(attr); String indexstring; diff --git a/WebCore/html/HTMLEntityNames.gperf b/WebCore/html/HTMLEntityNames.gperf index b16b3d8..c665efe 100644 --- a/WebCore/html/HTMLEntityNames.gperf +++ b/WebCore/html/HTMLEntityNames.gperf @@ -21,15 +21,22 @@ ---------------------------------------------------------------------------- HTMLEntityNames.gperf: input file to generate a hash table for entities - HTMLEntityNames.c: DO NOT EDIT! generated by the command - "gperf -a -L "ANSI-C" -C -G -c -o -t -k '*' -NfindEntity -D -s 2 HTMLEntityNames.gperf > entities.c" - from HTMLEntityNames.gperf + HTMLEntityNames.cpp: DO NOT EDIT! generated by WebCore/make-hash-tools.pl */ %} +%struct-type struct Entity { const char *name; int code; }; +%language=ANSI-C +%readonly-tables +%global-table +%compare-strncmp +%define lookup-function-name findEntity +%define hash-function-name entity_hash_function +%includes +%enum %% AElig, 0x00c6 AMP, 38 diff --git a/WebCore/html/HTMLFormCollection.cpp b/WebCore/html/HTMLFormCollection.cpp index e140a03..7a2e63a 100644 --- a/WebCore/html/HTMLFormCollection.cpp +++ b/WebCore/html/HTMLFormCollection.cpp @@ -111,8 +111,7 @@ Element* HTMLFormCollection::getNamedFormItem(const QualifiedName& attrName, con bool foundInputElements = false; for (unsigned i = 0; i < form->m_associatedElements.size(); ++i) { HTMLFormControlElement* e = form->m_associatedElements[i]; - const QualifiedName& attributeName = (attrName == idAttr) ? e->idAttributeName() : attrName; - if (e->isEnumeratable() && e->getAttribute(attributeName) == name) { + if (e->isEnumeratable() && e->getAttribute(attrName) == name) { foundInputElements = true; if (!duplicateNumber) return e; @@ -123,8 +122,7 @@ Element* HTMLFormCollection::getNamedFormItem(const QualifiedName& attrName, con if (!foundInputElements) { for (unsigned i = 0; i < form->m_imageElements.size(); ++i) { HTMLImageElement* e = form->m_imageElements[i]; - const QualifiedName& attributeName = (attrName == idAttr) ? e->idAttributeName() : attrName; - if (e->getAttribute(attributeName) == name) { + if (e->getAttribute(attrName) == name) { if (!duplicateNumber) return e; --duplicateNumber; @@ -176,9 +174,10 @@ Node* HTMLFormCollection::nextNamedItem(const AtomicString& name) const // checks if we are on the nameAttr half of the iteration and skips over any // that also have the same idAttributeName. Element* impl = nextNamedItemInternal(name); - if (m_idsDone) - while (impl && impl->getAttribute(impl->idAttributeName()) == name) + if (m_idsDone) { + while (impl && impl->getIdAttribute() == name) impl = nextNamedItemInternal(name); + } return impl; } @@ -194,7 +193,7 @@ void HTMLFormCollection::updateNameCache() const for (unsigned i = 0; i < f->m_associatedElements.size(); ++i) { HTMLFormControlElement* e = f->m_associatedElements[i]; if (e->isEnumeratable()) { - const AtomicString& idAttrVal = e->getAttribute(e->idAttributeName()); + const AtomicString& idAttrVal = e->getIdAttribute(); const AtomicString& nameAttrVal = e->getAttribute(nameAttr); if (!idAttrVal.isEmpty()) { // add to id cache @@ -221,7 +220,7 @@ void HTMLFormCollection::updateNameCache() const for (unsigned i = 0; i < f->m_imageElements.size(); ++i) { HTMLImageElement* e = f->m_imageElements[i]; - const AtomicString& idAttrVal = e->getAttribute(e->idAttributeName()); + const AtomicString& idAttrVal = e->getIdAttribute(); const AtomicString& nameAttrVal = e->getAttribute(nameAttr); if (!idAttrVal.isEmpty() && !foundInputElements.contains(idAttrVal.impl())) { // add to id cache diff --git a/WebCore/html/HTMLFormControlElement.cpp b/WebCore/html/HTMLFormControlElement.cpp index fa5d957..62474cc 100644 --- a/WebCore/html/HTMLFormControlElement.cpp +++ b/WebCore/html/HTMLFormControlElement.cpp @@ -38,8 +38,8 @@ #include "HTMLFormElement.h" #include "HTMLInputElement.h" #include "HTMLNames.h" -#include "HTMLParser.h" -#include "HTMLTokenizer.h" +#include "LegacyHTMLTreeConstructor.h" +#include "HTMLDocumentParser.h" #include "LabelsNodeList.h" #include "Page.h" #include "RenderBox.h" @@ -178,12 +178,11 @@ void HTMLFormControlElement::removedFromTree(bool deep) { // If the form and element are both in the same tree, preserve the connection to the form. // Otherwise, null out our form and remove ourselves from the form's list of elements. - HTMLParser* parser = 0; - if (Tokenizer* tokenizer = document()->tokenizer()) - if (tokenizer->isHTMLTokenizer()) - parser = static_cast<HTMLTokenizer*>(tokenizer)->htmlParser(); - - if (m_form && !(parser && parser->isHandlingResidualStyleAcrossBlocks()) && findRoot(this) != findRoot(m_form)) { + LegacyHTMLTreeConstructor* treeConstructor = 0; + if (DocumentParser* parser = document()->parser()) + treeConstructor = parser->htmlTreeConstructor(); + + if (m_form && !(treeConstructor && treeConstructor->isHandlingResidualStyleAcrossBlocks()) && findRoot(this) != findRoot(m_form)) { m_form->removeFormElement(this); m_form = 0; } diff --git a/WebCore/html/HTMLFormElement.cpp b/WebCore/html/HTMLFormElement.cpp index c19933a..084470c 100644 --- a/WebCore/html/HTMLFormElement.cpp +++ b/WebCore/html/HTMLFormElement.cpp @@ -209,7 +209,7 @@ PassRefPtr<FormData> HTMLFormElement::createFormData() control->appendFormData(*domFormData, m_formDataBuilder.isMultiPartForm()); } - RefPtr<FormData> result = (m_formDataBuilder.isMultiPartForm()) ? FormData::createMultiPart(*domFormData, document()) : FormData::create(*domFormData); + RefPtr<FormData> result = (m_formDataBuilder.isMultiPartForm()) ? FormData::createMultiPart(domFormData->items(), domFormData->encoding(), document()) : FormData::create(domFormData->items(), domFormData->encoding()); result->setIdentifier(generateFormDataIdentifier()); return result; @@ -234,7 +234,7 @@ static inline HTMLFormControlElement* submitElementFromEvent(const Event* event) bool HTMLFormElement::validateInteractively(Event* event) { ASSERT(event); - if (noValidate()) + if (!document()->inStrictMode() || noValidate()) return true; HTMLFormControlElement* submitElement = submitElementFromEvent(event); diff --git a/WebCore/html/HTMLFrameElementBase.cpp b/WebCore/html/HTMLFrameElementBase.cpp index fb05e91..b21bf92 100644 --- a/WebCore/html/HTMLFrameElementBase.cpp +++ b/WebCore/html/HTMLFrameElementBase.cpp @@ -113,7 +113,7 @@ void HTMLFrameElementBase::parseMappedAttribute(Attribute* attr) { if (attr->name() == srcAttr) setLocation(deprecatedParseURL(attr->value())); - else if (attr->name() == idAttributeName()) { + else if (isIdAttributeName(attr->name())) { // Important to call through to base for the id attribute so the hasID bit gets set. HTMLFrameOwnerElement::parseMappedAttribute(attr); m_frameName = attr->value(); @@ -154,7 +154,7 @@ void HTMLFrameElementBase::setName() { m_frameName = getAttribute(nameAttr); if (m_frameName.isNull()) - m_frameName = getAttribute(idAttributeName()); + m_frameName = getIdAttribute(); if (Frame* parentFrame = document()->frame()) m_frameName = parentFrame->tree()->uniqueChildName(m_frameName); diff --git a/WebCore/html/HTMLImageElement.cpp b/WebCore/html/HTMLImageElement.cpp index 5dd036e..b149c95 100644 --- a/WebCore/html/HTMLImageElement.cpp +++ b/WebCore/html/HTMLImageElement.cpp @@ -152,7 +152,7 @@ void HTMLImageElement::parseMappedAttribute(Attribute* attr) document->addNamedItem(newName); } m_name = newName; - } else if (attr->name() == idAttributeName()) { + } else if (isIdAttributeName(attr->name())) { const AtomicString& newId = attr->value(); if (inDocument() && document()->isHTMLDocument()) { HTMLDocument* document = static_cast<HTMLDocument*>(this->document()); diff --git a/WebCore/html/HTMLImageElement.idl b/WebCore/html/HTMLImageElement.idl index 3862539..a5a468e 100644 --- a/WebCore/html/HTMLImageElement.idl +++ b/WebCore/html/HTMLImageElement.idl @@ -20,7 +20,9 @@ module html { - interface HTMLImageElement : HTMLElement { + interface [ + GenerateNativeConverter + ] HTMLImageElement : HTMLElement { attribute [ConvertNullToNullString, Reflect] DOMString name; attribute [ConvertNullToNullString, Reflect] DOMString align; attribute [ConvertNullToNullString, Reflect] DOMString alt; diff --git a/WebCore/html/HTMLInputElement.cpp b/WebCore/html/HTMLInputElement.cpp index 9f91277..9be9bff 100644 --- a/WebCore/html/HTMLInputElement.cpp +++ b/WebCore/html/HTMLInputElement.cpp @@ -47,7 +47,7 @@ #include "HTMLImageLoader.h" #include "HTMLNames.h" #include "HTMLOptionElement.h" -#include "HTMLParser.h" +#include "LegacyHTMLTreeConstructor.h" #include "KeyboardEvent.h" #include "LocalizedStrings.h" #include "MouseEvent.h" @@ -166,6 +166,33 @@ void HTMLInputElement::updateCheckedRadioButtons() { if (attached() && checked()) checkedRadioButtons(this).addButton(this); + + if (form()) { + const Vector<HTMLFormControlElement*>& controls = form()->associatedElements(); + for (unsigned i = 0; i < controls.size(); ++i) { + HTMLFormControlElement* control = controls[i]; + if (control->name() != name()) + continue; + if (control->type() != type()) + continue; + control->setNeedsValidityCheck(); + } + } else { + // FIXME: Traversing the document is inefficient. + for (Node* node = document()->body(); node; node = node->traverseNextNode()) { + if (!node->isElementNode()) + continue; + Element* element = static_cast<Element*>(node); + if (element->formControlName() != name()) + continue; + if (element->formControlType() != type()) + continue; + HTMLFormControlElement* control = static_cast<HTMLFormControlElement*>(element); + if (control->form()) + continue; + control->setNeedsValidityCheck(); + } + } if (renderer() && renderer()->style()->hasAppearance()) renderer()->theme()->stateChanged(renderer(), CheckedState); @@ -1423,7 +1450,6 @@ void HTMLInputElement::setChecked(bool nowChecked, bool sendChangeEvent) m_useDefaultChecked = false; m_checked = nowChecked; - setNeedsValidityCheck(); setNeedsStyleRecalc(); updateCheckedRadioButtons(); diff --git a/WebCore/html/HTMLInputElement.h b/WebCore/html/HTMLInputElement.h index 363a25f..a9a7bb0 100644 --- a/WebCore/html/HTMLInputElement.h +++ b/WebCore/html/HTMLInputElement.h @@ -101,6 +101,10 @@ public: virtual bool isSearchField() const { return m_type == SEARCH; } virtual bool isInputTypeHidden() const { return m_type == HIDDEN; } virtual bool isPasswordField() const { return m_type == PASSWORD; } + bool isTelephoneField() const { return m_type == TELEPHONE; } + bool isNumberField() const { return m_type == NUMBER; } + bool isEmailField() const { return m_type == EMAIL; } + bool isUrlField() const { return m_type == URL; } bool checked() const { return m_checked; } void setChecked(bool, bool sendChangeEvent = false); diff --git a/WebCore/html/HTMLInputElement.idl b/WebCore/html/HTMLInputElement.idl index 83b04e7..237d4c3 100644 --- a/WebCore/html/HTMLInputElement.idl +++ b/WebCore/html/HTMLInputElement.idl @@ -57,7 +57,9 @@ module html { attribute [ConvertNullToNullString, JSCCustomGetter] DOMString type; // readonly dropped as part of DOM level 2 attribute [ConvertNullToNullString] DOMString useMap; attribute [ConvertNullToNullString] DOMString value; +#if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP attribute Date valueAsDate setter raises(DOMException); +#endif attribute double valueAsNumber setter raises(DOMException); #if defined(ENABLE_DATALIST) && ENABLE_DATALIST readonly attribute HTMLOptionElement selectedOption; diff --git a/WebCore/html/HTMLMapElement.cpp b/WebCore/html/HTMLMapElement.cpp index 1395cbb..07fcb5c 100644 --- a/WebCore/html/HTMLMapElement.cpp +++ b/WebCore/html/HTMLMapElement.cpp @@ -56,7 +56,6 @@ PassRefPtr<HTMLMapElement> HTMLMapElement::create(const QualifiedName& tagName, HTMLMapElement::~HTMLMapElement() { - document()->removeImageMap(this); } bool HTMLMapElement::checkDTD(const Node* newChild) @@ -104,26 +103,33 @@ HTMLImageElement* HTMLMapElement::imageElement() const return 0; } - -void HTMLMapElement::parseMappedAttribute(Attribute* attr) + +void HTMLMapElement::parseMappedAttribute(Attribute* attribute) { - const QualifiedName& attrName = attr->name(); - if (attrName == idAttributeName() || attrName == nameAttr) { - Document* doc = document(); - if (attrName == idAttributeName()) { + // FIXME: This logic seems wrong for XML documents. + // Either the id or name will be used depending on the order the attributes are parsed. + + const QualifiedName& attrName = attribute->name(); + if (isIdAttributeName(attrName) || attrName == nameAttr) { + Document* document = this->document(); + if (isIdAttributeName(attrName)) { // Call base class so that hasID bit gets set. - HTMLElement::parseMappedAttribute(attr); - if (doc->isHTMLDocument()) + HTMLElement::parseMappedAttribute(attribute); + if (document->isHTMLDocument()) return; } - doc->removeImageMap(this); - String mapName = attr->value(); + if (inDocument()) + document->removeImageMap(this); + String mapName = attribute->value(); if (mapName[0] == '#') mapName = mapName.substring(1); - m_name = doc->isHTMLDocument() ? mapName.lower() : mapName; - doc->addImageMap(this); - } else - HTMLElement::parseMappedAttribute(attr); + m_name = document->isHTMLDocument() ? mapName.lower() : mapName; + if (inDocument()) + document->addImageMap(this); + return; + } + + HTMLElement::parseMappedAttribute(attribute); } PassRefPtr<HTMLCollection> HTMLMapElement::areas() @@ -141,4 +147,16 @@ void HTMLMapElement::setName(const String& value) setAttribute(nameAttr, value); } +void HTMLMapElement::insertedIntoDocument() +{ + document()->addImageMap(this); + HTMLElement::insertedIntoDocument(); +} + +void HTMLMapElement::removedFromDocument() +{ + document()->removeImageMap(this); + HTMLElement::removedFromDocument(); +} + } diff --git a/WebCore/html/HTMLMapElement.h b/WebCore/html/HTMLMapElement.h index 9c8ab79..483f17b 100644 --- a/WebCore/html/HTMLMapElement.h +++ b/WebCore/html/HTMLMapElement.h @@ -56,6 +56,9 @@ private: virtual void parseMappedAttribute(Attribute*); + virtual void insertedIntoDocument(); + virtual void removedFromDocument(); + AtomicString m_name; }; diff --git a/WebCore/html/HTMLMediaElement.cpp b/WebCore/html/HTMLMediaElement.cpp index efef1d2..34679e7 100644 --- a/WebCore/html/HTMLMediaElement.cpp +++ b/WebCore/html/HTMLMediaElement.cpp @@ -661,6 +661,9 @@ void HTMLMediaElement::loadResource(const KURL& initialURL, ContentType& content bool HTMLMediaElement::isSafeToLoadURL(const KURL& url, InvalidSourceAction actionIfInvalid) { + if (!url.isValid()) + return false; + Frame* frame = document()->frame(); FrameLoader* loader = frame ? frame->loader() : 0; @@ -1488,7 +1491,7 @@ KURL HTMLMediaElement::selectNextSourceChild(ContentType *contentType, InvalidSo // Is it safe to load this url? mediaURL = source->src(); - if (!mediaURL.isValid() || !isSafeToLoadURL(mediaURL, actionIfInvalid) || !dispatchBeforeLoadEvent(mediaURL.string())) + if (!isSafeToLoadURL(mediaURL, actionIfInvalid) || !dispatchBeforeLoadEvent(mediaURL.string())) goto check_again; // Making it this far means the <source> looks reasonable @@ -1956,7 +1959,7 @@ void HTMLMediaElement::getPluginProxyParams(KURL& url, Vector<String>& names, Ve } url = src(); - if (!url.isValid() || !isSafeToLoadURL(url, Complain)) + if (!isSafeToLoadURL(url, Complain)) url = selectNextSourceChild(0, DoNothing); m_currentSrc = url.string(); diff --git a/WebCore/html/HTMLMeterElement.cpp b/WebCore/html/HTMLMeterElement.cpp index a1b74b2..1e8956d 100644 --- a/WebCore/html/HTMLMeterElement.cpp +++ b/WebCore/html/HTMLMeterElement.cpp @@ -24,10 +24,11 @@ #include "Attribute.h" #include "EventNames.h" +#include "ExceptionCode.h" #include "FormDataList.h" #include "HTMLFormElement.h" #include "HTMLNames.h" -#include "HTMLParser.h" +#include "LegacyHTMLTreeConstructor.h" #include "RenderMeter.h" #include <wtf/StdLibExtras.h> @@ -162,5 +163,38 @@ void HTMLMeterElement::setOptimum(double optimum, ExceptionCode& ec) setAttribute(optimumAttr, String::number(optimum)); } +HTMLMeterElement::GaugeRegion HTMLMeterElement::gaugeRegion() const +{ + double lowValue = low(); + double highValue = high(); + double theValue = value(); + double optimumValue = optimum(); + + if (optimumValue <= lowValue) { + // The optimum range stays under low + if (theValue <= lowValue) + return GaugeRegionOptimum; + if (theValue <= highValue) + return GaugeRegionSuboptimal; + return GaugeRegionEvenLessGood; + } + + if (highValue <= optimumValue) { + // The optimum range stays over high + if (highValue <= theValue) + return GaugeRegionOptimum; + if (lowValue <= theValue) + return GaugeRegionSuboptimal; + return GaugeRegionEvenLessGood; + } + + // The optimum range stays between high and low + if (lowValue < highValue && theValue < highValue) + return GaugeRegionOptimum; + if (theValue == min() || max() == theValue) + return GaugeRegionEvenLessGood; + return GaugeRegionSuboptimal; +} + } // namespace #endif diff --git a/WebCore/html/HTMLMeterElement.h b/WebCore/html/HTMLMeterElement.h index a218584..cefad97 100644 --- a/WebCore/html/HTMLMeterElement.h +++ b/WebCore/html/HTMLMeterElement.h @@ -30,6 +30,12 @@ class HTMLMeterElement : public HTMLFormControlElement { public: static PassRefPtr<HTMLMeterElement> create(const QualifiedName&, Document*); + enum GaugeRegion { + GaugeRegionOptimum, + GaugeRegionSuboptimal, + GaugeRegionEvenLessGood + }; + double min() const; void setMin(double, ExceptionCode&); @@ -48,6 +54,7 @@ public: double optimum() const; void setOptimum(double, ExceptionCode&); + GaugeRegion gaugeRegion() const; private: HTMLMeterElement(const QualifiedName&, Document*); diff --git a/WebCore/html/HTMLMeterElement.idl b/WebCore/html/HTMLMeterElement.idl index 2b0e03f..3398688 100644 --- a/WebCore/html/HTMLMeterElement.idl +++ b/WebCore/html/HTMLMeterElement.idl @@ -37,3 +37,4 @@ module html { readonly attribute NodeList labels; }; } + diff --git a/WebCore/html/HTMLNameCollection.cpp b/WebCore/html/HTMLNameCollection.cpp index eb88c02..4075e4c 100644 --- a/WebCore/html/HTMLNameCollection.cpp +++ b/WebCore/html/HTMLNameCollection.cpp @@ -63,7 +63,7 @@ Element* HTMLNameCollection::itemAfter(Element* previous) const e->hasTagName(objectTag)) if (e->getAttribute(nameAttr) == m_name) return e; - if (e->getAttribute(e->idAttributeName()) == m_name) + if (e->getIdAttribute() == m_name) return e; break; case DocumentNamedItems: @@ -74,14 +74,14 @@ Element* HTMLNameCollection::itemAfter(Element* previous) const if (e->getAttribute(nameAttr) == m_name) return e; } else if (e->hasTagName(appletTag)) { - if (e->getAttribute(nameAttr) == m_name || e->getAttribute(e->idAttributeName()) == m_name) + if (e->getAttribute(nameAttr) == m_name || e->getIdAttribute() == m_name) return e; } else if (e->hasTagName(objectTag)) { - if ((e->getAttribute(nameAttr) == m_name || e->getAttribute(e->idAttributeName()) == m_name) + if ((e->getAttribute(nameAttr) == m_name || e->getIdAttribute() == m_name) && static_cast<HTMLObjectElement*>(e)->isDocNamedItem()) return e; } else if (e->hasTagName(imgTag)) { - if (e->getAttribute(nameAttr) == m_name || (e->getAttribute(e->idAttributeName()) == m_name && e->hasAttribute(nameAttr))) + if (e->getAttribute(nameAttr) == m_name || (e->getIdAttribute() == m_name && e->hasAttribute(nameAttr))) return e; } break; diff --git a/WebCore/html/HTMLObjectElement.cpp b/WebCore/html/HTMLObjectElement.cpp index ea130b9..bd9fc1c 100644 --- a/WebCore/html/HTMLObjectElement.cpp +++ b/WebCore/html/HTMLObjectElement.cpp @@ -105,7 +105,7 @@ void HTMLObjectElement::parseMappedAttribute(Attribute* attr) document->addNamedItem(newName); } m_name = newName; - } else if (attr->name() == idAttributeName()) { + } else if (isIdAttributeName(attr->name())) { const AtomicString& newId = attr->value(); if (isDocNamedItem() && inDocument() && document()->isHTMLDocument()) { HTMLDocument* document = static_cast<HTMLDocument*>(this->document()); diff --git a/WebCore/html/HTMLParamElement.cpp b/WebCore/html/HTMLParamElement.cpp index ca28383..a637d5b 100644 --- a/WebCore/html/HTMLParamElement.cpp +++ b/WebCore/html/HTMLParamElement.cpp @@ -44,7 +44,7 @@ PassRefPtr<HTMLParamElement> HTMLParamElement::create(const QualifiedName& tagNa void HTMLParamElement::parseMappedAttribute(Attribute* attr) { - if (attr->name() == idAttributeName()) { + if (isIdAttributeName(attr->name())) { // Must call base class so that hasID bit gets set. HTMLElement::parseMappedAttribute(attr); if (document()->isHTMLDocument()) diff --git a/WebCore/html/HTMLParser.cpp b/WebCore/html/HTMLParser.cpp deleted file mode 100644 index dd822cf..0000000 --- a/WebCore/html/HTMLParser.cpp +++ /dev/null @@ -1,1743 +0,0 @@ -/* - Copyright (C) 1997 Martin Jones (mjones@kde.org) - (C) 1997 Torben Weis (weis@kde.org) - (C) 1999,2001 Lars Knoll (knoll@kde.org) - (C) 2000,2001 Dirk Mueller (mueller@kde.org) - Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. - Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) - - 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 "HTMLParser.h" - -#include "CharacterNames.h" -#include "CSSPropertyNames.h" -#include "CSSValueKeywords.h" -#include "Chrome.h" -#include "ChromeClient.h" -#include "Comment.h" -#include "Console.h" -#include "DOMWindow.h" -#include "DocumentFragment.h" -#include "DocumentType.h" -#include "Frame.h" -#include "HTMLBodyElement.h" -#include "HTMLDocument.h" -#include "HTMLDivElement.h" -#include "HTMLDListElement.h" -#include "HTMLElementFactory.h" -#include "HTMLFormElement.h" -#include "HTMLHeadElement.h" -#include "HTMLHRElement.h" -#include "HTMLHtmlElement.h" -#include "HTMLIsIndexElement.h" -#include "HTMLMapElement.h" -#include "HTMLNames.h" -#include "HTMLParserQuirks.h" -#include "HTMLTableCellElement.h" -#include "HTMLTableRowElement.h" -#include "HTMLTableSectionElement.h" -#include "HTMLTokenizer.h" -#include "LocalizedStrings.h" -#include "Page.h" -#include "QualifiedName.h" -#include "Settings.h" -#include "Text.h" -#include "TreeDepthLimit.h" -#include <wtf/StdLibExtras.h> -#include <wtf/dtoa.h> - -namespace WebCore { - -using namespace HTMLNames; - -static const unsigned cMaxRedundantTagDepth = 20; -static const unsigned cResidualStyleMaxDepth = 200; -static const unsigned cResidualStyleIterationLimit = 5; - - -static const int minBlockLevelTagPriority = 3; - -// A cap on the number of tags with priority minBlockLevelTagPriority or higher -// allowed in m_blockStack. The cap is enforced by adding such new elements as -// siblings instead of children once it is reached. -static const size_t cMaxBlockDepth = 4096; - - -typedef HashSet<AtomicStringImpl*> TagNameSet; - -template< size_t ArraySize > -static void addTags(TagNameSet& set, QualifiedName (&names)[ArraySize]) -{ - for (size_t x = 0; x < ArraySize; x++) { - const QualifiedName& name = names[x]; - set.add(name.localName().impl()); - } -} - -struct HTMLStackElem : Noncopyable { - HTMLStackElem(const AtomicString& t, int lvl, Node* n, bool r, HTMLStackElem* nx) - : tagName(t) - , level(lvl) - , strayTableContent(false) - , node(n) - , didRefNode(r) - , next(nx) - { - } - - void derefNode() - { - if (didRefNode) - node->deref(); - } - - AtomicString tagName; - int level; - bool strayTableContent; - Node* node; - bool didRefNode; - HTMLStackElem* next; -}; - -/** - * The parser parses tokenized input into the document, building up the - * document tree. If the document is well-formed, parsing it is straightforward. - * - * Unfortunately, we have to handle many HTML documents that are not well-formed, - * so the parser has to be tolerant about errors. - * - * We have to take care of at least the following error conditions: - * - * 1. The element being added is explicitly forbidden inside some outer tag. - * In this case we should close all tags up to the one, which forbids - * the element, and add it afterwards. - * - * 2. We are not allowed to add the element directly. It could be that - * the person writing the document forgot some tag in between (or that the - * tag in between is optional). This could be the case with the following - * tags: HTML HEAD BODY TBODY TR TD LI (did I forget any?). - * - * 3. We want to add a block element inside to an inline element. Close all - * inline elements up to the next higher block element. - * - * 4. If this doesn't help, close elements until we are allowed to add the - * element or ignore the tag. - * - */ - -HTMLParser::HTMLParser(HTMLDocument* doc, bool reportErrors) - : m_document(doc) - , m_current(doc) - , m_didRefCurrent(false) - , m_blockStack(0) - , m_blocksInStack(0) - , m_treeDepth(0) - , m_hasPElementInScope(NotInScope) - , m_inBody(false) - , m_haveContent(false) - , m_haveFrameSet(false) - , m_isParsingFragment(false) - , m_reportErrors(reportErrors) - , m_handlingResidualStyleAcrossBlocks(false) - , m_inStrayTableContent(0) - , m_scriptingPermission(FragmentScriptingAllowed) - , m_parserQuirks(m_document->page() ? m_document->page()->chrome()->client()->createHTMLParserQuirks() : 0) -{ -} - -HTMLParser::HTMLParser(DocumentFragment* frag, FragmentScriptingPermission scriptingPermission) - : m_document(frag->document()) - , m_current(frag) - , m_didRefCurrent(true) - , m_blockStack(0) - , m_blocksInStack(0) - , m_treeDepth(0) - , m_hasPElementInScope(NotInScope) - , m_inBody(true) - , m_haveContent(false) - , m_haveFrameSet(false) - , m_isParsingFragment(true) - , m_reportErrors(false) - , m_handlingResidualStyleAcrossBlocks(false) - , m_inStrayTableContent(0) - , m_scriptingPermission(scriptingPermission) - , m_parserQuirks(m_document->page() ? m_document->page()->chrome()->client()->createHTMLParserQuirks() : 0) -{ - if (frag) - frag->ref(); -} - -HTMLParser::~HTMLParser() -{ - freeBlock(); - if (m_didRefCurrent) - m_current->deref(); -} - -void HTMLParser::reset() -{ - ASSERT(!m_isParsingFragment); - - setCurrent(m_document); - - freeBlock(); - - m_treeDepth = 0; - m_inBody = false; - m_haveFrameSet = false; - m_haveContent = false; - m_inStrayTableContent = 0; - - m_currentFormElement = 0; - m_currentMapElement = 0; - m_head = 0; - m_isindexElement = 0; - - m_skipModeTag = nullAtom; - - if (m_parserQuirks) - m_parserQuirks->reset(); -} - -void HTMLParser::setCurrent(Node* newCurrent) -{ - bool didRefNewCurrent = newCurrent && newCurrent != m_document; - if (didRefNewCurrent) - newCurrent->ref(); - if (m_didRefCurrent) - m_current->deref(); - m_current = newCurrent; - m_didRefCurrent = didRefNewCurrent; -} - -inline static int tagPriorityOfNode(Node* n) -{ - return n->isHTMLElement() ? static_cast<HTMLElement*>(n)->tagPriority() : 0; -} - -inline void HTMLParser::limitDepth(int tagPriority) -{ - while (m_treeDepth >= maxDOMTreeDepth) - popBlock(m_blockStack->tagName); - if (tagPriority >= minBlockLevelTagPriority) { - while (m_blocksInStack >= cMaxBlockDepth) - popBlock(m_blockStack->tagName); - } -} - -inline bool HTMLParser::insertNodeAfterLimitDepth(Node* n, bool flat) -{ - limitDepth(tagPriorityOfNode(n)); - return insertNode(n, flat); -} - -PassRefPtr<Node> HTMLParser::parseToken(Token* t) -{ - if (!m_skipModeTag.isNull()) { - if (!t->beginTag && t->tagName == m_skipModeTag) - // Found the end tag for the current skip mode, so we're done skipping. - m_skipModeTag = nullAtom; - else if (m_current->localName() == t->tagName) - // Do not skip </iframe>. - // FIXME: What does that comment mean? How can it be right to parse a token without clearing m_skipModeTag? - ; - else - return 0; - } - - // Apparently some sites use </br> instead of <br>. Be compatible with IE and Firefox and treat this like <br>. - if (t->isCloseTag(brTag) && m_document->inCompatMode()) { - reportError(MalformedBRError); - t->beginTag = true; - } - - if (!t->beginTag) { - processCloseTag(t); - return 0; - } - - // Ignore spaces, if we're not inside a paragraph or other inline code. - // Do not alter the text if it is part of a scriptTag. - if (t->tagName == textAtom && t->text && m_current->localName() != scriptTag) { - if (m_inBody && !skipMode() && m_current->localName() != styleTag && - m_current->localName() != titleTag && !t->text->containsOnlyWhitespace()) - m_haveContent = true; - - RefPtr<Node> n; - String text = t->text.get(); - unsigned charsLeft = text.length(); - while (charsLeft) { - // split large blocks of text to nodes of manageable size - n = Text::createWithLengthLimit(m_document, text, charsLeft); - if (!insertNodeAfterLimitDepth(n.get(), t->selfClosingTag)) - return 0; - } - return n; - } - - RefPtr<Node> n = getNode(t); - // just to be sure, and to catch currently unimplemented stuff - if (!n) - return 0; - - // set attributes - if (n->isHTMLElement()) { - HTMLElement* e = static_cast<HTMLElement*>(n.get()); - if (m_scriptingPermission == FragmentScriptingAllowed || t->tagName != scriptTag) - e->setAttributeMap(t->attrs.get(), m_scriptingPermission); - - // take care of optional close tags - if (e->endTagRequirement() == TagStatusOptional) - popBlock(t->tagName); - - // If the node does not have a forbidden end tag requirement, and if the broken XML self-closing - // syntax was used, report an error. - if (t->brokenXMLStyle && e->endTagRequirement() != TagStatusForbidden) { - if (t->tagName == scriptTag) - reportError(IncorrectXMLCloseScriptWarning); - else - reportError(IncorrectXMLSelfCloseError, &t->tagName); - } - } - - if (!insertNodeAfterLimitDepth(n.get(), t->selfClosingTag)) { - // we couldn't insert the node - - if (n->isElementNode()) { - Element* e = static_cast<Element*>(n.get()); - e->setAttributeMap(0); - } - - if (m_currentMapElement == n) - m_currentMapElement = 0; - - if (m_currentFormElement == n) - m_currentFormElement = 0; - - if (m_head == n) - m_head = 0; - - return 0; - } - return n; -} - -void HTMLParser::parseDoctypeToken(DoctypeToken* t) -{ - // Ignore any doctype after the first. Ignore doctypes in fragments. - if (m_document->doctype() || m_isParsingFragment || m_current != m_document) - return; - - // Make a new doctype node and set it as our doctype. - m_document->addChild(DocumentType::create(m_document, String::adopt(t->m_name), String::adopt(t->m_publicID), String::adopt(t->m_systemID))); -} - -static bool isTableSection(const Node* n) -{ - return n->hasTagName(tbodyTag) || n->hasTagName(tfootTag) || n->hasTagName(theadTag); -} - -static bool isTablePart(const Node* n) -{ - return n->hasTagName(trTag) || n->hasTagName(tdTag) || n->hasTagName(thTag) - || isTableSection(n); -} - -static bool isTableRelated(const Node* n) -{ - return n->hasTagName(tableTag) || isTablePart(n); -} - -static bool isScopingTag(const AtomicString& tagName) -{ - return tagName == appletTag || tagName == captionTag || tagName == tdTag - || tagName == thTag || tagName == buttonTag || tagName == marqueeTag - || tagName == objectTag || tagName == tableTag || tagName == htmlTag; -} - -bool HTMLParser::insertNode(Node* n, bool flat) -{ - RefPtr<Node> protectNode(n); - - const AtomicString& localName = n->localName(); - - // <table> is never allowed inside stray table content. Always pop out of the stray table content - // and close up the first table, and then start the second table as a sibling. - if (m_inStrayTableContent && localName == tableTag) - popBlock(tableTag); - - if (m_parserQuirks && !m_parserQuirks->shouldInsertNode(m_current, n)) - return false; - - int tagPriority = tagPriorityOfNode(n); - - // let's be stupid and just try to insert it. - // this should work if the document is well-formed - Node* newNode = m_current->addChild(n); - if (!newNode) - return handleError(n, flat, localName, tagPriority); // Try to handle the error. - - // don't push elements without end tags (e.g., <img>) on the stack - bool parentAttached = m_current->attached(); - if (tagPriority > 0 && !flat) { - if (newNode == m_current) { - // This case should only be hit when a demoted <form> is placed inside a table. - ASSERT(localName == formTag); - reportError(FormInsideTablePartError, &m_current->localName()); - HTMLFormElement* form = static_cast<HTMLFormElement*>(n); - form->setDemoted(true); - } else { - // The pushBlock function transfers ownership of current to the block stack - // so we're guaranteed that m_didRefCurrent is false. The code below is an - // optimized version of setCurrent that takes advantage of that fact and also - // assumes that newNode is neither 0 nor a pointer to the document. - pushBlock(localName, tagPriority); - newNode->beginParsingChildren(); - ASSERT(!m_didRefCurrent); - newNode->ref(); - m_current = newNode; - m_didRefCurrent = true; - } - if (parentAttached && !n->attached() && !m_isParsingFragment) - n->attach(); - } else { - if (parentAttached && !n->attached() && !m_isParsingFragment) - n->attach(); - n->finishParsingChildren(); - } - - if (localName == htmlTag && m_document->frame() && !m_isParsingFragment) - m_document->frame()->loader()->dispatchDocumentElementAvailable(); - - return true; -} - -bool HTMLParser::handleError(Node* n, bool flat, const AtomicString& localName, int tagPriority) -{ - // Error handling code. This is just ad hoc handling of specific parent/child combinations. - bool handled = false; - - // 1. Check out the element's tag name to decide how to deal with errors. - if (n->isHTMLElement()) { - HTMLElement* h = static_cast<HTMLElement*>(n); - if (h->hasLocalName(trTag) || h->hasLocalName(thTag) || h->hasLocalName(tdTag)) { - if (m_inStrayTableContent && !isTableRelated(m_current)) { - reportError(MisplacedTablePartError, &localName, &m_current->localName()); - // pop out to the nearest enclosing table-related tag. - while (m_blockStack && !isTableRelated(m_current)) - popOneBlock(); - return insertNode(n); - } - } else if (h->hasLocalName(headTag)) { - if (!m_current->isDocumentNode() && !m_current->hasTagName(htmlTag)) { - reportError(MisplacedHeadError); - return false; - } - } else if (h->hasLocalName(metaTag) || h->hasLocalName(linkTag) || h->hasLocalName(baseTag)) { - bool createdHead = false; - if (!m_head) { - createHead(); - createdHead = true; - } - if (m_head) { - if (!createdHead) - reportError(MisplacedHeadContentError, &localName, &m_current->localName()); - if (m_head->addChild(n)) { - if (!n->attached() && !m_isParsingFragment) - n->attach(); - return true; - } else - return false; - } - } else if (h->hasLocalName(htmlTag)) { - if (!m_current->isDocumentNode() ) { - if (m_document->documentElement() && m_document->documentElement()->hasTagName(htmlTag) && !m_isParsingFragment) { - reportError(RedundantHTMLBodyError, &localName); - // we have another <HTML> element.... apply attributes to existing one - // make sure we don't overwrite already existing attributes - NamedNodeMap* map = static_cast<Element*>(n)->attributes(true); - Element* existingHTML = static_cast<Element*>(m_document->documentElement()); - NamedNodeMap* bmap = existingHTML->attributes(false); - for (unsigned l = 0; map && l < map->length(); ++l) { - Attribute* it = map->attributeItem(l); - if (!bmap->getAttributeItem(it->name())) - existingHTML->setAttribute(it->name(), it->value()); - } - } - return false; - } - } else if (h->hasLocalName(titleTag) || h->hasLocalName(styleTag) || h->hasLocalName(scriptTag)) { - bool createdHead = false; - if (!m_head) { - createHead(); - createdHead = true; - } - if (m_head) { - Node* newNode = m_head->addChild(n); - if (!newNode) { - setSkipMode(h->tagQName()); - return false; - } - - if (!createdHead) - reportError(MisplacedHeadContentError, &localName, &m_current->localName()); - - pushBlock(localName, tagPriority); - newNode->beginParsingChildren(); - setCurrent(newNode); - if (!n->attached() && !m_isParsingFragment) - n->attach(); - return true; - } - if (m_inBody) { - setSkipMode(h->tagQName()); - return false; - } - } else if (h->hasLocalName(bodyTag)) { - if (m_inBody && m_document->body() && !m_isParsingFragment) { - // we have another <BODY> element.... apply attributes to existing one - // make sure we don't overwrite already existing attributes - // some sites use <body bgcolor=rightcolor>...<body bgcolor=wrongcolor> - reportError(RedundantHTMLBodyError, &localName); - NamedNodeMap* map = static_cast<Element*>(n)->attributes(true); - Element* existingBody = m_document->body(); - NamedNodeMap* bmap = existingBody->attributes(false); - for (unsigned l = 0; map && l < map->length(); ++l) { - Attribute* it = map->attributeItem(l); - if (!bmap->getAttributeItem(it->name())) - existingBody->setAttribute(it->name(), it->value()); - } - return false; - } else if (!m_current->isDocumentNode()) - return false; - } else if (h->hasLocalName(areaTag)) { - if (m_currentMapElement) { - reportError(MisplacedAreaError, &m_current->localName()); - m_currentMapElement->addChild(n); - if (!n->attached() && !m_isParsingFragment) - n->attach(); - handled = true; - return true; - } - return false; - } else if (h->hasLocalName(colgroupTag) || h->hasLocalName(captionTag)) { - if (isTableRelated(m_current)) { - while (m_blockStack && isTablePart(m_current)) - popOneBlock(); - return insertNode(n); - } - } - } else if (n->isCommentNode() && !m_head) - return false; - - // 2. Next we examine our currently active element to do some further error handling. - if (m_current->isHTMLElement()) { - HTMLElement* h = static_cast<HTMLElement*>(m_current); - const AtomicString& currentTagName = h->localName(); - if (h->hasLocalName(htmlTag)) { - HTMLElement* elt = n->isHTMLElement() ? static_cast<HTMLElement*>(n) : 0; - if (elt && (elt->hasLocalName(scriptTag) || elt->hasLocalName(styleTag) || - elt->hasLocalName(metaTag) || elt->hasLocalName(linkTag) || - elt->hasLocalName(objectTag) || elt->hasLocalName(embedTag) || - elt->hasLocalName(titleTag) || elt->hasLocalName(isindexTag) || - elt->hasLocalName(baseTag))) { - if (!m_head) { - m_head = HTMLHeadElement::create(m_document); - insertNode(m_head.get()); - handled = true; - } - } else { - if (n->isTextNode()) { - Text* t = static_cast<Text*>(n); - if (t->containsOnlyWhitespace()) - return false; - } - if (!m_haveFrameSet) { - // Ensure that head exists. - // But not for older versions of Mail, where the implicit <head> isn't expected - <rdar://problem/6863795> - if (!m_isParsingFragment && shouldCreateImplicitHead(m_document)) - createHead(); - - popBlock(headTag); - startBody(); - insertNode(HTMLBodyElement::create(m_document).get()); - handled = true; - } else - reportError(MisplacedFramesetContentError, &localName); - } - } else if (h->hasLocalName(headTag)) { - if (n->hasTagName(htmlTag)) - return false; - else { - // This means the body starts here... - if (!m_haveFrameSet) { - ASSERT(currentTagName == headTag); - popBlock(currentTagName); - startBody(); - insertNode(HTMLBodyElement::create(m_document).get()); - handled = true; - } else - reportError(MisplacedFramesetContentError, &localName); - } - } else if (h->hasLocalName(addressTag) || h->hasLocalName(fontTag) - || h->hasLocalName(styleTag) || h->hasLocalName(titleTag)) { - reportError(MisplacedContentRetryError, &localName, ¤tTagName); - popBlock(currentTagName); - handled = true; - } else if (h->hasLocalName(captionTag)) { - // Illegal content in a caption. Close the caption and try again. - reportError(MisplacedCaptionContentError, &localName); - popBlock(currentTagName); - if (isTablePart(n)) - return insertNode(n, flat); - } else if (h->hasLocalName(tableTag) || h->hasLocalName(trTag) || isTableSection(h)) { - if (n->hasTagName(tableTag)) { - reportError(MisplacedTableError, ¤tTagName); - if (m_isParsingFragment && !h->hasLocalName(tableTag)) - // fragment may contain table parts without <table> ancestor, pop them one by one - popBlock(h->localName()); - popBlock(localName); // end the table - handled = true; // ...and start a new one - } else { - ExceptionCode ec = 0; - Node* node = m_current; - Node* parent = node->parentNode(); - // A script may have removed the current node's parent from the DOM - // http://bugs.webkit.org/show_bug.cgi?id=7137 - // FIXME: we should do real recovery here and re-parent with the correct node. - if (!parent) - return false; - Node* grandparent = parent->parentNode(); - - if (n->isTextNode() || - (h->hasLocalName(trTag) && - isTableSection(parent) && grandparent && grandparent->hasTagName(tableTag)) || - ((!n->hasTagName(tdTag) && !n->hasTagName(thTag) && - !n->hasTagName(formTag) && !n->hasTagName(scriptTag)) && isTableSection(node) && - parent->hasTagName(tableTag))) { - node = (node->hasTagName(tableTag)) ? node : - ((node->hasTagName(trTag)) ? grandparent : parent); - // This can happen with fragments - if (!node) - return false; - Node* parent = node->parentNode(); - if (!parent) - return false; - parent->insertBefore(n, node, ec); - if (!ec) { - reportError(StrayTableContentError, &localName, ¤tTagName); - if (n->isHTMLElement() && tagPriority > 0 && - !flat && static_cast<HTMLElement*>(n)->endTagRequirement() != TagStatusForbidden) - { - pushBlock(localName, tagPriority); - n->beginParsingChildren(); - setCurrent(n); - m_inStrayTableContent++; - m_blockStack->strayTableContent = true; - } - return true; - } - } - - if (!ec) { - if (m_current->hasTagName(trTag)) { - reportError(TablePartRequiredError, &localName, &tdTag.localName()); - insertNode(HTMLTableCellElement::create(tdTag, m_document).get()); - } else if (m_current->hasTagName(tableTag)) { - // Don't report an error in this case, since making a <tbody> happens all the time when you have <table><tr>, - // and it isn't really a parse error per se. - insertNode(HTMLTableSectionElement::create(tbodyTag, m_document).get()); - } else { - reportError(TablePartRequiredError, &localName, &trTag.localName()); - insertNode(HTMLTableRowElement::create(m_document).get()); - } - handled = true; - } - } - } else if (h->hasLocalName(objectTag)) { - reportError(MisplacedContentRetryError, &localName, ¤tTagName); - popBlock(objectTag); - handled = true; - } else if (h->hasLocalName(pTag) || isHeadingTag(currentTagName)) { - if (!isInline(n)) { - popBlock(currentTagName); - handled = true; - } - } else if (h->hasLocalName(optionTag) || h->hasLocalName(optgroupTag)) { - if (localName == optgroupTag) { - popBlock(currentTagName); - handled = true; - } else if (localName == selectTag) { - // IE treats a nested select as </select>. Let's do the same - popBlock(localName); - } - } else if (h->hasLocalName(selectTag)) { - if (localName == inputTag || localName == textareaTag) { - reportError(MisplacedContentRetryError, &localName, ¤tTagName); - popBlock(currentTagName); - handled = true; - } - } else if (h->hasLocalName(colgroupTag)) { - popBlock(currentTagName); - handled = true; - } else if (!h->hasLocalName(bodyTag)) { - if (isInline(m_current)) { - popInlineBlocks(); - handled = true; - } - } - } else if (m_current->isDocumentNode()) { - if (n->isTextNode()) { - Text* t = static_cast<Text*>(n); - if (t->containsOnlyWhitespace()) - return false; - } - - if (!m_document->documentElement()) { - insertNode(HTMLHtmlElement::create(m_document).get()); - handled = true; - } - } - - // 3. If we couldn't handle the error, just return false and attempt to error-correct again. - if (!handled) { - reportError(IgnoredContentError, &localName, &m_current->localName()); - return false; - } - return insertNode(n); -} - -typedef bool (HTMLParser::*CreateErrorCheckFunc)(Token* t, RefPtr<Node>&); -typedef HashMap<AtomicStringImpl*, CreateErrorCheckFunc> FunctionMap; - -bool HTMLParser::textCreateErrorCheck(Token* t, RefPtr<Node>& result) -{ - result = Text::create(m_document, t->text.get()); - return false; -} - -bool HTMLParser::commentCreateErrorCheck(Token* t, RefPtr<Node>& result) -{ - result = Comment::create(m_document, t->text.get()); - return false; -} - -bool HTMLParser::headCreateErrorCheck(Token*, RefPtr<Node>& result) -{ - if (!m_head || m_current->localName() == htmlTag) { - m_head = HTMLHeadElement::create(m_document); - result = m_head; - } else - reportError(MisplacedHeadError); - return false; -} - -bool HTMLParser::bodyCreateErrorCheck(Token*, RefPtr<Node>&) -{ - // body no longer allowed if we have a frameset - if (m_haveFrameSet) - return false; - - // Ensure that head exists (unless parsing a fragment). - // But not for older versions of Mail, where the implicit <head> isn't expected - <rdar://problem/6863795> - if (!m_isParsingFragment && shouldCreateImplicitHead(m_document)) - createHead(); - - popBlock(headTag); - startBody(); - return true; -} - -bool HTMLParser::framesetCreateErrorCheck(Token*, RefPtr<Node>&) -{ - popBlock(headTag); - if (m_inBody && !m_haveFrameSet && !m_haveContent) { - popBlock(bodyTag); - // ### actually for IE document.body returns the now hidden "body" element - // we can't implement that behaviour now because it could cause too many - // regressions and the headaches are not worth the work as long as there is - // no site actually relying on that detail (Dirk) - if (m_document->body() && !m_isParsingFragment) - m_document->body()->setAttribute(styleAttr, "display:none"); - m_inBody = false; - } - if ((m_haveContent || m_haveFrameSet) && m_current->localName() == htmlTag) - return false; - m_haveFrameSet = true; - startBody(); - return true; -} - -bool HTMLParser::formCreateErrorCheck(Token* t, RefPtr<Node>& result) -{ - // Only create a new form if we're not already inside one. - // This is consistent with other browsers' behavior. - if (!m_currentFormElement) { - m_currentFormElement = HTMLFormElement::create(m_document); - result = m_currentFormElement; - pCloserCreateErrorCheck(t, result); - } - return false; -} - -bool HTMLParser::isindexCreateErrorCheck(Token* t, RefPtr<Node>& result) -{ - RefPtr<Node> n = handleIsindex(t); - if (!m_inBody) - m_isindexElement = n.release(); - else { - t->selfClosingTag = true; - result = n.release(); - } - return false; -} - -bool HTMLParser::selectCreateErrorCheck(Token*, RefPtr<Node>&) -{ - return true; -} - -bool HTMLParser::ddCreateErrorCheck(Token* t, RefPtr<Node>& result) -{ - pCloserCreateErrorCheck(t, result); - popBlock(dtTag); - popBlock(ddTag); - return true; -} - -bool HTMLParser::dtCreateErrorCheck(Token* t, RefPtr<Node>& result) -{ - pCloserCreateErrorCheck(t, result); - popBlock(ddTag); - popBlock(dtTag); - return true; -} - -bool HTMLParser::rpCreateErrorCheck(Token*, RefPtr<Node>&) -{ - popBlock(rpTag); - popBlock(rtTag); - return true; -} - -bool HTMLParser::rtCreateErrorCheck(Token*, RefPtr<Node>&) -{ - popBlock(rpTag); - popBlock(rtTag); - return true; -} - -bool HTMLParser::nestedCreateErrorCheck(Token* t, RefPtr<Node>&) -{ - popBlock(t->tagName); - return true; -} - -bool HTMLParser::nestedPCloserCreateErrorCheck(Token* t, RefPtr<Node>& result) -{ - pCloserCreateErrorCheck(t, result); - popBlock(t->tagName); - return true; -} - -bool HTMLParser::nestedStyleCreateErrorCheck(Token* t, RefPtr<Node>&) -{ - return allowNestedRedundantTag(t->tagName); -} - -bool HTMLParser::tableCellCreateErrorCheck(Token*, RefPtr<Node>&) -{ - popBlock(tdTag); - popBlock(thTag); - return true; -} - -bool HTMLParser::tableSectionCreateErrorCheck(Token*, RefPtr<Node>&) -{ - popBlock(theadTag); - popBlock(tbodyTag); - popBlock(tfootTag); - return true; -} - -bool HTMLParser::noembedCreateErrorCheck(Token*, RefPtr<Node>&) -{ - setSkipMode(noembedTag); - return true; -} - -bool HTMLParser::noframesCreateErrorCheck(Token*, RefPtr<Node>&) -{ - setSkipMode(noframesTag); - return true; -} - -bool HTMLParser::noscriptCreateErrorCheck(Token*, RefPtr<Node>&) -{ - if (!m_isParsingFragment) { - Frame* frame = m_document->frame(); - if (frame && frame->script()->canExecuteScripts(NotAboutToExecuteScript)) - setSkipMode(noscriptTag); - } - return true; -} - -bool HTMLParser::pCloserCreateErrorCheck(Token*, RefPtr<Node>&) -{ - if (hasPElementInScope()) - popBlock(pTag); - return true; -} - -bool HTMLParser::pCloserStrictCreateErrorCheck(Token*, RefPtr<Node>&) -{ - if (m_document->inCompatMode()) - return true; - if (hasPElementInScope()) - popBlock(pTag); - return true; -} - -bool HTMLParser::mapCreateErrorCheck(Token*, RefPtr<Node>& result) -{ - m_currentMapElement = HTMLMapElement::create(m_document); - result = m_currentMapElement; - return false; -} - -static void mapTagToFunc(FunctionMap& map, const QualifiedName& tag, CreateErrorCheckFunc func) -{ - map.set(tag.localName().impl(), func); -} - -template< size_t ArraySize > -static void mapTagsToFunc(FunctionMap& map, QualifiedName (&names)[ArraySize], CreateErrorCheckFunc func) -{ - for (size_t x = 0; x < ArraySize; x++) { - const QualifiedName& name = names[x]; - mapTagToFunc(map, name, func); - } -} - -PassRefPtr<Node> HTMLParser::getNode(Token* t) -{ - // Init our error handling table. - DEFINE_STATIC_LOCAL(FunctionMap, gFunctionMap, ()); - if (gFunctionMap.isEmpty()) { - QualifiedName nestedCreateErrorTags[] = { aTag, buttonTag, nobrTag, trTag }; - mapTagsToFunc(gFunctionMap, nestedCreateErrorTags, &HTMLParser::nestedCreateErrorCheck); - - QualifiedName nestedStyleCreateErrorTags[] = { bTag, bigTag, iTag, sTag, smallTag, strikeTag, ttTag, uTag }; - mapTagsToFunc(gFunctionMap, nestedStyleCreateErrorTags, &HTMLParser::nestedStyleCreateErrorCheck); - - QualifiedName pCloserCreateErrorTags[] = { addressTag, articleTag, - asideTag, blockquoteTag, centerTag, dirTag, divTag, dlTag, - fieldsetTag, footerTag, h1Tag, h2Tag, h3Tag, h4Tag, h5Tag, h6Tag, - headerTag, hgroupTag, hrTag, listingTag, menuTag, navTag, olTag, - pTag, plaintextTag, preTag, sectionTag, ulTag }; - mapTagsToFunc(gFunctionMap, pCloserCreateErrorTags, &HTMLParser::pCloserCreateErrorCheck); - - mapTagToFunc(gFunctionMap, bodyTag, &HTMLParser::bodyCreateErrorCheck); - mapTagToFunc(gFunctionMap, ddTag, &HTMLParser::ddCreateErrorCheck); - mapTagToFunc(gFunctionMap, dtTag, &HTMLParser::dtCreateErrorCheck); - mapTagToFunc(gFunctionMap, formTag, &HTMLParser::formCreateErrorCheck); - mapTagToFunc(gFunctionMap, framesetTag, &HTMLParser::framesetCreateErrorCheck); - mapTagToFunc(gFunctionMap, headTag, &HTMLParser::headCreateErrorCheck); - mapTagToFunc(gFunctionMap, isindexTag, &HTMLParser::isindexCreateErrorCheck); - mapTagToFunc(gFunctionMap, mapTag, &HTMLParser::mapCreateErrorCheck); - mapTagToFunc(gFunctionMap, liTag, &HTMLParser::nestedPCloserCreateErrorCheck); - mapTagToFunc(gFunctionMap, noembedTag, &HTMLParser::noembedCreateErrorCheck); - mapTagToFunc(gFunctionMap, noframesTag, &HTMLParser::noframesCreateErrorCheck); - mapTagToFunc(gFunctionMap, noscriptTag, &HTMLParser::noscriptCreateErrorCheck); - mapTagToFunc(gFunctionMap, tableTag, &HTMLParser::pCloserStrictCreateErrorCheck); - mapTagToFunc(gFunctionMap, rpTag, &HTMLParser::rpCreateErrorCheck); - mapTagToFunc(gFunctionMap, rtTag, &HTMLParser::rtCreateErrorCheck); - mapTagToFunc(gFunctionMap, selectTag, &HTMLParser::selectCreateErrorCheck); - mapTagToFunc(gFunctionMap, tdTag, &HTMLParser::tableCellCreateErrorCheck); - mapTagToFunc(gFunctionMap, thTag, &HTMLParser::tableCellCreateErrorCheck); - mapTagToFunc(gFunctionMap, tbodyTag, &HTMLParser::tableSectionCreateErrorCheck); - mapTagToFunc(gFunctionMap, tfootTag, &HTMLParser::tableSectionCreateErrorCheck); - mapTagToFunc(gFunctionMap, theadTag, &HTMLParser::tableSectionCreateErrorCheck); - - gFunctionMap.set(commentAtom.impl(), &HTMLParser::commentCreateErrorCheck); - gFunctionMap.set(textAtom.impl(), &HTMLParser::textCreateErrorCheck); - } - - bool proceed = true; - RefPtr<Node> result; - if (CreateErrorCheckFunc errorCheckFunc = gFunctionMap.get(t->tagName.impl())) - proceed = (this->*errorCheckFunc)(t, result); - if (proceed) - result = HTMLElementFactory::createHTMLElement(QualifiedName(nullAtom, t->tagName, xhtmlNamespaceURI), m_document, m_currentFormElement.get()); - return result.release(); -} - -bool HTMLParser::allowNestedRedundantTag(const AtomicString& tagName) -{ - // www.liceo.edu.mx is an example of a site that achieves a level of nesting of - // about 1500 tags, all from a bunch of <b>s. We will only allow at most 20 - // nested tags of the same type before just ignoring them all together. - unsigned i = 0; - for (HTMLStackElem* curr = m_blockStack; - i < cMaxRedundantTagDepth && curr && curr->tagName == tagName; - curr = curr->next, i++) { } - return i != cMaxRedundantTagDepth; -} - -void HTMLParser::processCloseTag(Token* t) -{ - // Support for really broken html. - // we never close the body tag, since some stupid web pages close it before the actual end of the doc. - // let's rely on the end() call to close things. - if (t->tagName == htmlTag || t->tagName == bodyTag || t->tagName == commentAtom) - return; - - bool checkForCloseTagErrors = true; - if (t->tagName == formTag && m_currentFormElement) { - m_currentFormElement = 0; - checkForCloseTagErrors = false; - } else if (t->tagName == mapTag) - m_currentMapElement = 0; - else if (t->tagName == pTag) - checkForCloseTagErrors = false; - - HTMLStackElem* oldElem = m_blockStack; - popBlock(t->tagName, checkForCloseTagErrors); - if (oldElem == m_blockStack && t->tagName == pTag) { - // We encountered a stray </p>. Amazingly Gecko, WinIE, and MacIE all treat - // this as a valid break, i.e., <p></p>. So go ahead and make the empty - // paragraph. - t->beginTag = true; - parseToken(t); - popBlock(t->tagName); - reportError(StrayParagraphCloseError); - } -} - -bool HTMLParser::isHeadingTag(const AtomicString& tagName) -{ - DEFINE_STATIC_LOCAL(TagNameSet, headingTags, ()); - if (headingTags.isEmpty()) { - QualifiedName tagNames[] = { h1Tag, h2Tag, h3Tag, h4Tag, h5Tag, h6Tag }; - addTags(headingTags, tagNames); - } - return headingTags.contains(tagName.impl()); -} - -bool HTMLParser::isInline(Node* node) const -{ - if (node->isTextNode()) - return true; - - if (node->isHTMLElement()) { - HTMLElement* e = static_cast<HTMLElement*>(node); - if (e->hasLocalName(aTag) || e->hasLocalName(fontTag) || e->hasLocalName(ttTag) || - e->hasLocalName(uTag) || e->hasLocalName(bTag) || e->hasLocalName(iTag) || - e->hasLocalName(sTag) || e->hasLocalName(strikeTag) || e->hasLocalName(bigTag) || - e->hasLocalName(smallTag) || e->hasLocalName(emTag) || e->hasLocalName(strongTag) || - e->hasLocalName(dfnTag) || e->hasLocalName(codeTag) || e->hasLocalName(sampTag) || - e->hasLocalName(kbdTag) || e->hasLocalName(varTag) || e->hasLocalName(citeTag) || - e->hasLocalName(abbrTag) || e->hasLocalName(acronymTag) || e->hasLocalName(subTag) || - e->hasLocalName(supTag) || e->hasLocalName(spanTag) || e->hasLocalName(nobrTag) || - e->hasLocalName(noframesTag) || e->hasLocalName(nolayerTag) || - e->hasLocalName(noembedTag)) - return true; -#if !ENABLE(XHTMLMP) - if (e->hasLocalName(noscriptTag) && !m_isParsingFragment) { - Frame* frame = m_document->frame(); - if (frame && frame->script()->canExecuteScripts(NotAboutToExecuteScript)) - return true; - } -#endif - } - - return false; -} - -bool HTMLParser::isResidualStyleTag(const AtomicString& tagName) -{ - DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, residualStyleTags, ()); - if (residualStyleTags.isEmpty()) { - QualifiedName tagNames[] = { aTag, fontTag, ttTag, uTag, bTag, iTag, - sTag, strikeTag, bigTag, smallTag, emTag, strongTag, dfnTag, - codeTag, sampTag, kbdTag, varTag, nobrTag }; - addTags(residualStyleTags, tagNames); - } - return residualStyleTags.contains(tagName.impl()); -} - -bool HTMLParser::isAffectedByResidualStyle(const AtomicString& tagName) -{ - DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, unaffectedTags, ()); - if (unaffectedTags.isEmpty()) { - QualifiedName tagNames[] = { bodyTag, tableTag, theadTag, tbodyTag, - tfootTag, trTag, thTag, tdTag, captionTag, colgroupTag, colTag, - optionTag, optgroupTag, selectTag, objectTag, datagridTag, datalistTag }; - addTags(unaffectedTags, tagNames); - } - return !unaffectedTags.contains(tagName.impl()); -} - -void HTMLParser::handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem* elem) -{ - HTMLStackElem* maxElem = 0; - bool finished = false; - bool strayTableContent = elem->strayTableContent; - - unsigned iterationCount = 0; - - m_handlingResidualStyleAcrossBlocks = true; - while (!finished && (iterationCount++ < cResidualStyleIterationLimit)) { - // Find the outermost element that crosses over to a higher level. If there exists another higher-level - // element, we will do another pass, until we have corrected the innermost one. - ExceptionCode ec = 0; - HTMLStackElem* curr = m_blockStack; - HTMLStackElem* prev = 0; - HTMLStackElem* prevMaxElem = 0; - maxElem = 0; - finished = true; - while (curr && curr != elem) { - if (curr->level > elem->level) { - if (!isAffectedByResidualStyle(curr->tagName)) - return; - if (maxElem) - // We will need another pass. - finished = false; - maxElem = curr; - prevMaxElem = prev; - } - - prev = curr; - curr = curr->next; - } - - if (!curr || !maxElem) - return; - - Node* residualElem = prev->node; - Node* blockElem = prevMaxElem ? prevMaxElem->node : m_current; - Node* parentElem = elem->node; - - // Check to see if the reparenting that is going to occur is allowed according to the DOM. - // FIXME: We should either always allow it or perform an additional fixup instead of - // just bailing here. - // Example: <p><font><center>blah</font></center></p> isn't doing a fixup right now. - if (!parentElem->childAllowed(blockElem)) - return; - - m_hasPElementInScope = Unknown; - - if (maxElem->node->parentNode() != elem->node) { - // Walk the stack and remove any elements that aren't residual style tags. These - // are basically just being closed up. Example: - // <font><span>Moo<p>Goo</font></p>. - // In the above example, the <span> doesn't need to be reopened. It can just close. - HTMLStackElem* currElem = maxElem->next; - HTMLStackElem* prevElem = maxElem; - while (currElem != elem) { - HTMLStackElem* nextElem = currElem->next; - if (!isResidualStyleTag(currElem->tagName)) { - prevElem->next = nextElem; - prevElem->derefNode(); - prevElem->node = currElem->node; - prevElem->didRefNode = currElem->didRefNode; - delete currElem; - m_treeDepth--; - } else - prevElem = currElem; - currElem = nextElem; - } - - // We have to reopen residual tags in between maxElem and elem. An example of this case is: - // <font><i>Moo<p>Foo</font>. - // In this case, we need to transform the part before the <p> into: - // <font><i>Moo</i></font><i> - // so that the <i> will remain open. This involves the modification of elements - // in the block stack. - // This will also affect how we ultimately reparent the block, since we want it to end up - // under the reopened residual tags (e.g., the <i> in the above example.) - RefPtr<Node> prevNode = 0; - currElem = maxElem; - while (currElem->node != residualElem) { - if (isResidualStyleTag(currElem->node->localName())) { - // Create a clone of this element. - // We call releaseRef to get a raw pointer since we plan to hand over ownership to currElem. - Node* currNode = currElem->node->cloneNode(false).releaseRef(); - reportError(ResidualStyleError, &currNode->localName()); - - // Change the stack element's node to point to the clone. - // The stack element adopts the reference we obtained above by calling release(). - currElem->derefNode(); - currElem->node = currNode; - currElem->didRefNode = true; - - // Attach the previous node as a child of this new node. - if (prevNode) - currNode->appendChild(prevNode, ec); - else // The new parent for the block element is going to be the innermost clone. - parentElem = currNode; // FIXME: We shifted parentElem to be a residual inline. We never checked to see if blockElem could be legally placed inside the inline though. - - prevNode = currNode; - } - - currElem = currElem->next; - } - - // Now append the chain of new residual style elements if one exists. - if (prevNode) - elem->node->appendChild(prevNode, ec); // FIXME: This append can result in weird stuff happening, like an inline chain being put into a table section. - } - - // Check if the block is still in the tree. If it isn't, then we don't - // want to remove it from its parent (that would crash) or insert it into - // a new parent later. See http://bugs.webkit.org/show_bug.cgi?id=6778 - bool isBlockStillInTree = blockElem->parentNode(); - - // We need to make a clone of |residualElem| and place it just inside |blockElem|. - // All content of |blockElem| is reparented to be under this clone. We then - // reparent |blockElem| using real DOM calls so that attachment/detachment will - // be performed to fix up the rendering tree. - // So for this example: <b>...<p>Foo</b>Goo</p> - // The end result will be: <b>...</b><p><b>Foo</b>Goo</p> - // - // Step 1: Remove |blockElem| from its parent, doing a batch detach of all the kids. - if (isBlockStillInTree) - blockElem->parentNode()->removeChild(blockElem, ec); - - Node* newNodePtr = 0; - if (blockElem->firstChild()) { - // Step 2: Clone |residualElem|. - RefPtr<Node> newNode = residualElem->cloneNode(false); // Shallow clone. We don't pick up the same kids. - newNodePtr = newNode.get(); - reportError(ResidualStyleError, &newNode->localName()); - - // Step 3: Place |blockElem|'s children under |newNode|. Remove all of the children of |blockElem| - // before we've put |newElem| into the document. That way we'll only do one attachment of all - // the new content (instead of a bunch of individual attachments). - Node* currNode = blockElem->firstChild(); - while (currNode) { - Node* nextNode = currNode->nextSibling(); - newNode->appendChild(currNode, ec); - currNode = nextNode; - } - - // Step 4: Place |newNode| under |blockElem|. |blockElem| is still out of the document, so no - // attachment can occur yet. - blockElem->appendChild(newNode.release(), ec); - } else - finished = true; - - // Step 5: Reparent |blockElem|. Now the full attachment of the fixed up tree takes place. - if (isBlockStillInTree) - parentElem->appendChild(blockElem, ec); - - // Step 6: Pull |elem| out of the stack, since it is no longer enclosing us. Also update - // the node associated with the previous stack element so that when it gets popped, - // it doesn't make the residual element the next current node. - HTMLStackElem* currElem = maxElem; - HTMLStackElem* prevElem = 0; - while (currElem != elem) { - prevElem = currElem; - currElem = currElem->next; - } - prevElem->next = elem->next; - prevElem->derefNode(); - prevElem->node = elem->node; - prevElem->didRefNode = elem->didRefNode; - m_treeDepth--; - if (!finished) { - // Repurpose |elem| to represent |newNode| and insert it at the appropriate position - // in the stack. We do not do this for the innermost block, because in that case the new - // node is effectively no longer open. - elem->next = maxElem; - elem->node = prevMaxElem->node; - elem->didRefNode = prevMaxElem->didRefNode; - elem->strayTableContent = false; - prevMaxElem->next = elem; - ASSERT(newNodePtr); - prevMaxElem->node = newNodePtr; - newNodePtr->ref(); - prevMaxElem->didRefNode = true; - m_treeDepth++; - } else - delete elem; - } - - // FIXME: If we ever make a case like this work: - // <table><b><i><form></b></form></i></table> - // Then this check will be too simplistic. Right now the <i><form> chain will end up inside the <tbody>, which is pretty crazy. - if (strayTableContent) - m_inStrayTableContent--; - - // Step 7: Reopen intermediate inlines, e.g., <b><p><i>Foo</b>Goo</p>. - // In the above example, Goo should stay italic. - // We cap the number of tags we're willing to reopen based off cResidualStyleMaxDepth. - - HTMLStackElem* curr = m_blockStack; - HTMLStackElem* residualStyleStack = 0; - unsigned stackDepth = 1; - unsigned redundantStyleCount = 0; - while (curr && curr != maxElem) { - // We will actually schedule this tag for reopening - // after we complete the close of this entire block. - if (isResidualStyleTag(curr->tagName) && stackDepth++ < cResidualStyleMaxDepth) { - // We've overloaded the use of stack elements and are just reusing the - // struct with a slightly different meaning to the variables. Instead of chaining - // from innermost to outermost, we build up a list of all the tags we need to reopen - // from the outermost to the innermost, i.e., residualStyleStack will end up pointing - // to the outermost tag we need to reopen. - // We also set curr->node to be the actual element that corresponds to the ID stored in - // curr->id rather than the node that you should pop to when the element gets pulled off - // the stack. - if (residualStyleStack && curr->tagName == residualStyleStack->tagName && curr->node->attributes()->mapsEquivalent(residualStyleStack->node->attributes())) - redundantStyleCount++; - else - redundantStyleCount = 0; - - if (redundantStyleCount < cMaxRedundantTagDepth) - moveOneBlockToStack(residualStyleStack); - else - popOneBlock(); - } else - popOneBlock(); - - curr = m_blockStack; - } - - reopenResidualStyleTags(residualStyleStack, 0); // Stray table content can't be an issue here, since some element above will always become the root of new stray table content. - - m_handlingResidualStyleAcrossBlocks = false; -} - -void HTMLParser::reopenResidualStyleTags(HTMLStackElem* elem, Node* malformedTableParent) -{ - // Loop for each tag that needs to be reopened. - while (elem) { - // Create a shallow clone of the DOM node for this element. - RefPtr<Node> newNode = elem->node->cloneNode(false); - reportError(ResidualStyleError, &newNode->localName()); - - // Append the new node. In the malformed table case, we need to insert before the table, - // which will be the last child. - ExceptionCode ec = 0; - if (malformedTableParent) - malformedTableParent->insertBefore(newNode, malformedTableParent->lastChild(), ec); - else - m_current->appendChild(newNode, ec); - // FIXME: Is it really OK to ignore the exceptions here? - - // Now push a new stack element for this node we just created. - pushBlock(elem->tagName, elem->level); - newNode->beginParsingChildren(); - - // Set our strayTableContent boolean if needed, so that the reopened tag also knows - // that it is inside a malformed table. - m_blockStack->strayTableContent = malformedTableParent != 0; - if (m_blockStack->strayTableContent) - m_inStrayTableContent++; - - // Clear our malformed table parent variable. - malformedTableParent = 0; - - // Update |current| manually to point to the new node. - setCurrent(newNode.get()); - - // Advance to the next tag that needs to be reopened. - HTMLStackElem* next = elem->next; - elem->derefNode(); - delete elem; - elem = next; - } -} - -void HTMLParser::pushBlock(const AtomicString& tagName, int level) -{ - m_blockStack = new HTMLStackElem(tagName, level, m_current, m_didRefCurrent, m_blockStack); - if (level >= minBlockLevelTagPriority) - m_blocksInStack++; - m_treeDepth++; - m_didRefCurrent = false; - if (tagName == pTag) - m_hasPElementInScope = InScope; - else if (isScopingTag(tagName)) - m_hasPElementInScope = NotInScope; -} - -void HTMLParser::popBlock(const AtomicString& tagName, bool reportErrors) -{ - HTMLStackElem* elem = m_blockStack; - - if (m_parserQuirks && elem && !m_parserQuirks->shouldPopBlock(elem->tagName, tagName)) - return; - - int maxLevel = 0; - - while (elem && (elem->tagName != tagName)) { - if (maxLevel < elem->level) - maxLevel = elem->level; - elem = elem->next; - } - - if (!elem) { - if (reportErrors) - reportError(StrayCloseTagError, &tagName, 0, true); - return; - } - - if (maxLevel > elem->level) { - // We didn't match because the tag is in a different scope, e.g., - // <b><p>Foo</b>. Try to correct the problem. - if (!isResidualStyleTag(tagName)) - return; - return handleResidualStyleCloseTagAcrossBlocks(elem); - } - - bool isAffectedByStyle = isAffectedByResidualStyle(elem->tagName); - HTMLStackElem* residualStyleStack = 0; - Node* malformedTableParent = 0; - - elem = m_blockStack; - unsigned stackDepth = 1; - unsigned redundantStyleCount = 0; - while (elem) { - if (elem->tagName == tagName) { - int strayTable = m_inStrayTableContent; - popOneBlock(); - elem = 0; - - // This element was the root of some malformed content just inside an implicit or - // explicit <tbody> or <tr>. - // If we end up needing to reopen residual style tags, the root of the reopened chain - // must also know that it is the root of malformed content inside a <tbody>/<tr>. - if (strayTable && (m_inStrayTableContent < strayTable) && residualStyleStack) { - Node* curr = m_current; - while (curr && !curr->hasTagName(tableTag)) - curr = curr->parentNode(); - malformedTableParent = curr ? curr->parentNode() : 0; - } - } - else { - if (m_currentFormElement && elem->tagName == formTag) - // A <form> is being closed prematurely (and this is - // malformed HTML). Set an attribute on the form to clear out its - // bottom margin. - m_currentFormElement->setMalformed(true); - - // Schedule this tag for reopening - // after we complete the close of this entire block. - if (isAffectedByStyle && isResidualStyleTag(elem->tagName) && stackDepth++ < cResidualStyleMaxDepth) { - // We've overloaded the use of stack elements and are just reusing the - // struct with a slightly different meaning to the variables. Instead of chaining - // from innermost to outermost, we build up a list of all the tags we need to reopen - // from the outermost to the innermost, i.e., residualStyleStack will end up pointing - // to the outermost tag we need to reopen. - // We also set elem->node to be the actual element that corresponds to the ID stored in - // elem->id rather than the node that you should pop to when the element gets pulled off - // the stack. - if (residualStyleStack && elem->tagName == residualStyleStack->tagName && elem->node->attributes()->mapsEquivalent(residualStyleStack->node->attributes())) - redundantStyleCount++; - else - redundantStyleCount = 0; - - if (redundantStyleCount < cMaxRedundantTagDepth) - moveOneBlockToStack(residualStyleStack); - else - popOneBlock(); - } else - popOneBlock(); - elem = m_blockStack; - } - } - - reopenResidualStyleTags(residualStyleStack, malformedTableParent); -} - -inline HTMLStackElem* HTMLParser::popOneBlockCommon() -{ - HTMLStackElem* elem = m_blockStack; - - // Form elements restore their state during the parsing process. - // Also, a few elements (<applet>, <object>) need to know when all child elements (<param>s) are available. - if (m_current && elem->node != m_current) - m_current->finishParsingChildren(); - - if (m_blockStack->level >= minBlockLevelTagPriority) { - ASSERT(m_blocksInStack > 0); - m_blocksInStack--; - } - m_treeDepth--; - m_blockStack = elem->next; - m_current = elem->node; - m_didRefCurrent = elem->didRefNode; - - if (elem->strayTableContent) - m_inStrayTableContent--; - - if (elem->tagName == pTag) - m_hasPElementInScope = NotInScope; - else if (isScopingTag(elem->tagName)) - m_hasPElementInScope = Unknown; - - return elem; -} - -void HTMLParser::popOneBlock() -{ - // Store the current node before popOneBlockCommon overwrites it. - Node* lastCurrent = m_current; - bool didRefLastCurrent = m_didRefCurrent; - - delete popOneBlockCommon(); - - if (didRefLastCurrent) - lastCurrent->deref(); -} - -void HTMLParser::moveOneBlockToStack(HTMLStackElem*& head) -{ - // We'll be using the stack element we're popping, but for the current node. - // See the two callers for details. - - // Store the current node before popOneBlockCommon overwrites it. - Node* lastCurrent = m_current; - bool didRefLastCurrent = m_didRefCurrent; - - // Pop the block, but don't deref the current node as popOneBlock does because - // we'll be using the pointer in the new stack element. - HTMLStackElem* elem = popOneBlockCommon(); - - // Transfer the current node into the stack element. - // No need to deref the old elem->node because popOneBlockCommon transferred - // it into the m_current/m_didRefCurrent fields. - elem->node = lastCurrent; - elem->didRefNode = didRefLastCurrent; - elem->next = head; - head = elem; -} - -void HTMLParser::checkIfHasPElementInScope() -{ - m_hasPElementInScope = NotInScope; - HTMLStackElem* elem = m_blockStack; - while (elem) { - const AtomicString& tagName = elem->tagName; - if (tagName == pTag) { - m_hasPElementInScope = InScope; - return; - } else if (isScopingTag(tagName)) - return; - elem = elem->next; - } -} - -void HTMLParser::popInlineBlocks() -{ - while (m_blockStack && isInline(m_current)) - popOneBlock(); -} - -void HTMLParser::freeBlock() -{ - while (m_blockStack) - popOneBlock(); - ASSERT(!m_blocksInStack); - ASSERT(!m_treeDepth); -} - -void HTMLParser::createHead() -{ - if (m_head) - return; - - if (!m_document->documentElement() && !m_isParsingFragment) { - insertNode(HTMLHtmlElement::create(m_document).get()); - ASSERT(m_document->documentElement() || m_isParsingFragment); - } - - m_head = HTMLHeadElement::create(m_document); - - if (m_isParsingFragment) - return; - - HTMLElement* body = m_document->body(); - ExceptionCode ec = 0; - m_document->documentElement()->insertBefore(m_head.get(), body, ec); - if (ec) - m_head = 0; - - // If the body does not exist yet, then the <head> should be pushed as the current block. - if (m_head && !body) { - pushBlock(m_head->localName(), m_head->tagPriority()); - setCurrent(m_head.get()); - } -} - -PassRefPtr<Node> HTMLParser::handleIsindex(Token* t) -{ - RefPtr<Node> n = HTMLDivElement::create(m_document); - - NamedNodeMap* attrs = t->attrs.get(); - - RefPtr<HTMLIsIndexElement> isIndex = HTMLIsIndexElement::create(m_document, m_currentFormElement.get()); - isIndex->setAttributeMap(attrs); - isIndex->setAttribute(typeAttr, "khtml_isindex"); - - String text = searchableIndexIntroduction(); - if (attrs) { - if (Attribute* a = attrs->getAttributeItem(promptAttr)) - text = a->value().string() + " "; - t->attrs = 0; - } - - n->addChild(HTMLHRElement::create(m_document)); - n->addChild(Text::create(m_document, text)); - n->addChild(isIndex.release()); - n->addChild(HTMLHRElement::create(m_document)); - - return n.release(); -} - -void HTMLParser::startBody() -{ - if (m_inBody) - return; - - m_inBody = true; - - if (m_isindexElement) { - insertNode(m_isindexElement.get(), true /* don't descend into this node */); - m_isindexElement = 0; - } -} - -void HTMLParser::finished() -{ - // In the case of a completely empty document, here's the place to create the HTML element. - if (m_current && m_current->isDocumentNode() && !m_document->documentElement()) - insertNode(HTMLHtmlElement::create(m_document).get()); - - // This ensures that "current" is not left pointing to a node when the document is destroyed. - freeBlock(); - setCurrent(0); - - // Warning, this may delete the tokenizer and parser, so don't try to do anything else after this. - if (!m_isParsingFragment) - m_document->finishedParsing(); -} - -void HTMLParser::reportErrorToConsole(HTMLParserErrorCode errorCode, const AtomicString* tagName1, const AtomicString* tagName2, bool closeTags) -{ - Frame* frame = m_document->frame(); - if (!frame) - return; - - HTMLTokenizer* htmlTokenizer = static_cast<HTMLTokenizer*>(m_document->tokenizer()); - int lineNumber = htmlTokenizer->lineNumber() + 1; - - AtomicString tag1; - AtomicString tag2; - if (tagName1) { - if (*tagName1 == "#text") - tag1 = "Text"; - else if (*tagName1 == "#comment") - tag1 = "<!-- comment -->"; - else - tag1 = (closeTags ? "</" : "<") + *tagName1 + ">"; - } - if (tagName2) { - if (*tagName2 == "#text") - tag2 = "Text"; - else if (*tagName2 == "#comment") - tag2 = "<!-- comment -->"; - else - tag2 = (closeTags ? "</" : "<") + *tagName2 + ">"; - } - - const char* errorMsg = htmlParserErrorMessageTemplate(errorCode); - if (!errorMsg) - return; - - String message; - if (htmlTokenizer->processingContentWrittenByScript()) - message += htmlParserDocumentWriteMessage(); - message += errorMsg; - message.replace("%tag1", tag1); - message.replace("%tag2", tag2); - - frame->domWindow()->console()->addMessage(HTMLMessageSource, LogMessageType, - isWarning(errorCode) ? WarningMessageLevel : ErrorMessageLevel, - message, lineNumber, m_document->url().string()); -} - -#ifdef BUILDING_ON_LEOPARD -bool shouldCreateImplicitHead(Document* document) -{ - ASSERT(document); - - Settings* settings = document->page() ? document->page()->settings() : 0; - return settings ? !settings->needsLeopardMailQuirks() : true; -} -#elif defined(BUILDING_ON_TIGER) -bool shouldCreateImplicitHead(Document* document) -{ - ASSERT(document); - - Settings* settings = document->page() ? document->page()->settings() : 0; - return settings ? !settings->needsTigerMailQuirks() : true; -} -#endif - - -String serializeForNumberType(double number) -{ - // According to HTML5, "the best representation of the number n as a floating - // point number" is a string produced by applying ToString() to n. - DtoaBuffer buffer; - unsigned length; - doubleToStringInJavaScriptFormat(number, buffer, &length); - return String(buffer, length); -} - -bool parseToDoubleForNumberType(const String& src, double* out) -{ - // See HTML5 2.4.4.3 `Real numbers.' - - if (src.isEmpty()) - return false; - // String::toDouble() accepts leading + \t \n \v \f \r and SPACE, which are invalid in HTML5. - // So, check the first character. - if (src[0] != '-' && (src[0] < '0' || src[0] > '9')) - return false; - - bool valid = false; - double value = src.toDouble(&valid); - if (!valid) - return false; - // NaN and Infinity are not valid numbers according to the standard. - if (!isfinite(value)) - return false; - // -0 -> 0 - if (!value) - value = 0; - if (out) - *out = value; - return true; -} - -} diff --git a/WebCore/html/HTMLParser.h b/WebCore/html/HTMLParser.h deleted file mode 100644 index 028836c..0000000 --- a/WebCore/html/HTMLParser.h +++ /dev/null @@ -1,214 +0,0 @@ -/* - Copyright (C) 1997 Martin Jones (mjones@kde.org) - (C) 1997 Torben Weis (weis@kde.org) - (C) 1998 Waldo Bastian (bastian@kde.org) - (C) 1999 Lars Knoll (knoll@kde.org) - Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - 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 HTMLParser_h -#define HTMLParser_h - -#include "QualifiedName.h" -#include <wtf/Forward.h> -#include <wtf/OwnPtr.h> -#include <wtf/RefPtr.h> -#include "HTMLParserErrorCodes.h" -#include "MappedAttributeEntry.h" - -namespace WebCore { - -class DoctypeToken; -class Document; -class DocumentFragment; -class HTMLDocument; -class HTMLFormElement; -class HTMLHeadElement; -class HTMLMapElement; -class HTMLParserQuirks; -class Node; - -struct HTMLStackElem; -struct Token; - -/** - * The parser for HTML. It receives a stream of tokens from the HTMLTokenizer, and - * builds up the Document structure from it. - */ -class HTMLParser : public Noncopyable { -public: - HTMLParser(HTMLDocument*, bool reportErrors); - HTMLParser(DocumentFragment*, FragmentScriptingPermission = FragmentScriptingAllowed); - virtual ~HTMLParser(); - - /** - * parses one token delivered by the tokenizer - */ - PassRefPtr<Node> parseToken(Token*); - - // Parses a doctype token. - void parseDoctypeToken(DoctypeToken*); - - /** - * tokenizer says it's not going to be sending us any more tokens - */ - void finished(); - - /** - * resets the parser - */ - void reset(); - - bool skipMode() const { return !m_skipModeTag.isNull(); } - bool isHandlingResidualStyleAcrossBlocks() const { return m_handlingResidualStyleAcrossBlocks; } - -private: - void setCurrent(Node*); - void derefCurrent(); - void setSkipMode(const QualifiedName& qName) { m_skipModeTag = qName.localName(); } - - PassRefPtr<Node> getNode(Token*); - bool bodyCreateErrorCheck(Token*, RefPtr<Node>&); - bool canvasCreateErrorCheck(Token*, RefPtr<Node>&); - bool commentCreateErrorCheck(Token*, RefPtr<Node>&); - bool ddCreateErrorCheck(Token*, RefPtr<Node>&); - bool dtCreateErrorCheck(Token*, RefPtr<Node>&); - bool formCreateErrorCheck(Token*, RefPtr<Node>&); - bool framesetCreateErrorCheck(Token*, RefPtr<Node>&); - bool headCreateErrorCheck(Token*, RefPtr<Node>&); - bool iframeCreateErrorCheck(Token*, RefPtr<Node>&); - bool isindexCreateErrorCheck(Token*, RefPtr<Node>&); - bool mapCreateErrorCheck(Token*, RefPtr<Node>&); - bool nestedCreateErrorCheck(Token*, RefPtr<Node>&); - bool nestedPCloserCreateErrorCheck(Token*, RefPtr<Node>&); - bool nestedStyleCreateErrorCheck(Token*, RefPtr<Node>&); - bool noembedCreateErrorCheck(Token*, RefPtr<Node>&); - bool noframesCreateErrorCheck(Token*, RefPtr<Node>&); - bool nolayerCreateErrorCheck(Token*, RefPtr<Node>&); - bool noscriptCreateErrorCheck(Token*, RefPtr<Node>&); - bool pCloserCreateErrorCheck(Token*, RefPtr<Node>&); - bool pCloserStrictCreateErrorCheck(Token*, RefPtr<Node>&); - bool rpCreateErrorCheck(Token*, RefPtr<Node>&); - bool rtCreateErrorCheck(Token*, RefPtr<Node>&); - bool selectCreateErrorCheck(Token*, RefPtr<Node>&); - bool tableCellCreateErrorCheck(Token*, RefPtr<Node>&); - bool tableSectionCreateErrorCheck(Token*, RefPtr<Node>&); - bool textCreateErrorCheck(Token*, RefPtr<Node>&); - - void processCloseTag(Token*); - - void limitDepth(int tagPriority); - bool insertNodeAfterLimitDepth(Node*, bool flat = false); - bool insertNode(Node*, bool flat = false); - bool handleError(Node*, bool flat, const AtomicString& localName, int tagPriority); - - void pushBlock(const AtomicString& tagName, int level); - void popBlock(const AtomicString& tagName, bool reportErrors = false); - void popBlock(const QualifiedName& qName, bool reportErrors = false) { return popBlock(qName.localName(), reportErrors); } // Convenience function for readability. - void popOneBlock(); - void moveOneBlockToStack(HTMLStackElem*& head); - inline HTMLStackElem* popOneBlockCommon(); - void popInlineBlocks(); - - void freeBlock(); - - void createHead(); - - static bool isResidualStyleTag(const AtomicString& tagName); - static bool isAffectedByResidualStyle(const AtomicString& tagName); - void handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem*); - void reopenResidualStyleTags(HTMLStackElem*, Node* malformedTableParent); - - bool allowNestedRedundantTag(const AtomicString& tagName); - - static bool isHeadingTag(const AtomicString& tagName); - - bool isInline(Node*) const; - - void startBody(); // inserts the isindex element - PassRefPtr<Node> handleIsindex(Token*); - - void checkIfHasPElementInScope(); - bool hasPElementInScope() - { - if (m_hasPElementInScope == Unknown) - checkIfHasPElementInScope(); - return m_hasPElementInScope == InScope; - } - - void reportError(HTMLParserErrorCode errorCode, const AtomicString* tagName1 = 0, const AtomicString* tagName2 = 0, bool closeTags = false) - { if (!m_reportErrors) return; reportErrorToConsole(errorCode, tagName1, tagName2, closeTags); } - - void reportErrorToConsole(HTMLParserErrorCode, const AtomicString* tagName1, const AtomicString* tagName2, bool closeTags); - - Document* m_document; - - // The currently active element (the one new elements will be added to). Can be a document fragment, a document or an element. - Node* m_current; - // We can't ref a document, but we don't want to constantly check if a node is a document just to decide whether to deref. - bool m_didRefCurrent; - - HTMLStackElem* m_blockStack; - - // The number of tags with priority minBlockLevelTagPriority or higher - // currently in m_blockStack. The parser enforces a cap on this value by - // adding such new elements as siblings instead of children once it is reached. - size_t m_blocksInStack; - // Depth of the tree. - unsigned m_treeDepth; - - enum ElementInScopeState { NotInScope, InScope, Unknown }; - ElementInScopeState m_hasPElementInScope; - - RefPtr<HTMLFormElement> m_currentFormElement; // currently active form - RefPtr<HTMLMapElement> m_currentMapElement; // current map - RefPtr<HTMLHeadElement> m_head; // head element; needed for HTML which defines <base> after </head> - RefPtr<Node> m_isindexElement; // a possible <isindex> element in the head - - bool m_inBody; - bool m_haveContent; - bool m_haveFrameSet; - - AtomicString m_skipModeTag; // tells the parser to discard all tags until it reaches the one specified - - bool m_isParsingFragment; - bool m_reportErrors; - bool m_handlingResidualStyleAcrossBlocks; - int m_inStrayTableContent; - FragmentScriptingPermission m_scriptingPermission; - - OwnPtr<HTMLParserQuirks> m_parserQuirks; -}; - -#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_TIGER) -bool shouldCreateImplicitHead(Document*); -#else -inline bool shouldCreateImplicitHead(Document*) { return true; } -#endif - -// Converts the specified string to a floating number. -// If the conversion fails, the return value is false. Take care that leading or trailing unnecessary characters make failures. This returns false for an empty string input. -// The double* parameter may be 0. -bool parseToDoubleForNumberType(const String&, double*); -// Converts the specified number to a string. This is an implementation of -// HTML5's "algorithm to convert a number to a string" for NUMBER/RANGE types. -String serializeForNumberType(double); - -} - -#endif // HTMLParser_h diff --git a/WebCore/html/HTMLProgressElement.cpp b/WebCore/html/HTMLProgressElement.cpp index d275ebf..22226d9 100644 --- a/WebCore/html/HTMLProgressElement.cpp +++ b/WebCore/html/HTMLProgressElement.cpp @@ -24,10 +24,11 @@ #include "Attribute.h" #include "EventNames.h" +#include "ExceptionCode.h" #include "FormDataList.h" #include "HTMLFormElement.h" #include "HTMLNames.h" -#include "HTMLParser.h" +#include "LegacyHTMLTreeConstructor.h" #include "RenderProgress.h" #include <wtf/StdLibExtras.h> diff --git a/WebCore/html/HTMLTokenizer.cpp b/WebCore/html/HTMLTokenizer.cpp deleted file mode 100644 index e3d3ce6..0000000 --- a/WebCore/html/HTMLTokenizer.cpp +++ /dev/null @@ -1,2134 +0,0 @@ -/* - Copyright (C) 1997 Martin Jones (mjones@kde.org) - (C) 1997 Torben Weis (weis@kde.org) - (C) 1998 Waldo Bastian (bastian@kde.org) - (C) 1999 Lars Knoll (knoll@kde.org) - (C) 1999 Antti Koivisto (koivisto@kde.org) - (C) 2001 Dirk Mueller (mueller@kde.org) - Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. - Copyright (C) 2005, 2006 Alexey Proskuryakov (ap@nypop.com) - Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) - - 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 "HTMLTokenizer.h" - -#include "Attribute.h" -#include "CSSHelper.h" -#include "Cache.h" -#include "CachedScript.h" -#include "DocLoader.h" -#include "DocumentFragment.h" -#include "Event.h" -#include "EventNames.h" -#include "Frame.h" -#include "FrameLoader.h" -#include "FrameView.h" -#include "HTMLElement.h" -#include "HTMLNames.h" -#include "HTMLParser.h" -#include "HTMLScriptElement.h" -#include "HTMLViewSourceDocument.h" -#include "ImageLoader.h" -#include "InspectorTimelineAgent.h" -#include "Page.h" -#include "PreloadScanner.h" -#include "ScriptController.h" -#include "ScriptSourceCode.h" -#include "ScriptValue.h" -#include "XSSAuditor.h" -#include <wtf/ASCIICType.h> -#include <wtf/CurrentTime.h> - -#include "HTMLEntityNames.c" - -#ifdef ANDROID_INSTRUMENT -#include "TimeCounter.h" -#endif - -#define PRELOAD_SCANNER_ENABLED 1 - -using namespace WTF; -using namespace std; - -namespace WebCore { - -using namespace HTMLNames; - -// This value is used to define how many characters the tokenizer will process before -// yeilding control. -// To increase responsivness reduce the tokenizer chunk size. -static const int defaultTokenizerChunkSize = 4096; - -// FIXME: We would like this constant to be 200ms. -// Yielding more aggressively results in increased responsiveness and better incremental rendering. -// It slows down overall page-load on slower machines, though, so for now we set a value of 500. -// For smaller chunks (above) decrease the value of TimerDelay as the the tokenizer should not -// yield for as long a period otherwise it will take way to long to load a page. -static const double defaultTokenizerTimeDelay = 0.500; - -static const char commentStart [] = "<!--"; -static const char doctypeStart [] = "<!doctype"; -static const char publicStart [] = "public"; -static const char systemStart [] = "system"; -static const char scriptEnd [] = "</script"; -static const char xmpEnd [] = "</xmp"; -static const char styleEnd [] = "</style"; -static const char textareaEnd [] = "</textarea"; -static const char titleEnd [] = "</title"; -static const char iframeEnd [] = "</iframe"; - -// Full support for MS Windows extensions to Latin-1. -// Technically these extensions should only be activated for pages -// marked "windows-1252" or "cp1252", but -// in the standard Microsoft way, these extensions infect hundreds of thousands -// of web pages. Note that people with non-latin-1 Microsoft extensions -// are SOL. -// -// See: http://www.microsoft.com/globaldev/reference/WinCP.asp -// http://www.bbsinc.com/iso8859.html -// http://www.obviously.com/ -// -// There may be better equivalents - -// We only need this for entities. For non-entity text, we handle this in the text encoding. - -static const UChar windowsLatin1ExtensionArray[32] = { - 0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, // 80-87 - 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008D, 0x017D, 0x008F, // 88-8F - 0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, // 90-97 - 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x009D, 0x017E, 0x0178 // 98-9F -}; - -static inline UChar fixUpChar(UChar c) -{ - if ((c & ~0x1F) != 0x0080) - return c; - return windowsLatin1ExtensionArray[c - 0x80]; -} - -static inline bool tagMatch(const char* s1, const UChar* s2, unsigned length) -{ - for (unsigned i = 0; i != length; ++i) { - unsigned char c1 = s1[i]; - unsigned char uc1 = toASCIIUpper(static_cast<char>(c1)); - UChar c2 = s2[i]; - if (c1 != c2 && uc1 != c2) - return false; - } - return true; -} - -inline void Token::addAttribute(AtomicString& attrName, const AtomicString& attributeValue, bool viewSourceMode) -{ - if (!attrName.isEmpty()) { - ASSERT(!attrName.contains('/')); - RefPtr<Attribute> a = Attribute::createMapped(attrName, attributeValue); - if (!attrs) { - attrs = NamedNodeMap::create(); - attrs->reserveInitialCapacity(10); - } - attrs->insertAttribute(a.release(), viewSourceMode); - } - - attrName = emptyAtom; -} - -// ---------------------------------------------------------------------------- - -HTMLTokenizer::HTMLTokenizer(HTMLDocument* doc, bool reportErrors) - : Tokenizer() - , m_buffer(0) - , m_scriptCode(0) - , m_scriptCodeSize(0) - , m_scriptCodeCapacity(0) - , m_scriptCodeResync(0) - , m_executingScript(0) - , m_requestingScript(false) - , m_hasScriptsWaitingForStylesheets(false) - , m_timer(this, &HTMLTokenizer::timerFired) - , m_externalScriptsTimer(this, &HTMLTokenizer::executeExternalScriptsTimerFired) - , m_doc(doc) - , m_parser(new HTMLParser(doc, reportErrors)) - , m_inWrite(false) - , m_fragment(false) - , m_scriptingPermission(FragmentScriptingAllowed) -{ - begin(); -} - -HTMLTokenizer::HTMLTokenizer(HTMLViewSourceDocument* doc) - : Tokenizer(true) - , m_buffer(0) - , m_scriptCode(0) - , m_scriptCodeSize(0) - , m_scriptCodeCapacity(0) - , m_scriptCodeResync(0) - , m_executingScript(0) - , m_requestingScript(false) - , m_hasScriptsWaitingForStylesheets(false) - , m_timer(this, &HTMLTokenizer::timerFired) - , m_externalScriptsTimer(this, &HTMLTokenizer::executeExternalScriptsTimerFired) - , m_doc(doc) - , m_parser(0) - , m_inWrite(false) - , m_fragment(false) - , m_scriptingPermission(FragmentScriptingAllowed) -{ - begin(); -} - -HTMLTokenizer::HTMLTokenizer(DocumentFragment* frag, FragmentScriptingPermission scriptingPermission) - : m_buffer(0) - , m_scriptCode(0) - , m_scriptCodeSize(0) - , m_scriptCodeCapacity(0) - , m_scriptCodeResync(0) - , m_executingScript(0) - , m_requestingScript(false) - , m_hasScriptsWaitingForStylesheets(false) - , m_timer(this, &HTMLTokenizer::timerFired) - , m_externalScriptsTimer(this, &HTMLTokenizer::executeExternalScriptsTimerFired) - , m_doc(frag->document()) - , m_parser(new HTMLParser(frag, scriptingPermission)) - , m_inWrite(false) - , m_fragment(true) - , m_scriptingPermission(scriptingPermission) -{ - begin(); -} - -void HTMLTokenizer::reset() -{ - ASSERT(m_executingScript == 0); - - while (!m_pendingScripts.isEmpty()) { - CachedScript* cs = m_pendingScripts.first().get(); - m_pendingScripts.removeFirst(); - ASSERT(cache()->disabled() || cs->accessCount() > 0); - cs->removeClient(this); - } - - fastFree(m_buffer); - m_buffer = m_dest = 0; - m_bufferSize = 0; - - fastFree(m_scriptCode); - m_scriptCode = 0; - m_scriptCodeSize = m_scriptCodeCapacity = m_scriptCodeResync = 0; - - m_timer.stop(); - m_externalScriptsTimer.stop(); - - m_state.setAllowYield(false); - m_state.setForceSynchronous(false); - - m_currentToken.reset(); - m_doctypeToken.reset(); - m_doctypeSearchCount = 0; - m_doctypeSecondarySearchCount = 0; - m_hasScriptsWaitingForStylesheets = false; -} - -void HTMLTokenizer::begin() -{ - m_executingScript = 0; - m_requestingScript = false; - m_hasScriptsWaitingForStylesheets = false; - m_state.setLoadingExtScript(false); - reset(); - m_bufferSize = 254; - m_buffer = static_cast<UChar*>(fastMalloc(sizeof(UChar) * 254)); - m_dest = m_buffer; - tquote = NoQuote; - searchCount = 0; - m_state.setEntityState(NoEntity); - m_scriptTagSrcAttrValue = String(); - m_pendingSrc.clear(); - m_currentPrependingSrc = 0; - m_noMoreData = false; - m_brokenComments = false; - m_brokenServer = false; - m_lineNumber = 0; - m_currentScriptTagStartLineNumber = 0; - m_currentTagStartLineNumber = 0; - m_state.setForceSynchronous(false); - - Page* page = m_doc->page(); - if (page && page->hasCustomHTMLTokenizerTimeDelay()) - m_tokenizerTimeDelay = page->customHTMLTokenizerTimeDelay(); - else - m_tokenizerTimeDelay = defaultTokenizerTimeDelay; - - if (page && page->hasCustomHTMLTokenizerChunkSize()) - m_tokenizerChunkSize = page->customHTMLTokenizerChunkSize(); - else - m_tokenizerChunkSize = defaultTokenizerChunkSize; -} - -void HTMLTokenizer::setForceSynchronous(bool force) -{ - m_state.setForceSynchronous(force); -} - -HTMLTokenizer::State HTMLTokenizer::processListing(SegmentedString list, State state) -{ - // This function adds the listing 'list' as - // preformatted text-tokens to the token-collection - while (!list.isEmpty()) { - if (state.skipLF()) { - state.setSkipLF(false); - if (*list == '\n') { - list.advance(); - continue; - } - } - - checkBuffer(); - - if (*list == '\n' || *list == '\r') { - if (state.discardLF()) - // Ignore this LF - state.setDiscardLF(false); // We have discarded 1 LF - else - *m_dest++ = '\n'; - - /* Check for MS-DOS CRLF sequence */ - if (*list == '\r') - state.setSkipLF(true); - - list.advance(); - } else { - state.setDiscardLF(false); - *m_dest++ = *list; - list.advance(); - } - } - - return state; -} - -HTMLTokenizer::State HTMLTokenizer::parseNonHTMLText(SegmentedString& src, State state) -{ - ASSERT(state.inTextArea() || state.inTitle() || state.inIFrame() || !state.hasEntityState()); - ASSERT(!state.hasTagState()); - ASSERT(state.inXmp() + state.inTextArea() + state.inTitle() + state.inStyle() + state.inScript() + state.inIFrame() == 1); - if (state.inScript() && !m_currentScriptTagStartLineNumber) - m_currentScriptTagStartLineNumber = m_lineNumber; - - if (state.inComment()) - state = parseComment(src, state); - - int lastDecodedEntityPosition = -1; - while (!src.isEmpty()) { - checkScriptBuffer(); - UChar ch = *src; - - if (!m_scriptCodeResync && !m_brokenComments && - !state.inXmp() && ch == '-' && m_scriptCodeSize >= 3 && !src.escaped() && - m_scriptCode[m_scriptCodeSize - 3] == '<' && m_scriptCode[m_scriptCodeSize - 2] == '!' && m_scriptCode[m_scriptCodeSize - 1] == '-' && - (lastDecodedEntityPosition < m_scriptCodeSize - 3)) { - state.setInComment(true); - state = parseComment(src, state); - continue; - } - if (m_scriptCodeResync && !tquote && ch == '>') { - src.advancePastNonNewline(); - m_scriptCodeSize = m_scriptCodeResync - 1; - m_scriptCodeResync = 0; - m_scriptCode[m_scriptCodeSize] = m_scriptCode[m_scriptCodeSize + 1] = 0; - if (state.inScript()) - state = scriptHandler(state); - else { - state = processListing(SegmentedString(m_scriptCode, m_scriptCodeSize), state); - processToken(); - if (state.inStyle()) { - m_currentToken.tagName = styleTag.localName(); - m_currentToken.beginTag = false; - } else if (state.inTextArea()) { - m_currentToken.tagName = textareaTag.localName(); - m_currentToken.beginTag = false; - } else if (state.inTitle()) { - m_currentToken.tagName = titleTag.localName(); - m_currentToken.beginTag = false; - } else if (state.inXmp()) { - m_currentToken.tagName = xmpTag.localName(); - m_currentToken.beginTag = false; - } else if (state.inIFrame()) { - m_currentToken.tagName = iframeTag.localName(); - m_currentToken.beginTag = false; - } - processToken(); - state.setInStyle(false); - state.setInScript(false); - state.setInTextArea(false); - state.setInTitle(false); - state.setInXmp(false); - state.setInIFrame(false); - tquote = NoQuote; - m_scriptCodeSize = m_scriptCodeResync = 0; - } - return state; - } - // possible end of tagname, lets check. - if (!m_scriptCodeResync && !state.escaped() && !src.escaped() && (ch == '>' || ch == '/' || isASCIISpace(ch)) && - m_scriptCodeSize >= m_searchStopperLength && - tagMatch(m_searchStopper, m_scriptCode + m_scriptCodeSize - m_searchStopperLength, m_searchStopperLength) && - (lastDecodedEntityPosition < m_scriptCodeSize - m_searchStopperLength)) { - m_scriptCodeResync = m_scriptCodeSize-m_searchStopperLength+1; - tquote = NoQuote; - continue; - } - if (m_scriptCodeResync && !state.escaped()) { - if (ch == '\"') - tquote = (tquote == NoQuote) ? DoubleQuote : ((tquote == SingleQuote) ? SingleQuote : NoQuote); - else if (ch == '\'') - tquote = (tquote == NoQuote) ? SingleQuote : (tquote == DoubleQuote) ? DoubleQuote : NoQuote; - else if (tquote != NoQuote && (ch == '\r' || ch == '\n')) - tquote = NoQuote; - } - state.setEscaped(!state.escaped() && ch == '\\'); - if (!m_scriptCodeResync && (state.inTextArea() || state.inTitle() || state.inIFrame()) && !src.escaped() && ch == '&') { - UChar* scriptCodeDest = m_scriptCode + m_scriptCodeSize; - src.advancePastNonNewline(); - state = parseEntity(src, scriptCodeDest, state, m_cBufferPos, true, false); - if (scriptCodeDest == m_scriptCode + m_scriptCodeSize) - lastDecodedEntityPosition = m_scriptCodeSize; - else - m_scriptCodeSize = scriptCodeDest - m_scriptCode; - } else { - m_scriptCode[m_scriptCodeSize++] = ch; - src.advance(m_lineNumber); - } - } - - return state; -} - -HTMLTokenizer::State HTMLTokenizer::scriptHandler(State state) -{ - // We are inside a <script> - bool doScriptExec = false; - int startLine = m_currentScriptTagStartLineNumber + 1; // Script line numbers are 1 based, HTMLTokenzier line numbers are 0 based - - // Reset m_currentScriptTagStartLineNumber to indicate that we've finished parsing the current script element - m_currentScriptTagStartLineNumber = 0; - - // (Bugzilla 3837) Scripts following a frameset element should not execute or, - // in the case of extern scripts, even load. - bool followingFrameset = (m_doc->body() && m_doc->body()->hasTagName(framesetTag)); - - CachedScript* cs = 0; - // don't load external scripts for standalone documents (for now) - if (!inViewSourceMode()) { - if (!m_scriptTagSrcAttrValue.isEmpty() && m_doc->frame()) { - // forget what we just got; load from src url instead - if (!m_parser->skipMode() && !followingFrameset) { - // The parser might have been stopped by for example a window.close call in an earlier script. - // If so, we don't want to load scripts. - if (!m_parserStopped && m_scriptNode->dispatchBeforeLoadEvent(m_scriptTagSrcAttrValue) && - (cs = m_doc->docLoader()->requestScript(m_scriptTagSrcAttrValue, m_scriptTagCharsetAttrValue))) - m_pendingScripts.append(cs); - else - m_scriptNode = 0; - } else - m_scriptNode = 0; - m_scriptTagSrcAttrValue = String(); - } else { - // Parse m_scriptCode containing <script> info - doScriptExec = m_scriptNode->shouldExecuteAsJavaScript(); -#if ENABLE(XHTMLMP) - if (!doScriptExec) - m_doc->setShouldProcessNoscriptElement(true); -#endif - m_scriptNode = 0; - } - } - - state = processListing(SegmentedString(m_scriptCode, m_scriptCodeSize), state); - RefPtr<Node> node = processToken(); - - if (node && m_scriptingPermission == FragmentScriptingNotAllowed) { - ExceptionCode ec; - node->remove(ec); - node = 0; - } - - String scriptString = node ? node->textContent() : ""; - m_currentToken.tagName = scriptTag.localName(); - m_currentToken.beginTag = false; - processToken(); - - state.setInScript(false); - m_scriptCodeSize = m_scriptCodeResync = 0; - - // FIXME: The script should be syntax highlighted. - if (inViewSourceMode()) - return state; - - SegmentedString* savedPrependingSrc = m_currentPrependingSrc; - SegmentedString prependingSrc; - m_currentPrependingSrc = &prependingSrc; - -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::recordNoCounter(android::TimeCounter::ParsingTimeCounter, __FUNCTION__); -#endif - - if (!m_parser->skipMode() && !followingFrameset) { - if (cs) { - if (savedPrependingSrc) - savedPrependingSrc->append(m_src); - else - m_pendingSrc.prepend(m_src); - setSrc(SegmentedString()); - - // the ref() call below may call notifyFinished if the script is already in cache, - // and that mucks with the state directly, so we must write it back to the object. - m_state = state; - bool savedRequestingScript = m_requestingScript; - m_requestingScript = true; - cs->addClient(this); - m_requestingScript = savedRequestingScript; - state = m_state; - // will be 0 if script was already loaded and ref() executed it - if (!m_pendingScripts.isEmpty()) - state.setLoadingExtScript(true); - } else if (!m_fragment && doScriptExec) { - if (!m_executingScript) - m_pendingSrc.prepend(m_src); - else - prependingSrc = m_src; - setSrc(SegmentedString()); - state = scriptExecution(ScriptSourceCode(scriptString, m_doc->frame() ? m_doc->frame()->document()->url() : KURL(), startLine), state); - } - } - -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::start(android::TimeCounter::ParsingTimeCounter); -#endif - - if (!m_executingScript && !state.loadingExtScript()) { - m_src.append(m_pendingSrc); - m_pendingSrc.clear(); - } else if (!prependingSrc.isEmpty()) { - // restore first so that the write appends in the right place - // (does not hurt to do it again below) - m_currentPrependingSrc = savedPrependingSrc; - - // we need to do this slightly modified bit of one of the write() cases - // because we want to prepend to m_pendingSrc rather than appending - // if there's no previous prependingSrc - if (!m_pendingScripts.isEmpty()) { - if (m_currentPrependingSrc) - m_currentPrependingSrc->append(prependingSrc); - else - m_pendingSrc.prepend(prependingSrc); - } else { - m_state = state; - write(prependingSrc, false); - state = m_state; - } - } - -#if PRELOAD_SCANNER_ENABLED - if (!m_pendingScripts.isEmpty() && !m_executingScript) { - if (!m_preloadScanner) - m_preloadScanner.set(new PreloadScanner(m_doc)); - if (!m_preloadScanner->inProgress()) { - m_preloadScanner->begin(); - m_preloadScanner->write(m_pendingSrc); - } - } -#endif - m_currentPrependingSrc = savedPrependingSrc; - - return state; -} - -HTMLTokenizer::State HTMLTokenizer::scriptExecution(const ScriptSourceCode& sourceCode, State state) -{ - if (m_fragment || !m_doc->frame()) - return state; - m_executingScript++; - - SegmentedString* savedPrependingSrc = m_currentPrependingSrc; - SegmentedString prependingSrc; - m_currentPrependingSrc = &prependingSrc; - - m_state = state; - m_doc->frame()->script()->executeScript(sourceCode); - state = m_state; - - state.setAllowYield(true); - - m_executingScript--; - - if (!m_executingScript && !state.loadingExtScript()) { - m_pendingSrc.prepend(prependingSrc); - m_src.append(m_pendingSrc); - m_pendingSrc.clear(); - } else if (!prependingSrc.isEmpty()) { - // restore first so that the write appends in the right place - // (does not hurt to do it again below) - m_currentPrependingSrc = savedPrependingSrc; - - // we need to do this slightly modified bit of one of the write() cases - // because we want to prepend to m_pendingSrc rather than appending - // if there's no previous prependingSrc - if (!m_pendingScripts.isEmpty()) { - if (m_currentPrependingSrc) - m_currentPrependingSrc->append(prependingSrc); - else - m_pendingSrc.prepend(prependingSrc); - -#if PRELOAD_SCANNER_ENABLED - // We are stuck waiting for another script. Lets check the source that - // was just document.write()n for anything to load. - PreloadScanner documentWritePreloadScanner(m_doc); - documentWritePreloadScanner.begin(); - documentWritePreloadScanner.write(prependingSrc); - documentWritePreloadScanner.end(); -#endif - } else { - m_state = state; - write(prependingSrc, false); - state = m_state; - } - } - - m_currentPrependingSrc = savedPrependingSrc; - - return state; -} - -HTMLTokenizer::State HTMLTokenizer::parseComment(SegmentedString& src, State state) -{ - // FIXME: Why does this code even run for comments inside <script> and <style>? This seems bogus. - checkScriptBuffer(src.length()); - while (!src.isEmpty()) { - UChar ch = *src; - m_scriptCode[m_scriptCodeSize++] = ch; - if (ch == '>') { - bool handleBrokenComments = m_brokenComments && !(state.inScript() || state.inStyle()); - int endCharsCount = 1; // start off with one for the '>' character - if (m_scriptCodeSize > 2 && m_scriptCode[m_scriptCodeSize-3] == '-' && m_scriptCode[m_scriptCodeSize-2] == '-') { - endCharsCount = 3; - } else if (m_scriptCodeSize > 3 && m_scriptCode[m_scriptCodeSize-4] == '-' && m_scriptCode[m_scriptCodeSize-3] == '-' && - m_scriptCode[m_scriptCodeSize-2] == '!') { - // Other browsers will accept --!> as a close comment, even though it's - // not technically valid. - endCharsCount = 4; - } - if (handleBrokenComments || endCharsCount > 1) { - src.advancePastNonNewline(); - if (!(state.inTitle() || state.inScript() || state.inXmp() || state.inTextArea() || state.inStyle() || state.inIFrame())) { - checkScriptBuffer(); - m_scriptCode[m_scriptCodeSize] = 0; - m_scriptCode[m_scriptCodeSize + 1] = 0; - m_currentToken.tagName = commentAtom; - m_currentToken.beginTag = true; - state = processListing(SegmentedString(m_scriptCode, m_scriptCodeSize - endCharsCount), state); - processToken(); - m_currentToken.tagName = commentAtom; - m_currentToken.beginTag = false; - processToken(); - m_scriptCodeSize = 0; - } - state.setInComment(false); - return state; // Finished parsing comment - } - } - src.advance(m_lineNumber); - } - - return state; -} - -HTMLTokenizer::State HTMLTokenizer::parseServer(SegmentedString& src, State state) -{ - checkScriptBuffer(src.length()); - while (!src.isEmpty()) { - UChar ch = *src; - m_scriptCode[m_scriptCodeSize++] = ch; - if (ch == '>' && m_scriptCodeSize > 1 && m_scriptCode[m_scriptCodeSize - 2] == '%') { - src.advancePastNonNewline(); - state.setInServer(false); - m_scriptCodeSize = 0; - return state; // Finished parsing server include - } - src.advance(m_lineNumber); - } - return state; -} - -HTMLTokenizer::State HTMLTokenizer::parseProcessingInstruction(SegmentedString& src, State state) -{ - UChar oldchar = 0; - while (!src.isEmpty()) { - UChar chbegin = *src; - if (chbegin == '\'') - tquote = tquote == SingleQuote ? NoQuote : SingleQuote; - else if (chbegin == '\"') - tquote = tquote == DoubleQuote ? NoQuote : DoubleQuote; - // Look for '?>' - // Some crappy sites omit the "?" before it, so - // we look for an unquoted '>' instead. (IE compatible) - else if (chbegin == '>' && (!tquote || oldchar == '?')) { - // We got a '?>' sequence - state.setInProcessingInstruction(false); - src.advancePastNonNewline(); - state.setDiscardLF(true); - return state; // Finished parsing comment! - } - src.advance(m_lineNumber); - oldchar = chbegin; - } - - return state; -} - -HTMLTokenizer::State HTMLTokenizer::parseText(SegmentedString& src, State state) -{ - while (!src.isEmpty()) { - UChar cc = *src; - - if (state.skipLF()) { - state.setSkipLF(false); - if (cc == '\n') { - src.advancePastNewline(m_lineNumber); - continue; - } - } - - // do we need to enlarge the buffer? - checkBuffer(); - - if (cc == '\r') { - state.setSkipLF(true); - *m_dest++ = '\n'; - } else - *m_dest++ = cc; - src.advance(m_lineNumber); - } - - return state; -} - - -HTMLTokenizer::State HTMLTokenizer::parseEntity(SegmentedString& src, UChar*& dest, State state, unsigned& cBufferPos, bool start, bool parsingTag) -{ - if (start) { - cBufferPos = 0; - state.setEntityState(SearchEntity); - EntityUnicodeValue = 0; - } - - while (!src.isEmpty()) { - UChar cc = *src; - switch (state.entityState()) { - case NoEntity: - ASSERT(state.entityState() != NoEntity); - return state; - - case SearchEntity: - if (cc == '#') { - m_cBuffer[cBufferPos++] = cc; - src.advancePastNonNewline(); - state.setEntityState(NumericSearch); - } else - state.setEntityState(EntityName); - break; - - case NumericSearch: - if (cc == 'x' || cc == 'X') { - m_cBuffer[cBufferPos++] = cc; - src.advancePastNonNewline(); - state.setEntityState(Hexadecimal); - } else if (cc >= '0' && cc <= '9') - state.setEntityState(Decimal); - else - state.setEntityState(SearchSemicolon); - break; - - case Hexadecimal: { - int ll = min(src.length(), 10 - cBufferPos); - while (ll--) { - cc = *src; - if (!((cc >= '0' && cc <= '9') || (cc >= 'a' && cc <= 'f') || (cc >= 'A' && cc <= 'F'))) { - state.setEntityState(SearchSemicolon); - break; - } - int digit; - if (cc < 'A') - digit = cc - '0'; - else - digit = (cc - 'A' + 10) & 0xF; // handle both upper and lower case without a branch - EntityUnicodeValue = EntityUnicodeValue * 16 + digit; - m_cBuffer[cBufferPos++] = cc; - src.advancePastNonNewline(); - } - if (cBufferPos == 10) - state.setEntityState(SearchSemicolon); - break; - } - case Decimal: - { - int ll = min(src.length(), 9-cBufferPos); - while (ll--) { - cc = *src; - - if (!(cc >= '0' && cc <= '9')) { - state.setEntityState(SearchSemicolon); - break; - } - - EntityUnicodeValue = EntityUnicodeValue * 10 + (cc - '0'); - m_cBuffer[cBufferPos++] = cc; - src.advancePastNonNewline(); - } - if (cBufferPos == 9) - state.setEntityState(SearchSemicolon); - break; - } - case EntityName: - { - int ll = min(src.length(), 9-cBufferPos); - while (ll--) { - cc = *src; - - if (!((cc >= 'a' && cc <= 'z') || (cc >= '0' && cc <= '9') || (cc >= 'A' && cc <= 'Z'))) { - state.setEntityState(SearchSemicolon); - break; - } - - m_cBuffer[cBufferPos++] = cc; - src.advancePastNonNewline(); - } - if (cBufferPos == 9) - state.setEntityState(SearchSemicolon); - if (state.entityState() == SearchSemicolon) { - if (cBufferPos > 1) { - // Since the maximum length of entity name is 9, - // so a single char array which is allocated on - // the stack, its length is 10, should be OK. - // Also if we have an illegal character, we treat it - // as illegal entity name. - unsigned testedEntityNameLen = 0; - char tmpEntityNameBuffer[10]; - - ASSERT(cBufferPos < 10); - for (; testedEntityNameLen < cBufferPos; ++testedEntityNameLen) { - if (m_cBuffer[testedEntityNameLen] > 0x7e) - break; - tmpEntityNameBuffer[testedEntityNameLen] = m_cBuffer[testedEntityNameLen]; - } - - const Entity *e; - - if (testedEntityNameLen == cBufferPos) - e = findEntity(tmpEntityNameBuffer, cBufferPos); - else - e = 0; - - if (e) - EntityUnicodeValue = e->code; - - // be IE compatible - if (parsingTag && EntityUnicodeValue > 255 && *src != ';') - EntityUnicodeValue = 0; - } - } - else - break; - } - case SearchSemicolon: - // Don't allow values that are more than 21 bits. - if (EntityUnicodeValue > 0 && EntityUnicodeValue <= 0x10FFFF) { - if (!inViewSourceMode()) { - if (*src == ';') - src.advancePastNonNewline(); - if (EntityUnicodeValue <= 0xFFFF) { - checkBuffer(); - src.push(fixUpChar(EntityUnicodeValue)); - } else { - // Convert to UTF-16, using surrogate code points. - checkBuffer(2); - src.push(U16_LEAD(EntityUnicodeValue)); - src.push(U16_TRAIL(EntityUnicodeValue)); - } - } else { - // FIXME: We should eventually colorize entities by sending them as a special token. - // 12 bytes required: up to 10 bytes in m_cBuffer plus the - // leading '&' and trailing ';' - checkBuffer(12); - *dest++ = '&'; - for (unsigned i = 0; i < cBufferPos; i++) - dest[i] = m_cBuffer[i]; - dest += cBufferPos; - if (*src == ';') { - *dest++ = ';'; - src.advancePastNonNewline(); - } - } - } else { - // 11 bytes required: up to 10 bytes in m_cBuffer plus the - // leading '&' - checkBuffer(11); - // ignore the sequence, add it to the buffer as plaintext - *dest++ = '&'; - for (unsigned i = 0; i < cBufferPos; i++) - dest[i] = m_cBuffer[i]; - dest += cBufferPos; - } - - state.setEntityState(NoEntity); - return state; - } - } - - return state; -} - -HTMLTokenizer::State HTMLTokenizer::parseDoctype(SegmentedString& src, State state) -{ - ASSERT(state.inDoctype()); - while (!src.isEmpty() && state.inDoctype()) { - UChar c = *src; - bool isWhitespace = c == '\r' || c == '\n' || c == '\t' || c == ' '; - switch (m_doctypeToken.state()) { - case DoctypeBegin: { - m_doctypeToken.setState(DoctypeBeforeName); - if (isWhitespace) { - src.advance(m_lineNumber); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } - break; - } - case DoctypeBeforeName: { - if (c == '>') { - // Malformed. Just exit. - src.advancePastNonNewline(); - state.setInDoctype(false); - if (inViewSourceMode()) - processDoctypeToken(); - } else if (isWhitespace) { - src.advance(m_lineNumber); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } else - m_doctypeToken.setState(DoctypeName); - break; - } - case DoctypeName: { - if (c == '>') { - // Valid doctype. Emit it. - src.advancePastNonNewline(); - state.setInDoctype(false); - processDoctypeToken(); - } else if (isWhitespace) { - m_doctypeSearchCount = 0; // Used now to scan for PUBLIC - m_doctypeSecondarySearchCount = 0; // Used now to scan for SYSTEM - m_doctypeToken.setState(DoctypeAfterName); - src.advance(m_lineNumber); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } else { - src.advancePastNonNewline(); - m_doctypeToken.m_name.append(c); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } - break; - } - case DoctypeAfterName: { - if (c == '>') { - // Valid doctype. Emit it. - src.advancePastNonNewline(); - state.setInDoctype(false); - processDoctypeToken(); - } else if (!isWhitespace) { - src.advancePastNonNewline(); - if (toASCIILower(c) == publicStart[m_doctypeSearchCount]) { - m_doctypeSearchCount++; - if (m_doctypeSearchCount == 6) - // Found 'PUBLIC' sequence - m_doctypeToken.setState(DoctypeBeforePublicID); - } else if (m_doctypeSearchCount > 0) { - m_doctypeSearchCount = 0; - m_doctypeToken.setState(DoctypeBogus); - } else if (toASCIILower(c) == systemStart[m_doctypeSecondarySearchCount]) { - m_doctypeSecondarySearchCount++; - if (m_doctypeSecondarySearchCount == 6) - // Found 'SYSTEM' sequence - m_doctypeToken.setState(DoctypeBeforeSystemID); - } else { - m_doctypeSecondarySearchCount = 0; - m_doctypeToken.setState(DoctypeBogus); - } - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } else { - src.advance(m_lineNumber); // Whitespace keeps us in the after name state. - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } - break; - } - case DoctypeBeforePublicID: { - if (c == '\"' || c == '\'') { - tquote = c == '\"' ? DoubleQuote : SingleQuote; - m_doctypeToken.setState(DoctypePublicID); - src.advancePastNonNewline(); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } else if (c == '>') { - // Considered bogus. Don't process the doctype. - src.advancePastNonNewline(); - state.setInDoctype(false); - if (inViewSourceMode()) - processDoctypeToken(); - } else if (isWhitespace) { - src.advance(m_lineNumber); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } else - m_doctypeToken.setState(DoctypeBogus); - break; - } - case DoctypePublicID: { - if ((c == '\"' && tquote == DoubleQuote) || (c == '\'' && tquote == SingleQuote)) { - src.advancePastNonNewline(); - m_doctypeToken.setState(DoctypeAfterPublicID); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } else if (c == '>') { - // Considered bogus. Don't process the doctype. - src.advancePastNonNewline(); - state.setInDoctype(false); - if (inViewSourceMode()) - processDoctypeToken(); - } else { - m_doctypeToken.m_publicID.append(c); - src.advance(m_lineNumber); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } - break; - } - case DoctypeAfterPublicID: - if (c == '\"' || c == '\'') { - tquote = c == '\"' ? DoubleQuote : SingleQuote; - m_doctypeToken.setState(DoctypeSystemID); - src.advancePastNonNewline(); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } else if (c == '>') { - // Valid doctype. Emit it now. - src.advancePastNonNewline(); - state.setInDoctype(false); - processDoctypeToken(); - } else if (isWhitespace) { - src.advance(m_lineNumber); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } else - m_doctypeToken.setState(DoctypeBogus); - break; - case DoctypeBeforeSystemID: - if (c == '\"' || c == '\'') { - tquote = c == '\"' ? DoubleQuote : SingleQuote; - m_doctypeToken.setState(DoctypeSystemID); - src.advancePastNonNewline(); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } else if (c == '>') { - // Considered bogus. Don't process the doctype. - src.advancePastNonNewline(); - state.setInDoctype(false); - } else if (isWhitespace) { - src.advance(m_lineNumber); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } else - m_doctypeToken.setState(DoctypeBogus); - break; - case DoctypeSystemID: - if ((c == '\"' && tquote == DoubleQuote) || (c == '\'' && tquote == SingleQuote)) { - src.advancePastNonNewline(); - m_doctypeToken.setState(DoctypeAfterSystemID); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } else if (c == '>') { - // Considered bogus. Don't process the doctype. - src.advancePastNonNewline(); - state.setInDoctype(false); - if (inViewSourceMode()) - processDoctypeToken(); - } else { - m_doctypeToken.m_systemID.append(c); - src.advance(m_lineNumber); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } - break; - case DoctypeAfterSystemID: - if (c == '>') { - // Valid doctype. Emit it now. - src.advancePastNonNewline(); - state.setInDoctype(false); - processDoctypeToken(); - } else if (isWhitespace) { - src.advance(m_lineNumber); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } else - m_doctypeToken.setState(DoctypeBogus); - break; - case DoctypeBogus: - if (c == '>') { - // Done with the bogus doctype. - src.advancePastNonNewline(); - state.setInDoctype(false); - if (inViewSourceMode()) - processDoctypeToken(); - } else { - src.advance(m_lineNumber); // Just keep scanning for '>' - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } - break; - default: - break; - } - } - return state; -} - -HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state) -{ - ASSERT(!state.hasEntityState()); - - unsigned cBufferPos = m_cBufferPos; - - bool lastIsSlash = false; - - while (!src.isEmpty()) { - checkBuffer(); - switch (state.tagState()) { - case NoTag: - { - m_cBufferPos = cBufferPos; - return state; - } - case TagName: - { - if (searchCount > 0) { - if (*src == commentStart[searchCount]) { - searchCount++; - if (searchCount == 2) - m_doctypeSearchCount++; // A '!' is also part of a doctype, so we are moving through that still as well. - else - m_doctypeSearchCount = 0; - if (searchCount == 4) { - // Found '<!--' sequence - src.advancePastNonNewline(); - m_dest = m_buffer; // ignore the previous part of this tag - state.setInComment(true); - state.setTagState(NoTag); - - // Fix bug 34302 at kde.bugs.org. Go ahead and treat - // <!--> as a valid comment, since both mozilla and IE on windows - // can handle this case. Only do this in quirks mode. -dwh - if (!src.isEmpty() && *src == '>' && m_doc->inCompatMode()) { - state.setInComment(false); - src.advancePastNonNewline(); - if (!src.isEmpty()) - m_cBuffer[cBufferPos++] = *src; - } else - state = parseComment(src, state); - - m_cBufferPos = cBufferPos; - return state; // Finished parsing tag! - } - m_cBuffer[cBufferPos++] = *src; - src.advancePastNonNewline(); - break; - } else - searchCount = 0; // Stop looking for '<!--' sequence - } - - if (m_doctypeSearchCount > 0) { - if (toASCIILower(*src) == doctypeStart[m_doctypeSearchCount]) { - m_doctypeSearchCount++; - m_cBuffer[cBufferPos++] = *src; - src.advancePastNonNewline(); - if (m_doctypeSearchCount == 9) { - // Found '<!DOCTYPE' sequence - state.setInDoctype(true); - state.setTagState(NoTag); - m_doctypeToken.reset(); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(m_cBuffer, cBufferPos); - state = parseDoctype(src, state); - m_cBufferPos = cBufferPos; - return state; - } - break; - } else - m_doctypeSearchCount = 0; // Stop looking for '<!DOCTYPE' sequence - } - - bool finish = false; - unsigned int ll = min(src.length(), CBUFLEN - cBufferPos); - while (ll--) { - UChar curchar = *src; - if (isASCIISpace(curchar) || curchar == '>' || curchar == '<') { - finish = true; - break; - } - - // tolower() shows up on profiles. This is faster! - if (curchar >= 'A' && curchar <= 'Z' && !inViewSourceMode()) - m_cBuffer[cBufferPos++] = curchar + ('a' - 'A'); - else - m_cBuffer[cBufferPos++] = curchar; - src.advancePastNonNewline(); - } - - // Disadvantage: we add the possible rest of the tag - // as attribute names. ### judge if this causes problems - if (finish || CBUFLEN == cBufferPos) { - bool beginTag; - UChar* ptr = m_cBuffer; - unsigned int len = cBufferPos; - m_cBuffer[cBufferPos] = '\0'; - if ((cBufferPos > 0) && (*ptr == '/')) { - // End Tag - beginTag = false; - ptr++; - len--; - } - else - // Start Tag - beginTag = true; - - // Ignore the / in fake xml tags like <br/>. We trim off the "/" so that we'll get "br" as the tag name and not "br/". - if (len > 1 && ptr[len-1] == '/' && !inViewSourceMode()) - ptr[--len] = '\0'; - - // Now that we've shaved off any invalid / that might have followed the name), make the tag. - // FIXME: FireFox and WinIE turn !foo nodes into comments, we ignore comments. (fast/parser/tag-with-exclamation-point.html) - if (ptr[0] != '!' || inViewSourceMode()) { - m_currentToken.tagName = AtomicString(ptr); - m_currentToken.beginTag = beginTag; - } - m_dest = m_buffer; - state.setTagState(SearchAttribute); - cBufferPos = 0; - } - break; - } - case SearchAttribute: - while (!src.isEmpty()) { - UChar curchar = *src; - // In this mode just ignore any quotes we encounter and treat them like spaces. - if (!isASCIISpace(curchar) && curchar != '\'' && curchar != '"') { - if (curchar == '<' || curchar == '>') - state.setTagState(SearchEnd); - else - state.setTagState(AttributeName); - - cBufferPos = 0; - break; - } - if (inViewSourceMode()) - m_currentToken.addViewSourceChar(curchar); - src.advance(m_lineNumber); - } - break; - case AttributeName: - { - m_rawAttributeBeforeValue.clear(); - int ll = min(src.length(), CBUFLEN - cBufferPos); - while (ll--) { - UChar curchar = *src; - // If we encounter a "/" when scanning an attribute name, treat it as a delimiter. This allows the - // cases like <input type=checkbox checked/> to work (and accommodates XML-style syntax as per HTML5). - if (curchar <= '>' && (curchar >= '<' || isASCIISpace(curchar) || curchar == '/')) { - m_cBuffer[cBufferPos] = '\0'; - m_attrName = AtomicString(m_cBuffer); - m_dest = m_buffer; - *m_dest++ = 0; - state.setTagState(SearchEqual); - if (inViewSourceMode()) - m_currentToken.addViewSourceChar('a'); - break; - } - - // tolower() shows up on profiles. This is faster! - if (curchar >= 'A' && curchar <= 'Z' && !inViewSourceMode()) - m_cBuffer[cBufferPos++] = curchar + ('a' - 'A'); - else - m_cBuffer[cBufferPos++] = curchar; - - m_rawAttributeBeforeValue.append(curchar); - src.advance(m_lineNumber); - } - if (cBufferPos == CBUFLEN) { - m_cBuffer[cBufferPos] = '\0'; - m_attrName = AtomicString(m_cBuffer); - m_dest = m_buffer; - *m_dest++ = 0; - state.setTagState(SearchEqual); - if (inViewSourceMode()) - m_currentToken.addViewSourceChar('a'); - } - break; - } - case SearchEqual: - while (!src.isEmpty()) { - UChar curchar = *src; - - if (lastIsSlash && curchar == '>') { - // This is a quirk (with a long sad history). We have to do this - // since widgets do <script src="foo.js"/> and expect the tag to close. - if (m_currentToken.tagName == scriptTag) - m_currentToken.selfClosingTag = true; - m_currentToken.brokenXMLStyle = true; - } - - // In this mode just ignore any quotes or slashes we encounter and treat them like spaces. - if (!isASCIISpace(curchar) && curchar != '\'' && curchar != '"' && curchar != '/') { - if (curchar == '=') { - state.setTagState(SearchValue); - if (inViewSourceMode()) - m_currentToken.addViewSourceChar(curchar); - m_rawAttributeBeforeValue.append(curchar); - src.advancePastNonNewline(); - } else { - m_currentToken.addAttribute(m_attrName, emptyAtom, inViewSourceMode()); - m_dest = m_buffer; - state.setTagState(SearchAttribute); - lastIsSlash = false; - } - break; - } - - lastIsSlash = curchar == '/'; - - if (inViewSourceMode()) - m_currentToken.addViewSourceChar(curchar); - m_rawAttributeBeforeValue.append(curchar); - src.advance(m_lineNumber); - } - break; - case SearchValue: - while (!src.isEmpty()) { - UChar curchar = *src; - if (!isASCIISpace(curchar)) { - if (curchar == '\'' || curchar == '\"') { - tquote = curchar == '\"' ? DoubleQuote : SingleQuote; - state.setTagState(QuotedValue); - if (inViewSourceMode()) - m_currentToken.addViewSourceChar(curchar); - m_rawAttributeBeforeValue.append(curchar); - src.advancePastNonNewline(); - } else - state.setTagState(Value); - - break; - } - if (inViewSourceMode()) - m_currentToken.addViewSourceChar(curchar); - m_rawAttributeBeforeValue.append(curchar); - src.advance(m_lineNumber); - } - break; - case QuotedValue: - while (!src.isEmpty()) { - checkBuffer(); - - UChar curchar = *src; - if (curchar <= '>' && !src.escaped()) { - if (curchar == '>' && m_attrName.isEmpty()) { - // Handle a case like <img '>. Just go ahead and be willing - // to close the whole tag. Don't consume the character and - // just go back into SearchEnd while ignoring the whole - // value. - // FIXME: Note that this is actually not a very good solution. - // It doesn't handle the general case of - // unmatched quotes among attributes that have names. -dwh - while (m_dest > m_buffer + 1 && (m_dest[-1] == '\n' || m_dest[-1] == '\r')) - m_dest--; // remove trailing newlines - AtomicString attributeValue(m_buffer + 1, m_dest - m_buffer - 1); - if (!attributeValue.contains('/')) - m_attrName = attributeValue; // Just make the name/value match. (FIXME: Is this some WinIE quirk?) - m_currentToken.addAttribute(m_attrName, attributeValue, inViewSourceMode()); - if (inViewSourceMode()) - m_currentToken.addViewSourceChar('x'); - state.setTagState(SearchAttribute); - m_dest = m_buffer; - tquote = NoQuote; - break; - } - - if (curchar == '&') { - src.advancePastNonNewline(); - state = parseEntity(src, m_dest, state, cBufferPos, true, true); - break; - } - - if ((tquote == SingleQuote && curchar == '\'') || (tquote == DoubleQuote && curchar == '\"')) { - // some <input type=hidden> rely on trailing spaces. argh - while (m_dest > m_buffer + 1 && (m_dest[-1] == '\n' || m_dest[-1] == '\r')) - m_dest--; // remove trailing newlines - AtomicString attributeValue(m_buffer + 1, m_dest - m_buffer - 1); - if (m_attrName.isEmpty() && !attributeValue.contains('/')) { - m_attrName = attributeValue; // Make the name match the value. (FIXME: Is this a WinIE quirk?) - if (inViewSourceMode()) - m_currentToken.addViewSourceChar('x'); - } else if (inViewSourceMode()) - m_currentToken.addViewSourceChar('v'); - - if (m_currentToken.beginTag && m_currentToken.tagName == scriptTag && !inViewSourceMode() && !m_parser->skipMode() && m_attrName == srcAttr) { - String context(m_rawAttributeBeforeValue.data(), m_rawAttributeBeforeValue.size()); - if (m_XSSAuditor && !m_XSSAuditor->canLoadExternalScriptFromSrc(context, attributeValue)) - attributeValue = blankURL().string(); - } - - m_currentToken.addAttribute(m_attrName, attributeValue, inViewSourceMode()); - m_dest = m_buffer; - state.setTagState(SearchAttribute); - tquote = NoQuote; - if (inViewSourceMode()) - m_currentToken.addViewSourceChar(curchar); - src.advancePastNonNewline(); - break; - } - } - - *m_dest++ = curchar; - src.advance(m_lineNumber); - } - break; - case Value: - while (!src.isEmpty()) { - checkBuffer(); - UChar curchar = *src; - if (curchar <= '>' && !src.escaped()) { - // parse Entities - if (curchar == '&') { - src.advancePastNonNewline(); - state = parseEntity(src, m_dest, state, cBufferPos, true, true); - break; - } - // no quotes. Every space means end of value - // '/' does not delimit in IE! - if (isASCIISpace(curchar) || curchar == '>') { - AtomicString attributeValue(m_buffer + 1, m_dest - m_buffer - 1); - - if (m_currentToken.beginTag && m_currentToken.tagName == scriptTag && !inViewSourceMode() && !m_parser->skipMode() && m_attrName == srcAttr) { - String context(m_rawAttributeBeforeValue.data(), m_rawAttributeBeforeValue.size()); - if (m_XSSAuditor && !m_XSSAuditor->canLoadExternalScriptFromSrc(context, attributeValue)) - attributeValue = blankURL().string(); - } - - m_currentToken.addAttribute(m_attrName, attributeValue, inViewSourceMode()); - if (inViewSourceMode()) - m_currentToken.addViewSourceChar('v'); - m_dest = m_buffer; - state.setTagState(SearchAttribute); - break; - } - } - - *m_dest++ = curchar; - src.advance(m_lineNumber); - } - break; - case SearchEnd: - { - while (!src.isEmpty()) { - UChar ch = *src; - if (ch == '>' || ch == '<') - break; - if (ch == '/') - m_currentToken.selfClosingTag = true; - if (inViewSourceMode()) - m_currentToken.addViewSourceChar(ch); - src.advance(m_lineNumber); - } - if (src.isEmpty()) - break; - - searchCount = 0; // Stop looking for '<!--' sequence - state.setTagState(NoTag); - tquote = NoQuote; - - if (*src != '<') - src.advance(m_lineNumber); - - if (m_currentToken.tagName == nullAtom) { //stop if tag is unknown - m_cBufferPos = cBufferPos; - return state; - } - - AtomicString tagName = m_currentToken.tagName; - - // Handle <script src="foo"/> like Mozilla/Opera. We have to do this now for Dashboard - // compatibility. - bool isSelfClosingScript = m_currentToken.selfClosingTag && m_currentToken.beginTag && m_currentToken.tagName == scriptTag; - bool beginTag = !m_currentToken.selfClosingTag && m_currentToken.beginTag; - if (m_currentToken.beginTag && m_currentToken.tagName == scriptTag && !inViewSourceMode() && !m_parser->skipMode()) { - Attribute* a = 0; - m_scriptTagSrcAttrValue = String(); - m_scriptTagCharsetAttrValue = String(); - if (m_currentToken.attrs && !m_fragment) { - if (m_doc->frame() && m_doc->frame()->script()->canExecuteScripts(NotAboutToExecuteScript)) { - if ((a = m_currentToken.attrs->getAttributeItem(srcAttr))) - m_scriptTagSrcAttrValue = m_doc->completeURL(deprecatedParseURL(a->value())).string(); - } - } - } - - RefPtr<Node> n = processToken(); - m_cBufferPos = cBufferPos; - if (n || inViewSourceMode()) { - State savedState = state; - SegmentedString savedSrc = src; - long savedLineno = m_lineNumber; - if ((tagName == preTag || tagName == listingTag) && !inViewSourceMode()) { - if (beginTag) - state.setDiscardLF(true); // Discard the first LF after we open a pre. - } else if (tagName == scriptTag) { - ASSERT(!m_scriptNode); - m_scriptNode = static_pointer_cast<HTMLScriptElement>(n); - if (m_scriptNode) - m_scriptTagCharsetAttrValue = m_scriptNode->scriptCharset(); - if (beginTag) { - m_searchStopper = scriptEnd; - m_searchStopperLength = 8; - state.setInScript(true); - state = parseNonHTMLText(src, state); - } else if (isSelfClosingScript) { // Handle <script src="foo"/> - state.setInScript(true); - state = scriptHandler(state); - } - } else if (tagName == styleTag) { - if (beginTag) { - m_searchStopper = styleEnd; - m_searchStopperLength = 7; - state.setInStyle(true); - state = parseNonHTMLText(src, state); - } - } else if (tagName == textareaTag) { - if (beginTag) { - m_searchStopper = textareaEnd; - m_searchStopperLength = 10; - state.setInTextArea(true); - state = parseNonHTMLText(src, state); - } - } else if (tagName == titleTag) { - if (beginTag) { - m_searchStopper = titleEnd; - m_searchStopperLength = 7; - state.setInTitle(true); - state = parseNonHTMLText(src, state); - } - } else if (tagName == xmpTag) { - if (beginTag) { - m_searchStopper = xmpEnd; - m_searchStopperLength = 5; - state.setInXmp(true); - state = parseNonHTMLText(src, state); - } - } else if (tagName == iframeTag) { - if (beginTag) { - m_searchStopper = iframeEnd; - m_searchStopperLength = 8; - state.setInIFrame(true); - state = parseNonHTMLText(src, state); - } - } - if (src.isEmpty() && (state.inTitle() || inViewSourceMode()) && !state.inComment() && !(state.inScript() && m_currentScriptTagStartLineNumber)) { - // We just ate the rest of the document as the #text node under the special tag! - // Reset the state then retokenize without special handling. - // Let the parser clean up the missing close tag. - // FIXME: This is incorrect, because src.isEmpty() doesn't mean we're - // at the end of the document unless m_noMoreData is also true. We need - // to detect this case elsewhere, and save the state somewhere other - // than a local variable. - state = savedState; - src = savedSrc; - m_lineNumber = savedLineno; - m_scriptCodeSize = 0; - } - } - if (tagName == plaintextTag) - state.setInPlainText(beginTag); - return state; // Finished parsing tag! - } - } // end switch - } - m_cBufferPos = cBufferPos; - return state; -} - -inline bool HTMLTokenizer::continueProcessing(int& processedCount, double startTime, State &state) -{ - // We don't want to be checking elapsed time with every character, so we only check after we've - // processed a certain number of characters. - bool allowedYield = state.allowYield(); - state.setAllowYield(false); - if (!state.loadingExtScript() && !state.forceSynchronous() && !m_executingScript && (processedCount > m_tokenizerChunkSize || allowedYield)) { - processedCount = 0; - if (currentTime() - startTime > m_tokenizerTimeDelay) { - /* FIXME: We'd like to yield aggressively to give stylesheets the opportunity to - load, but this hurts overall performance on slower machines. For now turn this - off. - || (!m_doc->haveStylesheetsLoaded() && - (m_doc->documentElement()->id() != ID_HTML || m_doc->body()))) {*/ - // Schedule the timer to keep processing as soon as possible. - m_timer.startOneShot(0); - return false; - } - } - - processedCount++; - return true; -} - -// Turns the statemachine one crank using the passed in State object. -// This does not modify m_state directly in order to be reentrant. -ALWAYS_INLINE void HTMLTokenizer::advance(State& state) -{ - // do we need to enlarge the buffer? - checkBuffer(); - - UChar cc = *m_src; - - bool wasSkipLF = state.skipLF(); - if (wasSkipLF) - state.setSkipLF(false); - - if (wasSkipLF && (cc == '\n')) - m_src.advance(); - else if (state.needsSpecialWriteHandling()) { - // it's important to keep needsSpecialWriteHandling with the flags this block tests - if (state.hasEntityState()) - state = parseEntity(m_src, m_dest, state, m_cBufferPos, false, state.hasTagState()); - else if (state.inPlainText()) - state = parseText(m_src, state); - else if (state.inAnyNonHTMLText()) - state = parseNonHTMLText(m_src, state); - else if (state.inComment()) - state = parseComment(m_src, state); - else if (state.inDoctype()) - state = parseDoctype(m_src, state); - else if (state.inServer()) - state = parseServer(m_src, state); - else if (state.inProcessingInstruction()) - state = parseProcessingInstruction(m_src, state); - else if (state.hasTagState()) - state = parseTag(m_src, state); - else if (state.startTag()) { - state.setStartTag(false); - - switch (cc) { - case '/': - break; - case '!': { - // <!-- comment --> or <!DOCTYPE ...> - searchCount = 1; // Look for '<!--' sequence to start comment or '<!DOCTYPE' sequence to start doctype - m_doctypeSearchCount = 1; - break; - } - case '?': { - // xml processing instruction - state.setInProcessingInstruction(true); - tquote = NoQuote; - state = parseProcessingInstruction(m_src, state); - return; - } - case '%': - if (!m_brokenServer) { - // <% server stuff, handle as comment %> - state.setInServer(true); - tquote = NoQuote; - state = parseServer(m_src, state); - return; - } - // else fall through - default: { - if (((cc >= 'a') && (cc <= 'z')) || ((cc >= 'A') && (cc <= 'Z'))) { - // Start of a Start-Tag - } else { - // Invalid tag - // Add as is - *m_dest = '<'; - m_dest++; - return; - } - } - }; // end case - - processToken(); - - m_cBufferPos = 0; - state.setTagState(TagName); - state = parseTag(m_src, state); - } - } else if (cc == '&' && !m_src.escaped()) { - m_src.advancePastNonNewline(); - state = parseEntity(m_src, m_dest, state, m_cBufferPos, true, state.hasTagState()); - } else if (cc == '<' && !m_src.escaped()) { - m_currentTagStartLineNumber = m_lineNumber; - m_src.advancePastNonNewline(); - state.setStartTag(true); - state.setDiscardLF(false); - } else if (cc == '\n' || cc == '\r') { - if (state.discardLF()) - // Ignore this LF - state.setDiscardLF(false); // We have discarded 1 LF - else { - // Process this LF - *m_dest++ = '\n'; - if (cc == '\r' && !m_src.excludeLineNumbers()) - m_lineNumber++; - } - - /* Check for MS-DOS CRLF sequence */ - if (cc == '\r') - state.setSkipLF(true); - m_src.advance(m_lineNumber); - } else { - state.setDiscardLF(false); - *m_dest++ = cc; - m_src.advancePastNonNewline(); - } -} - -void HTMLTokenizer::willWriteHTML(const SegmentedString& source) -{ - #if ENABLE(INSPECTOR) - if (InspectorTimelineAgent* timelineAgent = m_doc->inspectorTimelineAgent()) - timelineAgent->willWriteHTML(source.length(), m_lineNumber); - #endif -} - -void HTMLTokenizer::didWriteHTML() -{ - #if ENABLE(INSPECTOR) - if (InspectorTimelineAgent* timelineAgent = m_doc->inspectorTimelineAgent()) - timelineAgent->didWriteHTML(m_lineNumber); - #endif -} - -void HTMLTokenizer::write(const SegmentedString& str, bool appendData) -{ - if (!m_buffer) - return; - - if (m_parserStopped) - return; - - SegmentedString source(str); - if (m_executingScript) - source.setExcludeLineNumbers(); - - if ((m_executingScript && appendData) || !m_pendingScripts.isEmpty()) { - // don't parse; we will do this later - if (m_currentPrependingSrc) - m_currentPrependingSrc->append(source); - else { - m_pendingSrc.append(source); -#if PRELOAD_SCANNER_ENABLED - if (m_preloadScanner && m_preloadScanner->inProgress() && appendData) - m_preloadScanner->write(source); -#endif - } - return; - } - -#if PRELOAD_SCANNER_ENABLED - if (m_preloadScanner && m_preloadScanner->inProgress() && appendData) - m_preloadScanner->end(); -#endif - - if (!m_src.isEmpty()) - m_src.append(source); - else - setSrc(source); - - // Once a timer is set, it has control of when the tokenizer continues. - if (m_timer.isActive()) - return; - - bool wasInWrite = m_inWrite; - m_inWrite = true; - -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::start(android::TimeCounter::ParsingTimeCounter); -#endif - - willWriteHTML(source); - - Frame* frame = m_doc->frame(); - State state = m_state; - int processedCount = 0; - double startTime = currentTime(); - - while (!m_src.isEmpty() && (!frame || !frame->redirectScheduler()->locationChangePending())) { - if (!continueProcessing(processedCount, startTime, state)) - break; - advance(state); - } - - didWriteHTML(); - - m_inWrite = wasInWrite; - m_state = state; - -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::record(android::TimeCounter::ParsingTimeCounter, __FUNCTION__); -#endif - - if (m_noMoreData && !m_inWrite && !state.loadingExtScript() && !m_executingScript && !m_timer.isActive()) - end(); // this actually causes us to be deleted - - // After parsing, go ahead and dispatch image beforeload events. - ImageLoader::dispatchPendingBeforeLoadEvents(); -} - -void HTMLTokenizer::stopParsing() -{ - Tokenizer::stopParsing(); - m_timer.stop(); - - // The part needs to know that the tokenizer has finished with its data, - // regardless of whether it happened naturally or due to manual intervention. - if (!m_fragment && m_doc->frame()) - m_doc->frame()->loader()->tokenizerProcessedData(); -} - -bool HTMLTokenizer::processingData() const -{ - return m_timer.isActive() || m_inWrite; -} - -void HTMLTokenizer::timerFired(Timer<HTMLTokenizer>*) -{ - if (m_doc->view() && m_doc->view()->layoutPending() && !m_doc->minimumLayoutDelay()) { - // Restart the timer and let layout win. This is basically a way of ensuring that the layout - // timer has higher priority than our timer. - m_timer.startOneShot(0); - return; - } - - // Invoke write() as though more data came in. This might cause us to get deleted. - write(SegmentedString(), true); -} - -void HTMLTokenizer::end() -{ - ASSERT(!m_timer.isActive()); - m_timer.stop(); // Only helps if assertion above fires, but do it anyway. - - if (m_buffer) { - // parseTag is using the buffer for different matters - if (!m_state.hasTagState()) - processToken(); - - fastFree(m_scriptCode); - m_scriptCode = 0; - m_scriptCodeSize = m_scriptCodeCapacity = m_scriptCodeResync = 0; - - fastFree(m_buffer); - m_buffer = 0; - } - - if (!inViewSourceMode()) - m_parser->finished(); - else - m_doc->finishedParsing(); -} - -void HTMLTokenizer::finish() -{ - // do this as long as we don't find matching comment ends - while ((m_state.inComment() || m_state.inServer()) && m_scriptCode && m_scriptCodeSize) { - // we've found an unmatched comment start - if (m_state.inComment()) - m_brokenComments = true; - else - m_brokenServer = true; - checkScriptBuffer(); - m_scriptCode[m_scriptCodeSize] = 0; - m_scriptCode[m_scriptCodeSize + 1] = 0; - int pos; - String food; - if (m_state.inScript() || m_state.inStyle() || m_state.inTextArea()) - food = String(m_scriptCode, m_scriptCodeSize); - else if (m_state.inServer()) { - food = "<"; - food.append(m_scriptCode, m_scriptCodeSize); - } else { - pos = find(m_scriptCode, m_scriptCodeSize, '>'); - food = String(m_scriptCode + pos + 1, m_scriptCodeSize - pos - 1); - } - fastFree(m_scriptCode); - m_scriptCode = 0; - m_scriptCodeSize = m_scriptCodeCapacity = m_scriptCodeResync = 0; - m_state.setInComment(false); - m_state.setInServer(false); - if (!food.isEmpty()) - write(food, true); - } - // this indicates we will not receive any more data... but if we are waiting on - // an external script to load, we can't finish parsing until that is done - m_noMoreData = true; - if (!m_inWrite && !m_state.loadingExtScript() && !m_executingScript && !m_timer.isActive()) - end(); // this actually causes us to be deleted -} - -PassRefPtr<Node> HTMLTokenizer::processToken() -{ - ScriptController* scriptController = (!m_fragment && m_doc->frame()) ? m_doc->frame()->script() : 0; - if (scriptController && scriptController->canExecuteScripts(NotAboutToExecuteScript)) - // FIXME: Why isn't this m_currentScriptTagStartLineNumber? I suspect this is wrong. - scriptController->setEventHandlerLineNumber(m_currentTagStartLineNumber + 1); // Script line numbers are 1 based. - if (m_dest > m_buffer) { - m_currentToken.text = StringImpl::createStrippingNullCharacters(m_buffer, m_dest - m_buffer); - if (m_currentToken.tagName != commentAtom) - m_currentToken.tagName = textAtom; - } else if (m_currentToken.tagName == nullAtom) { - m_currentToken.reset(); - if (scriptController) - scriptController->setEventHandlerLineNumber(m_lineNumber + 1); // Script line numbers are 1 based. - return 0; - } - - m_dest = m_buffer; - - RefPtr<Node> n; - - if (!m_parserStopped) { - if (NamedNodeMap* map = m_currentToken.attrs.get()) - map->shrinkToLength(); - if (inViewSourceMode()) - static_cast<HTMLViewSourceDocument*>(m_doc)->addViewSourceToken(&m_currentToken); - else - // pass the token over to the parser, the parser DOES NOT delete the token - n = m_parser->parseToken(&m_currentToken); - } - m_currentToken.reset(); - if (scriptController) - scriptController->setEventHandlerLineNumber(0); - - return n.release(); -} - -void HTMLTokenizer::processDoctypeToken() -{ - if (inViewSourceMode()) - static_cast<HTMLViewSourceDocument*>(m_doc)->addViewSourceDoctypeToken(&m_doctypeToken); - else - m_parser->parseDoctypeToken(&m_doctypeToken); -} - -HTMLTokenizer::~HTMLTokenizer() -{ - ASSERT(!m_inWrite); - reset(); -} - - -void HTMLTokenizer::enlargeBuffer(int len) -{ - // Resize policy: Always at least double the size of the buffer each time. - int delta = max(len, m_bufferSize); - - // Check for overflow. - // For now, handle overflow the same way we handle fastRealloc failure, with CRASH. - static const int maxSize = INT_MAX / sizeof(UChar); - if (delta > maxSize - m_bufferSize) - CRASH(); - - int newSize = m_bufferSize + delta; - int oldOffset = m_dest - m_buffer; - m_buffer = static_cast<UChar*>(fastRealloc(m_buffer, newSize * sizeof(UChar))); - m_dest = m_buffer + oldOffset; - m_bufferSize = newSize; -} - -void HTMLTokenizer::enlargeScriptBuffer(int len) -{ - // Resize policy: Always at least double the size of the buffer each time. - int delta = max(len, m_scriptCodeCapacity); - - // Check for overflow. - // For now, handle overflow the same way we handle fastRealloc failure, with CRASH. - static const int maxSize = INT_MAX / sizeof(UChar); - if (delta > maxSize - m_scriptCodeCapacity) - CRASH(); - - int newSize = m_scriptCodeCapacity + delta; - // If we allow fastRealloc(ptr, 0), it will call CRASH(). We run into this - // case if the HTML being parsed begins with "<!--" and there's more data - // coming. - if (!newSize) { - ASSERT(!m_scriptCode); - return; - } - - m_scriptCode = static_cast<UChar*>(fastRealloc(m_scriptCode, newSize * sizeof(UChar))); - m_scriptCodeCapacity = newSize; -} - -void HTMLTokenizer::executeScriptsWaitingForStylesheets() -{ - ASSERT(m_doc->haveStylesheetsLoaded()); - - if (m_hasScriptsWaitingForStylesheets) - notifyFinished(0); -} - -void HTMLTokenizer::notifyFinished(CachedResource*) -{ - executeExternalScriptsIfReady(); -} - -void HTMLTokenizer::executeExternalScriptsIfReady() -{ - ASSERT(!m_pendingScripts.isEmpty()); - - // Make external scripts wait for external stylesheets. - // FIXME: This needs to be done for inline scripts too. - m_hasScriptsWaitingForStylesheets = !m_doc->haveStylesheetsLoaded(); - if (m_hasScriptsWaitingForStylesheets) - return; - - bool finished = false; - - double startTime = currentTime(); - while (!finished && m_pendingScripts.first()->isLoaded()) { - if (!continueExecutingExternalScripts(startTime)) - break; - - CachedScript* cs = m_pendingScripts.first().get(); - m_pendingScripts.removeFirst(); - ASSERT(cache()->disabled() || cs->accessCount() > 0); - - setSrc(SegmentedString()); - - // make sure we forget about the script before we execute the new one - // infinite recursion might happen otherwise - ScriptSourceCode sourceCode(cs); - bool errorOccurred = cs->errorOccurred(); - cs->removeClient(this); - - RefPtr<Node> n = m_scriptNode.release(); - - if (errorOccurred) - n->dispatchEvent(Event::create(eventNames().errorEvent, true, false)); - else { - if (static_cast<HTMLScriptElement*>(n.get())->shouldExecuteAsJavaScript()) - m_state = scriptExecution(sourceCode, m_state); -#if ENABLE(XHTMLMP) - else - m_doc->setShouldProcessNoscriptElement(true); -#endif - n->dispatchEvent(Event::create(eventNames().loadEvent, false, false)); - } - - // The state of m_pendingScripts.isEmpty() can change inside the scriptExecution() - // call above, so test afterwards. - finished = m_pendingScripts.isEmpty(); - if (finished) { - ASSERT(!m_hasScriptsWaitingForStylesheets); - m_state.setLoadingExtScript(false); - } else if (m_hasScriptsWaitingForStylesheets) { - // m_hasScriptsWaitingForStylesheets flag might have changed during the script execution. - // If it did we are now blocked waiting for stylesheets and should not execute more scripts until they arrive. - finished = true; - } - - // 'm_requestingScript' is true when we are called synchronously from - // scriptHandler(). In that case scriptHandler() will take care - // of m_pendingSrc. - if (!m_requestingScript) { - SegmentedString rest = m_pendingSrc; - m_pendingSrc.clear(); - write(rest, false); - // we might be deleted at this point, do not access any members. - } - } -} - -void HTMLTokenizer::executeExternalScriptsTimerFired(Timer<HTMLTokenizer>*) -{ - if (m_doc->view() && m_doc->view()->layoutPending() && !m_doc->minimumLayoutDelay()) { - // Restart the timer and do layout first. - m_externalScriptsTimer.startOneShot(0); - return; - } - - // Continue executing external scripts. - executeExternalScriptsIfReady(); -} - -bool HTMLTokenizer::continueExecutingExternalScripts(double startTime) -{ - if (m_externalScriptsTimer.isActive()) - return false; - - if (currentTime() - startTime > m_tokenizerTimeDelay) { - // Schedule the timer to keep processing as soon as possible. - m_externalScriptsTimer.startOneShot(0); - return false; - } - return true; -} - -bool HTMLTokenizer::isWaitingForScripts() const -{ - return m_state.loadingExtScript(); -} - -void HTMLTokenizer::setSrc(const SegmentedString& source) -{ - m_src = source; -} - -void parseHTMLDocumentFragment(const String& source, DocumentFragment* fragment, FragmentScriptingPermission scriptingPermission) -{ - HTMLTokenizer tok(fragment, scriptingPermission); - tok.setForceSynchronous(true); - tok.write(source, true); - tok.finish(); - ASSERT(!tok.processingData()); // make sure we're done (see 3963151) -} - -UChar decodeNamedEntity(const char* name) -{ - const Entity* e = findEntity(name, strlen(name)); - return e ? e->code : 0; -} - -} diff --git a/WebCore/html/HTMLTokenizer.h b/WebCore/html/HTMLTokenizer.h deleted file mode 100644 index dc03cf2..0000000 --- a/WebCore/html/HTMLTokenizer.h +++ /dev/null @@ -1,446 +0,0 @@ -/* - Copyright (C) 1997 Martin Jones (mjones@kde.org) - (C) 1997 Torben Weis (weis@kde.org) - (C) 1998 Waldo Bastian (bastian@kde.org) - (C) 2001 Dirk Mueller (mueller@kde.org) - Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - 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 HTMLTokenizer_h -#define HTMLTokenizer_h - -#include "CachedResourceClient.h" -#include "CachedResourceHandle.h" -#include "MappedAttributeEntry.h" -#include "NamedNodeMap.h" -#include "SegmentedString.h" -#include "Timer.h" -#include "Tokenizer.h" -#include <wtf/Deque.h> -#include <wtf/OwnPtr.h> -#include <wtf/Vector.h> - -namespace WebCore { - -class CachedScript; -class DocumentFragment; -class Document; -class HTMLDocument; -class HTMLScriptElement; -class HTMLViewSourceDocument; -class FrameView; -class HTMLParser; -class Node; -class PreloadScanner; -class ScriptSourceCode; - -/** - * @internal - * represents one HTML tag. Consists of a numerical id, and the list - * of attributes. Can also represent text. In this case the id = 0 and - * text contains the text. - */ -struct Token { - Token() - : beginTag(true) - , selfClosingTag(false) - , brokenXMLStyle(false) - , m_sourceInfo(0) - { } - ~Token() { } - - void addAttribute(AtomicString& attrName, const AtomicString& v, bool viewSourceMode); - - bool isOpenTag(const QualifiedName& fullName) const { return beginTag && fullName.localName() == tagName; } - bool isCloseTag(const QualifiedName& fullName) const { return !beginTag && fullName.localName() == tagName; } - - void reset() - { - attrs = 0; - text = 0; - tagName = nullAtom; - beginTag = true; - selfClosingTag = false; - brokenXMLStyle = false; - if (m_sourceInfo) - m_sourceInfo->clear(); - } - - void addViewSourceChar(UChar c) { if (!m_sourceInfo.get()) m_sourceInfo.set(new Vector<UChar>); m_sourceInfo->append(c); } - - RefPtr<NamedNodeMap> attrs; - RefPtr<StringImpl> text; - AtomicString tagName; - bool beginTag; - bool selfClosingTag; - bool brokenXMLStyle; - OwnPtr<Vector<UChar> > m_sourceInfo; -}; - -enum DoctypeState { - DoctypeBegin, - DoctypeBeforeName, - DoctypeName, - DoctypeAfterName, - DoctypeBeforePublicID, - DoctypePublicID, - DoctypeAfterPublicID, - DoctypeBeforeSystemID, - DoctypeSystemID, - DoctypeAfterSystemID, - DoctypeBogus -}; - -class DoctypeToken { -public: - DoctypeToken() {} - - void reset() - { - m_name.clear(); - m_publicID.clear(); - m_systemID.clear(); - m_state = DoctypeBegin; - m_source.clear(); - } - - DoctypeState state() { return m_state; } - void setState(DoctypeState s) { m_state = s; } - - Vector<UChar> m_name; - Vector<UChar> m_publicID; - Vector<UChar> m_systemID; - DoctypeState m_state; - - Vector<UChar> m_source; -}; - -//----------------------------------------------------------------------------- - -// FIXME: This class does too much. Right now it is both an HTML lexer as well -// as handling all of the non-lexer-specific junk related to tokenizing HTML -// (like dealing with <script> tags). The HTML lexer bits should be pushed -// down into a separate HTML lexer class. - -class HTMLTokenizer : public Tokenizer, public CachedResourceClient { -public: - HTMLTokenizer(HTMLDocument*, bool reportErrors); - HTMLTokenizer(HTMLViewSourceDocument*); - HTMLTokenizer(DocumentFragment*, FragmentScriptingPermission = FragmentScriptingAllowed); - virtual ~HTMLTokenizer(); - - virtual void write(const SegmentedString&, bool appendData); - virtual void finish(); - virtual bool forceSynchronous() const { return m_state.forceSynchronous(); } - virtual void setForceSynchronous(bool force); - virtual bool isWaitingForScripts() const; - virtual void stopParsing(); - virtual bool processingData() const; - virtual int executingScript() const { return m_executingScript; } - - virtual int lineNumber() const { return m_lineNumber; } - virtual int columnNumber() const { return 1; } - - bool processingContentWrittenByScript() const { return m_src.excludeLineNumbers(); } - - virtual void executeScriptsWaitingForStylesheets(); - - virtual bool isHTMLTokenizer() const { return true; } - virtual HTMLTokenizer* asHTMLTokenizer() { return this; } - HTMLParser* htmlParser() const { return m_parser.get(); } - -private: - class State; - - // Where we are in parsing a tag - void begin(); - void end(); - - void reset(); - - void willWriteHTML(const SegmentedString&); - ALWAYS_INLINE void advance(State&); - void didWriteHTML(); - - PassRefPtr<Node> processToken(); - void processDoctypeToken(); - - State processListing(SegmentedString, State); - State parseComment(SegmentedString&, State); - State parseDoctype(SegmentedString&, State); - State parseServer(SegmentedString&, State); - State parseText(SegmentedString&, State); - State parseNonHTMLText(SegmentedString&, State); - State parseTag(SegmentedString&, State); - State parseEntity(SegmentedString&, UChar*& dest, State, unsigned& cBufferPos, bool start, bool parsingTag); - State parseProcessingInstruction(SegmentedString&, State); - State scriptHandler(State); - State scriptExecution(const ScriptSourceCode&, State); - void setSrc(const SegmentedString&); - - // check if we have enough space in the buffer. - // if not enlarge it - inline void checkBuffer(int len = 10) - { - if ((m_dest - m_buffer) > m_bufferSize - len) - enlargeBuffer(len); - } - - inline void checkScriptBuffer(int len = 10) - { - if (m_scriptCodeSize + len >= m_scriptCodeCapacity) - enlargeScriptBuffer(len); - } - - void enlargeBuffer(int len); - void enlargeScriptBuffer(int len); - - bool continueProcessing(int& processedCount, double startTime, State&); - void timerFired(Timer<HTMLTokenizer>*); - void allDataProcessed(); - - // from CachedResourceClient - void notifyFinished(CachedResource*); - - void executeExternalScriptsIfReady(); - void executeExternalScriptsTimerFired(Timer<HTMLTokenizer>*); - bool continueExecutingExternalScripts(double startTime); - - // Internal buffers - /////////////////// - UChar* m_buffer; - int m_bufferSize; - UChar* m_dest; - - Token m_currentToken; - - // This buffer holds the raw characters we've seen between the beginning of - // the attribute name and the first character of the attribute value. - Vector<UChar, 32> m_rawAttributeBeforeValue; - - // Tokenizer flags - ////////////////// - // are we in quotes within a html tag - enum { NoQuote, SingleQuote, DoubleQuote } tquote; - - // Are we in a &... character entity description? - enum EntityState { - NoEntity = 0, - SearchEntity = 1, - NumericSearch = 2, - Hexadecimal = 3, - Decimal = 4, - EntityName = 5, - SearchSemicolon = 6 - }; - unsigned EntityUnicodeValue; - - enum TagState { - NoTag = 0, - TagName = 1, - SearchAttribute = 2, - AttributeName = 3, - SearchEqual = 4, - SearchValue = 5, - QuotedValue = 6, - Value = 7, - SearchEnd = 8 - }; - - class State { - public: - State() : m_bits(0) { } - - TagState tagState() const { return static_cast<TagState>(m_bits & TagMask); } - void setTagState(TagState t) { m_bits = (m_bits & ~TagMask) | t; } - EntityState entityState() const { return static_cast<EntityState>((m_bits & EntityMask) >> EntityShift); } - void setEntityState(EntityState e) { m_bits = (m_bits & ~EntityMask) | (e << EntityShift); } - - bool inScript() const { return testBit(InScript); } - void setInScript(bool v) { setBit(InScript, v); } - bool inStyle() const { return testBit(InStyle); } - void setInStyle(bool v) { setBit(InStyle, v); } - bool inXmp() const { return testBit(InXmp); } - void setInXmp(bool v) { setBit(InXmp, v); } - bool inTitle() const { return testBit(InTitle); } - void setInTitle(bool v) { setBit(InTitle, v); } - bool inIFrame() const { return testBit(InIFrame); } - void setInIFrame(bool v) { setBit(InIFrame, v); } - bool inPlainText() const { return testBit(InPlainText); } - void setInPlainText(bool v) { setBit(InPlainText, v); } - bool inProcessingInstruction() const { return testBit(InProcessingInstruction); } - void setInProcessingInstruction(bool v) { return setBit(InProcessingInstruction, v); } - bool inComment() const { return testBit(InComment); } - void setInComment(bool v) { setBit(InComment, v); } - bool inDoctype() const { return testBit(InDoctype); } - void setInDoctype(bool v) { setBit(InDoctype, v); } - bool inTextArea() const { return testBit(InTextArea); } - void setInTextArea(bool v) { setBit(InTextArea, v); } - bool escaped() const { return testBit(Escaped); } - void setEscaped(bool v) { setBit(Escaped, v); } - bool inServer() const { return testBit(InServer); } - void setInServer(bool v) { setBit(InServer, v); } - bool skipLF() const { return testBit(SkipLF); } - void setSkipLF(bool v) { setBit(SkipLF, v); } - bool startTag() const { return testBit(StartTag); } - void setStartTag(bool v) { setBit(StartTag, v); } - bool discardLF() const { return testBit(DiscardLF); } - void setDiscardLF(bool v) { setBit(DiscardLF, v); } - bool allowYield() const { return testBit(AllowYield); } - void setAllowYield(bool v) { setBit(AllowYield, v); } - bool loadingExtScript() const { return testBit(LoadingExtScript); } - void setLoadingExtScript(bool v) { setBit(LoadingExtScript, v); } - bool forceSynchronous() const { return testBit(ForceSynchronous); } - void setForceSynchronous(bool v) { setBit(ForceSynchronous, v); } - - bool inAnyNonHTMLText() const { return m_bits & (InScript | InStyle | InXmp | InTextArea | InTitle | InIFrame); } - bool hasTagState() const { return m_bits & TagMask; } - bool hasEntityState() const { return m_bits & EntityMask; } - - bool needsSpecialWriteHandling() const { return m_bits & (InScript | InStyle | InXmp | InTextArea | InTitle | InIFrame | TagMask | EntityMask | InPlainText | InComment | InDoctype | InServer | InProcessingInstruction | StartTag); } - - private: - static const int EntityShift = 4; - enum StateBits { - TagMask = (1 << 4) - 1, - EntityMask = (1 << 7) - (1 << 4), - InScript = 1 << 7, - InStyle = 1 << 8, - // Bit 9 unused - InXmp = 1 << 10, - InTitle = 1 << 11, - InPlainText = 1 << 12, - InProcessingInstruction = 1 << 13, - InComment = 1 << 14, - InTextArea = 1 << 15, - Escaped = 1 << 16, - InServer = 1 << 17, - SkipLF = 1 << 18, - StartTag = 1 << 19, - DiscardLF = 1 << 20, // FIXME: should clarify difference between skip and discard - AllowYield = 1 << 21, - LoadingExtScript = 1 << 22, - ForceSynchronous = 1 << 23, - InIFrame = 1 << 24, - InDoctype = 1 << 25 - }; - - void setBit(StateBits bit, bool value) - { - if (value) - m_bits |= bit; - else - m_bits &= ~bit; - } - bool testBit(StateBits bit) const { return m_bits & bit; } - - unsigned m_bits; - }; - - State m_state; - - DoctypeToken m_doctypeToken; - int m_doctypeSearchCount; - int m_doctypeSecondarySearchCount; - - bool m_brokenServer; - - // Name of an attribute that we just scanned. - AtomicString m_attrName; - - // Used to store the code of a scripting sequence - UChar* m_scriptCode; - // Size of the script sequenze stored in @ref #scriptCode - int m_scriptCodeSize; - // Maximal size that can be stored in @ref #scriptCode - int m_scriptCodeCapacity; - // resync point of script code size - int m_scriptCodeResync; - - // Stores characters if we are scanning for a string like "</script>" - UChar searchBuffer[10]; - - // Counts where we are in the string we are scanning for - int searchCount; - // the stopper string - const char* m_searchStopper; - int m_searchStopperLength; - - // if no more data is coming, just parse what we have (including ext scripts that - // may be still downloading) and finish - bool m_noMoreData; - // URL to get source code of script from - String m_scriptTagSrcAttrValue; - String m_scriptTagCharsetAttrValue; - // the HTML code we will parse after the external script we are waiting for has loaded - SegmentedString m_pendingSrc; - - // the HTML code we will parse after this particular script has - // loaded, but before all pending HTML - SegmentedString* m_currentPrependingSrc; - - // true if we are executing a script while parsing a document. This causes the parsing of - // the output of the script to be postponed until after the script has finished executing - int m_executingScript; - Deque<CachedResourceHandle<CachedScript> > m_pendingScripts; - RefPtr<HTMLScriptElement> m_scriptNode; - - bool m_requestingScript; - bool m_hasScriptsWaitingForStylesheets; - - // if we found one broken comment, there are most likely others as well - // store a flag to get rid of the O(n^2) behaviour in such a case. - bool m_brokenComments; - // current line number - int m_lineNumber; - int m_currentScriptTagStartLineNumber; - int m_currentTagStartLineNumber; - - double m_tokenizerTimeDelay; - int m_tokenizerChunkSize; - - // The timer for continued processing. - Timer<HTMLTokenizer> m_timer; - - // The timer for continued executing external scripts. - Timer<HTMLTokenizer> m_externalScriptsTimer; - -// This buffer can hold arbitrarily long user-defined attribute names, such as in EMBED tags. -// So any fixed number might be too small, but rather than rewriting all usage of this buffer -// we'll just make it large enough to handle all imaginable cases. -#define CBUFLEN 1024 - UChar m_cBuffer[CBUFLEN + 2]; - unsigned int m_cBufferPos; - - SegmentedString m_src; - Document* m_doc; - OwnPtr<HTMLParser> m_parser; - bool m_inWrite; - bool m_fragment; - FragmentScriptingPermission m_scriptingPermission; - - OwnPtr<PreloadScanner> m_preloadScanner; -}; - -void parseHTMLDocumentFragment(const String&, DocumentFragment*, FragmentScriptingPermission = FragmentScriptingAllowed); - -UChar decodeNamedEntity(const char*); - -} // namespace WebCore - -#endif // HTMLTokenizer_h diff --git a/WebCore/html/HTMLVideoElement.idl b/WebCore/html/HTMLVideoElement.idl index 1b21c54..953e447 100644 --- a/WebCore/html/HTMLVideoElement.idl +++ b/WebCore/html/HTMLVideoElement.idl @@ -24,7 +24,10 @@ */ module html { - interface [Conditional=VIDEO] HTMLVideoElement : HTMLMediaElement { + interface [ + Conditional=VIDEO, + GenerateNativeConverter + ] HTMLVideoElement : HTMLMediaElement { attribute unsigned long width; attribute unsigned long height; readonly attribute unsigned long videoWidth; diff --git a/WebCore/html/HTMLViewSourceDocument.cpp b/WebCore/html/HTMLViewSourceDocument.cpp index 196c67e..5391ddc 100644 --- a/WebCore/html/HTMLViewSourceDocument.cpp +++ b/WebCore/html/HTMLViewSourceDocument.cpp @@ -36,7 +36,7 @@ #include "HTMLTableElement.h" #include "HTMLTableRowElement.h" #include "HTMLTableSectionElement.h" -#include "HTMLTokenizer.h" +#include "HTMLDocumentParser.h" #include "Text.h" #include "TextDocument.h" @@ -51,19 +51,19 @@ HTMLViewSourceDocument::HTMLViewSourceDocument(Frame* frame, const String& mimeT setUsesBeforeAfterRules(true); } -Tokenizer* HTMLViewSourceDocument::createTokenizer() +DocumentParser* HTMLViewSourceDocument::createParser() { - // Use HTMLTokenizer if applicable, otherwise use TextTokenizer. + // Use HTMLDocumentParser if applicable, otherwise use TextDocumentParser. if (m_type == "text/html" || m_type == "application/xhtml+xml" || m_type == "image/svg+xml" || DOMImplementation::isXMLMIMEType(m_type) #if ENABLE(XHTMLMP) || m_type == "application/vnd.wap.xhtml+xml" #endif ) { // FIXME: Should respect Settings::html5ParserEnabled() - return new HTMLTokenizer(this); + return new HTMLDocumentParser(this); } - return createTextTokenizer(this); + return createTextDocumentParser(this); } void HTMLViewSourceDocument::createContainingTable() @@ -157,7 +157,7 @@ void HTMLViewSourceDocument::addViewSourceToken(Token* token) } else { const String& value = attr->value().string(); - // Compare ignoring case since HTMLTokenizer doesn't + // Compare ignoring case since HTMLDocumentParser doesn't // lower names when passing in tokens to // HTMLViewSourceDocument. if (equalIgnoringCase(token->tagName, "base") && equalIgnoringCase(attr->name().localName(), "href")) { @@ -244,7 +244,7 @@ void HTMLViewSourceDocument::addLine(const String& className) m_current = m_td = td; #ifdef DEBUG_LINE_NUMBERS - RefPtr<Text> lineNumberText = Text::create(this, String::number(tokenizer()->lineNumber() + 1) + " "); + RefPtr<Text> lineNumberText = Text::create(this, String::number(parser()->lineNumber() + 1) + " "); td->addChild(lineNumberText); lineNumberText->attach(); #endif diff --git a/WebCore/html/HTMLViewSourceDocument.h b/WebCore/html/HTMLViewSourceDocument.h index e4eadb0..7de7f31 100644 --- a/WebCore/html/HTMLViewSourceDocument.h +++ b/WebCore/html/HTMLViewSourceDocument.h @@ -42,15 +42,15 @@ public: return adoptRef(new HTMLViewSourceDocument(frame, mimeType)); } - void addViewSourceToken(Token*); // Used by the HTML tokenizer. - void addViewSourceText(const String&); // Used by the plaintext tokenizer. + void addViewSourceToken(Token*); // Used by the HTMLDocumentParser. + void addViewSourceText(const String&); // Used by the TextDocumentParser. void addViewSourceDoctypeToken(DoctypeToken*); private: HTMLViewSourceDocument(Frame*, const String& mimeType); - // Returns HTMLTokenizer or TextTokenizer based on m_type. - virtual Tokenizer* createTokenizer(); + // Returns HTMLDocumentParser or TextDocumentParser based on m_type. + virtual DocumentParser* createParser(); void createContainingTable(); PassRefPtr<Element> addSpanWithClassName(const String&); diff --git a/WebCore/html/ImageResizerThread.cpp b/WebCore/html/ImageResizerThread.cpp new file mode 100644 index 0000000..1bae6a0 --- /dev/null +++ b/WebCore/html/ImageResizerThread.cpp @@ -0,0 +1,97 @@ +/* + * 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" +#if ENABLE(IMAGE_RESIZER) + +#include "ImageResizerThread.h" + +#include "BitmapImage.h" +#include "Image.h" +#include "SharedBuffer.h" +#include <utility> + +namespace WebCore { + +static void returnBlobOrError(void* callbackInformation) +{ + AsyncImageResizer::CallbackInfo* callbackInfo = static_cast<AsyncImageResizer::CallbackInfo*>(callbackInformation); + if (!callbackInfo->blob) + callbackInfo->asyncImageResizer->resizeError(); + else + callbackInfo->asyncImageResizer->resizeComplete(callbackInfo->blob); + delete callbackInfo; +} + +bool ImageResizerThread::start(PassRefPtr<SharedBuffer> imageData, AsyncImageResizer::CallbackInfo* callbackInfo, AsyncImageResizer::OutputType outputType, IntSize desiredBounds, float quality, AsyncImageResizer::AspectRatioOption aspectRatioOption, AsyncImageResizer::OrientationOption orientationOption) +{ + ImageResizerThread* imageResizerThread = new ImageResizerThread(callbackInfo, outputType, desiredBounds, quality, aspectRatioOption, orientationOption); + + RefPtr<SharedBuffer> copiedImageData = imageData->copy(); + imageResizerThread->m_image = BitmapImage::create(); + imageResizerThread->m_image->setData(copiedImageData, true); + + imageResizerThread->m_threadID = createThread(ImageResizerThread::imageResizerThreadStart, imageResizerThread, "ImageResizerThread"); + return imageResizerThread->m_threadID; +} + +ImageResizerThread::ImageResizerThread(AsyncImageResizer::CallbackInfo* callbackInfo, AsyncImageResizer::OutputType outputType, IntSize desiredBounds, float quality, AsyncImageResizer::AspectRatioOption aspectRatioOption, AsyncImageResizer::OrientationOption orientationOption) + : m_threadID(0) + , m_callbackInfo(callbackInfo) + , m_outputType(outputType) + , m_desiredBounds(desiredBounds) + , m_quality(quality) + , m_aspectRatioOption(aspectRatioOption) + , m_orientationOption(orientationOption) +{ +} + +ImageResizerThread::~ImageResizerThread() +{ +} + +void* ImageResizerThread::imageResizerThreadStart(void* thread) +{ + return static_cast<ImageResizerThread*>(thread)->imageResizerThread(); +} + +void* ImageResizerThread::imageResizerThread() +{ + // FIXME: Do resizing, create blob, and catch any errors. + + callOnMainThread(returnBlobOrError, static_cast<void*>(m_callbackInfo)); + detachThread(m_threadID); + delete this; + return 0; +} + +} // namespace WebCore + +#endif // ENABLE(IMAGE_RESIZER) diff --git a/WebCore/html/ImageResizerThread.h b/WebCore/html/ImageResizerThread.h new file mode 100644 index 0000000..ae5ade5 --- /dev/null +++ b/WebCore/html/ImageResizerThread.h @@ -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. + */ + +#ifndef ImageResizerThread_h +#define ImageResizerThread_h + +#if ENABLE(IMAGE_RESIZER) + +#include "AsyncImageResizer.h" + +namespace WebCore { + +class BitmapImage; +class SharedBuffer; + +class ImageResizerThread { +public: + static bool start(PassRefPtr<SharedBuffer> imageData, AsyncImageResizer::CallbackInfo*, AsyncImageResizer::OutputType, IntSize desiredBounds, float quality, AsyncImageResizer::AspectRatioOption, AsyncImageResizer::OrientationOption); + ~ImageResizerThread(); + +private: + ImageResizerThread(AsyncImageResizer::CallbackInfo*, AsyncImageResizer::OutputType, IntSize desiredBounds, float quality, AsyncImageResizer::AspectRatioOption, AsyncImageResizer::OrientationOption); + static void* imageResizerThreadStart(void*); + void* imageResizerThread(); + + // Threading attributes. + ThreadIdentifier m_threadID; + + // Image attributes. + AsyncImageResizer::CallbackInfo* m_callbackInfo; + RefPtr<BitmapImage> m_image; + AsyncImageResizer::OutputType m_outputType; + IntSize m_desiredBounds; + float m_quality; + AsyncImageResizer::AspectRatioOption m_aspectRatioOption; + AsyncImageResizer::OrientationOption m_orientationOption; +}; + +} // namespace WebCore + +#endif // ENABLE(IMAGE_RESIZER) + +#endif // ImageResizerThread_h diff --git a/WebCore/html/LegacyHTMLTreeConstructor.cpp b/WebCore/html/LegacyHTMLTreeConstructor.cpp new file mode 100644 index 0000000..1db0bb6 --- /dev/null +++ b/WebCore/html/LegacyHTMLTreeConstructor.cpp @@ -0,0 +1,1744 @@ +/* + Copyright (C) 1997 Martin Jones (mjones@kde.org) + (C) 1997 Torben Weis (weis@kde.org) + (C) 1999,2001 Lars Knoll (knoll@kde.org) + (C) 2000,2001 Dirk Mueller (mueller@kde.org) + Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) + + 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 "LegacyHTMLTreeConstructor.h" + +#include "CharacterNames.h" +#include "CSSPropertyNames.h" +#include "CSSValueKeywords.h" +#include "Chrome.h" +#include "ChromeClient.h" +#include "Comment.h" +#include "Console.h" +#include "DOMWindow.h" +#include "DocumentFragment.h" +#include "DocumentType.h" +#include "Frame.h" +#include "HTMLBodyElement.h" +#include "HTMLDocument.h" +#include "HTMLDivElement.h" +#include "HTMLDListElement.h" +#include "HTMLElementFactory.h" +#include "HTMLFormElement.h" +#include "HTMLHeadElement.h" +#include "HTMLHRElement.h" +#include "HTMLHtmlElement.h" +#include "HTMLIsIndexElement.h" +#include "HTMLMapElement.h" +#include "HTMLNames.h" +#include "HTMLParserQuirks.h" +#include "HTMLTableCellElement.h" +#include "HTMLTableRowElement.h" +#include "HTMLTableSectionElement.h" +#include "HTMLDocumentParser.h" +#include "LocalizedStrings.h" +#include "Page.h" +#include "Settings.h" +#include "Text.h" +#include "TreeDepthLimit.h" +#include <wtf/StdLibExtras.h> +#include <wtf/dtoa.h> + +namespace WebCore { + +using namespace HTMLNames; + +static const unsigned cMaxRedundantTagDepth = 20; +static const unsigned cResidualStyleMaxDepth = 200; +static const unsigned cResidualStyleIterationLimit = 5; + + +static const int minBlockLevelTagPriority = 3; + +// A cap on the number of tags with priority minBlockLevelTagPriority or higher +// allowed in m_blockStack. The cap is enforced by adding such new elements as +// siblings instead of children once it is reached. +static const size_t cMaxBlockDepth = 4096; + + +typedef HashSet<AtomicStringImpl*> TagNameSet; + +template< size_t ArraySize > +static void addTags(TagNameSet& set, QualifiedName (&names)[ArraySize]) +{ + for (size_t x = 0; x < ArraySize; x++) { + const QualifiedName& name = names[x]; + set.add(name.localName().impl()); + } +} + +struct HTMLStackElem : Noncopyable { + HTMLStackElem(const AtomicString& t, int lvl, Node* n, bool r, HTMLStackElem* nx) + : tagName(t) + , level(lvl) + , strayTableContent(false) + , node(n) + , didRefNode(r) + , next(nx) + { + } + + void derefNode() + { + if (didRefNode) + node->deref(); + } + + AtomicString tagName; + int level; + bool strayTableContent; + Node* node; + bool didRefNode; + HTMLStackElem* next; +}; + +/** + * The parser parses tokenized input into the document, building up the + * document tree. If the document is well-formed, parsing it is straightforward. + * + * Unfortunately, we have to handle many HTML documents that are not well-formed, + * so the parser has to be tolerant about errors. + * + * We have to take care of at least the following error conditions: + * + * 1. The element being added is explicitly forbidden inside some outer tag. + * In this case we should close all tags up to the one, which forbids + * the element, and add it afterwards. + * + * 2. We are not allowed to add the element directly. It could be that + * the person writing the document forgot some tag in between (or that the + * tag in between is optional). This could be the case with the following + * tags: HTML HEAD BODY TBODY TR TD LI (did I forget any?). + * + * 3. We want to add a block element inside to an inline element. Close all + * inline elements up to the next higher block element. + * + * 4. If this doesn't help, close elements until we are allowed to add the + * element or ignore the tag. + * + */ + +LegacyHTMLTreeConstructor::LegacyHTMLTreeConstructor(HTMLDocument* doc, bool reportErrors) + : m_document(doc) + , m_current(doc) + , m_didRefCurrent(false) + , m_blockStack(0) + , m_blocksInStack(0) + , m_treeDepth(0) + , m_hasPElementInScope(NotInScope) + , m_inBody(false) + , m_haveContent(false) + , m_haveFrameSet(false) + , m_isParsingFragment(false) + , m_reportErrors(reportErrors) + , m_handlingResidualStyleAcrossBlocks(false) + , m_inStrayTableContent(0) + , m_scriptingPermission(FragmentScriptingAllowed) + , m_parserQuirks(m_document->page() ? m_document->page()->chrome()->client()->createHTMLParserQuirks() : 0) +{ +} + +LegacyHTMLTreeConstructor::LegacyHTMLTreeConstructor(DocumentFragment* frag, FragmentScriptingPermission scriptingPermission) + : m_document(frag->document()) + , m_current(frag) + , m_didRefCurrent(true) + , m_blockStack(0) + , m_blocksInStack(0) + , m_treeDepth(0) + , m_hasPElementInScope(NotInScope) + , m_inBody(true) + , m_haveContent(false) + , m_haveFrameSet(false) + , m_isParsingFragment(true) + , m_reportErrors(false) + , m_handlingResidualStyleAcrossBlocks(false) + , m_inStrayTableContent(0) + , m_scriptingPermission(scriptingPermission) + , m_parserQuirks(m_document->page() ? m_document->page()->chrome()->client()->createHTMLParserQuirks() : 0) +{ + if (frag) + frag->ref(); +} + +LegacyHTMLTreeConstructor::~LegacyHTMLTreeConstructor() +{ + freeBlock(); + if (m_didRefCurrent) + m_current->deref(); +} + +void LegacyHTMLTreeConstructor::reset() +{ + ASSERT(!m_isParsingFragment); + + setCurrent(m_document); + + freeBlock(); + + m_treeDepth = 0; + m_inBody = false; + m_haveFrameSet = false; + m_haveContent = false; + m_inStrayTableContent = 0; + + m_currentFormElement = 0; + m_currentMapElement = 0; + m_head = 0; + m_isindexElement = 0; + + m_skipModeTag = nullAtom; + + if (m_parserQuirks) + m_parserQuirks->reset(); +} + +void LegacyHTMLTreeConstructor::setCurrent(Node* newCurrent) +{ + bool didRefNewCurrent = newCurrent && newCurrent != m_document; + if (didRefNewCurrent) + newCurrent->ref(); + if (m_didRefCurrent) + m_current->deref(); + m_current = newCurrent; + m_didRefCurrent = didRefNewCurrent; +} + +inline static int tagPriorityOfNode(Node* n) +{ + return n->isHTMLElement() ? static_cast<HTMLElement*>(n)->tagPriority() : 0; +} + +inline void LegacyHTMLTreeConstructor::limitDepth(int tagPriority) +{ + while (m_treeDepth >= maxDOMTreeDepth) + popBlock(m_blockStack->tagName); + if (tagPriority >= minBlockLevelTagPriority) { + while (m_blocksInStack >= cMaxBlockDepth) + popBlock(m_blockStack->tagName); + } +} + +inline bool LegacyHTMLTreeConstructor::insertNodeAfterLimitDepth(Node* n, bool flat) +{ + limitDepth(tagPriorityOfNode(n)); + return insertNode(n, flat); +} + +PassRefPtr<Node> LegacyHTMLTreeConstructor::parseToken(Token* t) +{ + if (!m_skipModeTag.isNull()) { + if (!t->beginTag && t->tagName == m_skipModeTag) + // Found the end tag for the current skip mode, so we're done skipping. + m_skipModeTag = nullAtom; + else if (m_current->localName() == t->tagName) + // Do not skip </iframe>. + // FIXME: What does that comment mean? How can it be right to parse a token without clearing m_skipModeTag? + ; + else + return 0; + } + + // Apparently some sites use </br> instead of <br>. Be compatible with IE and Firefox and treat this like <br>. + if (t->isCloseTag(brTag) && m_document->inCompatMode()) { + reportError(MalformedBRError); + t->beginTag = true; + } + + if (!t->beginTag) { + processCloseTag(t); + return 0; + } + + // Ignore spaces, if we're not inside a paragraph or other inline code. + // Do not alter the text if it is part of a scriptTag. + if (t->tagName == textAtom && t->text && m_current->localName() != scriptTag) { + if (m_inBody && !skipMode() && m_current->localName() != styleTag && + m_current->localName() != titleTag && !t->text->containsOnlyWhitespace()) + m_haveContent = true; + + RefPtr<Node> n; + String text = t->text.get(); + unsigned charsLeft = text.length(); + while (charsLeft) { + // split large blocks of text to nodes of manageable size + n = Text::createWithLengthLimit(m_document, text, charsLeft); + if (!insertNodeAfterLimitDepth(n.get(), t->selfClosingTag)) + return 0; + } + return n; + } + + RefPtr<Node> n = getNode(t); + // just to be sure, and to catch currently unimplemented stuff + if (!n) + return 0; + + // set attributes + if (n->isHTMLElement()) { + HTMLElement* e = static_cast<HTMLElement*>(n.get()); + if (m_scriptingPermission == FragmentScriptingAllowed || t->tagName != scriptTag) + e->setAttributeMap(t->attrs.get(), m_scriptingPermission); + + // take care of optional close tags + if (e->endTagRequirement() == TagStatusOptional) + popBlock(t->tagName); + + // If the node does not have a forbidden end tag requirement, and if the broken XML self-closing + // syntax was used, report an error. + if (t->brokenXMLStyle && e->endTagRequirement() != TagStatusForbidden) { + if (t->tagName == scriptTag) + reportError(IncorrectXMLCloseScriptWarning); + else + reportError(IncorrectXMLSelfCloseError, &t->tagName); + } + } + + if (!insertNodeAfterLimitDepth(n.get(), t->selfClosingTag)) { + // we couldn't insert the node + + if (n->isElementNode()) { + Element* e = static_cast<Element*>(n.get()); + e->setAttributeMap(0); + } + + if (m_currentMapElement == n) + m_currentMapElement = 0; + + if (m_currentFormElement == n) + m_currentFormElement = 0; + + if (m_head == n) + m_head = 0; + + return 0; + } + return n; +} + +void LegacyHTMLTreeConstructor::parseDoctypeToken(DoctypeToken* t) +{ + // Ignore any doctype after the first. Ignore doctypes in fragments. + if (m_document->doctype() || m_isParsingFragment || m_current != m_document) + return; + + // Make a new doctype node and set it as our doctype. + m_document->addChild(DocumentType::create(m_document, String::adopt(t->m_name), String::adopt(t->m_publicID), String::adopt(t->m_systemID))); + if (t->m_forceQuirks) + m_document->setParseMode(Document::Compat); +} + +static bool isTableSection(const Node* n) +{ + return n->hasTagName(tbodyTag) || n->hasTagName(tfootTag) || n->hasTagName(theadTag); +} + +static bool isTablePart(const Node* n) +{ + return n->hasTagName(trTag) || n->hasTagName(tdTag) || n->hasTagName(thTag) + || isTableSection(n); +} + +static bool isTableRelated(const Node* n) +{ + return n->hasTagName(tableTag) || isTablePart(n); +} + +static bool isScopingTag(const AtomicString& tagName) +{ + return tagName == appletTag || tagName == captionTag || tagName == tdTag + || tagName == thTag || tagName == buttonTag || tagName == marqueeTag + || tagName == objectTag || tagName == tableTag || tagName == htmlTag; +} + +bool LegacyHTMLTreeConstructor::insertNode(Node* n, bool flat) +{ + RefPtr<Node> protectNode(n); + + const AtomicString& localName = n->localName(); + + // <table> is never allowed inside stray table content. Always pop out of the stray table content + // and close up the first table, and then start the second table as a sibling. + if (m_inStrayTableContent && localName == tableTag) + popBlock(tableTag); + + if (m_parserQuirks && !m_parserQuirks->shouldInsertNode(m_current, n)) + return false; + + int tagPriority = tagPriorityOfNode(n); + + // let's be stupid and just try to insert it. + // this should work if the document is well-formed + Node* newNode = m_current->addChild(n); + if (!newNode) + return handleError(n, flat, localName, tagPriority); // Try to handle the error. + + // don't push elements without end tags (e.g., <img>) on the stack + bool parentAttached = m_current->attached(); + if (tagPriority > 0 && !flat) { + if (newNode == m_current) { + // This case should only be hit when a demoted <form> is placed inside a table. + ASSERT(localName == formTag); + reportError(FormInsideTablePartError, &m_current->localName()); + HTMLFormElement* form = static_cast<HTMLFormElement*>(n); + form->setDemoted(true); + } else { + // The pushBlock function transfers ownership of current to the block stack + // so we're guaranteed that m_didRefCurrent is false. The code below is an + // optimized version of setCurrent that takes advantage of that fact and also + // assumes that newNode is neither 0 nor a pointer to the document. + pushBlock(localName, tagPriority); + newNode->beginParsingChildren(); + ASSERT(!m_didRefCurrent); + newNode->ref(); + m_current = newNode; + m_didRefCurrent = true; + } + if (parentAttached && !n->attached() && !m_isParsingFragment) + n->attach(); + } else { + if (parentAttached && !n->attached() && !m_isParsingFragment) + n->attach(); + n->finishParsingChildren(); + } + + if (localName == htmlTag && m_document->frame() && !m_isParsingFragment) + m_document->frame()->loader()->dispatchDocumentElementAvailable(); + + return true; +} + +bool LegacyHTMLTreeConstructor::handleError(Node* n, bool flat, const AtomicString& localName, int tagPriority) +{ + // Error handling code. This is just ad hoc handling of specific parent/child combinations. + bool handled = false; + + // 1. Check out the element's tag name to decide how to deal with errors. + if (n->isHTMLElement()) { + HTMLElement* h = static_cast<HTMLElement*>(n); + if (h->hasLocalName(trTag) || h->hasLocalName(thTag) || h->hasLocalName(tdTag)) { + if (m_inStrayTableContent && !isTableRelated(m_current)) { + reportError(MisplacedTablePartError, &localName, &m_current->localName()); + // pop out to the nearest enclosing table-related tag. + while (m_blockStack && !isTableRelated(m_current)) + popOneBlock(); + return insertNode(n); + } + } else if (h->hasLocalName(headTag)) { + if (!m_current->isDocumentNode() && !m_current->hasTagName(htmlTag)) { + reportError(MisplacedHeadError); + return false; + } + } else if (h->hasLocalName(metaTag) || h->hasLocalName(linkTag) || h->hasLocalName(baseTag)) { + bool createdHead = false; + if (!m_head) { + createHead(); + createdHead = true; + } + if (m_head) { + if (!createdHead) + reportError(MisplacedHeadContentError, &localName, &m_current->localName()); + if (m_head->addChild(n)) { + if (!n->attached() && !m_isParsingFragment) + n->attach(); + return true; + } else + return false; + } + } else if (h->hasLocalName(htmlTag)) { + if (!m_current->isDocumentNode() ) { + if (m_document->documentElement() && m_document->documentElement()->hasTagName(htmlTag) && !m_isParsingFragment) { + reportError(RedundantHTMLBodyError, &localName); + // we have another <HTML> element.... apply attributes to existing one + // make sure we don't overwrite already existing attributes + NamedNodeMap* map = static_cast<Element*>(n)->attributes(true); + Element* existingHTML = static_cast<Element*>(m_document->documentElement()); + NamedNodeMap* bmap = existingHTML->attributes(false); + for (unsigned l = 0; map && l < map->length(); ++l) { + Attribute* it = map->attributeItem(l); + if (!bmap->getAttributeItem(it->name())) + existingHTML->setAttribute(it->name(), it->value()); + } + } + return false; + } + } else if (h->hasLocalName(titleTag) || h->hasLocalName(styleTag) || h->hasLocalName(scriptTag)) { + bool createdHead = false; + if (!m_head) { + createHead(); + createdHead = true; + } + if (m_head) { + Node* newNode = m_head->addChild(n); + if (!newNode) { + setSkipMode(h->tagQName()); + return false; + } + + if (!createdHead) + reportError(MisplacedHeadContentError, &localName, &m_current->localName()); + + pushBlock(localName, tagPriority); + newNode->beginParsingChildren(); + setCurrent(newNode); + if (!n->attached() && !m_isParsingFragment) + n->attach(); + return true; + } + if (m_inBody) { + setSkipMode(h->tagQName()); + return false; + } + } else if (h->hasLocalName(bodyTag)) { + if (m_inBody && m_document->body() && !m_isParsingFragment) { + // we have another <BODY> element.... apply attributes to existing one + // make sure we don't overwrite already existing attributes + // some sites use <body bgcolor=rightcolor>...<body bgcolor=wrongcolor> + reportError(RedundantHTMLBodyError, &localName); + NamedNodeMap* map = static_cast<Element*>(n)->attributes(true); + Element* existingBody = m_document->body(); + NamedNodeMap* bmap = existingBody->attributes(false); + for (unsigned l = 0; map && l < map->length(); ++l) { + Attribute* it = map->attributeItem(l); + if (!bmap->getAttributeItem(it->name())) + existingBody->setAttribute(it->name(), it->value()); + } + return false; + } else if (!m_current->isDocumentNode()) + return false; + } else if (h->hasLocalName(areaTag)) { + if (m_currentMapElement) { + reportError(MisplacedAreaError, &m_current->localName()); + m_currentMapElement->addChild(n); + if (!n->attached() && !m_isParsingFragment) + n->attach(); + handled = true; + return true; + } + return false; + } else if (h->hasLocalName(colgroupTag) || h->hasLocalName(captionTag)) { + if (isTableRelated(m_current)) { + while (m_blockStack && isTablePart(m_current)) + popOneBlock(); + return insertNode(n); + } + } + } else if (n->isCommentNode() && !m_head) + return false; + + // 2. Next we examine our currently active element to do some further error handling. + if (m_current->isHTMLElement()) { + HTMLElement* h = static_cast<HTMLElement*>(m_current); + const AtomicString& currentTagName = h->localName(); + if (h->hasLocalName(htmlTag)) { + HTMLElement* elt = n->isHTMLElement() ? static_cast<HTMLElement*>(n) : 0; + if (elt && (elt->hasLocalName(scriptTag) || elt->hasLocalName(styleTag) || + elt->hasLocalName(metaTag) || elt->hasLocalName(linkTag) || + elt->hasLocalName(objectTag) || elt->hasLocalName(embedTag) || + elt->hasLocalName(titleTag) || elt->hasLocalName(isindexTag) || + elt->hasLocalName(baseTag))) { + if (!m_head) { + m_head = HTMLHeadElement::create(m_document); + insertNode(m_head.get()); + handled = true; + } + } else { + if (n->isTextNode()) { + Text* t = static_cast<Text*>(n); + if (t->containsOnlyWhitespace()) + return false; + } + if (!m_haveFrameSet) { + // Ensure that head exists. + // But not for older versions of Mail, where the implicit <head> isn't expected - <rdar://problem/6863795> + if (!m_isParsingFragment && shouldCreateImplicitHead(m_document)) + createHead(); + + popBlock(headTag); + startBody(); + insertNode(HTMLBodyElement::create(m_document).get()); + handled = true; + } else + reportError(MisplacedFramesetContentError, &localName); + } + } else if (h->hasLocalName(headTag)) { + if (n->hasTagName(htmlTag)) + return false; + else { + // This means the body starts here... + if (!m_haveFrameSet) { + ASSERT(currentTagName == headTag); + popBlock(currentTagName); + startBody(); + insertNode(HTMLBodyElement::create(m_document).get()); + handled = true; + } else + reportError(MisplacedFramesetContentError, &localName); + } + } else if (h->hasLocalName(addressTag) || h->hasLocalName(fontTag) + || h->hasLocalName(styleTag) || h->hasLocalName(titleTag)) { + reportError(MisplacedContentRetryError, &localName, ¤tTagName); + popBlock(currentTagName); + handled = true; + } else if (h->hasLocalName(captionTag)) { + // Illegal content in a caption. Close the caption and try again. + reportError(MisplacedCaptionContentError, &localName); + popBlock(currentTagName); + if (isTablePart(n)) + return insertNode(n, flat); + } else if (h->hasLocalName(tableTag) || h->hasLocalName(trTag) || isTableSection(h)) { + if (n->hasTagName(tableTag)) { + reportError(MisplacedTableError, ¤tTagName); + if (m_isParsingFragment && !h->hasLocalName(tableTag)) + // fragment may contain table parts without <table> ancestor, pop them one by one + popBlock(h->localName()); + popBlock(localName); // end the table + handled = true; // ...and start a new one + } else { + ExceptionCode ec = 0; + Node* node = m_current; + Node* parent = node->parentNode(); + // A script may have removed the current node's parent from the DOM + // http://bugs.webkit.org/show_bug.cgi?id=7137 + // FIXME: we should do real recovery here and re-parent with the correct node. + if (!parent) + return false; + Node* grandparent = parent->parentNode(); + + if (n->isTextNode() || + (h->hasLocalName(trTag) && + isTableSection(parent) && grandparent && grandparent->hasTagName(tableTag)) || + ((!n->hasTagName(tdTag) && !n->hasTagName(thTag) && + !n->hasTagName(formTag) && !n->hasTagName(scriptTag)) && isTableSection(node) && + parent->hasTagName(tableTag))) { + node = (node->hasTagName(tableTag)) ? node : + ((node->hasTagName(trTag)) ? grandparent : parent); + // This can happen with fragments + if (!node) + return false; + Node* parent = node->parentNode(); + if (!parent) + return false; + parent->insertBefore(n, node, ec); + if (!ec) { + reportError(StrayTableContentError, &localName, ¤tTagName); + if (n->isHTMLElement() && tagPriority > 0 && + !flat && static_cast<HTMLElement*>(n)->endTagRequirement() != TagStatusForbidden) + { + pushBlock(localName, tagPriority); + n->beginParsingChildren(); + setCurrent(n); + m_inStrayTableContent++; + m_blockStack->strayTableContent = true; + } + return true; + } + } + + if (!ec) { + if (m_current->hasTagName(trTag)) { + reportError(TablePartRequiredError, &localName, &tdTag.localName()); + insertNode(HTMLTableCellElement::create(tdTag, m_document).get()); + } else if (m_current->hasTagName(tableTag)) { + // Don't report an error in this case, since making a <tbody> happens all the time when you have <table><tr>, + // and it isn't really a parse error per se. + insertNode(HTMLTableSectionElement::create(tbodyTag, m_document).get()); + } else { + reportError(TablePartRequiredError, &localName, &trTag.localName()); + insertNode(HTMLTableRowElement::create(m_document).get()); + } + handled = true; + } + } + } else if (h->hasLocalName(objectTag)) { + reportError(MisplacedContentRetryError, &localName, ¤tTagName); + popBlock(objectTag); + handled = true; + } else if (h->hasLocalName(pTag) || isHeadingTag(currentTagName)) { + if (!isInline(n)) { + popBlock(currentTagName); + handled = true; + } + } else if (h->hasLocalName(optionTag) || h->hasLocalName(optgroupTag)) { + if (localName == optgroupTag) { + popBlock(currentTagName); + handled = true; + } else if (localName == selectTag) { + // IE treats a nested select as </select>. Let's do the same + popBlock(localName); + } + } else if (h->hasLocalName(selectTag)) { + if (localName == inputTag || localName == textareaTag) { + reportError(MisplacedContentRetryError, &localName, ¤tTagName); + popBlock(currentTagName); + handled = true; + } + } else if (h->hasLocalName(colgroupTag)) { + popBlock(currentTagName); + handled = true; + } else if (!h->hasLocalName(bodyTag)) { + if (isInline(m_current)) { + popInlineBlocks(); + handled = true; + } + } + } else if (m_current->isDocumentNode()) { + if (n->isTextNode()) { + Text* t = static_cast<Text*>(n); + if (t->containsOnlyWhitespace()) + return false; + } + + if (!m_document->documentElement()) { + insertNode(HTMLHtmlElement::create(m_document).get()); + handled = true; + } + } + + // 3. If we couldn't handle the error, just return false and attempt to error-correct again. + if (!handled) { + reportError(IgnoredContentError, &localName, &m_current->localName()); + return false; + } + return insertNode(n); +} + +typedef bool (LegacyHTMLTreeConstructor::*CreateErrorCheckFunc)(Token* t, RefPtr<Node>&); +typedef HashMap<AtomicStringImpl*, CreateErrorCheckFunc> FunctionMap; + +bool LegacyHTMLTreeConstructor::textCreateErrorCheck(Token* t, RefPtr<Node>& result) +{ + result = Text::create(m_document, t->text.get()); + return false; +} + +bool LegacyHTMLTreeConstructor::commentCreateErrorCheck(Token* t, RefPtr<Node>& result) +{ + result = Comment::create(m_document, t->text.get()); + return false; +} + +bool LegacyHTMLTreeConstructor::headCreateErrorCheck(Token*, RefPtr<Node>& result) +{ + if (!m_head || m_current->localName() == htmlTag) { + m_head = HTMLHeadElement::create(m_document); + result = m_head; + } else + reportError(MisplacedHeadError); + return false; +} + +bool LegacyHTMLTreeConstructor::bodyCreateErrorCheck(Token*, RefPtr<Node>&) +{ + // body no longer allowed if we have a frameset + if (m_haveFrameSet) + return false; + + // Ensure that head exists (unless parsing a fragment). + // But not for older versions of Mail, where the implicit <head> isn't expected - <rdar://problem/6863795> + if (!m_isParsingFragment && shouldCreateImplicitHead(m_document)) + createHead(); + + popBlock(headTag); + startBody(); + return true; +} + +bool LegacyHTMLTreeConstructor::framesetCreateErrorCheck(Token*, RefPtr<Node>&) +{ + popBlock(headTag); + if (m_inBody && !m_haveFrameSet && !m_haveContent) { + popBlock(bodyTag); + // ### actually for IE document.body returns the now hidden "body" element + // we can't implement that behaviour now because it could cause too many + // regressions and the headaches are not worth the work as long as there is + // no site actually relying on that detail (Dirk) + if (m_document->body() && !m_isParsingFragment) + m_document->body()->setAttribute(styleAttr, "display:none"); + m_inBody = false; + } + if ((m_haveContent || m_haveFrameSet) && m_current->localName() == htmlTag) + return false; + m_haveFrameSet = true; + startBody(); + return true; +} + +bool LegacyHTMLTreeConstructor::formCreateErrorCheck(Token* t, RefPtr<Node>& result) +{ + // Only create a new form if we're not already inside one. + // This is consistent with other browsers' behavior. + if (!m_currentFormElement) { + m_currentFormElement = HTMLFormElement::create(m_document); + result = m_currentFormElement; + pCloserCreateErrorCheck(t, result); + } + return false; +} + +bool LegacyHTMLTreeConstructor::isindexCreateErrorCheck(Token* t, RefPtr<Node>& result) +{ + RefPtr<Node> n = handleIsindex(t); + if (!m_inBody) + m_isindexElement = n.release(); + else { + t->selfClosingTag = true; + result = n.release(); + } + return false; +} + +bool LegacyHTMLTreeConstructor::selectCreateErrorCheck(Token*, RefPtr<Node>&) +{ + return true; +} + +bool LegacyHTMLTreeConstructor::ddCreateErrorCheck(Token* t, RefPtr<Node>& result) +{ + pCloserCreateErrorCheck(t, result); + popBlock(dtTag); + popBlock(ddTag); + return true; +} + +bool LegacyHTMLTreeConstructor::dtCreateErrorCheck(Token* t, RefPtr<Node>& result) +{ + pCloserCreateErrorCheck(t, result); + popBlock(ddTag); + popBlock(dtTag); + return true; +} + +bool LegacyHTMLTreeConstructor::rpCreateErrorCheck(Token*, RefPtr<Node>&) +{ + popBlock(rpTag); + popBlock(rtTag); + return true; +} + +bool LegacyHTMLTreeConstructor::rtCreateErrorCheck(Token*, RefPtr<Node>&) +{ + popBlock(rpTag); + popBlock(rtTag); + return true; +} + +bool LegacyHTMLTreeConstructor::nestedCreateErrorCheck(Token* t, RefPtr<Node>&) +{ + popBlock(t->tagName); + return true; +} + +bool LegacyHTMLTreeConstructor::nestedPCloserCreateErrorCheck(Token* t, RefPtr<Node>& result) +{ + pCloserCreateErrorCheck(t, result); + popBlock(t->tagName); + return true; +} + +bool LegacyHTMLTreeConstructor::nestedStyleCreateErrorCheck(Token* t, RefPtr<Node>&) +{ + return allowNestedRedundantTag(t->tagName); +} + +bool LegacyHTMLTreeConstructor::tableCellCreateErrorCheck(Token*, RefPtr<Node>&) +{ + popBlock(tdTag); + popBlock(thTag); + return true; +} + +bool LegacyHTMLTreeConstructor::tableSectionCreateErrorCheck(Token*, RefPtr<Node>&) +{ + popBlock(theadTag); + popBlock(tbodyTag); + popBlock(tfootTag); + return true; +} + +bool LegacyHTMLTreeConstructor::noembedCreateErrorCheck(Token*, RefPtr<Node>&) +{ + setSkipMode(noembedTag); + return true; +} + +bool LegacyHTMLTreeConstructor::noframesCreateErrorCheck(Token*, RefPtr<Node>&) +{ + setSkipMode(noframesTag); + return true; +} + +bool LegacyHTMLTreeConstructor::noscriptCreateErrorCheck(Token*, RefPtr<Node>&) +{ + if (!m_isParsingFragment) { + Frame* frame = m_document->frame(); + if (frame && frame->script()->canExecuteScripts(NotAboutToExecuteScript)) + setSkipMode(noscriptTag); + } + return true; +} + +bool LegacyHTMLTreeConstructor::pCloserCreateErrorCheck(Token*, RefPtr<Node>&) +{ + if (hasPElementInScope()) + popBlock(pTag); + return true; +} + +bool LegacyHTMLTreeConstructor::pCloserStrictCreateErrorCheck(Token*, RefPtr<Node>&) +{ + if (m_document->inCompatMode()) + return true; + if (hasPElementInScope()) + popBlock(pTag); + return true; +} + +bool LegacyHTMLTreeConstructor::mapCreateErrorCheck(Token*, RefPtr<Node>& result) +{ + m_currentMapElement = HTMLMapElement::create(m_document); + result = m_currentMapElement; + return false; +} + +static void mapTagToFunc(FunctionMap& map, const QualifiedName& tag, CreateErrorCheckFunc func) +{ + map.set(tag.localName().impl(), func); +} + +template< size_t ArraySize > +static void mapTagsToFunc(FunctionMap& map, QualifiedName (&names)[ArraySize], CreateErrorCheckFunc func) +{ + for (size_t x = 0; x < ArraySize; x++) { + const QualifiedName& name = names[x]; + mapTagToFunc(map, name, func); + } +} + +PassRefPtr<Node> LegacyHTMLTreeConstructor::getNode(Token* t) +{ + // Init our error handling table. + DEFINE_STATIC_LOCAL(FunctionMap, gFunctionMap, ()); + if (gFunctionMap.isEmpty()) { + QualifiedName nestedCreateErrorTags[] = { aTag, buttonTag, nobrTag, trTag }; + mapTagsToFunc(gFunctionMap, nestedCreateErrorTags, &LegacyHTMLTreeConstructor::nestedCreateErrorCheck); + + QualifiedName nestedStyleCreateErrorTags[] = { bTag, bigTag, iTag, sTag, smallTag, strikeTag, ttTag, uTag }; + mapTagsToFunc(gFunctionMap, nestedStyleCreateErrorTags, &LegacyHTMLTreeConstructor::nestedStyleCreateErrorCheck); + + QualifiedName pCloserCreateErrorTags[] = { addressTag, articleTag, + asideTag, blockquoteTag, centerTag, dirTag, divTag, dlTag, + fieldsetTag, footerTag, h1Tag, h2Tag, h3Tag, h4Tag, h5Tag, h6Tag, + headerTag, hgroupTag, hrTag, listingTag, menuTag, navTag, olTag, + pTag, plaintextTag, preTag, sectionTag, ulTag }; + mapTagsToFunc(gFunctionMap, pCloserCreateErrorTags, &LegacyHTMLTreeConstructor::pCloserCreateErrorCheck); + + mapTagToFunc(gFunctionMap, bodyTag, &LegacyHTMLTreeConstructor::bodyCreateErrorCheck); + mapTagToFunc(gFunctionMap, ddTag, &LegacyHTMLTreeConstructor::ddCreateErrorCheck); + mapTagToFunc(gFunctionMap, dtTag, &LegacyHTMLTreeConstructor::dtCreateErrorCheck); + mapTagToFunc(gFunctionMap, formTag, &LegacyHTMLTreeConstructor::formCreateErrorCheck); + mapTagToFunc(gFunctionMap, framesetTag, &LegacyHTMLTreeConstructor::framesetCreateErrorCheck); + mapTagToFunc(gFunctionMap, headTag, &LegacyHTMLTreeConstructor::headCreateErrorCheck); + mapTagToFunc(gFunctionMap, isindexTag, &LegacyHTMLTreeConstructor::isindexCreateErrorCheck); + mapTagToFunc(gFunctionMap, mapTag, &LegacyHTMLTreeConstructor::mapCreateErrorCheck); + mapTagToFunc(gFunctionMap, liTag, &LegacyHTMLTreeConstructor::nestedPCloserCreateErrorCheck); + mapTagToFunc(gFunctionMap, noembedTag, &LegacyHTMLTreeConstructor::noembedCreateErrorCheck); + mapTagToFunc(gFunctionMap, noframesTag, &LegacyHTMLTreeConstructor::noframesCreateErrorCheck); + mapTagToFunc(gFunctionMap, noscriptTag, &LegacyHTMLTreeConstructor::noscriptCreateErrorCheck); + mapTagToFunc(gFunctionMap, tableTag, &LegacyHTMLTreeConstructor::pCloserStrictCreateErrorCheck); + mapTagToFunc(gFunctionMap, rpTag, &LegacyHTMLTreeConstructor::rpCreateErrorCheck); + mapTagToFunc(gFunctionMap, rtTag, &LegacyHTMLTreeConstructor::rtCreateErrorCheck); + mapTagToFunc(gFunctionMap, selectTag, &LegacyHTMLTreeConstructor::selectCreateErrorCheck); + mapTagToFunc(gFunctionMap, tdTag, &LegacyHTMLTreeConstructor::tableCellCreateErrorCheck); + mapTagToFunc(gFunctionMap, thTag, &LegacyHTMLTreeConstructor::tableCellCreateErrorCheck); + mapTagToFunc(gFunctionMap, tbodyTag, &LegacyHTMLTreeConstructor::tableSectionCreateErrorCheck); + mapTagToFunc(gFunctionMap, tfootTag, &LegacyHTMLTreeConstructor::tableSectionCreateErrorCheck); + mapTagToFunc(gFunctionMap, theadTag, &LegacyHTMLTreeConstructor::tableSectionCreateErrorCheck); + + gFunctionMap.set(commentAtom.impl(), &LegacyHTMLTreeConstructor::commentCreateErrorCheck); + gFunctionMap.set(textAtom.impl(), &LegacyHTMLTreeConstructor::textCreateErrorCheck); + } + + bool proceed = true; + RefPtr<Node> result; + if (CreateErrorCheckFunc errorCheckFunc = gFunctionMap.get(t->tagName.impl())) + proceed = (this->*errorCheckFunc)(t, result); + if (proceed) + result = HTMLElementFactory::createHTMLElement(QualifiedName(nullAtom, t->tagName, xhtmlNamespaceURI), m_document, m_currentFormElement.get()); + return result.release(); +} + +bool LegacyHTMLTreeConstructor::allowNestedRedundantTag(const AtomicString& tagName) +{ + // www.liceo.edu.mx is an example of a site that achieves a level of nesting of + // about 1500 tags, all from a bunch of <b>s. We will only allow at most 20 + // nested tags of the same type before just ignoring them all together. + unsigned i = 0; + for (HTMLStackElem* curr = m_blockStack; + i < cMaxRedundantTagDepth && curr && curr->tagName == tagName; + curr = curr->next, i++) { } + return i != cMaxRedundantTagDepth; +} + +void LegacyHTMLTreeConstructor::processCloseTag(Token* t) +{ + // Support for really broken html. + // we never close the body tag, since some stupid web pages close it before the actual end of the doc. + // let's rely on the end() call to close things. + if (t->tagName == htmlTag || t->tagName == bodyTag || t->tagName == commentAtom) + return; + + bool checkForCloseTagErrors = true; + if (t->tagName == formTag && m_currentFormElement) { + m_currentFormElement = 0; + checkForCloseTagErrors = false; + } else if (t->tagName == mapTag) + m_currentMapElement = 0; + else if (t->tagName == pTag) + checkForCloseTagErrors = false; + + HTMLStackElem* oldElem = m_blockStack; + popBlock(t->tagName, checkForCloseTagErrors); + if (oldElem == m_blockStack && t->tagName == pTag) { + // We encountered a stray </p>. Amazingly Gecko, WinIE, and MacIE all treat + // this as a valid break, i.e., <p></p>. So go ahead and make the empty + // paragraph. + t->beginTag = true; + parseToken(t); + popBlock(t->tagName); + reportError(StrayParagraphCloseError); + } +} + +bool LegacyHTMLTreeConstructor::isHeadingTag(const AtomicString& tagName) +{ + DEFINE_STATIC_LOCAL(TagNameSet, headingTags, ()); + if (headingTags.isEmpty()) { + QualifiedName tagNames[] = { h1Tag, h2Tag, h3Tag, h4Tag, h5Tag, h6Tag }; + addTags(headingTags, tagNames); + } + return headingTags.contains(tagName.impl()); +} + +bool LegacyHTMLTreeConstructor::isInline(Node* node) const +{ + if (node->isTextNode()) + return true; + + if (node->isHTMLElement()) { + HTMLElement* e = static_cast<HTMLElement*>(node); + if (e->hasLocalName(aTag) || e->hasLocalName(fontTag) || e->hasLocalName(ttTag) || + e->hasLocalName(uTag) || e->hasLocalName(bTag) || e->hasLocalName(iTag) || + e->hasLocalName(sTag) || e->hasLocalName(strikeTag) || e->hasLocalName(bigTag) || + e->hasLocalName(smallTag) || e->hasLocalName(emTag) || e->hasLocalName(strongTag) || + e->hasLocalName(dfnTag) || e->hasLocalName(codeTag) || e->hasLocalName(sampTag) || + e->hasLocalName(kbdTag) || e->hasLocalName(varTag) || e->hasLocalName(citeTag) || + e->hasLocalName(abbrTag) || e->hasLocalName(acronymTag) || e->hasLocalName(subTag) || + e->hasLocalName(supTag) || e->hasLocalName(spanTag) || e->hasLocalName(nobrTag) || + e->hasLocalName(noframesTag) || e->hasLocalName(nolayerTag) || + e->hasLocalName(noembedTag)) + return true; +#if !ENABLE(XHTMLMP) + if (e->hasLocalName(noscriptTag) && !m_isParsingFragment) { + Frame* frame = m_document->frame(); + if (frame && frame->script()->canExecuteScripts(NotAboutToExecuteScript)) + return true; + } +#endif + } + + return false; +} + +bool LegacyHTMLTreeConstructor::isResidualStyleTag(const AtomicString& tagName) +{ + DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, residualStyleTags, ()); + if (residualStyleTags.isEmpty()) { + QualifiedName tagNames[] = { aTag, fontTag, ttTag, uTag, bTag, iTag, + sTag, strikeTag, bigTag, smallTag, emTag, strongTag, dfnTag, + codeTag, sampTag, kbdTag, varTag, nobrTag }; + addTags(residualStyleTags, tagNames); + } + return residualStyleTags.contains(tagName.impl()); +} + +bool LegacyHTMLTreeConstructor::isAffectedByResidualStyle(const AtomicString& tagName) +{ + DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, unaffectedTags, ()); + if (unaffectedTags.isEmpty()) { + QualifiedName tagNames[] = { bodyTag, tableTag, theadTag, tbodyTag, + tfootTag, trTag, thTag, tdTag, captionTag, colgroupTag, colTag, + optionTag, optgroupTag, selectTag, objectTag, datagridTag, datalistTag }; + addTags(unaffectedTags, tagNames); + } + return !unaffectedTags.contains(tagName.impl()); +} + +void LegacyHTMLTreeConstructor::handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem* elem) +{ + HTMLStackElem* maxElem = 0; + bool finished = false; + bool strayTableContent = elem->strayTableContent; + + unsigned iterationCount = 0; + + m_handlingResidualStyleAcrossBlocks = true; + while (!finished && (iterationCount++ < cResidualStyleIterationLimit)) { + // Find the outermost element that crosses over to a higher level. If there exists another higher-level + // element, we will do another pass, until we have corrected the innermost one. + ExceptionCode ec = 0; + HTMLStackElem* curr = m_blockStack; + HTMLStackElem* prev = 0; + HTMLStackElem* prevMaxElem = 0; + maxElem = 0; + finished = true; + while (curr && curr != elem) { + if (curr->level > elem->level) { + if (!isAffectedByResidualStyle(curr->tagName)) + return; + if (maxElem) + // We will need another pass. + finished = false; + maxElem = curr; + prevMaxElem = prev; + } + + prev = curr; + curr = curr->next; + } + + if (!curr || !maxElem) + return; + + Node* residualElem = prev->node; + Node* blockElem = prevMaxElem ? prevMaxElem->node : m_current; + Node* parentElem = elem->node; + + // Check to see if the reparenting that is going to occur is allowed according to the DOM. + // FIXME: We should either always allow it or perform an additional fixup instead of + // just bailing here. + // Example: <p><font><center>blah</font></center></p> isn't doing a fixup right now. + if (!parentElem->childAllowed(blockElem)) + return; + + m_hasPElementInScope = Unknown; + + if (maxElem->node->parentNode() != elem->node) { + // Walk the stack and remove any elements that aren't residual style tags. These + // are basically just being closed up. Example: + // <font><span>Moo<p>Goo</font></p>. + // In the above example, the <span> doesn't need to be reopened. It can just close. + HTMLStackElem* currElem = maxElem->next; + HTMLStackElem* prevElem = maxElem; + while (currElem != elem) { + HTMLStackElem* nextElem = currElem->next; + if (!isResidualStyleTag(currElem->tagName)) { + prevElem->next = nextElem; + prevElem->derefNode(); + prevElem->node = currElem->node; + prevElem->didRefNode = currElem->didRefNode; + delete currElem; + m_treeDepth--; + } else + prevElem = currElem; + currElem = nextElem; + } + + // We have to reopen residual tags in between maxElem and elem. An example of this case is: + // <font><i>Moo<p>Foo</font>. + // In this case, we need to transform the part before the <p> into: + // <font><i>Moo</i></font><i> + // so that the <i> will remain open. This involves the modification of elements + // in the block stack. + // This will also affect how we ultimately reparent the block, since we want it to end up + // under the reopened residual tags (e.g., the <i> in the above example.) + RefPtr<Node> prevNode = 0; + currElem = maxElem; + while (currElem->node != residualElem) { + if (isResidualStyleTag(currElem->node->localName())) { + // Create a clone of this element. + // We call releaseRef to get a raw pointer since we plan to hand over ownership to currElem. + Node* currNode = currElem->node->cloneNode(false).releaseRef(); + reportError(ResidualStyleError, &currNode->localName()); + + // Change the stack element's node to point to the clone. + // The stack element adopts the reference we obtained above by calling release(). + currElem->derefNode(); + currElem->node = currNode; + currElem->didRefNode = true; + + // Attach the previous node as a child of this new node. + if (prevNode) + currNode->appendChild(prevNode, ec); + else // The new parent for the block element is going to be the innermost clone. + parentElem = currNode; // FIXME: We shifted parentElem to be a residual inline. We never checked to see if blockElem could be legally placed inside the inline though. + + prevNode = currNode; + } + + currElem = currElem->next; + } + + // Now append the chain of new residual style elements if one exists. + if (prevNode) + elem->node->appendChild(prevNode, ec); // FIXME: This append can result in weird stuff happening, like an inline chain being put into a table section. + } + + // Check if the block is still in the tree. If it isn't, then we don't + // want to remove it from its parent (that would crash) or insert it into + // a new parent later. See http://bugs.webkit.org/show_bug.cgi?id=6778 + bool isBlockStillInTree = blockElem->parentNode(); + + // We need to make a clone of |residualElem| and place it just inside |blockElem|. + // All content of |blockElem| is reparented to be under this clone. We then + // reparent |blockElem| using real DOM calls so that attachment/detachment will + // be performed to fix up the rendering tree. + // So for this example: <b>...<p>Foo</b>Goo</p> + // The end result will be: <b>...</b><p><b>Foo</b>Goo</p> + // + // Step 1: Remove |blockElem| from its parent, doing a batch detach of all the kids. + if (isBlockStillInTree) + blockElem->parentNode()->removeChild(blockElem, ec); + + Node* newNodePtr = 0; + if (blockElem->firstChild()) { + // Step 2: Clone |residualElem|. + RefPtr<Node> newNode = residualElem->cloneNode(false); // Shallow clone. We don't pick up the same kids. + newNodePtr = newNode.get(); + reportError(ResidualStyleError, &newNode->localName()); + + // Step 3: Place |blockElem|'s children under |newNode|. Remove all of the children of |blockElem| + // before we've put |newElem| into the document. That way we'll only do one attachment of all + // the new content (instead of a bunch of individual attachments). + Node* currNode = blockElem->firstChild(); + while (currNode) { + Node* nextNode = currNode->nextSibling(); + newNode->appendChild(currNode, ec); + currNode = nextNode; + } + + // Step 4: Place |newNode| under |blockElem|. |blockElem| is still out of the document, so no + // attachment can occur yet. + blockElem->appendChild(newNode.release(), ec); + } else + finished = true; + + // Step 5: Reparent |blockElem|. Now the full attachment of the fixed up tree takes place. + if (isBlockStillInTree) + parentElem->appendChild(blockElem, ec); + + // Step 6: Pull |elem| out of the stack, since it is no longer enclosing us. Also update + // the node associated with the previous stack element so that when it gets popped, + // it doesn't make the residual element the next current node. + HTMLStackElem* currElem = maxElem; + HTMLStackElem* prevElem = 0; + while (currElem != elem) { + prevElem = currElem; + currElem = currElem->next; + } + prevElem->next = elem->next; + prevElem->derefNode(); + prevElem->node = elem->node; + prevElem->didRefNode = elem->didRefNode; + m_treeDepth--; + if (!finished) { + // Repurpose |elem| to represent |newNode| and insert it at the appropriate position + // in the stack. We do not do this for the innermost block, because in that case the new + // node is effectively no longer open. + elem->next = maxElem; + elem->node = prevMaxElem->node; + elem->didRefNode = prevMaxElem->didRefNode; + elem->strayTableContent = false; + prevMaxElem->next = elem; + ASSERT(newNodePtr); + prevMaxElem->node = newNodePtr; + newNodePtr->ref(); + prevMaxElem->didRefNode = true; + m_treeDepth++; + } else + delete elem; + } + + // FIXME: If we ever make a case like this work: + // <table><b><i><form></b></form></i></table> + // Then this check will be too simplistic. Right now the <i><form> chain will end up inside the <tbody>, which is pretty crazy. + if (strayTableContent) + m_inStrayTableContent--; + + // Step 7: Reopen intermediate inlines, e.g., <b><p><i>Foo</b>Goo</p>. + // In the above example, Goo should stay italic. + // We cap the number of tags we're willing to reopen based off cResidualStyleMaxDepth. + + HTMLStackElem* curr = m_blockStack; + HTMLStackElem* residualStyleStack = 0; + unsigned stackDepth = 1; + unsigned redundantStyleCount = 0; + while (curr && curr != maxElem) { + // We will actually schedule this tag for reopening + // after we complete the close of this entire block. + if (isResidualStyleTag(curr->tagName) && stackDepth++ < cResidualStyleMaxDepth) { + // We've overloaded the use of stack elements and are just reusing the + // struct with a slightly different meaning to the variables. Instead of chaining + // from innermost to outermost, we build up a list of all the tags we need to reopen + // from the outermost to the innermost, i.e., residualStyleStack will end up pointing + // to the outermost tag we need to reopen. + // We also set curr->node to be the actual element that corresponds to the ID stored in + // curr->id rather than the node that you should pop to when the element gets pulled off + // the stack. + if (residualStyleStack && curr->tagName == residualStyleStack->tagName && curr->node->attributes()->mapsEquivalent(residualStyleStack->node->attributes())) + redundantStyleCount++; + else + redundantStyleCount = 0; + + if (redundantStyleCount < cMaxRedundantTagDepth) + moveOneBlockToStack(residualStyleStack); + else + popOneBlock(); + } else + popOneBlock(); + + curr = m_blockStack; + } + + reopenResidualStyleTags(residualStyleStack, 0); // Stray table content can't be an issue here, since some element above will always become the root of new stray table content. + + m_handlingResidualStyleAcrossBlocks = false; +} + +void LegacyHTMLTreeConstructor::reopenResidualStyleTags(HTMLStackElem* elem, Node* malformedTableParent) +{ + // Loop for each tag that needs to be reopened. + while (elem) { + // Create a shallow clone of the DOM node for this element. + RefPtr<Node> newNode = elem->node->cloneNode(false); + reportError(ResidualStyleError, &newNode->localName()); + + // Append the new node. In the malformed table case, we need to insert before the table, + // which will be the last child. + ExceptionCode ec = 0; + if (malformedTableParent) + malformedTableParent->insertBefore(newNode, malformedTableParent->lastChild(), ec); + else + m_current->appendChild(newNode, ec); + // FIXME: Is it really OK to ignore the exceptions here? + + // Now push a new stack element for this node we just created. + pushBlock(elem->tagName, elem->level); + newNode->beginParsingChildren(); + + // Set our strayTableContent boolean if needed, so that the reopened tag also knows + // that it is inside a malformed table. + m_blockStack->strayTableContent = malformedTableParent != 0; + if (m_blockStack->strayTableContent) + m_inStrayTableContent++; + + // Clear our malformed table parent variable. + malformedTableParent = 0; + + // Update |current| manually to point to the new node. + setCurrent(newNode.get()); + + // Advance to the next tag that needs to be reopened. + HTMLStackElem* next = elem->next; + elem->derefNode(); + delete elem; + elem = next; + } +} + +void LegacyHTMLTreeConstructor::pushBlock(const AtomicString& tagName, int level) +{ + m_blockStack = new HTMLStackElem(tagName, level, m_current, m_didRefCurrent, m_blockStack); + if (level >= minBlockLevelTagPriority) + m_blocksInStack++; + m_treeDepth++; + m_didRefCurrent = false; + if (tagName == pTag) + m_hasPElementInScope = InScope; + else if (isScopingTag(tagName)) + m_hasPElementInScope = NotInScope; +} + +void LegacyHTMLTreeConstructor::popBlock(const AtomicString& tagName, bool reportErrors) +{ + HTMLStackElem* elem = m_blockStack; + + if (m_parserQuirks && elem && !m_parserQuirks->shouldPopBlock(elem->tagName, tagName)) + return; + + int maxLevel = 0; + + while (elem && (elem->tagName != tagName)) { + if (maxLevel < elem->level) + maxLevel = elem->level; + elem = elem->next; + } + + if (!elem) { + if (reportErrors) + reportError(StrayCloseTagError, &tagName, 0, true); + return; + } + + if (maxLevel > elem->level) { + // We didn't match because the tag is in a different scope, e.g., + // <b><p>Foo</b>. Try to correct the problem. + if (!isResidualStyleTag(tagName)) + return; + return handleResidualStyleCloseTagAcrossBlocks(elem); + } + + bool isAffectedByStyle = isAffectedByResidualStyle(elem->tagName); + HTMLStackElem* residualStyleStack = 0; + Node* malformedTableParent = 0; + + elem = m_blockStack; + unsigned stackDepth = 1; + unsigned redundantStyleCount = 0; + while (elem) { + if (elem->tagName == tagName) { + int strayTable = m_inStrayTableContent; + popOneBlock(); + elem = 0; + + // This element was the root of some malformed content just inside an implicit or + // explicit <tbody> or <tr>. + // If we end up needing to reopen residual style tags, the root of the reopened chain + // must also know that it is the root of malformed content inside a <tbody>/<tr>. + if (strayTable && (m_inStrayTableContent < strayTable) && residualStyleStack) { + Node* curr = m_current; + while (curr && !curr->hasTagName(tableTag)) + curr = curr->parentNode(); + malformedTableParent = curr ? curr->parentNode() : 0; + } + } + else { + if (m_currentFormElement && elem->tagName == formTag) + // A <form> is being closed prematurely (and this is + // malformed HTML). Set an attribute on the form to clear out its + // bottom margin. + m_currentFormElement->setMalformed(true); + + // Schedule this tag for reopening + // after we complete the close of this entire block. + if (isAffectedByStyle && isResidualStyleTag(elem->tagName) && stackDepth++ < cResidualStyleMaxDepth) { + // We've overloaded the use of stack elements and are just reusing the + // struct with a slightly different meaning to the variables. Instead of chaining + // from innermost to outermost, we build up a list of all the tags we need to reopen + // from the outermost to the innermost, i.e., residualStyleStack will end up pointing + // to the outermost tag we need to reopen. + // We also set elem->node to be the actual element that corresponds to the ID stored in + // elem->id rather than the node that you should pop to when the element gets pulled off + // the stack. + if (residualStyleStack && elem->tagName == residualStyleStack->tagName && elem->node->attributes()->mapsEquivalent(residualStyleStack->node->attributes())) + redundantStyleCount++; + else + redundantStyleCount = 0; + + if (redundantStyleCount < cMaxRedundantTagDepth) + moveOneBlockToStack(residualStyleStack); + else + popOneBlock(); + } else + popOneBlock(); + elem = m_blockStack; + } + } + + reopenResidualStyleTags(residualStyleStack, malformedTableParent); +} + +inline HTMLStackElem* LegacyHTMLTreeConstructor::popOneBlockCommon() +{ + HTMLStackElem* elem = m_blockStack; + + // Form elements restore their state during the parsing process. + // Also, a few elements (<applet>, <object>) need to know when all child elements (<param>s) are available. + if (m_current && elem->node != m_current) + m_current->finishParsingChildren(); + + if (m_blockStack->level >= minBlockLevelTagPriority) { + ASSERT(m_blocksInStack > 0); + m_blocksInStack--; + } + m_treeDepth--; + m_blockStack = elem->next; + m_current = elem->node; + m_didRefCurrent = elem->didRefNode; + + if (elem->strayTableContent) + m_inStrayTableContent--; + + if (elem->tagName == pTag) + m_hasPElementInScope = NotInScope; + else if (isScopingTag(elem->tagName)) + m_hasPElementInScope = Unknown; + + return elem; +} + +void LegacyHTMLTreeConstructor::popOneBlock() +{ + // Store the current node before popOneBlockCommon overwrites it. + Node* lastCurrent = m_current; + bool didRefLastCurrent = m_didRefCurrent; + + delete popOneBlockCommon(); + + if (didRefLastCurrent) + lastCurrent->deref(); +} + +void LegacyHTMLTreeConstructor::moveOneBlockToStack(HTMLStackElem*& head) +{ + // We'll be using the stack element we're popping, but for the current node. + // See the two callers for details. + + // Store the current node before popOneBlockCommon overwrites it. + Node* lastCurrent = m_current; + bool didRefLastCurrent = m_didRefCurrent; + + // Pop the block, but don't deref the current node as popOneBlock does because + // we'll be using the pointer in the new stack element. + HTMLStackElem* elem = popOneBlockCommon(); + + // Transfer the current node into the stack element. + // No need to deref the old elem->node because popOneBlockCommon transferred + // it into the m_current/m_didRefCurrent fields. + elem->node = lastCurrent; + elem->didRefNode = didRefLastCurrent; + elem->next = head; + head = elem; +} + +void LegacyHTMLTreeConstructor::checkIfHasPElementInScope() +{ + m_hasPElementInScope = NotInScope; + HTMLStackElem* elem = m_blockStack; + while (elem) { + const AtomicString& tagName = elem->tagName; + if (tagName == pTag) { + m_hasPElementInScope = InScope; + return; + } else if (isScopingTag(tagName)) + return; + elem = elem->next; + } +} + +void LegacyHTMLTreeConstructor::popInlineBlocks() +{ + while (m_blockStack && isInline(m_current)) + popOneBlock(); +} + +void LegacyHTMLTreeConstructor::freeBlock() +{ + while (m_blockStack) + popOneBlock(); + ASSERT(!m_blocksInStack); + ASSERT(!m_treeDepth); +} + +void LegacyHTMLTreeConstructor::createHead() +{ + if (m_head) + return; + + if (!m_document->documentElement() && !m_isParsingFragment) { + insertNode(HTMLHtmlElement::create(m_document).get()); + ASSERT(m_document->documentElement() || m_isParsingFragment); + } + + m_head = HTMLHeadElement::create(m_document); + + if (m_isParsingFragment) + return; + + HTMLElement* body = m_document->body(); + ExceptionCode ec = 0; + m_document->documentElement()->insertBefore(m_head.get(), body, ec); + if (ec) + m_head = 0; + + // If the body does not exist yet, then the <head> should be pushed as the current block. + if (m_head && !body) { + pushBlock(m_head->localName(), m_head->tagPriority()); + setCurrent(m_head.get()); + } +} + +PassRefPtr<Node> LegacyHTMLTreeConstructor::handleIsindex(Token* t) +{ + RefPtr<Node> n = HTMLDivElement::create(m_document); + + NamedNodeMap* attrs = t->attrs.get(); + + RefPtr<HTMLIsIndexElement> isIndex = HTMLIsIndexElement::create(m_document, m_currentFormElement.get()); + isIndex->setAttributeMap(attrs); + isIndex->setAttribute(typeAttr, "khtml_isindex"); + + String text = searchableIndexIntroduction(); + if (attrs) { + if (Attribute* a = attrs->getAttributeItem(promptAttr)) + text = a->value().string() + " "; + t->attrs = 0; + } + + n->addChild(HTMLHRElement::create(m_document)); + n->addChild(Text::create(m_document, text)); + n->addChild(isIndex.release()); + n->addChild(HTMLHRElement::create(m_document)); + + return n.release(); +} + +void LegacyHTMLTreeConstructor::startBody() +{ + if (m_inBody) + return; + + m_inBody = true; + + if (m_isindexElement) { + insertNode(m_isindexElement.get(), true /* don't descend into this node */); + m_isindexElement = 0; + } +} + +void LegacyHTMLTreeConstructor::finished() +{ + // In the case of a completely empty document, here's the place to create the HTML element. + if (m_current && m_current->isDocumentNode() && !m_document->documentElement()) + insertNode(HTMLHtmlElement::create(m_document).get()); + + // This ensures that "current" is not left pointing to a node when the document is destroyed. + freeBlock(); + setCurrent(0); + + // Warning, this may delete the parser, so don't try to do anything else after this. + if (!m_isParsingFragment) + m_document->finishedParsing(); +} + +void LegacyHTMLTreeConstructor::reportErrorToConsole(HTMLParserErrorCode errorCode, const AtomicString* tagName1, const AtomicString* tagName2, bool closeTags) +{ + Frame* frame = m_document->frame(); + if (!frame) + return; + + HTMLDocumentParser* htmlTokenizer = static_cast<HTMLDocumentParser*>(m_document->parser()); + int lineNumber = htmlTokenizer->lineNumber() + 1; + + AtomicString tag1; + AtomicString tag2; + if (tagName1) { + if (*tagName1 == "#text") + tag1 = "Text"; + else if (*tagName1 == "#comment") + tag1 = "<!-- comment -->"; + else + tag1 = (closeTags ? "</" : "<") + *tagName1 + ">"; + } + if (tagName2) { + if (*tagName2 == "#text") + tag2 = "Text"; + else if (*tagName2 == "#comment") + tag2 = "<!-- comment -->"; + else + tag2 = (closeTags ? "</" : "<") + *tagName2 + ">"; + } + + const char* errorMsg = htmlParserErrorMessageTemplate(errorCode); + if (!errorMsg) + return; + + String message; + if (htmlTokenizer->processingContentWrittenByScript()) + message += htmlParserDocumentWriteMessage(); + message += errorMsg; + message.replace("%tag1", tag1); + message.replace("%tag2", tag2); + + frame->domWindow()->console()->addMessage(HTMLMessageSource, LogMessageType, + isWarning(errorCode) ? WarningMessageLevel : ErrorMessageLevel, + message, lineNumber, m_document->url().string()); +} + +#ifdef BUILDING_ON_LEOPARD +bool shouldCreateImplicitHead(Document* document) +{ + ASSERT(document); + + Settings* settings = document->page() ? document->page()->settings() : 0; + return settings ? !settings->needsLeopardMailQuirks() : true; +} +#elif defined(BUILDING_ON_TIGER) +bool shouldCreateImplicitHead(Document* document) +{ + ASSERT(document); + + Settings* settings = document->page() ? document->page()->settings() : 0; + return settings ? !settings->needsTigerMailQuirks() : true; +} +#endif + + +String serializeForNumberType(double number) +{ + // According to HTML5, "the best representation of the number n as a floating + // point number" is a string produced by applying ToString() to n. + DtoaBuffer buffer; + unsigned length; + doubleToStringInJavaScriptFormat(number, buffer, &length); + return String(buffer, length); +} + +bool parseToDoubleForNumberType(const String& src, double* out) +{ + // See HTML5 2.4.4.3 `Real numbers.' + + if (src.isEmpty()) + return false; + // String::toDouble() accepts leading + \t \n \v \f \r and SPACE, which are invalid in HTML5. + // So, check the first character. + if (src[0] != '-' && (src[0] < '0' || src[0] > '9')) + return false; + + bool valid = false; + double value = src.toDouble(&valid); + if (!valid) + return false; + // NaN and Infinity are not valid numbers according to the standard. + if (!isfinite(value)) + return false; + // -0 -> 0 + if (!value) + value = 0; + if (out) + *out = value; + return true; +} + +} diff --git a/WebCore/html/LegacyHTMLTreeConstructor.h b/WebCore/html/LegacyHTMLTreeConstructor.h new file mode 100644 index 0000000..ab1f5aa --- /dev/null +++ b/WebCore/html/LegacyHTMLTreeConstructor.h @@ -0,0 +1,214 @@ +/* + Copyright (C) 1997 Martin Jones (mjones@kde.org) + (C) 1997 Torben Weis (weis@kde.org) + (C) 1998 Waldo Bastian (bastian@kde.org) + (C) 1999 Lars Knoll (knoll@kde.org) + Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + 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 HTMLParser_h +#define HTMLParser_h + +#include "HTMLParserErrorCodes.h" +#include "MappedAttributeEntry.h" +#include "QualifiedName.h" +#include <wtf/Forward.h> +#include <wtf/OwnPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + +class DoctypeToken; +class Document; +class DocumentFragment; +class HTMLDocument; +class HTMLFormElement; +class HTMLHeadElement; +class HTMLMapElement; +class HTMLParserQuirks; +class Node; + +struct HTMLStackElem; +struct Token; + +/** + * The parser for HTML. It receives a stream of tokens from the HTMLDocumentParser, and + * builds up the Document structure from it. + */ +class LegacyHTMLTreeConstructor : public Noncopyable { +public: + LegacyHTMLTreeConstructor(HTMLDocument*, bool reportErrors); + LegacyHTMLTreeConstructor(DocumentFragment*, FragmentScriptingPermission = FragmentScriptingAllowed); + virtual ~LegacyHTMLTreeConstructor(); + + /** + * parses one token delivered by the tokenizer + */ + PassRefPtr<Node> parseToken(Token*); + + // Parses a doctype token. + void parseDoctypeToken(DoctypeToken*); + + /** + * tokenizer says it's not going to be sending us any more tokens + */ + void finished(); + + /** + * resets the parser + */ + void reset(); + + bool skipMode() const { return !m_skipModeTag.isNull(); } + bool isHandlingResidualStyleAcrossBlocks() const { return m_handlingResidualStyleAcrossBlocks; } + +private: + void setCurrent(Node*); + void derefCurrent(); + void setSkipMode(const QualifiedName& qName) { m_skipModeTag = qName.localName(); } + + PassRefPtr<Node> getNode(Token*); + bool bodyCreateErrorCheck(Token*, RefPtr<Node>&); + bool canvasCreateErrorCheck(Token*, RefPtr<Node>&); + bool commentCreateErrorCheck(Token*, RefPtr<Node>&); + bool ddCreateErrorCheck(Token*, RefPtr<Node>&); + bool dtCreateErrorCheck(Token*, RefPtr<Node>&); + bool formCreateErrorCheck(Token*, RefPtr<Node>&); + bool framesetCreateErrorCheck(Token*, RefPtr<Node>&); + bool headCreateErrorCheck(Token*, RefPtr<Node>&); + bool iframeCreateErrorCheck(Token*, RefPtr<Node>&); + bool isindexCreateErrorCheck(Token*, RefPtr<Node>&); + bool mapCreateErrorCheck(Token*, RefPtr<Node>&); + bool nestedCreateErrorCheck(Token*, RefPtr<Node>&); + bool nestedPCloserCreateErrorCheck(Token*, RefPtr<Node>&); + bool nestedStyleCreateErrorCheck(Token*, RefPtr<Node>&); + bool noembedCreateErrorCheck(Token*, RefPtr<Node>&); + bool noframesCreateErrorCheck(Token*, RefPtr<Node>&); + bool nolayerCreateErrorCheck(Token*, RefPtr<Node>&); + bool noscriptCreateErrorCheck(Token*, RefPtr<Node>&); + bool pCloserCreateErrorCheck(Token*, RefPtr<Node>&); + bool pCloserStrictCreateErrorCheck(Token*, RefPtr<Node>&); + bool rpCreateErrorCheck(Token*, RefPtr<Node>&); + bool rtCreateErrorCheck(Token*, RefPtr<Node>&); + bool selectCreateErrorCheck(Token*, RefPtr<Node>&); + bool tableCellCreateErrorCheck(Token*, RefPtr<Node>&); + bool tableSectionCreateErrorCheck(Token*, RefPtr<Node>&); + bool textCreateErrorCheck(Token*, RefPtr<Node>&); + + void processCloseTag(Token*); + + void limitDepth(int tagPriority); + bool insertNodeAfterLimitDepth(Node*, bool flat = false); + bool insertNode(Node*, bool flat = false); + bool handleError(Node*, bool flat, const AtomicString& localName, int tagPriority); + + void pushBlock(const AtomicString& tagName, int level); + void popBlock(const AtomicString& tagName, bool reportErrors = false); + void popBlock(const QualifiedName& qName, bool reportErrors = false) { return popBlock(qName.localName(), reportErrors); } // Convenience function for readability. + void popOneBlock(); + void moveOneBlockToStack(HTMLStackElem*& head); + inline HTMLStackElem* popOneBlockCommon(); + void popInlineBlocks(); + + void freeBlock(); + + void createHead(); + + static bool isResidualStyleTag(const AtomicString& tagName); + static bool isAffectedByResidualStyle(const AtomicString& tagName); + void handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem*); + void reopenResidualStyleTags(HTMLStackElem*, Node* malformedTableParent); + + bool allowNestedRedundantTag(const AtomicString& tagName); + + static bool isHeadingTag(const AtomicString& tagName); + + bool isInline(Node*) const; + + void startBody(); // inserts the isindex element + PassRefPtr<Node> handleIsindex(Token*); + + void checkIfHasPElementInScope(); + bool hasPElementInScope() + { + if (m_hasPElementInScope == Unknown) + checkIfHasPElementInScope(); + return m_hasPElementInScope == InScope; + } + + void reportError(HTMLParserErrorCode errorCode, const AtomicString* tagName1 = 0, const AtomicString* tagName2 = 0, bool closeTags = false) + { if (!m_reportErrors) return; reportErrorToConsole(errorCode, tagName1, tagName2, closeTags); } + + void reportErrorToConsole(HTMLParserErrorCode, const AtomicString* tagName1, const AtomicString* tagName2, bool closeTags); + + Document* m_document; + + // The currently active element (the one new elements will be added to). Can be a document fragment, a document or an element. + Node* m_current; + // We can't ref a document, but we don't want to constantly check if a node is a document just to decide whether to deref. + bool m_didRefCurrent; + + HTMLStackElem* m_blockStack; + + // The number of tags with priority minBlockLevelTagPriority or higher + // currently in m_blockStack. The parser enforces a cap on this value by + // adding such new elements as siblings instead of children once it is reached. + size_t m_blocksInStack; + // Depth of the tree. + unsigned m_treeDepth; + + enum ElementInScopeState { NotInScope, InScope, Unknown }; + ElementInScopeState m_hasPElementInScope; + + RefPtr<HTMLFormElement> m_currentFormElement; // currently active form + RefPtr<HTMLMapElement> m_currentMapElement; // current map + RefPtr<HTMLHeadElement> m_head; // head element; needed for HTML which defines <base> after </head> + RefPtr<Node> m_isindexElement; // a possible <isindex> element in the head + + bool m_inBody; + bool m_haveContent; + bool m_haveFrameSet; + + AtomicString m_skipModeTag; // tells the parser to discard all tags until it reaches the one specified + + bool m_isParsingFragment; + bool m_reportErrors; + bool m_handlingResidualStyleAcrossBlocks; + int m_inStrayTableContent; + FragmentScriptingPermission m_scriptingPermission; + + OwnPtr<HTMLParserQuirks> m_parserQuirks; +}; + +#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_TIGER) +bool shouldCreateImplicitHead(Document*); +#else +inline bool shouldCreateImplicitHead(Document*) { return true; } +#endif + +// Converts the specified string to a floating number. +// If the conversion fails, the return value is false. Take care that leading or trailing unnecessary characters make failures. This returns false for an empty string input. +// The double* parameter may be 0. +bool parseToDoubleForNumberType(const String&, double*); +// Converts the specified number to a string. This is an implementation of +// HTML5's "algorithm to convert a number to a string" for NUMBER/RANGE types. +String serializeForNumberType(double); + +} + +#endif // HTMLParser_h diff --git a/WebCore/html/PreloadScanner.cpp b/WebCore/html/PreloadScanner.cpp index ee7e761..d39092a 100644 --- a/WebCore/html/PreloadScanner.cpp +++ b/WebCore/html/PreloadScanner.cpp @@ -47,7 +47,7 @@ // Use __GNUC__ instead of PLATFORM(GCC) to stay consistent with the gperf generated c file #ifdef __GNUC__ // The main tokenizer includes this too so we are getting two copies of the data. However, this way the code gets inlined. -#include "HTMLEntityNames.c" +#include "HTMLEntityNames.cpp" #else // Not inlined for non-GCC compilers struct Entity { diff --git a/WebCore/html/StepRange.cpp b/WebCore/html/StepRange.cpp index 04f4ed3..3923abe 100644 --- a/WebCore/html/StepRange.cpp +++ b/WebCore/html/StepRange.cpp @@ -23,7 +23,7 @@ #include "HTMLInputElement.h" #include "HTMLNames.h" -#include "HTMLParser.h" +#include "LegacyHTMLTreeConstructor.h" #include "PlatformString.h" #include <wtf/MathExtras.h> diff --git a/WebCore/html/TextMetrics.h b/WebCore/html/TextMetrics.h index 14cdb67..c786fca 100644 --- a/WebCore/html/TextMetrics.h +++ b/WebCore/html/TextMetrics.h @@ -26,6 +26,7 @@ #ifndef TextMetrics_h #define TextMetrics_h +#include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> namespace WebCore { diff --git a/WebCore/html/ValidityState.cpp b/WebCore/html/ValidityState.cpp index fc60a22..7f6b8be 100644 --- a/WebCore/html/ValidityState.cpp +++ b/WebCore/html/ValidityState.cpp @@ -26,7 +26,7 @@ #include "HTMLInputElement.h" #include "HTMLNames.h" -#include "HTMLParser.h" +#include "LegacyHTMLTreeConstructor.h" #include "KURL.h" #include "LocalizedStrings.h" #include "RegularExpression.h" diff --git a/WebCore/html/canvas/CanvasGradient.idl b/WebCore/html/canvas/CanvasGradient.idl index 32813bc..a925a26 100644 --- a/WebCore/html/canvas/CanvasGradient.idl +++ b/WebCore/html/canvas/CanvasGradient.idl @@ -27,8 +27,7 @@ module html { interface [ InterfaceUUID=bb1108ea-6b8c-4a08-894a-218628630cdb, - ImplementationUUID=a2942ae6-2731-4286-98cc-9d5e79e20de1, - OmitConstructor + ImplementationUUID=a2942ae6-2731-4286-98cc-9d5e79e20de1 ] CanvasGradient { void addColorStop(in float offset, in DOMString color) diff --git a/WebCore/html/canvas/CanvasPattern.idl b/WebCore/html/canvas/CanvasPattern.idl index 492c93f..1cac8f8 100644 --- a/WebCore/html/canvas/CanvasPattern.idl +++ b/WebCore/html/canvas/CanvasPattern.idl @@ -27,8 +27,7 @@ module html { interface [ InterfaceUUID=c2131348-6d8c-47b5-86cc-d41aff34ce15, - ImplementationUUID=82f5d713-3d17-44dd-aa4a-7766fe345940, - OmitConstructor + ImplementationUUID=82f5d713-3d17-44dd-aa4a-7766fe345940 ] CanvasPattern { }; diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/WebCore/html/canvas/CanvasRenderingContext2D.cpp index 184cc14..8531bd5 100644 --- a/WebCore/html/canvas/CanvasRenderingContext2D.cpp +++ b/WebCore/html/canvas/CanvasRenderingContext2D.cpp @@ -753,6 +753,12 @@ void CanvasRenderingContext2D::fillRect(float x, float y, float width, float hei if (!state().m_invertibleCTM) return; + // from the HTML5 Canvas spec: + // If x0 = x1 and y0 = y1, then the linear gradient must paint nothing + Gradient* gradient = c->fillGradient(); + if (gradient && gradient->isZeroSize() && !gradient->isRadial()) + return; + FloatRect rect(x, y, width, height); willDraw(rect); @@ -1265,10 +1271,8 @@ PassRefPtr<CanvasPattern> CanvasRenderingContext2D::createPattern(HTMLImageEleme if (ec) return 0; - if (!image->complete()) { - ec = INVALID_STATE_ERR; + if (!image->complete()) return 0; - } CachedImage* cachedImage = image->cachedImage(); if (!cachedImage || !image->cachedImage()->image()) diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.idl b/WebCore/html/canvas/CanvasRenderingContext2D.idl index da4dd72..23afc11 100644 --- a/WebCore/html/canvas/CanvasRenderingContext2D.idl +++ b/WebCore/html/canvas/CanvasRenderingContext2D.idl @@ -90,10 +90,12 @@ module html { void setAlpha(in float alpha); void setCompositeOperation(in DOMString compositeOperation); +#if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP void setLineWidth(in float width); void setLineCap(in DOMString cap); void setLineJoin(in DOMString join); void setMiterLimit(in float limit); +#endif void clearShadow(); diff --git a/WebCore/html/canvas/Float32Array.cpp b/WebCore/html/canvas/Float32Array.cpp new file mode 100644 index 0000000..c95fb48 --- /dev/null +++ b/WebCore/html/canvas/Float32Array.cpp @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(3D_CANVAS) + +#include "Float32Array.h" + +namespace WebCore { + +PassRefPtr<Float32Array> Float32Array::create(unsigned length) +{ + return TypedArrayBase<float>::create<Float32Array>(length); +} + +PassRefPtr<Float32Array> Float32Array::create(float* array, unsigned length) +{ + return TypedArrayBase<float>::create<Float32Array>(array, length); +} + +PassRefPtr<Float32Array> Float32Array::create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length) +{ + return TypedArrayBase<float>::create<Float32Array>(buffer, byteOffset, length); +} + +Float32Array::Float32Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length) + : TypedArrayBase<float>(buffer, byteOffset, length) +{ +} + +PassRefPtr<ArrayBufferView> Float32Array::slice(int start, int end) const +{ + return sliceImpl<Float32Array>(start, end); +} + +} + +#endif // ENABLE(3D_CANVAS) diff --git a/WebCore/html/canvas/Float32Array.h b/WebCore/html/canvas/Float32Array.h new file mode 100644 index 0000000..8112264 --- /dev/null +++ b/WebCore/html/canvas/Float32Array.h @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef Float32Array_h +#define Float32Array_h + +#include "TypedArrayBase.h" +#include <wtf/MathExtras.h> + +namespace WebCore { + +class Float32Array : public TypedArrayBase<float> { + public: + static PassRefPtr<Float32Array> create(unsigned length); + static PassRefPtr<Float32Array> create(float* array, unsigned length); + static PassRefPtr<Float32Array> create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length); + + using TypedArrayBase<float>::set; + + void set(unsigned index, double value) + { + if (index >= TypedArrayBase<float>::m_length) + return; + if (isnan(value)) // Clamp NaN to 0 + value = 0; + TypedArrayBase<float>::data()[index] = static_cast<float>(value); + } + + // Invoked by the indexed getter. Does not perform range checks; caller + // is responsible for doing so and returning undefined as necessary. + float item(unsigned index) const + { + ASSERT(index < TypedArrayBase<float>::m_length); + float result = TypedArrayBase<float>::data()[index]; + if (isnan(result)) { + // Clamp NaN to 0 + result = 0; + } + return result; + } + + private: + Float32Array(PassRefPtr<ArrayBuffer> buffer, + unsigned byteOffset, + unsigned length); + // Make constructor visible to superclass. + friend class TypedArrayBase<float>; + + // Overridden from ArrayBufferView. + virtual bool isFloatArray() const { return true; } + virtual PassRefPtr<ArrayBufferView> slice(int start, int end) const; +}; + +} // namespace WebCore + +#endif // Float32Array_h diff --git a/WebCore/html/canvas/Float32Array.idl b/WebCore/html/canvas/Float32Array.idl new file mode 100644 index 0000000..91a9f4e --- /dev/null +++ b/WebCore/html/canvas/Float32Array.idl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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. + */ + +module html { + interface [ + Conditional=3D_CANVAS, + HasNumericIndexGetter, + HasCustomIndexSetter, + GenerateNativeConverter, + CustomConstructor, + CustomToJS + ] Float32Array : ArrayBufferView { + const unsigned int BYTES_PER_ELEMENT = 4; + + // void set(in Float32Array array, [Optional] in unsigned long offset); + // void set(in sequence<long> array, [Optional] in unsigned long offset); + [Custom] void set(); + }; +} diff --git a/WebCore/html/canvas/FloatArray.cpp b/WebCore/html/canvas/FloatArray.cpp deleted file mode 100644 index 942a123..0000000 --- a/WebCore/html/canvas/FloatArray.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(3D_CANVAS) - -#include "FloatArray.h" - -namespace WebCore { - -PassRefPtr<FloatArray> FloatArray::create(unsigned length) -{ - return TypedArrayBase<float>::create<FloatArray>(length); -} - -PassRefPtr<FloatArray> FloatArray::create(float* array, unsigned length) -{ - return TypedArrayBase<float>::create<FloatArray>(array, length); -} - -PassRefPtr<FloatArray> FloatArray::create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length) -{ - return TypedArrayBase<float>::create<FloatArray>(buffer, byteOffset, length); -} - -FloatArray::FloatArray(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length) - : TypedArrayBase<float>(buffer, byteOffset, length) -{ -} - -PassRefPtr<ArrayBufferView> FloatArray::slice(int start, int end) const -{ - return sliceImpl<FloatArray>(start, end); -} - -} - -#endif // ENABLE(3D_CANVAS) diff --git a/WebCore/html/canvas/FloatArray.h b/WebCore/html/canvas/FloatArray.h deleted file mode 100644 index 9211a40..0000000 --- a/WebCore/html/canvas/FloatArray.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef FloatArray_h -#define FloatArray_h - -#include "TypedArrayBase.h" -#include <wtf/MathExtras.h> - -namespace WebCore { - -class FloatArray : public TypedArrayBase<float> { - public: - static PassRefPtr<FloatArray> create(unsigned length); - static PassRefPtr<FloatArray> create(float* array, unsigned length); - static PassRefPtr<FloatArray> create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length); - - using TypedArrayBase<float>::set; - - void set(unsigned index, double value) - { - if (index >= TypedArrayBase<float>::m_length) - return; - if (isnan(value)) // Clamp NaN to 0 - value = 0; - TypedArrayBase<float>::data()[index] = static_cast<float>(value); - } - - // Invoked by the indexed getter. Does not perform range checks; caller - // is responsible for doing so and returning undefined as necessary. - float item(unsigned index) const - { - ASSERT(index < TypedArrayBase<float>::m_length); - float result = TypedArrayBase<float>::data()[index]; - if (isnan(result)) { - // Clamp NaN to 0 - result = 0; - } - return result; - } - - private: - FloatArray(PassRefPtr<ArrayBuffer> buffer, - unsigned byteOffset, - unsigned length); - // Make constructor visible to superclass. - friend class TypedArrayBase<float>; - - // Overridden from ArrayBufferView. - virtual bool isFloatArray() const { return true; } - virtual PassRefPtr<ArrayBufferView> slice(int start, int end) const; -}; - -} // namespace WebCore - -#endif // FloatArray_h diff --git a/WebCore/html/canvas/FloatArray.idl b/WebCore/html/canvas/FloatArray.idl deleted file mode 100644 index 41b2c94..0000000 --- a/WebCore/html/canvas/FloatArray.idl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE 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. - */ - -module html { - interface [ - Conditional=3D_CANVAS, - HasNumericIndexGetter, - HasCustomIndexSetter, - GenerateNativeConverter, - CustomConstructor, - CustomToJS - ] FloatArray : ArrayBufferView { - // void set(in FloatArray array, [Optional] in unsigned long offset); - // void set(in sequence<long> array, [Optional] in unsigned long offset); - [Custom] void set(); - }; -} diff --git a/WebCore/html/canvas/Int16Array.idl b/WebCore/html/canvas/Int16Array.idl index 2ac52fe..95c8204 100644 --- a/WebCore/html/canvas/Int16Array.idl +++ b/WebCore/html/canvas/Int16Array.idl @@ -32,6 +32,8 @@ module html { CustomConstructor, CustomToJS ] Int16Array : ArrayBufferView { + const unsigned int BYTES_PER_ELEMENT = 2; + // void set(in Int16Array array, [Optional] in unsigned long offset); // void set(in sequence<long> array, [Optional] in unsigned long offset); [Custom] void set(); diff --git a/WebCore/html/canvas/Int32Array.idl b/WebCore/html/canvas/Int32Array.idl index 80a885e..9c9a50f 100644 --- a/WebCore/html/canvas/Int32Array.idl +++ b/WebCore/html/canvas/Int32Array.idl @@ -33,6 +33,8 @@ module html { CustomConstructor, CustomToJS ] Int32Array : ArrayBufferView { + const unsigned int BYTES_PER_ELEMENT = 4; + // void set(in Int32Array array, [Optional] in unsigned long offset); // void set(in sequence<long> array, [Optional] in unsigned long offset); [Custom] void set(); diff --git a/WebCore/html/canvas/Int8Array.idl b/WebCore/html/canvas/Int8Array.idl index 1124ac1..9aefd34 100644 --- a/WebCore/html/canvas/Int8Array.idl +++ b/WebCore/html/canvas/Int8Array.idl @@ -33,6 +33,8 @@ module html { CustomConstructor, CustomToJS ] Int8Array : ArrayBufferView { + const unsigned int BYTES_PER_ELEMENT = 1; + // void set(in Int8Array array, [Optional] in unsigned long offset); // void set(in sequence<long> array, [Optional] in unsigned long offset); [Custom] void set(); diff --git a/WebCore/html/canvas/Uint16Array.idl b/WebCore/html/canvas/Uint16Array.idl index 2d5b34e..baba0d9 100644 --- a/WebCore/html/canvas/Uint16Array.idl +++ b/WebCore/html/canvas/Uint16Array.idl @@ -33,6 +33,8 @@ module html { GenerateNativeConverter, CustomToJS ] Uint16Array : ArrayBufferView { + const unsigned int BYTES_PER_ELEMENT = 2; + // void set(in Uint16Array array, [Optional] in unsigned long offset); // void set(in sequence<long> array, [Optional] in unsigned long offset); [Custom] void set(); diff --git a/WebCore/html/canvas/Uint32Array.idl b/WebCore/html/canvas/Uint32Array.idl index bab0f8d..b7573e6 100644 --- a/WebCore/html/canvas/Uint32Array.idl +++ b/WebCore/html/canvas/Uint32Array.idl @@ -33,6 +33,8 @@ module html { GenerateNativeConverter, CustomToJS ] Uint32Array : ArrayBufferView { + const unsigned int BYTES_PER_ELEMENT = 4; + // void set(in Uint32Array array, [Optional] in unsigned long offset); // void set(in sequence<long> array, [Optional] in unsigned long offset); [Custom] void set(); diff --git a/WebCore/html/canvas/Uint8Array.idl b/WebCore/html/canvas/Uint8Array.idl index 7031bfc..ea4c0f5 100644 --- a/WebCore/html/canvas/Uint8Array.idl +++ b/WebCore/html/canvas/Uint8Array.idl @@ -33,6 +33,8 @@ module html { CustomConstructor, CustomToJS ] Uint8Array : ArrayBufferView { + const unsigned int BYTES_PER_ELEMENT = 1; + // void set(in Uint8Array array, [Optional] in unsigned long offset); // void set(in sequence<long> array, [Optional] in unsigned long offset); [Custom] void set(); diff --git a/WebCore/html/canvas/WebGLFramebuffer.cpp b/WebCore/html/canvas/WebGLFramebuffer.cpp index c783553..db88b1c 100644 --- a/WebCore/html/canvas/WebGLFramebuffer.cpp +++ b/WebCore/html/canvas/WebGLFramebuffer.cpp @@ -87,6 +87,24 @@ void WebGLFramebuffer::onAttachedObjectChange(CanvasObject* object) initializeRenderbuffers(); } +unsigned long WebGLFramebuffer::getColorBufferFormat() +{ + if (object() && m_colorAttachment && m_colorAttachment->object()) { + if (m_colorAttachment->isRenderbuffer()) { + unsigned long format = (reinterpret_cast<WebGLRenderbuffer*>(m_colorAttachment))->getInternalformat(); + switch (format) { + case GraphicsContext3D::RGBA4: + case GraphicsContext3D::RGB5_A1: + return GraphicsContext3D::RGBA; + case GraphicsContext3D::RGB565: + return GraphicsContext3D::RGB; + } + } else if (m_colorAttachment->isTexture()) + return (reinterpret_cast<WebGLTexture*>(m_colorAttachment))->getInternalformat(); + } + return 0; +} + void WebGLFramebuffer::_deleteObject(Platform3DObject object) { context()->graphicsContext3D()->deleteFramebuffer(object); diff --git a/WebCore/html/canvas/WebGLFramebuffer.h b/WebCore/html/canvas/WebGLFramebuffer.h index 93ab97c..ae1f4dc 100644 --- a/WebCore/html/canvas/WebGLFramebuffer.h +++ b/WebCore/html/canvas/WebGLFramebuffer.h @@ -57,6 +57,8 @@ namespace WebCore { // clear un-initialized renderbuffers. void onAttachedObjectChange(CanvasObject*); + unsigned long getColorBufferFormat(); + protected: WebGLFramebuffer(WebGLRenderingContext*); diff --git a/WebCore/html/canvas/WebGLGetInfo.cpp b/WebCore/html/canvas/WebGLGetInfo.cpp index d5fcd92..79fc971 100644 --- a/WebCore/html/canvas/WebGLGetInfo.cpp +++ b/WebCore/html/canvas/WebGLGetInfo.cpp @@ -30,7 +30,7 @@ #include "WebGLGetInfo.h" #include "WebGLBuffer.h" -#include "FloatArray.h" +#include "Float32Array.h" #include "WebGLFramebuffer.h" #include "Int32Array.h" #include "WebGLProgram.h" @@ -81,7 +81,7 @@ WebGLGetInfo::WebGLGetInfo(PassRefPtr<WebGLBuffer> value) { } -WebGLGetInfo::WebGLGetInfo(PassRefPtr<FloatArray> value) +WebGLGetInfo::WebGLGetInfo(PassRefPtr<Float32Array> value) : m_type(kTypeWebGLFloatArray) , m_webglFloatArray(value) { @@ -168,7 +168,7 @@ PassRefPtr<WebGLBuffer> WebGLGetInfo::getWebGLBuffer() const return m_webglBuffer; } -PassRefPtr<FloatArray> WebGLGetInfo::getWebGLFloatArray() const +PassRefPtr<Float32Array> WebGLGetInfo::getWebGLFloatArray() const { ASSERT(getType() == kTypeWebGLFloatArray); return m_webglFloatArray; diff --git a/WebCore/html/canvas/WebGLGetInfo.h b/WebCore/html/canvas/WebGLGetInfo.h index 969e05d..b35add8 100644 --- a/WebCore/html/canvas/WebGLGetInfo.h +++ b/WebCore/html/canvas/WebGLGetInfo.h @@ -32,7 +32,7 @@ #include "PlatformString.h" #include "WebGLBuffer.h" -#include "FloatArray.h" +#include "Float32Array.h" #include "WebGLFramebuffer.h" #include "Int32Array.h" // FIXME: implement WebGLObjectArray @@ -77,7 +77,7 @@ public: WebGLGetInfo(const String& value); WebGLGetInfo(unsigned long value); WebGLGetInfo(PassRefPtr<WebGLBuffer> value); - WebGLGetInfo(PassRefPtr<FloatArray> value); + WebGLGetInfo(PassRefPtr<Float32Array> value); WebGLGetInfo(PassRefPtr<WebGLFramebuffer> value); WebGLGetInfo(PassRefPtr<Int32Array> value); // FIXME: implement WebGLObjectArray @@ -97,7 +97,7 @@ public: const String& getString() const; unsigned long getUnsignedLong() const; PassRefPtr<WebGLBuffer> getWebGLBuffer() const; - PassRefPtr<FloatArray> getWebGLFloatArray() const; + PassRefPtr<Float32Array> getWebGLFloatArray() const; PassRefPtr<WebGLFramebuffer> getWebGLFramebuffer() const; PassRefPtr<Int32Array> getWebGLIntArray() const; // FIXME: implement WebGLObjectArray @@ -115,7 +115,7 @@ private: String m_string; unsigned long m_unsignedLong; RefPtr<WebGLBuffer> m_webglBuffer; - RefPtr<FloatArray> m_webglFloatArray; + RefPtr<Float32Array> m_webglFloatArray; RefPtr<WebGLFramebuffer> m_webglFramebuffer; RefPtr<Int32Array> m_webglIntArray; // FIXME: implement WebGLObjectArray diff --git a/WebCore/html/canvas/WebGLRenderingContext.cpp b/WebCore/html/canvas/WebGLRenderingContext.cpp index ca1d375..82a0f8f 100644 --- a/WebCore/html/canvas/WebGLRenderingContext.cpp +++ b/WebCore/html/canvas/WebGLRenderingContext.cpp @@ -30,6 +30,8 @@ #include "WebGLRenderingContext.h" #include "CanvasPixelArray.h" +#include "Console.h" +#include "DOMWindow.h" #include "FrameView.h" #include "HTMLCanvasElement.h" #include "HTMLImageElement.h" @@ -50,6 +52,7 @@ #include "WebGLUniformLocation.h" #include <wtf/ByteArray.h> +#include <wtf/MathExtras.h> namespace WebCore { @@ -91,17 +94,33 @@ WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, Pa , m_activeTextureUnit(0) , m_packAlignment(4) , m_unpackAlignment(4) + , m_unpackFlipY(false) + , m_unpackPremultiplyAlpha(false) { ASSERT(m_context); + + int numCombinedTextureImageUnits = 0; + m_context->getIntegerv(GraphicsContext3D::MAX_COMBINED_TEXTURE_IMAGE_UNITS, &numCombinedTextureImageUnits); + m_textureUnits.resize(numCombinedTextureImageUnits); + int numVertexAttribs = 0; m_context->getIntegerv(GraphicsContext3D::MAX_VERTEX_ATTRIBS, &numVertexAttribs); m_maxVertexAttribs = numVertexAttribs; + int implementationColorReadFormat = GraphicsContext3D::RGBA; m_context->getIntegerv(GraphicsContext3D::IMPLEMENTATION_COLOR_READ_FORMAT, &implementationColorReadFormat); m_implementationColorReadFormat = implementationColorReadFormat; int implementationColorReadType = GraphicsContext3D::UNSIGNED_BYTE; m_context->getIntegerv(GraphicsContext3D::IMPLEMENTATION_COLOR_READ_TYPE, &implementationColorReadType); m_implementationColorReadType = implementationColorReadType; + + int maxTextureSize = 0; + m_context->getIntegerv(GraphicsContext3D::MAX_TEXTURE_SIZE, &maxTextureSize); + m_maxTextureSize = maxTextureSize; + int maxCubeMapTextureSize = 0; + m_context->getIntegerv(GraphicsContext3D::MAX_CUBE_MAP_TEXTURE_SIZE, &maxCubeMapTextureSize); + m_maxCubeMapTextureSize = maxCubeMapTextureSize; + if (!isGLES2Compliant()) createFallbackBlackTextures1x1(); m_context->reshape(canvas()->width(), canvas()->height()); @@ -433,36 +452,45 @@ void WebGLRenderingContext::compileShader(WebGLShader* shader, ExceptionCode& ec void WebGLRenderingContext::copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border) { - RefPtr<WebGLTexture> tex = 0; - switch (target) { - case GraphicsContext3D::TEXTURE_2D: - tex = m_textureUnits[m_activeTextureUnit].m_texture2DBinding; - break; - case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_X: - case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_X: - case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_Y: - case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_Y: - case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_Z: - case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_Z: - tex = m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding; - break; - } + if (!validateTexFuncParameters(target, level, internalformat, width, height, border, internalformat, GraphicsContext3D::UNSIGNED_BYTE)) + return; if (!isGLES2Compliant()) { + if (m_framebufferBinding && m_framebufferBinding->object() + && !isTexInternalformatColorBufferCombinationValid(internalformat, + m_framebufferBinding->getColorBufferFormat())) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } if (level && WebGLTexture::isNPOT(width, height)) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return; } + } + m_context->copyTexImage2D(target, level, internalformat, x, y, width, height, border); + // FIXME: if the framebuffer is not complete, none of the below should be executed. + WebGLTexture* tex = getTextureBinding(target); + if (!isGLES2Compliant()) { if (tex && !level) // only for level 0 tex->setSize(target, width, height); + if (tex) + tex->setInternalformat(internalformat); } - m_context->copyTexImage2D(target, level, internalformat, x, y, width, height, border); if (m_framebufferBinding && tex) - m_framebufferBinding->onAttachedObjectChange(tex.get()); + m_framebufferBinding->onAttachedObjectChange(tex); cleanupAfterGraphicsCall(false); } void WebGLRenderingContext::copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height) { + if (!isGLES2Compliant()) { + WebGLTexture* tex = getTextureBinding(target); + if (m_framebufferBinding && m_framebufferBinding->object() && tex + && !isTexInternalformatColorBufferCombinationValid(tex->getInternalformat(), + m_framebufferBinding->getColorBufferFormat())) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + } m_context->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); cleanupAfterGraphicsCall(false); } @@ -731,7 +759,14 @@ bool WebGLRenderingContext::validateRenderingState(long numElementsRequired) if (!m_currentProgram) return false; - // Look in each enabled vertex attrib and find the smallest buffer size + // Look in each enabled vertex attrib and check if they've been bound to a buffer. + for (size_t i = 0; i < m_vertexAttribState.size(); ++i) { + if (m_vertexAttribState[i].enabled + && (!m_vertexAttribState[i].bufferBinding || !m_vertexAttribState[i].bufferBinding->object())) + return false; + } + + // Look in each consumed vertex attrib (by the current program) and find the smallest buffer size long smallestNumElements = LONG_MAX; int numActiveAttribLocations = m_currentProgram->numActiveAttribLocations(); int numAttribStates = static_cast<int>(m_vertexAttribState.size()); @@ -766,8 +801,20 @@ bool WebGLRenderingContext::validateWebGLObject(CanvasObject* object) void WebGLRenderingContext::drawArrays(unsigned long mode, long first, long count, ExceptionCode& ec) { UNUSED_PARAM(ec); + + if (!validateDrawMode(mode)) + return; + + if (first < 0 || count < 0) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + + if (!count) + return; + // Ensure we have a valid rendering state - if (first < 0 || count < 0 || !validateRenderingState(first + count)) { + if (!validateRenderingState(first + count)) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); return; } @@ -778,13 +825,34 @@ void WebGLRenderingContext::drawArrays(unsigned long mode, long first, long coun cleanupAfterGraphicsCall(true); } -void WebGLRenderingContext::drawElements(unsigned long mode, unsigned long count, unsigned long type, long offset, ExceptionCode& ec) +void WebGLRenderingContext::drawElements(unsigned long mode, long count, unsigned long type, long offset, ExceptionCode& ec) { UNUSED_PARAM(ec); + + if (!validateDrawMode(mode)) + return; + + switch (type) { + case GraphicsContext3D::UNSIGNED_BYTE: + case GraphicsContext3D::UNSIGNED_SHORT: + break; + default: + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return; + } + + if (count < 0 || offset < 0) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + + if (!count) + return; + // Ensure we have a valid rendering state long numElements; - if (offset < 0 || !validateElementArraySize(count, type, offset)) { + if (!validateElementArraySize(count, type, offset)) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); return; } @@ -946,6 +1014,10 @@ PassRefPtr<WebGLActiveInfo> WebGLRenderingContext::getActiveUniform(WebGLProgram if (!m_context->getActiveUniform(program, index, info)) { return 0; } + if (!isGLES2Compliant()) { + if (info.size > 1 && !info.name.endsWith("[0]")) + info.name.append("[0]"); + } return WebGLActiveInfo::create(info.name, info.type, info.size); } @@ -1200,6 +1272,10 @@ WebGLGetInfo WebGLRenderingContext::getParameter(unsigned long pname, ExceptionC case GraphicsContext3D::UNPACK_ALIGNMENT: // FIXME: should this be "long" in the spec? return getIntParameter(pname); + case GraphicsContext3D::UNPACK_FLIP_Y_WEBGL: + return WebGLGetInfo(m_unpackFlipY); + case GraphicsContext3D::UNPACK_PREMULTIPLY_ALPHA_WEBGL: + return WebGLGetInfo(m_unpackPremultiplyAlpha); case GraphicsContext3D::VIEWPORT: return getWebGLIntArrayParameter(pname); default: @@ -1449,7 +1525,7 @@ WebGLGetInfo WebGLRenderingContext::getUniform(WebGLProgram* program, const WebG if (length == 1) return WebGLGetInfo(value[0]); else - return WebGLGetInfo(FloatArray::create(value, length)); + return WebGLGetInfo(Float32Array::create(value, length)); } case GraphicsContext3D::INT: { int value[16] = {0}; @@ -1527,7 +1603,7 @@ WebGLGetInfo WebGLRenderingContext::getVertexAttrib(unsigned long index, unsigne case GraphicsContext3D::CURRENT_VERTEX_ATTRIB: { float value[4] = {0}; m_context->getVertexAttribfv(index, pname, value); - return WebGLGetInfo(FloatArray::create(value, 4)); + return WebGLGetInfo(Float32Array::create(value, 4)); } default: { m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); @@ -1620,15 +1696,21 @@ void WebGLRenderingContext::linkProgram(WebGLProgram* program, ExceptionCode& ec void WebGLRenderingContext::pixelStorei(unsigned long pname, long param) { - m_context->pixelStorei(pname, param); - if (param == 1 || param == 2 || param == 4 || param == 8) { - switch (pname) { - case GraphicsContext3D::PACK_ALIGNMENT: - m_packAlignment = static_cast<int>(param); - break; - case GraphicsContext3D::UNPACK_ALIGNMENT: - m_unpackAlignment = static_cast<int>(param); - break; + if (pname == GraphicsContext3D::UNPACK_FLIP_Y_WEBGL) { + m_unpackFlipY = param; + } else if (pname == GraphicsContext3D::UNPACK_PREMULTIPLY_ALPHA_WEBGL) { + m_unpackPremultiplyAlpha = param; + } else { + m_context->pixelStorei(pname, param); + if (param == 1 || param == 2 || param == 4 || param == 8) { + switch (pname) { + case GraphicsContext3D::PACK_ALIGNMENT: + m_packAlignment = static_cast<int>(param); + break; + case GraphicsContext3D::UNPACK_ALIGNMENT: + m_unpackAlignment = static_cast<int>(param); + break; + } } } cleanupAfterGraphicsCall(false); @@ -1640,9 +1722,9 @@ void WebGLRenderingContext::polygonOffset(double factor, double units) cleanupAfterGraphicsCall(false); } -PassRefPtr<ArrayBufferView> WebGLRenderingContext::readPixels(long x, long y, unsigned long width, unsigned long height, unsigned long format, unsigned long type) +void WebGLRenderingContext::readPixels(long x, long y, long width, long height, unsigned long format, unsigned long type, ArrayBufferView* pixels) { - // Validate enums. + // Validate input parameters. unsigned long componentsPerPixel = 0; switch (format) { case GraphicsContext3D::ALPHA: @@ -1656,7 +1738,7 @@ PassRefPtr<ArrayBufferView> WebGLRenderingContext::readPixels(long x, long y, un break; default: m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); - return 0; + return; } unsigned long bytesPerComponent = 0; switch (type) { @@ -1671,11 +1753,25 @@ PassRefPtr<ArrayBufferView> WebGLRenderingContext::readPixels(long x, long y, un break; default: m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); - return 0; + return; + } + if (!pixels) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + if (width < 0 || height < 0) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; } if (!((format == GraphicsContext3D::RGBA && type == GraphicsContext3D::UNSIGNED_BYTE) || (format == m_implementationColorReadFormat && type == m_implementationColorReadType))) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); - return 0; + return; + } + // Validate array type against pixel type. + if (type == GraphicsContext3D::UNSIGNED_BYTE && !pixels->isUnsignedByteArray() + || type != GraphicsContext3D::UNSIGNED_BYTE && !pixels->isUnsignedShortArray()) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; } // Calculate array size, taking into consideration of PACK_ALIGNMENT. unsigned long bytesPerRow = componentsPerPixel * bytesPerComponent * width; @@ -1688,12 +1784,11 @@ PassRefPtr<ArrayBufferView> WebGLRenderingContext::readPixels(long x, long y, un // The last row needs no padding. unsigned long totalBytes = bytesPerRow * height - padding; unsigned long num = totalBytes / bytesPerComponent; - RefPtr<ArrayBufferView> array; - if (type == GraphicsContext3D::UNSIGNED_BYTE) - array = Uint8Array::create(num); - else - array = Uint16Array::create(num); - void* data = array->baseAddress(); + if (pixels->length() < num) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + void* data = pixels->baseAddress(); m_context->readPixels(x, y, width, height, format, type, data); #if PLATFORM(CG) // FIXME: remove this section when GL driver bug on Mac is fixed, i.e., @@ -1701,8 +1796,8 @@ PassRefPtr<ArrayBufferView> WebGLRenderingContext::readPixels(long x, long y, un if ((format == GraphicsContext3D::ALPHA || format == GraphicsContext3D::RGBA) && !m_context->getContextAttributes().alpha) { if (type == GraphicsContext3D::UNSIGNED_BYTE) { unsigned char* pixels = reinterpret_cast<unsigned char*>(data); - for (unsigned long iy = 0; iy < height; ++iy) { - for (unsigned long ix = 0; ix < width; ++ix) { + for (long iy = 0; iy < height; ++iy) { + for (long ix = 0; ix < width; ++ix) { pixels[componentsPerPixel - 1] = 255; pixels += componentsPerPixel; } @@ -1713,7 +1808,6 @@ PassRefPtr<ArrayBufferView> WebGLRenderingContext::readPixels(long x, long y, un } #endif cleanupAfterGraphicsCall(false); - return array; } void WebGLRenderingContext::releaseShaderCompiler() @@ -1805,43 +1899,39 @@ void WebGLRenderingContext::texImage2DBase(unsigned target, unsigned level, unsi unsigned width, unsigned height, unsigned border, unsigned format, unsigned type, void* pixels, ExceptionCode& ec) { - RefPtr<WebGLTexture> tex = 0; - switch (target) { - case GraphicsContext3D::TEXTURE_2D: - tex = m_textureUnits[m_activeTextureUnit].m_texture2DBinding; - break; - case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_X: - case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_X: - case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_Y: - case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_Y: - case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_Z: - case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_Z: - tex = m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding; - break; - } // FIXME: For now we ignore any errors returned ec = 0; + if (!validateTexFuncParameters(target, level, internalformat, width, height, border, format, type)) + return; if (!isGLES2Compliant()) { if (level && WebGLTexture::isNPOT(width, height)) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return; } - if (tex && !level) // only for level 0 - tex->setSize(target, width, height); } m_context->texImage2D(target, level, internalformat, width, height, border, format, type, pixels); + WebGLTexture* tex = getTextureBinding(target); + if (!isGLES2Compliant()) { + if (tex && !level) // only for level 0 + tex->setSize(target, width, height); + if (tex) + tex->setInternalformat(internalformat); + } if (m_framebufferBinding && tex) - m_framebufferBinding->onAttachedObjectChange(tex.get()); + m_framebufferBinding->onAttachedObjectChange(tex); cleanupAfterGraphicsCall(false); } -void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, Image* image, - bool flipY, bool premultiplyAlpha, ExceptionCode& ec) +void WebGLRenderingContext::texImage2DImpl(unsigned target, unsigned level, unsigned internalformat, + unsigned format, unsigned type, Image* image, + bool flipY, bool premultiplyAlpha, ExceptionCode& ec) { + // FIXME: pay attention to the user's supplied internalformat, format and type + // FIXME: pay attention to UNPACK_ROW_WIDTH + UNUSED_PARAM(type); ec = 0; Vector<uint8_t> data; - unsigned int format, internalformat; if (!m_context->extractImageData(image, flipY, premultiplyAlpha, data, &format, &internalformat)) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return; @@ -1859,21 +1949,82 @@ void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, unsigned format, type, pixels ? pixels->baseAddress() : 0, ec); } +void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, unsigned internalformat, + unsigned format, unsigned type, ImageData* pixels, ExceptionCode& ec) +{ + UNUSED_PARAM(internalformat); + UNUSED_PARAM(format); + UNUSED_PARAM(type); + // FIXME: pay attention to the user's supplied internalformat, format and type + ec = 0; + Vector<uint8_t> data; + if (!m_context->extractImageData(pixels, m_unpackFlipY, m_unpackPremultiplyAlpha, data)) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + texImage2DBase(target, level, GraphicsContext3D::RGBA, pixels->width(), pixels->height(), 0, + GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, data.data(), ec); +} + +void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, unsigned internalformat, + unsigned format, unsigned type, HTMLImageElement* image, ExceptionCode& ec) +{ + ec = 0; + if (!image || !image->cachedImage()) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + texImage2DImpl(target, level, internalformat, format, type, image->cachedImage()->image(), + m_unpackFlipY, m_unpackPremultiplyAlpha, ec); +} + +void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, unsigned internalformat, + unsigned format, unsigned type, HTMLCanvasElement* canvas, ExceptionCode& ec) +{ + ec = 0; + if (!canvas || !canvas->buffer()) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + texImage2DImpl(target, level, internalformat, format, type, canvas->buffer()->image(), + m_unpackFlipY, m_unpackPremultiplyAlpha, ec); +} + +void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, unsigned internalformat, + unsigned format, unsigned type, HTMLVideoElement* video, ExceptionCode& ec) +{ + // FIXME: Need to implement this call + UNUSED_PARAM(target); + UNUSED_PARAM(level); + UNUSED_PARAM(internalformat); + UNUSED_PARAM(format); + UNUSED_PARAM(type); + UNUSED_PARAM(video); + + ec = 0; + cleanupAfterGraphicsCall(false); +} + +// Obsolete texImage2D entry points -- to be removed shortly. (FIXME) + void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, ImageData* pixels, ExceptionCode& ec) { + printWarningToConsole("Calling obsolete texImage2D(GLenum target, GLint level, ImageData pixels)"); texImage2D(target, level, pixels, 0, 0, ec); } void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, ImageData* pixels, bool flipY, ExceptionCode& ec) { + printWarningToConsole("Calling obsolete texImage2D(GLenum target, GLint level, ImageData pixels, GLboolean flipY)"); texImage2D(target, level, pixels, flipY, 0, ec); } void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, ImageData* pixels, bool flipY, bool premultiplyAlpha, ExceptionCode& ec) { + printWarningToConsole("Calling obsolete texImage2D(GLenum target, GLint level, ImageData pixels, GLboolean flipY, GLboolean premultiplyAlpha)"); ec = 0; Vector<uint8_t> data; if (!m_context->extractImageData(pixels, flipY, premultiplyAlpha, data)) { @@ -1888,47 +2039,53 @@ void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, ImageDat void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLImageElement* image, ExceptionCode& ec) { + printWarningToConsole("Calling obsolete texImage2D(GLenum target, GLint level, HTMLImageElement image)"); texImage2D(target, level, image, 0, 0, ec); } void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLImageElement* image, bool flipY, ExceptionCode& ec) { + printWarningToConsole("Calling obsolete texImage2D(GLenum target, GLint level, HTMLImageElement image, GLboolean flipY)"); texImage2D(target, level, image, flipY, 0, ec); } void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLImageElement* image, bool flipY, bool premultiplyAlpha, ExceptionCode& ec) { + printWarningToConsole("Calling obsolete texImage2D(GLenum target, GLint level, HTMLImageElement image, GLboolean flipY, GLboolean premultiplyAlpha)"); ec = 0; if (!image || !image->cachedImage()) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return; } - texImage2D(target, level, image->cachedImage()->image(), flipY, premultiplyAlpha, ec); + texImage2DImpl(target, level, GraphicsContext3D::RGBA, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, image->cachedImage()->image(), flipY, premultiplyAlpha, ec); } void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas, ExceptionCode& ec) { + printWarningToConsole("Calling obsolete texImage2D(GLenum target, GLint level, HTMLCanvasElement canvas)"); texImage2D(target, level, canvas, 0, 0, ec); } void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas, bool flipY, ExceptionCode& ec) { + printWarningToConsole("Calling obsolete texImage2D(GLenum target, GLint level, HTMLCanvasElement canvas, GLboolean flipY)"); texImage2D(target, level, canvas, flipY, 0, ec); } void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas, bool flipY, bool premultiplyAlpha, ExceptionCode& ec) { + printWarningToConsole("Calling obsolete texImage2D(GLenum target, GLint level, HTMLCanvasElement canvas, GLboolean flipY, GLboolean premultiplyAlpha)"); ec = 0; if (!canvas || !canvas->buffer()) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return; } - texImage2D(target, level, canvas->buffer()->image(), flipY, premultiplyAlpha, ec); + texImage2DImpl(target, level, GraphicsContext3D::RGBA, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, canvas->buffer()->image(), flipY, premultiplyAlpha, ec); } void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLVideoElement* video, @@ -1957,34 +2114,59 @@ void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLVide cleanupAfterGraphicsCall(false); } -void WebGLRenderingContext::texParameterf(unsigned target, unsigned pname, float param) +void WebGLRenderingContext::texParameter(unsigned long target, unsigned long pname, float paramf, int parami, bool isFloat) { - m_context->texParameterf(target, pname, param); if (!isGLES2Compliant()) { RefPtr<WebGLTexture> tex = 0; - if (target == GraphicsContext3D::TEXTURE_2D) + switch (target) { + case GraphicsContext3D::TEXTURE_2D: tex = m_textureUnits[m_activeTextureUnit].m_texture2DBinding; - else if (target == GraphicsContext3D::TEXTURE_CUBE_MAP) + break; + case GraphicsContext3D::TEXTURE_CUBE_MAP: tex = m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding; - if (tex) - tex->setParameterf(pname, param); + break; + default: + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return; + } + switch (pname) { + case GraphicsContext3D::TEXTURE_MIN_FILTER: + case GraphicsContext3D::TEXTURE_MAG_FILTER: + break; + case GraphicsContext3D::TEXTURE_WRAP_S: + case GraphicsContext3D::TEXTURE_WRAP_T: + if (isFloat && paramf != GraphicsContext3D::CLAMP_TO_EDGE && paramf != GraphicsContext3D::MIRRORED_REPEAT && paramf != GraphicsContext3D::REPEAT + || !isFloat && parami != GraphicsContext3D::CLAMP_TO_EDGE && parami != GraphicsContext3D::MIRRORED_REPEAT && parami != GraphicsContext3D::REPEAT) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return; + } + break; + default: + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return; + } + if (tex) { + if (isFloat) + tex->setParameterf(pname, paramf); + else + tex->setParameteri(pname, parami); + } } + if (isFloat) + m_context->texParameterf(target, pname, paramf); + else + m_context->texParameteri(target, pname, parami); cleanupAfterGraphicsCall(false); } +void WebGLRenderingContext::texParameterf(unsigned target, unsigned pname, float param) +{ + texParameter(target, pname, param, 0, true); +} + void WebGLRenderingContext::texParameteri(unsigned target, unsigned pname, int param) { - m_context->texParameteri(target, pname, param); - if (!isGLES2Compliant()) { - RefPtr<WebGLTexture> tex = 0; - if (target == GraphicsContext3D::TEXTURE_2D) - tex = m_textureUnits[m_activeTextureUnit].m_texture2DBinding; - else if (target == GraphicsContext3D::TEXTURE_CUBE_MAP) - tex = m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding; - if (tex) - tex->setParameteri(pname, param); - } - cleanupAfterGraphicsCall(false); + texParameter(target, pname, 0, param, false); } void WebGLRenderingContext::texSubImage2DBase(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, @@ -1993,16 +2175,23 @@ void WebGLRenderingContext::texSubImage2DBase(unsigned target, unsigned level, u { // FIXME: For now we ignore any errors returned ec = 0; + if (!validateTexFuncFormatAndType(format, type)) + return; + m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); cleanupAfterGraphicsCall(false); } -void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - Image* image, bool flipY, bool premultiplyAlpha, ExceptionCode& ec) +void WebGLRenderingContext::texSubImage2DImpl(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + unsigned format, unsigned type, + Image* image, bool flipY, bool premultiplyAlpha, ExceptionCode& ec) { + UNUSED_PARAM(type); + // FIXME: pay attention to the user's supplied format and type + // FIXME: pay attention to UNPACK_ROW_WIDTH ec = 0; Vector<uint8_t> data; - unsigned int format, internalformat; + unsigned int internalformat; if (!m_context->extractImageData(image, flipY, premultiplyAlpha, data, &format, &internalformat)) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return; @@ -2020,20 +2209,80 @@ void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsig } void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + unsigned format, unsigned type, ImageData* pixels, ExceptionCode& ec) +{ + UNUSED_PARAM(format); + UNUSED_PARAM(type); + // FIXME: pay attention to the user's supplied format and type + ec = 0; + Vector<uint8_t> data; + if (!m_context->extractImageData(pixels, m_unpackFlipY, m_unpackPremultiplyAlpha, data)) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + texSubImage2DBase(target, level, xoffset, yoffset, pixels->width(), pixels->height(), + GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, data.data(), ec); +} + +void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + unsigned format, unsigned type, HTMLImageElement* image, ExceptionCode& ec) +{ + ec = 0; + if (!image || !image->cachedImage()) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + texSubImage2DImpl(target, level, xoffset, yoffset, format, type, image->cachedImage()->image(), + m_unpackFlipY, m_unpackPremultiplyAlpha, ec); +} + +void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + unsigned format, unsigned type, HTMLCanvasElement* canvas, ExceptionCode& ec) +{ + ec = 0; + if (!canvas || !canvas->buffer()) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + texSubImage2DImpl(target, level, xoffset, yoffset, format, type, canvas->buffer()->image(), + m_unpackFlipY, m_unpackPremultiplyAlpha, ec); +} + +void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + unsigned format, unsigned type, HTMLVideoElement* video, ExceptionCode& ec) +{ + // FIXME: Need to implement this call + UNUSED_PARAM(target); + UNUSED_PARAM(level); + UNUSED_PARAM(xoffset); + UNUSED_PARAM(yoffset); + UNUSED_PARAM(format); + UNUSED_PARAM(type); + UNUSED_PARAM(video); + ec = 0; + cleanupAfterGraphicsCall(false); +} + +// Obsolete texSubImage2D entry points -- to be removed shortly. (FIXME) + +void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, ImageData* pixels, ExceptionCode& ec) { + printWarningToConsole("Calling obsolete texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, ImageData pixels)"); texSubImage2D(target, level, xoffset, yoffset, pixels, 0, 0, ec); } void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, ImageData* pixels, bool flipY, ExceptionCode& ec) { + printWarningToConsole("Calling obsolete texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, ImageData pixels, GLboolean flipY)"); texSubImage2D(target, level, xoffset, yoffset, pixels, flipY, 0, ec); } void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, ImageData* pixels, bool flipY, bool premultiplyAlpha, ExceptionCode& ec) { + printWarningToConsole("Calling obsolete texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, ImageData pixels, GLboolean flipY, GLboolean premultiplyAlpha)"); ec = 0; Vector<uint8_t> data; if (!m_context->extractImageData(pixels, flipY, premultiplyAlpha, data)) { @@ -2047,49 +2296,55 @@ void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsig void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLImageElement* image, ExceptionCode& ec) { + printWarningToConsole("Calling obsolete texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, HTMLImageElement image)"); texSubImage2D(target, level, xoffset, yoffset, image, 0, 0, ec); } void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLImageElement* image, bool flipY, ExceptionCode& ec) { + printWarningToConsole("Calling obsolete texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, HTMLImageElement image, GLboolean flipY)"); texSubImage2D(target, level, xoffset, yoffset, image, flipY, 0, ec); } void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLImageElement* image, bool flipY, bool premultiplyAlpha, ExceptionCode& ec) { + printWarningToConsole("Calling obsolete texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, HTMLImageElement image, GLboolean flipY, GLboolean premultiplyAlpha)"); ec = 0; if (!image || !image->cachedImage()) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return; } - texSubImage2D(target, level, xoffset, yoffset, image->cachedImage()->image(), - flipY, premultiplyAlpha, ec); + texSubImage2DImpl(target, level, xoffset, yoffset, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, image->cachedImage()->image(), + flipY, premultiplyAlpha, ec); } void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLCanvasElement* canvas, ExceptionCode& ec) { + printWarningToConsole("Calling obsolete texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, HTMLCanvasElement canvas)"); texSubImage2D(target, level, xoffset, yoffset, canvas, 0, 0, ec); } void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLCanvasElement* canvas, bool flipY, ExceptionCode& ec) { + printWarningToConsole("Calling obsolete texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, HTMLCanvasElement canvas, GLboolean flipY)"); texSubImage2D(target, level, xoffset, yoffset, canvas, flipY, 0, ec); } void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLCanvasElement* canvas, bool flipY, bool premultiplyAlpha, ExceptionCode& ec) { + printWarningToConsole("Calling obsolete texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, HTMLCanvasElement canvas, GLboolean flipY, GLboolean premultiplyAlpha)"); ec = 0; if (!canvas || !canvas->buffer()) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return; } - texSubImage2D(target, level, xoffset, yoffset, canvas->buffer()->image(), - flipY, premultiplyAlpha, ec); + texSubImage2DImpl(target, level, xoffset, yoffset, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, canvas->buffer()->image(), + flipY, premultiplyAlpha, ec); } void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, @@ -2122,10 +2377,8 @@ void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsig void WebGLRenderingContext::uniform1f(const WebGLUniformLocation* location, float x, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2136,13 +2389,11 @@ void WebGLRenderingContext::uniform1f(const WebGLUniformLocation* location, floa cleanupAfterGraphicsCall(false); } -void WebGLRenderingContext::uniform1fv(const WebGLUniformLocation* location, FloatArray* v, ExceptionCode& ec) +void WebGLRenderingContext::uniform1fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2160,10 +2411,8 @@ void WebGLRenderingContext::uniform1fv(const WebGLUniformLocation* location, Flo void WebGLRenderingContext::uniform1fv(const WebGLUniformLocation* location, float* v, int size, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2181,10 +2430,8 @@ void WebGLRenderingContext::uniform1fv(const WebGLUniformLocation* location, flo void WebGLRenderingContext::uniform1i(const WebGLUniformLocation* location, int x, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2198,10 +2445,8 @@ void WebGLRenderingContext::uniform1i(const WebGLUniformLocation* location, int void WebGLRenderingContext::uniform1iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2219,10 +2464,8 @@ void WebGLRenderingContext::uniform1iv(const WebGLUniformLocation* location, Int void WebGLRenderingContext::uniform1iv(const WebGLUniformLocation* location, int* v, int size, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2240,10 +2483,8 @@ void WebGLRenderingContext::uniform1iv(const WebGLUniformLocation* location, int void WebGLRenderingContext::uniform2f(const WebGLUniformLocation* location, float x, float y, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2254,13 +2495,11 @@ void WebGLRenderingContext::uniform2f(const WebGLUniformLocation* location, floa cleanupAfterGraphicsCall(false); } -void WebGLRenderingContext::uniform2fv(const WebGLUniformLocation* location, FloatArray* v, ExceptionCode& ec) +void WebGLRenderingContext::uniform2fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2279,10 +2518,8 @@ void WebGLRenderingContext::uniform2fv(const WebGLUniformLocation* location, Flo void WebGLRenderingContext::uniform2fv(const WebGLUniformLocation* location, float* v, int size, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2301,10 +2538,8 @@ void WebGLRenderingContext::uniform2fv(const WebGLUniformLocation* location, flo void WebGLRenderingContext::uniform2i(const WebGLUniformLocation* location, int x, int y, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2318,10 +2553,8 @@ void WebGLRenderingContext::uniform2i(const WebGLUniformLocation* location, int void WebGLRenderingContext::uniform2iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2340,10 +2573,8 @@ void WebGLRenderingContext::uniform2iv(const WebGLUniformLocation* location, Int void WebGLRenderingContext::uniform2iv(const WebGLUniformLocation* location, int* v, int size, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2362,10 +2593,8 @@ void WebGLRenderingContext::uniform2iv(const WebGLUniformLocation* location, int void WebGLRenderingContext::uniform3f(const WebGLUniformLocation* location, float x, float y, float z, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2376,13 +2605,11 @@ void WebGLRenderingContext::uniform3f(const WebGLUniformLocation* location, floa cleanupAfterGraphicsCall(false); } -void WebGLRenderingContext::uniform3fv(const WebGLUniformLocation* location, FloatArray* v, ExceptionCode& ec) +void WebGLRenderingContext::uniform3fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2401,10 +2628,8 @@ void WebGLRenderingContext::uniform3fv(const WebGLUniformLocation* location, Flo void WebGLRenderingContext::uniform3fv(const WebGLUniformLocation* location, float* v, int size, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2423,10 +2648,8 @@ void WebGLRenderingContext::uniform3fv(const WebGLUniformLocation* location, flo void WebGLRenderingContext::uniform3i(const WebGLUniformLocation* location, int x, int y, int z, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2440,10 +2663,8 @@ void WebGLRenderingContext::uniform3i(const WebGLUniformLocation* location, int void WebGLRenderingContext::uniform3iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2462,10 +2683,8 @@ void WebGLRenderingContext::uniform3iv(const WebGLUniformLocation* location, Int void WebGLRenderingContext::uniform3iv(const WebGLUniformLocation* location, int* v, int size, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2484,10 +2703,8 @@ void WebGLRenderingContext::uniform3iv(const WebGLUniformLocation* location, int void WebGLRenderingContext::uniform4f(const WebGLUniformLocation* location, float x, float y, float z, float w, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2498,13 +2715,11 @@ void WebGLRenderingContext::uniform4f(const WebGLUniformLocation* location, floa cleanupAfterGraphicsCall(false); } -void WebGLRenderingContext::uniform4fv(const WebGLUniformLocation* location, FloatArray* v, ExceptionCode& ec) +void WebGLRenderingContext::uniform4fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2523,10 +2738,8 @@ void WebGLRenderingContext::uniform4fv(const WebGLUniformLocation* location, Flo void WebGLRenderingContext::uniform4fv(const WebGLUniformLocation* location, float* v, int size, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2545,10 +2758,8 @@ void WebGLRenderingContext::uniform4fv(const WebGLUniformLocation* location, flo void WebGLRenderingContext::uniform4i(const WebGLUniformLocation* location, int x, int y, int z, int w, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2562,10 +2773,8 @@ void WebGLRenderingContext::uniform4i(const WebGLUniformLocation* location, int void WebGLRenderingContext::uniform4iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2584,10 +2793,8 @@ void WebGLRenderingContext::uniform4iv(const WebGLUniformLocation* location, Int void WebGLRenderingContext::uniform4iv(const WebGLUniformLocation* location, int* v, int size, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2603,13 +2810,11 @@ void WebGLRenderingContext::uniform4iv(const WebGLUniformLocation* location, int cleanupAfterGraphicsCall(false); } -void WebGLRenderingContext::uniformMatrix2fv(const WebGLUniformLocation* location, bool transpose, FloatArray* v, ExceptionCode& ec) +void WebGLRenderingContext::uniformMatrix2fv(const WebGLUniformLocation* location, bool transpose, Float32Array* v, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2628,10 +2833,8 @@ void WebGLRenderingContext::uniformMatrix2fv(const WebGLUniformLocation* locatio void WebGLRenderingContext::uniformMatrix2fv(const WebGLUniformLocation* location, bool transpose, float* v, int size, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2647,13 +2850,11 @@ void WebGLRenderingContext::uniformMatrix2fv(const WebGLUniformLocation* locatio cleanupAfterGraphicsCall(false); } -void WebGLRenderingContext::uniformMatrix3fv(const WebGLUniformLocation* location, bool transpose, FloatArray* v, ExceptionCode& ec) +void WebGLRenderingContext::uniformMatrix3fv(const WebGLUniformLocation* location, bool transpose, Float32Array* v, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2672,10 +2873,8 @@ void WebGLRenderingContext::uniformMatrix3fv(const WebGLUniformLocation* locatio void WebGLRenderingContext::uniformMatrix3fv(const WebGLUniformLocation* location, bool transpose, float* v, int size, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2691,13 +2890,11 @@ void WebGLRenderingContext::uniformMatrix3fv(const WebGLUniformLocation* locatio cleanupAfterGraphicsCall(false); } -void WebGLRenderingContext::uniformMatrix4fv(const WebGLUniformLocation* location, bool transpose, FloatArray* v, ExceptionCode& ec) +void WebGLRenderingContext::uniformMatrix4fv(const WebGLUniformLocation* location, bool transpose, Float32Array* v, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2716,10 +2913,8 @@ void WebGLRenderingContext::uniformMatrix4fv(const WebGLUniformLocation* locatio void WebGLRenderingContext::uniformMatrix4fv(const WebGLUniformLocation* location, bool transpose, float* v, int size, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (!location) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + if (!location) return; - } if (location->program() != m_currentProgram) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -2766,7 +2961,7 @@ void WebGLRenderingContext::vertexAttrib1f(unsigned long indx, float v0) cleanupAfterGraphicsCall(false); } -void WebGLRenderingContext::vertexAttrib1fv(unsigned long indx, FloatArray* v) +void WebGLRenderingContext::vertexAttrib1fv(unsigned long indx, Float32Array* v) { // FIXME: Need to make sure array is big enough for attribute being set m_context->vertexAttrib1fv(indx, v->data()); @@ -2788,7 +2983,7 @@ void WebGLRenderingContext::vertexAttrib2f(unsigned long indx, float v0, float v cleanupAfterGraphicsCall(false); } -void WebGLRenderingContext::vertexAttrib2fv(unsigned long indx, FloatArray* v) +void WebGLRenderingContext::vertexAttrib2fv(unsigned long indx, Float32Array* v) { // FIXME: Need to make sure array is big enough for attribute being set m_context->vertexAttrib2fv(indx, v->data()); @@ -2810,7 +3005,7 @@ void WebGLRenderingContext::vertexAttrib3f(unsigned long indx, float v0, float v cleanupAfterGraphicsCall(false); } -void WebGLRenderingContext::vertexAttrib3fv(unsigned long indx, FloatArray* v) +void WebGLRenderingContext::vertexAttrib3fv(unsigned long indx, Float32Array* v) { // FIXME: Need to make sure array is big enough for attribute being set m_context->vertexAttrib3fv(indx, v->data()); @@ -2832,7 +3027,7 @@ void WebGLRenderingContext::vertexAttrib4f(unsigned long indx, float v0, float v cleanupAfterGraphicsCall(false); } -void WebGLRenderingContext::vertexAttrib4fv(unsigned long indx, FloatArray* v) +void WebGLRenderingContext::vertexAttrib4fv(unsigned long indx, Float32Array* v) { // FIXME: Need to make sure array is big enough for attribute being set m_context->vertexAttrib4fv(indx, v->data()); @@ -2872,7 +3067,8 @@ void WebGLRenderingContext::vertexAttribPointer(unsigned long indx, long size, u validatedStride = stride; } - + + m_vertexAttribState[indx].bufferBinding = m_boundArrayBuffer; // Avoid off-by-one errors in numElements computation. // For the last element, we will only touch the data for the // element and nothing beyond it. @@ -2995,7 +3191,7 @@ WebGLGetInfo WebGLRenderingContext::getWebGLFloatArrayParameter(unsigned long pn default: notImplemented(); } - return WebGLGetInfo(FloatArray::create(value, length)); + return WebGLGetInfo(Float32Array::create(value, length)); } WebGLGetInfo WebGLRenderingContext::getWebGLIntArrayParameter(unsigned long pname) @@ -3042,8 +3238,7 @@ void WebGLRenderingContext::handleNPOTTextures(bool prepareToDraw) if (isGLES2Compliant()) return; bool resetActiveUnit = false; - // FIXME: active texture unit limits should be queries instead of 32. - for (unsigned long ii = 0; ii < 32; ++ii) { + for (unsigned ii = 0; ii < m_textureUnits.size(); ++ii) { if (m_textureUnits[ii].m_texture2DBinding && m_textureUnits[ii].m_texture2DBinding->needToUseBlackTexture() || m_textureUnits[ii].m_textureCubeMapBinding && m_textureUnits[ii].m_textureCubeMapBinding->needToUseBlackTexture()) { if (ii != m_activeTextureUnit) { @@ -3097,6 +3292,150 @@ void WebGLRenderingContext::createFallbackBlackTextures1x1() m_context->bindTexture(GraphicsContext3D::TEXTURE_CUBE_MAP, 0); } +bool WebGLRenderingContext::isTexInternalformatColorBufferCombinationValid(unsigned long texInternalformat, + unsigned long colorBufferFormat) +{ + switch (colorBufferFormat) { + case GraphicsContext3D::ALPHA: + if (texInternalformat == GraphicsContext3D::ALPHA) + return true; + break; + case GraphicsContext3D::RGB: + if (texInternalformat == GraphicsContext3D::LUMINANCE + || texInternalformat == GraphicsContext3D::RGB) + return true; + break; + case GraphicsContext3D::RGBA: + return true; + } + return false; +} + +WebGLTexture* WebGLRenderingContext::getTextureBinding(unsigned long target) +{ + RefPtr<WebGLTexture> tex = 0; + switch (target) { + case GraphicsContext3D::TEXTURE_2D: + tex = m_textureUnits[m_activeTextureUnit].m_texture2DBinding; + break; + case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_X: + case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_X: + case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_Y: + case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_Y: + case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_Z: + case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_Z: + tex = m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding; + break; + } + if (tex && tex->object()) + return tex.get(); + return 0; +} + +bool WebGLRenderingContext::validateTexFuncFormatAndType(unsigned long format, unsigned long type) +{ + switch (format) { + case GraphicsContext3D::ALPHA: + case GraphicsContext3D::LUMINANCE: + case GraphicsContext3D::LUMINANCE_ALPHA: + case GraphicsContext3D::RGB: + case GraphicsContext3D::RGBA: + break; + default: + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return false; + } + + switch (type) { + case GraphicsContext3D::UNSIGNED_BYTE: + case GraphicsContext3D::UNSIGNED_SHORT_5_6_5: + case GraphicsContext3D::UNSIGNED_SHORT_4_4_4_4: + case GraphicsContext3D::UNSIGNED_SHORT_5_5_5_1: + break; + default: + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return false; + } + + return true; +} + +bool WebGLRenderingContext::validateTexFuncParameters(unsigned long target, long level, + unsigned long internalformat, + long width, long height, long border, + unsigned long format, unsigned long type) +{ + if (isGLES2Compliant()) + return true; + + if (width < 0 || height < 0 || level < 0) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return false; + } + + switch (target) { + case GraphicsContext3D::TEXTURE_2D: + if (width > m_maxTextureSize || + height > m_maxTextureSize || + level > log(static_cast<double>(m_maxTextureSize)) / log(2.0)) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return false; + } + break; + case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_X: + case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_X: + case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_Y: + case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_Y: + case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_Z: + case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_Z: + if (width != height || + width > m_maxCubeMapTextureSize || + level > log(static_cast<double>(m_maxCubeMapTextureSize)) / log(2.0)) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return false; + } + break; + default: + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return false; + } + + if (format != internalformat) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return false; + } + + if (border) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return false; + } + + return validateTexFuncFormatAndType(format, type); +} + +bool WebGLRenderingContext::validateDrawMode(unsigned long mode) +{ + switch (mode) { + case GraphicsContext3D::POINTS: + case GraphicsContext3D::LINE_STRIP: + case GraphicsContext3D::LINE_LOOP: + case GraphicsContext3D::LINES: + case GraphicsContext3D::TRIANGLE_STRIP: + case GraphicsContext3D::TRIANGLE_FAN: + case GraphicsContext3D::TRIANGLES: + return true; + default: + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return false; + } +} + +void WebGLRenderingContext::printWarningToConsole(const String& message) +{ + canvas()->document()->frame()->domWindow()->console()->addMessage(HTMLMessageSource, LogMessageType, WarningMessageLevel, + message, 0, canvas()->document()->url().string()); +} + } // namespace WebCore #endif // ENABLE(3D_CANVAS) diff --git a/WebCore/html/canvas/WebGLRenderingContext.h b/WebCore/html/canvas/WebGLRenderingContext.h index d447529..552efa9 100644 --- a/WebCore/html/canvas/WebGLRenderingContext.h +++ b/WebCore/html/canvas/WebGLRenderingContext.h @@ -28,7 +28,7 @@ #include "CanvasRenderingContext.h" #include "ExceptionCode.h" -#include "FloatArray.h" +#include "Float32Array.h" #include "WebGLGetInfo.h" #include "Int32Array.h" #include "Uint8Array.h" @@ -117,7 +117,7 @@ class WebKitCSSMatrix; void disable(unsigned long cap); void disableVertexAttribArray(unsigned long index, ExceptionCode&); void drawArrays(unsigned long mode, long first, long count, ExceptionCode&); - void drawElements(unsigned long mode, unsigned long count, unsigned long type, long offset, ExceptionCode&); + void drawElements(unsigned long mode, long count, unsigned long type, long offset, ExceptionCode&); void enable(unsigned long cap); void enableVertexAttribArray(unsigned long index, ExceptionCode&); @@ -181,9 +181,7 @@ class WebKitCSSMatrix; void linkProgram(WebGLProgram*, ExceptionCode&); void pixelStorei(unsigned long pname, long param); void polygonOffset(double factor, double units); - - PassRefPtr<ArrayBufferView> readPixels(long x, long y, unsigned long width, unsigned long height, unsigned long format, unsigned long type); - + void readPixels(long x, long y, long width, long height, unsigned long format, unsigned long type, ArrayBufferView* pixels); void releaseShaderCompiler(); void renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height); void sampleCoverage(double value, bool invert); @@ -199,6 +197,15 @@ class WebKitCSSMatrix; void texImage2D(unsigned target, unsigned level, unsigned internalformat, unsigned width, unsigned height, unsigned border, unsigned format, unsigned type, ArrayBufferView* pixels, ExceptionCode&); + void texImage2D(unsigned target, unsigned level, unsigned internalformat, + unsigned format, unsigned type, ImageData* pixels, ExceptionCode&); + void texImage2D(unsigned target, unsigned level, unsigned internalformat, + unsigned format, unsigned type, HTMLImageElement* image, ExceptionCode&); + void texImage2D(unsigned target, unsigned level, unsigned internalformat, + unsigned format, unsigned type, HTMLCanvasElement* canvas, ExceptionCode&); + void texImage2D(unsigned target, unsigned level, unsigned internalformat, + unsigned format, unsigned type, HTMLVideoElement* video, ExceptionCode&); + // Obsolete entry points -- to be removed shortly. (FIXME) void texImage2D(unsigned target, unsigned level, ImageData* pixels, ExceptionCode&); void texImage2D(unsigned target, unsigned level, ImageData* pixels, bool flipY, ExceptionCode&); void texImage2D(unsigned target, unsigned level, ImageData* pixels, bool flipY, bool premultiplyAlpha, ExceptionCode&); @@ -218,6 +225,15 @@ class WebKitCSSMatrix; void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, unsigned width, unsigned height, unsigned format, unsigned type, ArrayBufferView* pixels, ExceptionCode&); + void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + unsigned format, unsigned type, ImageData* pixels, ExceptionCode&); + void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + unsigned format, unsigned type, HTMLImageElement* image, ExceptionCode&); + void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + unsigned format, unsigned type, HTMLCanvasElement* canvas, ExceptionCode&); + void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + unsigned format, unsigned type, HTMLVideoElement* video, ExceptionCode&); + // Obsolete entry points -- to be removed shortly. (FIXME) void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, ImageData* pixels, ExceptionCode&); void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, ImageData* pixels, bool flipY, ExceptionCode&); void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, ImageData* pixels, bool flipY, bool premultiplyAlpha, ExceptionCode&); @@ -232,50 +248,50 @@ class WebKitCSSMatrix; void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLVideoElement* video, bool flipY, bool premultiplyAlpha, ExceptionCode&); void uniform1f(const WebGLUniformLocation* location, float x, ExceptionCode&); - void uniform1fv(const WebGLUniformLocation* location, FloatArray* v, ExceptionCode&); + void uniform1fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode&); void uniform1fv(const WebGLUniformLocation* location, float* v, int size, ExceptionCode&); void uniform1i(const WebGLUniformLocation* location, int x, ExceptionCode&); void uniform1iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionCode&); void uniform1iv(const WebGLUniformLocation* location, int* v, int size, ExceptionCode&); void uniform2f(const WebGLUniformLocation* location, float x, float y, ExceptionCode&); - void uniform2fv(const WebGLUniformLocation* location, FloatArray* v, ExceptionCode&); + void uniform2fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode&); void uniform2fv(const WebGLUniformLocation* location, float* v, int size, ExceptionCode&); void uniform2i(const WebGLUniformLocation* location, int x, int y, ExceptionCode&); void uniform2iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionCode&); void uniform2iv(const WebGLUniformLocation* location, int* v, int size, ExceptionCode&); void uniform3f(const WebGLUniformLocation* location, float x, float y, float z, ExceptionCode&); - void uniform3fv(const WebGLUniformLocation* location, FloatArray* v, ExceptionCode&); + void uniform3fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode&); void uniform3fv(const WebGLUniformLocation* location, float* v, int size, ExceptionCode&); void uniform3i(const WebGLUniformLocation* location, int x, int y, int z, ExceptionCode&); void uniform3iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionCode&); void uniform3iv(const WebGLUniformLocation* location, int* v, int size, ExceptionCode&); void uniform4f(const WebGLUniformLocation* location, float x, float y, float z, float w, ExceptionCode&); - void uniform4fv(const WebGLUniformLocation* location, FloatArray* v, ExceptionCode&); + void uniform4fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode&); void uniform4fv(const WebGLUniformLocation* location, float* v, int size, ExceptionCode&); void uniform4i(const WebGLUniformLocation* location, int x, int y, int z, int w, ExceptionCode&); void uniform4iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionCode&); void uniform4iv(const WebGLUniformLocation* location, int* v, int size, ExceptionCode&); - void uniformMatrix2fv(const WebGLUniformLocation* location, bool transpose, FloatArray* value, ExceptionCode&); + void uniformMatrix2fv(const WebGLUniformLocation* location, bool transpose, Float32Array* value, ExceptionCode&); void uniformMatrix2fv(const WebGLUniformLocation* location, bool transpose, float* value, int size, ExceptionCode&); - void uniformMatrix3fv(const WebGLUniformLocation* location, bool transpose, FloatArray* value, ExceptionCode&); + void uniformMatrix3fv(const WebGLUniformLocation* location, bool transpose, Float32Array* value, ExceptionCode&); void uniformMatrix3fv(const WebGLUniformLocation* location, bool transpose, float* value, int size, ExceptionCode&); - void uniformMatrix4fv(const WebGLUniformLocation* location, bool transpose, FloatArray* value, ExceptionCode&); + void uniformMatrix4fv(const WebGLUniformLocation* location, bool transpose, Float32Array* value, ExceptionCode&); void uniformMatrix4fv(const WebGLUniformLocation* location, bool transpose, float* value, int size, ExceptionCode&); void useProgram(WebGLProgram*, ExceptionCode&); void validateProgram(WebGLProgram*, ExceptionCode&); void vertexAttrib1f(unsigned long indx, float x); - void vertexAttrib1fv(unsigned long indx, FloatArray* values); + void vertexAttrib1fv(unsigned long indx, Float32Array* values); void vertexAttrib1fv(unsigned long indx, float* values, int size); void vertexAttrib2f(unsigned long indx, float x, float y); - void vertexAttrib2fv(unsigned long indx, FloatArray* values); + void vertexAttrib2fv(unsigned long indx, Float32Array* values); void vertexAttrib2fv(unsigned long indx, float* values, int size); void vertexAttrib3f(unsigned long indx, float x, float y, float z); - void vertexAttrib3fv(unsigned long indx, FloatArray* values); + void vertexAttrib3fv(unsigned long indx, Float32Array* values); void vertexAttrib3fv(unsigned long indx, float* values, int size); void vertexAttrib4f(unsigned long indx, float x, float y, float z, float w); - void vertexAttrib4fv(unsigned long indx, FloatArray* values); + void vertexAttrib4fv(unsigned long indx, Float32Array* values); void vertexAttrib4fv(unsigned long indx, float* values, int size); void vertexAttribPointer(unsigned long indx, long size, unsigned long type, bool normalized, unsigned long stride, unsigned long offset, ExceptionCode&); @@ -340,6 +356,7 @@ class WebKitCSSMatrix; VertexAttribState() : enabled(false), numElements(0) { } bool enabled; long numElements; + RefPtr<WebGLBuffer> bufferBinding; }; Vector<VertexAttribState> m_vertexAttribState; @@ -353,16 +370,21 @@ class WebKitCSSMatrix; RefPtr<WebGLTexture> m_texture2DBinding; RefPtr<WebGLTexture> m_textureCubeMapBinding; }; - TextureUnitState m_textureUnits[32]; + Vector<TextureUnitState> m_textureUnits; unsigned long m_activeTextureUnit; RefPtr<WebGLTexture> m_blackTexture2D; RefPtr<WebGLTexture> m_blackTextureCubeMap; + long m_maxTextureSize; + long m_maxCubeMapTextureSize; + int m_packAlignment; int m_unpackAlignment; unsigned long m_implementationColorReadFormat; unsigned long m_implementationColorReadType; + bool m_unpackFlipY; + bool m_unpackPremultiplyAlpha; // Helpers for getParameter and others WebGLGetInfo getBooleanParameter(unsigned long pname); @@ -377,18 +399,50 @@ class WebKitCSSMatrix; void texImage2DBase(unsigned target, unsigned level, unsigned internalformat, unsigned width, unsigned height, unsigned border, unsigned format, unsigned type, void* pixels, ExceptionCode&); - void texImage2D(unsigned target, unsigned level, Image* image, - bool flipY, bool premultiplyAlpha, ExceptionCode&); + void texImage2DImpl(unsigned target, unsigned level, unsigned internalformat, + unsigned format, unsigned type, Image* image, + bool flipY, bool premultiplyAlpha, ExceptionCode&); void texSubImage2DBase(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, unsigned width, unsigned height, unsigned format, unsigned type, void* pixels, ExceptionCode&); - void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - Image* image, bool flipY, bool premultiplyAlpha, ExceptionCode&); + void texSubImage2DImpl(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + unsigned format, unsigned type, + Image* image, bool flipY, bool premultiplyAlpha, ExceptionCode&); void handleNPOTTextures(bool prepareToDraw); void createFallbackBlackTextures1x1(); + // Helper function for copyTex{Sub}Image, check whether the internalformat + // and the color buffer format of the current bound framebuffer combination + // is valid. + bool isTexInternalformatColorBufferCombinationValid(unsigned long texInternalformat, + unsigned long colorBufferFormat); + + // Helper function to get the current bound texture. + WebGLTexture* getTextureBinding(unsigned long target); + + // Helper function to check input format/type for functions {copy}Tex{Sub}Image. + // Generate GL error and return false if parameters are invalid. + bool validateTexFuncFormatAndType(unsigned long format, unsigned long type); + + // Helper function to check input parameters for functions {copy}Tex{Sub}Image. + // Generate GL error and return false if parameters are invalid. + bool validateTexFuncParameters(unsigned long target, long level, + unsigned long internalformat, + long width, long height, long border, + unsigned long format, unsigned long type); + + // Helper function to validate mode for draw{Arrays/Elements}. + bool validateDrawMode(unsigned long); + + // Helper function for texParameterf and texParameteri. + void texParameter(unsigned long target, unsigned long pname, float parami, int paramf, bool isFloat); + + // Helper function to print warnings to console. Currently + // used only to warn about use of obsolete functions. + void printWarningToConsole(const String& message); + friend class WebGLStateRestorer; }; diff --git a/WebCore/html/canvas/WebGLRenderingContext.idl b/WebCore/html/canvas/WebGLRenderingContext.idl index 029cae3..b3793f5 100644 --- a/WebCore/html/canvas/WebGLRenderingContext.idl +++ b/WebCore/html/canvas/WebGLRenderingContext.idl @@ -459,6 +459,10 @@ module html { const unsigned int INVALID_FRAMEBUFFER_OPERATION = 0x0506; + /* WebGL-specific enums */ + const unsigned int UNPACK_FLIP_Y_WEBGL = 0x9240; + const unsigned int UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241; + long sizeInBytes(in unsigned long type) raises(DOMException); void activeTexture(in unsigned long texture) raises(DOMException); @@ -474,15 +478,9 @@ module html { void blendFunc(in unsigned long sfactor, in unsigned long dfactor); void blendFuncSeparate(in unsigned long srcRGB, in unsigned long dstRGB, in unsigned long srcAlpha, in unsigned long dstAlpha); -#if defined(V8_BINDING) && V8_BINDING void bufferData(in unsigned long target, in ArrayBufferView data, in unsigned long usage) raises (DOMException); void bufferData(in unsigned long target, in long size, in unsigned long usage) raises (DOMException); void bufferSubData(in unsigned long target, in long offset, in ArrayBufferView data) raises (DOMException); -#else - // FIXME: Unfork once JSC supports overload generation too. - [Custom] void bufferData() raises(DOMException); - [Custom] void bufferSubData() raises(DOMException); -#endif unsigned long checkFramebufferStatus(in unsigned long target); void clear(in unsigned long mask); @@ -521,8 +519,8 @@ module html { void detachShader(in WebGLProgram program, in WebGLShader shader) raises(DOMException); void disable(in unsigned long cap); void disableVertexAttribArray(in unsigned long index) raises(DOMException); - void drawArrays(in unsigned long mode, in long first, in unsigned long count) raises(DOMException); - void drawElements(in unsigned long mode, in long count, in unsigned long type, in unsigned long offset) raises(DOMException); + void drawArrays(in unsigned long mode, in long first, in long count) raises(DOMException); + void drawElements(in unsigned long mode, in long count, in unsigned long type, in long offset) raises(DOMException); void enable(in unsigned long cap); void enableVertexAttribArray(in unsigned long index) raises(DOMException); @@ -595,7 +593,7 @@ module html { void pixelStorei(in unsigned long pname, in long param); void polygonOffset(in double factor, in double units); - ArrayBufferView readPixels(in long x, in long y, in unsigned long width, in unsigned long height, in unsigned long format, in unsigned long type); + void readPixels(in long x, in long y, in long width, in long height, in unsigned long format, in unsigned long type, in ArrayBufferView pixels); void releaseShaderCompiler(); void renderbufferStorage(in unsigned long target, in unsigned long internalformat, in unsigned long width, in unsigned long height); @@ -613,9 +611,17 @@ module html { void texParameteri(in unsigned long target, in unsigned long pname, in long param); // Supported forms: -#if defined(V8_BINDING) && V8_BINDING void texImage2D(in unsigned long target, in long level, in unsigned long internalformat, in long width, in long height, in long border, in unsigned long format, in unsigned long type, in ArrayBufferView pixels) raises (DOMException); + void texImage2D(in unsigned long target, in long level, in unsigned long internalformat, + in unsigned long format, in unsigned long type, in ImageData pixels) raises (DOMException); + void texImage2D(in unsigned long target, in long level, in unsigned long internalformat, + in unsigned long format, in unsigned long type, in HTMLImageElement image) raises (DOMException); + void texImage2D(in unsigned long target, in long level, in unsigned long internalformat, + in unsigned long format, in unsigned long type, in HTMLCanvasElement canvas) raises (DOMException); + void texImage2D(in unsigned long target, in long level, in unsigned long internalformat, + in unsigned long format, in unsigned long type, in HTMLVideoElement video) raises (DOMException); + // Obsolete entry points -- to be removed shortly. (FIXME) void texImage2D(in unsigned long target, in long level, in ImageData pixels, in [Optional] boolean flipY, in [Optional] boolean premultiplyAlpha) raises (DOMException); void texImage2D(in unsigned long target, in long level, in HTMLImageElement image, @@ -629,6 +635,15 @@ module html { in long width, in long height, in unsigned long format, in unsigned long type, in ArrayBufferView pixels) raises (DOMException); void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, + in unsigned long format, in unsigned long type, in ImageData pixels) raises (DOMException); + void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, + in unsigned long format, in unsigned long type, in HTMLImageElement image) raises (DOMException); + void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, + in unsigned long format, in unsigned long type, in HTMLCanvasElement canvas) raises (DOMException); + void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, + in unsigned long format, in unsigned long type, in HTMLVideoElement video) raises (DOMException); + // Obsolete entry points -- to be removed shortly. (FIXME) + void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, in ImageData pixels, in [Optional] boolean flipY, in [Optional] boolean premultiplyAlpha) raises (DOMException); void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, in HTMLImageElement image, in [Optional] boolean flipY, in [Optional] boolean premultiplyAlpha) raises (DOMException); @@ -636,43 +651,39 @@ module html { in HTMLCanvasElement canvas, in [Optional] boolean flipY, in [Optional] boolean premultiplyAlpha) raises (DOMException); void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, in HTMLVideoElement video, in [Optional] boolean flipY, in [Optional] boolean premultiplyAlpha) raises (DOMException); -#else - // FIXME: Unfork once JSC supports overload generation too. - [Custom] void texImage2D(); - [Custom] void texSubImage2D(); -#endif + void uniform1f(in WebGLUniformLocation location, in float x) raises(DOMException); - [Custom] void uniform1fv(in WebGLUniformLocation location, in FloatArray v) raises(DOMException); + [Custom] void uniform1fv(in WebGLUniformLocation location, in Float32Array v) raises(DOMException); void uniform1i(in WebGLUniformLocation location, in long x) raises(DOMException); [Custom] void uniform1iv(in WebGLUniformLocation location, in Int32Array v) raises(DOMException); void uniform2f(in WebGLUniformLocation location, in float x, in float y) raises(DOMException); - [Custom] void uniform2fv(in WebGLUniformLocation location, in FloatArray v) raises(DOMException); + [Custom] void uniform2fv(in WebGLUniformLocation location, in Float32Array v) raises(DOMException); void uniform2i(in WebGLUniformLocation location, in long x, in long y) raises(DOMException); [Custom] void uniform2iv(in WebGLUniformLocation location, in Int32Array v) raises(DOMException); void uniform3f(in WebGLUniformLocation location, in float x, in float y, in float z) raises(DOMException); - [Custom] void uniform3fv(in WebGLUniformLocation location, in FloatArray v) raises(DOMException); + [Custom] void uniform3fv(in WebGLUniformLocation location, in Float32Array v) raises(DOMException); void uniform3i(in WebGLUniformLocation location, in long x, in long y, in long z) raises(DOMException); [Custom] void uniform3iv(in WebGLUniformLocation location, in Int32Array v) raises(DOMException); void uniform4f(in WebGLUniformLocation location, in float x, in float y, in float z, in float w) raises(DOMException); - [Custom] void uniform4fv(in WebGLUniformLocation location, in FloatArray v) raises(DOMException); + [Custom] void uniform4fv(in WebGLUniformLocation location, in Float32Array v) raises(DOMException); void uniform4i(in WebGLUniformLocation location, in long x, in long y, in long z, in long w) raises(DOMException); [Custom] void uniform4iv(in WebGLUniformLocation location, in Int32Array v) raises(DOMException); - [Custom] void uniformMatrix2fv(in WebGLUniformLocation location, in boolean transpose, in FloatArray array) raises(DOMException); - [Custom] void uniformMatrix3fv(in WebGLUniformLocation location, in boolean transpose, in FloatArray array) raises(DOMException); - [Custom] void uniformMatrix4fv(in WebGLUniformLocation location, in boolean transpose, in FloatArray array) raises(DOMException); + [Custom] void uniformMatrix2fv(in WebGLUniformLocation location, in boolean transpose, in Float32Array array) raises(DOMException); + [Custom] void uniformMatrix3fv(in WebGLUniformLocation location, in boolean transpose, in Float32Array array) raises(DOMException); + [Custom] void uniformMatrix4fv(in WebGLUniformLocation location, in boolean transpose, in Float32Array array) raises(DOMException); void useProgram(in WebGLProgram program) raises(DOMException); void validateProgram(in WebGLProgram program) raises(DOMException); void vertexAttrib1f(in unsigned long indx, in float x); - [Custom] void vertexAttrib1fv(in unsigned long indx, in FloatArray values); + [Custom] void vertexAttrib1fv(in unsigned long indx, in Float32Array values); void vertexAttrib2f(in unsigned long indx, in float x, in float y); - [Custom] void vertexAttrib2fv(in unsigned long indx, in FloatArray values); + [Custom] void vertexAttrib2fv(in unsigned long indx, in Float32Array values); void vertexAttrib3f(in unsigned long indx, in float x, in float y, in float z); - [Custom] void vertexAttrib3fv(in unsigned long indx, in FloatArray values); + [Custom] void vertexAttrib3fv(in unsigned long indx, in Float32Array values); void vertexAttrib4f(in unsigned long indx, in float x, in float y, in float z, in float w); - [Custom] void vertexAttrib4fv(in unsigned long indx, in FloatArray values); + [Custom] void vertexAttrib4fv(in unsigned long indx, in Float32Array values); void vertexAttribPointer(in unsigned long indx, in long size, in unsigned long type, in boolean normalized, in long stride, in unsigned long offset) raises(DOMException); diff --git a/WebCore/html/canvas/WebGLTexture.cpp b/WebCore/html/canvas/WebGLTexture.cpp index 4e4096b..d24405a 100644 --- a/WebCore/html/canvas/WebGLTexture.cpp +++ b/WebCore/html/canvas/WebGLTexture.cpp @@ -45,6 +45,7 @@ WebGLTexture::WebGLTexture(WebGLRenderingContext* ctx) , m_magFilter(GraphicsContext3D::LINEAR) , m_wrapS(GraphicsContext3D::REPEAT) , m_wrapT(GraphicsContext3D::REPEAT) + , m_internalformat(0) , m_isNPOT(false) , m_needToUseBlackTexture(false) { diff --git a/WebCore/html/canvas/WebGLTexture.h b/WebCore/html/canvas/WebGLTexture.h index 864533e..889e902 100644 --- a/WebCore/html/canvas/WebGLTexture.h +++ b/WebCore/html/canvas/WebGLTexture.h @@ -52,6 +52,9 @@ namespace WebCore { void setParameterf(unsigned long pname, float param); void setSize(unsigned long target, unsigned width, unsigned height); + void setInternalformat(unsigned long internalformat) { m_internalformat = internalformat; } + unsigned long getInternalformat() const { return m_internalformat; } + static bool isNPOT(unsigned, unsigned); bool isNPOT() const { return m_isNPOT; } @@ -77,6 +80,8 @@ namespace WebCore { int m_wrapS; int m_wrapT; + unsigned long m_internalformat; + unsigned m_width[6]; unsigned m_height[6]; diff --git a/WebCore/inspector/InjectedScriptHost.cpp b/WebCore/inspector/InjectedScriptHost.cpp index c58073d..4c3c7ae 100644 --- a/WebCore/inspector/InjectedScriptHost.cpp +++ b/WebCore/inspector/InjectedScriptHost.cpp @@ -110,12 +110,6 @@ long InjectedScriptHost::pushNodePathToFrontend(Node* node, bool withChildren, b return id; } -void InjectedScriptHost::addNodesToSearchResult(const String& nodeIds) -{ - if (InspectorFrontend* frontend = inspectorFrontend()) - frontend->addNodesToSearchResult(nodeIds); -} - long InjectedScriptHost::pushNodeByPathToFrontend(const String& path) { InspectorDOMAgent* domAgent = inspectorDOMAgent(); diff --git a/WebCore/inspector/InjectedScriptHost.h b/WebCore/inspector/InjectedScriptHost.h index beffc9d..66cf41e 100644 --- a/WebCore/inspector/InjectedScriptHost.h +++ b/WebCore/inspector/InjectedScriptHost.h @@ -69,7 +69,6 @@ public: Node* nodeForId(long nodeId); long pushNodePathToFrontend(Node* node, bool withChildren, bool selectInUI); - void addNodesToSearchResult(const String& nodeIds); long pushNodeByPathToFrontend(const String& path); #if ENABLE(DATABASE) diff --git a/WebCore/inspector/InjectedScriptHost.idl b/WebCore/inspector/InjectedScriptHost.idl index 8b24157..5a4ce19 100644 --- a/WebCore/inspector/InjectedScriptHost.idl +++ b/WebCore/inspector/InjectedScriptHost.idl @@ -38,7 +38,6 @@ module core { [Custom] DOMObject nodeForId(in long nodeId); [Custom] int pushNodePathToFrontend(in DOMObject node, in boolean withChildren, in boolean selectInUI); - void addNodesToSearchResult(in DOMString nodeIds); long pushNodeByPathToFrontend(in DOMString path); #if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER diff --git a/WebCore/inspector/InspectorBackend.cpp b/WebCore/inspector/InspectorBackend.cpp index 36f41b8..1eedda1 100644 --- a/WebCore/inspector/InspectorBackend.cpp +++ b/WebCore/inspector/InspectorBackend.cpp @@ -79,12 +79,18 @@ InspectorBackend::~InspectorBackend() { } -void InspectorBackend::saveFrontendSettings(const String& settings) +void InspectorBackend::saveApplicationSettings(const String& settings) { if (m_inspectorController) m_inspectorController->setSetting(InspectorController::frontendSettingsSettingName(), settings); } +void InspectorBackend::saveSessionSettings(const String& settings) +{ + if (m_inspectorController) + m_inspectorController->setSessionSettings(settings); +} + void InspectorBackend::storeLastActivePanel(const String& panelName) { if (m_inspectorController) @@ -215,9 +221,17 @@ void InspectorBackend::setPauseOnExceptionsState(long pauseState) frontend->updatePauseOnExceptionsState(ScriptDebugServer::shared().pauseOnExceptionsState()); } -#endif +void InspectorBackend::editScriptSource(long callId, const String& sourceID, const String& newContent) +{ + if (m_inspectorController) + m_inspectorController->editScriptSource(callId, sourceID, newContent); +} -#if ENABLE(JAVASCRIPT_DEBUGGER) +void InspectorBackend::getScriptSource(long callId, const String& sourceID) +{ + if (m_inspectorController) + m_inspectorController->getScriptSource(callId, sourceID); +} void InspectorBackend::enableProfiler(bool always) { @@ -351,6 +365,18 @@ void InspectorBackend::changeTagName(long callId, long nodeId, const AtomicStrin domAgent->changeTagName(callId, nodeId, tagName, expanded); } +void InspectorBackend::performSearch(const String& query, bool runSynchronously) +{ + if (InspectorDOMAgent* domAgent = inspectorDOMAgent()) + domAgent->performSearch(query, runSynchronously); +} + +void InspectorBackend::searchCanceled() +{ + if (InspectorDOMAgent* domAgent = inspectorDOMAgent()) + domAgent->searchCanceled(); +} + void InspectorBackend::getStyles(long callId, long nodeId, bool authorOnly) { if (InspectorDOMAgent* domAgent = inspectorDOMAgent()) diff --git a/WebCore/inspector/InspectorBackend.h b/WebCore/inspector/InspectorBackend.h index 0eb8e4c..61d73b8 100644 --- a/WebCore/inspector/InspectorBackend.h +++ b/WebCore/inspector/InspectorBackend.h @@ -57,7 +57,8 @@ public: InspectorController* inspectorController() { return m_inspectorController; } void disconnectController() { m_inspectorController = 0; } - void saveFrontendSettings(const String&); + void saveApplicationSettings(const String&); + void saveSessionSettings(const String&); void storeLastActivePanel(const String& panelName); @@ -84,12 +85,15 @@ public: void pauseInDebugger(); void resumeDebugger(); - void setPauseOnExceptionsState(long pauseState); - void stepOverStatementInDebugger(); void stepIntoStatementInDebugger(); void stepOutOfFunctionInDebugger(); + void setPauseOnExceptionsState(long pauseState); + + void editScriptSource(long callId, const String& sourceID, const String& newContent); + void getScriptSource(long callId, const String& sourceID); + void enableProfiler(bool always); void disableProfiler(bool always); @@ -116,6 +120,8 @@ public: void copyNode(long nodeId); void removeNode(long callId, long nodeId); void changeTagName(long callId, long nodeId, const AtomicString& tagName, bool expanded); + void performSearch(const String& query, bool runSynchronously); + void searchCanceled(); void getStyles(long callId, long nodeId, bool authOnly); void getAllStyles(long callId); diff --git a/WebCore/inspector/InspectorBackend.idl b/WebCore/inspector/InspectorBackend.idl index e8cfdb9..c0078ee 100644 --- a/WebCore/inspector/InspectorBackend.idl +++ b/WebCore/inspector/InspectorBackend.idl @@ -34,7 +34,8 @@ module core { interface [Conditional=INSPECTOR] InspectorBackend { void storeLastActivePanel(in DOMString panelName); - void saveFrontendSettings(in DOMString settings); + void saveApplicationSettings(in DOMString settings); + void saveSessionSettings(in DOMString settings); void enableSearchingForNode(); void disableSearchingForNode(); @@ -65,6 +66,9 @@ module core { void setPauseOnExceptionsState(in long pauseOnExceptionsState); + void editScriptSource(in long callId, in DOMString sourceID, in DOMString newContent); + void getScriptSource(in long callId, in DOMString sourceID); + void enableProfiler(in boolean always); void disableProfiler(in boolean always); @@ -91,6 +95,9 @@ module core { void copyNode(in long nodeId); void removeNode(in long callId, in long nodeId); void changeTagName(in long callId, in long nodeId, in DOMString newTagName, in boolean expanded); + void performSearch(in DOMString query, in boolean runSynchronously); + void searchCanceled(); + void highlightDOMNode(in long nodeId); void hideDOMNodeHighlight(); diff --git a/WebCore/inspector/InspectorClient.h b/WebCore/inspector/InspectorClient.h index 841c15e..2ce3a09 100644 --- a/WebCore/inspector/InspectorClient.h +++ b/WebCore/inspector/InspectorClient.h @@ -48,6 +48,8 @@ public: virtual void populateSetting(const String& key, String* value) = 0; virtual void storeSetting(const String& key, const String& value) = 0; + + virtual bool sendMessageToFrontend(const String& message) = 0; }; } // namespace WebCore diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp index f38f8d0..7916cd0 100644 --- a/WebCore/inspector/InspectorController.cpp +++ b/WebCore/inspector/InspectorController.cpp @@ -24,7 +24,7 @@ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" @@ -148,6 +148,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* client) , m_cssStore(new InspectorCSSStore(this)) , m_expiredConsoleMessageCount(0) , m_showAfterVisible(CurrentPanel) + , m_sessionSettings(InspectorObject::create()) , m_groupLevel(0) , m_searchingForNode(false) , m_previousMessage(0) @@ -158,8 +159,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* client) #if ENABLE(JAVASCRIPT_DEBUGGER) , m_debuggerEnabled(false) , m_attachDebuggerWhenShown(false) -#endif -#if ENABLE(JAVASCRIPT_DEBUGGER) + , m_pausedScriptState(0) , m_profilerEnabled(!WTF_USE_JSC) , m_recordingUserInitiatedProfile(false) , m_currentUserInitiatedProfileNumber(-1) @@ -230,6 +230,11 @@ void InspectorController::setSetting(const String& key, const String& value) m_client->storeSetting(key, value); } +void InspectorController::setSessionSettings(const String& settingsJSON) +{ + m_sessionSettings = InspectorValue::readJSON(settingsJSON); +} + void InspectorController::inspect(Node* node) { if (!enabled()) @@ -426,22 +431,27 @@ void InspectorController::setSearchingForNode(bool enabled) } } -void InspectorController::setFrontend(PassOwnPtr<InspectorFrontend> frontend) +void InspectorController::connectFrontend(const ScriptObject& webInspector) { - ASSERT(frontend); m_openingFrontend = false; - m_frontend = frontend; + m_frontend = new InspectorFrontend(webInspector, m_client); releaseDOMAgent(); m_domAgent = InspectorDOMAgent::create(m_cssStore.get(), m_frontend.get()); if (m_timelineAgent) m_timelineAgent->resetFrontendProxyObject(m_frontend.get()); -#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) - String debuggerEnabled = setting(debuggerEnabledSettingName); - if (debuggerEnabled == "true") - enableDebugger(); - String profilerEnabled = setting(profilerEnabledSettingName); - if (profilerEnabled == "true") - enableProfiler(); +#if ENABLE(JAVASCRIPT_DEBUGGER) + if (ScriptDebugServer::shared().isDebuggerAlwaysEnabled()) { + // FIXME (40364): This will force pushing script sources to frontend even if script + // panel is inactive. + enableDebuggerFromFrontend(false); + } else { + String debuggerEnabled = setting(debuggerEnabledSettingName); + if (debuggerEnabled == "true") + enableDebugger(); + String profilerEnabled = setting(profilerEnabledSettingName); + if (profilerEnabled == "true") + enableProfiler(); + } #endif // Initialize Web Inspector title. @@ -550,7 +560,7 @@ void InspectorController::populateScriptObjects() if (!m_frontend) return; - m_frontend->populateFrontendSettings(setting(frontendSettingsSettingName())); + m_frontend->populateApplicationSettings(setting(frontendSettingsSettingName())); if (m_resourceTrackingEnabled) m_frontend->resourceTrackingWasEnabled(); @@ -597,6 +607,7 @@ void InspectorController::populateScriptObjects() m_frontend->didCreateWorker(*it->second); #endif + m_frontend->populateSessionSettings(m_sessionSettings->toJSONString()); m_frontend->populateInterface(); // Dispatch pending frontend commands @@ -662,6 +673,7 @@ void InspectorController::didCommitLoad(DocumentLoader* loader) m_counts.clear(); #if ENABLE(JAVASCRIPT_DEBUGGER) m_sourceIDToURL.clear(); + m_scriptIDToContent.clear(); #endif #if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) m_profiles.clear(); @@ -673,6 +685,7 @@ void InspectorController::didCommitLoad(DocumentLoader* loader) unbindAllResources(); m_cssStore->reset(); + m_sessionSettings = InspectorObject::create(); if (m_frontend) { m_frontend->reset(); m_domAgent->reset(); @@ -875,6 +888,9 @@ bool InspectorController::isMainResourceLoader(DocumentLoader* loader, const KUR void InspectorController::willSendRequest(unsigned long identifier, const ResourceRequest& request, const ResourceResponse& redirectResponse) { + if (!enabled()) + return; + bool isMainResource = (m_mainResource && m_mainResource->identifier() == identifier); if (m_timelineAgent) m_timelineAgent->willSendResourceRequest(identifier, isMainResource, request); @@ -884,20 +900,24 @@ void InspectorController::willSendRequest(unsigned long identifier, const Resour return; if (!redirectResponse.isNull()) { - resource->markResponseReceivedTime(); - resource->endTiming(); - resource->updateResponse(redirectResponse); - - // We always store last redirect by the original id key. Rest of the redirects are stored within the last one. - unsigned long id = m_inspectedPage->progress()->createUniqueIdentifier(); - RefPtr<InspectorResource> withRedirect = resource->appendRedirect(id, request.url()); - removeResource(resource.get()); - addResource(withRedirect.get()); - if (isMainResource) { - m_mainResource = withRedirect; - withRedirect->markMainResource(); + // Redirect may have empty URL and we'd like to not crash with invalid HashMap entry. + // See http/tests/misc/will-send-request-returns-null-on-redirect.html + if (!request.url().isEmpty()) { + resource->markResponseReceivedTime(); + resource->endTiming(); + resource->updateResponse(redirectResponse); + + // We always store last redirect by the original id key. Rest of the redirects are stored within the last one. + unsigned long id = m_inspectedPage->progress()->createUniqueIdentifier(); + RefPtr<InspectorResource> withRedirect = resource->appendRedirect(id, request.url()); + removeResource(resource.get()); + addResource(withRedirect.get()); + if (isMainResource) { + m_mainResource = withRedirect; + withRedirect->markMainResource(); + } + resource = withRedirect; } - resource = withRedirect; } resource->startTiming(); @@ -909,6 +929,9 @@ void InspectorController::willSendRequest(unsigned long identifier, const Resour void InspectorController::didReceiveResponse(unsigned long identifier, const ResourceResponse& response) { + if (!enabled()) + return; + if (RefPtr<InspectorResource> resource = getTrackedResource(identifier)) { resource->updateResponse(response); resource->markResponseReceivedTime(); @@ -926,6 +949,9 @@ void InspectorController::didReceiveResponse(unsigned long identifier, const Res void InspectorController::didReceiveContentLength(unsigned long identifier, int lengthReceived) { + if (!enabled()) + return; + RefPtr<InspectorResource> resource = getTrackedResource(identifier); if (!resource) return; @@ -938,6 +964,9 @@ void InspectorController::didReceiveContentLength(unsigned long identifier, int void InspectorController::didFinishLoading(unsigned long identifier) { + if (!enabled()) + return; + if (m_timelineAgent) m_timelineAgent->didFinishLoadingResource(identifier, false); @@ -954,6 +983,9 @@ void InspectorController::didFinishLoading(unsigned long identifier) void InspectorController::didFailLoading(unsigned long identifier, const ResourceError& error) { + if (!enabled()) + return; + if (m_timelineAgent) m_timelineAgent->didFinishLoadingResource(identifier, true); @@ -1498,6 +1530,8 @@ void InspectorController::stopUserInitiatedProfiling() #if USE(JSC) JSC::ExecState* scriptState = toJSDOMWindow(m_inspectedPage->mainFrame(), debuggerWorld())->globalExec(); #else + // Use null script state to avoid filtering by context security token. + // All functions from all iframes should be visible from Inspector UI. ScriptState* scriptState = 0; #endif RefPtr<ScriptProfile> profile = ScriptProfiler::stop(scriptState, title); @@ -1593,11 +1627,30 @@ void InspectorController::disableDebugger(bool always) m_debuggerEnabled = false; m_attachDebuggerWhenShown = false; + m_pausedScriptState = 0; if (m_frontend) m_frontend->debuggerWasDisabled(); } +void InspectorController::editScriptSource(long callId, const String& sourceID, const String& newContent) +{ + String result; + bool success = ScriptDebugServer::shared().editScriptSource(sourceID, newContent, result); + RefPtr<SerializedScriptValue> callFrames; + if (success) + callFrames = currentCallFrames(); + m_frontend->didEditScriptSource(callId, success, result, callFrames.get()); +} + +void InspectorController::getScriptSource(long callId, const String& sourceID) +{ + if (!m_frontend) + return; + String scriptSource = m_scriptIDToContent.get(sourceID); + m_frontend->didGetScriptSource(callId, scriptSource); +} + void InspectorController::resumeDebugger() { if (!m_debuggerEnabled) @@ -1605,6 +1658,18 @@ void InspectorController::resumeDebugger() ScriptDebugServer::shared().continueProgram(); } +PassRefPtr<SerializedScriptValue> InspectorController::currentCallFrames() +{ + if (!m_pausedScriptState) + return 0; + InjectedScript injectedScript = m_injectedScriptHost->injectedScriptFor(m_pausedScriptState); + if (injectedScript.hasNoValue()) { + ASSERT_NOT_REACHED(); + return 0; + } + return injectedScript.callFrames(); +} + void InspectorController::setBreakpoint(const String& sourceID, unsigned lineNumber, bool enabled, const String& condition) { ScriptBreakpoint breakpoint(enabled, condition); @@ -1634,9 +1699,10 @@ void InspectorController::removeBreakpoint(const String& sourceID, unsigned line // JavaScriptDebugListener functions -void InspectorController::didParseSource(const String& sourceID, const String& url, const String& data, int firstLine) +void InspectorController::didParseSource(const String& sourceID, const String& url, const String& data, int firstLine, ScriptWorldType worldType) { - m_frontend->parsedScriptSource(sourceID, url, data, firstLine); + // Don't send script content to the front end until it's really needed. + m_frontend->parsedScriptSource(sourceID, url, "", firstLine, worldType); if (url.isEmpty()) return; @@ -1652,6 +1718,7 @@ void InspectorController::didParseSource(const String& sourceID, const String& u } m_sourceIDToURL.set(sourceID, url); + m_scriptIDToContent.set(sourceID, data); } void InspectorController::failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage) @@ -1661,14 +1728,15 @@ void InspectorController::failedToParseSource(const String& url, const String& d void InspectorController::didPause(ScriptState* scriptState) { - ASSERT(scriptState); - InjectedScript injectedScript = m_injectedScriptHost->injectedScriptFor(scriptState); - RefPtr<SerializedScriptValue> callFrames = injectedScript.callFrames(); + ASSERT(scriptState && !m_pausedScriptState); + m_pausedScriptState = scriptState; + RefPtr<SerializedScriptValue> callFrames = currentCallFrames(); m_frontend->pausedScript(callFrames.get()); } void InspectorController::didContinue() { + m_pausedScriptState = 0; m_frontend->resumedScript(); } diff --git a/WebCore/inspector/InspectorController.h b/WebCore/inspector/InspectorController.h index a2c8a77..af36383 100644 --- a/WebCore/inspector/InspectorController.h +++ b/WebCore/inspector/InspectorController.h @@ -32,6 +32,7 @@ #include "Console.h" #include "Cookie.h" #include "InspectorDOMAgent.h" +#include "InspectorValues.h" #include "PlatformString.h" #include "ScriptArray.h" #include "ScriptBreakpoint.h" @@ -126,6 +127,7 @@ public: String setting(const String& key) const; void setSetting(const String& key, const String& value); + void setSessionSettings(const String&); void inspect(Node*); void highlight(Node*); @@ -134,6 +136,11 @@ public: void show(); void showPanel(SpecialPanels); void close(); + + // We are in transition from JS transport via webInspector to native + // transport via InspectorClient. After migration, webInspector parameter should + // be removed. + void connectFrontend(const ScriptObject& webInspector); void disconnectFrontend(); void addMessageToConsole(MessageSource, MessageType, MessageLevel, ScriptCallStack*); @@ -151,7 +158,6 @@ public: void inspectedWindowScriptObjectCleared(Frame*); bool windowVisible(); - void setFrontend(PassOwnPtr<InspectorFrontend>); void didCommitLoad(DocumentLoader*); void frameDetachedFromParent(Frame*); @@ -241,9 +247,13 @@ public: void disableDebugger(bool always = false); bool debuggerEnabled() const { return m_debuggerEnabled; } + void editScriptSource(long callId, const String& sourceID, const String& newContent); + void getScriptSource(long callId, const String& sourceID); + void resumeDebugger(); + PassRefPtr<SerializedScriptValue> currentCallFrames(); - virtual void didParseSource(const String& sourceID, const String& url, const String& data, int firstLine); + virtual void didParseSource(const String& sourceID, const String& url, const String& data, int firstLine, ScriptWorldType); virtual void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage); virtual void didPause(ScriptState*); virtual void didContinue(); @@ -340,6 +350,7 @@ private: #endif SpecialPanels m_showAfterVisible; RefPtr<Node> m_highlightedNode; + RefPtr<InspectorValue> m_sessionSettings; unsigned m_groupLevel; bool m_searchingForNode; ConsoleMessage* m_previousMessage; @@ -356,7 +367,9 @@ private: #if ENABLE(JAVASCRIPT_DEBUGGER) bool m_debuggerEnabled; bool m_attachDebuggerWhenShown; + ScriptState* m_pausedScriptState; HashMap<String, String> m_sourceIDToURL; + HashMap<String, String> m_scriptIDToContent; HashMap<String, SourceBreakpoints> m_stickyBreakpoints; bool m_profilerEnabled; diff --git a/WebCore/inspector/InspectorDOMAgent.cpp b/WebCore/inspector/InspectorDOMAgent.cpp index 338dc33..b152dc3 100644 --- a/WebCore/inspector/InspectorDOMAgent.cpp +++ b/WebCore/inspector/InspectorDOMAgent.cpp @@ -51,6 +51,8 @@ #include "EventListener.h" #include "EventNames.h" #include "EventTarget.h" +#include "Frame.h" +#include "FrameTree.h" #include "HTMLFrameOwnerElement.h" #include "InspectorFrontend.h" #include "markup.h" @@ -65,18 +67,141 @@ #include "StyleSheetList.h" #include "Text.h" +#if ENABLE(XPATH) +#include "XPathResult.h" +#endif + #include <wtf/text/CString.h> #include <wtf/HashSet.h> +#include <wtf/ListHashSet.h> #include <wtf/OwnPtr.h> #include <wtf/Vector.h> namespace WebCore { +class MatchJob { +public: + virtual void match(ListHashSet<Node*>& resultCollector) = 0; + virtual ~MatchJob() { } + +protected: + MatchJob(Document* document, const String& query) + : m_document(document) + , m_query(query) { } + + void addNodesToResults(PassRefPtr<NodeList> nodes, ListHashSet<Node*>& resultCollector) + { + for (unsigned i = 0; nodes && i < nodes->length(); ++i) + resultCollector.add(nodes->item(i)); + } + + RefPtr<Document> m_document; + String m_query; +}; + +namespace { + +class MatchExactIdJob : public WebCore::MatchJob { +public: + MatchExactIdJob(Document* document, const String& query) : WebCore::MatchJob(document, query) { } + virtual ~MatchExactIdJob() { } + +protected: + virtual void match(ListHashSet<Node*>& resultCollector) + { + if (m_query.isEmpty()) + return; + + Element* element = m_document->getElementById(m_query); + if (element) + resultCollector.add(element); + } +}; + +class MatchExactClassNamesJob : public WebCore::MatchJob { +public: + MatchExactClassNamesJob(Document* document, const String& query) : WebCore::MatchJob(document, query) { } + virtual ~MatchExactClassNamesJob() { } + + virtual void match(ListHashSet<Node*>& resultCollector) + { + if (!m_query.isEmpty()) + addNodesToResults(m_document->getElementsByClassName(m_query), resultCollector); + } +}; + +class MatchExactTagNamesJob : public WebCore::MatchJob { +public: + MatchExactTagNamesJob(Document* document, const String& query) : WebCore::MatchJob(document, query) { } + virtual ~MatchExactTagNamesJob() { } + + virtual void match(ListHashSet<Node*>& resultCollector) + { + if (!m_query.isEmpty()) + addNodesToResults(m_document->getElementsByName(m_query), resultCollector); + } +}; + +class MatchQuerySelectorAllJob : public WebCore::MatchJob { +public: + MatchQuerySelectorAllJob(Document* document, const String& query) : WebCore::MatchJob(document, query) { } + virtual ~MatchQuerySelectorAllJob() { } + + virtual void match(ListHashSet<Node*>& resultCollector) + { + if (m_query.isEmpty()) + return; + + ExceptionCode ec = 0; + RefPtr<NodeList> list = m_document->querySelectorAll(m_query, ec); + if (!ec) + addNodesToResults(list, resultCollector); + } +}; + +class MatchXPathJob : public WebCore::MatchJob { +public: + MatchXPathJob(Document* document, const String& query) : WebCore::MatchJob(document, query) { } + virtual ~MatchXPathJob() { } + + virtual void match(ListHashSet<Node*>& resultCollector) + { +#if ENABLE(XPATH) + if (m_query.isEmpty()) + return; + + ExceptionCode ec = 0; + RefPtr<XPathResult> result = m_document->evaluate(m_query, m_document.get(), 0, XPathResult::ORDERED_NODE_SNAPSHOT_TYPE, 0, ec); + if (ec || !result) + return; + + unsigned long size = result->snapshotLength(ec); + for (unsigned long i = 0; !ec && i < size; ++i) { + Node* node = result->snapshotItem(i, ec); + if (!ec) + resultCollector.add(node); + } +#endif + } +}; + +class MatchPlainTextJob : public MatchXPathJob { +public: + MatchPlainTextJob(Document* document, const String& query) : MatchXPathJob(document, query) + { + m_query = "//text()[contains(., '" + m_query + "')] | //comment()[contains(., '" + m_query + "')]"; + } + virtual ~MatchPlainTextJob() { } +}; + +} + InspectorDOMAgent::InspectorDOMAgent(InspectorCSSStore* cssStore, InspectorFrontend* frontend) : EventListener(InspectorDOMAgentType) , m_cssStore(cssStore) , m_frontend(frontend) , m_lastNodeId(1) + , m_matchJobsTimer(this, &InspectorDOMAgent::onMatchJobsTimer) { } @@ -87,6 +212,7 @@ InspectorDOMAgent::~InspectorDOMAgent() void InspectorDOMAgent::reset() { + searchCanceled(); discardBindings(); ListHashSet<RefPtr<Document> > copy = m_documents; @@ -506,6 +632,103 @@ void InspectorDOMAgent::getEventListenersForNode(long callId, long nodeId) m_frontend->didGetEventListenersForNode(callId, nodeId, listenersArray); } +void InspectorDOMAgent::performSearch(const String& whitespaceTrimmedQuery, bool runSynchronously) +{ + // FIXME: Few things are missing here: + // 1) Search works with node granularity - number of matches within node is not calculated. + // 2) There is no need to push all search results to the front-end at a time, pushing next / previous result + // is sufficient. + + int queryLength = whitespaceTrimmedQuery.length(); + bool startTagFound = !whitespaceTrimmedQuery.find('<'); + bool endTagFound = whitespaceTrimmedQuery.reverseFind('>') + 1 == queryLength; + + String tagNameQuery = whitespaceTrimmedQuery; + if (startTagFound || endTagFound) + tagNameQuery = tagNameQuery.substring(startTagFound ? 1 : 0, endTagFound ? queryLength - 1 : queryLength); + if (!Document::isValidName(tagNameQuery)) + tagNameQuery = ""; + + String attributeNameQuery = whitespaceTrimmedQuery; + if (!Document::isValidName(attributeNameQuery)) + attributeNameQuery = ""; + + String escapedQuery = whitespaceTrimmedQuery; + escapedQuery.replace("'", "\\'"); + String escapedTagNameQuery = tagNameQuery; + escapedTagNameQuery.replace("'", "\\'"); + + // Clear pending jobs. + searchCanceled(); + + // Find all frames, iframes and object elements to search their documents. + for (Frame* frame = mainFrameDocument()->frame(); frame; frame = frame->tree()->traverseNext()) { + Document* document = frame->document(); + if (!document) + continue; + + if (!tagNameQuery.isEmpty() && startTagFound && endTagFound) { + m_pendingMatchJobs.append(new MatchExactTagNamesJob(document, tagNameQuery)); + m_pendingMatchJobs.append(new MatchPlainTextJob(document, escapedQuery)); + continue; + } + + if (!tagNameQuery.isEmpty() && startTagFound) { + m_pendingMatchJobs.append(new MatchXPathJob(document, "//*[starts-with(name(), '" + escapedTagNameQuery + "')]")); + m_pendingMatchJobs.append(new MatchPlainTextJob(document, escapedQuery)); + continue; + } + + if (!tagNameQuery.isEmpty() && endTagFound) { + // FIXME: we should have a matchEndOfTagNames search function if endTagFound is true but not startTagFound. + // This requires ends-with() support in XPath, WebKit only supports starts-with() and contains(). + m_pendingMatchJobs.append(new MatchXPathJob(document, "//*[contains(name(), '" + escapedTagNameQuery + "')]")); + m_pendingMatchJobs.append(new MatchPlainTextJob(document, escapedQuery)); + continue; + } + + bool matchesEveryNode = whitespaceTrimmedQuery == "//*" || whitespaceTrimmedQuery == "*"; + if (matchesEveryNode) { + // These queries will match every node. Matching everything isn't useful and can be slow for large pages, + // so limit the search functions list to plain text and attribute matching for these. + m_pendingMatchJobs.append(new MatchXPathJob(document, "//*[contains(@*, '" + escapedQuery + "')]")); + m_pendingMatchJobs.append(new MatchPlainTextJob(document, escapedQuery)); + continue; + } + + m_pendingMatchJobs.append(new MatchExactIdJob(document, whitespaceTrimmedQuery)); + m_pendingMatchJobs.append(new MatchExactClassNamesJob(document, whitespaceTrimmedQuery)); + m_pendingMatchJobs.append(new MatchExactTagNamesJob(document, tagNameQuery)); + m_pendingMatchJobs.append(new MatchQuerySelectorAllJob(document, "[" + attributeNameQuery + "]")); + m_pendingMatchJobs.append(new MatchQuerySelectorAllJob(document, whitespaceTrimmedQuery)); + m_pendingMatchJobs.append(new MatchXPathJob(document, "//*[contains(@*, '" + escapedQuery + "')]")); + if (!tagNameQuery.isEmpty()) + m_pendingMatchJobs.append(new MatchXPathJob(document, "//*[contains(name(), '" + escapedTagNameQuery + "')]")); + m_pendingMatchJobs.append(new MatchPlainTextJob(document, escapedQuery)); + m_pendingMatchJobs.append(new MatchXPathJob(document, whitespaceTrimmedQuery)); + } + + if (runSynchronously) { + // For tests. + ListHashSet<Node*> resultCollector; + for (Deque<MatchJob*>::iterator it = m_pendingMatchJobs.begin(); it != m_pendingMatchJobs.end(); ++it) + (*it)->match(resultCollector); + reportNodesAsSearchResults(resultCollector); + searchCanceled(); + return; + } + m_matchJobsTimer.startOneShot(0); +} + +void InspectorDOMAgent::searchCanceled() +{ + if (m_matchJobsTimer.isActive()) + m_matchJobsTimer.stop(); + deleteAllValues(m_pendingMatchJobs); + m_pendingMatchJobs.clear(); + m_searchResults.clear(); +} + String InspectorDOMAgent::documentURLString(Document* document) const { if (!document || document->url().isNull()) @@ -1330,6 +1553,36 @@ CSSStyleSheet* InspectorDOMAgent::getParentStyleSheet(CSSStyleDeclaration* style return parentStyleSheet; } +void InspectorDOMAgent::onMatchJobsTimer(Timer<InspectorDOMAgent>*) +{ + if (!m_pendingMatchJobs.size()) { + searchCanceled(); + return; + } + + ListHashSet<Node*> resultCollector; + MatchJob* job = m_pendingMatchJobs.takeFirst(); + job->match(resultCollector); + delete job; + + reportNodesAsSearchResults(resultCollector); + + m_matchJobsTimer.startOneShot(0.025); +} + +void InspectorDOMAgent::reportNodesAsSearchResults(ListHashSet<Node*>& resultCollector) +{ + ScriptArray nodeIds = m_frontend->newScriptArray(); + int index = 0; + for (ListHashSet<Node*>::iterator it = resultCollector.begin(); it != resultCollector.end(); ++it) { + if (m_searchResults.contains(*it)) + continue; + m_searchResults.add(*it); + nodeIds.set(index++, static_cast<long long>(pushNodePathToFrontend(*it))); + } + m_frontend->addNodesToSearchResult(nodeIds); +} + } // namespace WebCore #endif // ENABLE(INSPECTOR) diff --git a/WebCore/inspector/InspectorDOMAgent.h b/WebCore/inspector/InspectorDOMAgent.h index f8925b5..a962569 100644 --- a/WebCore/inspector/InspectorDOMAgent.h +++ b/WebCore/inspector/InspectorDOMAgent.h @@ -31,13 +31,17 @@ #define InspectorDOMAgent_h #include "AtomicString.h" +#include "Document.h" #include "EventListener.h" #include "EventTarget.h" #include "InspectorCSSStore.h" +#include "NodeList.h" #include "ScriptArray.h" #include "ScriptObject.h" #include "ScriptState.h" +#include "Timer.h" +#include <wtf/Deque.h> #include <wtf/ListHashSet.h> #include <wtf/HashMap.h> #include <wtf/HashSet.h> @@ -53,8 +57,8 @@ namespace WebCore { class CSSStyleSheet; class Element; class Event; - class Document; class InspectorFrontend; + class MatchJob; class NameNodeMap; class Node; class Page; @@ -101,6 +105,8 @@ namespace WebCore { void changeTagName(long callId, long nodeId, const AtomicString& tagName, bool expanded); void setTextNodeValue(long callId, long nodeId, const String& value); void getEventListenersForNode(long callId, long nodeId); + void performSearch(const String& whitespaceTrimmedQuery, bool runSynchronously); + void searchCanceled(); // Methods called from the frontend for CSS styles inspection. void getStyles(long callId, long nodeId, bool authorOnly); @@ -165,6 +171,9 @@ namespace WebCore { String documentURLString(Document* document) const; InspectorCSSStore* cssStore() { return m_cssStore; } + void onMatchJobsTimer(Timer<InspectorDOMAgent>*); + void reportNodesAsSearchResults(ListHashSet<Node*>& resultCollector); + ScriptObject buildObjectForStyle(CSSStyleDeclaration*, bool bind); void populateObjectWithStyleProperties(CSSStyleDeclaration*, ScriptObject& result); ScriptArray buildArrayForDisabledStyleProperties(DisabledStyleDeclaration*); @@ -188,9 +197,11 @@ namespace WebCore { HashSet<long> m_childrenRequested; long m_lastNodeId; ListHashSet<RefPtr<Document> > m_documents; + Deque<MatchJob*> m_pendingMatchJobs; + Timer<InspectorDOMAgent> m_matchJobsTimer; + HashSet<RefPtr<Node> > m_searchResults; }; - } // namespace WebCore #endif // !defined(InspectorDOMAgent_h) diff --git a/WebCore/inspector/InspectorFrontend.cpp b/WebCore/inspector/InspectorFrontend.cpp index fb66cad..c9aa730 100644 --- a/WebCore/inspector/InspectorFrontend.cpp +++ b/WebCore/inspector/InspectorFrontend.cpp @@ -36,6 +36,7 @@ #include "Frame.h" #include "InjectedScript.h" #include "InjectedScriptHost.h" +#include "InspectorClient.h" #include "InspectorController.h" #include "InspectorWorkerResource.h" #include "Node.h" @@ -49,8 +50,9 @@ namespace WebCore { -InspectorFrontend::InspectorFrontend(ScriptObject webInspector) +InspectorFrontend::InspectorFrontend(ScriptObject webInspector, InspectorClient* inspectorClient) : m_webInspector(webInspector) + , m_inspectorClient(inspectorClient) { } @@ -86,10 +88,18 @@ void InspectorFrontend::didCommitLoad() callSimpleFunction("didCommitLoad"); } -void InspectorFrontend::populateFrontendSettings(const String& settings) +void InspectorFrontend::populateApplicationSettings(const String& settings) { ScriptFunctionCall function(m_webInspector, "dispatch"); - function.appendArgument("populateFrontendSettings"); + function.appendArgument("populateApplicationSettings"); + function.appendArgument(settings); + function.call(); +} + +void InspectorFrontend::populateSessionSettings(const String& settings) +{ + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("populateSessionSettings"); function.appendArgument(settings); function.call(); } @@ -305,7 +315,7 @@ void InspectorFrontend::debuggerWasDisabled() callSimpleFunction("debuggerWasDisabled"); } -void InspectorFrontend::parsedScriptSource(const String& sourceID, const String& url, const String& data, int firstLine) +void InspectorFrontend::parsedScriptSource(const String& sourceID, const String& url, const String& data, int firstLine, int scriptWorldType) { ScriptFunctionCall function(m_webInspector, "dispatch"); function.appendArgument("parsedScriptSource"); @@ -313,6 +323,7 @@ void InspectorFrontend::parsedScriptSource(const String& sourceID, const String& function.appendArgument(url); function.appendArgument(data); function.appendArgument(firstLine); + function.appendArgument(scriptWorldType); function.call(); } @@ -354,6 +365,30 @@ void InspectorFrontend::resumedScript() callSimpleFunction("resumedScript"); } +void InspectorFrontend::didEditScriptSource(long callId, bool success, const String& result, SerializedScriptValue* newCallFrames) +{ + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("didEditScriptSource"); + function.appendArgument(callId); + function.appendArgument(success); + function.appendArgument(result); + if (success && newCallFrames) { + ScriptValue newCallFramesValue = ScriptValue::deserialize(scriptState(), newCallFrames); + ASSERT(!newCallFramesValue .hasNoValue()); + function.appendArgument(newCallFramesValue); + } + function.call(); +} + +void InspectorFrontend::didGetScriptSource(long callId, const String& result) +{ + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("didGetScriptSource"); + function.appendArgument(callId); + function.appendArgument(result); + function.call(); +} + void InspectorFrontend::profilerWasEnabled() { callSimpleFunction("profilerWasEnabled"); @@ -738,7 +773,7 @@ void InspectorFrontend::updateDOMStorage(long storageId) } #endif -void InspectorFrontend::addNodesToSearchResult(const String& nodeIds) +void InspectorFrontend::addNodesToSearchResult(const ScriptArray& nodeIds) { ScriptFunctionCall function(m_webInspector, "dispatch"); function.appendArgument("addNodesToSearchResult"); diff --git a/WebCore/inspector/InspectorFrontend.h b/WebCore/inspector/InspectorFrontend.h index fa752aa..1762014 100644 --- a/WebCore/inspector/InspectorFrontend.h +++ b/WebCore/inspector/InspectorFrontend.h @@ -30,6 +30,7 @@ #ifndef InspectorFrontend_h #define InspectorFrontend_h +#include "InspectorValues.h" #include "ScriptArray.h" #include "ScriptObject.h" #include "ScriptState.h" @@ -39,16 +40,20 @@ namespace WebCore { class ConsoleMessage; class Database; class Frame; + class InspectorClient; class InspectorResource; + class InspectorWorkerResource; class Node; class ScriptString; class SerializedScriptValue; class Storage; - class InspectorWorkerResource; class InspectorFrontend : public Noncopyable { public: - InspectorFrontend(ScriptObject webInspector); + // We are in transition from JS transport via webInspector to native + // transport via inspectorClient. After migration, webInspector parameter should + // be removed. + InspectorFrontend(ScriptObject webInspector, InspectorClient* inspectorClient); ~InspectorFrontend(); void close(); @@ -59,7 +64,8 @@ namespace WebCore { void didCommitLoad(); - void populateFrontendSettings(const String& settings); + void populateApplicationSettings(const String& settings); + void populateSessionSettings(const String& settings); void updateConsoleMessageExpiredCount(unsigned count); void addConsoleMessage(const ScriptObject& messageObj, const Vector<ScriptString>& frames, const Vector<RefPtr<SerializedScriptValue> >& arguments, const String& message); @@ -92,12 +98,15 @@ namespace WebCore { void debuggerWasEnabled(); void debuggerWasDisabled(); - void parsedScriptSource(const String& sourceID, const String& url, const String& data, int firstLine); + void parsedScriptSource(const String& sourceID, const String& url, const String& data, int firstLine, int scriptWorldType); void restoredBreakpoint(const String& sourceID, const String& url, int line, bool enabled, const String& condition); void failedToParseScriptSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage); void pausedScript(SerializedScriptValue* callFrames); void resumedScript(); + void didEditScriptSource(long callId, bool success, const String& result, SerializedScriptValue* newCallFrames); + void didGetScriptSource(long callId, const String& result); + void profilerWasEnabled(); void profilerWasDisabled(); void addProfileHeader(const ScriptValue& profile); @@ -158,7 +167,7 @@ namespace WebCore { void didGetCookies(long callId, const ScriptArray& cookies, const String& cookiesString); void didDispatchOnInjectedScript(long callId, SerializedScriptValue* result, bool isException); - void addNodesToSearchResult(const String& nodeIds); + void addNodesToSearchResult(const ScriptArray& nodeIds); void contextMenuItemSelected(int itemId); void contextMenuCleared(); @@ -169,6 +178,7 @@ namespace WebCore { private: void callSimpleFunction(const String& functionName); ScriptObject m_webInspector; + InspectorClient* m_inspectorClient; }; } // namespace WebCore diff --git a/WebCore/inspector/InspectorFrontendClientLocal.cpp b/WebCore/inspector/InspectorFrontendClientLocal.cpp index 18c52da..188566f 100644 --- a/WebCore/inspector/InspectorFrontendClientLocal.cpp +++ b/WebCore/inspector/InspectorFrontendClientLocal.cpp @@ -89,7 +89,7 @@ void InspectorFrontendClientLocal::frontendLoaded() ASSERT_NOT_REACHED(); return; } - m_inspectorController->setFrontend(new InspectorFrontend(webInspectorObj)); + m_inspectorController->connectFrontend(webInspectorObj); } void InspectorFrontendClientLocal::requestAttachWindow() diff --git a/WebCore/inspector/InspectorResource.cpp b/WebCore/inspector/InspectorResource.cpp index 999b8d6..f0e391d 100644 --- a/WebCore/inspector/InspectorResource.cpp +++ b/WebCore/inspector/InspectorResource.cpp @@ -169,7 +169,6 @@ void InspectorResource::updateScriptObject(InspectorFrontend* frontend) jsonObject.set("expectedContentLength", m_expectedContentLength); jsonObject.set("statusCode", m_responseStatusCode); jsonObject.set("statusText", m_responseStatusText); - jsonObject.set("suggestedFilename", m_suggestedFilename); ScriptObject responseHeaders = frontend->newScriptObject(); populateHeadersObject(&responseHeaders, m_responseHeaderFields); jsonObject.set("responseHeaders", responseHeaders); diff --git a/WebCore/inspector/InspectorTimelineAgent.h b/WebCore/inspector/InspectorTimelineAgent.h index 4c5b939..fe334be 100644 --- a/WebCore/inspector/InspectorTimelineAgent.h +++ b/WebCore/inspector/InspectorTimelineAgent.h @@ -97,9 +97,11 @@ public: void willPaint(const IntRect&); void didPaint(); + // FIXME: |length| should be passed in didWrite instead willWrite + // as the parser can not know how much it will process until it tries. void willWriteHTML(unsigned int length, unsigned int startLine); void didWriteHTML(unsigned int endLine); - + void didInstallTimer(int timerId, int timeout, bool singleShot); void didRemoveTimer(int timerId); void willFireTimer(int timerId); diff --git a/WebCore/inspector/InspectorValues.cpp b/WebCore/inspector/InspectorValues.cpp index f59e900..5c7d0c8 100644 --- a/WebCore/inspector/InspectorValues.cpp +++ b/WebCore/inspector/InspectorValues.cpp @@ -35,6 +35,407 @@ namespace WebCore { +namespace { + +static const int stackLimit = 1000; + +enum Token { + OBJECT_BEGIN, + OBJECT_END, + ARRAY_BEGIN, + ARRAY_END, + STRING, + NUMBER, + BOOL_TRUE, + BOOL_FALSE, + NULL_TOKEN, + LIST_SEPARATOR, + OBJECT_PAIR_SEPARATOR, + INVALID_TOKEN, +}; + +const char* const nullString = "null"; +const char* const trueString = "true"; +const char* const falseString = "false"; + +bool parseConstToken(const UChar* start, const UChar* end, const UChar** tokenEnd, const char* token) +{ + while (start < end && *token != '\0' && *start++ == *token++) { } + if (*token != '\0') + return false; + *tokenEnd = start; + return true; +} + +bool readInt(const UChar* start, const UChar* end, const UChar** tokenEnd, bool canHaveLeadingZeros) +{ + if (start == end) + return false; + bool haveLeadingZero = '0' == *start; + int length = 0; + while (start < end && '0' <= *start && *start <= '9') { + ++start; + ++length; + } + if (!length) + return false; + if (!canHaveLeadingZeros && length > 1 && haveLeadingZero) + return false; + *tokenEnd = start; + return true; +} + +bool parseNumberToken(const UChar* start, const UChar* end, const UChar** tokenEnd) +{ + // We just grab the number here. We validate the size in DecodeNumber. + // According to RFC4627, a valid number is: [minus] int [frac] [exp] + if (start == end) + return false; + UChar c = *start; + if ('-' == c) + ++start; + + if (!readInt(start, end, &start, false)) + return false; + if (start == end) { + *tokenEnd = start; + return true; + } + + // Optional fraction part + c = *start; + if ('.' == c) { + ++start; + if (!readInt(start, end, &start, true)) + return false; + if (start == end) { + *tokenEnd = start; + return true; + } + c = *start; + } + + // Optional exponent part + if ('e' == c || 'E' == c) { + ++start; + if (start == end) + return false; + c = *start; + if ('-' == c || '+' == c) { + ++start; + if (start == end) + return false; + } + if (!readInt(start, end, &start, true)) + return false; + } + + *tokenEnd = start; + return true; +} + +bool readHexDigits(const UChar* start, const UChar* end, const UChar** tokenEnd, int digits) +{ + if (end - start < digits) + return false; + for (int i = 0; i < digits; ++i) { + UChar c = *start++; + if (!(('0' <= c && c <= '9') || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F'))) + return false; + } + *tokenEnd = start; + return true; +} + +bool parseStringToken(const UChar* start, const UChar* end, const UChar** tokenEnd) +{ + while (start < end) { + UChar c = *start++; + if ('\\' == c) { + c = *start++; + // Make sure the escaped char is valid. + switch (c) { + case 'x': + if (!readHexDigits(start, end, &start, 2)) + return false; + break; + case 'u': + if (!readHexDigits(start, end, &start, 4)) + return false; + break; + case '\\': + case '/': + case 'b': + case 'f': + case 'n': + case 'r': + case 't': + case 'v': + case '"': + break; + default: + return false; + } + } else if ('"' == c) { + *tokenEnd = start; + return true; + } + } + return false; +} + +Token parseToken(const UChar* start, const UChar* end, const UChar** tokenEnd) +{ + if (start == end) + return INVALID_TOKEN; + + switch (*start) { + case 'n': + if (parseConstToken(start, end, tokenEnd, nullString)) + return NULL_TOKEN; + break; + case 't': + if (parseConstToken(start, end, tokenEnd, trueString)) + return BOOL_TRUE; + break; + case 'f': + if (parseConstToken(start, end, tokenEnd, falseString)) + return BOOL_FALSE; + break; + case '[': + *tokenEnd = start + 1; + return ARRAY_BEGIN; + case ']': + *tokenEnd = start + 1; + return ARRAY_END; + case ',': + *tokenEnd = start + 1; + return LIST_SEPARATOR; + case '{': + *tokenEnd = start + 1; + return OBJECT_BEGIN; + case '}': + *tokenEnd = start + 1; + return OBJECT_END; + case ':': + *tokenEnd = start + 1; + return OBJECT_PAIR_SEPARATOR; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '-': + if (parseNumberToken(start, end, tokenEnd)) + return NUMBER; + break; + case '"': + if (parseStringToken(start + 1, end, tokenEnd)) + return STRING; + break; + } + return INVALID_TOKEN; +} + +inline int hexToInt(UChar c) +{ + if ('0' <= c && c <= '9') + return c - '0'; + if ('A' <= c && c <= 'F') + return c - 'A' + 10; + if ('a' <= c && c <= 'f') + return c - 'a' + 10; + ASSERT_NOT_REACHED(); + return 0; +} + +bool decodeString(const UChar* start, const UChar* end, Vector<UChar>* output) +{ + while (start < end) { + UChar c = *start++; + if ('\\' != c) { + output->append(c); + continue; + } + c = *start++; + switch (c) { + case '"': + case '/': + case '\\': + break; + case 'b': + c = '\b'; + break; + case 'f': + c = '\f'; + break; + case 'n': + c = '\n'; + break; + case 'r': + c = '\r'; + break; + case 't': + c = '\t'; + break; + case 'v': + c = '\v'; + break; + case 'x': + c = (hexToInt(*start) << 4) + + hexToInt(*(start + 1)); + start += 2; + break; + case 'u': + c = (hexToInt(*start) << 12) + + (hexToInt(*(start + 1)) << 8) + + (hexToInt(*(start + 2)) << 4) + + hexToInt(*(start + 3)); + start += 4; + break; + default: + return false; + } + output->append(c); + } + return true; +} + +bool decodeString(const UChar* start, const UChar* end, String* output) +{ + if (start == end) { + *output = ""; + return true; + } + if (start > end) + return false; + Vector<UChar> buffer; + buffer.reserveCapacity(end - start); + if (!decodeString(start, end, &buffer)) + return false; + *output = String(buffer.data(), buffer.size()); + return true; +} + +PassRefPtr<InspectorValue> buildValue(const UChar* start, const UChar* end, const UChar** valueTokenEnd, int depth) +{ + if (depth > stackLimit) + return 0; + + RefPtr<InspectorValue> result; + const UChar* tokenEnd; + Token token = parseToken(start, end, &tokenEnd); + switch (token) { + case INVALID_TOKEN: + return 0; + case NULL_TOKEN: + result = InspectorValue::null(); + break; + case BOOL_TRUE: + result = InspectorBasicValue::create(true); + break; + case BOOL_FALSE: + result = InspectorBasicValue::create(false); + break; + case NUMBER: { + bool ok; + double value = charactersToDouble(start, tokenEnd - start, &ok); + if (!ok) + return 0; + result = InspectorBasicValue::create(value); + break; + } + case STRING: { + String value; + bool ok = decodeString(start + 1, tokenEnd - 1, &value); + if (!ok) + return 0; + result = InspectorString::create(value); + break; + } + case ARRAY_BEGIN: { + RefPtr<InspectorArray> array = InspectorArray::create(); + start = tokenEnd; + token = parseToken(start, end, &tokenEnd); + while (token != ARRAY_END) { + RefPtr<InspectorValue> arrayNode = buildValue(start, end, &tokenEnd, depth + 1); + if (!arrayNode) + return 0; + array->push(arrayNode); + + // After a list value, we expect a comma or the end of the list. + start = tokenEnd; + token = parseToken(start, end, &tokenEnd); + if (token == LIST_SEPARATOR) { + start = tokenEnd; + token = parseToken(start, end, &tokenEnd); + if (token == ARRAY_END) + return 0; + } else if (token != ARRAY_END) { + // Unexpected value after list value. Bail out. + return 0; + } + } + if (token != ARRAY_END) + return 0; + result = array.release(); + break; + } + case OBJECT_BEGIN: { + RefPtr<InspectorObject> object = InspectorObject::create(); + start = tokenEnd; + token = parseToken(start, end, &tokenEnd); + while (token != OBJECT_END) { + if (token != STRING) + return 0; + String key; + if (!decodeString(start + 1, tokenEnd - 1, &key)) + return 0; + start = tokenEnd; + + token = parseToken(start, end, &tokenEnd); + if (token != OBJECT_PAIR_SEPARATOR) + return 0; + start = tokenEnd; + + RefPtr<InspectorValue> value = buildValue(start, end, &tokenEnd, depth + 1); + if (!value) + return 0; + object->set(key, value); + start = tokenEnd; + + // After a key/value pair, we expect a comma or the end of the + // object. + token = parseToken(start, end, &tokenEnd); + if (token == LIST_SEPARATOR) { + start = tokenEnd; + token = parseToken(start, end, &tokenEnd); + if (token == OBJECT_END) + return 0; + } else if (token != OBJECT_END) { + // Unexpected value after last object value. Bail out. + return 0; + } + } + if (token != OBJECT_END) + return 0; + result = object.release(); + break; + } + + default: + // We got a token that's not a value. + return 0; + } + *valueTokenEnd = tokenEnd; + return result.release(); +} + inline bool escapeChar(UChar c, Vector<UChar>* dst) { switch (c) { @@ -71,6 +472,44 @@ inline void doubleQuoteString(const String& str, Vector<UChar>* dst) dst->append('"'); } +} // anonymous namespace + +bool InspectorValue::asBool(bool*) const +{ + return false; +} + +bool InspectorValue::asNumber(double*) const +{ + return false; +} + +bool InspectorValue::asString(String*) const +{ + return false; +} + +PassRefPtr<InspectorObject> InspectorValue::asObject() +{ + return 0; +} + +PassRefPtr<InspectorArray> InspectorValue::asArray() +{ + return 0; +} + +PassRefPtr<InspectorValue> InspectorValue::readJSON(const String& json) +{ + const UChar* start = json.characters(); + const UChar* end = json.characters() + json.length(); + const UChar *tokenEnd; + RefPtr<InspectorValue> value = buildValue(start, end, &tokenEnd, 0); + if (!value || tokenEnd != end) + return 0; + return value.release(); +} + String InspectorValue::toJSONString() const { Vector<UChar> result; @@ -82,7 +521,23 @@ String InspectorValue::toJSONString() const void InspectorValue::writeJSON(Vector<UChar>* output) const { ASSERT(m_type == TypeNull); - output->append("null", 4); + output->append(nullString, 4); +} + +bool InspectorBasicValue::asBool(bool* output) const +{ + if (type() != TypeBoolean) + return false; + *output = m_boolValue; + return true; +} + +bool InspectorBasicValue::asNumber(double* output) const +{ + if (type() != TypeDouble) + return false; + *output = m_doubleValue; + return true; } void InspectorBasicValue::writeJSON(Vector<UChar>* output) const @@ -90,26 +545,87 @@ void InspectorBasicValue::writeJSON(Vector<UChar>* output) const ASSERT(type() == TypeBoolean || type() == TypeDouble); if (type() == TypeBoolean) { if (m_boolValue) - output->append("true", 4); + output->append(trueString, 4); else - output->append("false", 5); + output->append(falseString, 5); } else if (type() == TypeDouble) { String value = String::format("%f", m_doubleValue); output->append(value.characters(), value.length()); } } +bool InspectorString::asString(String* output) const +{ + *output = m_stringValue; + return true; +} + void InspectorString::writeJSON(Vector<UChar>* output) const { ASSERT(type() == TypeString); doubleQuoteString(m_stringValue, output); } +PassRefPtr<InspectorObject> InspectorObject::asObject() +{ + return this; +} + +bool InspectorObject::getBool(const String& name, bool* output) const +{ + RefPtr<InspectorValue> value = get(name); + if (!value) + return false; + return value->asBool(output); +} + +bool InspectorObject::getNumber(const String& name, double* output) const +{ + RefPtr<InspectorValue> value = get(name); + if (!value) + return false; + return value->asNumber(output); +} + +bool InspectorObject::getString(const String& name, String* output) const +{ + RefPtr<InspectorValue> value = get(name); + if (!value) + return false; + return value->asString(output); +} + +PassRefPtr<InspectorObject> InspectorObject::getObject(const String& name) const +{ + PassRefPtr<InspectorValue> value = get(name); + if (!value) + return false; + return value->asObject(); +} + +PassRefPtr<InspectorArray> InspectorObject::getArray(const String& name) const +{ + PassRefPtr<InspectorValue> value = get(name); + if (!value) + return false; + return value->asArray(); +} + +PassRefPtr<InspectorValue> InspectorObject::get(const String& name) const +{ + Dictionary::const_iterator it = m_data.find(name); + if (it == m_data.end()) + return 0; + return it->second; +} + void InspectorObject::writeJSON(Vector<UChar>* output) const { output->append('{'); - for (Dictionary::const_iterator it = m_data.begin(); it != m_data.end(); ++it) { - if (it != m_data.begin()) + for (size_t i = 0; i < m_order.size(); ++i) { + Dictionary::const_iterator it = m_data.find(m_order[i]); + ASSERT(it != m_data.end()); + if (i) output->append(','); doubleQuoteString(it->first, output); output->append(':'); @@ -118,6 +634,11 @@ void InspectorObject::writeJSON(Vector<UChar>* output) const output->append('}'); } +PassRefPtr<InspectorArray> InspectorArray::asArray() +{ + return this; +} + void InspectorArray::writeJSON(Vector<UChar>* output) const { output->append('['); diff --git a/WebCore/inspector/InspectorValues.h b/WebCore/inspector/InspectorValues.h index a60bb2c..b9920c4 100644 --- a/WebCore/inspector/InspectorValues.h +++ b/WebCore/inspector/InspectorValues.h @@ -42,6 +42,8 @@ namespace WebCore { +class InspectorArray; +class InspectorObject; class String; class InspectorValue : public RefCounted<InspectorValue> { @@ -65,6 +67,14 @@ public: Type type() const { return m_type; } + virtual bool asBool(bool* output) const; + virtual bool asNumber(double* output) const; + virtual bool asString(String* output) const; + virtual PassRefPtr<InspectorObject> asObject(); + virtual PassRefPtr<InspectorArray> asArray(); + + static PassRefPtr<InspectorValue> readJSON(const String& json); + String toJSONString() const; virtual void writeJSON(Vector<UChar>* output) const; @@ -93,6 +103,9 @@ public: return adoptRef(new InspectorBasicValue(value)); } + virtual bool asBool(bool* output) const; + virtual bool asNumber(double* output) const; + virtual void writeJSON(Vector<UChar>* output) const; private: @@ -117,6 +130,9 @@ public: { return adoptRef(new InspectorString(value)); } + + virtual bool asString(String* output) const; + virtual void writeJSON(Vector<UChar>* output) const; private: @@ -127,6 +143,13 @@ private: }; class InspectorObject : public InspectorValue { +private: + typedef HashMap<String, RefPtr<InspectorValue> > Dictionary; + +public: + typedef Dictionary::iterator iterator; + typedef Dictionary::const_iterator const_iterator; + public: static PassRefPtr<InspectorObject> create() { @@ -134,17 +157,31 @@ public: } ~InspectorObject() { } + virtual PassRefPtr<InspectorObject> asObject(); + void setBool(const String& name, bool); void setNumber(const String& name, double); void setString(const String& name, const String&); void set(const String& name, PassRefPtr<InspectorValue>); + bool getBool(const String& name, bool* output) const; + bool getNumber(const String& name, double* output) const; + bool getString(const String& name, String* output) const; + PassRefPtr<InspectorObject> getObject(const String& name) const; + PassRefPtr<InspectorArray> getArray(const String& name) const; + PassRefPtr<InspectorValue> get(const String& name) const; + virtual void writeJSON(Vector<UChar>* output) const; + iterator begin() { return m_data.begin(); } + iterator end() { return m_data.end(); } + const_iterator begin() const { return m_data.begin(); } + const_iterator end() const { return m_data.end(); } + private: InspectorObject() : InspectorValue(TypeObject) { } - typedef HashMap<String, RefPtr<InspectorValue> > Dictionary; Dictionary m_data; + Vector<String> m_order; }; class InspectorArray : public InspectorValue { @@ -155,6 +192,8 @@ public: } ~InspectorArray() { } + virtual PassRefPtr<InspectorArray> asArray(); + void pushBool(bool); void pushNumber(double); void pushString(const String&); @@ -170,22 +209,23 @@ private: inline void InspectorObject::setBool(const String& name, bool value) { - m_data.set(name, InspectorBasicValue::create(value)); + set(name, InspectorBasicValue::create(value)); } inline void InspectorObject::setNumber(const String& name, double value) { - m_data.set(name, InspectorBasicValue::create(value)); + set(name, InspectorBasicValue::create(value)); } inline void InspectorObject::setString(const String& name, const String& value) { - m_data.set(name, InspectorString::create(value)); + set(name, InspectorString::create(value)); } inline void InspectorObject::set(const String& name, PassRefPtr<InspectorValue> value) { - m_data.set(name, value); + if (m_data.set(name, value).second) + m_order.append(name); } inline void InspectorArray::pushBool(bool value) @@ -212,4 +252,3 @@ inline void InspectorArray::push(PassRefPtr<InspectorValue> value) #endif // ENABLE(INSPECTOR) #endif // !defined(InspectorValues_h) - diff --git a/WebCore/inspector/ScriptDebugListener.h b/WebCore/inspector/ScriptDebugListener.h index c669f5e..539b000 100644 --- a/WebCore/inspector/ScriptDebugListener.h +++ b/WebCore/inspector/ScriptDebugListener.h @@ -38,11 +38,16 @@ namespace WebCore { class String; +enum ScriptWorldType { +MAIN_WORLD = 0, +EXTENSIONS_WORLD +}; + class ScriptDebugListener { public: virtual ~ScriptDebugListener() { } - virtual void didParseSource(const String& sourceID, const String& url, const String& data, int firstLine) = 0; + virtual void didParseSource(const String& sourceID, const String& url, const String& data, int firstLine, ScriptWorldType) = 0; virtual void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage) = 0; virtual void didPause(ScriptState*) = 0; virtual void didContinue() = 0; diff --git a/WebCore/inspector/front-end/Breakpoint.js b/WebCore/inspector/front-end/Breakpoint.js deleted file mode 100644 index e69de29..0000000 diff --git a/WebCore/inspector/front-end/BreakpointManager.js b/WebCore/inspector/front-end/BreakpointManager.js index c277fb1..3ccccac 100644 --- a/WebCore/inspector/front-end/BreakpointManager.js +++ b/WebCore/inspector/front-end/BreakpointManager.js @@ -30,11 +30,32 @@ WebInspector.BreakpointManager = function() } WebInspector.BreakpointManager.prototype = { + setOneTimeBreakpoint: function(sourceID, line) + { + var breakpoint = new WebInspector.Breakpoint(this, sourceID, undefined, line, true, undefined); + if (this._breakpoints[breakpoint.id]) + return; + if (this._oneTimeBreakpoint) + this._removeBreakpointFromBackend(this._oneTimeBreakpoint); + this._oneTimeBreakpoint = breakpoint; + this._saveBreakpointOnBackend(breakpoint); + }, + + removeOneTimeBreakpoint: function() + { + if (this._oneTimeBreakpoint) { + this._removeBreakpointFromBackend(this._oneTimeBreakpoint); + delete this._oneTimeBreakpoint; + } + }, + addBreakpoint: function(sourceID, sourceURL, line, enabled, condition) { var breakpoint = new WebInspector.Breakpoint(this, sourceID, sourceURL, line, enabled, condition); if (this._breakpoints[breakpoint.id]) return; + if (this._oneTimeBreakpoint && (this._oneTimeBreakpoint.id == breakpoint.id)) + delete this._oneTimeBreakpoint; this._breakpoints[breakpoint.id] = breakpoint; this._saveBreakpointOnBackend(breakpoint); this.dispatchEventToListeners("breakpoint-added", breakpoint); @@ -72,6 +93,7 @@ WebInspector.BreakpointManager.prototype = { reset: function() { this._breakpoints = {}; + delete this._oneTimeBreakpoint; }, _saveBreakpointOnBackend: function(breakpoint) diff --git a/WebCore/inspector/front-end/CSSStyleModel.js b/WebCore/inspector/front-end/CSSStyleModel.js new file mode 100644 index 0000000..66a20ce --- /dev/null +++ b/WebCore/inspector/front-end/CSSStyleModel.js @@ -0,0 +1,111 @@ +/* + * 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.CSSStyleModel = function() +{ +} + +WebInspector.CSSStyleModel.prototype = { + getStylesAsync: function(nodeId, authOnly, userCallback) + { + InspectorBackend.getStyles(WebInspector.Callback.wrap(userCallback), nodeId, authOnly); + }, + + getComputedStyleAsync: function(nodeId, userCallback) + { + InspectorBackend.getComputedStyle(WebInspector.Callback.wrap(userCallback), nodeId); + }, + + setRuleSelector: function(ruleId, newContent, nodeId, successCallback, failureCallback) + { + function callback(newRulePayload, doesAffectSelectedNode) + { + if (!newRulePayload) + failureCallback(); + else + successCallback(WebInspector.CSSStyleDeclaration.parseRule(newRulePayload), doesAffectSelectedNode); + } + + InspectorBackend.setRuleSelector(WebInspector.Callback.wrap(callback), ruleId, newContent, nodeId); + }, + + addRule: function(nodeId, newContent, successCallback, failureCallback) + { + function callback(rule, doesAffectSelectedNode) + { + if (!rule) { + // Invalid syntax for a selector + failureCallback(); + } else { + var styleRule = WebInspector.CSSStyleDeclaration.parseRule(rule); + styleRule.rule = rule; + successCallback(styleRule, doesAffectSelectedNode); + } + } + + InspectorBackend.addRule(WebInspector.Callback.wrap(callback), newContent, nodeId); + }, + + toggleStyleEnabled: function(styleId, propertyName, disabled, userCallback) + { + function callback(newPayload) + { + if (!newPayload) { + userCallback(null); + return; + } + + var newStyle = WebInspector.CSSStyleDeclaration.parseStyle(newPayload); + userCallback(newStyle); + } + + InspectorBackend.toggleStyleEnabled(WebInspector.Callback.wrap(callback), styleId, propertyName, disabled); + }, + + setCSSText: function(styleId, cssText) + { + InspectorBackend.setStyleText(WebInspector.Callback.wrap(null), styleId, cssText); + }, + + applyStyleText: function(styleId, styleText, propertyName, successCallback, failureCallback) + { + function callback(success, newPayload, changedProperties) + { + if (!success) + failureCallback(); + else { + var newStyle = newPayload ? WebInspector.CSSStyleDeclaration.parseStyle(newPayload) : null; + successCallback(newStyle, changedProperties); + } + } + + InspectorBackend.applyStyleText(WebInspector.Callback.wrap(callback), styleId, styleText, propertyName); + } +} diff --git a/WebCore/inspector/front-end/ConsoleView.js b/WebCore/inspector/front-end/ConsoleView.js index 8521cb3..d1f347b 100644 --- a/WebCore/inspector/front-end/ConsoleView.js +++ b/WebCore/inspector/front-end/ConsoleView.js @@ -48,7 +48,7 @@ WebInspector.ConsoleView = function(drawer) this.promptElement.className = "source-code"; this.promptElement.addEventListener("keydown", this._promptKeyDown.bind(this), true); this.prompt = new WebInspector.TextPrompt(this.promptElement, this.completions.bind(this), ExpressionStopCharacters + "."); - WebInspector.settings.addEventListener("loaded", this._settingsLoaded, this); + WebInspector.applicationSettings.addEventListener("loaded", this._settingsLoaded, this); this.topGroup = new WebInspector.ConsoleGroup(null, 0); this.messagesElement.insertBefore(this.topGroup.element, this.promptElement); @@ -104,7 +104,7 @@ WebInspector.ConsoleView = function(drawer) WebInspector.ConsoleView.prototype = { _settingsLoaded: function() { - this.prompt.history = WebInspector.settings.consoleHistory; + this.prompt.history = WebInspector.applicationSettings.consoleHistory; }, _updateFilter: function(e) @@ -536,7 +536,7 @@ WebInspector.ConsoleView.prototype = { self.prompt.historyOffset = 0; self.prompt.text = ""; - WebInspector.settings.consoleHistory = self.prompt.history.slice(-30); + WebInspector.applicationSettings.consoleHistory = self.prompt.history.slice(-30); self.addMessage(new WebInspector.ConsoleCommandResult(result, exception, commandMessage)); } diff --git a/WebCore/inspector/front-end/ElementsPanel.js b/WebCore/inspector/front-end/ElementsPanel.js index c853440..55ba82d 100644 --- a/WebCore/inspector/front-end/ElementsPanel.js +++ b/WebCore/inspector/front-end/ElementsPanel.js @@ -240,7 +240,7 @@ WebInspector.ElementsPanel.prototype = { this._currentSearchResultIndex = 0; this._searchResults = []; - InjectedScriptAccess.getDefault().searchCanceled(function() {}); + InspectorBackend.searchCanceled(); }, performSearch: function(query) @@ -256,7 +256,7 @@ WebInspector.ElementsPanel.prototype = { this._matchesCountUpdateTimeout = null; this._searchQuery = query; - InjectedScriptAccess.getDefault().performSearch(whitespaceTrimmedQuery, false, function() {}); + InspectorBackend.performSearch(whitespaceTrimmedQuery); }, searchingForNodeWasEnabled: function() @@ -288,12 +288,11 @@ WebInspector.ElementsPanel.prototype = { addNodesToSearchResult: function(nodeIds) { - if (!nodeIds) + if (!nodeIds.length) return; - var nodeIdsArray = nodeIds.split(","); - for (var i = 0; i < nodeIdsArray.length; ++i) { - var nodeId = nodeIdsArray[i]; + for (var i = 0; i < nodeIds.length; ++i) { + var nodeId = nodeIds[i]; var node = WebInspector.domAgent.nodeForId(nodeId); if (!node) continue; diff --git a/WebCore/inspector/front-end/EventListenersSidebarPane.js b/WebCore/inspector/front-end/EventListenersSidebarPane.js index 045d29b..6798845 100644 --- a/WebCore/inspector/front-end/EventListenersSidebarPane.js +++ b/WebCore/inspector/front-end/EventListenersSidebarPane.js @@ -46,7 +46,7 @@ WebInspector.EventListenersSidebarPane = function() option.label = WebInspector.UIString("Selected Node Only"); this.settingsSelectElement.appendChild(option); - WebInspector.settings.addEventListener("loaded", this._settingsLoaded, this); + WebInspector.applicationSettings.addEventListener("loaded", this._settingsLoaded, this); this.settingsSelectElement.addEventListener("click", function(event) { event.stopPropagation() }, false); this.settingsSelectElement.addEventListener("change", this._changeSetting.bind(this), false); @@ -56,7 +56,7 @@ WebInspector.EventListenersSidebarPane = function() WebInspector.EventListenersSidebarPane.prototype = { _settingsLoaded: function() { - var filter = WebInspector.settings.eventListenersFilter; + var filter = WebInspector.applicationSettings.eventListenersFilter; if (filter === "all") this.settingsSelectElement[0].selected = true; if (filter === "selected") @@ -112,7 +112,7 @@ WebInspector.EventListenersSidebarPane.prototype = { _changeSetting: function(event) { var selectedOption = this.settingsSelectElement[this.settingsSelectElement.selectedIndex]; - WebInspector.settings.eventListenersFilter = selectedOption.value; + WebInspector.applicationSettings.eventListenersFilter = selectedOption.value; for (var i = 0; i < this.sections.length; ++i) this.sections[i].update(); @@ -142,7 +142,7 @@ WebInspector.EventListenersSection.prototype = { { // A Filtered Array simplifies when to create connectors var filteredEventListeners = this.eventListeners; - if (WebInspector.settings.eventListenersFilter === "selected") { + if (WebInspector.applicationSettings.eventListenersFilter === "selected") { filteredEventListeners = []; for (var i = 0; i < this.eventListeners.length; ++i) { var eventListener = this.eventListeners[i]; diff --git a/WebCore/inspector/front-end/HAREntry.js b/WebCore/inspector/front-end/HAREntry.js new file mode 100644 index 0000000..c06e64f --- /dev/null +++ b/WebCore/inspector/front-end/HAREntry.js @@ -0,0 +1,135 @@ +/* + * 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. + */ + +// See http://groups.google.com/group/http-archive-specification/web/har-1-2-spec +// for HAR specification. + +WebInspector.HAREntry = function(resource) +{ + this._resource = resource; +} + +WebInspector.HAREntry.prototype = { + build: function() + { + return { + pageref: this._resource.documentURL, + startedDateTime: new Date(this._resource.startTime * 1000), + time: this._toMilliseconds(this._resource.duration), + request: this._buildRequest(), + response: this._buildResponse(), + // cache: {...}, -- Not supproted yet. + timings: this._buildTimings() + }; + }, + + _buildRequest: function() + { + var res = { + method: this._resource.requestMethod, + url: this._resource.url, + // httpVersion: "HTTP/1.1" -- Not available. + // cookies: [] -- Not available. + headers: this._buildHeaders(this._resource.requestHeaders), + headersSize: -1, // Not available. + bodySize: -1 // Not available. + }; + if (this._resource.queryParameters) + res.queryString = this._buildParameters(this._resource.queryParameters); + if (this._resource.requestFormData) + res.postData = this._buildPostData(); + return res; + }, + + _buildResponse: function() + { + return { + status: this._resource.statusCode, + statusText: this._resource.statusText, + // "httpVersion": "HTTP/1.1" -- Not available. + // "cookies": [], -- Not available. + headers: this._buildHeaders(this._resource.responseHeaders), + content: this._buildContent(), + redirectURL: this._resource.responseHeaderValue("Location") || "", + headersSize: -1, // Not available. + bodySize: this._resource.resourceSize + }; + }, + + _buildContent: function() + { + return { + size: this._resource.resourceSize, + // compression: 0, -- Not available. + mimeType: this._resource.mimeType, + // text: -- Not available. + }; + }, + + _buildTimings: function() + { + return { + blocked: -1, // Not available. + dns: -1, // Not available. + connect: -1, // Not available. + send: -1, // Not available. + wait: this._toMilliseconds(this._resource.latency), + receive: this._toMilliseconds(this._resource.receiveDuration), + ssl: -1 // Not available. + }; + }, + + _buildHeaders: function(headers) + { + var result = []; + for (var name in headers) + result.push({ name: name, value: headers[name] }); + return result; + }, + + _buildPostData: function() + { + return { + mimeType: this._resource.requestHeaderValue("Content-Type"), + params: this._buildParameters(this._resource.formParameters), + text: this._resource.requestFormData + }; + }, + + _buildParameters: function(parameters) + { + return parameters.slice(); + }, + + _toMilliseconds: function(time) + { + return time === -1 ? -1 : Math.round(time * 1000); + } +}; diff --git a/WebCore/inspector/front-end/InjectedScript.js b/WebCore/inspector/front-end/InjectedScript.js index e3be6a3..e62a916 100644 --- a/WebCore/inspector/front-end/InjectedScript.js +++ b/WebCore/inspector/front-end/InjectedScript.js @@ -83,8 +83,6 @@ InjectedScript.releaseWrapperObjectGroup = function(objectGroupName) { // Called from within InspectorController on the 'inspected page' side. InjectedScript.reset = function() { - InjectedScript._searchResults = []; - InjectedScript._includedInSearchResultsPropertyName = "__includedInInspectorSearchResults"; } InjectedScript.reset(); @@ -211,7 +209,7 @@ InjectedScript.setPropertyValue = function(objectProxy, propertyName, expression return true; } catch(e) { try { - var result = inspectedWindow.eval("\"" + InjectedScript._escapeCharacters(expression, "\"") + "\""); + var result = inspectedWindow.eval("\"" + expression.replace(/"/g, "\\\"") + "\""); object[propertyName] = result; return true; } catch(e) { @@ -355,247 +353,6 @@ InjectedScript.getNodeId = function(node) return InjectedScriptHost.pushNodePathToFrontend(node, false, false); } -InjectedScript.performSearch = function(whitespaceTrimmedQuery, runSynchronously) -{ - // FIXME: Few things are missing here: - // 1) Search works with node granularity - number of matches within node is not calculated. - // 2) Search does not work outside main documents' domain - we need to use specific InjectedScript instances - // for other domains. - // 3) There is no need to push all search results to the front-end at a time, pushing next / previous result - // is sufficient. - var tagNameQuery = whitespaceTrimmedQuery; - var attributeNameQuery = whitespaceTrimmedQuery; - var startTagFound = (tagNameQuery.indexOf("<") === 0); - var endTagFound = (tagNameQuery.lastIndexOf(">") === (tagNameQuery.length - 1)); - - if (startTagFound || endTagFound) { - var tagNameQueryLength = tagNameQuery.length; - tagNameQuery = tagNameQuery.substring((startTagFound ? 1 : 0), (endTagFound ? (tagNameQueryLength - 1) : tagNameQueryLength)); - } - - // Check the tagNameQuery is it is a possibly valid tag name. - if (!/^[a-zA-Z0-9\-_:]+$/.test(tagNameQuery)) - tagNameQuery = null; - - // Check the attributeNameQuery is it is a possibly valid tag name. - if (!/^[a-zA-Z0-9\-_:]+$/.test(attributeNameQuery)) - attributeNameQuery = null; - - const escapedQuery = InjectedScript._escapeCharacters(whitespaceTrimmedQuery, "'"); - const escapedTagNameQuery = (tagNameQuery ? InjectedScript._escapeCharacters(tagNameQuery, "'") : null); - const escapedWhitespaceTrimmedQuery = InjectedScript._escapeCharacters(whitespaceTrimmedQuery, "'"); - const searchResultsProperty = InjectedScript._includedInSearchResultsPropertyName; - - function addNodesToResults(nodes, length, getItem) - { - if (!length) - return; - - var nodeIds = []; - for (var i = 0; i < length; ++i) { - var node = getItem.call(nodes, i); - // Skip this node if it already has the property. - if (searchResultsProperty in node) - continue; - - if (!InjectedScript._searchResults.length) { - InjectedScript._currentSearchResultIndex = 0; - } - - node[searchResultsProperty] = true; - InjectedScript._searchResults.push(node); - var nodeId = InjectedScriptHost.pushNodePathToFrontend(node, false, false); - nodeIds.push(nodeId); - } - InjectedScriptHost.addNodesToSearchResult(nodeIds.join(",")); - } - - function matchExactItems(doc) - { - matchExactId.call(this, doc); - matchExactClassNames.call(this, doc); - matchExactTagNames.call(this, doc); - matchExactAttributeNames.call(this, doc); - } - - function matchExactId(doc) - { - const result = doc.__proto__.getElementById.call(doc, whitespaceTrimmedQuery); - addNodesToResults.call(this, result, (result ? 1 : 0), function() { return this }); - } - - function matchExactClassNames(doc) - { - const result = doc.__proto__.getElementsByClassName.call(doc, whitespaceTrimmedQuery); - addNodesToResults.call(this, result, result.length, result.item); - } - - function matchExactTagNames(doc) - { - if (!tagNameQuery) - return; - const result = doc.__proto__.getElementsByTagName.call(doc, tagNameQuery); - addNodesToResults.call(this, result, result.length, result.item); - } - - function matchExactAttributeNames(doc) - { - if (!attributeNameQuery) - return; - const result = doc.__proto__.querySelectorAll.call(doc, "[" + attributeNameQuery + "]"); - addNodesToResults.call(this, result, result.length, result.item); - } - - function matchPartialTagNames(doc) - { - if (!tagNameQuery) - return; - const result = doc.__proto__.evaluate.call(doc, "//*[contains(name(), '" + escapedTagNameQuery + "')]", doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE); - addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem); - } - - function matchStartOfTagNames(doc) - { - if (!tagNameQuery) - return; - const result = doc.__proto__.evaluate.call(doc, "//*[starts-with(name(), '" + escapedTagNameQuery + "')]", doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE); - addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem); - } - - function matchPartialTagNamesAndAttributeValues(doc) - { - if (!tagNameQuery) { - matchPartialAttributeValues.call(this, doc); - return; - } - - const result = doc.__proto__.evaluate.call(doc, "//*[contains(name(), '" + escapedTagNameQuery + "') or contains(@*, '" + escapedQuery + "')]", doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE); - addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem); - } - - function matchPartialAttributeValues(doc) - { - const result = doc.__proto__.evaluate.call(doc, "//*[contains(@*, '" + escapedQuery + "')]", doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE); - addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem); - } - - function matchStyleSelector(doc) - { - const result = doc.__proto__.querySelectorAll.call(doc, whitespaceTrimmedQuery); - addNodesToResults.call(this, result, result.length, result.item); - } - - function matchPlainText(doc) - { - const result = doc.__proto__.evaluate.call(doc, "//text()[contains(., '" + escapedQuery + "')] | //comment()[contains(., '" + escapedQuery + "')]", doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE); - addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem); - } - - function matchXPathQuery(doc) - { - const result = doc.__proto__.evaluate.call(doc, whitespaceTrimmedQuery, doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE); - addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem); - } - - function finishedSearching() - { - // Remove the searchResultsProperty now that the search is finished. - for (var i = 0; i < InjectedScript._searchResults.length; ++i) - delete InjectedScript._searchResults[i][searchResultsProperty]; - } - - const mainFrameDocument = inspectedWindow.document; - const searchDocuments = [mainFrameDocument]; - var searchFunctions; - if (tagNameQuery && startTagFound && endTagFound) - searchFunctions = [matchExactTagNames, matchPlainText]; - else if (tagNameQuery && startTagFound) - searchFunctions = [matchStartOfTagNames, matchPlainText]; - else if (tagNameQuery && endTagFound) { - // FIXME: we should have a matchEndOfTagNames search function if endTagFound is true but not startTagFound. - // This requires ends-with() support in XPath, WebKit only supports starts-with() and contains(). - searchFunctions = [matchPartialTagNames, matchPlainText]; - } else if (whitespaceTrimmedQuery === "//*" || whitespaceTrimmedQuery === "*") { - // These queries will match every node. Matching everything isn't useful and can be slow for large pages, - // so limit the search functions list to plain text and attribute matching. - searchFunctions = [matchPartialAttributeValues, matchPlainText]; - } else - searchFunctions = [matchExactItems, matchStyleSelector, matchPartialTagNamesAndAttributeValues, matchPlainText, matchXPathQuery]; - - // Find all frames, iframes and object elements to search their documents. - const subdocumentResult = mainFrameDocument.querySelectorAll("iframe, frame, object"); - - for (var i = 0; i < subdocumentResult.length; ++i) { - var element = subdocumentResult.item(i); - if (element.contentDocument) - searchDocuments.push(element.contentDocument); - } - - const panel = InjectedScript; - var documentIndex = 0; - var searchFunctionIndex = 0; - var chunkIntervalIdentifier = null; - - // Split up the work into chunks so we don't block the UI thread while processing. - - function processChunk() - { - var searchDocument = searchDocuments[documentIndex]; - var searchFunction = searchFunctions[searchFunctionIndex]; - - if (++searchFunctionIndex > searchFunctions.length) { - searchFunction = searchFunctions[0]; - searchFunctionIndex = 0; - - if (++documentIndex > searchDocuments.length) { - if (panel._currentSearchChunkIntervalIdentifier === chunkIntervalIdentifier) - delete panel._currentSearchChunkIntervalIdentifier; - clearInterval(chunkIntervalIdentifier); - finishedSearching.call(panel); - return false; - } - - searchDocument = searchDocuments[documentIndex]; - } - - try { - searchFunction.call(panel, searchDocument); - } catch(err) { - // ignore any exceptions. the query might be malformed, but we allow that. - } - return true; - } - - if (runSynchronously) - while (processChunk()) {} - else { - processChunk(); - chunkIntervalIdentifier = setInterval(processChunk, 25); - InjectedScript._currentSearchChunkIntervalIdentifier = chunkIntervalIdentifier; - } - return true; -} - -InjectedScript.searchCanceled = function() -{ - if (InjectedScript._searchResults) { - const searchResultsProperty = InjectedScript._includedInSearchResultsPropertyName; - for (var i = 0; i < this._searchResults.length; ++i) { - var node = this._searchResults[i]; - - // Remove the searchResultsProperty since there might be an unfinished search. - delete node[searchResultsProperty]; - } - } - - if (InjectedScript._currentSearchChunkIntervalIdentifier) { - clearInterval(InjectedScript._currentSearchChunkIntervalIdentifier); - delete InjectedScript._currentSearchChunkIntervalIdentifier; - } - InjectedScript._searchResults = []; - return true; -} - InjectedScript.openInInspectedWindow = function(url) { // Don't call window.open on wrapper - popup blocker mutes it. @@ -1017,38 +774,15 @@ InjectedScript._className = function(obj) // Both of the methods below result in "Object" names on the foreign engine bindings. // I gave up and am using a check below to distinguish between the egine bingings. - if (typeof Document === "object") { - // JSC + if (jsEngine == "JSC") { var str = inspectedWindow.Object ? inspectedWindow.Object.prototype.toString.call(obj) : InjectedScript._toString(obj); return str.replace(/^\[object (.*)\]$/i, "$1"); + } else { + // V8 + if (typeof obj !== "object") + return "null"; + return obj.constructor.name || "Object"; } - // V8 - if (typeof obj !== "object") - return "null"; - return obj.constructor.name; -} - -InjectedScript._escapeCharacters = function(str, chars) -{ - var foundChar = false; - for (var i = 0; i < chars.length; ++i) { - if (str.indexOf(chars.charAt(i)) !== -1) { - foundChar = true; - break; - } - } - - if (!foundChar) - return str; - - var result = ""; - for (var i = 0; i < str.length; ++i) { - if (chars.indexOf(str.charAt(i)) !== -1) - result += "\\"; - result += str.charAt(i); - } - - return result; } return InjectedScript; diff --git a/WebCore/inspector/front-end/InjectedScriptAccess.js b/WebCore/inspector/front-end/InjectedScriptAccess.js index 2558267..c388213 100644 --- a/WebCore/inspector/front-end/InjectedScriptAccess.js +++ b/WebCore/inspector/front-end/InjectedScriptAccess.js @@ -71,29 +71,18 @@ InjectedScriptAccess._installHandler = function(methodName, async) // - Make sure last parameter of all the InjectedSriptAccess.* calls is a callback function. // We keep these sorted. InjectedScriptAccess._installHandler("addInspectedNode"); -InjectedScriptAccess._installHandler("addStyleSelector"); -InjectedScriptAccess._installHandler("applyStyleRuleText"); -InjectedScriptAccess._installHandler("applyStyleText"); InjectedScriptAccess._installHandler("clearConsoleMessages"); InjectedScriptAccess._installHandler("evaluate"); InjectedScriptAccess._installHandler("evaluateInCallFrame"); InjectedScriptAccess._installHandler("getCompletions"); -InjectedScriptAccess._installHandler("getComputedStyle"); -InjectedScriptAccess._installHandler("getInlineStyle"); InjectedScriptAccess._installHandler("getNodePropertyValue"); InjectedScriptAccess._installHandler("getProperties"); InjectedScriptAccess._installHandler("getPrototypes"); -InjectedScriptAccess._installHandler("getStyles"); InjectedScriptAccess._installHandler("openInInspectedWindow"); -InjectedScriptAccess._installHandler("performSearch"); InjectedScriptAccess._installHandler("pushNodeToFrontend"); InjectedScriptAccess._installHandler("nodeByPath"); -InjectedScriptAccess._installHandler("searchCanceled"); InjectedScriptAccess._installHandler("setOuterHTML"); InjectedScriptAccess._installHandler("setPropertyValue"); -InjectedScriptAccess._installHandler("setStyleProperty"); -InjectedScriptAccess._installHandler("setStyleText"); -InjectedScriptAccess._installHandler("toggleStyleEnabled"); InjectedScriptAccess._installHandler("evaluateOnSelf"); // Some methods can't run synchronously even on the injected script side (such as DB transactions). diff --git a/WebCore/inspector/front-end/InspectorBackendStub.js b/WebCore/inspector/front-end/InspectorBackendStub.js index 4670af1..492bf87 100644 --- a/WebCore/inspector/front-end/InspectorBackendStub.js +++ b/WebCore/inspector/front-end/InspectorBackendStub.js @@ -185,6 +185,16 @@ WebInspector.InspectorBackendStub.prototype = { WebInspector.updatePauseOnExceptionsState(value); }, + editScriptSource: function() + { + WebInspector.didEditScriptSource(callId, false); + }, + + getScriptSource: function(callId, sourceID) + { + WebInspector.didGetScriptSource(callId, null); + }, + resumeDebugger: function() { }, @@ -237,7 +247,11 @@ WebInspector.InspectorBackendStub.prototype = { { }, - saveFrontendSettings: function() + saveApplicationSettings: function() + { + }, + + saveSessionSettings: function() { }, @@ -259,6 +273,14 @@ WebInspector.InspectorBackendStub.prototype = { removeAllScriptsToEvaluateOnLoad: function() { + }, + + performSearch: function() + { + }, + + searchCanceled: function() + { } } diff --git a/WebCore/inspector/front-end/KeyboardShortcut.js b/WebCore/inspector/front-end/KeyboardShortcut.js index 4e7c88a..2bcf3d1 100644 --- a/WebCore/inspector/front-end/KeyboardShortcut.js +++ b/WebCore/inspector/front-end/KeyboardShortcut.js @@ -50,14 +50,14 @@ WebInspector.KeyboardShortcut.Modifiers = { WebInspector.KeyboardShortcut.Keys = { Backspace: { code: 8, name: "\u21a4" }, - Tab: { code: 9, name: "<Tab>" }, - Enter: { code: 13, name: "<Enter>" }, - Esc: { code: 27, name: "<Esc>" }, + Tab: { code: 9, name: { mac: "\u21e5", other: "<Tab>" } }, + Enter: { code: 13, name: { mac: "\u21a9", other: "<Enter>" } }, + Esc: { code: 27, name: { mac: "\u238b", other: "<Esc>" } }, Space: { code: 32, name: "<Space>" }, - PageUp: { code: 33, name: "<PageUp>" }, // also NUM_NORTH_EAST - PageDown: { code: 34, name: "<PageDown>" }, // also NUM_SOUTH_EAST - End: { code: 35, name: "<End>" }, // also NUM_SOUTH_WEST - Home: { code: 36, name: "<Home>" }, // also NUM_NORTH_WEST + PageUp: { code: 33, name: { mac: "\u21de", other: "<PageUp>" } }, // also NUM_NORTH_EAST + PageDown: { code: 34, name: { mac: "\u21df", other: "<PageDown>" } }, // also NUM_SOUTH_EAST + End: { code: 35, name: { mac: "\u2197", other: "<End>" } }, // also NUM_SOUTH_WEST + Home: { code: 36, name: { mac: "\u2196", other: "<Home>" } }, // also NUM_NORTH_WEST Left: { code: 37, name: "\u2190" }, // also NUM_WEST Up: { code: 38, name: "\u2191" }, // also NUM_NORTH Right: { code: 39, name: "\u2192" }, // also NUM_EAST @@ -130,7 +130,16 @@ WebInspector.KeyboardShortcut.makeDescriptor = function(key, optModifiers) WebInspector.KeyboardShortcut.shortcutToString = function(key, modifiers) { - return WebInspector.KeyboardShortcut._modifiersToString(modifiers) + (typeof key === "string" ? key.toUpperCase() : key.name); + return WebInspector.KeyboardShortcut._modifiersToString(modifiers) + WebInspector.KeyboardShortcut._keyName(key); +} + +WebInspector.KeyboardShortcut._keyName = function(key) +{ + if (typeof key === "string") + return key.toUpperCase(); + if (typeof key.name === "string") + return key.name; + return key.name[WebInspector.platform] || key.name.other; } WebInspector.KeyboardShortcut._makeKeyFromCodeAndModifiers = function(keyCode, modifiers) @@ -143,11 +152,12 @@ WebInspector.KeyboardShortcut._modifiersToString = function(modifiers) const cmdKey = "\u2318"; const optKey = "\u2325"; const shiftKey = "\u21e7"; + const ctrlKey = "\u2303"; var isMac = WebInspector.isMac(); var res = ""; if (modifiers & WebInspector.KeyboardShortcut.Modifiers.Ctrl) - res += "<Ctrl> + "; + res += isMac ? ctrlKey : "<Ctrl> + "; if (modifiers & WebInspector.KeyboardShortcut.Modifiers.Alt) res += isMac ? optKey : "<Alt> + "; if (modifiers & WebInspector.KeyboardShortcut.Modifiers.Shift) diff --git a/WebCore/inspector/front-end/Resource.js b/WebCore/inspector/front-end/Resource.js index 279e3af..2ae23a0 100644 --- a/WebCore/inspector/front-end/Resource.js +++ b/WebCore/inspector/front-end/Resource.js @@ -33,7 +33,6 @@ WebInspector.Resource = function(identifier, url) this._startTime = -1; this._endTime = -1; this._requestMethod = ""; - this._requestFormData = ""; this._category = WebInspector.resourceCategories.other; } @@ -88,7 +87,7 @@ WebInspector.Resource.prototype = { var oldURL = this._url; this._url = x; - + delete this._parsedQueryParameters; // FIXME: We should make the WebInspector object listen for the "url changed" event. // Then resourceURLChanged can be removed. WebInspector.resourceURLChanged(this, oldURL); @@ -215,6 +214,13 @@ WebInspector.Resource.prototype = { return this._responseReceivedTime - this._startTime; }, + get receiveDuration() + { + if (this._endTime === -1 || this._responseReceivedTime === -1) + return -1; + return this._endTime - this._responseReceivedTime; + }, + get resourceSize() { return this._resourceSize || 0; @@ -384,6 +390,22 @@ WebInspector.Resource.prototype = { return this._sortedRequestHeaders; }, + requestHeaderValue: function(headerName) + { + return this._headerValue(this.requestHeaders, headerName); + }, + + get requestFormData() + { + return this._requestFormData; + }, + + set requestFormData(x) + { + this._requestFormData = x; + delete this._parsedFormParameters; + }, + get responseHeaders() { if (this._responseHeaders === undefined) @@ -415,6 +437,61 @@ WebInspector.Resource.prototype = { return this._sortedResponseHeaders; }, + responseHeaderValue: function(headerName) + { + return this._headerValue(this.responseHeaders, headerName); + }, + + get queryParameters() + { + if (this._parsedQueryParameters) + return this._parsedQueryParameters; + var queryString = this.url.split("?", 2)[1]; + if (!queryString) + return; + this._parsedQueryParameters = this._parseParameters(queryString); + return this._parsedQueryParameters; + }, + + get formParameters() + { + if (this._parsedFormParameters) + return this._parsedFormParameters; + if (!this.requestFormData) + return; + var requestContentType = this.requestHeaderValue("Content-Type"); + if (!requestContentType || !requestContentType.match(/^application\/x-www-form-urlencoded\s*(;.*)?$/i)) + return; + this._parsedFormParameters = this._parseParameters(this.requestFormData); + return this._parsedFormParameters; + }, + + _parseParameters: function(queryString) + { + function parseNameValue(pair) + { + var parameter = {}; + var splitPair = pair.split("=", 2); + + parameter.name = splitPair[0]; + if (splitPair.length === 1) + parameter.value = ""; + else + parameter.value = splitPair[1]; + return parameter; + } + return queryString.split("&").map(parseNameValue); + }, + + _headerValue: function(headers, headerName) + { + headerName = headerName.toLowerCase(); + for (var header in headers) { + if (header.toLowerCase() === headerName) + return headers[header]; + } + }, + get scripts() { if (!("_scripts" in this)) diff --git a/WebCore/inspector/front-end/ResourceView.js b/WebCore/inspector/front-end/ResourceView.js index ffcb9b9..bfd1576 100644 --- a/WebCore/inspector/front-end/ResourceView.js +++ b/WebCore/inspector/front-end/ResourceView.js @@ -143,7 +143,7 @@ WebInspector.ResourceView.prototype = { _selectTab: function() { if (this._headersVisible) { - if (!this.hasContentTab() || WebInspector.settings.resourceViewTab === "headers") + if (!this.hasContentTab() || WebInspector.applicationSettings.resourceViewTab === "headers") this._selectHeadersTab(); else this.selectContentTab(); @@ -154,14 +154,14 @@ WebInspector.ResourceView.prototype = { _selectHeadersTab: function(updatePrefs) { if (updatePrefs) - WebInspector.settings.resourceViewTab = "headers"; + WebInspector.applicationSettings.resourceViewTab = "headers"; this.tabbedPane.selectTabById("headers"); }, selectContentTab: function(updatePrefs) { if (updatePrefs) - WebInspector.settings.resourceViewTab = "content"; + WebInspector.applicationSettings.resourceViewTab = "content"; this._innerSelectContentTab(); }, @@ -187,17 +187,10 @@ WebInspector.ResourceView.prototype = { _refreshQueryString: function() { - var url = this.resource.url; - var hasQueryString = url.indexOf("?") >= 0; - - if (!hasQueryString) { - this.queryStringTreeElement.hidden = true; - return; - } - - this.queryStringTreeElement.hidden = false; - var parmString = url.split("?", 2)[1]; - this._refreshParms(WebInspector.UIString("Query String Parameters"), parmString, this.queryStringTreeElement); + var queryParameters = this.resource.queryParameters; + this.queryStringTreeElement.hidden = !queryParameters; + if (queryParameters) + this._refreshParms(WebInspector.UIString("Query String Parameters"), queryParameters, this.queryStringTreeElement); }, _refreshFormData: function() @@ -205,21 +198,17 @@ WebInspector.ResourceView.prototype = { this.formDataTreeElement.hidden = true; this.requestPayloadTreeElement.hidden = true; - var isFormData = this.resource.requestFormData; - if (!isFormData) + var formData = this.resource.requestFormData; + if (!formData) return; - var isFormEncoded = false; - var requestContentType = this._getHeaderValue(this.resource.requestHeaders, "Content-Type"); - if (requestContentType && requestContentType.match(/^application\/x-www-form-urlencoded\s*(;.*)?$/i)) - isFormEncoded = true; - - if (isFormEncoded) { + var formParameters = this.resource.formParameters; + if (formParameters) { this.formDataTreeElement.hidden = false; - this._refreshParms(WebInspector.UIString("Form Data"), this.resource.requestFormData, this.formDataTreeElement); + this._refreshParms(WebInspector.UIString("Form Data"), formParameters, this.formDataTreeElement); } else { this.requestPayloadTreeElement.hidden = false; - this._refreshRequestPayload(this.resource.requestFormData); + this._refreshRequestPayload(formData); } }, @@ -233,24 +222,15 @@ WebInspector.ResourceView.prototype = { this.requestPayloadTreeElement.appendChild(parmTreeElement); }, - _refreshParms: function(title, parmString, parmsTreeElement) + _refreshParms: function(title, parms, parmsTreeElement) { - var parms = parmString.split("&"); - for (var i = 0; i < parms.length; ++i) { - var parm = parms[i]; - parm = parm.split("=", 2); - if (parm.length == 1) - parm.push(""); - parms[i] = parm; - } - parmsTreeElement.removeChildren(); parmsTreeElement.title = title + "<span class=\"header-count\">" + WebInspector.UIString(" (%d)", parms.length) + "</span>"; for (var i = 0; i < parms.length; ++i) { - var key = parms[i][0]; - var value = parms[i][1]; + var name = parms[i].name; + var value = parms[i].value; var errorDecoding = false; if (this._decodeRequestParameters) { @@ -269,7 +249,7 @@ WebInspector.ResourceView.prototype = { if (errorDecoding) valueEscaped += " <span class=\"error-message\">" + WebInspector.UIString("(unable to decode value)").escapeHTML() + "</span>"; - var title = "<div class=\"header-name\">" + key.escapeHTML() + ":</div>"; + var title = "<div class=\"header-name\">" + name.escapeHTML() + ":</div>"; title += "<div class=\"header-value source-code\">" + valueEscaped + "</div>"; var parmTreeElement = new TreeElement(title, null, false); diff --git a/WebCore/inspector/front-end/ResourcesPanel.js b/WebCore/inspector/front-end/ResourcesPanel.js index b2dfa15..ef6aa26 100644 --- a/WebCore/inspector/front-end/ResourcesPanel.js +++ b/WebCore/inspector/front-end/ResourcesPanel.js @@ -151,7 +151,7 @@ WebInspector.ResourcesPanel.prototype = { { this.largerResourcesButton = new WebInspector.StatusBarButton(WebInspector.UIString("Use small resource rows."), "resources-larger-resources-status-bar-item"); - WebInspector.settings.addEventListener("loaded", this._settingsLoaded, this); + WebInspector.applicationSettings.addEventListener("loaded", this._settingsLoaded, this); this.largerResourcesButton.addEventListener("click", this._toggleLargerResources.bind(this), false); this.sortingSelectElement = document.createElement("select"); this.sortingSelectElement.className = "status-bar-item"; @@ -160,9 +160,9 @@ WebInspector.ResourcesPanel.prototype = { _settingsLoaded: function() { - this.largerResourcesButton.toggled = WebInspector.settings.resourcesLargeRows; - if (!WebInspector.settings.resourcesLargeRows) - this._setLargerResources(WebInspector.settings.resourcesLargeRows); + this.largerResourcesButton.toggled = WebInspector.applicationSettings.resourcesLargeRows; + if (!WebInspector.applicationSettings.resourcesLargeRows) + this._setLargerResources(WebInspector.applicationSettings.resourcesLargeRows); }, get mainResourceLoadTime() @@ -637,7 +637,7 @@ WebInspector.ResourcesPanel.prototype = { if (!this.itemsTreeElement._childrenListNode) return; - WebInspector.settings.resourcesLargeRows = !WebInspector.settings.resourcesLargeRows; + WebInspector.applicationSettings.resourcesLargeRows = !WebInspector.applicationSettings.resourcesLargeRows; this._setLargerResources(this.itemsTreeElement.smallChildren); }, diff --git a/WebCore/inspector/front-end/Script.js b/WebCore/inspector/front-end/Script.js index 79004f3..42d6850 100644 --- a/WebCore/inspector/front-end/Script.js +++ b/WebCore/inspector/front-end/Script.js @@ -23,7 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -WebInspector.Script = function(sourceID, sourceURL, source, startingLine, errorLine, errorMessage) +WebInspector.Script = function(sourceID, sourceURL, source, startingLine, errorLine, errorMessage, worldType) { this.sourceID = sourceID; this.sourceURL = sourceURL; @@ -31,6 +31,7 @@ WebInspector.Script = function(sourceID, sourceURL, source, startingLine, errorL this.startingLine = startingLine; this.errorLine = errorLine; this.errorMessage = errorMessage; + this.worldType = worldType; // if no URL, look for "//@ sourceURL=" decorator // note that this sourceURL comment decorator is behavior that FireBug added @@ -46,6 +47,16 @@ WebInspector.Script = function(sourceID, sourceURL, source, startingLine, errorL } } +WebInspector.Script.WorldType = { + MAIN_WORLD: 0, + EXTENSIONS_WORLD: 1 +} + +WebInspector.Script.WorldType = { + MAIN_WORLD: 0, + EXTENSIONS_WORLD: 1 +} + WebInspector.Script.prototype = { get linesCount() { diff --git a/WebCore/inspector/front-end/ScriptView.js b/WebCore/inspector/front-end/ScriptView.js index 1a24211..fb0bb4b 100644 --- a/WebCore/inspector/front-end/ScriptView.js +++ b/WebCore/inspector/front-end/ScriptView.js @@ -34,7 +34,7 @@ WebInspector.ScriptView = function(script) this._frameNeedsSetup = true; this._sourceFrameSetup = false; var canEditScripts = WebInspector.panels.scripts.canEditScripts(); - this.sourceFrame = new WebInspector.SourceFrame(this.element, this._addBreakpoint.bind(this), this._removeBreakpoint.bind(this), canEditScripts ? this._editLine.bind(this) : null); + this.sourceFrame = new WebInspector.SourceFrame(this.element, this._addBreakpoint.bind(this), this._removeBreakpoint.bind(this), canEditScripts ? this._editLine.bind(this) : null, this._continueToLine.bind(this)); } WebInspector.ScriptView.prototype = { @@ -50,12 +50,28 @@ WebInspector.ScriptView.prototype = { { if (!this._frameNeedsSetup) return; + delete this._frameNeedsSetup; this.attach(); + if (this.script.source) + this._sourceFrameSetupFinished(); + else { + var callbackId = WebInspector.Callback.wrap(this._didGetScriptSource.bind(this)) + InspectorBackend.getScriptSource(callbackId, this.script.sourceID); + } + }, + + _didGetScriptSource: function(source) + { + this.script.source = source || WebInspector.UIString("<source is not available>"); + this._sourceFrameSetupFinished(); + }, + + _sourceFrameSetupFinished: function() + { this.sourceFrame.setContent("text/javascript", this._prependWhitespace(this.script.source)); this._sourceFrameSetup = true; - delete this._frameNeedsSetup; }, _prependWhitespace: function(content) { @@ -71,6 +87,13 @@ WebInspector.ScriptView.prototype = { document.getElementById("script-resource-views").appendChild(this.element); }, + _continueToLine: function(line) + { + var scriptsPanel = WebInspector.panels.scripts; + if (scriptsPanel) + scriptsPanel.continueToLine(this.script.sourceID, line); + }, + _addBreakpoint: function(line) { WebInspector.breakpointManager.addBreakpoint(this.script.sourceID, this.script.sourceURL, line, true, ""); @@ -99,10 +122,11 @@ WebInspector.ScriptView.prototype = { showingFirstSearchResult: WebInspector.SourceView.prototype.showingFirstSearchResult, showingLastSearchResult: WebInspector.SourceView.prototype.showingLastSearchResult, _jumpToSearchResult: WebInspector.SourceView.prototype._jumpToSearchResult, - _sourceFrameSetupFinished: WebInspector.SourceView.prototype._sourceFrameSetupFinished, _removeBreakpoint: WebInspector.SourceView.prototype._removeBreakpoint, _editLine: WebInspector.SourceView.prototype._editLine, resize: WebInspector.SourceView.prototype.resize } WebInspector.ScriptView.prototype.__proto__ = WebInspector.View.prototype; + +WebInspector.didGetScriptSource = WebInspector.Callback.processCallback; diff --git a/WebCore/inspector/front-end/ScriptsPanel.js b/WebCore/inspector/front-end/ScriptsPanel.js index 755daff..4504d57 100644 --- a/WebCore/inspector/front-end/ScriptsPanel.js +++ b/WebCore/inspector/front-end/ScriptsPanel.js @@ -241,9 +241,9 @@ WebInspector.ScriptsPanel.prototype = { return this.toggleBreakpointsButton.toggled; }, - addScript: function(sourceID, sourceURL, source, startingLine, errorLine, errorMessage) + addScript: function(sourceID, sourceURL, source, startingLine, errorLine, errorMessage, scriptWorldType) { - var script = new WebInspector.Script(sourceID, sourceURL, source, startingLine, errorLine, errorMessage); + var script = new WebInspector.Script(sourceID, sourceURL, source, startingLine, errorLine, errorMessage, scriptWorldType); this._sourceIDMap[sourceID] = script; var resource = WebInspector.resourceURLMap[sourceURL]; @@ -264,6 +264,13 @@ WebInspector.ScriptsPanel.prototype = { this._addScriptToFilesMenu(script); }, + continueToLine: function(sourceID, line) + { + WebInspector.breakpointManager.setOneTimeBreakpoint(sourceID, line); + if (this.paused) + this._togglePause(); + }, + _resourceLoadingFinished: function(e) { var resource = e.target; @@ -334,10 +341,10 @@ WebInspector.ScriptsPanel.prototype = { canEditScripts: function() { - return !!InspectorBackend.editScriptSource; + return Preferences.canEditScriptSource; }, - editScriptSource: function(sourceID, newContent, line, linesCountToShift, callback) + editScriptSource: function(sourceID, newContent, line, linesCountToShift, commitEditingCallback, cancelEditingCallback) { if (!this.canEditScripts()) return; @@ -347,12 +354,19 @@ WebInspector.ScriptsPanel.prototype = { for (var i = 0; i < breakpoints.length; ++i) WebInspector.breakpointManager.removeBreakpoint(breakpoints[i]); - function mycallback(newBody) + function mycallback(success, newBodyOrErrorMessage, callFrames) { - callback(newBody); + if (success) { + commitEditingCallback(newBodyOrErrorMessage); + if (callFrames && callFrames.length) + this.debuggerPaused(callFrames); + } else { + cancelEditingCallback(); + WebInspector.log(newBodyOrErrorMessage, WebInspector.ConsoleMessage.MessageLevel.Warning); + } for (var i = 0; i < breakpoints.length; ++i) { var breakpoint = breakpoints[i]; - if (breakpoint.line >= line) + if (success && breakpoint.line >= line) breakpoint.line += linesCountToShift; WebInspector.breakpointManager.addBreakpoint(breakpoint); } @@ -400,6 +414,7 @@ WebInspector.ScriptsPanel.prototype = { debuggerPaused: function(callFrames) { + WebInspector.breakpointManager.removeOneTimeBreakpoint(); this._paused = true; this._waitingToPause = false; this._stepping = false; @@ -624,7 +639,7 @@ WebInspector.ScriptsPanel.prototype = { var url = scriptOrResource.url || scriptOrResource.sourceURL; if (url && !options.initialLoad) - WebInspector.settings.lastViewedScriptFile = url; + WebInspector.applicationSettings.lastViewedScriptFile = url; if (!options.fromBackForwardAction) { var oldIndex = this._currentBackForwardIndex; @@ -725,10 +740,13 @@ WebInspector.ScriptsPanel.prototype = { else { // if not first item, check to see if this was the last viewed var url = option.representedObject.url || option.representedObject.sourceURL; - var lastURL = WebInspector.settings.lastViewedScriptFile; + var lastURL = WebInspector.applicationSettings.lastViewedScriptFile; if (url && url === lastURL) this._showScriptOrResource(option.representedObject, {initialLoad: true}); } + + if (script.worldType === WebInspector.Script.WorldType.EXTENSIONS_WORLD) + script.filesSelectOption.addStyleClass("extension-script"); }, _clearCurrentExecutionLine: function() diff --git a/WebCore/inspector/front-end/Settings.js b/WebCore/inspector/front-end/Settings.js index b9b5f75..c7fc5a9 100644 --- a/WebCore/inspector/front-end/Settings.js +++ b/WebCore/inspector/front-end/Settings.js @@ -30,6 +30,7 @@ var Preferences = { + canEditScriptSource: false, maxInlineTextChildLength: 80, minConsoleHeight: 75, minSidebarWidth: 100, @@ -44,16 +45,39 @@ var Preferences = { auditsPanelEnabled: true } -WebInspector.populateFrontendSettings = function(settingsString) +WebInspector.populateApplicationSettings = function(settingsString) { - WebInspector.settings._load(settingsString); + WebInspector.applicationSettings._load(settingsString); + WebInspector.applicationSettings._installSetting("eventListenersFilter", "event-listeners-filter", "all"); + WebInspector.applicationSettings._installSetting("colorFormat", "color-format", "hex"); + WebInspector.applicationSettings._installSetting("resourcesLargeRows", "resources-large-rows", true); + WebInspector.applicationSettings._installSetting("watchExpressions", "watch-expressions", []); + WebInspector.applicationSettings._installSetting("lastViewedScriptFile", "last-viewed-script-file"); + WebInspector.applicationSettings._installSetting("showInheritedComputedStyleProperties", "show-inherited-computed-style-properties", false); + WebInspector.applicationSettings._installSetting("showUserAgentStyles", "show-user-agent-styles", true); + WebInspector.applicationSettings._installSetting("resourceViewTab", "resource-view-tab", "content"); + WebInspector.applicationSettings._installSetting("consoleHistory", "console-history", []); + WebInspector.applicationSettings.dispatchEventToListeners("loaded"); } -WebInspector.Settings = function() +WebInspector.populateSessionSettings = function(settingsString) { + WebInspector.sessionSettings._load(settingsString); + WebInspector.sessionSettings.dispatchEventToListeners("loaded"); +} + +WebInspector.Settings = function(sessionScope) +{ + this._sessionScope = sessionScope; } WebInspector.Settings.prototype = { + reset: function() + { + this._store = {}; + this.dispatchEventToListeners("loaded"); + }, + _load: function(settingsString) { try { @@ -62,17 +86,6 @@ WebInspector.Settings.prototype = { // May fail; this._store = {}; } - - this._installSetting("eventListenersFilter", "event-listeners-filter", "all"); - this._installSetting("colorFormat", "color-format", "hex"); - this._installSetting("resourcesLargeRows", "resources-large-rows", true); - this._installSetting("watchExpressions", "watch-expressions", []); - 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", "content"); - this._installSetting("consoleHistory", "console-history", []); - this.dispatchEventToListeners("loaded"); }, _installSetting: function(name, propertyName, defaultValue) @@ -93,7 +106,11 @@ WebInspector.Settings.prototype = { { this._store[propertyName] = newValue; try { - InspectorBackend.saveFrontendSettings(JSON.stringify(this._store)); + var store = JSON.stringify(this._store); + if (this._sessionScope) + InspectorBackend.saveSessionSettings(store); + else + InspectorBackend.saveApplicationSettings(store); } catch (e) { // May fail; } diff --git a/WebCore/inspector/front-end/SourceFrame.js b/WebCore/inspector/front-end/SourceFrame.js index 5e529ae..f221086 100644 --- a/WebCore/inspector/front-end/SourceFrame.js +++ b/WebCore/inspector/front-end/SourceFrame.js @@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -WebInspector.SourceFrame = function(parentElement, addBreakpointDelegate, removeBreakpointDelegate, editDelegate) +WebInspector.SourceFrame = function(parentElement, addBreakpointDelegate, removeBreakpointDelegate, editDelegate, continueToHereDelegate) { this._parentElement = parentElement; @@ -42,6 +42,7 @@ WebInspector.SourceFrame = function(parentElement, addBreakpointDelegate, remove this._loaded = false; + this._continueToHereDelegate = continueToHereDelegate; this._addBreakpointDelegate = addBreakpointDelegate; this._removeBreakpointDelegate = removeBreakpointDelegate; this._editDelegate = editDelegate; @@ -409,9 +410,14 @@ WebInspector.SourceFrame.prototype = { return; var row = target.parentElement; + if (!WebInspector.panels.scripts) + return; + var lineNumber = row.lineNumber; var contextMenu = new WebInspector.ContextMenu(); + contextMenu.appendItem(WebInspector.UIString("Continue to Here"), this._continueToHereDelegate.bind(this, lineNumber + 1)); + var breakpoint = this._textModel.getAttribute(lineNumber, "breakpoint"); if (!breakpoint) { // This row doesn't have a breakpoint: We want to show Add Breakpoint and Add and Edit Breakpoint. diff --git a/WebCore/inspector/front-end/SourceView.js b/WebCore/inspector/front-end/SourceView.js index f01c241..e4d7fed 100644 --- a/WebCore/inspector/front-end/SourceView.js +++ b/WebCore/inspector/front-end/SourceView.js @@ -32,8 +32,8 @@ WebInspector.SourceView = function(resource) this.element.addStyleClass("source"); - var canEditScripts = WebInspector.panels.scripts.canEditScripts() && resource.type === WebInspector.Resource.Type.Script; - this.sourceFrame = new WebInspector.SourceFrame(this.contentElement, this._addBreakpoint.bind(this), this._removeBreakpoint.bind(this), canEditScripts ? this._editLine.bind(this) : null); + var canEditScripts = WebInspector.panels.scripts && WebInspector.panels.scripts.canEditScripts() && resource.type === WebInspector.Resource.Type.Script; + this.sourceFrame = new WebInspector.SourceFrame(this.contentElement, this._addBreakpoint.bind(this), this._removeBreakpoint.bind(this), canEditScripts ? this._editLine.bind(this) : null, this._continueToLine.bind(this)); resource.addEventListener("finished", this._resourceLoadingFinished, this); this._frameNeedsSetup = true; } @@ -115,6 +115,15 @@ WebInspector.SourceView.prototype = { this.resource.removeEventListener("finished", this._resourceLoadingFinished, this); }, + _continueToLine: function(line) + { + var scriptsPanel = WebInspector.panels.scripts; + if (scriptsPanel) { + var sourceID = this._sourceIDForLine(line); + scriptsPanel.continueToLine(sourceID, line); + } + }, + _addBreakpoint: function(line) { var sourceID = this._sourceIDForLine(line); @@ -126,7 +135,7 @@ WebInspector.SourceView.prototype = { WebInspector.breakpointManager.removeBreakpoint(breakpoint); }, - _editLine: function(line, newContent) + _editLine: function(line, newContent, cancelEditingCallback) { var lines = []; var textModel = this.sourceFrame.textModel; @@ -138,7 +147,7 @@ WebInspector.SourceView.prototype = { } var linesCountToShift = newContent.split("\n").length - 1; - WebInspector.panels.scripts.editScriptSource(this._sourceIDForLine(line), lines.join("\n"), line, linesCountToShift, this._editLineComplete.bind(this)); + WebInspector.panels.scripts.editScriptSource(this._sourceIDForLine(line), lines.join("\n"), line, linesCountToShift, this._editLineComplete.bind(this), cancelEditingCallback); }, _editLineComplete: function(newBody) @@ -202,7 +211,7 @@ WebInspector.SourceView.prototype = { this.localContentElement = document.createElement("div"); this.localContentElement.className = "resource-view-content"; this.tabbedPane.appendTab("local", WebInspector.UIString("Local"), this.localContentElement, this.selectLocalContentTab.bind(this)); - this.localSourceFrame = new WebInspector.SourceFrame(this.localContentElement, this._addBreakpoint.bind(this), this._removeBreakpoint.bind(this)); + this.localSourceFrame = new WebInspector.SourceFrame(this.localContentElement, this._addBreakpoint.bind(this), this._removeBreakpoint.bind(this), null, this._continueToLine.bind(this)); } this.localSourceFrame.setContent(mimeType, content, ""); }, diff --git a/WebCore/inspector/front-end/StylesSidebarPane.js b/WebCore/inspector/front-end/StylesSidebarPane.js index 35d25d4..18b7f0f 100644 --- a/WebCore/inspector/front-end/StylesSidebarPane.js +++ b/WebCore/inspector/front-end/StylesSidebarPane.js @@ -60,7 +60,7 @@ WebInspector.StylesSidebarPane = function(computedStylePane) 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.applicationSettings.addEventListener("loaded", this._settingsLoaded, this); this.titleElement.appendChild(this.settingsSelectElement); this._computedStylePane = computedStylePane; @@ -96,7 +96,7 @@ WebInspector.StylesSidebarPane.PseudoIdNames = [ WebInspector.StylesSidebarPane.prototype = { _settingsLoaded: function() { - var format = WebInspector.settings.colorFormat; + var format = WebInspector.applicationSettings.colorFormat; if (format === "hex") this.settingsSelectElement[0].selected = true; if (format === "rgb") @@ -133,22 +133,22 @@ WebInspector.StylesSidebarPane.prototype = { return; } - function getStylesCallback(styles) + function stylesCallback(styles) { if (styles) this._rebuildUpdate(node, styles); } - function getComputedStyleCallback(computedStyle) + function computedStyleCallback(computedStyle) { if (computedStyle) this._refreshUpdate(node, computedStyle, editedSection); }; if (refresh) - InspectorBackend.getComputedStyle(WebInspector.Callback.wrap(getComputedStyleCallback.bind(this)), node.id); + WebInspector.cssModel.getComputedStyleAsync(node.id, computedStyleCallback.bind(this)); else - InspectorBackend.getStyles(WebInspector.Callback.wrap(getStylesCallback.bind(this)), node.id, !WebInspector.settings.showUserAgentStyles); + WebInspector.cssModel.getStylesAsync(node.id, !WebInspector.applicationSettings.showUserAgentStyles, stylesCallback.bind(this)); }, _refreshUpdate: function(node, computedStyle, editedSection) @@ -466,7 +466,7 @@ WebInspector.StylesSidebarPane.prototype = { { for (var i = 0; i < properties.length; ++i) { var property = properties[i]; - // Does this style contain non-overriden inherited property? + // Does this style contain non-overridden inherited property? if (property.name in WebInspector.StylesSidebarPane.InheritedProperties) return true; } @@ -482,7 +482,7 @@ WebInspector.StylesSidebarPane.prototype = { // Select the correct color format setting again, since it needs to be selected. var selectedIndex = 0; for (var i = 0; i < options.length; ++i) { - if (options[i].value === WebInspector.settings.colorFormat) { + if (options[i].value === WebInspector.applicationSettings.colorFormat) { selectedIndex = i; break; } @@ -494,7 +494,7 @@ WebInspector.StylesSidebarPane.prototype = { _changeColorFormat: function(event) { var selectedOption = this.settingsSelectElement[this.settingsSelectElement.selectedIndex]; - WebInspector.settings.colorFormat = selectedOption.value; + WebInspector.applicationSettings.colorFormat = selectedOption.value; for (var pseudoId in this.sections) { var sections = this.sections[pseudoId]; @@ -581,18 +581,18 @@ WebInspector.ComputedStyleSidebarPane = function() function settingsLoaded() { - if (WebInspector.settings.showInheritedComputedStyleProperties) { + if (WebInspector.applicationSettings.showInheritedComputedStyleProperties) { this.bodyElement.addStyleClass("show-inherited"); showInheritedCheckbox.checked = true; } } - WebInspector.settings.addEventListener("loaded", settingsLoaded.bind(this)); + WebInspector.applicationSettings.addEventListener("loaded", settingsLoaded.bind(this)); function showInheritedToggleFunction(event) { - WebInspector.settings.showInheritedComputedStyleProperties = showInheritedCheckbox.checked; - if (WebInspector.settings.showInheritedComputedStyleProperties) + WebInspector.applicationSettings.showInheritedComputedStyleProperties = showInheritedCheckbox.checked; + if (WebInspector.applicationSettings.showInheritedComputedStyleProperties) this.bodyElement.addStyleClass("show-inherited"); else this.bodyElement.removeStyleClass("show-inherited"); @@ -600,7 +600,7 @@ WebInspector.ComputedStyleSidebarPane = function() showInheritedCheckbox.addEventListener(showInheritedToggleFunction.bind(this)); } - + WebInspector.ComputedStyleSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; WebInspector.StylePropertiesSection = function(styleRule, subtitle, computedStyle, usedProperties, editable, isInherited, isFirstSection) @@ -882,14 +882,9 @@ WebInspector.StylePropertiesSection.prototype = { return moveToNextIfNeeded.call(this); var self = this; - function callback(newRulePayload, doesAffectSelectedNode) - { - if (!newRulePayload) { - // Invalid Syntax for a Selector - moveToNextIfNeeded.call(self); - return; - } + function successCallback(newRule, doesAffectSelectedNode) + { if (!doesAffectSelectedNode) { self.noAffect = true; self.element.addStyleClass("no-affect"); @@ -898,7 +893,6 @@ WebInspector.StylePropertiesSection.prototype = { self.element.removeStyleClass("no-affect"); } - var newRule = WebInspector.CSSStyleDeclaration.parseRule(newRulePayload); self.rule = newRule; self.styleRule = { section: self, style: newRule.style, selectorText: newRule.selectorText, parentStyleSheet: newRule.parentStyleSheet, rule: newRule }; @@ -912,7 +906,7 @@ WebInspector.StylePropertiesSection.prototype = { moveToNextIfNeeded.call(self); } - InspectorBackend.setRuleSelector(WebInspector.Callback.wrap(callback), this.rule.id, newContent, this.pane.node.id); + WebInspector.cssModel.setRuleSelector(this.rule.id, newContent, this.pane.node.id, successCallback, moveToNextIfNeeded.bind(this)); }, editingSelectorCancelled: function() @@ -939,17 +933,8 @@ WebInspector.BlankStylePropertiesSection.prototype = { editingSelectorCommitted: function(element, newContent, oldContent, context) { var self = this; - function callback(rule, doesSelectorAffectSelectedNode) + function successCallback(styleRule, doesSelectorAffectSelectedNode) { - if (!rule) { - // Invalid Syntax for a Selector - self.editingSelectorCancelled(); - return; - } - - var styleRule = WebInspector.CSSStyleDeclaration.parseRule(rule); - styleRule.rule = rule; - self.makeNormal(styleRule); if (!doesSelectorAffectSelectedNode) { @@ -963,7 +948,7 @@ WebInspector.BlankStylePropertiesSection.prototype = { self.addNewBlankProperty().startEditing(); } - InspectorBackend.addRule(WebInspector.Callback.wrap(callback), newContent, this.pane.node.id); + WebInspector.cssModel.addRule(this.pane.node.id, newContent, successCallback, this.editingSelectorCancelled.bind(this)); }, editingSelectorCancelled: function() @@ -1137,9 +1122,9 @@ WebInspector.StylePropertyTreeElement.prototype = { var format; if (Preferences.showColorNicknames && color.nickname) format = "nickname"; - else if (WebInspector.settings.colorFormat === "rgb") + else if (WebInspector.applicationSettings.colorFormat === "rgb") format = (color.simple ? "rgb" : "rgba"); - else if (WebInspector.settings.colorFormat === "hsl") + else if (WebInspector.applicationSettings.colorFormat === "hsl") format = (color.simple ? "hsl" : "hsla"); else if (color.simple) format = (color.hasShortHex() ? "shorthex" : "hex"); @@ -1220,6 +1205,9 @@ WebInspector.StylePropertyTreeElement.prototype = { this.listItemElement.removeChildren(); + if (!this.treeOutline) + return; + // Append the checkbox for root elements of an editable section. if (this.treeOutline.section && this.treeOutline.section.editable && this.parent.root) this.listItemElement.appendChild(enabledCheckboxElement); @@ -1254,12 +1242,12 @@ WebInspector.StylePropertyTreeElement.prototype = { var disabled = !event.target.checked; var self = this; - function callback(newPayload) + function callback(newStyle) { - if (!newPayload) + if (!newStyle) return; - self.style = WebInspector.CSSStyleDeclaration.parseStyle(newPayload); + self.style = newStyle; self._styleRule.style = self.style; // Set the disabled property here, since the code above replies on it not changing @@ -1272,7 +1260,7 @@ WebInspector.StylePropertyTreeElement.prototype = { self.updateAll(true); } - InspectorBackend.toggleStyleEnabled(WebInspector.Callback.wrap(callback), this.style.id, this.name, disabled); + WebInspector.cssModel.toggleStyleEnabled(this.style.id, this.name, disabled, callback); }, updateState: function() @@ -1434,7 +1422,7 @@ WebInspector.StylePropertyTreeElement.prototype = { } else { // Restore the original CSS text before applying user changes. This is needed to prevent // new properties from sticking around if the user adds one, then removes it. - InspectorBackend.setStyleText(WebInspector.Callback.wrap(null), this.style.id, this.originalCSSText); + WebInspector.cssModel.setCSSText(this.style.id, this.originalCSSText); } this.applyStyleText(this.listItemElement.textContent); @@ -1454,7 +1442,7 @@ WebInspector.StylePropertyTreeElement.prototype = { if (this._newProperty) this.treeOutline.removeChild(this); else if (this.originalCSSText) { - InspectorBackend.setStyleText(WebInspector.Callback.wrap(null), this.style.id, this.originalCSSText); + WebInspector.cssModel.setCSSText(this.style.id, this.originalCSSText); if (this.treeOutline.section && this.treeOutline.section.pane) this.treeOutline.section.pane.dispatchEventToListeners("style edited"); @@ -1541,28 +1529,29 @@ WebInspector.StylePropertyTreeElement.prototype = { } var self = this; - function callback(success, newPayload, changedProperties) + + function failureCallback() { - if (!success) { - // The user typed something, but it didn't parse. Just abort and restore - // the original title for this property. If this was a new attribute and - // we couldn't parse, then just remove it. - if (self._newProperty) { - self.parent.removeChild(self); - return; - } - if (updateInterface) - self.updateTitle(); + // The user typed something, but it didn't parse. Just abort and restore + // the original title for this property. If this was a new attribute and + // we couldn't parse, then just remove it. + if (self._newProperty) { + self.parent.removeChild(self); return; } + if (updateInterface) + self.updateTitle(); + } + function successCallback(newStyle, changedProperties) + { elementsPanel.removeStyleChange(section.identifier, self.style, self.name); if (!styleTextLength) { // Do remove ourselves from UI when the property removal is confirmed. self.parent.removeChild(self); } else { - self.style = WebInspector.CSSStyleDeclaration.parseStyle(newPayload); + self.style = newStyle; for (var i = 0; i < changedProperties.length; ++i) elementsPanel.addStyleChange(section.identifier, self.style, changedProperties[i]); self._styleRule.style = self.style; @@ -1574,7 +1563,8 @@ WebInspector.StylePropertyTreeElement.prototype = { if (updateInterface) self.updateAll(true); } - InspectorBackend.applyStyleText(WebInspector.Callback.wrap(callback), this.style.id, styleText, this.name); + + WebInspector.cssModel.applyStyleText(this.style.id, styleText, this.name, successCallback, failureCallback); } } diff --git a/WebCore/inspector/front-end/TextPrompt.js b/WebCore/inspector/front-end/TextPrompt.js index 2bbe075..b6bcd52 100644 --- a/WebCore/inspector/front-end/TextPrompt.js +++ b/WebCore/inspector/front-end/TextPrompt.js @@ -242,7 +242,7 @@ WebInspector.TextPrompt.prototype = { wordPrefixLength = commonPrefix.length; if (selection.isCollapsed) - var completionText = completions[1]; + var completionText = completions[0]; else { var currentText = fullWordRange.toString(); diff --git a/WebCore/inspector/front-end/TextViewer.js b/WebCore/inspector/front-end/TextViewer.js index cd06072..4709a59 100644 --- a/WebCore/inspector/front-end/TextViewer.js +++ b/WebCore/inspector/front-end/TextViewer.js @@ -260,12 +260,14 @@ WebInspector.TextViewer.prototype = { return; // Do not trigger editing from line numbers. var oldContent = lineRow.lastChild.innerHTML; - this._editingLine = WebInspector.startEditing(lineRow.lastChild, this._commitEditingLine.bind(this, lineRow.lineNumber, lineRow.lastChild), this._cancelEditingLine.bind(this, lineRow.lastChild, oldContent), null, true); + var cancelEditingCallback = this._cancelEditingLine.bind(this, lineRow.lastChild, oldContent); + var commitEditingCallback = this._commitEditingLine.bind(this, lineRow.lineNumber, lineRow.lastChild, cancelEditingCallback); + this._editingLine = WebInspector.startEditing(lineRow.lastChild, commitEditingCallback, cancelEditingCallback, null, true); }, - _commitEditingLine: function(lineNumber, element) + _commitEditingLine: function(lineNumber, element, cancelEditingCallback) { - this._editCallback(lineNumber, element.textContent) + this._editCallback(lineNumber, element.textContent, cancelEditingCallback); delete this._editingLine; }, diff --git a/WebCore/inspector/front-end/TimelinePanel.js b/WebCore/inspector/front-end/TimelinePanel.js index b9f0814..29efd79 100644 --- a/WebCore/inspector/front-end/TimelinePanel.js +++ b/WebCore/inspector/front-end/TimelinePanel.js @@ -940,7 +940,7 @@ WebInspector.TimelinePanel.FormattedRecord.prototype = { case recordTypes.TimerRemove: contentHelper._appendTextRow(WebInspector.UIString("Timer ID"), this.data.timerId); if (typeof this.timeout === "number") { - contentHelper._appendTextRow(WebInspector.UIString("Timeout"), this.timeout); + contentHelper._appendTextRow(WebInspector.UIString("Timeout"), Number.secondsToString(this.timeout / 1000, WebInspector.UIString)); contentHelper._appendTextRow(WebInspector.UIString("Repeats"), !this.singleShot); } if (typeof this.callSiteScriptLine === "number") diff --git a/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js b/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js index 3655d68..b530ab6 100644 --- a/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js +++ b/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js @@ -31,7 +31,7 @@ WebInspector.WatchExpressionsSidebarPane = function() { WebInspector.SidebarPane.call(this, WebInspector.UIString("Watch Expressions")); - WebInspector.settings.addEventListener("loaded", this._settingsLoaded, this); + WebInspector.applicationSettings.addEventListener("loaded", this._settingsLoaded, this); } WebInspector.WatchExpressionsSidebarPane.prototype = { @@ -39,7 +39,7 @@ WebInspector.WatchExpressionsSidebarPane.prototype = { { this.bodyElement.removeChildren(); - this.expanded = WebInspector.settings.watchExpressions.length > 0; + this.expanded = WebInspector.applicationSettings.watchExpressions.length > 0; this.section = new WebInspector.WatchExpressionsSection(); this.bodyElement.appendChild(this.section.element); @@ -77,7 +77,7 @@ WebInspector.WatchExpressionsSection = function() WebInspector.ObjectPropertiesSection.call(this); - this.watchExpressions = WebInspector.settings.watchExpressions; + this.watchExpressions = WebInspector.applicationSettings.watchExpressions; this.headerElement.className = "hidden"; this.editable = true; @@ -195,7 +195,7 @@ WebInspector.WatchExpressionsSection.prototype = { if (this.watchExpressions[i]) toSave.push(this.watchExpressions[i]); - WebInspector.settings.watchExpressions = toSave; + WebInspector.applicationSettings.watchExpressions = toSave; return toSave.length; } } diff --git a/WebCore/inspector/front-end/WebKit.qrc b/WebCore/inspector/front-end/WebKit.qrc index e93bf2c..fd84586 100644 --- a/WebCore/inspector/front-end/WebKit.qrc +++ b/WebCore/inspector/front-end/WebKit.qrc @@ -19,6 +19,7 @@ <file>ConsoleView.js</file> <file>ContextMenu.js</file> <file>CookieItemsView.js</file> + <file>CSSStyleModel.js</file> <file>Database.js</file> <file>DatabaseQueryView.js</file> <file>DatabaseTableView.js</file> @@ -32,6 +33,7 @@ <file>ElementsTreeOutline.js</file> <file>EventListenersSidebarPane.js</file> <file>FontView.js</file> + <file>HAREntry.js</file> <file>HelpScreen.js</file> <file>ImageView.js</file> <file>InjectedFakeWorker.js</file> diff --git a/WebCore/inspector/front-end/inspector.css b/WebCore/inspector/front-end/inspector.css index ef34f2c..52b85bc 100644 --- a/WebCore/inspector/front-end/inspector.css +++ b/WebCore/inspector/front-end/inspector.css @@ -2351,6 +2351,10 @@ button.enable-toggle-status-bar-item.toggled-on .glyph { max-width: 250px; } +#scripts-files option.extension-script { + color: rgb(70, 134, 240); +} + #scripts-functions { max-width: 150px; } @@ -3976,7 +3980,6 @@ ol.breakpoint-list { .styles-selector { cursor: text; - -webkit-user-select: text; } .workers-list { @@ -4004,6 +4007,7 @@ a.worker-item { white-space: nowrap; -webkit-background-origin: padding; -webkit-background-clip: padding; + -webkit-user-select: text; } .styles-section:not(.first-styles-section) { @@ -4058,7 +4062,6 @@ a.worker-item { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; - -webkit-user-select: text; cursor: auto; } diff --git a/WebCore/inspector/front-end/inspector.html b/WebCore/inspector/front-end/inspector.html index 75b31eb..4c51634 100644 --- a/WebCore/inspector/front-end/inspector.html +++ b/WebCore/inspector/front-end/inspector.html @@ -41,6 +41,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="InspectorFrontendHostStub.js"></script> <script type="text/javascript" src="Object.js"></script> <script type="text/javascript" src="Settings.js"></script> + <script type="text/javascript" src="CSSStyleModel.js"></script> <script type="text/javascript" src="Checkbox.js"></script> <script type="text/javascript" src="ContextMenu.js"></script> <script type="text/javascript" src="KeyboardShortcut.js"></script> @@ -127,6 +128,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="TestController.js"></script> <script type="text/javascript" src="HelpScreen.js"></script> <script type="text/javascript" src="ShortcutsHelp.js"></script> + <script type="text/javascript" src="HAREntry.js"></script> </head> <body class="detached"> <div id="toolbar"> diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js index 8c25be5..e8108af 100644 --- a/WebCore/inspector/front-end/inspector.js +++ b/WebCore/inspector/front-end/inspector.js @@ -440,7 +440,8 @@ WebInspector.loaded = function() var port = WebInspector.port; document.body.addStyleClass("port-" + port); - this.settings = new WebInspector.Settings(); + this.applicationSettings = new WebInspector.Settings(false); + this.sessionSettings = new WebInspector.Settings(true); this._registerShortcuts(); // set order of some sections explicitly @@ -466,6 +467,7 @@ WebInspector.loaded = function() }; this.breakpointManager = new WebInspector.BreakpointManager(); + this.cssModel = new WebInspector.CSSStyleModel(); this.panels = {}; this._createPanels(); @@ -571,6 +573,13 @@ WebInspector.dispatch = function() { setTimeout(delayDispatch, 0); } +WebInspector.dispatchMessageFromBackend = function(arguments) +{ + var methodName = arguments.shift(); + WebInspector[methodName].apply(this, arguments); +} + + WebInspector.windowResize = function(event) { if (this.currentPanel) @@ -696,7 +705,7 @@ WebInspector._registerShortcuts = function() shortcut.shortcutToString("[", shortcut.Modifiers.CtrlOrMeta) ]; section.addRelatedKeys(keys, WebInspector.UIString("Next/previous panel")); - section.addKey(shortcut.Keys.Esc.name, WebInspector.UIString("Toggle console")); + section.addKey(shortcut.shortcutToString(shortcut.Keys.Esc), WebInspector.UIString("Toggle console")); section.addKey(shortcut.shortcutToString("f", shortcut.Modifiers.CtrlOrMeta), WebInspector.UIString("Search")); keys = [ shortcut.shortcutToString("g", shortcut.Modifiers.CtrlOrMeta), @@ -1318,9 +1327,9 @@ WebInspector.profilerWasDisabled = function() this.panels.profiles.profilerWasDisabled(); } -WebInspector.parsedScriptSource = function(sourceID, sourceURL, source, startingLine) +WebInspector.parsedScriptSource = function(sourceID, sourceURL, source, startingLine, scriptWorldType) { - this.panels.scripts.addScript(sourceID, sourceURL, source, startingLine); + this.panels.scripts.addScript(sourceID, sourceURL, source, startingLine, undefined, undefined, scriptWorldType); } WebInspector.restoredBreakpoint = function(sourceID, sourceURL, line, enabled, condition) @@ -1360,6 +1369,7 @@ WebInspector.reset = function() panel.reset(); } + this.sessionSettings.reset(); this.breakpointManager.reset(); for (var category in this.resourceCategories) diff --git a/WebCore/inspector/front-end/utilities.js b/WebCore/inspector/front-end/utilities.js index 9ad1c10..bb19dbd 100644 --- a/WebCore/inspector/front-end/utilities.js +++ b/WebCore/inspector/front-end/utilities.js @@ -55,7 +55,14 @@ Function.prototype.bind = function(thisObject) { var func = this; var args = Array.prototype.slice.call(arguments, 1); - return function() { return func.apply(thisObject, args.concat(Array.prototype.slice.call(arguments, 0))) }; + function bound() + { + return func.apply(thisObject, args.concat(Array.prototype.slice.call(arguments, 0))); + } + bound.toString = function() { + return "bound: " + func; + }; + return bound; } Node.prototype.rangeOfWord = function(offset, stopCharacters, stayWithinNode, direction) diff --git a/WebCore/loader/CachedFont.cpp b/WebCore/loader/CachedFont.cpp index 92ac32e..af0c235 100644 --- a/WebCore/loader/CachedFont.cpp +++ b/WebCore/loader/CachedFont.cpp @@ -176,11 +176,9 @@ SVGFontElement* CachedFont::getSVGFontById(const String& fontName) const return static_cast<SVGFontElement*>(list->item(0)); for (unsigned i = 0; i < listLength; ++i) { - Node* node = list->item(i); - if (static_cast<Element*>(node)->getAttribute(static_cast<Element*>(node)->idAttributeName()) != fontName) - continue; - - return static_cast<SVGFontElement*>(node); + SVGFontElement* element = static_cast<SVGFontElement*>(list->item(i)); + if (element->getIdAttribute() == fontName) + return element; } return 0; diff --git a/WebCore/loader/DocumentLoader.cpp b/WebCore/loader/DocumentLoader.cpp index 21c2e27..990c48a 100644 --- a/WebCore/loader/DocumentLoader.cpp +++ b/WebCore/loader/DocumentLoader.cpp @@ -50,7 +50,7 @@ #include "PlatformString.h" #include "Settings.h" #include "SharedBuffer.h" -#include "XMLTokenizer.h" +#include "XMLDocumentParser.h" #include <wtf/Assertions.h> #include <wtf/unicode/Unicode.h> @@ -259,7 +259,7 @@ void DocumentLoader::commitIfReady() { if (m_gotFirstByte && !m_committed) { m_committed = true; - frameLoader()->commitProvisionalLoad(0); + frameLoader()->commitProvisionalLoad(); } } @@ -399,8 +399,8 @@ bool DocumentLoader::isLoadingInAPISense() const Document* doc = m_frame->document(); if (doc->docLoader()->requestCount()) return true; - if (Tokenizer* tok = doc->tokenizer()) - if (tok->processingData()) + if (DocumentParser* parser = doc->parser()) + if (parser->processingData()) return true; } return frameLoader()->subframeIsLoading(); diff --git a/WebCore/loader/DocumentLoader.h b/WebCore/loader/DocumentLoader.h index 1beed10..ea6f58b 100644 --- a/WebCore/loader/DocumentLoader.h +++ b/WebCore/loader/DocumentLoader.h @@ -200,7 +200,11 @@ namespace WebCore { void setDeferMainResourceDataLoad(bool defer) { m_deferMainResourceDataLoad = defer; } bool deferMainResourceDataLoad() const { return m_deferMainResourceDataLoad; } - void didTellClientAboutLoad(const String& url) { m_resourcesClientKnowsAbout.add(url); } + void didTellClientAboutLoad(const String& url) + { + if (!url.isEmpty()) + m_resourcesClientKnowsAbout.add(url); + } bool haveToldClientAboutLoad(const String& url) { return m_resourcesClientKnowsAbout.contains(url); } void recordMemoryCacheLoadForFutureClientNotification(const String& url); void takeMemoryCacheLoadsForClientNotification(Vector<String>& loads); diff --git a/WebCore/loader/DocumentWriter.cpp b/WebCore/loader/DocumentWriter.cpp index 0bed159..cc2632b 100644 --- a/WebCore/loader/DocumentWriter.cpp +++ b/WebCore/loader/DocumentWriter.cpp @@ -42,7 +42,7 @@ #include "Settings.h" #include "SinkDocument.h" #include "TextResourceDecoder.h" -#include "Tokenizer.h" +#include "DocumentParser.h" namespace WebCore { @@ -99,7 +99,7 @@ void DocumentWriter::begin(const KURL& url, bool dispatch, SecurityOrigin* origi RefPtr<Document> document = createDocument(); // If the new document is for a Plugin but we're supposed to be sandboxed from Plugins, - // then replace the document with one whose tokenizer will ignore the incoming data (bug 39323) + // then replace the document with one whose parser will ignore the incoming data (bug 39323) if (document->isPluginDocument() && m_frame->loader()->isSandboxed(SandboxPlugins)) document = SinkDocument::create(m_frame); @@ -136,10 +136,10 @@ void DocumentWriter::addData(const char* str, int len, bool flush) if (len == -1) len = strlen(str); - Tokenizer* tokenizer = m_frame->document()->tokenizer(); - if (tokenizer && tokenizer->wantsRawData()) { + DocumentParser* parser = m_frame->document()->parser(); + if (parser && parser->wantsRawData()) { if (len > 0) - tokenizer->writeRawData(str, len); + parser->writeRawData(str, len); return; } @@ -186,9 +186,9 @@ void DocumentWriter::addData(const char* str, int len, bool flush) m_frame->document()->recalcStyle(Node::Force); } - if (tokenizer) { - ASSERT(!tokenizer->wantsRawData()); - tokenizer->write(decoded, true); + if (parser) { + ASSERT(!parser->wantsRawData()); + parser->write(decoded, true); } } @@ -202,8 +202,8 @@ void DocumentWriter::addData(const String& str) m_frame->document()->setParseMode(Document::Strict); } - if (Tokenizer* tokenizer = m_frame->document()->tokenizer()) - tokenizer->write(str, true); + if (DocumentParser* parser = m_frame->document()->parser()) + parser->write(str, true); } void DocumentWriter::end() diff --git a/WebCore/loader/EmptyClients.h b/WebCore/loader/EmptyClients.h index 982324a..613c7f6 100644 --- a/WebCore/loader/EmptyClients.h +++ b/WebCore/loader/EmptyClients.h @@ -494,6 +494,7 @@ public: virtual void populateSetting(const String&, String*) { } virtual void storeSetting(const String&, const String&) { } + virtual bool sendMessageToFrontend(const String&) { return false; } }; } diff --git a/WebCore/loader/FTPDirectoryDocument.cpp b/WebCore/loader/FTPDirectoryDocument.cpp index 66136b5..5d1b2bf 100644 --- a/WebCore/loader/FTPDirectoryDocument.cpp +++ b/WebCore/loader/FTPDirectoryDocument.cpp @@ -29,7 +29,7 @@ #include "CharacterNames.h" #include "HTMLNames.h" #include "HTMLTableElement.h" -#include "HTMLTokenizer.h" +#include "HTMLDocumentParser.h" #include "LocalizedStrings.h" #include "Logging.h" #include "FTPDirectoryParser.h" @@ -48,9 +48,9 @@ namespace WebCore { using namespace HTMLNames; -class FTPDirectoryTokenizer : public HTMLTokenizer { +class FTPDirectoryDocumentParser : public HTMLDocumentParser { public: - FTPDirectoryTokenizer(HTMLDocument*); + FTPDirectoryDocumentParser(HTMLDocument*); virtual void write(const SegmentedString&, bool appendData); virtual void finish(); @@ -70,7 +70,7 @@ public: } private: - // The tokenizer will attempt to load the document template specified via the preference + // The parser will attempt to load the document template specified via the preference // Failing that, it will fall back and create the basic document which will have a minimal // table for presenting the FTP directory in a useful manner bool loadDocumentTemplate(); @@ -94,8 +94,8 @@ private: ListState m_listState; }; -FTPDirectoryTokenizer::FTPDirectoryTokenizer(HTMLDocument* doc) - : HTMLTokenizer(doc, false) +FTPDirectoryDocumentParser::FTPDirectoryDocumentParser(HTMLDocument* doc) + : HTMLDocumentParser(doc, false) , m_doc(doc) , m_skipLF(false) , m_parsedTemplate(false) @@ -105,7 +105,7 @@ FTPDirectoryTokenizer::FTPDirectoryTokenizer(HTMLDocument* doc) { } -void FTPDirectoryTokenizer::appendEntry(const String& filename, const String& size, const String& date, bool isDirectory) +void FTPDirectoryDocumentParser::appendEntry(const String& filename, const String& size, const String& date, bool isDirectory) { ExceptionCode ec; @@ -135,7 +135,7 @@ void FTPDirectoryTokenizer::appendEntry(const String& filename, const String& si rowElement->appendChild(element, ec); } -PassRefPtr<Element> FTPDirectoryTokenizer::createTDForFilename(const String& filename) +PassRefPtr<Element> FTPDirectoryDocumentParser::createTDForFilename(const String& filename) { ExceptionCode ec; @@ -257,7 +257,7 @@ static String processFileDateString(const FTPTime& fileTime) return dateString + timeOfDay; } -void FTPDirectoryTokenizer::parseAndAppendOneLine(const String& inputLine) +void FTPDirectoryDocumentParser::parseAndAppendOneLine(const String& inputLine) { ListResult result; CString latin1Input = inputLine.latin1(); @@ -292,7 +292,7 @@ static inline PassRefPtr<SharedBuffer> createTemplateDocumentData(Settings* sett return buffer.release(); } -bool FTPDirectoryTokenizer::loadDocumentTemplate() +bool FTPDirectoryDocumentParser::loadDocumentTemplate() { DEFINE_STATIC_LOCAL(RefPtr<SharedBuffer>, templateDocumentData, (createTemplateDocumentData(m_doc->settings()))); // FIXME: Instead of storing the data, we'd rather actually parse the template data into the template Document once, @@ -306,7 +306,7 @@ bool FTPDirectoryTokenizer::loadDocumentTemplate() // Tokenize the template as an HTML document synchronously setForceSynchronous(true); - HTMLTokenizer::write(String(templateDocumentData->data(), templateDocumentData->size()), true); + HTMLDocumentParser::write(String(templateDocumentData->data(), templateDocumentData->size()), true); setForceSynchronous(false); RefPtr<Element> tableElement = m_doc->getElementById("ftpDirectoryTable"); @@ -338,7 +338,7 @@ bool FTPDirectoryTokenizer::loadDocumentTemplate() return true; } -void FTPDirectoryTokenizer::createBasicDocument() +void FTPDirectoryDocumentParser::createBasicDocument() { LOG(FTP, "Creating a basic FTP document structure as no template was loaded"); @@ -357,7 +357,7 @@ void FTPDirectoryTokenizer::createBasicDocument() bodyElement->appendChild(m_tableElement, ec); } -void FTPDirectoryTokenizer::write(const SegmentedString& s, bool /*appendData*/) +void FTPDirectoryDocumentParser::write(const SegmentedString& s, bool /*appendData*/) { // Make sure we have the table element to append to by loading the template set in the pref, or // creating a very basic document with the appropriate table @@ -420,7 +420,7 @@ void FTPDirectoryTokenizer::write(const SegmentedString& s, bool /*appendData*/) m_carryOver.append(String(start, cursor - start - 1)); } -void FTPDirectoryTokenizer::finish() +void FTPDirectoryDocumentParser::finish() { // Possible the last line in the listing had no newline, so try to parse it now if (!m_carryOver.isEmpty()) { @@ -431,7 +431,7 @@ void FTPDirectoryTokenizer::finish() m_tableElement = 0; fastFree(m_buffer); - HTMLTokenizer::finish(); + HTMLDocumentParser::finish(); } FTPDirectoryDocument::FTPDirectoryDocument(Frame* frame) @@ -442,9 +442,9 @@ FTPDirectoryDocument::FTPDirectoryDocument(Frame* frame) #endif } -Tokenizer* FTPDirectoryDocument::createTokenizer() +DocumentParser* FTPDirectoryDocument::createParser() { - return new FTPDirectoryTokenizer(this); + return new FTPDirectoryDocumentParser(this); } } diff --git a/WebCore/loader/FTPDirectoryDocument.h b/WebCore/loader/FTPDirectoryDocument.h index b208c4e..f74508c 100644 --- a/WebCore/loader/FTPDirectoryDocument.h +++ b/WebCore/loader/FTPDirectoryDocument.h @@ -40,7 +40,7 @@ public: private: FTPDirectoryDocument(Frame*); - virtual Tokenizer* createTokenizer(); + virtual DocumentParser* createParser(); }; } // namespace WebCore diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp index 20a8142..7920e2e 100644 --- a/WebCore/loader/FrameLoader.cpp +++ b/WebCore/loader/FrameLoader.cpp @@ -114,7 +114,7 @@ #include "TextResourceDecoder.h" #include "WindowFeatures.h" #include "XMLHttpRequest.h" -#include "XMLTokenizer.h" +#include "XMLDocumentParser.h" #include "XSSAuditor.h" #include <wtf/text/CString.h> #include <wtf/CurrentTime.h> @@ -571,8 +571,8 @@ void FrameLoader::submitForm(const char* action, const String& url, PassRefPtr<F void FrameLoader::stopLoading(UnloadEventPolicy unloadEventPolicy, DatabasePolicy databasePolicy) { - if (m_frame->document() && m_frame->document()->tokenizer()) - m_frame->document()->tokenizer()->stopParsing(); + if (m_frame->document() && m_frame->document()->parser()) + m_frame->document()->parser()->stopParsing(); if (unloadEventPolicy != UnloadEventPolicyNone) { if (m_frame->document()) { @@ -648,8 +648,8 @@ void FrameLoader::stop() // The frame's last ref may be removed and it will be deleted by checkCompleted(). RefPtr<Frame> protector(m_frame); - if (m_frame->document()->tokenizer()) - m_frame->document()->tokenizer()->stopParsing(); + if (m_frame->document()->parser()) + m_frame->document()->parser()->stopParsing(); m_frame->document()->finishParsing(); if (m_iconLoader) @@ -1458,208 +1458,6 @@ static inline bool frameContainsWMLContent(Frame* frame) } #endif -bool FrameLoader::canCachePageContainingThisFrame() -{ - for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) { - if (!child->loader()->canCachePageContainingThisFrame()) - return false; - } - - return m_documentLoader - && m_documentLoader->mainDocumentError().isNull() - // FIXME: If we ever change this so that frames with plug-ins will be cached, - // we need to make sure that we don't cache frames that have outstanding NPObjects - // (objects created by the plug-in). Since there is no way to pause/resume a Netscape plug-in, - // they would need to be destroyed and then recreated, and there is no way that we can recreate - // the right NPObjects. See <rdar://problem/5197041> for more information. - && !m_containsPlugIns - && !m_URL.protocolIs("https") - && (!m_frame->domWindow() || !m_frame->domWindow()->hasEventListeners(eventNames().unloadEvent)) -#if ENABLE(DATABASE) - && !m_frame->document()->hasOpenDatabases() -#endif -#if ENABLE(SHARED_WORKERS) - && !SharedWorkerRepository::hasSharedWorkers(m_frame->document()) -#endif - && !m_frame->document()->usingGeolocation() - && history()->currentItem() - && !m_quickRedirectComing - && !m_documentLoader->isLoadingInAPISense() - && !m_documentLoader->isStopping() - && m_frame->document()->canSuspendActiveDOMObjects() -#if ENABLE(OFFLINE_WEB_APPLICATIONS) - // FIXME: We should investigating caching frames that have an associated - // application cache. <rdar://problem/5917899> tracks that work. - && m_documentLoader->applicationCacheHost()->canCacheInPageCache() -#endif -#if ENABLE(WML) - && !frameContainsWMLContent(m_frame) -#endif - && m_client->canCachePage() - ; -} - -bool FrameLoader::canCachePage() -{ -#ifndef NDEBUG - logCanCachePageDecision(); -#endif - - // Cache the page, if possible. - // Don't write to the cache if in the middle of a redirect, since we will want to - // store the final page we end up on. - // No point writing to the cache on a reload or loadSame, since we will just write - // over it again when we leave that page. - // FIXME: <rdar://problem/4886592> - We should work out the complexities of caching pages with frames as they - // are the most interesting pages on the web, and often those that would benefit the most from caching! - FrameLoadType loadType = this->loadType(); - - return !m_frame->tree()->parent() - && canCachePageContainingThisFrame() - && m_frame->page() - && m_frame->page()->backForwardList()->enabled() - && m_frame->page()->backForwardList()->capacity() > 0 - && m_frame->page()->settings()->usesPageCache() - && loadType != FrameLoadTypeReload - && loadType != FrameLoadTypeReloadFromOrigin - && loadType != FrameLoadTypeSame - ; -} - -#ifndef NDEBUG -static String& pageCacheLogPrefix(int indentLevel) -{ - static int previousIndent = -1; - DEFINE_STATIC_LOCAL(String, prefix, ()); - - if (indentLevel != previousIndent) { - previousIndent = indentLevel; - prefix.truncate(0); - for (int i = 0; i < previousIndent; ++i) - prefix += " "; - } - - return prefix; -} - -static void pageCacheLog(const String& prefix, const String& message) -{ - LOG(PageCache, "%s%s", prefix.utf8().data(), message.utf8().data()); -} - -#define PCLOG(...) pageCacheLog(pageCacheLogPrefix(indentLevel), String::format(__VA_ARGS__)) - -void FrameLoader::logCanCachePageDecision() -{ - // Only bother logging for main frames that have actually loaded and have content. - if (m_creatingInitialEmptyDocument) - return; - KURL currentURL = m_documentLoader ? m_documentLoader->url() : KURL(); - if (currentURL.isEmpty()) - return; - - int indentLevel = 0; - PCLOG("--------\n Determining if page can be cached:"); - - bool cannotCache = !logCanCacheFrameDecision(1); - - FrameLoadType loadType = this->loadType(); - do { - if (m_frame->tree()->parent()) - { PCLOG(" -Frame has a parent frame"); cannotCache = true; } - if (!m_frame->page()) { - PCLOG(" -There is no Page object"); - cannotCache = true; - break; - } - if (!m_frame->page()->backForwardList()->enabled()) - { PCLOG(" -The back/forward list is disabled"); cannotCache = true; } - if (!(m_frame->page()->backForwardList()->capacity() > 0)) - { PCLOG(" -The back/forward list has a 0 capacity"); cannotCache = true; } - if (!m_frame->page()->settings()->usesPageCache()) - { PCLOG(" -Page settings says b/f cache disabled"); cannotCache = true; } - if (loadType == FrameLoadTypeReload) - { PCLOG(" -Load type is: Reload"); cannotCache = true; } - if (loadType == FrameLoadTypeReloadFromOrigin) - { PCLOG(" -Load type is: Reload from origin"); cannotCache = true; } - if (loadType == FrameLoadTypeSame) - { PCLOG(" -Load type is: Same"); cannotCache = true; } - } while (false); - - PCLOG(cannotCache ? " Page CANNOT be cached\n--------" : " Page CAN be cached\n--------"); -} - -bool FrameLoader::logCanCacheFrameDecision(int indentLevel) -{ - // Only bother logging for frames that have actually loaded and have content. - if (m_creatingInitialEmptyDocument) - return false; - KURL currentURL = m_documentLoader ? m_documentLoader->url() : KURL(); - if (currentURL.isEmpty()) - return false; - - PCLOG("+---"); - KURL newURL = m_provisionalDocumentLoader ? m_provisionalDocumentLoader->url() : KURL(); - if (!newURL.isEmpty()) - PCLOG(" Determining if frame can be cached navigating from (%s) to (%s):", currentURL.string().utf8().data(), newURL.string().utf8().data()); - else - PCLOG(" Determining if subframe with URL (%s) can be cached:", currentURL.string().utf8().data()); - - bool cannotCache = false; - - do { - if (!m_documentLoader) { - PCLOG(" -There is no DocumentLoader object"); - cannotCache = true; - break; - } - if (!m_documentLoader->mainDocumentError().isNull()) - { PCLOG(" -Main document has an error"); cannotCache = true; } - if (m_containsPlugIns) - { PCLOG(" -Frame contains plugins"); cannotCache = true; } - if (m_URL.protocolIs("https")) - { PCLOG(" -Frame is HTTPS"); cannotCache = true; } - if (m_frame->domWindow() && m_frame->domWindow()->hasEventListeners(eventNames().unloadEvent)) - { PCLOG(" -Frame has an unload event listener"); cannotCache = true; } -#if ENABLE(DATABASE) - if (m_frame->document()->hasOpenDatabases()) - { PCLOG(" -Frame has open database handles"); cannotCache = true; } -#endif -#if ENABLE(SHARED_WORKERS) - if (SharedWorkerRepository::hasSharedWorkers(m_frame->document())) - { PCLOG(" -Frame has associated SharedWorkers"); cannotCache = true; } -#endif - if (m_frame->document()->usingGeolocation()) - { PCLOG(" -Frame uses Geolocation"); cannotCache = true; } - if (!history()->currentItem()) - { PCLOG(" -No current history item"); cannotCache = true; } - if (m_quickRedirectComing) - { PCLOG(" -Quick redirect is coming"); cannotCache = true; } - if (m_documentLoader->isLoadingInAPISense()) - { PCLOG(" -DocumentLoader is still loading in API sense"); cannotCache = true; } - if (m_documentLoader->isStopping()) - { PCLOG(" -DocumentLoader is in the middle of stopping"); cannotCache = true; } - if (!m_frame->document()->canSuspendActiveDOMObjects()) - { PCLOG(" -The document cannot suspect its active DOM Objects"); cannotCache = true; } -#if ENABLE(OFFLINE_WEB_APPLICATIONS) - if (!m_documentLoader->applicationCacheHost()->canCacheInPageCache()) - { PCLOG(" -The DocumentLoader uses an application cache"); cannotCache = true; } -#endif - if (!m_client->canCachePage()) - { PCLOG(" -The client says this frame cannot be cached"); cannotCache = true; } - } while (false); - - for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) - if (!child->loader()->logCanCacheFrameDecision(indentLevel + 1)) - cannotCache = true; - - PCLOG(cannotCache ? " Frame CANNOT be cached" : " Frame CAN be cached"); - PCLOG("+---"); - - return !cannotCache; -} -#endif - void FrameLoader::updateFirstPartyForCookies() { if (m_frame->tree()->parent()) @@ -1738,7 +1536,7 @@ void FrameLoader::loadInSameDocument(const KURL& url, SerializedScriptValue* sta } if (hashChange) { - m_frame->document()->enqueueHashchangeEvent(oldURL, m_URL); + m_frame->document()->enqueueHashchangeEvent(oldURL, url); m_client->dispatchDidChangeLocationWithinPage(); } @@ -2421,9 +2219,9 @@ void FrameLoader::markLoadComplete() setState(FrameStateComplete); } -void FrameLoader::commitProvisionalLoad(PassRefPtr<CachedPage> prpCachedPage) +void FrameLoader::commitProvisionalLoad() { - RefPtr<CachedPage> cachedPage = prpCachedPage; + RefPtr<CachedPage> cachedPage = m_loadingFromCachedPage ? pageCache()->get(history()->provisionalItem()) : 0; RefPtr<DocumentLoader> pdl = m_provisionalDocumentLoader; LOG(PageCache, "WebCoreLoading %s: About to commit provisional load from previous URL '%s' to new URL '%s'", m_frame->tree()->name().string().utf8().data(), m_URL.string().utf8().data(), @@ -2431,7 +2229,11 @@ void FrameLoader::commitProvisionalLoad(PassRefPtr<CachedPage> prpCachedPage) // Check to see if we need to cache the page we are navigating away from into the back/forward cache. // We are doing this here because we know for sure that a new page is about to be loaded. - cachePageForHistoryItem(history()->currentItem()); + HistoryItem* item = history()->currentItem(); + if (!m_frame->tree()->parent() && PageCache::canCache(m_frame->page()) && !item->isInPageCache()) { + pageHidden(); + pageCache()->add(item, m_frame->page()); + } if (m_loadType != FrameLoadTypeReplace) closeOldDataSources(); @@ -2448,9 +2250,11 @@ void FrameLoader::commitProvisionalLoad(PassRefPtr<CachedPage> prpCachedPage) if (m_sentRedirectNotification) clientRedirectCancelledOrFinished(false); - if (cachedPage && cachedPage->document()) - open(*cachedPage); - else { + if (cachedPage && cachedPage->document()) { + prepareForCachedPageRestore(); + cachedPage->restore(m_frame->page()); + checkCompleted(); + } else { KURL url = pdl->substituteData().responseURL(); if (url.isEmpty()) url = pdl->url(); @@ -2666,7 +2470,7 @@ void FrameLoader::closeOldDataSources() m_client->setMainFrameDocumentReady(false); // stop giving out the actual DOMDocument to observers } -void FrameLoader::open(CachedPage& cachedPage) +void FrameLoader::prepareForCachedPageRestore() { ASSERT(!m_frame->tree()->parent()); ASSERT(m_frame->page()); @@ -2682,10 +2486,6 @@ void FrameLoader::open(CachedPage& cachedPage) m_frame->setJSStatusBarText(String()); m_frame->setJSDefaultStatusBarText(String()); } - - cachedPage.restore(m_frame->page()); - - checkCompleted(); } void FrameLoader::open(CachedFrameBase& cachedFrame) @@ -3149,11 +2949,6 @@ String FrameLoader::userAgent(const KURL& url) const return m_client->userAgent(url); } -void FrameLoader::tokenizerProcessedData() -{ - checkCompleted(); -} - void FrameLoader::handledOnloadEvents() { m_client->dispatchDidHandleOnloadEvents(); @@ -3559,8 +3354,10 @@ void FrameLoader::continueLoadAfterNavigationPolicy(const ResourceRequest&, Pass setPolicyDocumentLoader(0); - if (isBackForwardLoadType(type) && loadProvisionalItemFromCachedPage()) + if (isBackForwardLoadType(type) && history()->provisionalItem()->isInPageCache()) { + loadProvisionalItemFromCachedPage(); return; + } if (formState) m_client->dispatchWillSubmitForm(&PolicyChecker::continueLoadAfterWillSubmitForm, formState); @@ -3673,36 +3470,17 @@ bool FrameLoader::shouldInterruptLoadForXFrameOptions(const String& content, con return false; } -bool FrameLoader::loadProvisionalItemFromCachedPage() +void FrameLoader::loadProvisionalItemFromCachedPage() { - RefPtr<CachedPage> cachedPage = pageCache()->get(history()->provisionalItem()); - if (!cachedPage || !cachedPage->document()) - return false; + DocumentLoader* provisionalLoader = provisionalDocumentLoader(); + LOG(PageCache, "WebCorePageCache: Loading provisional DocumentLoader %p with URL '%s' from CachedPage", provisionalDocumentLoader(), provisionalDocumentLoader()->url().string().utf8().data()); - DocumentLoader *provisionalLoader = provisionalDocumentLoader(); - LOG(PageCache, "WebCorePageCache: FrameLoader %p loading provisional DocumentLoader %p with URL '%s' from CachedPage %p", this, provisionalLoader, provisionalLoader->url().string().utf8().data(), cachedPage.get()); - provisionalLoader->prepareForLoadStart(); m_loadingFromCachedPage = true; provisionalLoader->setCommitted(true); - commitProvisionalLoad(cachedPage); - - return true; -} - -void FrameLoader::cachePageForHistoryItem(HistoryItem* item) -{ - if (!canCachePage() || item->isInPageCache()) - return; - - pageHidden(); - - if (Page* page = m_frame->page()) { - RefPtr<CachedPage> cachedPage = CachedPage::create(page); - pageCache()->add(item, cachedPage.release()); - } + commitProvisionalLoad(); } void FrameLoader::pageHidden() @@ -3770,21 +3548,10 @@ void FrameLoader::navigateToDifferentDocument(HistoryItem* item, FrameLoadType l { // Remember this item so we can traverse any child items as child frames load history()->setProvisionalItem(item); - - // Check if we'll be using the page cache. We only use the page cache - // if one exists and it is less than _backForwardCacheExpirationInterval - // seconds old. If the cache is expired it gets flushed here. - if (RefPtr<CachedPage> cachedPage = pageCache()->get(item)) { - // FIXME: 1800 should not be hardcoded, it should come from - // WebKitBackForwardCacheExpirationIntervalKey in WebKit. - // Or we should remove WebKitBackForwardCacheExpirationIntervalKey. - if (currentTime() - cachedPage->timeStamp() <= 1800) { - loadWithDocumentLoader(cachedPage->documentLoader(), loadType, 0); - return; - } - - LOG(PageCache, "Not restoring page for %s from back/forward cache because cache entry has expired", history()->provisionalItem()->url().string().ascii().data()); - pageCache()->remove(item); + + if (CachedPage* cachedPage = pageCache()->get(item)) { + loadWithDocumentLoader(cachedPage->documentLoader(), loadType, 0); + return; } KURL itemURL = item->url(); diff --git a/WebCore/loader/FrameLoader.h b/WebCore/loader/FrameLoader.h index 70e4b9f..a04937d 100644 --- a/WebCore/loader/FrameLoader.h +++ b/WebCore/loader/FrameLoader.h @@ -248,8 +248,6 @@ public: KURL baseURL() const; - void tokenizerProcessedData(); - void handledOnloadEvents(); String userAgent(const KURL&) const; @@ -311,7 +309,7 @@ public: void setTitle(const String&); void setIconURL(const String&); - void commitProvisionalLoad(PassRefPtr<CachedPage>); + void commitProvisionalLoad(); bool isLoadingFromCachedPage() const { return m_loadingFromCachedPage; } bool committingFirstRealLoad() const { return !m_creatingInitialEmptyDocument && !m_committedFirstRealDocumentLoad; } @@ -355,7 +353,9 @@ public: bool isDisplayingInitialEmptyDocument() const { return m_isDisplayingInitialEmptyDocument; } void clear(bool clearWindowProperties = true, bool clearScriptObjects = true, bool clearFrameView = true); - + + bool quickRedirectComing() const { return m_quickRedirectComing; } + bool shouldClose(); private: @@ -376,8 +376,7 @@ private: void navigateWithinDocument(HistoryItem*); void navigateToDifferentDocument(HistoryItem*, FrameLoadType); - bool loadProvisionalItemFromCachedPage(); - void cachePageForHistoryItem(HistoryItem*); + void loadProvisionalItemFromCachedPage(); void pageHidden(); void receivedFirstData(); @@ -418,7 +417,7 @@ private: void setState(FrameState); void closeOldDataSources(); - void open(CachedPage&); + void prepareForCachedPageRestore(); void updateHistoryAfterClientRedirect(); diff --git a/WebCore/loader/ImageDocument.cpp b/WebCore/loader/ImageDocument.cpp index 69aaed1..8ab412f 100644 --- a/WebCore/loader/ImageDocument.cpp +++ b/WebCore/loader/ImageDocument.cpp @@ -44,7 +44,7 @@ #include "SegmentedString.h" #include "Settings.h" #include "Text.h" -#include "XMLTokenizer.h" +#include "XMLDocumentParser.h" using std::min; @@ -76,7 +76,7 @@ private: ImageDocument* m_doc; }; -class ImageTokenizer : public Tokenizer { +class ImageTokenizer : public DocumentParser { public: ImageTokenizer(ImageDocument* doc) : m_doc(doc) {} @@ -192,7 +192,7 @@ ImageDocument::ImageDocument(Frame* frame) setParseMode(Compat); } -Tokenizer* ImageDocument::createTokenizer() +DocumentParser* ImageDocument::createParser() { return new ImageTokenizer(this); } diff --git a/WebCore/loader/ImageDocument.h b/WebCore/loader/ImageDocument.h index 080b250..bd627b4 100644 --- a/WebCore/loader/ImageDocument.h +++ b/WebCore/loader/ImageDocument.h @@ -49,7 +49,7 @@ public: private: ImageDocument(Frame*); - virtual Tokenizer* createTokenizer(); + virtual DocumentParser* createParser(); virtual bool isImageDocument() const { return true; } void createDocumentStructure(); diff --git a/WebCore/loader/MediaDocument.cpp b/WebCore/loader/MediaDocument.cpp index 27361fc..e505c2f 100644 --- a/WebCore/loader/MediaDocument.cpp +++ b/WebCore/loader/MediaDocument.cpp @@ -45,19 +45,18 @@ #include "SegmentedString.h" #include "Settings.h" #include "Text.h" -#include "XMLTokenizer.h" +#include "XMLDocumentParser.h" namespace WebCore { using namespace HTMLNames; -class MediaTokenizer : public Tokenizer { +class MediaDocumentParser : public DocumentParser { public: - MediaTokenizer(Document* doc) : m_doc(doc), m_mediaElement(0) {} + MediaDocumentParser(Document* doc) : m_doc(doc), m_mediaElement(0) {} private: virtual void write(const SegmentedString&, bool appendData); - virtual void stopParsing(); virtual void finish(); virtual bool isWaitingForScripts() const; @@ -70,12 +69,12 @@ private: HTMLMediaElement* m_mediaElement; }; -void MediaTokenizer::write(const SegmentedString&, bool) +void MediaDocumentParser::write(const SegmentedString&, bool) { ASSERT_NOT_REACHED(); } -void MediaTokenizer::createDocumentStructure() +void MediaDocumentParser::createDocumentStructure() { ExceptionCode ec; RefPtr<Element> rootElement = m_doc->createElement(htmlTag, false); @@ -105,7 +104,7 @@ void MediaTokenizer::createDocumentStructure() frame->loader()->activeDocumentLoader()->mainResourceLoader()->setShouldBufferData(false); } -bool MediaTokenizer::writeRawData(const char*, int) +bool MediaDocumentParser::writeRawData(const char*, int) { ASSERT(!m_mediaElement); if (m_mediaElement) @@ -115,19 +114,14 @@ bool MediaTokenizer::writeRawData(const char*, int) finish(); return false; } - -void MediaTokenizer::stopParsing() -{ - Tokenizer::stopParsing(); -} - -void MediaTokenizer::finish() + +void MediaDocumentParser::finish() { if (!m_parserStopped) m_doc->finishedParsing(); } -bool MediaTokenizer::isWaitingForScripts() const +bool MediaDocumentParser::isWaitingForScripts() const { // A media document is never waiting for scripts return false; @@ -145,9 +139,9 @@ MediaDocument::~MediaDocument() ASSERT(!m_replaceMediaElementTimer.isActive()); } -Tokenizer* MediaDocument::createTokenizer() +DocumentParser* MediaDocument::createParser() { - return new MediaTokenizer(this); + return new MediaDocumentParser(this); } void MediaDocument::defaultEventHandler(Event* event) diff --git a/WebCore/loader/MediaDocument.h b/WebCore/loader/MediaDocument.h index aa751ab..98eb02f 100644 --- a/WebCore/loader/MediaDocument.h +++ b/WebCore/loader/MediaDocument.h @@ -46,7 +46,7 @@ private: MediaDocument(Frame*); virtual bool isMediaDocument() const { return true; } - virtual Tokenizer* createTokenizer(); + virtual DocumentParser* createParser(); virtual void defaultEventHandler(Event*); diff --git a/WebCore/loader/PluginDocument.cpp b/WebCore/loader/PluginDocument.cpp index 7024333..7833d41 100644 --- a/WebCore/loader/PluginDocument.cpp +++ b/WebCore/loader/PluginDocument.cpp @@ -39,20 +39,19 @@ #include "SegmentedString.h" #include "Settings.h" #include "Text.h" -#include "XMLTokenizer.h" +#include "XMLDocumentParser.h" namespace WebCore { using namespace HTMLNames; -class PluginTokenizer : public Tokenizer { +class PluginDocumentParser : public DocumentParser { public: - PluginTokenizer(Document* doc) : m_doc(doc), m_embedElement(0) {} + PluginDocumentParser(Document* doc) : m_doc(doc), m_embedElement(0) {} static Widget* pluginWidgetFromDocument(Document* doc); private: virtual void write(const SegmentedString&, bool appendData); - virtual void stopParsing(); virtual void finish(); virtual bool isWaitingForScripts() const; @@ -65,7 +64,7 @@ private: HTMLEmbedElement* m_embedElement; }; -Widget* PluginTokenizer::pluginWidgetFromDocument(Document* doc) +Widget* PluginDocumentParser::pluginWidgetFromDocument(Document* doc) { ASSERT(doc); RefPtr<Element> body = doc->body(); @@ -79,12 +78,12 @@ Widget* PluginTokenizer::pluginWidgetFromDocument(Document* doc) return 0; } -void PluginTokenizer::write(const SegmentedString&, bool) +void PluginDocumentParser::write(const SegmentedString&, bool) { ASSERT_NOT_REACHED(); } -void PluginTokenizer::createDocumentStructure() +void PluginDocumentParser::createDocumentStructure() { ExceptionCode ec; RefPtr<Element> rootElement = m_doc->createElement(htmlTag, false); @@ -110,7 +109,7 @@ void PluginTokenizer::createDocumentStructure() body->appendChild(embedElement, ec); } -bool PluginTokenizer::writeRawData(const char*, int) +bool PluginDocumentParser::writeRawData(const char*, int) { ASSERT(!m_embedElement); if (m_embedElement) @@ -134,19 +133,14 @@ bool PluginTokenizer::writeRawData(const char*, int) return false; } - -void PluginTokenizer::stopParsing() -{ - Tokenizer::stopParsing(); -} - -void PluginTokenizer::finish() + +void PluginDocumentParser::finish() { if (!m_parserStopped) m_doc->finishedParsing(); } -bool PluginTokenizer::isWaitingForScripts() const +bool PluginDocumentParser::isWaitingForScripts() const { // A plugin document is never waiting for scripts return false; @@ -158,14 +152,14 @@ PluginDocument::PluginDocument(Frame* frame) setParseMode(Compat); } -Tokenizer* PluginDocument::createTokenizer() +DocumentParser* PluginDocument::createParser() { - return new PluginTokenizer(this); + return new PluginDocumentParser(this); } Widget* PluginDocument::pluginWidget() { - return PluginTokenizer::pluginWidgetFromDocument(this); + return PluginDocumentParser::pluginWidgetFromDocument(this); } Node* PluginDocument::pluginNode() diff --git a/WebCore/loader/PluginDocument.h b/WebCore/loader/PluginDocument.h index 7ff028a..e3f98a7 100644 --- a/WebCore/loader/PluginDocument.h +++ b/WebCore/loader/PluginDocument.h @@ -46,7 +46,7 @@ public: private: PluginDocument(Frame*); - virtual Tokenizer* createTokenizer(); + virtual DocumentParser* createParser(); }; } diff --git a/WebCore/loader/SinkDocument.cpp b/WebCore/loader/SinkDocument.cpp index b9c892e..d40e567 100644 --- a/WebCore/loader/SinkDocument.cpp +++ b/WebCore/loader/SinkDocument.cpp @@ -26,17 +26,16 @@ #include "config.h" #include "SinkDocument.h" -#include "Tokenizer.h" +#include "DocumentParser.h" namespace WebCore { -class SinkTokenizer : public Tokenizer { +class SinkDocumentParser : public DocumentParser { public: - SinkTokenizer(Document* document) : m_document(document) { } + SinkDocumentParser(Document* document) : m_document(document) { } private: virtual void write(const SegmentedString&, bool) { ASSERT_NOT_REACHED(); } - virtual void stopParsing(); virtual void finish(); virtual bool isWaitingForScripts() const { return false; } @@ -46,12 +45,7 @@ private: Document* m_document; }; -void SinkTokenizer::stopParsing() -{ - Tokenizer::stopParsing(); -} - -void SinkTokenizer::finish() +void SinkDocumentParser::finish() { if (!m_parserStopped) m_document->finishedParsing(); @@ -63,9 +57,9 @@ SinkDocument::SinkDocument(Frame* frame) setParseMode(Compat); } -Tokenizer* SinkDocument::createTokenizer() +DocumentParser* SinkDocument::createParser() { - return new SinkTokenizer(this); + return new SinkDocumentParser(this); } } // namespace WebCore diff --git a/WebCore/loader/SinkDocument.h b/WebCore/loader/SinkDocument.h index c79ffc3..386660c 100644 --- a/WebCore/loader/SinkDocument.h +++ b/WebCore/loader/SinkDocument.h @@ -40,7 +40,7 @@ public: private: SinkDocument(Frame*); - virtual Tokenizer* createTokenizer(); + virtual DocumentParser* createParser(); }; diff --git a/WebCore/loader/TextDocument.cpp b/WebCore/loader/TextDocument.cpp index a3d7061..68335a7 100644 --- a/WebCore/loader/TextDocument.cpp +++ b/WebCore/loader/TextDocument.cpp @@ -30,7 +30,7 @@ #include "HTMLViewSourceDocument.h" #include "SegmentedString.h" #include "Text.h" -#include "XMLTokenizer.h" +#include "XMLDocumentParser.h" using namespace std; @@ -38,11 +38,11 @@ namespace WebCore { using namespace HTMLNames; -class TextTokenizer : public Tokenizer { +class TextDocumentParser : public DocumentParser { public: - TextTokenizer(Document*); - virtual ~TextTokenizer(); - TextTokenizer(HTMLViewSourceDocument*); + TextDocumentParser(Document*); + virtual ~TextDocumentParser(); + TextDocumentParser(HTMLViewSourceDocument*); virtual void write(const SegmentedString&, bool appendData); virtual void finish(); @@ -71,7 +71,7 @@ private: UChar* m_dest; }; -TextTokenizer::TextTokenizer(Document* doc) +TextDocumentParser::TextDocumentParser(Document* doc) : m_doc(doc) , m_preElement(0) , m_skipLF(false) @@ -82,8 +82,8 @@ TextTokenizer::TextTokenizer(Document* doc) m_dest = m_buffer; } -TextTokenizer::TextTokenizer(HTMLViewSourceDocument* doc) - : Tokenizer(true) +TextDocumentParser::TextDocumentParser(HTMLViewSourceDocument* doc) + : DocumentParser(true) , m_doc(doc) , m_preElement(0) , m_skipLF(false) @@ -94,13 +94,13 @@ TextTokenizer::TextTokenizer(HTMLViewSourceDocument* doc) m_dest = m_buffer; } -TextTokenizer::~TextTokenizer() +TextDocumentParser::~TextDocumentParser() { // finish() should have been called to prevent any leaks ASSERT(!m_buffer); } -void TextTokenizer::write(const SegmentedString& s, bool) +void TextDocumentParser::write(const SegmentedString& s, bool) { ExceptionCode ec; @@ -160,7 +160,7 @@ void TextTokenizer::write(const SegmentedString& s, bool) } } -void TextTokenizer::finish() +void TextDocumentParser::finish() { if (!m_preElement) write(SegmentedString(), true); // Create document structure for an empty text document. @@ -172,7 +172,7 @@ void TextTokenizer::finish() m_doc->finishedParsing(); } -bool TextTokenizer::isWaitingForScripts() const +bool TextDocumentParser::isWaitingForScripts() const { // A text document is never waiting for scripts return false; @@ -183,14 +183,14 @@ TextDocument::TextDocument(Frame* frame) { } -Tokenizer* TextDocument::createTokenizer() +DocumentParser* TextDocument::createParser() { - return new TextTokenizer(this); + return new TextDocumentParser(this); } -Tokenizer* createTextTokenizer(HTMLViewSourceDocument* document) +DocumentParser* createTextDocumentParser(HTMLViewSourceDocument* document) { - return new TextTokenizer(document); + return new TextDocumentParser(document); } } diff --git a/WebCore/loader/TextDocument.h b/WebCore/loader/TextDocument.h index 53e3074..02c7af5 100644 --- a/WebCore/loader/TextDocument.h +++ b/WebCore/loader/TextDocument.h @@ -41,10 +41,10 @@ public: private: TextDocument(Frame*); - virtual Tokenizer* createTokenizer(); + virtual DocumentParser* createParser(); }; -Tokenizer* createTextTokenizer(HTMLViewSourceDocument*); +DocumentParser* createTextDocumentParser(HTMLViewSourceDocument*); } diff --git a/WebCore/loader/TextResourceDecoder.cpp b/WebCore/loader/TextResourceDecoder.cpp index 6ddd604..e4fd855 100644 --- a/WebCore/loader/TextResourceDecoder.cpp +++ b/WebCore/loader/TextResourceDecoder.cpp @@ -568,7 +568,7 @@ bool TextResourceDecoder::checkForHeadCharset(const char* data, size_t len, bool if (xmlDeclarationEnd == pEnd) return false; // No need for +1, because we have an extra "?" to lose at the end of XML declaration. - int len; + int len = 0; int pos = findXMLEncoding(ptr, xmlDeclarationEnd - ptr, len); if (pos != -1) setEncoding(findTextEncoding(ptr + pos, len), EncodingFromXMLHeader); diff --git a/WebCore/loader/appcache/ApplicationCacheStorage.cpp b/WebCore/loader/appcache/ApplicationCacheStorage.cpp index 36c9bda..59232a5 100644 --- a/WebCore/loader/appcache/ApplicationCacheStorage.cpp +++ b/WebCore/loader/appcache/ApplicationCacheStorage.cpp @@ -625,7 +625,11 @@ bool ApplicationCacheStorage::store(ApplicationCacheResource* resource, unsigned ASSERT(!resource->storageID()); openDatabase(true); - + + // openDatabase(true) could still fail, for example when cacheStorage is full or no longer available. + if (!m_database.isOpen()) + return false; + // First, insert the data SQLiteStatement dataStatement(m_database, "INSERT INTO CacheResourceData (data) VALUES (?)"); if (dataStatement.prepare() != SQLResultOk) @@ -711,6 +715,9 @@ bool ApplicationCacheStorage::store(ApplicationCacheResource* resource, Applicat ASSERT(cache->storageID()); openDatabase(true); + + if (!m_database.isOpen()) + return false; m_isMaximumSizeReached = false; m_database.setMaximumSize(m_maximumSize); @@ -742,6 +749,9 @@ bool ApplicationCacheStorage::storeNewestCache(ApplicationCacheGroup* group) { openDatabase(true); + if (!m_database.isOpen()) + return false; + m_isMaximumSizeReached = false; m_database.setMaximumSize(m_maximumSize); diff --git a/WebCore/make-hash-tools.pl b/WebCore/make-hash-tools.pl new file mode 100644 index 0000000..42cb6fd --- /dev/null +++ b/WebCore/make-hash-tools.pl @@ -0,0 +1,62 @@ +#! /usr/bin/perl +# +# This file is part of the WebKit project +# +# Copyright (C) 2010 Andras Becsi (abecsi@inf.u-szeged.hu), University of Szeged +# +# 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. + +use strict; +use Switch; +use File::Basename; + +my $outdir = $ARGV[0]; +shift; +my $option = basename($ARGV[0],".gperf"); + +switch ($option) { + +case "HTMLEntityNames" { + + my $htmlEntityNamesGenerated = "$outdir/HTMLEntityNames.cpp"; + my $htmlEntityNamesGperf = $ARGV[0]; + shift; + + system("gperf --key-positions=\"*\" -D -s 2 $htmlEntityNamesGperf > $htmlEntityNamesGenerated") == 0 || die "calling gperf failed: $?"; + +} # case "HTMLEntityNames" + +case "DocTypeStrings" { + + my $docTypeStringsGenerated = "$outdir/DocTypeStrings.cpp"; + my $docTypeStringsGperf = $ARGV[0]; + shift; + + system("gperf --key-positions=\"*\" -s 2 $docTypeStringsGperf > $docTypeStringsGenerated") == 0 || die "calling gperf failed: $?"; + +} # case "DocTypeStrings" + +case "ColorData" { + + my $colorDataGenerated = "$outdir/ColorData.cpp"; + my $colorDataGperf = $ARGV[0]; + shift; + + system("gperf --key-positions=\"*\" -D -s 2 $colorDataGperf > $colorDataGenerated") == 0 || die "calling gperf failed: $?"; + +} # case "ColorData" + +} # switch ($option) diff --git a/WebCore/manual-tests/cur-hotspot.html b/WebCore/manual-tests/cur-hotspot.html new file mode 100644 index 0000000..f1cfb54 --- /dev/null +++ b/WebCore/manual-tests/cur-hotspot.html @@ -0,0 +1,12 @@ +<!DOCTYPE html> +<html xmlns="http://www.w3.org/1999/xhtml"> +<body> + <p>Test for .cur cursor intrinsic hot spot behavior. See <a href="https://bugs.webkit.org/show_bug.cgi?id=15779">bug 15779</a>.</p> + <div style="background:turquoise;cursor:url(resources/cur-hotspot.cur), auto; width:200px; height:200px; position:absolute; top:100px; left: 50px;">Mouse cursor should be upside down inside this box.</div> + + <div style="background:turquoise;cursor:url(resources/cur-hotspot.cur) 200 200, auto; width:200px; height:200px; position:absolute; top:100px; left: 300px;">Mouse cursor should be upside down inside this box.</div> + + <div style="background:turquoise;cursor:url(resources/cur-hotspot.cur) 0 0, auto; width:200px; height:200px; position:absolute; top:350px; left: 50px;">Mouse cursor should flip erratically, due to incorrect hot spot forced in CSS.</div> + +</body> +</html> diff --git a/WebCore/manual-tests/localstorage-empty-database.html b/WebCore/manual-tests/localstorage-empty-database.html new file mode 100644 index 0000000..a164127 --- /dev/null +++ b/WebCore/manual-tests/localstorage-empty-database.html @@ -0,0 +1,13 @@ +<html> +<body> +<script type="text/javascript"> + var x = localStorage.getItem('foo'); +</script> +<p>This page has called <code>localStorage.getItem('foo')</code>. +Since no data has been stored, no database file should have been created.</p> + +<p>If you click <a href="javascript:localStorage.setItem('bar', 'baz');">here</a>, data will be stored, and a database file should be created.</p> + +<p>(This is for <a href="https://bugs.webkit.org/show_bug.cgi?id=40301">https://bugs.webkit.org/show_bug.cgi?id=40301</a>.)</p> +</body> +</html> diff --git a/WebCore/manual-tests/resources/cur-hotspot.cur b/WebCore/manual-tests/resources/cur-hotspot.cur new file mode 100644 index 0000000..8107e47 Binary files /dev/null and b/WebCore/manual-tests/resources/cur-hotspot.cur differ diff --git a/WebCore/notifications/Notification.cpp b/WebCore/notifications/Notification.cpp index 182f713..5908634 100644 --- a/WebCore/notifications/Notification.cpp +++ b/WebCore/notifications/Notification.cpp @@ -38,6 +38,9 @@ #include "Document.h" #include "EventNames.h" +#include "ResourceRequest.h" +#include "ResourceResponse.h" +#include "ThreadableLoader.h" #include "WorkerContext.h" namespace WebCore { @@ -45,7 +48,7 @@ namespace WebCore { Notification::Notification(const KURL& url, ScriptExecutionContext* context, ExceptionCode& ec, NotificationPresenter* provider) : ActiveDOMObject(context, this) , m_isHTML(true) - , m_isShowing(false) + , m_state(Idle) , m_presenter(provider) { ASSERT(m_presenter); @@ -66,7 +69,7 @@ Notification::Notification(const NotificationContents& contents, ScriptExecution : ActiveDOMObject(context, this) , m_isHTML(false) , m_contents(contents) - , m_isShowing(false) + , m_state(Idle) , m_presenter(provider) { ASSERT(m_presenter); @@ -83,20 +86,48 @@ Notification::Notification(const NotificationContents& contents, ScriptExecution Notification::~Notification() { - m_presenter->notificationObjectDestroyed(this); + if (m_state == Loading) { + ASSERT_NOT_REACHED(); + cancel(); + } + if (m_presenter) + m_presenter->notificationObjectDestroyed(this); } void Notification::show() { +#if PLATFORM(QT) + if (iconURL().isEmpty()) { + // Set the state before actually showing, because + // handling of ondisplay may rely on that. + if (m_state == Idle) { + m_state = Showing; + m_presenter->show(this); + } + } else + startLoading(); +#else // prevent double-showing - if (!m_isShowing) - m_isShowing = m_presenter->show(this); + if (m_state == Idle && m_presenter->show(this)) + m_state = Showing; +#endif } void Notification::cancel() { - if (m_isShowing) + switch (m_state) { + case Idle: + break; + case Loading: + m_state = Cancelled; + stopLoading(); + break; + case Showing: m_presenter->cancel(this); + break; + case Cancelled: + break; + } } EventTargetData* Notification::eventTargetData() @@ -109,6 +140,73 @@ EventTargetData* Notification::ensureEventTargetData() return &m_eventTargetData; } + +void Notification::startLoading() +{ + if (m_state != Idle) + return; + setPendingActivity(this); + m_state = Loading; + ThreadableLoaderOptions options; + options.sendLoadCallbacks = false; + options.sniffContent = false; + options.forcePreflight = false; + options.allowCredentials = AllowStoredCredentials; + options.crossOriginRequestPolicy = AllowCrossOriginRequests; + m_loader = ThreadableLoader::create(scriptExecutionContext(), this, ResourceRequest(iconURL()), options); +} + +void Notification::stopLoading() +{ + m_iconData = 0; + RefPtr<ThreadableLoader> protect(m_loader); + m_loader->cancel(); +} + +void Notification::didReceiveResponse(const ResourceResponse& response) +{ + int status = response.httpStatusCode(); + if (status && (status < 200 || status > 299)) { + stopLoading(); + return; + } + m_iconData = SharedBuffer::create(); +} + +void Notification::didReceiveData(const char* data, int lengthReceived) +{ + m_iconData->append(data, lengthReceived); +} + +void Notification::didFinishLoading(unsigned long) +{ + finishLoading(); +} + +void Notification::didFail(const ResourceError&) +{ + finishLoading(); +} + +void Notification::didFailRedirectCheck() +{ + finishLoading(); +} + +void Notification::didReceiveAuthenticationCancellation(const ResourceResponse&) +{ + finishLoading(); +} + +void Notification::finishLoading() +{ + if (m_state == Loading) { + if (m_presenter->show(this)) + m_state = Showing; + } + unsetPendingActivity(this); +} + } // namespace WebCore #endif // ENABLE(NOTIFICATIONS) diff --git a/WebCore/notifications/Notification.h b/WebCore/notifications/Notification.h index 47de2a2..0e66b3d 100644 --- a/WebCore/notifications/Notification.h +++ b/WebCore/notifications/Notification.h @@ -43,6 +43,9 @@ #include "NotificationPresenter.h" #include "NotificationContents.h" #include "RegisteredEventListener.h" +#include "SharedBuffer.h" +#include "ThreadableLoader.h" +#include "ThreadableLoaderClient.h" #include <wtf/OwnPtr.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> @@ -53,10 +56,10 @@ namespace WebCore { class WorkerContext; - class Notification : public RefCounted<Notification>, public ActiveDOMObject, public EventTarget { + class Notification : public RefCounted<Notification>, public ActiveDOMObject, public ThreadableLoaderClient, public EventTarget { public: - static Notification* create(const KURL& url, ScriptExecutionContext* context, ExceptionCode& ec, NotificationPresenter* provider) { return new Notification(url, context, ec, provider); } - static Notification* create(const NotificationContents& contents, ScriptExecutionContext* context, ExceptionCode& ec, NotificationPresenter* provider) { return new Notification(contents, context, ec, provider); } + static PassRefPtr<Notification> create(const KURL& url, ScriptExecutionContext* context, ExceptionCode& ec, NotificationPresenter* provider) { return adoptRef(new Notification(url, context, ec, provider)); } + static PassRefPtr<Notification> create(const NotificationContents& contents, ScriptExecutionContext* context, ExceptionCode& ec, NotificationPresenter* provider) { return adoptRef(new Notification(contents, context, ec, provider)); } virtual ~Notification(); @@ -84,6 +87,21 @@ namespace WebCore { virtual ScriptExecutionContext* scriptExecutionContext() const { return ActiveDOMObject::scriptExecutionContext(); } virtual Notification* toNotification() { return this; } + void stopLoading(); + + SharedBuffer* iconData() { return m_iconData.get(); } + void releaseIconData() { m_iconData = 0; } + + // Called if the presenter is deleted before the notification is GC'd + void detachPresenter() { m_presenter = 0; } + + virtual void didReceiveResponse(const ResourceResponse&); + virtual void didReceiveData(const char* data, int lengthReceived); + virtual void didFinishLoading(unsigned long identifier); + virtual void didFail(const ResourceError&); + virtual void didFailRedirectCheck(); + virtual void didReceiveAuthenticationCancellation(const ResourceResponse&); + private: Notification(const KURL&, ScriptExecutionContext*, ExceptionCode&, NotificationPresenter*); Notification(const NotificationContents&, ScriptExecutionContext*, ExceptionCode&, NotificationPresenter*); @@ -94,18 +112,31 @@ namespace WebCore { virtual EventTargetData* eventTargetData(); virtual EventTargetData* ensureEventTargetData(); + void startLoading(); + void finishLoading(); + bool m_isHTML; KURL m_notificationURL; NotificationContents m_contents; String m_direction; String m_replaceId; - - bool m_isShowing; + + enum NotificationState { + Idle = 0, + Loading = 1, + Showing = 2, + Cancelled = 3 + }; + + NotificationState m_state; NotificationPresenter* m_presenter; EventTargetData m_eventTargetData; + + RefPtr<ThreadableLoader> m_loader; + RefPtr<SharedBuffer> m_iconData; }; } // namespace WebCore diff --git a/WebCore/notifications/NotificationCenter.h b/WebCore/notifications/NotificationCenter.h index acf1ae5..b72e07d 100644 --- a/WebCore/notifications/NotificationCenter.h +++ b/WebCore/notifications/NotificationCenter.h @@ -49,7 +49,7 @@ namespace WebCore { public: static PassRefPtr<NotificationCenter> create(ScriptExecutionContext* context, NotificationPresenter* presenter) { return adoptRef(new NotificationCenter(context, presenter)); } - Notification* createHTMLNotification(const String& URI, ExceptionCode& ec) + PassRefPtr<Notification> createHTMLNotification(const String& URI, ExceptionCode& ec) { if (!presenter()) { ec = INVALID_STATE_ERR; @@ -62,7 +62,7 @@ namespace WebCore { return Notification::create(m_scriptExecutionContext->completeURL(URI), context(), ec, presenter()); } - Notification* createNotification(const String& iconURI, const String& title, const String& body, ExceptionCode& ec) + PassRefPtr<Notification> createNotification(const String& iconURI, const String& title, const String& body, ExceptionCode& ec) { if (!presenter()) { ec = INVALID_STATE_ERR; diff --git a/WebCore/page/AbstractView.idl b/WebCore/page/AbstractView.idl index e4ece0f..6d8232b 100644 --- a/WebCore/page/AbstractView.idl +++ b/WebCore/page/AbstractView.idl @@ -32,7 +32,7 @@ module views { OmitConstructor ] AbstractView { readonly attribute Document document; - readonly attribute Media styleMedia; + readonly attribute StyleMedia styleMedia; }; } diff --git a/WebCore/page/Console.h b/WebCore/page/Console.h index 18e311f..04e743e 100644 --- a/WebCore/page/Console.h +++ b/WebCore/page/Console.h @@ -43,6 +43,7 @@ typedef Vector<RefPtr<ScriptProfile> > ProfilesArray; #endif class Frame; +class MemoryInfo; class Page; class String; class ScriptCallStack; diff --git a/WebCore/page/Console.idl b/WebCore/page/Console.idl index 9a7cdc0..1506210 100644 --- a/WebCore/page/Console.idl +++ b/WebCore/page/Console.idl @@ -60,6 +60,8 @@ module window { [CustomArgumentHandling] void group(); [CustomArgumentHandling] void groupCollapsed(); void groupEnd(); + + readonly attribute [CustomGetter] MemoryInfo memory; }; } diff --git a/WebCore/page/DOMWindow.cpp b/WebCore/page/DOMWindow.cpp index 9532ec9..413dba1 100644 --- a/WebCore/page/DOMWindow.cpp +++ b/WebCore/page/DOMWindow.cpp @@ -472,8 +472,6 @@ void DOMWindow::clear() #endif #if ENABLE(INDEXED_DATABASE) - if (m_indexedDatabaseRequest) - m_indexedDatabaseRequest->disconnectFrame(); m_indexedDatabaseRequest = 0; #endif } @@ -673,7 +671,7 @@ IndexedDatabaseRequest* DOMWindow::indexedDB() const // FIXME: See if indexedDatabase access is allowed. - m_indexedDatabaseRequest = IndexedDatabaseRequest::create(page->group().indexedDatabase(), m_frame); + m_indexedDatabaseRequest = IndexedDatabaseRequest::create(page->group().indexedDatabase()); return m_indexedDatabaseRequest.get(); } #endif diff --git a/WebCore/page/DOMWindow.idl b/WebCore/page/DOMWindow.idl index ec1645b..bf1d55d 100644 --- a/WebCore/page/DOMWindow.idl +++ b/WebCore/page/DOMWindow.idl @@ -449,6 +449,8 @@ module window { attribute [CustomGetter] HTMLImageElementConstructor Image; // Usable with new operator attribute [CustomGetter] HTMLOptionElementConstructor Option; // Usable with new operator + attribute CanvasPatternConstructor CanvasPattern; + attribute CanvasGradientConstructor CanvasGradient; attribute CanvasRenderingContext2DConstructor CanvasRenderingContext2D; attribute ImageDataConstructor ImageData; attribute [Conditional=3D_CANVAS,EnabledAtRuntime] WebGLRenderingContextConstructor WebGLRenderingContext; @@ -461,7 +463,7 @@ module window { attribute [JSCCustomGetter,Conditional=3D_CANVAS,EnabledAtRuntime] Uint16ArrayConstructor Uint16Array; // Usable with new operator attribute [JSCCustomGetter,Conditional=3D_CANVAS,EnabledAtRuntime] Int32ArrayConstructor Int32Array; // Usable with new operator attribute [JSCCustomGetter,Conditional=3D_CANVAS,EnabledAtRuntime] Uint32ArrayConstructor Uint32Array; // Usable with new operator - attribute [JSCCustomGetter,Conditional=3D_CANVAS,EnabledAtRuntime] FloatArrayConstructor FloatArray; // Usable with new operator + attribute [JSCCustomGetter,Conditional=3D_CANVAS,EnabledAtRuntime] Float32ArrayConstructor Float32Array; // Usable with new operator // Temporary aliases to keep current WebGL content working during transition period to TypedArray spec. // To be removed before WebGL spec is finalized. (FIXME) @@ -472,7 +474,7 @@ module window { attribute [CustomGetter,Conditional=3D_CANVAS,EnabledAtRuntime] Uint16ArrayConstructor WebGLUnsignedShortArray; // Usable with new operator attribute [CustomGetter,Conditional=3D_CANVAS,EnabledAtRuntime] Int32ArrayConstructor WebGLIntArray; // Usable with new operator attribute [CustomGetter,Conditional=3D_CANVAS,EnabledAtRuntime] Uint32ArrayConstructor WebGLUnsignedIntArray; // Usable with new operator - attribute [CustomGetter,Conditional=3D_CANVAS,EnabledAtRuntime] FloatArrayConstructor WebGLFloatArray; // Usable with new operator + attribute [CustomGetter,Conditional=3D_CANVAS,EnabledAtRuntime] Float32ArrayConstructor WebGLFloatArray; // Usable with new operator attribute EventConstructor Event; attribute BeforeLoadEventConstructor BeforeLoadEvent; @@ -744,4 +746,3 @@ module window { }; } - diff --git a/WebCore/page/DragController.cpp b/WebCore/page/DragController.cpp index ec69ea0..716772b 100644 --- a/WebCore/page/DragController.cpp +++ b/WebCore/page/DragController.cpp @@ -56,6 +56,7 @@ #include "PlatformKeyboardEvent.h" #include "RenderFileUploadControl.h" #include "RenderImage.h" +#include "RenderLayer.h" #include "RenderView.h" #include "ReplaceSelectionCommand.h" #include "ResourceRequest.h" @@ -109,9 +110,9 @@ static PassRefPtr<DocumentFragment> documentFragmentFromDragData(DragData* dragD if (PassRefPtr<DocumentFragment> fragment = dragData->asFragment(document)) return fragment; - if (dragData->containsURL()) { + if (dragData->containsURL(DragData::DoNotConvertFilenames)) { String title; - String url = dragData->asURL(&title); + String url = dragData->asURL(DragData::DoNotConvertFilenames, &title); if (!url.isEmpty()) { RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::create(document); anchor->setHref(url); diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp index 266881c..5fde80e 100644 --- a/WebCore/page/EventHandler.cpp +++ b/WebCore/page/EventHandler.cpp @@ -62,6 +62,7 @@ #include "PluginView.h" #endif #include "RenderFrameSet.h" +#include "RenderLayer.h" #include "RenderTextControlSingleLine.h" #include "RenderView.h" #include "RenderWidget.h" @@ -377,7 +378,7 @@ bool EventHandler::handleMousePressEventSingleClick(const MouseEventWithHitTestR m_frame->selection()->setIsDirectional(false); ASSERT(m_frame->settings()); - if (m_frame->settings()->editingBehavior() == EditingMacBehavior) { + if (m_frame->settings()->editingBehaviorType() == EditingMacBehavior) { // See <rdar://problem/3668157> REGRESSION (Mail): shift-click deselects when selection // was created right-to-left Position start = newSelection.start(); @@ -496,7 +497,7 @@ static bool canAutoscroll(RenderObject* renderer) // The code for this is in RenderLayer::scrollRectToVisible. if (renderer->node() != renderer->document()) return false; - Frame* frame = renderer->document()->frame(); + Frame* frame = renderer->frame(); if (!frame) return false; Page* page = frame->page(); @@ -1096,9 +1097,6 @@ Cursor EventHandler::selectCursor(const MouseEventWithHitTestResults& event, Scr IntSize size = cimage->image()->size(); if (size.width() > 128 || size.height() > 128) continue; - // Do not let the hotspot be outside the bounds of the image. - if (hotSpot.x() < 0 || hotSpot.y() < 0 || hotSpot.x() > size.width() || hotSpot.y() > size.height()) - continue; if (cimage->image()->isNull()) break; if (!cimage->errorOccurred()) diff --git a/WebCore/page/FocusController.cpp b/WebCore/page/FocusController.cpp index 372cb32..804341d 100644 --- a/WebCore/page/FocusController.cpp +++ b/WebCore/page/FocusController.cpp @@ -511,14 +511,19 @@ static void clearSelectionIfNeeded(Frame* oldFocusedFrame, Frame* newFocusedFram if (selectionStartNode == newFocusedNode || selectionStartNode->isDescendantOf(newFocusedNode) || selectionStartNode->shadowAncestorNode() == newFocusedNode) return; - if (Node* mousePressNode = newFocusedFrame->eventHandler()->mousePressNode()) - if (mousePressNode->renderer() && !mousePressNode->canStartSelection()) - if (Node* root = s->rootEditableElement()) - if (Node* shadowAncestorNode = root->shadowAncestorNode()) - // Don't do this for textareas and text fields, when they lose focus their selections should be cleared - // and then restored when they regain focus, to match other browsers. - if (!shadowAncestorNode->hasTagName(inputTag) && !shadowAncestorNode->hasTagName(textareaTag)) - return; + if (Node* mousePressNode = newFocusedFrame->eventHandler()->mousePressNode()) { + if (mousePressNode->renderer() && !mousePressNode->canStartSelection()) { + // Don't clear the selection for contentEditable elements, but do clear it for input and textarea. See bug 38696. + Node * root = s->rootEditableElement(); + if (!root) + return; + + if (Node* shadowAncestorNode = root->shadowAncestorNode()) { + if (!shadowAncestorNode->hasTagName(inputTag) && !shadowAncestorNode->hasTagName(textareaTag)) + return; + } + } + } s->clear(); } diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp index f0ce1f2..fb658d2 100644 --- a/WebCore/page/Frame.cpp +++ b/WebCore/page/Frame.cpp @@ -64,6 +64,7 @@ #include "Page.h" #include "PageGroup.h" #include "RegularExpression.h" +#include "RenderLayer.h" #include "RenderPart.h" #include "RenderTableCell.h" #include "RenderTextControl.h" @@ -141,8 +142,8 @@ Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* , m_redirectScheduler(this) , m_ownerElement(ownerElement) , m_script(this) - , m_selectionController(this) , m_editor(this) + , m_selectionController(this) , m_eventHandler(this) , m_animationController(this) , m_lifeSupportTimer(this, &Frame::lifeSupportTimerFired) diff --git a/WebCore/page/Frame.h b/WebCore/page/Frame.h index 7e80370..cb7e977 100644 --- a/WebCore/page/Frame.h +++ b/WebCore/page/Frame.h @@ -339,9 +339,9 @@ namespace WebCore { String m_kjsStatusBarText; String m_kjsDefaultStatusBarText; - mutable SelectionController m_selectionController; mutable VisibleSelection m_mark; mutable Editor m_editor; + mutable SelectionController m_selectionController; mutable EventHandler m_eventHandler; mutable AnimationController m_animationController; diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp index d549ff4..6fe8d38 100644 --- a/WebCore/page/FrameView.cpp +++ b/WebCore/page/FrameView.cpp @@ -47,6 +47,7 @@ #include "InspectorTimelineAgent.h" #include "OverflowEvent.h" #include "RenderEmbeddedObject.h" +#include "RenderLayer.h" #include "RenderPart.h" #include "RenderScrollbar.h" #include "RenderScrollbarPart.h" @@ -1071,7 +1072,11 @@ void FrameView::setScrollPosition(const IntPoint& scrollPoint) void FrameView::scrollPositionChanged() { frame()->eventHandler()->sendScrollEvent(); + repaintFixedElementsAfterScrolling(); +} +void FrameView::repaintFixedElementsAfterScrolling() +{ // For fixed position elements, update widget positions and compositing layers after scrolling, // but only if we're not inside of layout. if (!m_nestedLayoutCount && hasFixedObjects()) { diff --git a/WebCore/page/FrameView.h b/WebCore/page/FrameView.h index 203dc86..69cc67a 100644 --- a/WebCore/page/FrameView.h +++ b/WebCore/page/FrameView.h @@ -25,10 +25,10 @@ #ifndef FrameView_h #define FrameView_h -#include "Frame.h" +#include "Frame.h" // Only used by FrameView::inspectorTimelineAgent() #include "IntSize.h" -#include "Page.h" -#include "RenderLayer.h" +#include "Page.h" // Only used by FrameView::inspectorTimelineAgent() +#include "RenderObject.h" // For PaintBehavior #include "ScrollView.h" #include <wtf/Forward.h> #include <wtf/OwnPtr.h> @@ -37,7 +37,6 @@ namespace WebCore { class Color; class Event; -class Frame; class FrameViewPrivate; class InspectorTimelineAgent; class IntRect; @@ -46,6 +45,7 @@ class PlatformMouseEvent; class RenderLayer; class RenderObject; class RenderEmbeddedObject; +class RenderScrollbarPart; class ScheduledEvent; class String; @@ -143,7 +143,8 @@ public: virtual IntRect windowResizerRect() const; void setScrollPosition(const IntPoint&); - virtual void scrollPositionChanged(); + void scrollPositionChanged(); + virtual void repaintFixedElementsAfterScrolling(); String mediaType() const; void setMediaType(const String&); diff --git a/WebCore/page/Geolocation.h b/WebCore/page/Geolocation.h index fcb967f..f831b87 100644 --- a/WebCore/page/Geolocation.h +++ b/WebCore/page/Geolocation.h @@ -28,7 +28,6 @@ #define Geolocation_h #include "GeolocationPositionCache.h" -#include "GeolocationService.h" #include "Geoposition.h" #include "PositionCallback.h" #include "PositionError.h" @@ -36,6 +35,10 @@ #include "PositionOptions.h" #include "Timer.h" +#if !ENABLE(CLIENT_BASED_GEOLOCATION) +#include "GeolocationService.h" +#endif + namespace WebCore { class Frame; diff --git a/WebCore/page/GeolocationController.cpp b/WebCore/page/GeolocationController.cpp index 3812730..40f01ba 100644 --- a/WebCore/page/GeolocationController.cpp +++ b/WebCore/page/GeolocationController.cpp @@ -47,7 +47,10 @@ GeolocationController::~GeolocationController() void GeolocationController::addObserver(Geolocation* observer) { - ASSERT(!m_observers.contains(observer)); + // This may be called multiple times with the same observer, though removeObserver() + // is called only once with each. + if (m_observers.contains(observer)) + return; bool wasEmpty = m_observers.isEmpty(); m_observers.add(observer); diff --git a/WebCore/page/Location.idl b/WebCore/page/Location.idl index b020267..aad90ab 100644 --- a/WebCore/page/Location.idl +++ b/WebCore/page/Location.idl @@ -41,13 +41,16 @@ module window { CustomPrototypeDefineGetter, OmitConstructor ] Location { +#if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP attribute [DoNotCheckDomainSecurityOnSet, CustomSetter, V8DisallowShadowing] DOMString href; +#endif [Custom, V8OnInstance] void assign(in DOMString url); [Custom, V8OnInstance] void replace(in DOMString url); [Custom, V8OnInstance] void reload(); // URI decomposition attributes +#if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP attribute [CustomSetter] DOMString protocol; attribute [CustomSetter] DOMString host; attribute [CustomSetter] DOMString hostname; @@ -55,6 +58,7 @@ module window { attribute [CustomSetter] DOMString pathname; attribute [CustomSetter] DOMString search; attribute [CustomSetter] DOMString hash; +#endif #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT [DontEnum, Custom, V8OnInstance, V8ReadOnly] DOMString toString(); diff --git a/WebCore/page/MemoryInfo.cpp b/WebCore/page/MemoryInfo.cpp new file mode 100644 index 0000000..010a19c --- /dev/null +++ b/WebCore/page/MemoryInfo.cpp @@ -0,0 +1,47 @@ +/* + * 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 "MemoryInfo.h" + +#include "ScriptGCEvent.h" + +namespace WebCore { + +MemoryInfo::MemoryInfo() + : m_totalJSHeapSize(0), + m_usedJSHeapSize(0) +{ +#if ENABLE(INSPECTOR) + ScriptGCEvent::getHeapSize(m_usedJSHeapSize, m_totalJSHeapSize); +#endif +} + +} // namespace WebCore diff --git a/WebCore/page/MemoryInfo.h b/WebCore/page/MemoryInfo.h new file mode 100644 index 0000000..e9e0fa5 --- /dev/null +++ b/WebCore/page/MemoryInfo.h @@ -0,0 +1,55 @@ +/* + * 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 MemoryInfo_h +#define MemoryInfo_h + +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class MemoryInfo : public RefCounted<MemoryInfo> { +public: + static PassRefPtr<MemoryInfo> create() { return adoptRef(new MemoryInfo()); } + + size_t totalJSHeapSize() const { return m_totalJSHeapSize; } + size_t usedJSHeapSize() const { return m_usedJSHeapSize; } + +private: + MemoryInfo(); + + size_t m_totalJSHeapSize; + size_t m_usedJSHeapSize; +}; + +} // namespace WebCore + +#endif // MemoryInfo_h diff --git a/WebCore/page/MemoryInfo.idl b/WebCore/page/MemoryInfo.idl new file mode 100644 index 0000000..59b0081 --- /dev/null +++ b/WebCore/page/MemoryInfo.idl @@ -0,0 +1,40 @@ +/* + * 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. + */ + +module window { + + interface [OmitConstructor] MemoryInfo { + + readonly attribute unsigned long totalJSHeapSize; + readonly attribute unsigned long usedJSHeapSize; + + }; + +} diff --git a/WebCore/page/PositionCallback.h b/WebCore/page/PositionCallback.h index 5b7a202..5511d3e 100644 --- a/WebCore/page/PositionCallback.h +++ b/WebCore/page/PositionCallback.h @@ -26,14 +26,16 @@ #ifndef PositionCallback_h #define PositionCallback_h +#include "ActiveDOMObject.h" #include <wtf/RefCounted.h> namespace WebCore { class Geoposition; - class PositionCallback : public RefCounted<PositionCallback> { + class PositionCallback : public RefCounted<PositionCallback>, public ActiveDOMObject { public: + PositionCallback(ScriptExecutionContext* context) : ActiveDOMObject(context, this) { } virtual ~PositionCallback() { } virtual void handleEvent(Geoposition*) = 0; }; diff --git a/WebCore/page/PositionErrorCallback.h b/WebCore/page/PositionErrorCallback.h index e784297..a65e350 100644 --- a/WebCore/page/PositionErrorCallback.h +++ b/WebCore/page/PositionErrorCallback.h @@ -26,14 +26,16 @@ #ifndef PositionErrorCallback_h #define PositionErrorCallback_h +#include "ActiveDOMObject.h" #include <wtf/RefCounted.h> namespace WebCore { class PositionError; - class PositionErrorCallback : public RefCounted<PositionErrorCallback> { + class PositionErrorCallback : public RefCounted<PositionErrorCallback>, public ActiveDOMObject { public: + PositionErrorCallback(ScriptExecutionContext* context) : ActiveDOMObject(context, this) { } virtual ~PositionErrorCallback() { } virtual void handleEvent(PositionError*) = 0; }; diff --git a/WebCore/page/PrintContext.cpp b/WebCore/page/PrintContext.cpp index ffde0be..bc4b31a 100644 --- a/WebCore/page/PrintContext.cpp +++ b/WebCore/page/PrintContext.cpp @@ -24,6 +24,7 @@ #include "GraphicsContext.h" #include "Frame.h" #include "FrameView.h" +#include "RenderLayer.h" #include "RenderView.h" using namespace WebCore; diff --git a/WebCore/page/Settings.cpp b/WebCore/page/Settings.cpp index 268d8ae..9ee3e1f 100644 --- a/WebCore/page/Settings.cpp +++ b/WebCore/page/Settings.cpp @@ -125,7 +125,7 @@ Settings::Settings(Page* page) , m_enforceCSSMIMETypeInStrictMode(true) , m_usesEncodingDetector(false) , m_allowScriptsToCloseWindows(false) - , m_editingBehavior( + , m_editingBehaviorType( #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) // (PLATFORM(MAC) is always false in Chromium, hence the extra condition.) EditingMacBehavior @@ -145,9 +145,13 @@ Settings::Settings(Page* page) , m_loadDeferringEnabled(true) , m_tiledBackingStoreEnabled(false) , m_html5ParserEnabled(false) +<<<<<<< HEAD:WebCore/page/Settings.cpp #ifdef ANDROID_PLUGINS , m_pluginsOnDemand(false) #endif +======= + , m_paginateDuringLayoutEnabled(false) +>>>>>>> Webkit.org at r61121:WebCore/page/Settings.cpp { // A Frame may not have been created yet, so we initialize the AtomicString // hash before trying to use it. diff --git a/WebCore/page/Settings.h b/WebCore/page/Settings.h index 2f9637b..8e82891 100644 --- a/WebCore/page/Settings.h +++ b/WebCore/page/Settings.h @@ -28,6 +28,7 @@ #define Settings_h #include "AtomicString.h" +#include "EditingBehaviorTypes.h" #include "FontRenderingMode.h" #include "KURL.h" #include "ZoomMode.h" @@ -50,21 +51,6 @@ namespace WebCore { TextDirectionSubmenuAlwaysIncluded }; - // There are multiple editing details that are different on Windows than Macintosh. - // We use a single switch for all of them. Some examples: - // - // 1) Clicking below the last line of an editable area puts the caret at the end - // of the last line on Mac, but in the middle of the last line on Windows. - // 2) Pushing the down arrow key on the last line puts the caret at the end of the - // last line on Mac, but does nothing on Windows. A similar case exists on the - // top line. - // - // This setting is intended to control these sorts of behaviors. There are some other - // behaviors with individual function calls on EditorClient (smart copy and paste and - // selecting the space after a double click) that could be combined with this if - // if possible in the future. - enum EditingBehavior { EditingMacBehavior, EditingWindowsBehavior }; - class Settings : public Noncopyable { public: Settings(Page*); @@ -336,9 +322,9 @@ namespace WebCore { void setAllowScriptsToCloseWindows(bool); bool allowScriptsToCloseWindows() const { return m_allowScriptsToCloseWindows; } - void setEditingBehavior(EditingBehavior behavior) { m_editingBehavior = behavior; } - EditingBehavior editingBehavior() const { return static_cast<EditingBehavior>(m_editingBehavior); } - + void setEditingBehaviorType(EditingBehaviorType behavior) { m_editingBehaviorType = behavior; } + EditingBehaviorType editingBehaviorType() const { return static_cast<EditingBehaviorType>(m_editingBehaviorType); } + void setDownloadableBinaryFontsEnabled(bool); bool downloadableBinaryFontsEnabled() const { return m_downloadableBinaryFontsEnabled; } @@ -377,6 +363,9 @@ namespace WebCore { void setHTML5ParserEnabled(bool flag) { m_html5ParserEnabled = flag; } bool html5ParserEnabled() const { return m_html5ParserEnabled; } + void setPaginateDuringLayoutEnabled(bool flag) { m_paginateDuringLayoutEnabled = flag; } + bool paginateDuringLayoutEnabled() const { return m_paginateDuringLayoutEnabled; } + private: Page* m_page; @@ -483,7 +472,7 @@ namespace WebCore { bool m_enforceCSSMIMETypeInStrictMode : 1; bool m_usesEncodingDetector : 1; bool m_allowScriptsToCloseWindows : 1; - unsigned m_editingBehavior : 1; + unsigned m_editingBehaviorType : 1; bool m_downloadableBinaryFontsEnabled : 1; bool m_xssAuditorEnabled : 1; bool m_acceleratedCompositingEnabled : 1; @@ -494,10 +483,15 @@ namespace WebCore { bool m_loadDeferringEnabled : 1; bool m_tiledBackingStoreEnabled : 1; bool m_html5ParserEnabled: 1; +<<<<<<< HEAD:WebCore/page/Settings.h #ifdef ANDROID_PLUGINS bool m_pluginsOnDemand : 1; #endif +======= + bool m_paginateDuringLayoutEnabled : 1; + +>>>>>>> Webkit.org at r61121:WebCore/page/Settings.h #if USE(SAFARI_THEME) static bool gShouldPaintNativeControls; #endif diff --git a/WebCore/page/SpatialNavigation.cpp b/WebCore/page/SpatialNavigation.cpp index d7eaf25..0239c39 100644 --- a/WebCore/page/SpatialNavigation.cpp +++ b/WebCore/page/SpatialNavigation.cpp @@ -35,6 +35,7 @@ #include "HTMLFrameOwnerElement.h" #include "IntRect.h" #include "Node.h" +#include "RenderLayer.h" #include "Page.h" namespace WebCore { diff --git a/WebCore/page/WebKitPoint.h b/WebCore/page/WebKitPoint.h index 501b17f..ff5d442 100644 --- a/WebCore/page/WebKitPoint.h +++ b/WebCore/page/WebKitPoint.h @@ -26,6 +26,7 @@ #ifndef WebKitPoint_h #define WebKitPoint_h +#include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> namespace WebCore { diff --git a/WebCore/page/XSSAuditor.cpp b/WebCore/page/XSSAuditor.cpp index 9e225ff..b5aba79 100644 --- a/WebCore/page/XSSAuditor.cpp +++ b/WebCore/page/XSSAuditor.cpp @@ -170,7 +170,7 @@ bool XSSAuditor::canCreateInlineEventListener(const String&, const String& code) return true; } -bool XSSAuditor::canLoadExternalScriptFromSrc(const String& context, const String& url) const +bool XSSAuditor::canLoadExternalScriptFromSrc(const String& url) const { if (!isEnabled()) return true; @@ -179,8 +179,8 @@ bool XSSAuditor::canLoadExternalScriptFromSrc(const String& context, const Strin return true; FindTask task; - task.context = context; task.string = url; + task.allowRequestIfNoIllegalURICharacters = true; if (findInRequest(task)) { DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to execute a JavaScript script. Source code of script found within request.\n")); diff --git a/WebCore/page/XSSAuditor.h b/WebCore/page/XSSAuditor.h index d2f525d..7afbf07 100644 --- a/WebCore/page/XSSAuditor.h +++ b/WebCore/page/XSSAuditor.h @@ -66,7 +66,7 @@ namespace WebCore { // * ScriptController::executeIfJavaScriptURL - used to evaluate JavaScript URLs. // * ScriptEventListener::createAttributeEventListener - used to create JavaScript event handlers. // * HTMLBaseElement::process - used to set the document base URL. - // * HTMLTokenizer::parseTag - used to load external JavaScript scripts. + // * HTMLDocumentParser::parseTag - used to load external JavaScript scripts. // * FrameLoader::requestObject - used to load <object>/<embed> elements. // class XSSAuditor : public Noncopyable { @@ -90,7 +90,7 @@ namespace WebCore { // Determines whether the external script should be loaded based on the // content of any user-submitted data. - bool canLoadExternalScriptFromSrc(const String& context, const String& url) const; + bool canLoadExternalScriptFromSrc(const String& url) const; // Determines whether object should be loaded based on the content of // any user-submitted data. diff --git a/WebCore/page/qt/EventHandlerQt.cpp b/WebCore/page/qt/EventHandlerQt.cpp index ace8e54..18d9b73 100644 --- a/WebCore/page/qt/EventHandlerQt.cpp +++ b/WebCore/page/qt/EventHandlerQt.cpp @@ -43,12 +43,12 @@ #include "HitTestResult.h" #include "KeyboardEvent.h" #include "MouseEventWithHitTestResults.h" +#include "NotImplemented.h" #include "Page.h" #include "PlatformKeyboardEvent.h" #include "PlatformWheelEvent.h" #include "RenderWidget.h" #include "Scrollbar.h" -#include "NotImplemented.h" QT_BEGIN_NAMESPACE Q_GUI_EXPORT extern bool qt_tab_all_widgets; // from qapplication.cpp @@ -96,7 +96,7 @@ bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestR bool EventHandler::eventActivatedView(const PlatformMouseEvent&) const { - //Qt has an activation event which is sent independently + // Qt has an activation event which is sent independently // of mouse event so this thing will be a snafu to implement // correctly return false; diff --git a/WebCore/platform/BlobItem.cpp b/WebCore/platform/BlobItem.cpp new file mode 100644 index 0000000..949e7f8 --- /dev/null +++ b/WebCore/platform/BlobItem.cpp @@ -0,0 +1,243 @@ +/* + * 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 "BlobItem.h" + +#include "FileSystem.h" +#include "UUID.h" + +namespace WebCore { + +#if ENABLE(BLOB_SLICE) +static const double invalidModificationTime = 0; + +static double getFileSnapshotModificationTime(const String& path) +{ + // FIXME: synchronized file call + time_t modificationTime; + if (getFileModificationTime(path, modificationTime)) + return static_cast<double>(modificationTime); + return invalidModificationTime; +} +#endif // ENABLE(BLOB_SLICE) + +// DataBlobItem ---------------------------------------------------------------- + +#if ENABLE(BLOB_SLICE) +PassRefPtr<BlobItem> DataBlobItem::slice(long long start, long long length) +{ + ASSERT(start >= 0 && length >= 0); + ASSERT(static_cast<unsigned long long>(start) < size()); + if (!start && size() <= static_cast<unsigned long long>(length)) + return this; + if (static_cast<unsigned long long>(start + length) > size()) + length = size() - start; + return DataRangeBlobItem::create(this, start, length); +} +#endif // ENABLE(BLOB_SLICE) + +// FileBlobItem ---------------------------------------------------------------- + +PassRefPtr<BlobItem> FileBlobItem::create(const String& path) +{ + return adoptRef(static_cast<BlobItem*>(new FileBlobItem(path))); +} + +FileBlobItem::FileBlobItem(const String& path) + : m_path(path) + , m_fileName(pathGetFileName(m_path)) +{ +} + +unsigned long long FileBlobItem::size() const +{ + // FIXME: synchronized file call + long long size; + if (!getFileSize(m_path, size)) + return 0; + return static_cast<unsigned long long>(size); +} + +#if ENABLE(BLOB_SLICE) +PassRefPtr<BlobItem> FileBlobItem::slice(long long start, long long length) +{ + ASSERT(start >= 0 && length >= 0); + ASSERT(static_cast<unsigned long long>(start) < size()); + if (!start && size() <= static_cast<unsigned long long>(length)) + return this; + const FileRangeBlobItem* fileRangeItem = toFileRangeBlobItem(); + double modificationTime = fileRangeItem ? fileRangeItem->snapshotModificationTime() : getFileSnapshotModificationTime(path()); + return FileRangeBlobItem::create(path(), start, length, modificationTime); +} +#endif // ENABLE(BLOB_SLICE) + +// StringBlobItem -------------------------------------------------------------- + +PassRefPtr<BlobItem> StringBlobItem::create(const String& text, LineEnding ending, TextEncoding encoding) +{ + return adoptRef(static_cast<BlobItem*>(new StringBlobItem(text, ending, encoding))); +} + +PassRefPtr<BlobItem> StringBlobItem::create(const CString& text) +{ + return adoptRef(static_cast<BlobItem*>(new StringBlobItem(text))); +} + +StringBlobItem::StringBlobItem(const String& text, LineEnding ending, TextEncoding encoding) + : m_data(StringBlobItem::convertToCString(text, ending, encoding)) +{ +} + +StringBlobItem::StringBlobItem(const CString& text) + : m_data(text) +{ +} + +CString StringBlobItem::convertToCString(const String& text, LineEnding ending, TextEncoding encoding) +{ + CString from = encoding.encode(text.characters(), text.length(), EntitiesForUnencodables); + CString result = from; + + if (ending == EndingTransparent) + return result; + + const char* endingChars = (ending == EndingCRLF) ? "\r\n" : ((ending == EndingCR) ? "\r" : "\n"); + + int endingLength = (ending == EndingCRLF) ? 2 : 1; + int needFix = 0; + + // Calculate the final length. + int calculatedLength = from.length(); + const char* p = from.data(); + while (char c = *p++) { + if (c == '\r') { + // Safe to look ahead because of trailing '\0'. + if (*p == '\n' && ending != EndingCRLF) { + calculatedLength += (endingLength - 2); + ++needFix; + } else if (ending != EndingCR) { + calculatedLength += (endingLength - 1); + ++needFix; + } + } else if (c == '\n' && ending != EndingLF) { + calculatedLength += (endingLength - 1); + ++needFix; + } + } + + if (!needFix) + return result; + + // Convert the endings and create a data buffer. + p = from.data(); + char* q; + result = CString::newUninitialized(calculatedLength, q); + while (char c = *p++) { + if (c == '\r') { + if (*p == '\n' && ending != EndingCRLF) { + memcpy(q, endingChars, endingLength); + q += endingLength; + } else if (*p != '\n' && ending != EndingCR) { + memcpy(q, endingChars, endingLength); + q += endingLength; + } + } else if (c == '\n' && ending != EndingLF) { + memcpy(q, endingChars, endingLength); + q += endingLength; + } else { + // Leave other characters alone. + *q++ = c; + } + } + return result; +} + +// ByteArrayBlobItem ---------------------------------------------------------- + +PassRefPtr<BlobItem> ByteArrayBlobItem::create(const char* data, size_t size) +{ + return adoptRef(static_cast<BlobItem*>(new ByteArrayBlobItem(data, size))); +} + +ByteArrayBlobItem::ByteArrayBlobItem(const char* data, size_t size) +{ + m_bytesArray.append(data, size); +} + +#if ENABLE(BLOB_SLICE) + +// DataRangeBlobItem ----------------------------------------------------------- + +PassRefPtr<BlobItem> DataRangeBlobItem::create(PassRefPtr<DataBlobItem> item, long long start, long long length) +{ + return adoptRef(static_cast<BlobItem*>(new DataRangeBlobItem(item, start, length))); +} + +DataRangeBlobItem::DataRangeBlobItem(PassRefPtr<DataBlobItem> item, long long start, long long length) + : m_length(length) +{ + const DataRangeBlobItem* rangeItem = m_item->toDataRangeBlobItem(); + if (rangeItem) { + m_item = rangeItem->m_item; + m_start = start + rangeItem->m_start; + ASSERT(!m_item->toDataRangeBlobItem()); + ASSERT(static_cast<unsigned long long>(m_start + m_length) <= m_item->size()); + } else { + m_item = item; + m_start = start; + } +} + +const char* DataRangeBlobItem::data() const +{ + return m_item->data() + m_start; +} + +// FileRangeBlobItem ----------------------------------------------------------- + +PassRefPtr<BlobItem> FileRangeBlobItem::create(const String& path, long long start, long long length, double snapshotModificationTime) +{ + return adoptRef(static_cast<BlobItem*>(new FileRangeBlobItem(path, start, length, snapshotModificationTime))); +} + +FileRangeBlobItem::FileRangeBlobItem(const String& path, long long start, long long length, double modificationTime) + : FileBlobItem(path) + , m_start(start) + , m_length(length) + , m_snapshotModificationTime(modificationTime) +{ + m_uniqueName = "Blob" + createCanonicalUUIDString(); + m_uniqueName.replace("-", ""); // For safty, remove '-' from the filename snce some servers may not like it. +} + +#endif // ENABLE(BLOB_SLICE) + +} // namespace WebCore diff --git a/WebCore/platform/BlobItem.h b/WebCore/platform/BlobItem.h new file mode 100644 index 0000000..f2ee56b --- /dev/null +++ b/WebCore/platform/BlobItem.h @@ -0,0 +1,209 @@ +/* + * 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 BlobItem_h +#define BlobItem_h + +#include "PlatformString.h" +#include "TextEncoding.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/Vector.h> +#include <wtf/text/CString.h> + +namespace WebCore { + +// String ending types. +enum LineEnding { + EndingTransparent = 0, + EndingLF, + EndingCR, + EndingCRLF, +}; + +class ByteArrayBlobItem; +class DataBlobItem; +class DataRangeBlobItem; +class FileBlobItem; +class FileRangeBlobItem; +class StringBlobItem; + +// A base interface for all arbitrary-data-object component items. +// The BlobItem and its subclasses are structured like the following: +// BlobItem +// | +// +-------> DataBlobItem +// | | +// | +---------> StringBlobItem +// | +---------> ByteArrayBlobItem +// | +---------> DataRangeBlobItem +// | +// +-------> FileBlobItem +// | +// +---------> FileRangeBlobItem +// +class BlobItem : public RefCounted<BlobItem> { +public: + virtual ~BlobItem() { } + virtual unsigned long long size() const = 0; + + virtual const DataBlobItem* toDataBlobItem() const { return 0; } + virtual const StringBlobItem* toStringBlobItem() const { return 0; } + virtual const ByteArrayBlobItem* toByteArrayBlobItem() const { return 0; } + virtual const FileBlobItem* toFileBlobItem() const { return 0; } +#if ENABLE(BLOB_SLICE) + virtual const DataRangeBlobItem* toDataRangeBlobItem() const { return 0; } + virtual const FileRangeBlobItem* toFileRangeBlobItem() const { return 0; } + + // Note: no external methods except for Blob::slice should call this. + virtual PassRefPtr<BlobItem> slice(long long start, long long length) = 0; +#endif // ENABLE(BLOB_SLICE) + +protected: + BlobItem() { } +}; + +typedef Vector<RefPtr<BlobItem> > BlobItemList; + +class DataBlobItem : public BlobItem { +public: + virtual const char* data() const = 0; + + // BlobItem methods. + virtual const DataBlobItem* toDataBlobItem() const { return this; } +#if ENABLE(BLOB_SLICE) + virtual PassRefPtr<BlobItem> slice(long long start, long long length); +#endif // ENABLE(BLOB_SLICE) +}; + +class FileBlobItem : public BlobItem { +public: + static PassRefPtr<BlobItem> create(const String& path); + virtual const String& name() const { return m_fileName; } + virtual const String& path() const { return m_path; } + + // BlobItem methods. + virtual unsigned long long size() const; + virtual const FileBlobItem* toFileBlobItem() const { return this; } +#if ENABLE(BLOB_SLICE) + virtual PassRefPtr<BlobItem> slice(long long start, long long length); +#endif // ENABLE(BLOB_SLICE) + +protected: + FileBlobItem(const String& path); + String m_path; + String m_fileName; +}; + +class StringBlobItem : public DataBlobItem { +public: + static PassRefPtr<BlobItem> create(const String&, LineEnding, TextEncoding); + static PassRefPtr<BlobItem> create(const CString&); + const CString& cstr() const { return m_data; } + + // BlobItem methods. + virtual unsigned long long size() const { return m_data.length(); } + virtual const StringBlobItem* toStringBlobItem() const { return this; } + + // DataBlobItem methods. + virtual const char* data() const { return m_data.data(); } + +private: + StringBlobItem(const String&, LineEnding, TextEncoding); + StringBlobItem(const CString&); + static CString convertToCString(const String&, LineEnding, TextEncoding); + CString m_data; +}; + +class ByteArrayBlobItem : public DataBlobItem { +public: + static PassRefPtr<BlobItem> create(const char* data, size_t size); + + // BlobItem methods. + virtual unsigned long long size() const { return m_bytesArray.size(); } + virtual const ByteArrayBlobItem* toByteArrayBlobItem() const { return this; } + + // DataBlobItem methods. + virtual const char* data() const { return m_bytesArray.data(); } + +private: + ByteArrayBlobItem(const char* data, size_t size); + Vector<char> m_bytesArray; +}; + +#if ENABLE(BLOB_SLICE) + +// BlobItem class for sliced data (string or bytes-array). +class DataRangeBlobItem : public DataBlobItem { +public: + static PassRefPtr<BlobItem> create(PassRefPtr<DataBlobItem>, long long start, long long length); + + // BlobItem methods. + virtual unsigned long long size() const { return m_length; } + virtual const DataRangeBlobItem* toDataRangeBlobItem() const { return this; } + + // DataBlobItem methods. + virtual const char* data() const; + +private: + DataRangeBlobItem(PassRefPtr<DataBlobItem>, long long start, long long length); + RefPtr<DataBlobItem> m_item; + long long m_start; + long long m_length; +}; + +class FileRangeBlobItem : public FileBlobItem { +public: + static PassRefPtr<BlobItem> create(const String& path, long long start, long long length, double snapshotModificationTime); + long long start() const { return m_start; } + double snapshotModificationTime() const { return m_snapshotModificationTime; } + + // BlobItem methods. + virtual unsigned long long size() const { return m_length; } + virtual const FileRangeBlobItem* toFileRangeBlobItem() const { return this; } + + // FileBlobItem methods. + virtual const String& name() const { return m_uniqueName; } + +private: + FileRangeBlobItem(const String& path, long long start, long long length, double snapshotModificationTime); + long long m_start; + long long m_length; + String m_uniqueName; + + double m_snapshotModificationTime; +}; + +#endif // ENABLE(BLOB_SLICE) + +} // namespace WebCore + +#endif // BlobItem_h diff --git a/WebCore/platform/ColorData.gperf b/WebCore/platform/ColorData.gperf index 8a54916..11ef798 100644 --- a/WebCore/platform/ColorData.gperf +++ b/WebCore/platform/ColorData.gperf @@ -1,4 +1,16 @@ -struct NamedColor { const char *name; int RGBValue; }; +%struct-type +struct NamedColor { + const char *name; + int RGBValue; +}; +%language=ANSI-C +%readonly-tables +%global-table +%compare-strncmp +%define lookup-function-name findColor +%define hash-function-name colordata_hash_function +%includes +%enum %% aliceblue, 0xf0f8ff antiquewhite, 0xfaebd7 diff --git a/WebCore/platform/ContextMenu.cpp b/WebCore/platform/ContextMenu.cpp index 66d3496..00bb253 100644 --- a/WebCore/platform/ContextMenu.cpp +++ b/WebCore/platform/ContextMenu.cpp @@ -570,6 +570,7 @@ void ContextMenu::addInspectElementItem() return; ContextMenuItem InspectElementItem(ActionType, ContextMenuItemTagInspectElement, contextMenuItemTagInspectElement()); + appendItem(*separatorItem()); appendItem(InspectElementItem); } #endif // ENABLE(INSPECTOR) diff --git a/WebCore/platform/Cursor.cpp b/WebCore/platform/Cursor.cpp new file mode 100644 index 0000000..794a9dc --- /dev/null +++ b/WebCore/platform/Cursor.cpp @@ -0,0 +1,49 @@ +/* + * 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 + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "Cursor.h" + +#include "Image.h" + +namespace WebCore { + +IntPoint determineHotSpot(Image* image, const IntPoint& specifiedHotSpot) +{ + // Hot spot must be inside cursor rectangle. + IntRect imageRect = image->rect(); + if (imageRect.contains(specifiedHotSpot)) + return specifiedHotSpot; + + // If hot spot is not specified externally, it can be extracted from some image formats (e.g. .cur). + IntPoint intrinsicHotSpot; + bool imageHasIntrinsicHotSpot = image->getHotSpot(intrinsicHotSpot); + if (imageHasIntrinsicHotSpot && imageRect.contains(intrinsicHotSpot)) + return intrinsicHotSpot; + + return IntPoint(); +} + +} diff --git a/WebCore/platform/Cursor.h b/WebCore/platform/Cursor.h index 76f19e9..12b1614 100644 --- a/WebCore/platform/Cursor.h +++ b/WebCore/platform/Cursor.h @@ -110,7 +110,7 @@ namespace WebCore { #endif { } - Cursor(Image*, const IntPoint& hotspot); + Cursor(Image*, const IntPoint& hotSpot); Cursor(const Cursor&); ~Cursor(); Cursor& operator=(const Cursor&); @@ -122,6 +122,8 @@ namespace WebCore { PlatformCursor m_impl; }; + IntPoint determineHotSpot(Image*, const IntPoint& specifiedHotSpot); + const Cursor& pointerCursor(); const Cursor& crossCursor(); const Cursor& handCursor(); diff --git a/WebCore/platform/DragData.h b/WebCore/platform/DragData.h index 5020739..eda7e7e 100644 --- a/WebCore/platform/DragData.h +++ b/WebCore/platform/DragData.h @@ -80,6 +80,8 @@ namespace WebCore { class DragData { public: + enum FilenameConversionPolicy { DoNotConvertFilenames, ConvertFilenames }; + #if PLATFORM(MAC) //FIXME: In the future the WebKit functions provided by the helper class should be moved into WebCore, //after which this constructor should be removed @@ -94,10 +96,10 @@ namespace WebCore { DragDataRef platformData() const { return m_platformDragData; } DragOperation draggingSourceOperationMask() const { return m_draggingSourceOperationMask; } PassRefPtr<Clipboard> createClipboard(ClipboardAccessPolicy) const; - bool containsURL() const; + bool containsURL(FilenameConversionPolicy filenamePolicy = ConvertFilenames) const; bool containsPlainText() const; bool containsCompatibleContent() const; - String asURL(String* title = 0) const; + String asURL(FilenameConversionPolicy filenamePolicy = ConvertFilenames, String* title = 0) const; String asPlainText() const; void asFilenames(Vector<String>&) const; Color asColor() const; diff --git a/WebCore/platform/FileSystem.cpp b/WebCore/platform/FileSystem.cpp deleted file mode 100644 index 01318e3..0000000 --- a/WebCore/platform/FileSystem.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2010 Company 100, Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "FileSystem.h" - -#include <wtf/text/CString.h> - -namespace WebCore { - -#if !PLATFORM(GTK) && !PLATFORM(EFL) -char* filenameFromString(const String& string) -{ - return fastStrDup(string.utf8().data()); -} -#endif - -} // namespace WebCore diff --git a/WebCore/platform/FileSystem.h b/WebCore/platform/FileSystem.h index c79237b..f270c31 100644 --- a/WebCore/platform/FileSystem.h +++ b/WebCore/platform/FileSystem.h @@ -172,8 +172,6 @@ String roamingUserSpecificStorageDirectory(); bool safeCreateFile(const String&, CFDataRef); #endif -char* filenameFromString(const String&); - #if PLATFORM(GTK) String filenameToString(const char*); String filenameForDisplay(const String&); diff --git a/WebCore/platform/PlatformMouseEvent.h b/WebCore/platform/PlatformMouseEvent.h index 5121995..be25973 100644 --- a/WebCore/platform/PlatformMouseEvent.h +++ b/WebCore/platform/PlatformMouseEvent.h @@ -122,6 +122,7 @@ namespace WebCore { #if PLATFORM(GTK) PlatformMouseEvent(GdkEventButton*); PlatformMouseEvent(GdkEventMotion*); + void setClickCount(int count) { m_clickCount = count; } #endif #if PLATFORM(EFL) diff --git a/WebCore/platform/PopupMenuClient.h b/WebCore/platform/PopupMenuClient.h index 2f3f892..bffde92 100644 --- a/WebCore/platform/PopupMenuClient.h +++ b/WebCore/platform/PopupMenuClient.h @@ -38,6 +38,8 @@ class PopupMenuClient { public: virtual ~PopupMenuClient() {} virtual void valueChanged(unsigned listIndex, bool fireEvents = true) = 0; + virtual void selectionChanged(unsigned listIndex, bool fireEvents = true) = 0; + virtual void selectionCleared() = 0; virtual String itemText(unsigned listIndex) const = 0; virtual String itemToolTip(unsigned listIndex) const = 0; diff --git a/WebCore/platform/ScrollView.cpp b/WebCore/platform/ScrollView.cpp index 3ed65c3..87d58c7 100644 --- a/WebCore/platform/ScrollView.cpp +++ b/WebCore/platform/ScrollView.cpp @@ -322,7 +322,7 @@ void ScrollView::valueChanged(Scrollbar* scrollbar) if (scrollbarsSuppressed()) return; - scrollPositionChanged(); + repaintFixedElementsAfterScrolling(); scrollContents(scrollDelta); } diff --git a/WebCore/platform/ScrollView.h b/WebCore/platform/ScrollView.h index 27bdedd..8bda7af 100644 --- a/WebCore/platform/ScrollView.h +++ b/WebCore/platform/ScrollView.h @@ -305,7 +305,7 @@ private: void updateScrollbars(const IntSize& desiredOffset); // Called when the scroll position within this view changes. FrameView overrides this to generate repaint invalidations. - virtual void scrollPositionChanged() {} + virtual void repaintFixedElementsAfterScrolling() {} void platformInit(); void platformDestroy(); diff --git a/WebCore/platform/ThemeTypes.h b/WebCore/platform/ThemeTypes.h index 657797f..7314fba 100644 --- a/WebCore/platform/ThemeTypes.h +++ b/WebCore/platform/ThemeTypes.h @@ -56,7 +56,9 @@ enum ControlPart { SliderHorizontalPart, SliderVerticalPart, SliderThumbHorizontalPart, SliderThumbVerticalPart, CaretPart, SearchFieldPart, SearchFieldDecorationPart, SearchFieldResultsDecorationPart, SearchFieldResultsButtonPart, - SearchFieldCancelButtonPart, TextFieldPart, TextAreaPart, CapsLockIndicatorPart + SearchFieldCancelButtonPart, TextFieldPart, CapsLockIndicatorPart, + RelevancyLevelIndicatorPart, ContinuousCapacityLevelIndicatorPart, DiscreteCapacityLevelIndicatorPart, RatingLevelIndicatorPart, + TextAreaPart }; enum SelectionPart { diff --git a/WebCore/platform/android/DragDataAndroid.cpp b/WebCore/platform/android/DragDataAndroid.cpp index 39b2963..756d007 100644 --- a/WebCore/platform/android/DragDataAndroid.cpp +++ b/WebCore/platform/android/DragDataAndroid.cpp @@ -68,12 +68,12 @@ bool DragData::containsCompatibleContent() const return false; } -bool DragData::containsURL() const +bool DragData::containsURL(FilenameConversionPolicy) const { return false; } -String DragData::asURL(String*) const +String DragData::asURL(FilenameConversionPolicy, String*) const { return String(); } diff --git a/WebCore/platform/animation/Animation.h b/WebCore/platform/animation/Animation.h index a629f43..cabb0eb 100644 --- a/WebCore/platform/animation/Animation.h +++ b/WebCore/platform/animation/Animation.h @@ -39,7 +39,8 @@ class Animation : public RefCounted<Animation> { public: ~Animation(); - static PassRefPtr<Animation> create() { return adoptRef(new Animation); }; + static PassRefPtr<Animation> create() { return adoptRef(new Animation); } + static PassRefPtr<Animation> create(const Animation* o) { return adoptRef(new Animation(*o)); } bool isDelaySet() const { return m_delaySet; } bool isDirectionSet() const { return m_directionSet; } diff --git a/WebCore/platform/animation/AnimationList.cpp b/WebCore/platform/animation/AnimationList.cpp index bd5fdee..58a40aa 100644 --- a/WebCore/platform/animation/AnimationList.cpp +++ b/WebCore/platform/animation/AnimationList.cpp @@ -31,6 +31,12 @@ if (i < size() && i != 0) { \ animation(i)->propSet(animation(j)->propGet()); \ } +AnimationList::AnimationList(const AnimationList& o) +{ + for (size_t i = 0; i < o.size(); ++i) + m_animations.append(Animation::create(o.animation(i))); +} + void AnimationList::fillUnsetProperties() { size_t i; diff --git a/WebCore/platform/animation/AnimationList.h b/WebCore/platform/animation/AnimationList.h index afad422..9a334ca 100644 --- a/WebCore/platform/animation/AnimationList.h +++ b/WebCore/platform/animation/AnimationList.h @@ -33,6 +33,9 @@ namespace WebCore { class AnimationList : public FastAllocBase { public: + AnimationList() { } + AnimationList(const AnimationList&); + void fillUnsetProperties(); bool operator==(const AnimationList& o) const; bool operator!=(const AnimationList& o) const @@ -51,6 +54,8 @@ public: const Animation* animation(size_t i) const { return m_animations[i].get(); } private: + AnimationList& operator=(const AnimationList&); + Vector<RefPtr<Animation> > m_animations; }; diff --git a/WebCore/platform/brew/ClipboardBrew.cpp b/WebCore/platform/brew/ClipboardBrew.cpp new file mode 100644 index 0000000..3fd085a --- /dev/null +++ b/WebCore/platform/brew/ClipboardBrew.cpp @@ -0,0 +1,117 @@ +/* + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2010 Company 100, Inc. + * + * 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 "ClipboardBrew.h" + +#include "CachedImage.h" +#include "Element.h" +#include "FileList.h" +#include "Frame.h" +#include "NotImplemented.h" +#include "Range.h" + +namespace WebCore { + +ClipboardBrew::ClipboardBrew(ClipboardAccessPolicy policy, bool isForDragging) + : Clipboard(policy, isForDragging) +{ +} + +ClipboardBrew::~ClipboardBrew() +{ +} + +void ClipboardBrew::clearData(const String&) +{ + ASSERT(isForDragging()); +} + +void ClipboardBrew::clearAllData() +{ + ASSERT(isForDragging()); +} + +String ClipboardBrew::getData(const String&, bool& success) const +{ + success = false; + return ""; +} + +bool ClipboardBrew::setData(const String&, const String&) +{ + ASSERT(isForDragging()); + return false; +} + +// extensions beyond IE's API +HashSet<String> ClipboardBrew::types() const +{ + return HashSet<String>(); +} + +PassRefPtr<FileList> ClipboardBrew::files() const +{ + notImplemented(); + return 0; +} + +void ClipboardBrew::setDragImage(CachedImage*, const IntPoint&) +{ +} + +void ClipboardBrew::setDragImageElement(Node*, const IntPoint&) +{ +} + +DragImageRef ClipboardBrew::createDragImage(IntPoint&) const +{ + return 0; +} + +void ClipboardBrew::declareAndWriteDragImage(Element*, const KURL&, const String&, Frame*) +{ +} + +void ClipboardBrew::writeURL(const KURL&, const String&, Frame*) +{ +} + +void ClipboardBrew::writeRange(Range* selectedRange, Frame*) +{ + ASSERT(selectedRange); +} + +void ClipboardBrew::writePlainText(const String&) +{ +} + +bool ClipboardBrew::hasData() +{ + return false; +} + +} // namespace WebCore diff --git a/WebCore/platform/brew/ClipboardBrew.h b/WebCore/platform/brew/ClipboardBrew.h new file mode 100644 index 0000000..a966db1 --- /dev/null +++ b/WebCore/platform/brew/ClipboardBrew.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2010 Company 100, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ClipboardBrew_h +#define ClipboardBrew_h + +#include "CachedResourceClient.h" +#include "Clipboard.h" + +namespace WebCore { + +class CachedImage; + +class ClipboardBrew : public Clipboard, public CachedResourceClient { +public: + ClipboardBrew(ClipboardAccessPolicy policy, bool isForDragging); + ~ClipboardBrew(); + + void clearData(const String&); + void clearAllData(); + String getData(const String&, bool& success) const; + bool setData(const String&, const String&); + + // extensions beyond IE's API + HashSet<String> types() const; + virtual PassRefPtr<FileList> files() const; + + void setDragImage(CachedImage*, const IntPoint&); + void setDragImageElement(Node*, const IntPoint&); + + virtual DragImageRef createDragImage(IntPoint&) const; + 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(); +}; + +} // namespace WebCore + +#endif // ClipboardBrew_h diff --git a/WebCore/platform/brew/ContextMenuBrew.cpp b/WebCore/platform/brew/ContextMenuBrew.cpp new file mode 100644 index 0000000..924e9dd --- /dev/null +++ b/WebCore/platform/brew/ContextMenuBrew.cpp @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2010 Company 100, Inc. + * + * 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 "ContextMenu.h" + +#include "NotImplemented.h" +#include <wtf/text/CString.h> + +namespace WebCore { + +ContextMenu::ContextMenu(const HitTestResult& result) + : m_hitTestResult(result) +{ + ASSERT_NOT_REACHED(); + notImplemented(); +} + +ContextMenu::ContextMenu(const HitTestResult& result, const PlatformMenuDescription menu) + : m_hitTestResult(result) +{ + ASSERT_NOT_REACHED(); + notImplemented(); +} + +ContextMenu::~ContextMenu() +{ + ASSERT_NOT_REACHED(); + notImplemented(); +} + +unsigned ContextMenu::itemCount() const +{ + ASSERT_NOT_REACHED(); + return 0; +} + +void ContextMenu::insertItem(unsigned int position, ContextMenuItem& item) +{ + ASSERT_NOT_REACHED(); + notImplemented(); +} + +void ContextMenu::appendItem(ContextMenuItem& item) +{ + ASSERT_NOT_REACHED(); + notImplemented(); +} + +ContextMenuItem* ContextMenu::itemWithAction(unsigned action) +{ + ASSERT_NOT_REACHED(); + notImplemented(); + return 0; +} + +ContextMenuItem* ContextMenu::itemAtIndex(unsigned index, const PlatformMenuDescription platformDescription) +{ + ASSERT_NOT_REACHED(); + notImplemented(); + return 0; +} + +void ContextMenu::setPlatformDescription(PlatformMenuDescription menu) +{ + ASSERT_NOT_REACHED(); + notImplemented(); +} + +PlatformMenuDescription ContextMenu::platformDescription() const +{ + ASSERT_NOT_REACHED(); + notImplemented(); + return 0; +} + +PlatformMenuDescription ContextMenu::releasePlatformDescription() +{ + ASSERT_NOT_REACHED(); + notImplemented(); + return 0; +} + +} diff --git a/WebCore/platform/brew/ContextMenuItemBrew.cpp b/WebCore/platform/brew/ContextMenuItemBrew.cpp new file mode 100644 index 0000000..717084d --- /dev/null +++ b/WebCore/platform/brew/ContextMenuItemBrew.cpp @@ -0,0 +1,139 @@ +/* + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2010 Company 100, Inc. + * + * 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 "ContextMenuItem.h" + +#include "ContextMenu.h" +#include "NotImplemented.h" + +#include <wtf/text/CString.h> + +namespace WebCore { + +ContextMenuItem::ContextMenuItem(PlatformMenuDescription item) +{ + ASSERT_NOT_REACHED(); + notImplemented(); +} + +ContextMenuItem::ContextMenuItem(ContextMenu* subMenu) +{ + ASSERT_NOT_REACHED(); + notImplemented(); +} + +ContextMenuItem::ContextMenuItem(ContextMenuItemType type, ContextMenuAction action, const String& title, ContextMenu* subMenu) +{ + ASSERT_NOT_REACHED(); + notImplemented(); +} + +ContextMenuItem::~ContextMenuItem() +{ + ASSERT_NOT_REACHED(); + notImplemented(); +} + +PlatformMenuDescription ContextMenuItem::releasePlatformDescription() +{ + ASSERT_NOT_REACHED(); + notImplemented(); + return 0; +} + +ContextMenuItemType ContextMenuItem::type() const +{ + ASSERT_NOT_REACHED(); + notImplemented(); + return ActionType; +} + +ContextMenuAction ContextMenuItem::action() const +{ + ASSERT_NOT_REACHED(); + notImplemented(); + return ContextMenuItemTagNoAction; +} + +String ContextMenuItem::title() const +{ + ASSERT_NOT_REACHED(); + notImplemented(); + return String(); +} + +PlatformMenuDescription ContextMenuItem::platformSubMenu() const +{ + ASSERT_NOT_REACHED(); + notImplemented(); + return 0; +} + +void ContextMenuItem::setType(ContextMenuItemType type) +{ + ASSERT_NOT_REACHED(); + notImplemented(); +} + +void ContextMenuItem::setAction(ContextMenuAction action) +{ + ASSERT_NOT_REACHED(); + notImplemented(); +} + +void ContextMenuItem::setTitle(const String& title) +{ + ASSERT_NOT_REACHED(); + notImplemented(); +} + +void ContextMenuItem::setSubMenu(ContextMenu* subMenu) +{ + ASSERT_NOT_REACHED(); + notImplemented(); +} + +void ContextMenuItem::setChecked(bool checked) +{ + ASSERT_NOT_REACHED(); + notImplemented(); +} + +void ContextMenuItem::setEnabled(bool enabled) +{ + ASSERT_NOT_REACHED(); + notImplemented(); +} + +bool ContextMenuItem::enabled() const +{ + ASSERT_NOT_REACHED(); + notImplemented(); + return false; +} + +} diff --git a/WebCore/platform/brew/EventLoopBrew.cpp b/WebCore/platform/brew/EventLoopBrew.cpp new file mode 100644 index 0000000..286b983 --- /dev/null +++ b/WebCore/platform/brew/EventLoopBrew.cpp @@ -0,0 +1,36 @@ +/* + * 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: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 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 "EventLoop.h" + +namespace WebCore { + +void EventLoop::cycle() +{ + // BREW MP does not have an explicit event loop. +} + +} // namespace WebCore diff --git a/WebCore/platform/brew/SearchPopupMenuBrew.cpp b/WebCore/platform/brew/SearchPopupMenuBrew.cpp new file mode 100644 index 0000000..780c7e5 --- /dev/null +++ b/WebCore/platform/brew/SearchPopupMenuBrew.cpp @@ -0,0 +1,52 @@ +/* + * 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: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 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 "SearchPopupMenu.h" + +namespace WebCore { + +// Save the past searches stored in 'searchItems' to a database associated with 'name' +void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) +{ +} + +// Load past searches associated with 'name' from the database to 'searchItems' +void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) +{ +} + +// Create a search popup menu - not sure what else we have to do here +SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client) + : PopupMenu(client) +{ +} + +bool SearchPopupMenu::enabled() +{ + return false; +} + +} // namespace WebCore diff --git a/WebCore/platform/chromium/DragDataChromium.cpp b/WebCore/platform/chromium/DragDataChromium.cpp index 1ce20dc..2c2151a 100644 --- a/WebCore/platform/chromium/DragDataChromium.cpp +++ b/WebCore/platform/chromium/DragDataChromium.cpp @@ -56,17 +56,17 @@ PassRefPtr<Clipboard> DragData::createClipboard(ClipboardAccessPolicy policy) co return clipboard.release(); } -bool DragData::containsURL() const +bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const { - return !asURL().isEmpty(); + return !asURL(filenamePolicy).isEmpty(); } -String DragData::asURL(String* title) const +String DragData::asURL(FilenameConversionPolicy filenamePolicy, String* title) const { String url; if (m_platformDragData->hasValidURL()) url = m_platformDragData->getURL().string(); - else if (!m_platformDragData->filenames.isEmpty()) { + else if (filenamePolicy == ConvertFilenames && !m_platformDragData->filenames.isEmpty()) { String fileName = m_platformDragData->filenames[0]; fileName = ChromiumBridge::getAbsolutePath(fileName); url = ChromiumBridge::filePathToURL(fileName).string(); diff --git a/WebCore/platform/chromium/KeyCodeConversionGtk.cpp b/WebCore/platform/chromium/KeyCodeConversionGtk.cpp index a709f3e..a7f4245 100644 --- a/WebCore/platform/chromium/KeyCodeConversionGtk.cpp +++ b/WebCore/platform/chromium/KeyCodeConversionGtk.cpp @@ -276,8 +276,10 @@ int windowsKeyCodeForKeyEvent(unsigned keycode) case GDK_Z: return VKEY_Z; // (5A) Z key case 'z': case 'Z': return 0x5A; case GDK_Meta_L: + case GDK_Super_L: return VKEY_LWIN; // (5B) Left Windows key (Microsoft Natural keyboard) case GDK_Meta_R: + case GDK_Super_R: return VKEY_RWIN; // (5C) Right Windows key (Natural keyboard) // VKEY_SLEEP (5F) Computer Sleep key // VKEY_SEPARATOR (6C) Separator key diff --git a/WebCore/platform/chromium/PasteboardChromium.cpp b/WebCore/platform/chromium/PasteboardChromium.cpp index 6904050..0455482 100644 --- a/WebCore/platform/chromium/PasteboardChromium.cpp +++ b/WebCore/platform/chromium/PasteboardChromium.cpp @@ -129,6 +129,10 @@ void Pasteboard::writeImage(Node* node, const KURL&, const String& title) return; Image* image = cachedImage->image(); ASSERT(image); + + NativeImagePtr bitmap = image->nativeImageForCurrentFrame(); + if (!bitmap) + return; // If the image is wrapped in a link, |url| points to the target of the // link. This isn't useful to us, so get the actual image URL. @@ -145,7 +149,6 @@ void Pasteboard::writeImage(Node* node, const KURL&, const String& title) } KURL url = urlString.isEmpty() ? KURL() : node->document()->completeURL(deprecatedParseURL(urlString)); - NativeImagePtr bitmap = image->nativeImageForCurrentFrame(); ChromiumBridge::clipboardWriteImage(bitmap, url, title); } diff --git a/WebCore/platform/chromium/PopupMenuChromium.cpp b/WebCore/platform/chromium/PopupMenuChromium.cpp index c612bb0..e8ab333 100644 --- a/WebCore/platform/chromium/PopupMenuChromium.cpp +++ b/WebCore/platform/chromium/PopupMenuChromium.cpp @@ -1018,6 +1018,7 @@ void PopupListBox::selectIndex(int index) invalidateRow(m_selectedIndex); scrollToRevealSelection(); + m_popupClient->selectionChanged(m_selectedIndex); } } @@ -1079,6 +1080,7 @@ void PopupListBox::clearSelection() if (m_selectedIndex != -1) { invalidateRow(m_selectedIndex); m_selectedIndex = -1; + m_popupClient->selectionCleared(); } } diff --git a/WebCore/platform/efl/DragDataEfl.cpp b/WebCore/platform/efl/DragDataEfl.cpp index 3f9eccb..f6b446c 100644 --- a/WebCore/platform/efl/DragDataEfl.cpp +++ b/WebCore/platform/efl/DragDataEfl.cpp @@ -71,12 +71,12 @@ bool DragData::containsCompatibleContent() const return false; } -bool DragData::containsURL() const +bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const { return false; } -String DragData::asURL(String* title) const +String DragData::asURL(FilenameConversionPolicy filenamePolicy, String* title) const { return String(); } diff --git a/WebCore/platform/efl/FileSystemEfl.cpp b/WebCore/platform/efl/FileSystemEfl.cpp index f612793..31b2e22 100644 --- a/WebCore/platform/efl/FileSystemEfl.cpp +++ b/WebCore/platform/efl/FileSystemEfl.cpp @@ -53,17 +53,15 @@ namespace WebCore { CString fileSystemRepresentation(const String& path) { - return path.utf8(); -} - -char* filenameFromString(const String& string) -{ // WARNING: this is just used by platform/network/soup, thus must be GLIB!!! // TODO: move this to CString and use it instead in both, being more standard #if PLATFORM(WIN_OS) - return g_strdup(string.utf8().data()); + return path.utf8(); #else - return g_uri_unescape_string(string.utf8().data(), 0); + char* filename = g_uri_unescape_string(path.utf8().data(), 0); + CString cfilename(filename); + g_free(filename); + return cfilename; #endif } diff --git a/WebCore/platform/graphics/BitmapImage.cpp b/WebCore/platform/graphics/BitmapImage.cpp index 62f29cf..2805b21 100644 --- a/WebCore/platform/graphics/BitmapImage.cpp +++ b/WebCore/platform/graphics/BitmapImage.cpp @@ -155,6 +155,11 @@ IntSize BitmapImage::currentFrameSize() const return m_source.frameSizeAtIndex(m_currentFrame); } +bool BitmapImage::getHotSpot(IntPoint& hotSpot) const +{ + return m_source.getHotSpot(hotSpot); +} + bool BitmapImage::dataChanged(bool allDataReceived) { // Because we're modifying the current frame, clear its (now possibly diff --git a/WebCore/platform/graphics/BitmapImage.h b/WebCore/platform/graphics/BitmapImage.h index e4261e2..e5591ec 100644 --- a/WebCore/platform/graphics/BitmapImage.h +++ b/WebCore/platform/graphics/BitmapImage.h @@ -118,6 +118,7 @@ public: virtual IntSize size() const; IntSize currentFrameSize() const; + virtual bool getHotSpot(IntPoint&) const; virtual bool dataChanged(bool allDataReceived); virtual String filenameExtension() const; diff --git a/WebCore/platform/graphics/Color.cpp b/WebCore/platform/graphics/Color.cpp index 17a5d38..2f2a357 100644 --- a/WebCore/platform/graphics/Color.cpp +++ b/WebCore/platform/graphics/Color.cpp @@ -31,7 +31,7 @@ #include <wtf/Assertions.h> #include <wtf/MathExtras.h> -#include "ColorData.c" +#include "ColorData.cpp" using namespace std; using namespace WTF; diff --git a/WebCore/platform/graphics/Font.cpp b/WebCore/platform/graphics/Font.cpp index 7682011..6414147 100644 --- a/WebCore/platform/graphics/Font.cpp +++ b/WebCore/platform/graphics/Font.cpp @@ -38,7 +38,6 @@ using namespace Unicode; namespace WebCore { -#if USE(FONT_FAST_PATH) const uint8_t Font::gRoundingHackCharacterTable[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 /*\t*/, 1 /*\n*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 /*space*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 /*-*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 /*?*/, @@ -51,7 +50,6 @@ const uint8_t Font::gRoundingHackCharacterTable[256] = { }; Font::CodePath Font::s_codePath = Auto; -#endif // ============================================================================================ // Font Implementation (Cross-Platform Portion) @@ -151,10 +149,8 @@ void Font::drawText(GraphicsContext* context, const TextRun& run, const FloatPoi } #endif -#if USE(FONT_FAST_PATH) if (codePath(run) != Complex) return drawSimpleText(context, run, point, from, to); -#endif return drawComplexText(context, run, point, from, to); } @@ -166,7 +162,6 @@ float Font::floatWidth(const TextRun& run, HashSet<const SimpleFontData*>* fallb return floatWidthUsingSVGFont(run); #endif -#if USE(FONT_FAST_PATH) CodePath codePathToUse = codePath(run); if (codePathToUse != Complex) { // If the complex text implementation cannot return fallback fonts, avoid @@ -174,7 +169,6 @@ float Font::floatWidth(const TextRun& run, HashSet<const SimpleFontData*>* fallb static bool returnFallbackFonts = canReturnFallbackFontsForComplexText(); return floatWidthForSimpleText(run, 0, returnFallbackFonts ? fallbackFonts : 0, codePathToUse == SimpleWithGlyphOverflow ? glyphOverflow : 0); } -#endif return floatWidthForComplexText(run, fallbackFonts, glyphOverflow); } @@ -191,10 +185,8 @@ float Font::floatWidth(const TextRun& run, int extraCharsAvailable, int& charsCo charsConsumed = run.length(); glyphName = ""; -#if USE(FONT_FAST_PATH) if (codePath(run) != Complex) return floatWidthForSimpleText(run, 0); -#endif return floatWidthForComplexText(run); } @@ -208,10 +200,8 @@ FloatRect Font::selectionRectForText(const TextRun& run, const IntPoint& point, to = (to == -1 ? run.length() : to); -#if USE(FONT_FAST_PATH) if (codePath(run) != Complex) return selectionRectForSimpleText(run, point, h, from, to); -#endif return selectionRectForComplexText(run, point, h, from, to); } @@ -223,10 +213,8 @@ int Font::offsetForPosition(const TextRun& run, int x, bool includePartialGlyphs return offsetForPositionForTextUsingSVGFont(run, x, includePartialGlyphs); #endif -#if USE(FONT_FAST_PATH) if (codePath(run) != Complex) return offsetForPositionForSimpleText(run, x, includePartialGlyphs); -#endif return offsetForPositionForComplexText(run, x, includePartialGlyphs); } @@ -268,4 +256,79 @@ bool Font::shouldUseSmoothing() return shouldUseFontSmoothing; } +void Font::setCodePath(CodePath p) +{ + s_codePath = p; +} + +Font::CodePath Font::codePath() +{ + return s_codePath; +} + +Font::CodePath Font::codePath(const TextRun& run) const +{ + if (s_codePath != Auto) + return s_codePath; + +#if PLATFORM(QT) + if (run.padding() || run.rtl() || isSmallCaps() || wordSpacing() || letterSpacing()) + return Complex; +#endif + + // Start from 0 since drawing and highlighting also measure the characters before run->from + for (int i = 0; i < run.length(); i++) { + const UChar c = run[i]; + if (c < 0x300) // U+0300 through U+036F Combining diacritical marks + continue; + if (c <= 0x36F) + return Complex; + + if (c < 0x0591 || c == 0x05BE) // U+0591 through U+05CF excluding U+05BE Hebrew combining marks, Hebrew punctuation Paseq, Sof Pasuq and Nun Hafukha + continue; + if (c <= 0x05CF) + return Complex; + + if (c < 0x0600) // U+0600 through U+1059 Arabic, Syriac, Thaana, Devanagari, Bengali, Gurmukhi, Gujarati, Oriya, Tamil, Telugu, Kannada, Malayalam, Sinhala, Thai, Lao, Tibetan, Myanmar + continue; + if (c <= 0x1059) + return Complex; + + if (c < 0x1100) // U+1100 through U+11FF Hangul Jamo (only Ancient Korean should be left here if you precompose; Modern Korean will be precomposed as a result of step A) + continue; + if (c <= 0x11FF) + return Complex; + + if (c < 0x1780) // U+1780 through U+18AF Khmer, Mongolian + continue; + if (c <= 0x18AF) + return Complex; + + if (c < 0x1900) // U+1900 through U+194F Limbu (Unicode 4.0) + continue; + if (c <= 0x194F) + return Complex; + + if (c < 0x1E00) // U+1E00 through U+2000 characters with diacritics and stacked diacritics + continue; + if (c <= 0x2000) + return SimpleWithGlyphOverflow; + + if (c < 0x20D0) // U+20D0 through U+20FF Combining marks for symbols + continue; + if (c <= 0x20FF) + return Complex; + + if (c < 0xFE20) // U+FE20 through U+FE2F Combining half marks + continue; + if (c <= 0xFE2F) + return Complex; + } + + if (typesettingFeatures()) + return Complex; + + return Simple; +} + } diff --git a/WebCore/platform/graphics/Font.h b/WebCore/platform/graphics/Font.h index 6633a50..2b36cca 100644 --- a/WebCore/platform/graphics/Font.h +++ b/WebCore/platform/graphics/Font.h @@ -151,9 +151,7 @@ public: static void setShouldUseSmoothing(bool); static bool shouldUseSmoothing(); -#if USE(FONT_FAST_PATH) enum CodePath { Auto, Simple, Complex, SimpleWithGlyphOverflow }; -#endif private: #if ENABLE(SVG_FONTS) @@ -164,8 +162,6 @@ private: int offsetForPositionForTextUsingSVGFont(const TextRun&, int position, bool includePartialGlyphs) const; #endif -#if USE(FONT_FAST_PATH) - CodePath codePath(const TextRun&) const; void drawSimpleText(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const; void drawGlyphs(GraphicsContext*, const SimpleFontData*, const GlyphBuffer&, int from, int to, const FloatPoint&) const; void drawGlyphBuffer(GraphicsContext*, const GlyphBuffer&, const TextRun&, const FloatPoint&) const; @@ -174,8 +170,8 @@ private: FloatRect selectionRectForSimpleText(const TextRun&, const IntPoint&, int h, int from, int to) const; static bool canReturnFallbackFontsForComplexText(); -#endif + CodePath codePath(const TextRun&) const; void drawComplexText(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const; float floatWidthForComplexText(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const; int offsetForPositionForComplexText(const TextRun&, int position, bool includePartialGlyphs) const; @@ -185,7 +181,6 @@ private: public: // Useful for debugging the different font rendering code paths. -#if USE(FONT_FAST_PATH) static void setCodePath(CodePath); static CodePath codePath(); static CodePath s_codePath; @@ -195,7 +190,6 @@ public: { return (((c & ~0xFF) == 0 && gRoundingHackCharacterTable[c])); } -#endif FontSelector* fontSelector() const; static bool treatAsSpace(UChar c) { return c == ' ' || c == '\t' || c == '\n' || c == 0x00A0; } diff --git a/WebCore/platform/graphics/FontFastPath.cpp b/WebCore/platform/graphics/FontFastPath.cpp index f57ae5b..b863e83 100644 --- a/WebCore/platform/graphics/FontFastPath.cpp +++ b/WebCore/platform/graphics/FontFastPath.cpp @@ -180,76 +180,6 @@ GlyphData Font::glyphDataForCharacter(UChar32 c, bool mirror, bool forceSmallCap return data; } -void Font::setCodePath(CodePath p) -{ - s_codePath = p; -} - -Font::CodePath Font::codePath() -{ - return s_codePath; -} - -Font::CodePath Font::codePath(const TextRun& run) const -{ - if (s_codePath != Auto) - return s_codePath; - - // Start from 0 since drawing and highlighting also measure the characters before run->from - for (int i = 0; i < run.length(); i++) { - const UChar c = run[i]; - if (c < 0x300) // U+0300 through U+036F Combining diacritical marks - continue; - if (c <= 0x36F) - return Complex; - - if (c < 0x0591 || c == 0x05BE) // U+0591 through U+05CF excluding U+05BE Hebrew combining marks, Hebrew punctuation Paseq, Sof Pasuq and Nun Hafukha - continue; - if (c <= 0x05CF) - return Complex; - - if (c < 0x0600) // U+0600 through U+1059 Arabic, Syriac, Thaana, Devanagari, Bengali, Gurmukhi, Gujarati, Oriya, Tamil, Telugu, Kannada, Malayalam, Sinhala, Thai, Lao, Tibetan, Myanmar - continue; - if (c <= 0x1059) - return Complex; - - if (c < 0x1100) // U+1100 through U+11FF Hangul Jamo (only Ancient Korean should be left here if you precompose; Modern Korean will be precomposed as a result of step A) - continue; - if (c <= 0x11FF) - return Complex; - - if (c < 0x1780) // U+1780 through U+18AF Khmer, Mongolian - continue; - if (c <= 0x18AF) - return Complex; - - if (c < 0x1900) // U+1900 through U+194F Limbu (Unicode 4.0) - continue; - if (c <= 0x194F) - return Complex; - - if (c < 0x1E00) // U+1E00 through U+2000 characters with diacritics and stacked diacritics - continue; - if (c <= 0x2000) - return SimpleWithGlyphOverflow; - - if (c < 0x20D0) // U+20D0 through U+20FF Combining marks for symbols - continue; - if (c <= 0x20FF) - return Complex; - - if (c < 0xFE20) // U+FE20 through U+FE2F Combining half marks - continue; - if (c <= 0xFE2F) - return Complex; - } - - if (typesettingFeatures()) - return Complex; - - return Simple; -} - void Font::drawSimpleText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const { // This glyph buffer holds our glyphs+advances+font data for each glyph. diff --git a/WebCore/platform/graphics/Gradient.cpp b/WebCore/platform/graphics/Gradient.cpp index 0e961ad..198b41a 100644 --- a/WebCore/platform/graphics/Gradient.cpp +++ b/WebCore/platform/graphics/Gradient.cpp @@ -202,7 +202,11 @@ void Gradient::setGradientSpaceTransform(const AffineTransform& gradientSpaceTra setPlatformGradientSpaceTransform(gradientSpaceTransformation); } +<<<<<<< HEAD:WebCore/platform/graphics/Gradient.cpp #if !(PLATFORM(SKIA) && !PLATFORM(ANDROID)) +======= +#if !PLATFORM(SKIA) && !PLATFORM(CAIRO) +>>>>>>> Webkit.org at r61121:WebCore/platform/graphics/Gradient.cpp void Gradient::setPlatformGradientSpaceTransform(const AffineTransform&) { } diff --git a/WebCore/platform/graphics/Gradient.h b/WebCore/platform/graphics/Gradient.h index 2c877af..b526e51 100644 --- a/WebCore/platform/graphics/Gradient.h +++ b/WebCore/platform/graphics/Gradient.h @@ -93,12 +93,14 @@ namespace WebCore { void getColor(float value, float* r, float* g, float* b, float* a) const; + bool isRadial() const { return m_radial; } + bool isZeroSize() const { return m_p0.x() == m_p1.x() && m_p0.y() == m_p1.y(); } + #if OS(WINCE) && !PLATFORM(QT) const FloatPoint& p0() const { return m_p0; } const FloatPoint& p1() const { return m_p1; } float r0() const { return m_r0; } float r1() const { return m_r1; } - bool isRadial() const { return m_radial; } const Vector<ColorStop>& getStops() const; #else #if PLATFORM(ANDROID) diff --git a/WebCore/platform/graphics/GraphicsContext.cpp b/WebCore/platform/graphics/GraphicsContext.cpp index 0105c53..629d100 100644 --- a/WebCore/platform/graphics/GraphicsContext.cpp +++ b/WebCore/platform/graphics/GraphicsContext.cpp @@ -129,7 +129,7 @@ void GraphicsContext::setStrokeColor(const Color& color, ColorSpace colorSpace) setPlatformStrokeColor(color, colorSpace); } -void GraphicsContext::setShadow(const IntSize& size, int blur, const Color& color, ColorSpace colorSpace) +void GraphicsContext::setShadow(const IntSize& size, float blur, const Color& color, ColorSpace colorSpace) { m_common->state.shadowSize = size; m_common->state.shadowBlur = blur; @@ -145,7 +145,7 @@ void GraphicsContext::clearShadow() clearPlatformShadow(); } -bool GraphicsContext::getShadow(IntSize& size, int& blur, Color& color) const +bool GraphicsContext::getShadow(IntSize& size, float& blur, Color& color) const { size = m_common->state.shadowSize; blur = m_common->state.shadowBlur; diff --git a/WebCore/platform/graphics/GraphicsContext.h b/WebCore/platform/graphics/GraphicsContext.h index caa0a7c..b857546 100644 --- a/WebCore/platform/graphics/GraphicsContext.h +++ b/WebCore/platform/graphics/GraphicsContext.h @@ -298,8 +298,8 @@ namespace WebCore { void beginTransparencyLayer(float opacity); void endTransparencyLayer(); - void setShadow(const IntSize&, int blur, const Color&, ColorSpace); - bool getShadow(IntSize&, int&, Color&) const; + void setShadow(const IntSize&, float blur, const Color&, ColorSpace); + bool getShadow(IntSize&, float&, Color&) const; void clearShadow(); void drawFocusRing(const Vector<IntRect>&, int width, int offset, const Color&); @@ -314,7 +314,7 @@ namespace WebCore { #if PLATFORM(CAIRO) float getAlpha(); void createPlatformShadow(PassOwnPtr<ImageBuffer> buffer, const Color& shadowColor, const FloatRect& shadowRect, float kernelSize); - static void calculateShadowBufferDimensions(IntSize& shadowBufferSize, FloatRect& shadowRect, float& kernelSize, const FloatRect& sourceRect, const IntSize& shadowSize, int shadowBlur); + static void calculateShadowBufferDimensions(IntSize& shadowBufferSize, FloatRect& shadowRect, float& kernelSize, const FloatRect& sourceRect, const IntSize& shadowSize, float shadowBlur); #endif void setCompositeOperation(CompositeOperator); @@ -444,7 +444,7 @@ namespace WebCore { void setPlatformShouldAntialias(bool b); - void setPlatformShadow(const IntSize&, int blur, const Color&, ColorSpace); + void setPlatformShadow(const IntSize&, float blur, const Color&, ColorSpace); void clearPlatformShadow(); static void adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, float strokeWidth, const StrokeStyle&); diff --git a/WebCore/platform/graphics/GraphicsContext3D.cpp b/WebCore/platform/graphics/GraphicsContext3D.cpp index 97465e2..a5ca8c7 100644 --- a/WebCore/platform/graphics/GraphicsContext3D.cpp +++ b/WebCore/platform/graphics/GraphicsContext3D.cpp @@ -54,7 +54,8 @@ bool GraphicsContext3D::extractImageData(Image* image, image->height(), flipY, alphaOp); - *internalFormat = (hasAlphaChannel ? RGBA : RGB); + // For GLES2 tex functions, internalformat has to match format. + *internalFormat = *format; return true; } diff --git a/WebCore/platform/graphics/GraphicsContext3D.h b/WebCore/platform/graphics/GraphicsContext3D.h index b62f52c..8d5c286 100644 --- a/WebCore/platform/graphics/GraphicsContext3D.h +++ b/WebCore/platform/graphics/GraphicsContext3D.h @@ -45,8 +45,8 @@ const PlatformGraphicsContext3D NullPlatformGraphicsContext3D = 0; typedef GLuint Platform3DObject; const Platform3DObject NullPlatform3DObject = 0; #elif PLATFORM(QT) -#include <QtOpenGL/QtOpenGL> - +class QPainter; +class QRect; typedef void* PlatformGraphicsContext3D; const PlatformGraphicsContext3D NullPlatformGraphicsContext3D = 0; typedef int Platform3DObject; @@ -63,7 +63,7 @@ namespace WebCore { class ArrayBufferView; class WebGLBuffer; class Uint8Array; - class FloatArray; + class Float32Array; class WebGLFramebuffer; class Int32Array; class WebGLProgram; @@ -390,7 +390,11 @@ namespace WebCore { FRAMEBUFFER_BINDING = 0x8CA6, RENDERBUFFER_BINDING = 0x8CA7, MAX_RENDERBUFFER_SIZE = 0x84E8, - INVALID_FRAMEBUFFER_OPERATION = 0x0506 + INVALID_FRAMEBUFFER_OPERATION = 0x0506, + + // WebGL-specific enums + UNPACK_FLIP_Y_WEBGL = 0x9240, + UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241 }; // Context creation attributes. @@ -398,7 +402,7 @@ namespace WebCore { Attributes() : alpha(true) , depth(true) - , stencil(true) + , stencil(false) , antialias(true) , premultipliedAlpha(true) { diff --git a/WebCore/platform/graphics/GraphicsContextPrivate.h b/WebCore/platform/graphics/GraphicsContextPrivate.h index 1980337..baa3392 100644 --- a/WebCore/platform/graphics/GraphicsContextPrivate.h +++ b/WebCore/platform/graphics/GraphicsContextPrivate.h @@ -73,7 +73,7 @@ namespace WebCore { bool paintingDisabled; IntSize shadowSize; - unsigned shadowBlur; + float shadowBlur; Color shadowColor; bool shadowsIgnoreTransforms; diff --git a/WebCore/platform/graphics/Image.h b/WebCore/platform/graphics/Image.h index 212175c..3230df5 100644 --- a/WebCore/platform/graphics/Image.h +++ b/WebCore/platform/graphics/Image.h @@ -109,6 +109,7 @@ public: IntRect rect() const { return IntRect(IntPoint(), size()); } int width() const { return size().width(); } int height() const { return size().height(); } + virtual bool getHotSpot(IntPoint&) const { return false; } bool setData(PassRefPtr<SharedBuffer> data, bool allDataReceived); virtual bool dataChanged(bool /*allDataReceived*/) { return false; } diff --git a/WebCore/platform/graphics/ImageBuffer.h b/WebCore/platform/graphics/ImageBuffer.h index 9163523..9f9ba7e 100644 --- a/WebCore/platform/graphics/ImageBuffer.h +++ b/WebCore/platform/graphics/ImageBuffer.h @@ -43,7 +43,7 @@ namespace WebCore { class IntPoint; class IntRect; class String; - + enum ImageColorSpace { Unknown, DeviceRGB, // like sRGB @@ -82,8 +82,8 @@ namespace WebCore { void putUnmultipliedImageData(ImageData*, const IntRect& sourceRect, const IntPoint& destPoint); void putPremultipliedImageData(ImageData*, const IntRect& sourceRect, const IntPoint& destPoint); - - String toDataURL(const String& mimeType, double quality = 1.0) const; + + String toDataURL(const String& mimeType, const double* quality = 0) const; #if !PLATFORM(CG) AffineTransform baseTransform() const { return AffineTransform(); } void transformColorSpace(ImageColorSpace srcColorSpace, ImageColorSpace dstColorSpace); diff --git a/WebCore/platform/graphics/ImageSource.cpp b/WebCore/platform/graphics/ImageSource.cpp index c2366c1..7f6d323 100644 --- a/WebCore/platform/graphics/ImageSource.cpp +++ b/WebCore/platform/graphics/ImageSource.cpp @@ -37,6 +37,10 @@ namespace WebCore { +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) +unsigned ImageSource::s_maxPixelsPerDecodedImage = 1024 * 1024; +#endif + ImageSource::ImageSource() : m_decoder(0) { @@ -75,11 +79,8 @@ void ImageSource::setData(SharedBuffer* data, bool allDataReceived) if (!m_decoder) { m_decoder = static_cast<NativeImageSourcePtr>(ImageDecoder::create(*data)); #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) -#ifndef IMAGE_DECODER_DOWN_SAMPLING_MAX_NUMBER_OF_PIXELS -#define IMAGE_DECODER_DOWN_SAMPLING_MAX_NUMBER_OF_PIXELS (1024 * 1024) -#endif - if (m_decoder) - m_decoder->setMaxNumPixels(IMAGE_DECODER_DOWN_SAMPLING_MAX_NUMBER_OF_PIXELS); + if (m_decoder && s_maxPixelsPerDecodedImage) + m_decoder->setMaxNumPixels(s_maxPixelsPerDecodedImage); #endif } @@ -107,6 +108,11 @@ IntSize ImageSource::frameSizeAtIndex(size_t index) const return m_decoder ? m_decoder->frameSizeAtIndex(index) : IntSize(); } +bool ImageSource::getHotSpot(IntPoint&) const +{ + return false; +} + int ImageSource::repetitionCount() { return m_decoder ? m_decoder->repetitionCount() : cAnimationNone; diff --git a/WebCore/platform/graphics/ImageSource.h b/WebCore/platform/graphics/ImageSource.h index d9bfa25..716566b 100644 --- a/WebCore/platform/graphics/ImageSource.h +++ b/WebCore/platform/graphics/ImageSource.h @@ -61,6 +61,7 @@ class BBitmap; namespace WebCore { +class IntPoint; class IntSize; class SharedBuffer; class String; @@ -172,6 +173,7 @@ public: bool isSizeAvailable(); IntSize size() const; IntSize frameSizeAtIndex(size_t) const; + bool getHotSpot(IntPoint&) const; int repetitionCount(); @@ -185,10 +187,18 @@ public: bool frameHasAlphaAtIndex(size_t); // Whether or not the frame actually used any alpha. bool frameIsCompleteAtIndex(size_t); // Whether or not the frame is completely decoded. +<<<<<<< HEAD:WebCore/platform/graphics/ImageSource.h #if PLATFORM(ANDROID) void clearURL(); void setURL(const String& url); #endif +======= +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + static unsigned maxPixelsPerDecodedImage() { return s_maxPixelsPerDecodedImage; } + static void setMaxPixelsPerDecodedImage(unsigned maxPixels) { s_maxPixelsPerDecodedImage = maxPixels; } +#endif + +>>>>>>> Webkit.org at r61121:WebCore/platform/graphics/ImageSource.h private: #if PLATFORM(ANDROID) // FIXME: This is protected only to allow ImageSourceSkia to set ICO decoder @@ -196,6 +206,9 @@ private: protected: #endif NativeImageSourcePtr m_decoder; +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + static unsigned s_maxPixelsPerDecodedImage; +#endif }; } diff --git a/WebCore/platform/graphics/cairo/FontCacheCairo.cpp b/WebCore/platform/graphics/cairo/FontCacheCairo.cpp index 79b32b4..fceeea1 100644 --- a/WebCore/platform/graphics/cairo/FontCacheCairo.cpp +++ b/WebCore/platform/graphics/cairo/FontCacheCairo.cpp @@ -21,7 +21,9 @@ #include "config.h" #include "FontCache.h" +#include "CString.h" #include "Font.h" +#include "GOwnPtrCairo.h" #include "SimpleFontData.h" #include <wtf/Assertions.h> @@ -81,8 +83,57 @@ void FontCache::getTraitsInFamily(const AtomicString& familyName, Vector<unsigne { } +static bool isWellKnownFontName(const AtomicString family) +{ + // Fonts that are used by layout tests included. The fact that + // they are used in Layout Tests indicate web compatibility issues + // if we do not handle them correctly. + if (equalIgnoringCase(family, "sans-serif") || equalIgnoringCase(family, "serif") + || equalIgnoringCase(family, "monospace") || equalIgnoringCase(family, "cursive") + || equalIgnoringCase(family, "fantasy") || equalIgnoringCase(family, "Times") + || equalIgnoringCase(family, "Courier") || equalIgnoringCase(family, "Helvetica") + || equalIgnoringCase(family, "Arial") || equalIgnoringCase(family, "Lucida Grande") + || equalIgnoringCase(family, "Ahem") || equalIgnoringCase(family, "Georgia") + || equalIgnoringCase(family, "Times New Roman")) + return true; + + return false; +} + FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family) { +#if defined(USE_FREETYPE) + // Handle generic family types specially, because fontconfig does not know them, but we have + // code to fallback correctly in our platform data implementation. + if (!family.length() || family.startsWith("-webkit-") + || (fontDescription.genericFamily() != FontDescription::NoFamily) + || isWellKnownFontName(family)) + return new FontPlatformData(fontDescription, family); + + // First check the font exists. + CString familyNameString = family.string().utf8(); + const char* fcfamily = familyNameString.data(); + + GOwnPtr<FcPattern> pattern(FcPatternCreate()); + if (!FcPatternAddString(pattern.get(), FC_FAMILY, reinterpret_cast<const FcChar8*>(fcfamily))) + return 0; + + FcConfigSubstitute(0, pattern.get(), FcMatchPattern); + FcDefaultSubstitute(pattern.get()); + + GOwnPtr<FcObjectSet> objectSet(FcObjectSetCreate()); + if (!FcObjectSetAdd(objectSet.get(), FC_FAMILY)) + return 0; + + GOwnPtr<FcFontSet> fontSet(FcFontList(0, pattern.get(), objectSet.get())); + + if (!fontSet) + return 0; + + if (!fontSet->fonts) + return 0; +#endif + return new FontPlatformData(fontDescription, family); } diff --git a/WebCore/platform/graphics/cairo/FontCairo.cpp b/WebCore/platform/graphics/cairo/FontCairo.cpp index 71a2430..2a2d4a7 100644 --- a/WebCore/platform/graphics/cairo/FontCairo.cpp +++ b/WebCore/platform/graphics/cairo/FontCairo.cpp @@ -71,7 +71,7 @@ void Font::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, cons // Text shadow, inspired by FontMac IntSize shadowSize; - int shadowBlur = 0; + float shadowBlur = 0; Color shadowColor; bool hasShadow = context->textDrawingMode() == cTextFill && context->getShadow(shadowSize, shadowBlur, shadowColor); diff --git a/WebCore/platform/graphics/cairo/GOwnPtrCairo.cpp b/WebCore/platform/graphics/cairo/GOwnPtrCairo.cpp new file mode 100644 index 0000000..12df3cf --- /dev/null +++ b/WebCore/platform/graphics/cairo/GOwnPtrCairo.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2010 Collabora Ltd. + * + * 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 "GOwnPtrCairo.h" + +#if defined(USE_FREETYPE) +#include <cairo-ft.h> +#include <fontconfig/fcfreetype.h> +#endif + +namespace WTF { + +#if defined(USE_FREETYPE) +template <> void freeOwnedGPtr<FcPattern>(FcPattern* ptr) +{ + if (ptr) + FcPatternDestroy(ptr); +} + +template <> void freeOwnedGPtr<FcObjectSet>(FcObjectSet* ptr) +{ + if (ptr) + FcObjectSetDestroy(ptr); +} + +template <> void freeOwnedGPtr<FcFontSet>(FcFontSet* ptr) +{ + if (ptr) + FcFontSetDestroy(ptr); +} +#endif + +} // namespace WTF diff --git a/WebCore/platform/graphics/cairo/GOwnPtrCairo.h b/WebCore/platform/graphics/cairo/GOwnPtrCairo.h new file mode 100644 index 0000000..b099707 --- /dev/null +++ b/WebCore/platform/graphics/cairo/GOwnPtrCairo.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2010 Collabora Ltd. + * + * 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 GOwnPtrCairo_h +#define GOwnPtrCairo_h + +#include "GOwnPtr.h" + +#if defined(USE_FREETYPE) +typedef struct _FcPattern FcPattern; +typedef struct _FcObjectSet FcObjectSet; +typedef struct _FcFontSet FcFontSet; +#endif + +namespace WTF { + +#if defined(USE_FREETYPE) +template <> void freeOwnedGPtr<FcPattern>(FcPattern*); +template <> void freeOwnedGPtr<FcObjectSet>(FcObjectSet*); +template <> void freeOwnedGPtr<FcFontSet>(FcFontSet*); +#endif + +} // namespace WTF + +#endif diff --git a/WebCore/platform/graphics/cairo/GradientCairo.cpp b/WebCore/platform/graphics/cairo/GradientCairo.cpp index 0aada55..4e6ed07 100644 --- a/WebCore/platform/graphics/cairo/GradientCairo.cpp +++ b/WebCore/platform/graphics/cairo/GradientCairo.cpp @@ -76,6 +76,15 @@ cairo_pattern_t* Gradient::platformGradient() return m_gradient; } +void Gradient::setPlatformGradientSpaceTransform(const AffineTransform& gradientSpaceTransformation) +{ + if (m_gradient) { + cairo_matrix_t matrix = gradientSpaceTransformation; + cairo_matrix_invert(&matrix); + cairo_pattern_set_matrix(m_gradient, &matrix); + } +} + void Gradient::fill(GraphicsContext* context, const FloatRect& rect) { cairo_t* cr = context->platformContext(); diff --git a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp index a2dcbaf..083497f 100644 --- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp +++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp @@ -143,7 +143,7 @@ static inline void copyContextProperties(cairo_t* srcCr, cairo_t* dstCr) cairo_set_fill_rule(dstCr, cairo_get_fill_rule(srcCr)); } -void GraphicsContext::calculateShadowBufferDimensions(IntSize& shadowBufferSize, FloatRect& shadowRect, float& kernelSize, const FloatRect& sourceRect, const IntSize& shadowSize, int shadowBlur) +void GraphicsContext::calculateShadowBufferDimensions(IntSize& shadowBufferSize, FloatRect& shadowRect, float& kernelSize, const FloatRect& sourceRect, const IntSize& shadowSize, float shadowBlur) { #if ENABLE(FILTERS) // calculate the kernel size according to the HTML5 canvas shadow specification @@ -162,7 +162,7 @@ static inline void drawPathShadow(GraphicsContext* context, GraphicsContextPriva { #if ENABLE(FILTERS) IntSize shadowSize; - int shadowBlur; + float shadowBlur; Color shadowColor; if (!context->getShadow(shadowSize, shadowBlur, shadowColor)) return; @@ -560,7 +560,7 @@ static void drawBorderlessRectShadow(GraphicsContext* context, const FloatRect& { #if ENABLE(FILTERS) IntSize shadowSize; - int shadowBlur; + float shadowBlur; Color shadowColor; if (!context->getShadow(shadowSize, shadowBlur, shadowColor)) @@ -841,7 +841,7 @@ void GraphicsContext::clipToImageBuffer(const FloatRect& rect, const ImageBuffer notImplemented(); } -void GraphicsContext::setPlatformShadow(IntSize const& size, int, Color const&, ColorSpace) +void GraphicsContext::setPlatformShadow(IntSize const& size, float, Color const&, ColorSpace) { // Cairo doesn't support shadows natively, they are drawn manually in the draw* // functions diff --git a/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp b/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp index 85a4179..c298e18 100644 --- a/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp +++ b/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp @@ -284,7 +284,7 @@ static cairo_status_t writeFunction(void* closure, const unsigned char* data, un return CAIRO_STATUS_SUCCESS; } -String ImageBuffer::toDataURL(const String& mimeType, double) const +String ImageBuffer::toDataURL(const String& mimeType, const double*) const { cairo_surface_t* image = cairo_get_target(context()->platformContext()); if (!image) diff --git a/WebCore/platform/graphics/cairo/ImageCairo.cpp b/WebCore/platform/graphics/cairo/ImageCairo.cpp index e74c495..92394b3 100644 --- a/WebCore/platform/graphics/cairo/ImageCairo.cpp +++ b/WebCore/platform/graphics/cairo/ImageCairo.cpp @@ -135,7 +135,7 @@ void BitmapImage::draw(GraphicsContext* context, const FloatRect& dst, const Flo // Draw the shadow #if ENABLE(FILTERS) IntSize shadowSize; - int shadowBlur; + float shadowBlur; Color shadowColor; if (context->getShadow(shadowSize, shadowBlur, shadowColor)) { IntSize shadowBufferSize; diff --git a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp index 2e3f829..c69f222 100644 --- a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp +++ b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp @@ -764,7 +764,7 @@ void GraphicsContext::endTransparencyLayer() m_data->m_userToDeviceTransformKnownToBeIdentity = false; } -void GraphicsContext::setPlatformShadow(const IntSize& offset, int blur, const Color& color, ColorSpace colorSpace) +void GraphicsContext::setPlatformShadow(const IntSize& offset, float blur, const Color& color, ColorSpace colorSpace) { if (paintingDisabled()) return; diff --git a/WebCore/platform/graphics/cg/ImageBufferCG.cpp b/WebCore/platform/graphics/cg/ImageBufferCG.cpp index ce11499..fe7f83a 100644 --- a/WebCore/platform/graphics/cg/ImageBufferCG.cpp +++ b/WebCore/platform/graphics/cg/ImageBufferCG.cpp @@ -250,6 +250,14 @@ void ImageBuffer::putPremultipliedImageData(ImageData* source, const IntRect& so putImageData<Premultiplied>(source, sourceRect, destPoint, m_data, m_size); } +static inline CFStringRef jpegUTI() +{ +#if PLATFORM(WIN) + static const CFStringRef kUTTypeJPEG = CFSTR("public.jpeg"); +#endif + return kUTTypeJPEG; +} + static RetainPtr<CFStringRef> utiFromMIMEType(const String& mimeType) { #if PLATFORM(MAC) @@ -261,13 +269,12 @@ static RetainPtr<CFStringRef> utiFromMIMEType(const String& mimeType) // FIXME: Add Windows support for all the supported UTIs when a way to convert from MIMEType to UTI reliably is found. // For now, only support PNG, JPEG, and GIF. See <rdar://problem/6095286>. static const CFStringRef kUTTypePNG = CFSTR("public.png"); - static const CFStringRef kUTTypeJPEG = CFSTR("public.jpeg"); static const CFStringRef kUTTypeGIF = CFSTR("com.compuserve.gif"); if (equalIgnoringCase(mimeType, "image/png")) return kUTTypePNG; if (equalIgnoringCase(mimeType, "image/jpeg")) - return kUTTypeJPEG; + return jpegUTI(); if (equalIgnoringCase(mimeType, "image/gif")) return kUTTypeGIF; @@ -276,7 +283,7 @@ static RetainPtr<CFStringRef> utiFromMIMEType(const String& mimeType) #endif } -String ImageBuffer::toDataURL(const String& mimeType, double) const +String ImageBuffer::toDataURL(const String& mimeType, const double* quality) const { ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); @@ -288,11 +295,23 @@ String ImageBuffer::toDataURL(const String& mimeType, double) const if (!data) return "data:,"; - RetainPtr<CGImageDestinationRef> destination(AdoptCF, CGImageDestinationCreateWithData(data.get(), utiFromMIMEType(mimeType).get(), 1, 0)); + RetainPtr<CFStringRef> uti = utiFromMIMEType(mimeType); + ASSERT(uti); + + RetainPtr<CGImageDestinationRef> destination(AdoptCF, CGImageDestinationCreateWithData(data.get(), uti.get(), 1, 0)); if (!destination) return "data:,"; - CGImageDestinationAddImage(destination.get(), image.get(), 0); + RetainPtr<CFDictionaryRef> imageProperties = 0; + if (CFEqual(uti.get(), jpegUTI()) && quality && *quality >= 0.0 && *quality <= 1.0) { + // Apply the compression quality to the image destination. + RetainPtr<CFNumberRef> compressionQuality(AdoptCF, CFNumberCreate(kCFAllocatorDefault, kCFNumberDoubleType, quality)); + const void* key = kCGImageDestinationLossyCompressionQuality; + const void* value = compressionQuality.get(); + imageProperties.adoptCF(CFDictionaryCreate(0, &key, &value, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); + } + + CGImageDestinationAddImage(destination.get(), image.get(), imageProperties.get()); CGImageDestinationFinalize(destination.get()); Vector<char> out; diff --git a/WebCore/platform/graphics/cg/ImageSourceCG.cpp b/WebCore/platform/graphics/cg/ImageSourceCG.cpp index 9ad3166..4a7aecc 100644 --- a/WebCore/platform/graphics/cg/ImageSourceCG.cpp +++ b/WebCore/platform/graphics/cg/ImageSourceCG.cpp @@ -29,6 +29,7 @@ #if PLATFORM(CG) #include "ImageSourceCG.h" +#include "IntPoint.h" #include "IntSize.h" #include "MIMETypeRegistry.h" #include "SharedBuffer.h" @@ -196,6 +197,28 @@ IntSize ImageSource::size() const return frameSizeAtIndex(0); } +bool ImageSource::getHotSpot(IntPoint& hotSpot) const +{ + RetainPtr<CFDictionaryRef> properties(AdoptCF, CGImageSourceCopyPropertiesAtIndex(m_decoder, 0, imageSourceOptions())); + if (!properties) + return false; + + int x = -1, y = -1; + CFNumberRef num = (CFNumberRef)CFDictionaryGetValue(properties.get(), CFSTR("hotspotX")); + if (!num || !CFNumberGetValue(num, kCFNumberIntType, &x)) + return false; + + num = (CFNumberRef)CFDictionaryGetValue(properties.get(), CFSTR("hotspotY")); + if (!num || !CFNumberGetValue(num, kCFNumberIntType, &y)) + return false; + + if (x < 0 || y < 0) + return false; + + hotSpot = IntPoint(x, y); + return true; +} + int ImageSource::repetitionCount() { int result = cAnimationLoopOnce; // No property means loop once. diff --git a/WebCore/platform/graphics/chromium/FontChromiumWin.cpp b/WebCore/platform/graphics/chromium/FontChromiumWin.cpp index 9538a8d..48cf9d2 100644 --- a/WebCore/platform/graphics/chromium/FontChromiumWin.cpp +++ b/WebCore/platform/graphics/chromium/FontChromiumWin.cpp @@ -274,7 +274,7 @@ bool TransparencyAwareGlyphPainter::drawGlyphs(int numGlyphs, // If there is a non-blur shadow and both the fill color and shadow color // are opaque, handle without skia. IntSize shadowSize; - int shadowBlur; + float shadowBlur; Color shadowColor; if (m_graphicsContext->getShadow(shadowSize, shadowBlur, shadowColor)) { // If there is a shadow and this code is reached, windowsCanHandleDrawTextShadow() @@ -484,7 +484,7 @@ void Font::drawComplexText(GraphicsContext* graphicsContext, // If there is a non-blur shadow and both the fill color and shadow color // are opaque, handle without skia. IntSize shadowSize; - int shadowBlur; + float shadowBlur; Color shadowColor; if (graphicsContext->getShadow(shadowSize, shadowBlur, shadowColor) && windowsCanHandleDrawTextShadow(graphicsContext)) { COLORREF textColor = skia::SkColorToCOLORREF(SkColorSetARGB(255, shadowColor.red(), shadowColor.green(), shadowColor.blue())); diff --git a/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp b/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp index 7b22bad..0a5aec5 100644 --- a/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp +++ b/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp @@ -143,6 +143,7 @@ void FontPlatformData::setupPaint(SkPaint* paint) const break; } + paint->setEmbeddedBitmapText(m_style.useBitmaps); paint->setTextSize(SkFloatToScalar(ts)); paint->setTypeface(m_typeface); paint->setFakeBoldText(m_fakeBold); diff --git a/WebCore/platform/graphics/chromium/FontUtilsChromiumWin.cpp b/WebCore/platform/graphics/chromium/FontUtilsChromiumWin.cpp index 8dba49e..78170a9 100644 --- a/WebCore/platform/graphics/chromium/FontUtilsChromiumWin.cpp +++ b/WebCore/platform/graphics/chromium/FontUtilsChromiumWin.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2007, 2008, Google Inc. All rights reserved. + * Copyright (c) 2006, 2007, 2008, 2009, 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 @@ -44,6 +44,25 @@ namespace WebCore { namespace { +bool isFontPresent(const UChar* fontName) +{ + HFONT hfont = CreateFont(12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + fontName); + if (!hfont) + return false; + HDC dc = GetDC(0); + HGDIOBJ oldFont = static_cast<HFONT>(SelectObject(dc, hfont)); + WCHAR actualFontName[LF_FACESIZE]; + GetTextFace(dc, LF_FACESIZE, actualFontName); + actualFontName[LF_FACESIZE - 1] = 0; + SelectObject(dc, oldFont); + DeleteObject(hfont); + ReleaseDC(0, dc); + // We don't have to worry about East Asian fonts with locale-dependent + // names here for now. + return !wcscmp(fontName, actualFontName); +} + // A simple mapping from UScriptCode to family name. This is a sparse array, // which works well since the range of UScriptCode values is small. typedef const UChar* ScriptToFontMap[USCRIPT_CODE_LIMIT]; @@ -55,10 +74,14 @@ void initializeScriptFontMap(ScriptToFontMap& scriptFontMap) const UChar* family; }; - const static FontMap fontMap[] = { + static const FontMap fontMap[] = { {USCRIPT_LATIN, L"times new roman"}, {USCRIPT_GREEK, L"times new roman"}, {USCRIPT_CYRILLIC, L"times new roman"}, + // FIXME: Consider trying new Vista fonts before XP fonts for CJK. + // Some Vista users do want to use Vista cleartype CJK fonts. If we + // did, the results of tests with CJK characters would have to be + // regenerated for Vista. {USCRIPT_SIMPLIFIED_HAN, L"simsun"}, {USCRIPT_TRADITIONAL_HAN, L"pmingliu"}, {USCRIPT_HIRAGANA, L"ms pgothic"}, @@ -72,32 +95,81 @@ void initializeScriptFontMap(ScriptToFontMap& scriptFontMap) {USCRIPT_BENGALI, L"vrinda"}, {USCRIPT_GURMUKHI, L"raavi"}, {USCRIPT_GUJARATI, L"shruti"}, - {USCRIPT_ORIYA, L"kalinga"}, {USCRIPT_TAMIL, L"latha"}, {USCRIPT_TELUGU, L"gautami"}, {USCRIPT_KANNADA, L"tunga"}, - {USCRIPT_MALAYALAM, L"kartika"}, - {USCRIPT_LAO, L"dokchampa"}, - {USCRIPT_TIBETAN, L"microsoft himalaya"}, {USCRIPT_GEORGIAN, L"sylfaen"}, {USCRIPT_ARMENIAN, L"sylfaen"}, - {USCRIPT_ETHIOPIC, L"nyala"}, + {USCRIPT_THAANA, L"mv boli"}, {USCRIPT_CANADIAN_ABORIGINAL, L"euphemia"}, {USCRIPT_CHEROKEE, L"plantagenet cherokee"}, - {USCRIPT_YI, L"microsoft yi balti"}, - {USCRIPT_SINHALA, L"iskoola pota"}, - {USCRIPT_SYRIAC, L"estrangelo edessa"}, - {USCRIPT_KHMER, L"daunpenh"}, - {USCRIPT_THAANA, L"mv boli"}, {USCRIPT_MONGOLIAN, L"mongolian balti"}, - {USCRIPT_MYANMAR, L"padauk"}, // For USCRIPT_COMMON, we map blocks to scripts when // that makes sense. }; - + + struct ScriptToFontFamilies { + UScriptCode script; + const UChar** families; + }; + + // Kartika on Vista or earlier lacks the support for Chillu + // letters added to Unicode 5.1. + // Try AnjaliOldLipi (a very widely used Malaylalam font with the full + // Unicode 5.x support) before falling back to Kartika. + static const UChar* malayalamFonts[] = {L"AnjaliOldLipi", L"Lohit Malayalam", L"Kartika", L"Rachana", 0}; + // Try Khmer OS before Vista fonts because 'Khmer OS' goes along better + // with Latin and looks better/larger for the same size. + static const UChar* khmerFonts[] = {L"Khmer OS", L"MoolBoran", L"DaunPenh", L"Code2000", 0}; + // For the following 6 scripts, two or fonts are listed. The fonts in + // the 1st slot are not available on Windows XP. To support these + // scripts on XP, listed in the rest of slots are widely used + // fonts. + static const UChar* ethiopicFonts[] = {L"Nyala", L"Abyssinica SIL", L"Ethiopia Jiret", L"Visual Geez Unicode", L"GF Zemen Unicode", 0}; + static const UChar* oriyaFonts[] = {L"Kalinga", L"ori1Uni", L"Lohit Oriya", 0}; + static const UChar* laoFonts[] = {L"DokChampa", L"Saysettha OT", L"Phetsarath OT", L"Code2000", 0}; + static const UChar* tibetanFonts[] = {L"Microsoft Himalaya", L"Jomolhari", L"Tibetan Machine Uni", 0}; + static const UChar* sinhalaFonts[] = {L"Iskoola Pota", L"AksharUnicode", 0}; + static const UChar* yiFonts[] = {L"Microsoft Yi Balti", L"Nuosu SIL", L"Code2000", 0}; + // http://www.bethmardutho.org/support/meltho/download/index.php + static const UChar* syriacFonts[] = {L"Estrangelo Edessa", L"Estrangelo Nisibin", L"Code2000", 0}; + // No Myanmar/Burmese font is shipped with Windows, yet. Try a few + // widely available/used ones that supports Unicode 5.1 or later. + static const UChar* myanmarFonts[] = {L"Padauk", L"Parabaik", L"Myanmar3", L"Code2000", 0}; + + static const ScriptToFontFamilies scriptToFontFamilies[] = { + {USCRIPT_MALAYALAM, malayalamFonts}, + {USCRIPT_KHMER, khmerFonts}, + {USCRIPT_ETHIOPIC, ethiopicFonts}, + {USCRIPT_ORIYA, oriyaFonts}, + {USCRIPT_LAO, laoFonts}, + {USCRIPT_TIBETAN, tibetanFonts}, + {USCRIPT_SINHALA, sinhalaFonts}, + {USCRIPT_YI, yiFonts}, + {USCRIPT_SYRIAC, syriacFonts}, + {USCRIPT_MYANMAR, myanmarFonts}, + }; + for (int i = 0; i < sizeof(fontMap) / sizeof(fontMap[0]); ++i) scriptFontMap[fontMap[i].script] = fontMap[i].family; + // FIXME: Instead of scanning the hard-coded list, we have to + // use EnumFont* to 'inspect' fonts to pick up fonts covering scripts + // when it's possible (e.g. using OS/2 table). If we do that, this + // had better be pulled out of here. + for (int i = 0; i < sizeof(scriptToFontFamilies) / sizeof(scriptToFontFamilies[0]); ++i) { + UScriptCode script = scriptToFontFamilies[i].script; + scriptFontMap[script] = 0; + const UChar** familyPtr = scriptToFontFamilies[i].families; + while (*familyPtr) { + if (isFontPresent(*familyPtr)) { + scriptFontMap[script] = *familyPtr; + break; + } + ++familyPtr; + } + } + // Initialize the locale-dependent mapping. // Since Chrome synchronizes the ICU default locale with its UI locale, // this ICU locale tells the current UI locale of Chrome. @@ -198,7 +270,7 @@ struct FontData { // in the 1st pass. Need to experiment further. typedef HashMap<String, FontData> FontDataCache; -} // namespace +} // namespace // FIXME: this is font fallback code version 0.1 // - Cover all the scripts @@ -363,4 +435,4 @@ int getStyleFromLogfont(const LOGFONT* logfont) (logfont->lfWeight >= 700 ? FontStyleBold : FontStyleNormal); } -} // namespace WebCore +} // namespace WebCore diff --git a/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp b/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp index 37ea485..23aeefa 100644 --- a/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp +++ b/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp @@ -474,7 +474,50 @@ void GraphicsLayerChromium::updateBackfaceVisibility() void GraphicsLayerChromium::updateLayerPreserves3D() { - // FIXME: implement + if (m_preserves3D && !m_transformLayer) { + // Create the transform layer. + m_transformLayer = LayerChromium::create(LayerChromium::TransformLayer, this); + + // Copy the position from this layer. + updateLayerPosition(); + updateLayerSize(); + updateAnchorPoint(); + updateTransform(); + updateChildrenTransform(); + + m_layer->setPosition(FloatPoint(m_size.width() / 2.0f, m_size.height() / 2.0f)); + + m_layer->setAnchorPoint(FloatPoint(0.5f, 0.5f)); + TransformationMatrix identity; + m_layer->setTransform(identity); + + // Set the old layer to opacity of 1. Further down we will set the opacity on the transform layer. + m_layer->setOpacity(1); + + // Move this layer to be a child of the transform layer. + if (m_layer->superlayer()) + m_layer->superlayer()->replaceSublayer(m_layer.get(), m_transformLayer.get()); + m_transformLayer->addSublayer(m_layer.get()); + + updateSublayerList(); + } else if (!m_preserves3D && m_transformLayer) { + // Relace the transformLayer in the parent with this layer. + m_layer->removeFromSuperlayer(); + m_transformLayer->superlayer()->replaceSublayer(m_transformLayer.get(), m_layer.get()); + + // Release the transform layer. + m_transformLayer = 0; + + updateLayerPosition(); + updateLayerSize(); + updateAnchorPoint(); + updateTransform(); + updateChildrenTransform(); + + updateSublayerList(); + } + + updateOpacityOnLayer(); } void GraphicsLayerChromium::updateLayerDrawsContent() @@ -527,8 +570,7 @@ void GraphicsLayerChromium::updateContentsRect() if (!m_contentsLayer) return; - // The position of the layer is the center of quad. - m_contentsLayer->setPosition(FloatPoint(m_contentsRect.x() + m_contentsRect.width() / 2, m_contentsRect.y() + m_contentsRect.height() / 2)); + m_contentsLayer->setPosition(FloatPoint(m_contentsRect.x(), m_contentsRect.y())); m_contentsLayer->setBounds(IntSize(m_contentsRect.width(), m_contentsRect.height())); } diff --git a/WebCore/platform/graphics/chromium/LayerChromium.cpp b/WebCore/platform/graphics/chromium/LayerChromium.cpp index b08df82..5e71e49 100644 --- a/WebCore/platform/graphics/chromium/LayerChromium.cpp +++ b/WebCore/platform/graphics/chromium/LayerChromium.cpp @@ -118,6 +118,10 @@ void LayerChromium::updateTextureContents(unsigned int textureId) OwnPtr<PlatformContextSkia> skiaContext; OwnPtr<GraphicsContext> graphicsContext; if (drawsContent()) { // Layer contents must be drawn into a canvas. + // Clip the dirtyRect to the size of the layer to avoid drawing outside + // the bounds of the backing texture. + dirtyRect.intersect(IntRect(IntPoint(0, 0), m_bounds)); + canvas.set(new skia::PlatformCanvas(dirtyRect.width(), dirtyRect.height(), false)); skiaContext.set(new PlatformContextSkia(canvas.get())); @@ -135,8 +139,7 @@ void LayerChromium::updateTextureContents(unsigned int textureId) m_owner->paintGraphicsLayerContents(*graphicsContext, dirtyRect); const SkBitmap& bitmap = canvas->getDevice()->accessBitmap(false); skiaBitmap = &bitmap; - requiredTextureSize = IntSize(max(m_bounds.width(), dirtyRect.width()), - max(m_bounds.height(), dirtyRect.height())); + requiredTextureSize = m_bounds; } else { // Layer is a container. // The layer contains an Image. NativeImageSkia* skiaImage = static_cast<NativeImageSkia*>(contents()); diff --git a/WebCore/platform/graphics/chromium/LayerChromium.h b/WebCore/platform/graphics/chromium/LayerChromium.h index 59952eb..7af7e9b 100644 --- a/WebCore/platform/graphics/chromium/LayerChromium.h +++ b/WebCore/platform/graphics/chromium/LayerChromium.h @@ -158,8 +158,16 @@ public: void setContents(NativeImagePtr contents); NativeImagePtr contents() const { return m_contents; } + void setDrawTransform(const TransformationMatrix& transform) { m_drawTransform = transform; } + const TransformationMatrix& drawTransform() const { return m_drawTransform; } + + void setDrawOpacity(float opacity) { m_drawOpacity = opacity; } + float drawOpacity() const { return m_drawOpacity; } + bool drawsContent() { return m_owner && m_owner->drawsContent(); } + bool preserves3D() { return m_owner && m_owner->preserves3D(); } + void setLayerRenderer(LayerRendererChromium*); private: @@ -203,12 +211,16 @@ private: TransformationMatrix m_transform; TransformationMatrix m_sublayerTransform; + TransformationMatrix m_drawTransform; + uint32_t m_edgeAntialiasingMask; float m_opacity; float m_zPosition; float m_anchorPointZ; float m_borderWidth; + float m_drawOpacity; + unsigned int m_allocatedTextureId; IntSize m_allocatedTextureSize; diff --git a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp index dfb6078..73311be 100644 --- a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp +++ b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp @@ -156,6 +156,13 @@ static GLuint createLayerTexture() return textureId; } +static inline bool compareLayerZ(const LayerChromium* a, const LayerChromium* b) +{ + const TransformationMatrix& transformA = a->drawTransform(); + const TransformationMatrix& transformB = b->drawTransform(); + + return transformA.m43() < transformB.m43(); +} PassOwnPtr<LayerRendererChromium> LayerRendererChromium::create(Page* page) { @@ -173,6 +180,7 @@ LayerRendererChromium::LayerRendererChromium(Page* page) , m_page(page) , m_rootLayerTextureWidth(0) , m_rootLayerTextureHeight(0) + , m_scrollPosition(IntPoint(-1, -1)) { m_quadVboIds[Vertices] = m_quadVboIds[LayerElements] = 0; m_hardwareCompositing = (initGL() && initializeSharedGLObjects()); @@ -284,6 +292,9 @@ void LayerRendererChromium::drawLayers(const IntRect& updateRect, const IntRect& glDisable(GL_DEPTH_TEST); glDisable(GL_CULL_FACE); + if (m_scrollPosition == IntPoint(-1, -1)) + m_scrollPosition = scrollPosition; + IntPoint scrollDelta = toPoint(scrollPosition - m_scrollPosition); // Scroll only when the updateRect contains pixels for the newly uncovered region to avoid flashing. if ((scrollDelta.x() && updateRect.width() >= abs(scrollDelta.x()) && updateRect.height() >= contentRect.height()) @@ -358,19 +369,26 @@ void LayerRendererChromium::drawLayers(const IntRect& updateRect, const IntRect& checkGLError(); - // FIXME: Sublayers need to be sorted in Z to get the correct transparency effect. - - // Enable scissoring to avoid rendering composited layers over the scrollbars. - glEnable(GL_SCISSOR_TEST); - glScissor(0, visibleRect.height() - contentRect.height(), contentRect.width(), contentRect.height()); - // Translate all the composited layers by the scroll position. TransformationMatrix matrix; matrix.translate3d(-m_scrollPosition.x(), -m_scrollPosition.y(), 0); + float opacity = 1; + m_layerList.shrink(0); const Vector<RefPtr<LayerChromium> >& sublayers = m_rootLayer->getSublayers(); for (size_t i = 0; i < sublayers.size(); i++) - compositeLayersRecursive(sublayers[i].get(), matrix, opacity, visibleRect); + updateLayersRecursive(sublayers[i].get(), matrix, opacity, visibleRect); + + // Sort layers by the z coordinate of their center so that layers further + // away get drawn first. + std::stable_sort(m_layerList.begin(), m_layerList.end(), compareLayerZ); + + // Enable scissoring to avoid rendering composited layers over the scrollbars. + glEnable(GL_SCISSOR_TEST); + glScissor(0, visibleRect.height() - contentRect.height(), contentRect.width(), contentRect.height()); + + for (size_t j = 0; j < m_layerList.size(); j++) + drawLayer(m_layerList[j]); glDisable(GL_SCISSOR_TEST); @@ -464,65 +482,108 @@ bool LayerRendererChromium::isLayerVisible(LayerChromium* layer, const Transform return mappedRect.intersects(FloatRect(-1, -1, 2, 2)); } -void LayerRendererChromium::compositeLayersRecursive(LayerChromium* layer, const TransformationMatrix& matrix, float opacity, const IntRect& visibleRect) +// Updates and caches the layer transforms and opacity values that will be used +// when rendering them. +void LayerRendererChromium::updateLayersRecursive(LayerChromium* layer, const TransformationMatrix& parentMatrix, float opacity, const IntRect& visibleRect) { - static GLfloat glMatrix[16]; - // Compute the new matrix transformation that will be applied to this layer and - // all its sublayers. - // The basic transformation chain for the layer is (using the Matrix x Vector order): - // M = M[p] * T[l] * T[a] * M[l] * T[-a] + // all its sublayers. It's important to remember that the layer's position + // is the position of the layer's anchor point. Also, the coordinate system used + // assumes that the origin is at the lower left even though the coordinates the browser + // gives us for the layers are for the upper left corner. The Y flip happens via + // the orthographic projection applied at render time. + // The transformation chain for the layer is (using the Matrix x Vector order): + // M = M[p] * Tr[l] * M[l] * Tr[c] // Where M[p] is the parent matrix passed down to the function - // T[l] is the translation of the layer's center - // T[a] and T[-a] is a translation/inverse translation by the anchor point - // M[l] is the layer's matrix + // Tr[l] is the translation matrix locating the layer's anchor point + // Tr[c] is the translation offset between the anchor point and the center of the layer + // M[l] is the layer's matrix (applied at the anchor point) + // This transform creates a coordinate system whose origin is the center of the layer. // Note that the final matrix used by the shader for the layer is P * M * S . This final product - // is effectively computed in drawTexturedQuad(). + // is computed in drawTexturedQuad(). // Where: P is the projection matrix // M is the layer's matrix computed above // S is the scale adjustment (to scale up to the layer size) IntSize bounds = layer->bounds(); FloatPoint anchorPoint = layer->anchorPoint(); FloatPoint position = layer->position(); - float anchorX = (anchorPoint.x() - 0.5) * bounds.width(); - float anchorY = (0.5 - anchorPoint.y()) * bounds.height(); + + // Offset between anchor point and the center of the quad. + float centerOffsetX = (0.5 - anchorPoint.x()) * bounds.width(); + float centerOffsetY = (0.5 - anchorPoint.y()) * bounds.height(); // M = M[p] - TransformationMatrix localMatrix = matrix; - // M = M[p] * T[l] - localMatrix.translate3d(position.x(), position.y(), 0); - // M = M[p] * T[l] * T[a] - localMatrix.translate3d(anchorX, anchorY, 0); - // M = M[p] * T[l] * T[a] * M[l] + TransformationMatrix localMatrix = parentMatrix; + // M = M[p] * Tr[l] + localMatrix.translate3d(position.x(), position.y(), layer->anchorPointZ()); + // M = M[p] * Tr[l] * M[l] localMatrix.multLeft(layer->transform()); - // M = M[p] * T[l] * T[a] * M[l] * T[-a] - localMatrix.translate3d(-anchorX, -anchorY, 0); + // M = M[p] * Tr[l] * M[l] * Tr[c] + localMatrix.translate3d(centerOffsetX, centerOffsetY, -layer->anchorPointZ()); + + // Check if the layer falls within the visible bounds of the page. + bool layerVisible = isLayerVisible(layer, localMatrix, visibleRect); + + bool layerHasContent = layer->drawsContent() || layer->contents(); bool skipLayer = false; if (bounds.width() > 2048 || bounds.height() > 2048) { - LOG(LayerRenderer, "Skipping layer with size %d %d", bounds.width(), bounds.height()); + if (layerHasContent) + LOG(LayerRenderer, "Skipping layer with size %d %d", bounds.width(), bounds.height()); skipLayer = true; } // Calculate the layer's opacity. opacity *= layer->opacity(); - bool layerVisible = isLayerVisible(layer, localMatrix, visibleRect); + layer->setDrawTransform(localMatrix); + layer->setDrawOpacity(opacity); + if (layerVisible && !skipLayer) + m_layerList.append(layer); + + // Flatten to 2D if the layer doesn't preserve 3D. + if (!layer->preserves3D()) { + localMatrix.setM13(0); + localMatrix.setM23(0); + localMatrix.setM31(0); + localMatrix.setM32(0); + localMatrix.setM33(1); + localMatrix.setM34(0); + localMatrix.setM43(0); + } + + // Apply the sublayer transform at the center of the layer. + localMatrix.multLeft(layer->sublayerTransform()); + + // The origin of the sublayers is actually the bottom left corner of the layer + // (or top left when looking it it from the browser's pespective) instead of the center. + // The matrix passed down to the sublayers is therefore: + // M[s] = M * Tr[-center] + localMatrix.translate3d(-bounds.width() * 0.5, -bounds.height() * 0.5, 0); + + const Vector<RefPtr<LayerChromium> >& sublayers = layer->getSublayers(); + for (size_t i = 0; i < sublayers.size(); i++) + updateLayersRecursive(sublayers[i].get(), localMatrix, opacity, visibleRect); +} + +void LayerRendererChromium::drawLayer(LayerChromium* layer) +{ + const TransformationMatrix& localMatrix = layer->drawTransform(); + IntSize bounds = layer->bounds(); // Note that there are two types of layers: - // 1. Layers that have their own GraphicsContext and can draw their contents on demand (layer->drawsContent() == true). - // 2. Layers that are just containers of images/video/etc that don't own a GraphicsContext (layer->contents() == true). - if ((layer->drawsContent() || layer->contents()) && !skipLayer && layerVisible) { + // 1. Layers that draw their own content via the GraphicsContext (layer->drawsContent() == true). + // 2. Layers that are pure containers of images/video/etc whose content is simply + // copied into the backing texture (layer->contents() == true). + if (layer->drawsContent() || layer->contents()) { int textureId = getTextureId(layer); // If no texture has been created for the layer yet then create one now. if (textureId == -1) textureId = assignTextureForLayer(layer); // Redraw the contents of the layer if necessary. - if ((layer->drawsContent() || layer->contents()) && layer->contentsDirty()) { - // Update the contents of the layer before taking a snapshot. For layers that - // are simply containers, the following call just clears the dirty flag but doesn't - // actually do any draws/copies. + if (layer->contentsDirty()) { + // Update the backing texture contents for any dirty portion of the layer. layer->updateTextureContents(textureId); } @@ -533,22 +594,11 @@ void LayerRendererChromium::compositeLayersRecursive(LayerChromium* layer, const glBindTexture(GL_TEXTURE_2D, textureId); - drawTexturedQuad(localMatrix, bounds.width(), bounds.height(), opacity, false); + drawTexturedQuad(localMatrix, bounds.width(), bounds.height(), layer->drawOpacity(), false); } // Draw the debug border if there is one. drawDebugBorder(layer, localMatrix); - - // Apply the sublayer transform. - localMatrix.multLeft(layer->sublayerTransform()); - - // The origin of the sublayers is actually the left top corner of the layer - // instead of the center. The matrix passed down to the sublayers is therefore: - // M[s] = M * T[-center] - localMatrix.translate3d(-bounds.width() * 0.5, -bounds.height() * 0.5, 0); - const Vector<RefPtr<LayerChromium> >& sublayers = layer->getSublayers(); - for (size_t i = 0; i < sublayers.size(); i++) - compositeLayersRecursive(sublayers[i].get(), localMatrix, opacity, visibleRect); } bool LayerRendererChromium::makeContextCurrent() @@ -590,8 +640,7 @@ bool LayerRendererChromium::initializeSharedGLObjects() " v_texCoord = a_texCoord; \n" "} \n"; char fragmentShaderString[] = - // FIXME: Re-introduce precision qualifier when we need GL ES shaders. - "//precision mediump float; \n" + "precision mediump float; \n" "varying vec2 v_texCoord; \n" "uniform sampler2D s_texture; \n" "uniform float alpha; \n" @@ -605,8 +654,7 @@ bool LayerRendererChromium::initializeSharedGLObjects() // from fragmentShaderString in that it doesn't swizzle the colors and doesn't // take an alpha value. char scrollFragmentShaderString[] = - // FIXME: Re-introduce precision qualifier when we need GL ES shaders. - "//precision mediump float; \n" + "precision mediump float; \n" "varying vec2 v_texCoord; \n" "uniform sampler2D s_texture; \n" "void main() \n" @@ -624,8 +672,7 @@ bool LayerRendererChromium::initializeSharedGLObjects() " gl_Position = matrix * a_position; \n" "} \n"; char borderFragmentShaderString[] = - // FIXME: Re-introduce precision qualifier when we need GL ES shaders. - "//precision mediump float; \n" + "precision mediump float; \n" "uniform vec4 color; \n" "void main() \n" "{ \n" diff --git a/WebCore/platform/graphics/chromium/LayerRendererChromium.h b/WebCore/platform/graphics/chromium/LayerRendererChromium.h index eb66dac..a2e3427 100644 --- a/WebCore/platform/graphics/chromium/LayerRendererChromium.h +++ b/WebCore/platform/graphics/chromium/LayerRendererChromium.h @@ -74,7 +74,9 @@ public: GraphicsContext* rootLayerGraphicsContext() const { return m_rootLayerGraphicsContext.get(); } private: - void compositeLayersRecursive(LayerChromium*, const TransformationMatrix&, float opacity, const IntRect& visibleRect); + void updateLayersRecursive(LayerChromium* layer, const TransformationMatrix& parentMatrix, float opacity, const IntRect& visibleRect); + + void drawLayer(LayerChromium*); void drawDebugBorder(LayerChromium*, const TransformationMatrix&); @@ -120,6 +122,8 @@ private: RefPtr<LayerChromium> m_rootLayer; + Vector<LayerChromium*> m_layerList; + bool m_needsDisplay; IntPoint m_scrollPosition; bool m_hardwareCompositing; diff --git a/WebCore/platform/graphics/gtk/FontGtk.cpp b/WebCore/platform/graphics/gtk/FontGtk.cpp index 29b83dc..2164db5 100644 --- a/WebCore/platform/graphics/gtk/FontGtk.cpp +++ b/WebCore/platform/graphics/gtk/FontGtk.cpp @@ -211,7 +211,7 @@ void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const F // Text shadow, inspired by FontMac IntSize shadowSize; - int shadowBlur = 0; + float shadowBlur = 0; Color shadowColor; bool hasShadow = context->textDrawingMode() == cTextFill && context->getShadow(shadowSize, shadowBlur, shadowColor); diff --git a/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp b/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp index 8db512c..7350eeb 100644 --- a/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp +++ b/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp @@ -536,7 +536,7 @@ void GraphicsContext::clearPlatformShadow() notImplemented(); } -void GraphicsContext::setPlatformShadow(IntSize const&, int, Color const&, ColorSpace) +void GraphicsContext::setPlatformShadow(IntSize const&, float, Color const&, ColorSpace) { notImplemented(); } diff --git a/WebCore/platform/graphics/haiku/ImageBufferHaiku.cpp b/WebCore/platform/graphics/haiku/ImageBufferHaiku.cpp index fdab656..c5de485 100644 --- a/WebCore/platform/graphics/haiku/ImageBufferHaiku.cpp +++ b/WebCore/platform/graphics/haiku/ImageBufferHaiku.cpp @@ -310,7 +310,7 @@ void ImageBuffer::putPremultipliedImageData(ImageData* source, const IntRect& so putImageData(source, sourceRect, destPoint, m_data, m_size, true); } -String ImageBuffer::toDataURL(const String& mimeType, double) const +String ImageBuffer::toDataURL(const String& mimeType, const double*) const { if (!MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)) return "data:,"; diff --git a/WebCore/platform/graphics/mac/FontMac.mm b/WebCore/platform/graphics/mac/FontMac.mm index 87057fa..100200a 100644 --- a/WebCore/platform/graphics/mac/FontMac.mm +++ b/WebCore/platform/graphics/mac/FontMac.mm @@ -136,7 +136,7 @@ void Font::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, cons IntSize shadowSize; - int shadowBlur; + float shadowBlur; Color shadowColor; ColorSpace fillColorSpace = context->fillColorSpace(); context->getShadow(shadowSize, shadowBlur, shadowColor); diff --git a/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp b/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp index 79a10dd..90678b2 100644 --- a/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp +++ b/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp @@ -35,7 +35,7 @@ #include "WebGLActiveInfo.h" #include "ArrayBufferView.h" #include "WebGLBuffer.h" -#include "FloatArray.h" +#include "Float32Array.h" #include "WebGLFramebuffer.h" #include "Int32Array.h" #include "WebGLProgram.h" diff --git a/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp b/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp index 54cc7ee..7fe160a 100644 --- a/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp +++ b/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp @@ -292,7 +292,7 @@ FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& rect) return FloatRect(enclosingIntRect(m_data->transformation().mapRect(rect))); } -void GraphicsContext::setPlatformShadow(const IntSize& size, int blur, const Color& color, ColorSpace colorSpace) +void GraphicsContext::setPlatformShadow(const IntSize& size, float blur, const Color& color, ColorSpace colorSpace) { if (paintingDisabled()) return; diff --git a/WebCore/platform/graphics/qt/FontQt.cpp b/WebCore/platform/graphics/qt/FontQt.cpp index 2009424..d357a22 100644 --- a/WebCore/platform/graphics/qt/FontQt.cpp +++ b/WebCore/platform/graphics/qt/FontQt.cpp @@ -44,11 +44,15 @@ namespace WebCore { -static const QString fromRawDataWithoutRef(const String& string) +static const QString fromRawDataWithoutRef(const String& string, int start = 0, int len = -1) { + if (len < 0) + len = string.length() - start; + Q_ASSERT(start + len <= string.length()); + // We don't detach. This assumes the WebCore string data will stay valid for the // lifetime of the QString we pass back, since we don't ref the WebCore string. - return QString::fromRawData(reinterpret_cast<const QChar*>(string.characters()), string.length()); + return QString::fromRawData(reinterpret_cast<const QChar*>(string.characters() + start), len); } static QTextLine setupLayout(QTextLayout* layout, const TextRun& style) @@ -66,7 +70,7 @@ static QTextLine setupLayout(QTextLayout* layout, const TextRun& style) return line; } -void Font::drawComplexText(GraphicsContext* ctx, const TextRun& run, const FloatPoint& point, int from, int to) const +static void drawTextCommon(GraphicsContext* ctx, const TextRun& run, const FloatPoint& point, int from, int to, const QFont& font, bool isComplexText) { if (to < 0) to = run.length(); @@ -102,59 +106,72 @@ void Font::drawComplexText(GraphicsContext* ctx, const TextRun& run, const Float String sanitized = Font::normalizeSpaces(String(run.characters(), run.length())); QString string = fromRawDataWithoutRef(sanitized); + QPointF pt(point.x(), point.y()); // text shadow IntSize shadowSize; - int shadowBlur; + float shadowBlur; Color shadowColor; bool hasShadow = ctx->textDrawingMode() == cTextFill && ctx->getShadow(shadowSize, shadowBlur, shadowColor); if (from > 0 || to < run.length()) { - QTextLayout layout(string, font()); - QTextLine line = setupLayout(&layout, run); - float x1 = line.cursorToX(from); - float x2 = line.cursorToX(to); - if (x2 < x1) - qSwap(x1, x2); - - QFontMetrics fm(font()); - int ascent = fm.ascent(); - QRectF clip(point.x() + x1, point.y() - ascent, x2 - x1, fm.height()); - - if (hasShadow) { - // TODO: when blur support is added, the clip will need to account - // for the blur radius - qreal dx1 = 0, dx2 = 0, dy1 = 0, dy2 = 0; - if (shadowSize.width() > 0) - dx2 = shadowSize.width(); - else - dx1 = -shadowSize.width(); - if (shadowSize.height() > 0) - dy2 = shadowSize.height(); - else - dy1 = -shadowSize.height(); - // expand the clip rect to include the text shadow as well - clip.adjust(dx1, dx2, dy1, dy2); - } - p->save(); - p->setClipRect(clip.toRect(), Qt::IntersectClip); - QPointF pt(point.x(), point.y() - ascent); - if (hasShadow) { + if (isComplexText) { + QTextLayout layout(string, font); + QTextLine line = setupLayout(&layout, run); + float x1 = line.cursorToX(from); + float x2 = line.cursorToX(to); + if (x2 < x1) + qSwap(x1, x2); + + QFontMetrics fm(font); + int ascent = fm.ascent(); + QRectF clip(point.x() + x1, point.y() - ascent, x2 - x1, fm.height()); + + if (hasShadow) { + // TODO: when blur support is added, the clip will need to account + // for the blur radius + qreal dx1 = 0, dx2 = 0, dy1 = 0, dy2 = 0; + if (shadowSize.width() > 0) + dx2 = shadowSize.width(); + else + dx1 = -shadowSize.width(); + if (shadowSize.height() > 0) + dy2 = shadowSize.height(); + else + dy1 = -shadowSize.height(); + // expand the clip rect to include the text shadow as well + clip.adjust(dx1, dx2, dy1, dy2); + } p->save(); - p->setPen(QColor(shadowColor)); - p->translate(shadowSize.width(), shadowSize.height()); + p->setClipRect(clip.toRect(), Qt::IntersectClip); + pt.setY(pt.y() - ascent); + if (hasShadow) { + p->save(); + p->setPen(QColor(shadowColor)); + p->translate(shadowSize.width(), shadowSize.height()); + line.draw(p, pt); + p->restore(); + } + p->setPen(textFillPen); line.draw(p, pt); p->restore(); + return; } - line.draw(p, pt); - p->restore(); - return; +#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) + int skipWidth = QFontMetrics(font).width(string, from, Qt::TextBypassShaping); + pt.setX(pt.x() + skipWidth); + string = fromRawDataWithoutRef(sanitized, from, to - from); +#endif } - p->setFont(font()); + p->setFont(font); - QPointF pt(point.x(), point.y()); int flags = run.rtl() ? Qt::TextForceRightToLeft : Qt::TextForceLeftToRight; +#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) + // See QWebPagePrivate::QWebPagePrivate() where the default path is set to Complex for Qt 4.6 and earlier. + if (!isComplexText) + flags |= Qt::TextBypassShaping; +#endif if (hasShadow) { // TODO: text shadow blur support p->save(); @@ -165,7 +182,7 @@ void Font::drawComplexText(GraphicsContext* ctx, const TextRun& run, const Float } if (ctx->textDrawingMode() & cTextStroke) { QPainterPath path; - path.addText(pt, font(), string); + path.addText(pt, font, string); p->setPen(textStrokePen); p->strokePath(path, p->pen()); } @@ -175,6 +192,42 @@ void Font::drawComplexText(GraphicsContext* ctx, const TextRun& run, const Float } } +void Font::drawSimpleText(GraphicsContext* ctx, const TextRun& run, const FloatPoint& point, int from, int to) const +{ +#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) + drawTextCommon(ctx, run, point, from, to, font(), /* isComplexText = */false); +#else + Q_ASSERT(false); +#endif +} + +void Font::drawComplexText(GraphicsContext* ctx, const TextRun& run, const FloatPoint& point, int from, int to) const +{ + drawTextCommon(ctx, run, point, from, to, font(), /* isComplexText = */true); +} + +float Font::floatWidthForSimpleText(const TextRun& run, GlyphBuffer* glyphBuffer, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const +{ +#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) + if (!run.length()) + return 0; + + String sanitized = Font::normalizeSpaces(String(run.characters(), run.length())); + QString string = fromRawDataWithoutRef(sanitized); + + int w = QFontMetrics(font()).width(string, -1, Qt::TextBypassShaping); + + // WebKit expects us to ignore word spacing on the first character (as opposed to what Qt does) + if (treatAsSpace(run[0])) + w -= m_wordSpacing; + + return w + run.padding(); +#else + Q_ASSERT(false); + return 0.0f; +#endif +} + float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>*, GlyphOverflow*) const { if (!run.length()) @@ -194,6 +247,34 @@ float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon return w + run.padding(); } +int Font::offsetForPositionForSimpleText(const TextRun& run, int position, bool includePartialGlyphs) const +{ +#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) + String sanitized = Font::normalizeSpaces(String(run.characters(), run.length())); + QString string = fromRawDataWithoutRef(sanitized); + + QFontMetrics fm(font()); + float delta = (float)position; + int curPos = 0; + do { + float charWidth = fm.width(string[curPos]); + delta -= charWidth; + if (includePartialGlyphs) { + if (delta + charWidth / 2 <= 0) + break; + } else { + if (delta + charWidth <= 0) + break; + } + } while (++curPos < string.size()); + + return curPos; +#else + Q_ASSERT(false); + return 0; +#endif +} + int Font::offsetForPositionForComplexText(const TextRun& run, int position, bool) const { String sanitized = Font::normalizeSpaces(String(run.characters(), run.length())); @@ -204,6 +285,23 @@ int Font::offsetForPositionForComplexText(const TextRun& run, int position, bool return line.xToCursor(position); } +FloatRect Font::selectionRectForSimpleText(const TextRun& run, const IntPoint& pt, int h, int from, int to) const +{ +#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) + String sanitized = Font::normalizeSpaces(String(run.characters(), run.length())); + QString wholeText = fromRawDataWithoutRef(sanitized); + QString selectedText = fromRawDataWithoutRef(sanitized, from, to - from); + + int startX = QFontMetrics(font()).width(wholeText, from, Qt::TextBypassShaping); + int width = QFontMetrics(font()).width(selectedText, -1, Qt::TextBypassShaping); + + return FloatRect(pt.x() + startX, pt.y(), width, h); +#else + Q_ASSERT(false); + return FloatRect(); +#endif +} + FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint& pt, int h, int from, int to) const { String sanitized = Font::normalizeSpaces(String(run.characters(), run.length())); @@ -220,6 +318,11 @@ FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint& return FloatRect(pt.x() + x1, pt.y(), x2 - x1, h); } +bool Font::canReturnFallbackFontsForComplexText() +{ + return false; +} + QFont Font::font() const { QFont f = primaryFont()->getQtFont(); diff --git a/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp index ad43908..e0a785e 100644 --- a/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp +++ b/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp @@ -30,7 +30,7 @@ #include "WebGLActiveInfo.h" #include "ArrayBufferView.h" #include "WebGLBuffer.h" -#include "FloatArray.h" +#include "Float32Array.h" #include "WebGLFramebuffer.h" #include "Int32Array.h" #include "WebGLProgram.h" @@ -40,6 +40,7 @@ #include "WebGLTexture.h" #include "Uint8Array.h" #include <QAbstractScrollArea> +#include <QGLContext> #include <wtf/UnusedParam.h> #include <wtf/text/CString.h> @@ -1620,6 +1621,11 @@ bool GraphicsContext3D::getImageData(Image* image, AlphaOp* neededAlphaOp, unsigned int* format) { + if (!image) + return false; + QPixmap* nativePixmap = image->nativeImageForCurrentFrame(); + if (!nativePixmap) + return false; *hasAlphaChannel = true; *format = GraphicsContext3D::RGBA; @@ -1627,8 +1633,7 @@ bool GraphicsContext3D::getImageData(Image* image, *neededAlphaOp = kAlphaDoNothing; if (!premultiplyAlpha && *hasAlphaChannel) *neededAlphaOp = kAlphaDoUnmultiply; - - QPixmap* nativePixmap = image->nativeImageForCurrentFrame(); + QImage nativeImage = nativePixmap->toImage().convertToFormat(QImage::Format_ARGB32); outputVector.append(nativeImage.rgbSwapped().bits(), nativeImage.byteCount()); diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp index bdb810a..2a7db4e 100644 --- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp +++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp @@ -334,7 +334,7 @@ void GraphicsContext::drawRect(const IntRect& rect) if (m_common->state.shadowColor.isValid()) { IntSize shadowSize; - int shadowBlur; + float shadowBlur; Color shadowColor; if (getShadow(shadowSize, shadowBlur, shadowColor)) { IntRect shadowRect = rect; @@ -372,7 +372,7 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) adjustLineToPixelBoundaries(p1, p2, width, style); IntSize shadowSize; - int shadowBlur; + float shadowBlur; Color shadowColor; if (textDrawingMode() == cTextFill && getShadow(shadowSize, shadowBlur, shadowColor)) { p->save(); @@ -474,7 +474,7 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp p->setRenderHint(QPainter::Antialiasing, true); IntSize shadowSize; - int shadowBlur; + float shadowBlur; Color shadowColor; startAngle *= 16; angleSpan *= 16; @@ -509,7 +509,7 @@ void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points p->save(); p->setRenderHint(QPainter::Antialiasing, shouldAntialias); IntSize shadowSize; - int shadowBlur; + float shadowBlur; Color shadowColor; if (getShadow(shadowSize, shadowBlur, shadowColor)) { p->save(); @@ -540,7 +540,7 @@ QPen GraphicsContext::pen() static void inline drawFilledShadowPath(GraphicsContext* context, QPainter* p, const QPainterPath& path) { IntSize shadowSize; - int shadowBlur; + float shadowBlur; Color shadowColor; if (context->getShadow(shadowSize, shadowBlur, shadowColor)) { p->translate(shadowSize.width(), shadowSize.height()); @@ -587,7 +587,7 @@ void GraphicsContext::strokePath() if (m_common->state.strokePattern || m_common->state.strokeGradient || strokeColor().alpha()) { IntSize shadowSize; - int shadowBlur; + float shadowBlur; Color shadowColor; if (getShadow(shadowSize, shadowBlur, shadowColor)) { QTransform t(p->worldTransform()); @@ -619,7 +619,7 @@ void GraphicsContext::strokePath() static inline void drawBorderlessRectShadow(GraphicsContext* context, QPainter* p, const FloatRect& rect) { IntSize shadowSize; - int shadowBlur; + float shadowBlur; Color shadowColor; if (context->getShadow(shadowSize, shadowBlur, shadowColor)) { FloatRect shadowRect(rect); @@ -820,7 +820,7 @@ FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& frect) return FloatRect(roundedOrigin, roundedLowerRight - roundedOrigin); } -void GraphicsContext::setPlatformShadow(const IntSize& size, int, const Color&, ColorSpace) +void GraphicsContext::setPlatformShadow(const IntSize& size, float, const Color&, ColorSpace) { // Qt doesn't support shadows natively, they are drawn manually in the draw* // functions @@ -1011,7 +1011,8 @@ void GraphicsContext::clipOut(const Path& path) newClip.addPath(clippedOut); p->setClipPath(newClip, Qt::IntersectClip); } else { - newClip.addRect(p->window()); + QRect windowRect = p->transform().inverted().mapRect(p->window()); + newClip.addRect(windowRect); newClip.addPath(clippedOut.intersected(newClip)); p->setClipPath(newClip); } diff --git a/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp b/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp index be54735..8ed0d89 100644 --- a/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp +++ b/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp @@ -59,7 +59,12 @@ public: // (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()); + const QSize maskSize = sourceBoundingRect().toAlignedRect().size(); + if (!maskSize.isValid() || maskSize.isEmpty()) { + drawSource(painter); + return; + } + QPixmap maskPixmap(maskSize); // We need to do this so the pixmap would have hasAlpha(). maskPixmap.fill(Qt::transparent); @@ -334,7 +339,7 @@ const GraphicsLayerQtImpl* GraphicsLayerQtImpl::rootLayer() const QPixmap GraphicsLayerQtImpl::recache(const QRegion& regionToUpdate) { - if (!m_layer->drawsContent()) + if (!m_layer->drawsContent() || m_size.isEmpty() ||!m_size.isValid()) return QPixmap(); QRegion region = regionToUpdate; @@ -361,6 +366,7 @@ QPixmap GraphicsLayerQtImpl::recache(const QRegion& regionToUpdate) // Render the actual contents into the cache painter.setCompositionMode(QPainter::CompositionMode_SourceOver); m_layer->paintGraphicsLayerContents(gc, region.boundingRect()); + painter.end(); m_backingStoreKey = QPixmapCache::insert(pixmap); return pixmap; @@ -665,7 +671,9 @@ void GraphicsLayerQtImpl::flushChanges(bool recursive, bool forceUpdateTransform #ifndef QT_NO_GRAPHICSEFFECT if (m_maskEffect) m_maskEffect.data()->update(); - else if (m_changeMask & DisplayChange) { + else +#endif + if (m_changeMask & DisplayChange) { // Recache now: all the content is ready and we don't want to wait until the paint event. // We only need to do this for HTML content, there's no point in caching directly composited // content like images or solid rectangles. @@ -674,7 +682,6 @@ void GraphicsLayerQtImpl::flushChanges(bool recursive, bool forceUpdateTransform update(m_pendingContent.regionToUpdate.boundingRect()); m_pendingContent.regionToUpdate = QRegion(); } -#endif if ((m_changeMask & BackgroundColorChange) && (m_pendingContent.backgroundColor != m_currentContent.backgroundColor)) diff --git a/WebCore/platform/graphics/qt/ImageBufferQt.cpp b/WebCore/platform/graphics/qt/ImageBufferQt.cpp index bee15f2..e46913c 100644 --- a/WebCore/platform/graphics/qt/ImageBufferQt.cpp +++ b/WebCore/platform/graphics/qt/ImageBufferQt.cpp @@ -276,10 +276,9 @@ void ImageBuffer::putPremultipliedImageData(ImageData* source, const IntRect& so // We get a mimeType here but QImageWriter does not support mimetypes but // only formats (png, gif, jpeg..., xpm). So assume we get image/ as image // mimetypes and then remove the image/ to get the Qt format. -String ImageBuffer::toDataURL(const String& mimeType, double quality) const +String ImageBuffer::toDataURL(const String& mimeType, const double* quality) const { ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); - ASSERT(0.0 <= quality && quality <= 1.0); if (!mimeType.startsWith("image/")) return "data:,"; @@ -289,9 +288,16 @@ String ImageBuffer::toDataURL(const String& mimeType, double quality) const QBuffer buffer(&data); buffer.open(QBuffer::WriteOnly); - if (!m_data.m_pixmap.save(&buffer, mimeType.substring(sizeof "image").utf8().data(), quality * 100 + 0.5)) { - buffer.close(); - return "data:,"; + if (quality && *quality >= 0.0 && *quality <= 1.0) { + if (!m_data.m_pixmap.save(&buffer, mimeType.substring(sizeof "image").utf8().data(), *quality * 100 + 0.5)) { + buffer.close(); + return "data:,"; + } + } else { + if (!m_data.m_pixmap.save(&buffer, mimeType.substring(sizeof "image").utf8().data(), 100)) { + buffer.close(); + return "data:,"; + } } buffer.close(); diff --git a/WebCore/platform/graphics/qt/ImageQt.cpp b/WebCore/platform/graphics/qt/ImageQt.cpp index db12738..0d23738 100644 --- a/WebCore/platform/graphics/qt/ImageQt.cpp +++ b/WebCore/platform/graphics/qt/ImageQt.cpp @@ -187,6 +187,23 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst, if (!image->hasAlpha() && painter->compositionMode() == QPainter::CompositionMode_SourceOver) painter->setCompositionMode(QPainter::CompositionMode_Source); + IntSize shadowSize; + float shadowBlur; + Color shadowColor; + if (ctxt->getShadow(shadowSize, shadowBlur, shadowColor)) { + FloatRect shadowImageRect(dst); + shadowImageRect.move(shadowSize.width(), shadowSize.height()); + + QImage shadowImage(QSize(static_cast<int>(src.width()), static_cast<int>(src.height())), QImage::Format_ARGB32_Premultiplied); + QPainter p(&shadowImage); + p.setCompositionMode(QPainter::CompositionMode_Source); + p.fillRect(shadowImage.rect(), shadowColor); + p.setCompositionMode(QPainter::CompositionMode_DestinationIn); + p.drawPixmap(dst, *image, src); + p.end(); + painter->drawImage(shadowImageRect, shadowImage, src); + } + // Test using example site at // http://www.meyerweb.com/eric/css/edge/complexspiral/demo.html painter->drawPixmap(dst, *image, src); diff --git a/WebCore/platform/graphics/qt/PathQt.cpp b/WebCore/platform/graphics/qt/PathQt.cpp index a7351a0..8f1f912 100644 --- a/WebCore/platform/graphics/qt/PathQt.cpp +++ b/WebCore/platform/graphics/qt/PathQt.cpp @@ -72,6 +72,10 @@ Path& Path::operator=(const Path& other) // Check whether a point is on the border bool isPointOnPathBorder(const QPolygonF& border, const QPointF& p) { + // null border doesn't contain points + if (border.isEmpty()) + return false; + QPointF p1 = border.at(0); QPointF p2; @@ -186,6 +190,15 @@ void Path::addBezierCurveTo(const FloatPoint& cp1, const FloatPoint& cp2, const void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius) { + // Make sure there is a subpath for p1, the behavior depend on the last element of the subpath. + // When the user agent is to ensure there is a subpath for a coordinate (x, y), the user agent must + // check to see if the context has any subpaths, and if it does not, then the user agent must create + // a new subpath with the point (x, y) as its first (and only) point, as if the moveTo() method had been called. + if (!m_path.elementCount()) { + m_path.moveTo(p1); + return; + } + FloatPoint p0(m_path.currentPosition()); if ((p1.x() == p0.x() && p1.y() == p0.y()) || (p1.x() == p2.x() && p1.y() == p2.y()) || radius == 0.f) { @@ -286,22 +299,34 @@ void Path::addArc(const FloatPoint& p, float r, float sar, float ear, bool antic double width = radius*2; double height = radius*2; - if (!anticlockwise && (ea < sa)) - span += 360; - else if (anticlockwise && (sa < ea)) - span -= 360; - - // this is also due to switched coordinate system - // we would end up with a 0 span instead of 360 - if (!(qFuzzyCompare(span + (ea - sa) + 1, 1.0) && - qFuzzyCompare(qAbs(span), 360.0))) { - span += ea - sa; + if ((!anticlockwise && (ea - sa >= 360)) || (anticlockwise && (sa - ea >= 360))) + // If the anticlockwise argument is false and endAngle-startAngle is equal to or greater than 2*PI, or, if the + // anticlockwise argument is true and startAngle-endAngle is equal to or greater than 2*PI, then the arc is the whole + // circumference of this circle. + span = 360; + else { + if (!anticlockwise && (ea < sa)) + span += 360; + else if (anticlockwise && (sa < ea)) + span -= 360; + + // this is also due to switched coordinate system + // we would end up with a 0 span instead of 360 + if (!(qFuzzyCompare(span + (ea - sa) + 1, 1.0) + && qFuzzyCompare(qAbs(span), 360.0))) { + // mod 360 + span += (ea - sa) - (static_cast<int>((ea - sa) / 360)) * 360; + } } // If the path is empty, move to where the arc will start to avoid painting a line from (0,0) // NOTE: QPainterPath::isEmpty() won't work here since it ignores a lone MoveToElement if (!m_path.elementCount()) m_path.arcMoveTo(xs, ys, width, height, sa); + else if (!radius) { + m_path.lineTo(xc, yc); + return; + } m_path.arcTo(xs, ys, width, height, sa, span); @@ -413,7 +438,16 @@ void Path::apply(void* info, PathApplierFunction function) const void Path::transform(const AffineTransform& transform) { - m_path = QTransform(transform).map(m_path); + QTransform qTransform(transform); +#if QT_VERSION < QT_VERSION_CHECK(4, 7, 0) + // Workaround for http://bugreports.qt.nokia.com/browse/QTBUG-11264 + // QTransform.map doesn't handle the MoveTo element because of the isEmpty issue + if (m_path.isEmpty() && m_path.elementCount()) { + QPointF point = qTransform.map(m_path.currentPosition()); + m_path.moveTo(point); + } else +#endif + m_path = qTransform.map(m_path); } } diff --git a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp index 9de21e0..6ef38f0 100644 --- a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp +++ b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp @@ -978,7 +978,7 @@ void GraphicsContext::setPlatformFillPattern(Pattern* pattern) } void GraphicsContext::setPlatformShadow(const IntSize& size, - int blurInt, + float blurFloat, const Color& color, ColorSpace colorSpace) { @@ -986,14 +986,14 @@ void GraphicsContext::setPlatformShadow(const IntSize& size, return; // Detect when there's no effective shadow and clear the looper. - if (!size.width() && !size.height() && !blurInt) { + if (!size.width() && !size.height() && !blurFloat) { platformContext()->setDrawLooper(0); return; } double width = size.width(); double height = size.height(); - double blur = blurInt; + double blur = blurFloat; // TODO(tc): This still does not address the issue that shadows // within canvas elements should ignore transforms. diff --git a/WebCore/platform/graphics/skia/ImageBufferSkia.cpp b/WebCore/platform/graphics/skia/ImageBufferSkia.cpp index 1b03694..912fd12 100644 --- a/WebCore/platform/graphics/skia/ImageBufferSkia.cpp +++ b/WebCore/platform/graphics/skia/ImageBufferSkia.cpp @@ -261,7 +261,7 @@ void ImageBuffer::putPremultipliedImageData(ImageData* source, const IntRect& so putImageData<Premultiplied>(source, sourceRect, destPoint, *context()->platformContext()->bitmap(), m_size); } -String ImageBuffer::toDataURL(const String&, double) const +String ImageBuffer::toDataURL(const String&, const double*) const { // Encode the image into a vector. Vector<unsigned char> pngEncodedData; diff --git a/WebCore/platform/graphics/skia/ImageSkia.cpp b/WebCore/platform/graphics/skia/ImageSkia.cpp index d1fb647..d1d1692 100644 --- a/WebCore/platform/graphics/skia/ImageSkia.cpp +++ b/WebCore/platform/graphics/skia/ImageSkia.cpp @@ -66,6 +66,16 @@ enum ResamplingMode { static ResamplingMode computeResamplingMode(PlatformContextSkia* platformContext, const NativeImageSkia& bitmap, int srcWidth, int srcHeight, float destWidth, float destHeight) { + if (platformContext->hasImageResamplingHint()) { + IntSize srcSize; + FloatSize dstSize; + platformContext->getImageResamplingHint(&srcSize, &dstSize); + srcWidth = srcSize.width(); + srcHeight = srcSize.height(); + destWidth = dstSize.width(); + destHeight = dstSize.height(); + } + int destIWidth = static_cast<int>(destWidth); int destIHeight = static_cast<int>(destHeight); @@ -188,7 +198,7 @@ static void drawResampledBitmap(SkCanvas& canvas, SkPaint& paint, const NativeIm if (!destBitmapSubsetSkI.intersect(resizedImageRect)) return; // Resized image does not intersect. - if (srcIsFull || bitmap.shouldCacheResampling( + if (srcIsFull && bitmap.shouldCacheResampling( resizedImageRect.width(), resizedImageRect.height(), destBitmapSubsetSkI.width(), diff --git a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp b/WebCore/platform/graphics/skia/PlatformContextSkia.cpp index 7ec403c..15bd9b4 100644 --- a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp +++ b/WebCore/platform/graphics/skia/PlatformContextSkia.cpp @@ -101,6 +101,7 @@ struct PlatformContextSkia::State { WTF::Vector<SkPath> m_antiAliasClipPaths; WebCore::InterpolationQuality m_interpolationQuality; + PlatformContextSkia::State cloneInheritedProperties(); private: // Not supported. void operator=(const State&); @@ -149,6 +150,7 @@ PlatformContextSkia::State::State(const State& other) , m_imageBufferClip(other.m_imageBufferClip) , m_clip(other.m_clip) #endif + , m_antiAliasClipPaths(other.m_antiAliasClipPaths) , m_interpolationQuality(other.m_interpolationQuality) { // Up the ref count of these. saveRef does nothing if 'this' is NULL. @@ -166,6 +168,17 @@ PlatformContextSkia::State::~State() m_strokeShader->safeUnref(); } +// Returns a new State with all of this object's inherited properties copied. +PlatformContextSkia::State PlatformContextSkia::State::cloneInheritedProperties() +{ + PlatformContextSkia::State state(*this); + + // Everything is inherited except for the clip paths. + state.m_antiAliasClipPaths.clear(); + + return state; +} + SkColor PlatformContextSkia::State::applyAlpha(SkColor c) const { int s = roundf(m_alpha * 256); @@ -214,7 +227,9 @@ bool PlatformContextSkia::isDrawingToImageBuffer() const void PlatformContextSkia::save() { - m_stateStack.append(*m_state); + ASSERT(!hasImageResamplingHint()); + + m_stateStack.append(m_state->cloneInheritedProperties()); m_state = &m_stateStack.last(); #if OS(LINUX) || OS(WINDOWS) @@ -576,6 +591,29 @@ bool PlatformContextSkia::isPrinting() return m_canvas->getTopPlatformDevice().IsVectorial(); } +void PlatformContextSkia::getImageResamplingHint(WebCore::IntSize* srcSize, WebCore::FloatSize* dstSize) const +{ + *srcSize = m_imageResamplingHintSrcSize; + *dstSize = m_imageResamplingHintDstSize; +} + +void PlatformContextSkia::setImageResamplingHint(const WebCore::IntSize& srcSize, const WebCore::FloatSize& dstSize) +{ + m_imageResamplingHintSrcSize = srcSize; + m_imageResamplingHintDstSize = dstSize; +} + +void PlatformContextSkia::clearImageResamplingHint() +{ + m_imageResamplingHintSrcSize = WebCore::IntSize(); + m_imageResamplingHintDstSize = WebCore::FloatSize(); +} + +bool PlatformContextSkia::hasImageResamplingHint() const +{ + return !m_imageResamplingHintSrcSize.isEmpty() && !m_imageResamplingHintDstSize.isEmpty(); +} + #if OS(LINUX) || OS(WINDOWS) void PlatformContextSkia::applyClipFromImage(const WebCore::FloatRect& rect, const SkBitmap& imageBuffer) { diff --git a/WebCore/platform/graphics/skia/PlatformContextSkia.h b/WebCore/platform/graphics/skia/PlatformContextSkia.h index 2f24646..88a8ec7 100644 --- a/WebCore/platform/graphics/skia/PlatformContextSkia.h +++ b/WebCore/platform/graphics/skia/PlatformContextSkia.h @@ -170,6 +170,11 @@ public: // possible quality. bool isPrinting(); + void getImageResamplingHint(WebCore::IntSize* srcSize, WebCore::FloatSize* dstSize) const; + void setImageResamplingHint(const WebCore::IntSize& srcSize, const WebCore::FloatSize& dstSize); + void clearImageResamplingHint(); + bool hasImageResamplingHint() const; + private: #if OS(LINUX) || OS(WINDOWS) // Used when restoring and the state has an image clip. Only shows the pixels in @@ -194,6 +199,10 @@ private: // Current path in global coordinates. SkPath m_path; + // Stores image sizes for a hint to compute image resampling modes. + // Values are used in ImageSkia.cpp + WebCore::IntSize m_imageResamplingHintSrcSize; + WebCore::FloatSize m_imageResamplingHintDstSize; #if OS(WINDOWS) bool m_drawingToImageBuffer; #endif diff --git a/WebCore/platform/graphics/skia/SkiaFontWin.cpp b/WebCore/platform/graphics/skia/SkiaFontWin.cpp index 4abf914..e0d2840 100644 --- a/WebCore/platform/graphics/skia/SkiaFontWin.cpp +++ b/WebCore/platform/graphics/skia/SkiaFontWin.cpp @@ -223,7 +223,7 @@ void SkiaWinOutlineCache::removePathsForFont(HFONT hfont) bool windowsCanHandleDrawTextShadow(WebCore::GraphicsContext *context) { IntSize shadowSize; - int shadowBlur; + float shadowBlur; Color shadowColor; bool hasShadow = context->getShadow(shadowSize, shadowBlur, shadowColor); diff --git a/WebCore/platform/graphics/win/FontCGWin.cpp b/WebCore/platform/graphics/win/FontCGWin.cpp index e4eb159..83178f3 100644 --- a/WebCore/platform/graphics/win/FontCGWin.cpp +++ b/WebCore/platform/graphics/win/FontCGWin.cpp @@ -141,7 +141,7 @@ static void drawGDIGlyphs(GraphicsContext* graphicsContext, const SimpleFontData drawIntoBitmap = fillColor.alpha() != 255 || graphicsContext->inTransparencyLayer(); if (!drawIntoBitmap) { IntSize size; - int blur; + float blur; Color color; graphicsContext->getShadow(size, blur, color); drawIntoBitmap = !size.isEmpty() || blur; @@ -350,7 +350,7 @@ void Font::drawGlyphs(GraphicsContext* graphicsContext, const SimpleFontData* fo wkSetCGContextFontRenderingStyle(cgContext, font->isSystemFont(), false, font->platformData().useGDI()); IntSize shadowSize; - int shadowBlur; + float shadowBlur; Color shadowColor; graphicsContext->getShadow(shadowSize, shadowBlur, shadowColor); diff --git a/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp b/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp index c6be087..2ca1a96 100644 --- a/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp +++ b/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp @@ -10,7 +10,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS “AS IS” + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS diff --git a/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h b/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h index d42f7f3..0a43a69 100644 --- a/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h +++ b/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h @@ -10,7 +10,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS “AS IS” + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS diff --git a/WebCore/platform/graphics/win/QTCFDictionary.cpp b/WebCore/platform/graphics/win/QTCFDictionary.cpp index ada1500..3c72792 100644 --- a/WebCore/platform/graphics/win/QTCFDictionary.cpp +++ b/WebCore/platform/graphics/win/QTCFDictionary.cpp @@ -52,9 +52,10 @@ CFDictionaryRef QTCFDictionaryCreateCopyWithDataCallback(CFAllocatorRef allocato ASSERT(callback); CFDataRef data = QTCFPropertyListCreateXMLData(kCFAllocatorDefault, dictionary); + if (!data) + return 0; CFDictionaryRef outputDictionary = callback(allocator, CFDataGetBytePtr(data), CFDataGetLength(data)); - if (data) - CFRelease(data); + CFRelease(data); return outputDictionary; } diff --git a/WebCore/platform/graphics/win/WKCAImageQueue.cpp b/WebCore/platform/graphics/win/WKCAImageQueue.cpp index b52b9a4..c2a178b 100644 --- a/WebCore/platform/graphics/win/WKCAImageQueue.cpp +++ b/WebCore/platform/graphics/win/WKCAImageQueue.cpp @@ -10,7 +10,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS “AS IS” + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS diff --git a/WebCore/platform/graphics/win/WKCAImageQueue.h b/WebCore/platform/graphics/win/WKCAImageQueue.h index 5c17575..3d25b48 100644 --- a/WebCore/platform/graphics/win/WKCAImageQueue.h +++ b/WebCore/platform/graphics/win/WKCAImageQueue.h @@ -10,7 +10,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS “AS IS” + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS diff --git a/WebCore/platform/graphics/wince/GraphicsContextWince.cpp b/WebCore/platform/graphics/wince/GraphicsContextWince.cpp index a7bb695..5896f90 100644 --- a/WebCore/platform/graphics/wince/GraphicsContextWince.cpp +++ b/WebCore/platform/graphics/wince/GraphicsContextWince.cpp @@ -1250,7 +1250,7 @@ void GraphicsContext::fillRoundedRect(const IntRect& fillRect, const IntSize& to return; IntSize shadowSize; - int shadowBlur = 0; + float shadowBlur = 0; Color shadowColor; getShadow(shadowSize, shadowBlur, shadowColor); @@ -1550,7 +1550,7 @@ void GraphicsContext::fillRect(const FloatRect& rect) fillRect(rect, fillColor(), DeviceColorSpace); } -void GraphicsContext::setPlatformShadow(const IntSize&, int, const Color&, ColorSpace) +void GraphicsContext::setPlatformShadow(const IntSize&, float, const Color&, ColorSpace) { notImplemented(); } @@ -1673,7 +1673,7 @@ void GraphicsContext::drawText(const SimpleFontData* fontData, const GlyphBuffer } IntSize shadowSize; - int shadowBlur = 0; + float shadowBlur = 0; Color shadowColor; bool hasShadow = textDrawingMode() == cTextFill && getShadow(shadowSize, shadowBlur, shadowColor) diff --git a/WebCore/platform/graphics/wince/ImageBufferWince.cpp b/WebCore/platform/graphics/wince/ImageBufferWince.cpp index 0d5c8dd..4b739c8 100644 --- a/WebCore/platform/graphics/wince/ImageBufferWince.cpp +++ b/WebCore/platform/graphics/wince/ImageBufferWince.cpp @@ -216,7 +216,7 @@ void ImageBuffer::putPremultipliedImageData(ImageData* source, const IntRect& so putImageData<true>(source, sourceRect, destPoint, m_data.m_bitmap.get()); } -String ImageBuffer::toDataURL(const String& mimeType, double) const +String ImageBuffer::toDataURL(const String& mimeType, const double*) const { if (!m_data.m_bitmap->bytes()) return "data:,"; diff --git a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp index 2298d6a..127bf07 100644 --- a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp +++ b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp @@ -554,7 +554,7 @@ void GraphicsContext::fillRect(const FloatRect& rect) return; } -void GraphicsContext::setPlatformShadow(IntSize const&,int,Color const&, ColorSpace) +void GraphicsContext::setPlatformShadow(IntSize const&, float, Color const&, ColorSpace) { notImplemented(); } diff --git a/WebCore/platform/graphics/wx/ImageBufferWx.cpp b/WebCore/platform/graphics/wx/ImageBufferWx.cpp index 1d37dfa..775e018 100644 --- a/WebCore/platform/graphics/wx/ImageBufferWx.cpp +++ b/WebCore/platform/graphics/wx/ImageBufferWx.cpp @@ -76,7 +76,7 @@ void ImageBuffer::putPremultipliedImageData(ImageData* source, const IntRect& so notImplemented(); } -String ImageBuffer::toDataURL(const String&, double) const +String ImageBuffer::toDataURL(const String&, const double*) const { notImplemented(); return String(); diff --git a/WebCore/platform/gtk/CursorGtk.cpp b/WebCore/platform/gtk/CursorGtk.cpp index 705c2ae..017e486 100644 --- a/WebCore/platform/gtk/CursorGtk.cpp +++ b/WebCore/platform/gtk/CursorGtk.cpp @@ -65,8 +65,9 @@ Cursor::Cursor(const Cursor& other) Cursor::Cursor(Image* image, const IntPoint& hotSpot) { + IntPoint effectiveHotSpot = determineHotSpot(image, hotSpot); GdkPixbuf* pixbuf = image->getGdkPixbuf(); - m_impl = gdk_cursor_new_from_pixbuf(gdk_display_get_default(), pixbuf, hotSpot.x(), hotSpot.y()); + m_impl = gdk_cursor_new_from_pixbuf(gdk_display_get_default(), pixbuf, effectiveHotSpot.x(), effectiveHotSpot.y()); g_object_unref(pixbuf); } diff --git a/WebCore/platform/gtk/DragDataGtk.cpp b/WebCore/platform/gtk/DragDataGtk.cpp index 69b3161..4ed3bc1 100644 --- a/WebCore/platform/gtk/DragDataGtk.cpp +++ b/WebCore/platform/gtk/DragDataGtk.cpp @@ -67,12 +67,12 @@ bool DragData::containsCompatibleContent() const return false; } -bool DragData::containsURL() const +bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const { return false; } -String DragData::asURL(String* title) const +String DragData::asURL(FilenameConversionPolicy filenamePolicy, String* title) const { return String(); } diff --git a/WebCore/platform/gtk/FileChooserGtk.cpp b/WebCore/platform/gtk/FileChooserGtk.cpp index 3ff06f0..4600215 100644 --- a/WebCore/platform/gtk/FileChooserGtk.cpp +++ b/WebCore/platform/gtk/FileChooserGtk.cpp @@ -57,9 +57,8 @@ String FileChooser::basenameForWidth(const Font& font, int width) const String string = fileButtonNoFileSelectedLabel(); if (m_filenames.size() == 1) { - gchar* systemFilename = filenameFromString(m_filenames[0]); - gchar* systemBasename = g_path_get_basename(systemFilename); - g_free(systemFilename); + CString systemFilename = fileSystemRepresentation(m_filenames[0]); + gchar* systemBasename = g_path_get_basename(systemFilename.data()); stringByAdoptingFileSystemRepresentation(systemBasename, string); } else if (m_filenames.size() > 1) return StringTruncator::rightTruncate(multipleFileUploadText(m_filenames.size()), width, font, false); diff --git a/WebCore/platform/gtk/FileSystemGtk.cpp b/WebCore/platform/gtk/FileSystemGtk.cpp index ddcf0aa..401bd4a 100644 --- a/WebCore/platform/gtk/FileSystemGtk.cpp +++ b/WebCore/platform/gtk/FileSystemGtk.cpp @@ -52,12 +52,15 @@ String filenameToString(const char* filename) #endif } -char* filenameFromString(const String& string) +CString fileSystemRepresentation(const String& path) { #if OS(WINDOWS) - return g_strdup(string.utf8().data()); + return path.utf8(); #else - return g_uri_unescape_string(string.utf8().data(), 0); + char* filename = g_uri_unescape_string(path.utf8().data(), 0); + CString cfilename(filename); + g_free(filename); + return cfilename; #endif } @@ -67,9 +70,8 @@ String filenameForDisplay(const String& string) #if OS(WINDOWS) return string; #else - gchar* filename = filenameFromString(string); - gchar* display = g_filename_to_utf8(filename, 0, 0, 0, 0); - g_free(filename); + CString filename = fileSystemRepresentation(string); + gchar* display = g_filename_to_utf8(filename.data(), 0, 0, 0, 0); if (!display) return string; @@ -83,12 +85,10 @@ String filenameForDisplay(const String& string) bool fileExists(const String& path) { bool result = false; - gchar* filename = filenameFromString(path); + CString filename = fileSystemRepresentation(path); - if (filename) { - result = g_file_test(filename, G_FILE_TEST_EXISTS); - g_free(filename); - } + if (!filename.isNull()) + result = g_file_test(filename.data(), G_FILE_TEST_EXISTS); return result; } @@ -96,12 +96,10 @@ bool fileExists(const String& path) bool deleteFile(const String& path) { bool result = false; - gchar* filename = filenameFromString(path); + CString filename = fileSystemRepresentation(path); - if (filename) { - result = g_remove(filename) == 0; - g_free(filename); - } + if (!filename.isNull()) + result = g_remove(filename.data()) == 0; return result; } @@ -109,25 +107,22 @@ bool deleteFile(const String& path) bool deleteEmptyDirectory(const String& path) { bool result = false; - gchar* filename = filenameFromString(path); + CString filename = fileSystemRepresentation(path); - if (filename) { - result = g_rmdir(filename) == 0; - g_free(filename); - } + if (!filename.isNull()) + result = g_rmdir(filename.data()) == 0; return result; } bool getFileSize(const String& path, long long& resultSize) { - gchar* filename = filenameFromString(path); - if (!filename) + CString filename = fileSystemRepresentation(path); + if (filename.isNull()) return false; struct stat statResult; - gint result = g_stat(filename, &statResult); - g_free(filename); + gint result = g_stat(filename.data(), &statResult); if (result != 0) return false; @@ -137,13 +132,12 @@ bool getFileSize(const String& path, long long& resultSize) bool getFileModificationTime(const String& path, time_t& modifiedTime) { - gchar* filename = filenameFromString(path); - if (!filename) + CString filename = fileSystemRepresentation(path); + if (filename.isNull()) return false; struct stat statResult; - gint result = g_stat(filename, &statResult); - g_free(filename); + gint result = g_stat(filename.data(), &statResult); if (result != 0) return false; @@ -162,12 +156,11 @@ String pathByAppendingComponent(const String& path, const String& component) bool makeAllDirectories(const String& path) { - gchar* filename = filenameFromString(path); - if (!filename) + CString filename = fileSystemRepresentation(path); + if (filename.isNull()) return false; - gint result = g_mkdir_with_parents(filename, S_IRWXU); - g_free(filename); + gint result = g_mkdir_with_parents(filename.data(), S_IRWXU); return result == 0; } @@ -182,11 +175,10 @@ String pathGetFileName(const String& pathName) if (pathName.isEmpty()) return pathName; - char* tmpFilename = filenameFromString(pathName); - char* baseName = g_path_get_basename(tmpFilename); + CString tmpFilename = fileSystemRepresentation(pathName); + char* baseName = g_path_get_basename(tmpFilename.data()); String fileName = String::fromUTF8(baseName); g_free(baseName); - g_free(tmpFilename); return fileName; } @@ -194,7 +186,7 @@ String pathGetFileName(const String& pathName) String directoryName(const String& path) { /* No null checking needed */ - GOwnPtr<char> tmpFilename(filenameFromString(path)); + GOwnPtr<char> tmpFilename(const_cast<char*>(fileSystemRepresentation(path).data())); GOwnPtr<char> dirname(g_path_get_dirname(tmpFilename.get())); return String::fromUTF8(dirname.get()); } @@ -203,8 +195,8 @@ Vector<String> listDirectory(const String& path, const String& filter) { Vector<String> entries; - gchar* filename = filenameFromString(path); - GDir* dir = g_dir_open(filename, 0, 0); + CString filename = fileSystemRepresentation(path); + GDir* dir = g_dir_open(filename.data(), 0, 0); if (!dir) return entries; @@ -213,12 +205,11 @@ Vector<String> listDirectory(const String& path, const String& filter) if (!g_pattern_match_string(pspec, name)) continue; - gchar* entry = g_build_filename(filename, name, NULL); - entries.append(filenameToString(entry)); - g_free(entry); + GOwnPtr<gchar> entry(g_build_filename(filename.data(), name, NULL)); + entries.append(filenameToString(entry.get())); } + g_pattern_spec_free(pspec); g_dir_close(dir); - g_free(filename); return entries; } diff --git a/WebCore/platform/gtk/GOwnPtrGtk.cpp b/WebCore/platform/gtk/GOwnPtrGtk.cpp new file mode 100644 index 0000000..0558f33 --- /dev/null +++ b/WebCore/platform/gtk/GOwnPtrGtk.cpp @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2010 Igalia S.L. + * + * 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 "GOwnPtrGtk.h" + +#include <gdk/gdk.h> +#include <glib.h> + +namespace WTF { + +template <> void freeOwnedGPtr<GdkEvent>(GdkEvent* ptr) +{ + if (ptr) + gdk_event_free(ptr); +} + +} diff --git a/WebCore/platform/gtk/GOwnPtrGtk.h b/WebCore/platform/gtk/GOwnPtrGtk.h new file mode 100644 index 0000000..674ea58 --- /dev/null +++ b/WebCore/platform/gtk/GOwnPtrGtk.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2010 Igalia S.L. + * + * 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 GOwnPtrGtk_h +#define GOwnPtrGtk_h + +#include "GOwnPtr.h" + +typedef union _GdkEvent GdkEvent; + +namespace WTF { + +template<> void freeOwnedGPtr<GdkEvent>(GdkEvent*); + +} + +#endif diff --git a/WebCore/platform/gtk/GtkPluginWidget.cpp b/WebCore/platform/gtk/GtkPluginWidget.cpp index 67bf4b1..94382f1 100644 --- a/WebCore/platform/gtk/GtkPluginWidget.cpp +++ b/WebCore/platform/gtk/GtkPluginWidget.cpp @@ -47,7 +47,7 @@ void GtkPluginWidget::invalidateRect(const IntRect& _rect) if (!gtk_widget_get_has_window(platformWidget())) return; - GdkWindow* window = platformWidget()->window; + GdkWindow* window = gtk_widget_get_window(platformWidget()); if (!window) return; diff --git a/WebCore/platform/gtk/GtkVersioning.h b/WebCore/platform/gtk/GtkVersioning.h index fc92d8b..cdd679c 100644 --- a/WebCore/platform/gtk/GtkVersioning.h +++ b/WebCore/platform/gtk/GtkVersioning.h @@ -31,4 +31,8 @@ #define gtk_widget_is_sensitive(widget) GTK_WIDGET_IS_SENSITIVE(widget) #endif // GTK_CHECK_VERSION(2, 19, 0) +#if !GTK_CHECK_VERSION(2, 14, 0) +#define gtk_widget_get_window(widget) (widget)->window +#endif + #endif // GtkVersioning_h diff --git a/WebCore/platform/gtk/PlatformScreenGtk.cpp b/WebCore/platform/gtk/PlatformScreenGtk.cpp index 9341714..0ab00a1 100644 --- a/WebCore/platform/gtk/PlatformScreenGtk.cpp +++ b/WebCore/platform/gtk/PlatformScreenGtk.cpp @@ -64,7 +64,7 @@ static GdkVisual* getVisual(Widget* widget) } - return gdk_drawable_get_visual(GDK_DRAWABLE(container->window)); + return gdk_drawable_get_visual(GDK_DRAWABLE(gtk_widget_get_window(container))); } int screenDepth(Widget* widget) @@ -102,7 +102,7 @@ FloatRect screenRect(Widget* widget) if (!screen) return FloatRect(); - gint monitor = gdk_screen_get_monitor_at_window(screen, GTK_WIDGET(container)->window); + gint monitor = gdk_screen_get_monitor_at_window(screen, gtk_widget_get_window(GTK_WIDGET(container))); GdkRectangle geometry; gdk_screen_get_monitor_geometry(screen, monitor, &geometry); diff --git a/WebCore/platform/gtk/PopupMenuGtk.cpp b/WebCore/platform/gtk/PopupMenuGtk.cpp index 1620b3b..f29d51b 100644 --- a/WebCore/platform/gtk/PopupMenuGtk.cpp +++ b/WebCore/platform/gtk/PopupMenuGtk.cpp @@ -26,6 +26,7 @@ #include "PopupMenu.h" #include "FrameView.h" +#include "GtkVersioning.h" #include "HostWindow.h" #include "PlatformString.h" #include <wtf/text/CString.h> @@ -57,7 +58,7 @@ void PopupMenu::show(const IntRect& rect, FrameView* view, int index) gtk_container_foreach(GTK_CONTAINER(m_popup.get()), reinterpret_cast<GtkCallback>(menuRemoveItem), this); int x, y; - gdk_window_get_origin(GTK_WIDGET(view->hostWindow()->platformPageClient())->window, &x, &y); + gdk_window_get_origin(gtk_widget_get_window(GTK_WIDGET(view->hostWindow()->platformPageClient())), &x, &y); m_menuPosition = view->contentsToWindow(rect.location()); m_menuPosition = IntPoint(m_menuPosition.x() + x, m_menuPosition.y() + y + rect.height()); m_indexMap.clear(); diff --git a/WebCore/platform/gtk/RenderThemeGtk.cpp b/WebCore/platform/gtk/RenderThemeGtk.cpp index c572e77..6205dbd 100644 --- a/WebCore/platform/gtk/RenderThemeGtk.cpp +++ b/WebCore/platform/gtk/RenderThemeGtk.cpp @@ -99,7 +99,7 @@ void RenderThemeGtk::initMediaStyling(GtkStyle* style, bool force) m_muteButton = Image::loadPlatformThemeIcon("audio-volume-high", m_mediaIconSize); m_unmuteButton = Image::loadPlatformThemeIcon("audio-volume-muted", m_mediaIconSize); m_playButton = Image::loadPlatformThemeIcon(reinterpret_cast<const char*>(playButtonIconName), m_mediaIconSize); - m_pauseButton = Image::loadPlatformThemeIcon("gtk-media-pause", m_mediaIconSize).releaseRef(); + m_pauseButton = Image::loadPlatformThemeIcon("gtk-media-pause", m_mediaIconSize); m_seekBackButton = Image::loadPlatformThemeIcon(reinterpret_cast<const char*>(seekBackButtonIconName), m_mediaIconSize); m_seekForwardButton = Image::loadPlatformThemeIcon(reinterpret_cast<const char*>(seekForwardButtonIconName), m_mediaIconSize); @@ -179,6 +179,8 @@ RenderThemeGtk::~RenderThemeGtk() for (guint i = 0; i < g_list_length(values); i++) moz_gtk_destroy_theme_parts_widgets( static_cast<GtkThemeParts*>(g_list_nth_data(values, i))); + + gtk_widget_destroy(m_gtkWindow); } GtkThemeParts* RenderThemeGtk::partsForDrawable(GdkDrawable* drawable) const @@ -211,6 +213,8 @@ static bool supportsFocus(ControlPart appearance) case MenulistPart: case RadioPart: case CheckboxPart: + case SliderHorizontalPart: + case SliderVerticalPart: return true; default: return false; @@ -273,7 +277,7 @@ static void adjustMozillaStyle(const RenderThemeGtk* theme, RenderStyle* style, style->setPaddingBottom(Length(ypadding + bottom, Fixed)); } -static void setMozillaState(const RenderTheme* theme, GtkWidgetState* state, RenderObject* o) +static void setMozillaState(const RenderTheme* theme, GtkThemeWidgetType type, RenderObject* o, GtkWidgetState* state) { state->active = theme->isPressed(o); state->focused = theme->isFocused(o); @@ -282,7 +286,15 @@ static void setMozillaState(const RenderTheme* theme, GtkWidgetState* state, Ren state->disabled = !theme->isEnabled(o) || theme->isReadOnlyControl(o); state->isDefault = false; state->canDefault = false; - state->depressed = false; + + + // FIXME: The depressed value should probably apply for other theme parts too. + // It must be used for range thumbs, because otherwise when the thumb is pressed, + // the rendering is incorrect. + if (type == MOZ_GTK_SCALE_THUMB_HORIZONTAL || type == MOZ_GTK_SCALE_THUMB_VERTICAL) + state->depressed = theme->isPressed(o); + else + state->depressed = false; } static bool paintMozillaGtkWidget(const RenderThemeGtk* theme, GtkThemeWidgetType type, RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect) @@ -299,7 +311,7 @@ static bool paintMozillaGtkWidget(const RenderThemeGtk* theme, GtkThemeWidgetTyp pixmap = adoptGRef(gdk_pixmap_new(0, rect.width(), rect.height(), gdk_visual_get_system()->depth)); GtkWidgetState mozState; - setMozillaState(theme, &mozState, o); + setMozillaState(theme, type, o, &mozState); int flags; @@ -528,14 +540,55 @@ bool RenderThemeGtk::paintSearchField(RenderObject* o, const RenderObject::Paint return paintTextField(o, i, rect); } +bool RenderThemeGtk::paintSliderTrack(RenderObject* object, const RenderObject::PaintInfo& info, const IntRect& rect) +{ + ControlPart part = object->style()->appearance(); + ASSERT(part == SliderHorizontalPart || part == SliderVerticalPart); + + GtkThemeWidgetType gtkPart = MOZ_GTK_SCALE_HORIZONTAL; + if (part == SliderVerticalPart) + gtkPart = MOZ_GTK_SCALE_VERTICAL; + + return paintMozillaGtkWidget(this, gtkPart, object, info, rect); +} + +void RenderThemeGtk::adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle* style, Element*) const +{ + style->setBoxShadow(0); +} + +bool RenderThemeGtk::paintSliderThumb(RenderObject* object, const RenderObject::PaintInfo& info, const IntRect& rect) +{ + ControlPart part = object->style()->appearance(); + ASSERT(part == SliderThumbHorizontalPart || part == SliderThumbVerticalPart); + + GtkThemeWidgetType gtkPart = MOZ_GTK_SCALE_THUMB_HORIZONTAL; + if (part == SliderThumbVerticalPart) + gtkPart = MOZ_GTK_SCALE_THUMB_VERTICAL; + + return paintMozillaGtkWidget(this, gtkPart, object, info, rect); +} + +void RenderThemeGtk::adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle* style, Element*) const +{ + style->setBoxShadow(0); +} + void RenderThemeGtk::adjustSliderThumbSize(RenderObject* o) const { + ControlPart part = o->style()->appearance(); #if ENABLE(VIDEO) - if (o->style()->appearance() == MediaSliderThumbPart) { + if (part == MediaSliderThumbPart) { o->style()->setWidth(Length(m_mediaSliderThumbWidth, Fixed)); o->style()->setHeight(Length(m_mediaSliderThumbHeight, Fixed)); - } + } else #endif + if (part == SliderThumbHorizontalPart || part == SliderThumbVerticalPart) { + gint width, height; + moz_gtk_get_scalethumb_metrics(part == SliderThumbHorizontalPart ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, &width, &height); + o->style()->setWidth(Length(width, Fixed)); + o->style()->setHeight(Length(height, Fixed)); + } } Color RenderThemeGtk::platformActiveSelectionBackgroundColor() const diff --git a/WebCore/platform/gtk/RenderThemeGtk.h b/WebCore/platform/gtk/RenderThemeGtk.h index b62b41c..41b518e 100644 --- a/WebCore/platform/gtk/RenderThemeGtk.h +++ b/WebCore/platform/gtk/RenderThemeGtk.h @@ -122,7 +122,13 @@ protected: virtual void adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; virtual bool paintSearchFieldCancelButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual void adjustSliderThumbSize(RenderObject*) const; + virtual bool paintSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual void adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle*, Element*) const; + + virtual bool paintSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual void adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle*, Element*) const; + + virtual void adjustSliderThumbSize(RenderObject* object) const; #if ENABLE(VIDEO) virtual void initMediaStyling(GtkStyle* style, bool force); diff --git a/WebCore/platform/gtk/SharedBufferGtk.cpp b/WebCore/platform/gtk/SharedBufferGtk.cpp index db04d80..c7040f2 100644 --- a/WebCore/platform/gtk/SharedBufferGtk.cpp +++ b/WebCore/platform/gtk/SharedBufferGtk.cpp @@ -32,19 +32,17 @@ PassRefPtr<SharedBuffer> SharedBuffer::createWithContentsOfFile(const String& fi if (filePath.isEmpty()) return 0; - gchar* filename = filenameFromString(filePath); + CString filename = fileSystemRepresentation(filePath); gchar* contents; gsize size; GError* error = 0; - if (!g_file_get_contents(filename, &contents, &size, &error)) { + if (!g_file_get_contents(filename.data(), &contents, &size, &error)) { LOG_ERROR("Failed to fully read contents of file %s - %s", filenameForDisplay(filePath).utf8().data(), error->message); g_error_free(error); - g_free(filename); return 0; } RefPtr<SharedBuffer> result = SharedBuffer::create(contents, size); - g_free(filename); g_free(contents); return result.release(); diff --git a/WebCore/platform/gtk/WidgetGtk.cpp b/WebCore/platform/gtk/WidgetGtk.cpp index 71addfd..c2c11bd 100644 --- a/WebCore/platform/gtk/WidgetGtk.cpp +++ b/WebCore/platform/gtk/WidgetGtk.cpp @@ -31,6 +31,7 @@ #include "Cursor.h" #include "FrameView.h" #include "GraphicsContext.h" +#include "GtkVersioning.h" #include "HostWindow.h" #include "IntRect.h" #include "RenderObject.h" @@ -61,7 +62,7 @@ void Widget::setFocus(bool focused) static GdkDrawable* gdkDrawable(PlatformWidget widget) { - return widget ? widget->window : 0; + return widget ? gtk_widget_get_window(widget) : 0; } void Widget::setCursor(const Cursor& cursor) @@ -77,7 +78,7 @@ void Widget::setCursor(const Cursor& cursor) if (platformCursor == lastSetCursor) return; - gdk_window_set_cursor(gdkDrawable(platformWidget()) ? GDK_WINDOW(gdkDrawable(platformWidget())) : GTK_WIDGET(root()->hostWindow()->platformPageClient())->window, platformCursor); + gdk_window_set_cursor(gdkDrawable(platformWidget()) ? GDK_WINDOW(gdkDrawable(platformWidget())) : gtk_widget_get_window(GTK_WIDGET(root()->hostWindow()->platformPageClient())), platformCursor); lastSetCursor = platformCursor; } diff --git a/WebCore/platform/haiku/DragDataHaiku.cpp b/WebCore/platform/haiku/DragDataHaiku.cpp index 4a20147..7f40b8a 100644 --- a/WebCore/platform/haiku/DragDataHaiku.cpp +++ b/WebCore/platform/haiku/DragDataHaiku.cpp @@ -86,13 +86,13 @@ bool DragData::containsCompatibleContent() const return containsColor() || containsURL() || containsPlainText(); } -bool DragData::containsURL() const +bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const { notImplemented(); return false; } -String DragData::asURL(String* title) const +String DragData::asURL(FilenameConversionPolicy filenamePolicy, String* title) const { notImplemented(); return String(); diff --git a/WebCore/platform/haiku/SharedBufferHaiku.cpp b/WebCore/platform/haiku/SharedBufferHaiku.cpp index abe9e2d..5bab562 100644 --- a/WebCore/platform/haiku/SharedBufferHaiku.cpp +++ b/WebCore/platform/haiku/SharedBufferHaiku.cpp @@ -40,17 +40,12 @@ PassRefPtr<SharedBuffer> SharedBuffer::createWithContentsOfFile(const String& fi if (file.InitCheck() != B_OK) return 0; - RefPtr<SharedBuffer> result = SharedBuffer::create(); - off_t size; file.GetSize(&size); - result->m_buffer.resize(size); - if (result->m_buffer.size() != size) - return 0; - result->m_size = size; - file.Read(result->m_buffer.data(), result->m_buffer.size()); - return result.release(); + Vector<char> buffer(size); + file.Read(buffer.data(), buffer.size()); + return SharedBuffer::adoptVector(buffer); } } // namespace WebCore diff --git a/WebCore/platform/mac/CursorMac.mm b/WebCore/platform/mac/CursorMac.mm index c28f149..8cd54a1 100644 --- a/WebCore/platform/mac/CursorMac.mm +++ b/WebCore/platform/mac/CursorMac.mm @@ -43,14 +43,14 @@ namespace WebCore { // Simple NSCursor calls shouldn't need protection, // but creating a cursor with a bad image might throw. -static NSCursor* createCustomCursor(Image* image, const IntPoint& hotspot) +static NSCursor* createCustomCursor(Image* image, const IntPoint& hotSpot) { // FIXME: The cursor won't animate. Not sure if that's a big deal. NSImage* img = image->getNSImage(); if (!img) return 0; BEGIN_BLOCK_OBJC_EXCEPTIONS; - return [[NSCursor alloc] initWithImage:img hotSpot:hotspot]; + return [[NSCursor alloc] initWithImage:img hotSpot:determineHotSpot(image, hotSpot)]; END_BLOCK_OBJC_EXCEPTIONS; return 0; } @@ -76,8 +76,8 @@ static NSCursor* leakNamedCursor(const char* name, int x, int y) return nil; } -Cursor::Cursor(Image* image, const IntPoint& hotspot) - : m_impl(HardRetainWithNSRelease(createCustomCursor(image, hotspot))) +Cursor::Cursor(Image* image, const IntPoint& hotSpot) + : m_impl(HardRetainWithNSRelease(createCustomCursor(image, hotSpot))) { } diff --git a/WebCore/platform/mac/DragDataMac.mm b/WebCore/platform/mac/DragDataMac.mm index 02a6af7..fa416ed 100644 --- a/WebCore/platform/mac/DragDataMac.mm +++ b/WebCore/platform/mac/DragDataMac.mm @@ -113,13 +113,15 @@ bool DragData::containsCompatibleContent() const return [types count] != 0; } -bool DragData::containsURL() const +bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const { - return !asURL().isEmpty(); + return !asURL(filenamePolicy).isEmpty(); } -String DragData::asURL(String* title) const +String DragData::asURL(FilenameConversionPolicy filenamePolicy, String* title) const { + // FIXME: Use filenamePolicy. + (void)filenamePolicy; return m_pasteboardHelper->urlFromPasteboard([m_platformDragData draggingPasteboard], title); } diff --git a/WebCore/platform/mac/WebCoreSystemInterface.h b/WebCore/platform/mac/WebCoreSystemInterface.h index ea30023..88472da 100644 --- a/WebCore/platform/mac/WebCoreSystemInterface.h +++ b/WebCore/platform/mac/WebCoreSystemInterface.h @@ -117,7 +117,7 @@ extern ATSUFontID (*wkGetNSFontATSUFontId)(NSFont*); extern double (*wkGetNSURLResponseCalculatedExpiration)(NSURLResponse *response); extern NSDate *(*wkGetNSURLResponseLastModifiedDate)(NSURLResponse *response); extern BOOL (*wkGetNSURLResponseMustRevalidate)(NSURLResponse *response); -extern void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, float* wheelTicksX, float* wheelTicksY, BOOL* continuous); +extern void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, BOOL* continuous); extern BOOL (*wkHitTestMediaUIPart)(int part, int themeStyle, CGRect bounds, CGPoint point); extern void (*wkMeasureMediaUIPart)(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize); extern BOOL (*wkMediaControllerThemeAvailable)(int themeStyle); diff --git a/WebCore/platform/mac/WebCoreSystemInterface.mm b/WebCore/platform/mac/WebCoreSystemInterface.mm index b63c5c2..bb54ad0 100644 --- a/WebCore/platform/mac/WebCoreSystemInterface.mm +++ b/WebCore/platform/mac/WebCoreSystemInterface.mm @@ -52,7 +52,7 @@ NSString* (*wkGetMIMETypeForExtension)(NSString*); NSTimeInterval (*wkGetNSURLResponseCalculatedExpiration)(NSURLResponse *response); NSDate *(*wkGetNSURLResponseLastModifiedDate)(NSURLResponse *response); BOOL (*wkGetNSURLResponseMustRevalidate)(NSURLResponse *response); -void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, float* wheelTicksX, float* wheelTicksY, BOOL* continuous); +void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, BOOL* continuous); void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*); unsigned (*wkQTIncludeOnlyModernMediaFileTypes)(void); int (*wkQTMovieDataRate)(QTMovie*); diff --git a/WebCore/platform/mac/WheelEventMac.mm b/WebCore/platform/mac/WheelEventMac.mm index d7e2934..d9663b9 100644 --- a/WebCore/platform/mac/WheelEventMac.mm +++ b/WebCore/platform/mac/WheelEventMac.mm @@ -43,9 +43,14 @@ PlatformWheelEvent::PlatformWheelEvent(NSEvent* event, NSView *windowView) , m_metaKey([event modifierFlags] & NSCommandKeyMask) { BOOL continuous; - wkGetWheelEventDeltas(event, &m_deltaX, &m_deltaY, &m_wheelTicksX, &m_wheelTicksY, &continuous); - - if (!continuous) { + + wkGetWheelEventDeltas(event, &m_deltaX, &m_deltaY, &continuous); + if (continuous) { + 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>(Scrollbar::pixelsPerLineStep()); m_deltaY *= static_cast<float>(Scrollbar::pixelsPerLineStep()); } diff --git a/WebCore/platform/network/FormData.cpp b/WebCore/platform/network/FormData.cpp index 918002a..431dbe4 100644 --- a/WebCore/platform/network/FormData.cpp +++ b/WebCore/platform/network/FormData.cpp @@ -19,23 +19,26 @@ */ #include "config.h" + #include "FormData.h" -#include "Blob.h" +#include "BlobItem.h" #include "Chrome.h" #include "ChromeClient.h" -#include "DOMFormData.h" #include "Document.h" -#include "File.h" #include "FileSystem.h" #include "FormDataBuilder.h" #include "MIMETypeRegistry.h" #include "Page.h" #include "TextEncoding.h" -#include "UUID.h" namespace WebCore { +#if ENABLE(BLOB_SLICE) +const long long FormDataElement::toEndOfFile = -1; +const double FormDataElement::doNotCheckFileChange = 0; +#endif + inline FormData::FormData() : m_identifier(0) , m_hasGeneratedFiles(false) @@ -96,17 +99,17 @@ PassRefPtr<FormData> FormData::create(const Vector<char>& vector) return result.release(); } -PassRefPtr<FormData> FormData::create(const DOMFormData& domFormData) +PassRefPtr<FormData> FormData::create(const BlobItemList& items, const TextEncoding& encoding) { RefPtr<FormData> result = create(); - result->appendDOMFormData(domFormData, false, 0); + result->appendKeyValuePairItems(items, encoding, false, 0); return result.release(); } -PassRefPtr<FormData> FormData::createMultiPart(const DOMFormData& domFormData, Document* document) +PassRefPtr<FormData> FormData::createMultiPart(const BlobItemList& items, const TextEncoding& encoding, Document* document) { RefPtr<FormData> result = create(); - result->appendDOMFormData(domFormData, true, document); + result->appendKeyValuePairItems(items, encoding, true, document); return result.release(); } @@ -154,12 +157,44 @@ void FormData::appendData(const void* data, size_t size) void FormData::appendFile(const String& filename, bool shouldGenerateFile) { #if ENABLE(BLOB_SLICE) - m_elements.append(FormDataElement(filename, 0, Blob::toEndOfFile, Blob::doNotCheckFileChange, shouldGenerateFile)); + m_elements.append(FormDataElement(filename, 0, FormDataElement::toEndOfFile, FormDataElement::doNotCheckFileChange, shouldGenerateFile)); #else m_elements.append(FormDataElement(filename, shouldGenerateFile)); #endif } +void FormData::appendItems(const BlobItemList& items) +{ + for (BlobItemList::const_iterator iter(items.begin()); iter != items.end(); ++iter) + appendItem(iter->get(), false); +} + +void FormData::appendItem(const BlobItem* item, bool shouldGenerateFile) +{ + const DataBlobItem* dataItem = item->toDataBlobItem(); + if (dataItem) { + appendData(dataItem->data(), static_cast<size_t>(dataItem->size())); + return; + } + + const FileBlobItem* fileItem = item->toFileBlobItem(); + ASSERT(fileItem); + if (fileItem->path().isEmpty()) { + // If the path is empty do not add the item. + return; + } + +#if ENABLE(BLOB_SLICE) + const FileRangeBlobItem* fileRangeItem = item->toFileRangeBlobItem(); + if (fileRangeItem) { + appendFileRange(fileItem->path(), fileRangeItem->start(), fileRangeItem->size(), fileRangeItem->snapshotModificationTime(), shouldGenerateFile); + return; + } +#endif + + appendFile(fileItem->path(), shouldGenerateFile); +} + #if ENABLE(BLOB_SLICE) void FormData::appendFileRange(const String& filename, long long start, long long length, double expectedModificationTime, bool shouldGenerateFile) { @@ -167,42 +202,30 @@ void FormData::appendFileRange(const String& filename, long long start, long lon } #endif -void FormData::appendDOMFormData(const DOMFormData& domFormData, bool isMultiPartForm, Document* document) +void FormData::appendKeyValuePairItems(const BlobItemList& items, const TextEncoding& encoding, bool isMultiPartForm, Document* document) { FormDataBuilder formDataBuilder; if (isMultiPartForm) m_boundary = formDataBuilder.generateUniqueBoundaryString(); Vector<char> encodedData; - TextEncoding encoding = domFormData.encoding(); - const Vector<FormDataList::Item>& list = domFormData.list(); - size_t formDataListSize = list.size(); + size_t formDataListSize = items.size(); ASSERT(!(formDataListSize % 2)); for (size_t i = 0; i < formDataListSize; i += 2) { - const FormDataList::Item& key = list[i]; - const FormDataList::Item& value = list[i + 1]; + const StringBlobItem* key = items[i]->toStringBlobItem(); + const BlobItem* value = items[i + 1].get(); + ASSERT(key); if (isMultiPartForm) { Vector<char> header; - formDataBuilder.beginMultiPartHeader(header, m_boundary.data(), key.data()); + formDataBuilder.beginMultiPartHeader(header, m_boundary.data(), key->cstr()); bool shouldGenerateFile = false; // If the current type is FILE, then we also need to include the filename - if (value.blob()) { - const String& path = value.blob()->path(); -#if ENABLE(BLOB_SLICE) - String fileName; - if (value.blob()->isFile()) - fileName = static_cast<File*>(value.blob())->fileName(); - else { - // If a blob is sliced from a file, it does not have the filename. In this case, let's produce a unique filename. - fileName = "Blob" + createCanonicalUUIDString(); - fileName.replace("-", ""); // For safty, remove '-' from the filename snce some servers may not like it. - } -#else - ASSERT(value.blob()->isFile()); - String fileName = static_cast<File*>(value.blob())->fileName(); -#endif + const FileBlobItem* fileItem = value->toFileBlobItem(); + if (fileItem) { + const String& path = fileItem->path(); + String fileName = fileItem->name(); // Let the application specify a filename if it's going to generate a replacement file for the upload. if (!path.isEmpty()) { @@ -217,9 +240,9 @@ void FormData::appendDOMFormData(const DOMFormData& domFormData, bool isMultiPar // We have to include the filename=".." part in the header, even if the filename is empty formDataBuilder.addFilenameToMultiPartHeader(header, encoding, fileName); - // If a blob is sliced from a file, do not add the content type. + // If the item is sliced from a file, do not add the content type. #if ENABLE(BLOB_SLICE) - if (!fileName.isEmpty() && value.blob()->isFile()) { + if (!fileName.isEmpty() && !value->toFileRangeBlobItem()) { #else if (!fileName.isEmpty()) { #endif @@ -237,25 +260,20 @@ void FormData::appendDOMFormData(const DOMFormData& domFormData, bool isMultiPar // Append body appendData(header.data(), header.size()); - if (size_t dataSize = value.data().length()) - appendData(value.data().data(), dataSize); - else if (value.blob() && !value.blob()->path().isEmpty()) -#if ENABLE(BLOB_SLICE) - appendFileRange(value.blob()->path(), value.blob()->start(), value.blob()->length(), value.blob()->modificationTime(), shouldGenerateFile); -#else - appendFile(value.blob()->path(), shouldGenerateFile); -#endif - + appendItem(value, shouldGenerateFile); appendData("\r\n", 2); } else { // Omit the name "isindex" if it's the first form data element. // FIXME: Why is this a good rule? Is this obsolete now? - if (encodedData.isEmpty() && key.data() == "isindex") - FormDataBuilder::encodeStringAsFormData(encodedData, value.data()); + const StringBlobItem* stringValue = value->toStringBlobItem(); + if (!stringValue) + continue; + if (encodedData.isEmpty() && key->cstr() == "isindex") + FormDataBuilder::encodeStringAsFormData(encodedData, stringValue->cstr()); else - formDataBuilder.addKeyValuePairAsFormData(encodedData, key.data(), value.data()); + formDataBuilder.addKeyValuePairAsFormData(encodedData, key->cstr(), stringValue->cstr()); } - } + } if (isMultiPartForm) formDataBuilder.addBoundaryToMultiPartHeader(encodedData, m_boundary.data(), true); @@ -270,12 +288,8 @@ void FormData::flatten(Vector<char>& data) const size_t n = m_elements.size(); for (size_t i = 0; i < n; ++i) { const FormDataElement& e = m_elements[i]; - if (e.m_type == FormDataElement::data) { - size_t oldSize = data.size(); - size_t delta = e.m_data.size(); - data.grow(oldSize + delta); - memcpy(data.data() + oldSize, e.m_data.data(), delta); - } + if (e.m_type == FormDataElement::data) + data.append(e.m_data.data(), static_cast<size_t>(e.m_data.size())); } } @@ -289,10 +303,10 @@ String FormData::flattenToString() const void FormData::generateFiles(Document* document) { ASSERT(!m_hasGeneratedFiles); - + if (m_hasGeneratedFiles) return; - + Page* page = document->page(); if (!page) return; @@ -312,7 +326,7 @@ void FormData::removeGeneratedFilesIfNeeded() { if (!m_hasGeneratedFiles) return; - + size_t n = m_elements.size(); for (size_t i = 0; i < n; ++i) { FormDataElement& e = m_elements[i]; diff --git a/WebCore/platform/network/FormData.h b/WebCore/platform/network/FormData.h index a439023..95eb258 100644 --- a/WebCore/platform/network/FormData.h +++ b/WebCore/platform/network/FormData.h @@ -26,13 +26,16 @@ namespace WebCore { -class DOMFormData; +class BlobItem; class Document; +class TextEncoding; +typedef Vector<RefPtr<BlobItem> > BlobItemList; class FormDataElement { public: FormDataElement() : m_type(data) { } FormDataElement(const Vector<char>& array) : m_type(data), m_data(array) { } + #if ENABLE(BLOB_SLICE) FormDataElement(const String& filename, long long fileStart, long long fileLength, double expectedFileModificationTime, bool shouldGenerateFile) : m_type(encodedFile), m_filename(filename), m_fileStart(fileStart), m_fileLength(fileLength), m_expectedFileModificationTime(expectedFileModificationTime), m_shouldGenerateFile(shouldGenerateFile) { } #else @@ -49,13 +52,18 @@ public: #endif String m_generatedFilename; bool m_shouldGenerateFile; + +#if ENABLE(BLOB_SLICE) + static const long long toEndOfFile; + static const double doNotCheckFileChange; +#endif }; inline bool operator==(const FormDataElement& a, const FormDataElement& b) { if (&a == &b) return true; - + if (a.m_type != b.m_type) return false; if (a.m_data != b.m_data) @@ -69,25 +77,26 @@ inline bool operator==(const FormDataElement& a, const FormDataElement& b) return true; } - + inline bool operator!=(const FormDataElement& a, const FormDataElement& b) { return !(a == b); } - + class FormData : public RefCounted<FormData> { public: static PassRefPtr<FormData> create(); static PassRefPtr<FormData> create(const void*, size_t); static PassRefPtr<FormData> create(const WTF::CString&); static PassRefPtr<FormData> create(const Vector<char>&); - static PassRefPtr<FormData> create(const DOMFormData&); - static PassRefPtr<FormData> createMultiPart(const DOMFormData&, Document*); + static PassRefPtr<FormData> create(const BlobItemList&, const TextEncoding&); + static PassRefPtr<FormData> createMultiPart(const BlobItemList&, const TextEncoding&, Document*); PassRefPtr<FormData> copy() const; PassRefPtr<FormData> deepCopy() const; ~FormData(); - + void appendData(const void* data, size_t); + void appendItems(const BlobItemList&); void appendFile(const String& filename, bool shouldGenerateFile = false); #if ENABLE(BLOB_SLICE) void appendFileRange(const String& filename, long long start, long long length, double expectedModificationTime, bool shouldGenerateFile = false); @@ -115,9 +124,11 @@ private: FormData(); FormData(const FormData&); - void appendDOMFormData(const DOMFormData& domFormData, bool isMultiPartForm, Document* document); + void appendItem(const BlobItem*, bool shouldGenerateFile); + void appendKeyValuePairItems(const BlobItemList&, const TextEncoding&, bool isMultiPartForm, Document*); Vector<FormDataElement> m_elements; + int64_t m_identifier; bool m_hasGeneratedFiles; bool m_alwaysStream; @@ -131,7 +142,7 @@ inline bool operator==(const FormData& a, const FormData& b) inline bool operator!=(const FormData& a, const FormData& b) { - return a.elements() != b.elements(); + return !(a == b); } } // namespace WebCore diff --git a/WebCore/platform/network/chromium/ResourceResponse.h b/WebCore/platform/network/chromium/ResourceResponse.h index 8400ce5..f80bf42 100644 --- a/WebCore/platform/network/chromium/ResourceResponse.h +++ b/WebCore/platform/network/chromium/ResourceResponse.h @@ -41,6 +41,7 @@ namespace WebCore { , m_isMultipartPayload(false) , m_wasFetchedViaSPDY(false) , m_wasNpnNegotiated(false) + , m_wasFetchedViaProxy(false) , m_responseTime(0) { } @@ -52,6 +53,7 @@ namespace WebCore { , m_isMultipartPayload(false) , m_wasFetchedViaSPDY(false) , m_wasNpnNegotiated(false) + , m_wasFetchedViaProxy(false) , m_responseTime(0) { } @@ -74,6 +76,9 @@ namespace WebCore { bool wasNpnNegotiated() const { return m_wasNpnNegotiated; } void setWasNpnNegotiated(bool value) { m_wasNpnNegotiated = value; } + bool wasFetchedViaProxy() const { return m_wasFetchedViaProxy; } + void setWasFetchedViaProxy(bool value) { m_wasFetchedViaProxy = value; } + bool isMultipartPayload() const { return m_isMultipartPayload; } void setIsMultipartPayload(bool value) { m_isMultipartPayload = value; } @@ -114,6 +119,9 @@ namespace WebCore { // Was the resource fetched over a channel which used TLS/Next-Protocol-Negotiation (also SPDY related). bool m_wasNpnNegotiated; + // Was the resource fetched over an explicit proxy (HTTP, SOCKS, etc). + bool m_wasFetchedViaProxy; + // The time at which the response headers were received. For cached // responses, this time could be "far" in the past. double m_responseTime; diff --git a/WebCore/platform/network/mac/FormDataStreamMac.mm b/WebCore/platform/network/mac/FormDataStreamMac.mm index 27ecfd0..db2e13b 100644 --- a/WebCore/platform/network/mac/FormDataStreamMac.mm +++ b/WebCore/platform/network/mac/FormDataStreamMac.mm @@ -31,7 +31,6 @@ #import "config.h" #import "FormDataStreamMac.h" -#import "Blob.h" #import "FileSystem.h" #import "FormData.h" #import "ResourceHandle.h" @@ -142,7 +141,7 @@ static void closeCurrentStream(FormStreamFields *form) CFRelease(form->currentStream); form->currentStream = NULL; #if ENABLE(BLOB_SLICE) - form->currentStreamRangeLength = Blob::toEndOfFile; + form->currentStreamRangeLength = FormDataElement::toEndOfFile; #endif } if (form->currentData) { @@ -151,7 +150,7 @@ static void closeCurrentStream(FormStreamFields *form) } } -// Return false if we cannot advance the stream. Currently the only possible failure is that the underlying file has been changed since File.slice. +// Return false if we cannot advance the stream. Currently the only possible failure is that the underlying file has been removed or changed since File.slice. static bool advanceCurrentStream(FormStreamFields* form) { closeCurrentStream(form); @@ -161,6 +160,7 @@ static bool advanceCurrentStream(FormStreamFields* form) // Create the new stream. FormDataElement& nextInput = form->remainingElements.last(); + if (nextInput.m_type == FormDataElement::data) { size_t size = nextInput.m_data.size(); char* data = nextInput.m_data.releaseBuffer(); @@ -169,17 +169,20 @@ static bool advanceCurrentStream(FormStreamFields* form) } else { #if ENABLE(BLOB_SLICE) // Check if the file has been changed or not if required. - if (nextInput.m_expectedFileModificationTime != Blob::doNotCheckFileChange) { + if (nextInput.m_expectedFileModificationTime != FormDataElement::doNotCheckFileChange) { time_t fileModificationTime; if (!getFileModificationTime(nextInput.m_filename, fileModificationTime) || fileModificationTime != static_cast<time_t>(nextInput.m_expectedFileModificationTime)) return false; } #endif - const String& path = nextInput.m_shouldGenerateFile ? nextInput.m_generatedFilename : nextInput.m_filename; RetainPtr<CFStringRef> filename(AdoptCF, path.createCFString()); RetainPtr<CFURLRef> fileURL(AdoptCF, CFURLCreateWithFileSystemPath(0, filename.get(), kCFURLPOSIXPathStyle, FALSE)); form->currentStream = CFReadStreamCreateWithFile(0, fileURL.get()); + if (!form->currentStream) { + // The file must have been removed or become unreadable. + return false; + } #if ENABLE(BLOB_SLICE) if (nextInput.m_fileStart > 0) { CFNumberRef position = CFNumberCreate(0, kCFNumberLongLongType, &nextInput.m_fileStart); @@ -222,7 +225,7 @@ static void* formCreate(CFReadStreamRef stream, void* context) FormStreamFields* newInfo = new FormStreamFields; newInfo->currentStream = NULL; #if ENABLE(BLOB_SLICE) - newInfo->currentStreamRangeLength = Blob::toEndOfFile; + newInfo->currentStreamRangeLength = FormDataElement::toEndOfFile; #endif newInfo->currentData = 0; newInfo->formStream = stream; // Don't retain. That would create a reference cycle. @@ -270,7 +273,7 @@ static CFIndex formRead(CFReadStreamRef stream, UInt8* buffer, CFIndex bufferLen while (form->currentStream) { CFIndex bytesToRead = bufferLength; #if ENABLE(BLOB_SLICE) - if (form->currentStreamRangeLength != Blob::toEndOfFile && form->currentStreamRangeLength < bytesToRead) + if (form->currentStreamRangeLength != FormDataElement::toEndOfFile && form->currentStreamRangeLength < bytesToRead) bytesToRead = static_cast<CFIndex>(form->currentStreamRangeLength); #endif CFIndex bytesRead = CFReadStreamRead(form->currentStream, buffer, bytesToRead); @@ -283,7 +286,7 @@ static CFIndex formRead(CFReadStreamRef stream, UInt8* buffer, CFIndex bufferLen *atEOF = FALSE; form->bytesSent += bytesRead; #if ENABLE(BLOB_SLICE) - if (form->currentStreamRangeLength != Blob::toEndOfFile) + if (form->currentStreamRangeLength != FormDataElement::toEndOfFile) form->currentStreamRangeLength -= bytesRead; #endif @@ -400,7 +403,7 @@ void setHTTPBody(NSMutableURLRequest *request, PassRefPtr<FormData> formData) else { #if ENABLE(BLOB_SLICE) // If we're sending the file range, use the existing range length for now. We will detect if the file has been changed right before we read the file and abort the operation if necessary. - if (element.m_fileLength != Blob::toEndOfFile) { + if (element.m_fileLength != FormDataElement::toEndOfFile) { length += element.m_fileLength; continue; } diff --git a/WebCore/platform/network/soup/ResourceHandleSoup.cpp b/WebCore/platform/network/soup/ResourceHandleSoup.cpp index 90a842e..e2c67bc 100644 --- a/WebCore/platform/network/soup/ResourceHandleSoup.cpp +++ b/WebCore/platform/network/soup/ResourceHandleSoup.cpp @@ -533,10 +533,8 @@ static bool startHttp(ResourceHandle* handle) * libsoup's simple-httpd test */ GError* error = 0; - gchar* fileName = filenameFromString(element.m_filename); - GMappedFile* fileMapping = g_mapped_file_new(fileName, false, &error); - - g_free(fileName); + CString fileName = fileSystemRepresentation(element.m_filename); + GMappedFile* fileMapping = g_mapped_file_new(fileName.data(), false, &error); if (error) { g_error_free(error); diff --git a/WebCore/platform/posix/SharedBufferPOSIX.cpp b/WebCore/platform/posix/SharedBufferPOSIX.cpp index ea0589d..6f66d4d 100644 --- a/WebCore/platform/posix/SharedBufferPOSIX.cpp +++ b/WebCore/platform/posix/SharedBufferPOSIX.cpp @@ -40,9 +40,8 @@ PassRefPtr<SharedBuffer> SharedBuffer::createWithContentsOfFile(const String& fi if (filePath.isEmpty()) return 0; - char* filename = filenameFromString(filePath); - int fd = open(filename, O_RDONLY); - fastFree(filename); + CString filename = fileSystemRepresentation(filePath); + int fd = open(filename.data(), O_RDONLY); if (fd == -1) return 0; diff --git a/WebCore/platform/qt/ClipboardQt.cpp b/WebCore/platform/qt/ClipboardQt.cpp index c23e42e..c98c79a 100644 --- a/WebCore/platform/qt/ClipboardQt.cpp +++ b/WebCore/platform/qt/ClipboardQt.cpp @@ -22,14 +22,14 @@ * 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 "ClipboardQt.h" -#include "CachedImage.h" #include "CSSHelper.h" +#include "CachedImage.h" #include "Document.h" #include "Element.h" #include "FileList.h" @@ -38,19 +38,19 @@ #include "Image.h" #include "IntPoint.h" #include "KURL.h" -#include "markup.h" #include "NotImplemented.h" #include "PlatformString.h" #include "Range.h" #include "RenderImage.h" #include "StringHash.h" +#include "markup.h" +#include <QApplication> +#include <QClipboard> #include <QList> #include <QMimeData> #include <QStringList> #include <QUrl> -#include <QApplication> -#include <QClipboard> #include <qdebug.h> #define methodDebug() qDebug("ClipboardQt: %s", __FUNCTION__) @@ -226,14 +226,14 @@ void ClipboardQt::declareAndWriteDragImage(Element* element, const KURL& url, co { ASSERT(frame); - //WebCore::writeURL(m_writableDataObject.get(), url, title, true, false); + // WebCore::writeURL(m_writableDataObject.get(), url, title, true, false); if (!m_writableData) m_writableData = new QMimeData; CachedImage* cachedImage = getCachedImage(element); if (!cachedImage || !cachedImage->image() || !cachedImage->isLoaded()) return; - QPixmap *pixmap = cachedImage->image()->nativeImageForCurrentFrame(); + QPixmap* pixmap = cachedImage->image()->nativeImageForCurrentFrame(); if (pixmap) m_writableData->setImageData(*pixmap); diff --git a/WebCore/platform/qt/ContextMenuItemQt.cpp b/WebCore/platform/qt/ContextMenuItemQt.cpp index cf23587..b91a2a7 100644 --- a/WebCore/platform/qt/ContextMenuItemQt.cpp +++ b/WebCore/platform/qt/ContextMenuItemQt.cpp @@ -21,11 +21,12 @@ * 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 "ContextMenuItem.h" + #include "ContextMenu.h" namespace WebCore { diff --git a/WebCore/platform/qt/ContextMenuQt.cpp b/WebCore/platform/qt/ContextMenuQt.cpp index 9b1a054..30c4c2d 100644 --- a/WebCore/platform/qt/ContextMenuQt.cpp +++ b/WebCore/platform/qt/ContextMenuQt.cpp @@ -21,19 +21,17 @@ * 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 "ContextMenu.h" -#include <wtf/Assertions.h> - -#include <QAction> - #include <Document.h> #include <Frame.h> #include <FrameView.h> +#include <QAction> +#include <wtf/Assertions.h> namespace WebCore { diff --git a/WebCore/platform/qt/CursorQt.cpp b/WebCore/platform/qt/CursorQt.cpp index 87f4fce..2e495e7 100644 --- a/WebCore/platform/qt/CursorQt.cpp +++ b/WebCore/platform/qt/CursorQt.cpp @@ -57,11 +57,12 @@ Cursor::~Cursor() { } -Cursor::Cursor(Image* image, const IntPoint& hotspot) +Cursor::Cursor(Image* image, const IntPoint& hotSpot) +{ #ifndef QT_NO_CURSOR - : m_impl(*(image->nativeImageForCurrentFrame()), hotspot.x(), hotspot.y()) + IntPoint effectiveHotSpot = determineHotSpot(image, hotSpot); + m_impl = QCursor(*(image->nativeImageForCurrentFrame()), effectiveHotSpot.x(), effectiveHotSpot.y()); #endif -{ } Cursor& Cursor::operator=(const Cursor& other) diff --git a/WebCore/platform/qt/DragDataQt.cpp b/WebCore/platform/qt/DragDataQt.cpp index 09a797f..808606d 100644 --- a/WebCore/platform/qt/DragDataQt.cpp +++ b/WebCore/platform/qt/DragDataQt.cpp @@ -20,7 +20,7 @@ * 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" @@ -31,10 +31,10 @@ #include "DocumentFragment.h" #include "markup.h" +#include <QColor> #include <QList> #include <QMimeData> #include <QUrl> -#include <QColor> namespace WebCore { @@ -90,7 +90,7 @@ String DragData::asPlainText() const return text; // FIXME: Should handle rich text here - return asURL(0); + return asURL(DoNotConvertFilenames, 0); } Color DragData::asColor() const @@ -112,15 +112,17 @@ bool DragData::containsCompatibleContent() const return containsColor() || containsURL() || m_platformDragData->hasHtml() || m_platformDragData->hasText(); } -bool DragData::containsURL() const +bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const { + // FIXME: Use filenamePolicy. if (!m_platformDragData) return false; return m_platformDragData->hasUrls(); } -String DragData::asURL(String*) const +String DragData::asURL(FilenameConversionPolicy filenamePolicy, String*) const { + // FIXME: Use filenamePolicy. if (!m_platformDragData) return String(); QList<QUrl> urls = m_platformDragData->urls(); diff --git a/WebCore/platform/qt/FileChooserQt.cpp b/WebCore/platform/qt/FileChooserQt.cpp index 307876c..8b1df0a 100644 --- a/WebCore/platform/qt/FileChooserQt.cpp +++ b/WebCore/platform/qt/FileChooserQt.cpp @@ -21,8 +21,8 @@ #include "config.h" #include "FileChooser.h" -#include "LocalizedStrings.h" #include "Font.h" +#include "LocalizedStrings.h" #include <QCoreApplication> #include <QFontMetrics> diff --git a/WebCore/platform/qt/FileSystemQt.cpp b/WebCore/platform/qt/FileSystemQt.cpp index e42ca67..03dfc8f 100644 --- a/WebCore/platform/qt/FileSystemQt.cpp +++ b/WebCore/platform/qt/FileSystemQt.cpp @@ -9,13 +9,13 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. + * 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. + * 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 @@ -33,14 +33,12 @@ #include "FileSystem.h" #include "PlatformString.h" -#include <wtf/text/CString.h> - #include <QDateTime> +#include <QDir> #include <QFile> -#include <QTemporaryFile> #include <QFileInfo> -#include <QDateTime> -#include <QDir> +#include <QTemporaryFile> +#include <wtf/text/CString.h> namespace WebCore { diff --git a/WebCore/platform/qt/GeolocationServiceQt.cpp b/WebCore/platform/qt/GeolocationServiceQt.cpp new file mode 100644 index 0000000..e24d497 --- /dev/null +++ b/WebCore/platform/qt/GeolocationServiceQt.cpp @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "GeolocationServiceQt.h" + +#include "Geolocation.h" +#include "Geoposition.h" +#include "PositionError.h" +#include "PositionOptions.h" + +using namespace QtMobility; + +namespace WebCore { + +GeolocationService::FactoryFunction* GeolocationService::s_factoryFunction = &GeolocationServiceQt::create; + +GeolocationService* GeolocationServiceQt::create(GeolocationServiceClient* client) +{ + return new GeolocationServiceQt(client); +} + +GeolocationServiceQt::GeolocationServiceQt(GeolocationServiceClient* client) + : GeolocationService(client) + , m_lastPosition(0) + , m_lastError(0) +{ + m_location = QGeoPositionInfoSource::createDefaultSource(this); + + if (m_location) + connect(m_location, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(positionUpdated(QGeoPositionInfo))); +} + +GeolocationServiceQt::~GeolocationServiceQt() +{ +} + +void GeolocationServiceQt::positionUpdated(const QGeoPositionInfo &geoPosition) +{ + if (!geoPosition.isValid()) + errorOccurred(); + + QGeoCoordinate coord = geoPosition.coordinate(); + double latitude = coord.latitude(); + double longitude = coord.longitude(); + bool providesAltitude = true; + double altitude = coord.altitude(); + + double accuracy = geoPosition.hasAttribute(QGeoPositionInfo::HorizontalAccuracy) ? + geoPosition.attribute(QGeoPositionInfo::HorizontalAccuracy) : 0.0; + + bool providesAltitudeAccuracy = geoPosition.hasAttribute(QGeoPositionInfo::VerticalAccuracy); + double altitudeAccuracy = providesAltitudeAccuracy ? geoPosition.attribute(QGeoPositionInfo::VerticalAccuracy) : 0.0; + + bool providesHeading = geoPosition.hasAttribute(QGeoPositionInfo::Direction); + double heading = providesHeading ? geoPosition.attribute(QGeoPositionInfo::Direction) : 0.0; + + bool providesSpeed = geoPosition.hasAttribute(QGeoPositionInfo::GroundSpeed); + double speed = providesSpeed ? geoPosition.attribute(QGeoPositionInfo::GroundSpeed) : 0.0; + + RefPtr<Coordinates> coordinates = Coordinates::create(latitude, longitude, providesAltitude, altitude, + accuracy, providesAltitudeAccuracy, altitudeAccuracy, + providesHeading, heading, providesSpeed, speed); + m_lastPosition = Geoposition::create(coordinates.release(), geoPosition.timestamp().toTime_t()); + positionChanged(); +} + +bool GeolocationServiceQt::startUpdating(PositionOptions*) +{ + m_lastPosition = 0; + + if (!m_location) + return false; + + // TODO: handle enableHighAccuracy() + + m_location->startUpdates(); + return true; +} + +void GeolocationServiceQt::stopUpdating() +{ + if (m_location) + m_location->stopUpdates(); +} + +} // namespace WebCore diff --git a/WebCore/platform/qt/GeolocationServiceQt.h b/WebCore/platform/qt/GeolocationServiceQt.h new file mode 100644 index 0000000..2525e47 --- /dev/null +++ b/WebCore/platform/qt/GeolocationServiceQt.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * 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 GeolocationServiceQt_h +#define GeolocationServiceQt_h + +#include "GeolocationService.h" +#include <QGeoPositionInfoSource> +#include <wtf/RefPtr.h> + +// FIXME: Remove usage of "using namespace" in a header file. +// There is bug in qtMobility signal names are not full qualified when used with namespace +// QtMobility namespace in slots throws up error and its required to be fixed in qtmobility. +using namespace QtMobility; + +namespace WebCore { + +// This class provides a implementation of a GeolocationService for qtWebkit. +// It uses QtMobility (v1.0.0) location service to get positions +class GeolocationServiceQt : public QObject, GeolocationService { + Q_OBJECT + +public: + static GeolocationService* create(GeolocationServiceClient*); + + GeolocationServiceQt(GeolocationServiceClient*); + virtual ~GeolocationServiceQt(); + + virtual bool startUpdating(PositionOptions*); + virtual void stopUpdating(); + + virtual Geoposition* lastPosition() const { return m_lastPosition.get(); } + virtual PositionError* lastError() const { return m_lastError.get(); } + +public Q_SLOTS: + // QGeoPositionInfoSource + void positionUpdated(const QGeoPositionInfo&); + +private: + RefPtr<Geoposition> m_lastPosition; + RefPtr<PositionError> m_lastError; + + QtMobility::QGeoPositionInfoSource* m_location; +}; + +} // namespace WebCore + +#endif // GeolocationServiceQt_h diff --git a/WebCore/platform/qt/KURLQt.cpp b/WebCore/platform/qt/KURLQt.cpp index ea1a795..f6d2a86 100644 --- a/WebCore/platform/qt/KURLQt.cpp +++ b/WebCore/platform/qt/KURLQt.cpp @@ -19,11 +19,11 @@ */ #include "config.h" #include "KURL.h" -#include "TextEncoding.h" -#include <wtf/text/CString.h> #include "NotImplemented.h" +#include "TextEncoding.h" #include "qurl.h" +#include <wtf/text/CString.h> namespace WebCore { diff --git a/WebCore/platform/qt/Localizations.cpp b/WebCore/platform/qt/Localizations.cpp index 8fdd666..454872a 100644 --- a/WebCore/platform/qt/Localizations.cpp +++ b/WebCore/platform/qt/Localizations.cpp @@ -27,15 +27,15 @@ */ #include "config.h" +#include "LocalizedStrings.h" #include "IntSize.h" -#include "LocalizedStrings.h" #include "NotImplemented.h" #include "PlatformString.h" -#include <wtf/MathExtras.h> - #include <QCoreApplication> #include <QLocale> +#include <wtf/MathExtras.h> + namespace WebCore { @@ -350,7 +350,7 @@ String AXMenuListActionVerb() { return String(); } - + String missingPluginText() { return QCoreApplication::translate("QWebPage", "Missing Plug-in", "Label text to be used when a plug-in is missing"); @@ -477,21 +477,18 @@ String localizedMediaTimeDescription(float time) int minutes = (seconds / 60) % 60; seconds %= 60; - if (days) { + if (days) return QCoreApplication::translate("QWebPage", "%1 days %2 hours %3 minutes %4 seconds", "Media time description").arg(days).arg(hours).arg(minutes).arg(seconds); - } - if (hours) { + if (hours) return QCoreApplication::translate("QWebPage", "%1 hours %2 minutes %3 seconds", "Media time description").arg(hours).arg(minutes).arg(seconds); - } - if (minutes) { + if (minutes) return QCoreApplication::translate("QWebPage", "%1 minutes %2 seconds", "Media time description").arg(minutes).arg(seconds); - } return QCoreApplication::translate("QWebPage", "%1 seconds", "Media time description").arg(seconds); } -#endif // ENABLE(VIDEO) +#endif // ENABLE(VIDEO) String validationMessageValueMissingText() { diff --git a/WebCore/platform/qt/LoggingQt.cpp b/WebCore/platform/qt/LoggingQt.cpp index 2854953..817887d 100644 --- a/WebCore/platform/qt/LoggingQt.cpp +++ b/WebCore/platform/qt/LoggingQt.cpp @@ -19,8 +19,8 @@ #include "config.h" #include "Logging.h" -#include "PlatformString.h" +#include "PlatformString.h" #include <QDebug> #include <QStringList> diff --git a/WebCore/platform/qt/PasteboardQt.cpp b/WebCore/platform/qt/PasteboardQt.cpp index 484fa60..86d2cfe 100644 --- a/WebCore/platform/qt/PasteboardQt.cpp +++ b/WebCore/platform/qt/PasteboardQt.cpp @@ -162,8 +162,8 @@ void Pasteboard::writeImage(Node* node, const KURL&, const String&) ASSERT(image); QPixmap* pixmap = image->nativeImageForCurrentFrame(); - ASSERT(pixmap); - + if (!pixmap) + return; QApplication::clipboard()->setPixmap(*pixmap, QClipboard::Clipboard); #endif } diff --git a/WebCore/platform/qt/PlatformKeyboardEventQt.cpp b/WebCore/platform/qt/PlatformKeyboardEventQt.cpp index 56fec70..58ab2bf 100644 --- a/WebCore/platform/qt/PlatformKeyboardEventQt.cpp +++ b/WebCore/platform/qt/PlatformKeyboardEventQt.cpp @@ -31,110 +31,109 @@ #include "NotImplemented.h" #include "WindowsKeyboardCodes.h" -#include <ctype.h> - #include <QKeyEvent> +#include <ctype.h> namespace WebCore { static String keyIdentifierForQtKeyCode(int keyCode) { switch (keyCode) { - case Qt::Key_Menu: - case Qt::Key_Alt: - return "Alt"; - case Qt::Key_Clear: - return "Clear"; - case Qt::Key_Down: - return "Down"; - case Qt::Key_End: - return "End"; - case Qt::Key_Return: - case Qt::Key_Enter: - return "Enter"; - case Qt::Key_Execute: - return "Execute"; - case Qt::Key_F1: - return "F1"; - case Qt::Key_F2: - return "F2"; - case Qt::Key_F3: - return "F3"; - case Qt::Key_F4: - return "F4"; - case Qt::Key_F5: - return "F5"; - case Qt::Key_F6: - return "F6"; - case Qt::Key_F7: - return "F7"; - case Qt::Key_F8: - return "F8"; - case Qt::Key_F9: - return "F9"; - case Qt::Key_F10: - return "F10"; - case Qt::Key_F11: - return "F11"; - case Qt::Key_F12: - return "F12"; - case Qt::Key_F13: - return "F13"; - case Qt::Key_F14: - return "F14"; - case Qt::Key_F15: - return "F15"; - case Qt::Key_F16: - return "F16"; - case Qt::Key_F17: - return "F17"; - case Qt::Key_F18: - return "F18"; - case Qt::Key_F19: - return "F19"; - case Qt::Key_F20: - return "F20"; - case Qt::Key_F21: - return "F21"; - case Qt::Key_F22: - return "F22"; - case Qt::Key_F23: - return "F23"; - case Qt::Key_F24: - return "F24"; - case Qt::Key_Help: - return "Help"; - case Qt::Key_Home: - return "Home"; - case Qt::Key_Insert: - return "Insert"; - case Qt::Key_Left: - return "Left"; - case Qt::Key_PageDown: - return "PageDown"; - case Qt::Key_PageUp: - return "PageUp"; - case Qt::Key_Pause: - return "Pause"; - case Qt::Key_Print: - return "PrintScreen"; - case Qt::Key_Right: - return "Right"; - case Qt::Key_Select: - return "Select"; - case Qt::Key_Up: - return "Up"; - // Standard says that DEL becomes U+007F. - case Qt::Key_Delete: - return "U+007F"; - case Qt::Key_Backspace: - return "U+0008"; - case Qt::Key_Tab: - return "U+0009"; - case Qt::Key_Backtab: - return "U+0009"; - default: - return String::format("U+%04X", toupper(keyCode)); + case Qt::Key_Menu: + case Qt::Key_Alt: + return "Alt"; + case Qt::Key_Clear: + return "Clear"; + case Qt::Key_Down: + return "Down"; + case Qt::Key_End: + return "End"; + case Qt::Key_Return: + case Qt::Key_Enter: + return "Enter"; + case Qt::Key_Execute: + return "Execute"; + case Qt::Key_F1: + return "F1"; + case Qt::Key_F2: + return "F2"; + case Qt::Key_F3: + return "F3"; + case Qt::Key_F4: + return "F4"; + case Qt::Key_F5: + return "F5"; + case Qt::Key_F6: + return "F6"; + case Qt::Key_F7: + return "F7"; + case Qt::Key_F8: + return "F8"; + case Qt::Key_F9: + return "F9"; + case Qt::Key_F10: + return "F10"; + case Qt::Key_F11: + return "F11"; + case Qt::Key_F12: + return "F12"; + case Qt::Key_F13: + return "F13"; + case Qt::Key_F14: + return "F14"; + case Qt::Key_F15: + return "F15"; + case Qt::Key_F16: + return "F16"; + case Qt::Key_F17: + return "F17"; + case Qt::Key_F18: + return "F18"; + case Qt::Key_F19: + return "F19"; + case Qt::Key_F20: + return "F20"; + case Qt::Key_F21: + return "F21"; + case Qt::Key_F22: + return "F22"; + case Qt::Key_F23: + return "F23"; + case Qt::Key_F24: + return "F24"; + case Qt::Key_Help: + return "Help"; + case Qt::Key_Home: + return "Home"; + case Qt::Key_Insert: + return "Insert"; + case Qt::Key_Left: + return "Left"; + case Qt::Key_PageDown: + return "PageDown"; + case Qt::Key_PageUp: + return "PageUp"; + case Qt::Key_Pause: + return "Pause"; + case Qt::Key_Print: + return "PrintScreen"; + case Qt::Key_Right: + return "Right"; + case Qt::Key_Select: + return "Select"; + case Qt::Key_Up: + return "Up"; + // Standard says that DEL becomes U+007F. + case Qt::Key_Delete: + return "U+007F"; + case Qt::Key_Backspace: + return "U+0008"; + case Qt::Key_Tab: + return "U+0009"; + case Qt::Key_Backtab: + return "U+0009"; + default: + return String::format("U+%04X", toupper(keyCode)); } } @@ -144,35 +143,35 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode, bool isKeypad = false if (isKeypad) { switch (keycode) { case Qt::Key_0: - return VK_NUMPAD0; // (60) Numeric keypad 0 key + return VK_NUMPAD0; // (60) Numeric keypad 0 key case Qt::Key_1: - return VK_NUMPAD1; // (61) Numeric keypad 1 key + return VK_NUMPAD1; // (61) Numeric keypad 1 key case Qt::Key_2: return VK_NUMPAD2; // (62) Numeric keypad 2 key case Qt::Key_3: - return VK_NUMPAD3; // (63) Numeric keypad 3 key + return VK_NUMPAD3; // (63) Numeric keypad 3 key case Qt::Key_4: - return VK_NUMPAD4; // (64) Numeric keypad 4 key + return VK_NUMPAD4; // (64) Numeric keypad 4 key case Qt::Key_5: - return VK_NUMPAD5; // (65) Numeric keypad 5 key + return VK_NUMPAD5; // (65) Numeric keypad 5 key case Qt::Key_6: - return VK_NUMPAD6; // (66) Numeric keypad 6 key + return VK_NUMPAD6; // (66) Numeric keypad 6 key case Qt::Key_7: - return VK_NUMPAD7; // (67) Numeric keypad 7 key + return VK_NUMPAD7; // (67) Numeric keypad 7 key case Qt::Key_8: - return VK_NUMPAD8; // (68) Numeric keypad 8 key + return VK_NUMPAD8; // (68) Numeric keypad 8 key case Qt::Key_9: - return VK_NUMPAD9; // (69) Numeric keypad 9 key + return VK_NUMPAD9; // (69) Numeric keypad 9 key case Qt::Key_Asterisk: return VK_MULTIPLY; // (6A) Multiply key case Qt::Key_Plus: - return VK_ADD; // (6B) Add key + return VK_ADD; // (6B) Add key case Qt::Key_Minus: return VK_SUBTRACT; // (6D) Subtract key case Qt::Key_Period: - return VK_DECIMAL; // (6E) Decimal key + return VK_DECIMAL; // (6E) Decimal key case Qt::Key_Slash: - return VK_DIVIDE; // (6F) Divide key + return VK_DIVIDE; // (6F) Divide key case Qt::Key_PageUp: return VK_PRIOR; // (21) PAGE UP key case Qt::Key_PageDown: @@ -196,311 +195,310 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode, bool isKeypad = false } else switch (keycode) { - case Qt::Key_Backspace: - return VK_BACK; // (08) BACKSPACE key - case Qt::Key_Backtab: - case Qt::Key_Tab: - return VK_TAB; // (09) TAB key - case Qt::Key_Clear: - return VK_CLEAR; // (0C) CLEAR key - case Qt::Key_Enter: - case Qt::Key_Return: - return VK_RETURN; //(0D) Return key - case Qt::Key_Shift: - return VK_SHIFT; // (10) SHIFT key - case Qt::Key_Control: - return VK_CONTROL; // (11) CTRL key - case Qt::Key_Menu: - case Qt::Key_Alt: - return VK_MENU; // (12) ALT key + case Qt::Key_Backspace: + return VK_BACK; // (08) BACKSPACE key + case Qt::Key_Backtab: + case Qt::Key_Tab: + return VK_TAB; // (09) TAB key + case Qt::Key_Clear: + return VK_CLEAR; // (0C) CLEAR key + case Qt::Key_Enter: + case Qt::Key_Return: + return VK_RETURN; // (0D) Return key + case Qt::Key_Shift: + return VK_SHIFT; // (10) SHIFT key + case Qt::Key_Control: + return VK_CONTROL; // (11) CTRL key + case Qt::Key_Menu: + case Qt::Key_Alt: + return VK_MENU; // (12) ALT key - case Qt::Key_F1: - return VK_F1; - case Qt::Key_F2: - return VK_F2; - case Qt::Key_F3: - return VK_F3; - case Qt::Key_F4: - return VK_F4; - case Qt::Key_F5: - return VK_F5; - case Qt::Key_F6: - return VK_F6; - case Qt::Key_F7: - return VK_F7; - case Qt::Key_F8: - return VK_F8; - case Qt::Key_F9: - return VK_F9; - case Qt::Key_F10: - return VK_F10; - case Qt::Key_F11: - return VK_F11; - case Qt::Key_F12: - return VK_F12; - case Qt::Key_F13: - return VK_F13; - case Qt::Key_F14: - return VK_F14; - case Qt::Key_F15: - return VK_F15; - case Qt::Key_F16: - return VK_F16; - case Qt::Key_F17: - return VK_F17; - case Qt::Key_F18: - return VK_F18; - case Qt::Key_F19: - return VK_F19; - case Qt::Key_F20: - return VK_F20; - case Qt::Key_F21: - return VK_F21; - case Qt::Key_F22: - return VK_F22; - case Qt::Key_F23: - return VK_F23; - case Qt::Key_F24: - return VK_F24; + case Qt::Key_F1: + return VK_F1; + case Qt::Key_F2: + return VK_F2; + case Qt::Key_F3: + return VK_F3; + case Qt::Key_F4: + return VK_F4; + case Qt::Key_F5: + return VK_F5; + case Qt::Key_F6: + return VK_F6; + case Qt::Key_F7: + return VK_F7; + case Qt::Key_F8: + return VK_F8; + case Qt::Key_F9: + return VK_F9; + case Qt::Key_F10: + return VK_F10; + case Qt::Key_F11: + return VK_F11; + case Qt::Key_F12: + return VK_F12; + case Qt::Key_F13: + return VK_F13; + case Qt::Key_F14: + return VK_F14; + case Qt::Key_F15: + return VK_F15; + case Qt::Key_F16: + return VK_F16; + case Qt::Key_F17: + return VK_F17; + case Qt::Key_F18: + return VK_F18; + case Qt::Key_F19: + return VK_F19; + case Qt::Key_F20: + return VK_F20; + case Qt::Key_F21: + return VK_F21; + case Qt::Key_F22: + return VK_F22; + case Qt::Key_F23: + return VK_F23; + case Qt::Key_F24: + return VK_F24; - case Qt::Key_Pause: - return VK_PAUSE; // (13) PAUSE key - case Qt::Key_CapsLock: - return VK_CAPITAL; // (14) CAPS LOCK key - case Qt::Key_Kana_Lock: - case Qt::Key_Kana_Shift: - return VK_KANA; // (15) Input Method Editor (IME) Kana mode - case Qt::Key_Hangul: - return VK_HANGUL; // VK_HANGUL (15) IME Hangul mode - // VK_JUNJA (17) IME Junja mode - // VK_FINAL (18) IME final mode - case Qt::Key_Hangul_Hanja: - return VK_HANJA; // (19) IME Hanja mode - case Qt::Key_Kanji: - return VK_KANJI; // (19) IME Kanji mode - case Qt::Key_Escape: - return VK_ESCAPE; // (1B) ESC key - // VK_CONVERT (1C) IME convert - // VK_NONCONVERT (1D) IME nonconvert - // VK_ACCEPT (1E) IME accept - // VK_MODECHANGE (1F) IME mode change request - case Qt::Key_Space: - return VK_SPACE; // (20) SPACEBAR - case Qt::Key_PageUp: - return VK_PRIOR; // (21) PAGE UP key - case Qt::Key_PageDown: - return VK_NEXT; // (22) PAGE DOWN key - case Qt::Key_End: - return VK_END; // (23) END key - case Qt::Key_Home: - return VK_HOME; // (24) HOME key - case Qt::Key_Left: - return VK_LEFT; // (25) LEFT ARROW key - case Qt::Key_Up: - return VK_UP; // (26) UP ARROW key - case Qt::Key_Right: - return VK_RIGHT; // (27) RIGHT ARROW key - case Qt::Key_Down: - return VK_DOWN; // (28) DOWN ARROW key - case Qt::Key_Select: - return VK_SELECT; // (29) SELECT key - case Qt::Key_Print: - return VK_PRINT; // (2A) PRINT key - case Qt::Key_Execute: - return VK_EXECUTE;// (2B) EXECUTE key - //dunno on this - //case Qt::Key_PrintScreen: - // return VK_SNAPSHOT; // (2C) PRINT SCREEN key - case Qt::Key_Insert: - return VK_INSERT; // (2D) INS key - case Qt::Key_Delete: - return VK_DELETE; // (2E) DEL key - case Qt::Key_Help: - return VK_HELP; // (2F) HELP key - case Qt::Key_0: - case Qt::Key_ParenLeft: - return VK_0; // (30) 0) key - case Qt::Key_1: - return VK_1; // (31) 1 ! key - case Qt::Key_2: - case Qt::Key_At: - return VK_2; // (32) 2 & key - case Qt::Key_3: - case Qt::Key_NumberSign: - return VK_3; //case '3': case '#'; - case Qt::Key_4: - case Qt::Key_Dollar: // (34) 4 key '$'; - return VK_4; - case Qt::Key_5: - case Qt::Key_Percent: - return VK_5; // (35) 5 key '%' - case Qt::Key_6: - case Qt::Key_AsciiCircum: - return VK_6; // (36) 6 key '^' - case Qt::Key_7: - case Qt::Key_Ampersand: - return VK_7; // (37) 7 key case '&' - case Qt::Key_8: - case Qt::Key_Asterisk: - return VK_8; // (38) 8 key '*' - case Qt::Key_9: - case Qt::Key_ParenRight: - return VK_9; // (39) 9 key '(' - case Qt::Key_A: - return VK_A; // (41) A key case 'a': case 'A': return 0x41; - case Qt::Key_B: - return VK_B; // (42) B key case 'b': case 'B': return 0x42; - case Qt::Key_C: - return VK_C; // (43) C key case 'c': case 'C': return 0x43; - case Qt::Key_D: - return VK_D; // (44) D key case 'd': case 'D': return 0x44; - case Qt::Key_E: - return VK_E; // (45) E key case 'e': case 'E': return 0x45; - case Qt::Key_F: - return VK_F; // (46) F key case 'f': case 'F': return 0x46; - case Qt::Key_G: - return VK_G; // (47) G key case 'g': case 'G': return 0x47; - case Qt::Key_H: - return VK_H; // (48) H key case 'h': case 'H': return 0x48; - case Qt::Key_I: - return VK_I; // (49) I key case 'i': case 'I': return 0x49; - case Qt::Key_J: - return VK_J; // (4A) J key case 'j': case 'J': return 0x4A; - case Qt::Key_K: - return VK_K; // (4B) K key case 'k': case 'K': return 0x4B; - case Qt::Key_L: - return VK_L; // (4C) L key case 'l': case 'L': return 0x4C; - case Qt::Key_M: - return VK_M; // (4D) M key case 'm': case 'M': return 0x4D; - case Qt::Key_N: - return VK_N; // (4E) N key case 'n': case 'N': return 0x4E; - case Qt::Key_O: - return VK_O; // (4F) O key case 'o': case 'O': return 0x4F; - case Qt::Key_P: - return VK_P; // (50) P key case 'p': case 'P': return 0x50; - case Qt::Key_Q: - return VK_Q; // (51) Q key case 'q': case 'Q': return 0x51; - case Qt::Key_R: - return VK_R; // (52) R key case 'r': case 'R': return 0x52; - case Qt::Key_S: - return VK_S; // (53) S key case 's': case 'S': return 0x53; - case Qt::Key_T: - return VK_T; // (54) T key case 't': case 'T': return 0x54; - case Qt::Key_U: - return VK_U; // (55) U key case 'u': case 'U': return 0x55; - case Qt::Key_V: - return VK_V; // (56) V key case 'v': case 'V': return 0x56; - case Qt::Key_W: - return VK_W; // (57) W key case 'w': case 'W': return 0x57; - case Qt::Key_X: - return VK_X; // (58) X key case 'x': case 'X': return 0x58; - case Qt::Key_Y: - return VK_Y; // (59) Y key case 'y': case 'Y': return 0x59; - case Qt::Key_Z: - return VK_Z; // (5A) Z key case 'z': case 'Z': return 0x5A; - case Qt::Key_Meta: - return VK_LWIN; // (5B) Left Windows key (Microsoft Natural keyboard) - //case Qt::Key_Meta_R: FIXME: What to do here? + case Qt::Key_Pause: + return VK_PAUSE; // (13) PAUSE key + case Qt::Key_CapsLock: + return VK_CAPITAL; // (14) CAPS LOCK key + case Qt::Key_Kana_Lock: + case Qt::Key_Kana_Shift: + return VK_KANA; // (15) Input Method Editor (IME) Kana mode + case Qt::Key_Hangul: + return VK_HANGUL; // VK_HANGUL (15) IME Hangul mode + // VK_JUNJA (17) IME Junja mode + // VK_FINAL (18) IME final mode + case Qt::Key_Hangul_Hanja: + return VK_HANJA; // (19) IME Hanja mode + case Qt::Key_Kanji: + return VK_KANJI; // (19) IME Kanji mode + case Qt::Key_Escape: + return VK_ESCAPE; // (1B) ESC key + // VK_CONVERT (1C) IME convert + // VK_NONCONVERT (1D) IME nonconvert + // VK_ACCEPT (1E) IME accept + // VK_MODECHANGE (1F) IME mode change request + case Qt::Key_Space: + return VK_SPACE; // (20) SPACEBAR + case Qt::Key_PageUp: + return VK_PRIOR; // (21) PAGE UP key + case Qt::Key_PageDown: + return VK_NEXT; // (22) PAGE DOWN key + case Qt::Key_End: + return VK_END; // (23) END key + case Qt::Key_Home: + return VK_HOME; // (24) HOME key + case Qt::Key_Left: + return VK_LEFT; // (25) LEFT ARROW key + case Qt::Key_Up: + return VK_UP; // (26) UP ARROW key + case Qt::Key_Right: + return VK_RIGHT; // (27) RIGHT ARROW key + case Qt::Key_Down: + return VK_DOWN; // (28) DOWN ARROW key + case Qt::Key_Select: + return VK_SELECT; // (29) SELECT key + case Qt::Key_Print: + return VK_PRINT; // (2A) PRINT key + case Qt::Key_Execute: + return VK_EXECUTE; // (2B) EXECUTE key + // dunno on this + // case Qt::Key_PrintScreen: + // return VK_SNAPSHOT; // (2C) PRINT SCREEN key + case Qt::Key_Insert: + return VK_INSERT; // (2D) INS key + case Qt::Key_Delete: + return VK_DELETE; // (2E) DEL key + case Qt::Key_Help: + return VK_HELP; // (2F) HELP key + case Qt::Key_0: + case Qt::Key_ParenLeft: + return VK_0; // (30) 0) key + case Qt::Key_1: + return VK_1; // (31) 1 ! key + case Qt::Key_2: + case Qt::Key_At: + return VK_2; // (32) 2 & key + case Qt::Key_3: + case Qt::Key_NumberSign: + return VK_3; // case '3': case '#'; + case Qt::Key_4: + case Qt::Key_Dollar: // (34) 4 key '$'; + return VK_4; + case Qt::Key_5: + case Qt::Key_Percent: + return VK_5; // (35) 5 key '%' + case Qt::Key_6: + case Qt::Key_AsciiCircum: + return VK_6; // (36) 6 key '^' + case Qt::Key_7: + case Qt::Key_Ampersand: + return VK_7; // (37) 7 key case '&' + case Qt::Key_8: + case Qt::Key_Asterisk: + return VK_8; // (38) 8 key '*' + case Qt::Key_9: + case Qt::Key_ParenRight: + return VK_9; // (39) 9 key '(' + case Qt::Key_A: + return VK_A; // (41) A key case 'a': case 'A': return 0x41; + case Qt::Key_B: + return VK_B; // (42) B key case 'b': case 'B': return 0x42; + case Qt::Key_C: + return VK_C; // (43) C key case 'c': case 'C': return 0x43; + case Qt::Key_D: + return VK_D; // (44) D key case 'd': case 'D': return 0x44; + case Qt::Key_E: + return VK_E; // (45) E key case 'e': case 'E': return 0x45; + case Qt::Key_F: + return VK_F; // (46) F key case 'f': case 'F': return 0x46; + case Qt::Key_G: + return VK_G; // (47) G key case 'g': case 'G': return 0x47; + case Qt::Key_H: + return VK_H; // (48) H key case 'h': case 'H': return 0x48; + case Qt::Key_I: + return VK_I; // (49) I key case 'i': case 'I': return 0x49; + case Qt::Key_J: + return VK_J; // (4A) J key case 'j': case 'J': return 0x4A; + case Qt::Key_K: + return VK_K; // (4B) K key case 'k': case 'K': return 0x4B; + case Qt::Key_L: + return VK_L; // (4C) L key case 'l': case 'L': return 0x4C; + case Qt::Key_M: + return VK_M; // (4D) M key case 'm': case 'M': return 0x4D; + case Qt::Key_N: + return VK_N; // (4E) N key case 'n': case 'N': return 0x4E; + case Qt::Key_O: + return VK_O; // (4F) O key case 'o': case 'O': return 0x4F; + case Qt::Key_P: + return VK_P; // (50) P key case 'p': case 'P': return 0x50; + case Qt::Key_Q: + return VK_Q; // (51) Q key case 'q': case 'Q': return 0x51; + case Qt::Key_R: + return VK_R; // (52) R key case 'r': case 'R': return 0x52; + case Qt::Key_S: + return VK_S; // (53) S key case 's': case 'S': return 0x53; + case Qt::Key_T: + return VK_T; // (54) T key case 't': case 'T': return 0x54; + case Qt::Key_U: + return VK_U; // (55) U key case 'u': case 'U': return 0x55; + case Qt::Key_V: + return VK_V; // (56) V key case 'v': case 'V': return 0x56; + case Qt::Key_W: + return VK_W; // (57) W key case 'w': case 'W': return 0x57; + case Qt::Key_X: + return VK_X; // (58) X key case 'x': case 'X': return 0x58; + case Qt::Key_Y: + return VK_Y; // (59) Y key case 'y': case 'Y': return 0x59; + case Qt::Key_Z: + return VK_Z; // (5A) Z key case 'z': case 'Z': return 0x5A; + case Qt::Key_Meta: + return VK_LWIN; // (5B) Left Windows key (Microsoft Natural keyboard) + // case Qt::Key_Meta_R: FIXME: What to do here? // return VK_RWIN; // (5C) Right Windows key (Natural keyboard) - // VK_APPS (5D) Applications key (Natural keyboard) - // VK_SLEEP (5F) Computer Sleep key - // VK_SEPARATOR (6C) Separator key - // VK_SUBTRACT (6D) Subtract key - // VK_DECIMAL (6E) Decimal key - // VK_DIVIDE (6F) Divide key - // handled by key code above + // VK_APPS (5D) Applications key (Natural keyboard) + // VK_SLEEP (5F) Computer Sleep key + // VK_SEPARATOR (6C) Separator key + // VK_SUBTRACT (6D) Subtract key + // VK_DECIMAL (6E) Decimal key + // VK_DIVIDE (6F) Divide key + // handled by key code above - case Qt::Key_NumLock: - return VK_NUMLOCK; // (90) NUM LOCK key + case Qt::Key_NumLock: + return VK_NUMLOCK; // (90) NUM LOCK key - case Qt::Key_ScrollLock: - return VK_SCROLL; // (91) SCROLL LOCK key + case Qt::Key_ScrollLock: + return VK_SCROLL; // (91) SCROLL LOCK key - // VK_LSHIFT (A0) Left SHIFT key - // VK_RSHIFT (A1) Right SHIFT key - // VK_LCONTROL (A2) Left CONTROL key - // VK_RCONTROL (A3) Right CONTROL key - // VK_LMENU (A4) Left MENU key - // VK_RMENU (A5) Right MENU key - // VK_BROWSER_BACK (A6) Windows 2000/XP: Browser Back key - // VK_BROWSER_FORWARD (A7) Windows 2000/XP: Browser Forward key - // VK_BROWSER_REFRESH (A8) Windows 2000/XP: Browser Refresh key - // VK_BROWSER_STOP (A9) Windows 2000/XP: Browser Stop key - // VK_BROWSER_SEARCH (AA) Windows 2000/XP: Browser Search key - // VK_BROWSER_FAVORITES (AB) Windows 2000/XP: Browser Favorites key - // VK_BROWSER_HOME (AC) Windows 2000/XP: Browser Start and Home key - // VK_VOLUME_MUTE (AD) Windows 2000/XP: Volume Mute key - // VK_VOLUME_DOWN (AE) Windows 2000/XP: Volume Down key - // VK_VOLUME_UP (AF) Windows 2000/XP: Volume Up key - // VK_MEDIA_NEXT_TRACK (B0) Windows 2000/XP: Next Track key - // VK_MEDIA_PREV_TRACK (B1) Windows 2000/XP: Previous Track key - // VK_MEDIA_STOP (B2) Windows 2000/XP: Stop Media key - // VK_MEDIA_PLAY_PAUSE (B3) Windows 2000/XP: Play/Pause Media key - // VK_LAUNCH_MAIL (B4) Windows 2000/XP: Start Mail key - // VK_LAUNCH_MEDIA_SELECT (B5) Windows 2000/XP: Select Media key - // VK_LAUNCH_APP1 (B6) Windows 2000/XP: Start Application 1 key - // VK_LAUNCH_APP2 (B7) Windows 2000/XP: Start Application 2 key + // VK_LSHIFT (A0) Left SHIFT key + // VK_RSHIFT (A1) Right SHIFT key + // VK_LCONTROL (A2) Left CONTROL key + // VK_RCONTROL (A3) Right CONTROL key + // VK_LMENU (A4) Left MENU key + // VK_RMENU (A5) Right MENU key + // VK_BROWSER_BACK (A6) Windows 2000/XP: Browser Back key + // VK_BROWSER_FORWARD (A7) Windows 2000/XP: Browser Forward key + // VK_BROWSER_REFRESH (A8) Windows 2000/XP: Browser Refresh key + // VK_BROWSER_STOP (A9) Windows 2000/XP: Browser Stop key + // VK_BROWSER_SEARCH (AA) Windows 2000/XP: Browser Search key + // VK_BROWSER_FAVORITES (AB) Windows 2000/XP: Browser Favorites key + // VK_BROWSER_HOME (AC) Windows 2000/XP: Browser Start and Home key + // VK_VOLUME_MUTE (AD) Windows 2000/XP: Volume Mute key + // VK_VOLUME_DOWN (AE) Windows 2000/XP: Volume Down key + // VK_VOLUME_UP (AF) Windows 2000/XP: Volume Up key + // VK_MEDIA_NEXT_TRACK (B0) Windows 2000/XP: Next Track key + // VK_MEDIA_PREV_TRACK (B1) Windows 2000/XP: Previous Track key + // VK_MEDIA_STOP (B2) Windows 2000/XP: Stop Media key + // VK_MEDIA_PLAY_PAUSE (B3) Windows 2000/XP: Play/Pause Media key + // VK_LAUNCH_MAIL (B4) Windows 2000/XP: Start Mail key + // VK_LAUNCH_MEDIA_SELECT (B5) Windows 2000/XP: Select Media key + // VK_LAUNCH_APP1 (B6) Windows 2000/XP: Start Application 1 key + // VK_LAUNCH_APP2 (B7) Windows 2000/XP: Start Application 2 key - // VK_OEM_1 (BA) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ';:' key - case Qt::Key_Semicolon: - case Qt::Key_Colon: - return VK_OEM_1; //case ';': case ':': return 0xBA; - // VK_OEM_PLUS (BB) Windows 2000/XP: For any country/region, the '+' key - case Qt::Key_Plus: - case Qt::Key_Equal: - return VK_OEM_PLUS; //case '=': case '+': return 0xBB; - // VK_OEM_COMMA (BC) Windows 2000/XP: For any country/region, the ',' key - case Qt::Key_Comma: - case Qt::Key_Less: - return VK_OEM_COMMA; //case ',': case '<': return 0xBC; - // VK_OEM_MINUS (BD) Windows 2000/XP: For any country/region, the '-' key - case Qt::Key_Minus: - case Qt::Key_Underscore: - return VK_OEM_MINUS; //case '-': case '_': return 0xBD; - // VK_OEM_PERIOD (BE) Windows 2000/XP: For any country/region, the '.' key - case Qt::Key_Period: - case Qt::Key_Greater: - return VK_OEM_PERIOD; //case '.': case '>': return 0xBE; - // VK_OEM_2 (BF) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '/?' key - case Qt::Key_Slash: - case Qt::Key_Question: - return VK_OEM_2; //case '/': case '?': return 0xBF; - // VK_OEM_3 (C0) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '`~' key - case Qt::Key_AsciiTilde: - case Qt::Key_QuoteLeft: - return VK_OEM_3; //case '`': case '~': return 0xC0; - // VK_OEM_4 (DB) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '[{' key - case Qt::Key_BracketLeft: - case Qt::Key_BraceLeft: - return VK_OEM_4; //case '[': case '{': return 0xDB; - // VK_OEM_5 (DC) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key - case Qt::Key_Backslash: - case Qt::Key_Bar: - return VK_OEM_5; //case '\\': case '|': return 0xDC; - // VK_OEM_6 (DD) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ']}' key - case Qt::Key_BracketRight: - case Qt::Key_BraceRight: - return VK_OEM_6; // case ']': case '}': return 0xDD; - // VK_OEM_7 (DE) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key - case Qt::Key_QuoteDbl: - return VK_OEM_7; // case '\'': case '"': return 0xDE; - // VK_OEM_8 (DF) Used for miscellaneous characters; it can vary by keyboard. - // VK_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard - // VK_PROCESSKEY (E5) Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key - // VK_PACKET (E7) Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT,SendInput, WM_KEYDOWN, and WM_KEYUP - // VK_ATTN (F6) Attn key - // VK_CRSEL (F7) CrSel key - // VK_EXSEL (F8) ExSel key - // VK_EREOF (F9) Erase EOF key - // VK_PLAY (FA) Play key - // VK_ZOOM (FB) Zoom key - // VK_NONAME (FC) Reserved for future use - // VK_PA1 (FD) PA1 key - // VK_OEM_CLEAR (FE) Clear key - default: - return 0; + // VK_OEM_1 (BA) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ';:' key + case Qt::Key_Semicolon: + case Qt::Key_Colon: + return VK_OEM_1; // case ';': case ':': return 0xBA; + // VK_OEM_PLUS (BB) Windows 2000/XP: For any country/region, the '+' key + case Qt::Key_Plus: + case Qt::Key_Equal: + return VK_OEM_PLUS; // case '=': case '+': return 0xBB; + // VK_OEM_COMMA (BC) Windows 2000/XP: For any country/region, the ',' key + case Qt::Key_Comma: + case Qt::Key_Less: + return VK_OEM_COMMA; // case ',': case '<': return 0xBC; + // VK_OEM_MINUS (BD) Windows 2000/XP: For any country/region, the '-' key + case Qt::Key_Minus: + case Qt::Key_Underscore: + return VK_OEM_MINUS; // case '-': case '_': return 0xBD; + // VK_OEM_PERIOD (BE) Windows 2000/XP: For any country/region, the '.' key + case Qt::Key_Period: + case Qt::Key_Greater: + return VK_OEM_PERIOD; // case '.': case '>': return 0xBE; + // VK_OEM_2 (BF) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '/?' key + case Qt::Key_Slash: + case Qt::Key_Question: + return VK_OEM_2; // case '/': case '?': return 0xBF; + // VK_OEM_3 (C0) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '`~' key + case Qt::Key_AsciiTilde: + case Qt::Key_QuoteLeft: + return VK_OEM_3; // case '`': case '~': return 0xC0; + // VK_OEM_4 (DB) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '[{' key + case Qt::Key_BracketLeft: + case Qt::Key_BraceLeft: + return VK_OEM_4; // case '[': case '{': return 0xDB; + // VK_OEM_5 (DC) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key + case Qt::Key_Backslash: + case Qt::Key_Bar: + return VK_OEM_5; // case '\\': case '|': return 0xDC; + // VK_OEM_6 (DD) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ']}' key + case Qt::Key_BracketRight: + case Qt::Key_BraceRight: + return VK_OEM_6; // case ']': case '}': return 0xDD; + // VK_OEM_7 (DE) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key + case Qt::Key_QuoteDbl: + return VK_OEM_7; // case '\'': case '"': return 0xDE; + // VK_OEM_8 (DF) Used for miscellaneous characters; it can vary by keyboard. + // VK_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard + // VK_PROCESSKEY (E5) Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key + // VK_PACKET (E7) Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT,SendInput, WM_KEYDOWN, and WM_KEYUP + // VK_ATTN (F6) Attn key + // VK_CRSEL (F7) CrSel key + // VK_EXSEL (F8) ExSel key + // VK_EREOF (F9) Erase EOF key + // VK_PLAY (FA) Play key + // VK_ZOOM (FB) Zoom key + // VK_NONAME (FC) Reserved for future use + // VK_PA1 (FD) PA1 key + // VK_OEM_CLEAR (FE) Clear key + default: + return 0; } - } PlatformKeyboardEvent::PlatformKeyboardEvent(QKeyEvent* event) @@ -511,13 +509,13 @@ PlatformKeyboardEvent::PlatformKeyboardEvent(QKeyEvent* event) m_unmodifiedText = event->text(); // FIXME: not correct m_keyIdentifier = keyIdentifierForQtKeyCode(event->key()); m_autoRepeat = event->isAutoRepeat(); - m_ctrlKey = (state & Qt::ControlModifier) != 0; - m_altKey = (state & Qt::AltModifier) != 0; - m_metaKey = (state & Qt::MetaModifier) != 0; - m_isKeypad = (state & Qt::KeypadModifier) != 0; + m_ctrlKey = (state & Qt::ControlModifier); + m_altKey = (state & Qt::AltModifier); + m_metaKey = (state & Qt::MetaModifier); + m_isKeypad = (state & Qt::KeypadModifier); m_windowsVirtualKeyCode = windowsKeyCodeForKeyEvent(event->key(), m_isKeypad); m_nativeVirtualKeyCode = event->nativeVirtualKey(); - m_shiftKey = (state & Qt::ShiftModifier) != 0 || event->key() == Qt::Key_Backtab; // Simulate Shift+Tab with Key_Backtab + m_shiftKey = (state & Qt::ShiftModifier) || event->key() == Qt::Key_Backtab; // Simulate Shift+Tab with Key_Backtab m_qtEvent = event; } diff --git a/WebCore/platform/qt/PlatformMouseEventQt.cpp b/WebCore/platform/qt/PlatformMouseEventQt.cpp index e486e68..a8956bf 100644 --- a/WebCore/platform/qt/PlatformMouseEventQt.cpp +++ b/WebCore/platform/qt/PlatformMouseEventQt.cpp @@ -28,10 +28,9 @@ #include "config.h" #include "PlatformMouseEvent.h" -#include <wtf/CurrentTime.h> - -#include <QMouseEvent> #include <QGraphicsSceneMouseEvent> +#include <QMouseEvent> +#include <wtf/CurrentTime.h> namespace WebCore { @@ -65,10 +64,10 @@ PlatformMouseEvent::PlatformMouseEvent(QGraphicsSceneMouseEvent* event, int clic m_button = NoButton; m_clickCount = clickCount; - m_shiftKey = (event->modifiers() & Qt::ShiftModifier) != 0; - m_ctrlKey = (event->modifiers() & Qt::ControlModifier) != 0; - m_altKey = (event->modifiers() & Qt::AltModifier) != 0; - m_metaKey = (event->modifiers() & Qt::MetaModifier) != 0; + m_shiftKey = (event->modifiers() & Qt::ShiftModifier); + m_ctrlKey = (event->modifiers() & Qt::ControlModifier); + m_altKey = (event->modifiers() & Qt::AltModifier); + m_metaKey = (event->modifiers() & Qt::MetaModifier); } PlatformMouseEvent::PlatformMouseEvent(QInputEvent* event, int clickCount) @@ -94,7 +93,7 @@ PlatformMouseEvent::PlatformMouseEvent(QInputEvent* event, int clickCount) #ifndef QT_NO_CONTEXTMENU case QEvent::ContextMenu: { m_eventType = MouseEventPressed; - QContextMenuEvent *ce = static_cast<QContextMenuEvent *>(event); + QContextMenuEvent* ce = static_cast<QContextMenuEvent*>(event); m_position = IntPoint(ce->pos()); m_globalPosition = IntPoint(ce->globalPos()); m_button = RightButton; @@ -120,10 +119,10 @@ PlatformMouseEvent::PlatformMouseEvent(QInputEvent* event, int clickCount) } m_clickCount = clickCount; - m_shiftKey = (event->modifiers() & Qt::ShiftModifier) != 0; - m_ctrlKey = (event->modifiers() & Qt::ControlModifier) != 0; - m_altKey = (event->modifiers() & Qt::AltModifier) != 0; - m_metaKey = (event->modifiers() & Qt::MetaModifier) != 0; + m_shiftKey = (event->modifiers() & Qt::ShiftModifier); + m_ctrlKey = (event->modifiers() & Qt::ControlModifier); + m_altKey = (event->modifiers() & Qt::AltModifier); + m_metaKey = (event->modifiers() & Qt::MetaModifier); } } diff --git a/WebCore/platform/qt/RenderThemeQt.cpp b/WebCore/platform/qt/RenderThemeQt.cpp index ee66a35..9319493 100644 --- a/WebCore/platform/qt/RenderThemeQt.cpp +++ b/WebCore/platform/qt/RenderThemeQt.cpp @@ -47,16 +47,16 @@ #endif #include "NotImplemented.h" #include "Page.h" -#include "QtStyleOptionWebComboBox.h" #include "QWebPageClient.h" +#include "QtStyleOptionWebComboBox.h" #include "RenderBox.h" #if ENABLE(PROGRESS_TAG) #include "RenderProgress.h" #endif #include "RenderSlider.h" #include "RenderTheme.h" -#include "TimeRanges.h" #include "ScrollbarThemeQt.h" +#include "TimeRanges.h" #include "UserAgentStyleSheets.h" #include "qwebpage.h" @@ -727,6 +727,9 @@ void RenderThemeQt::adjustProgressBarStyle(CSSStyleSelector*, RenderStyle* style bool RenderThemeQt::paintProgressBar(RenderObject* o, const RenderObject::PaintInfo& pi, const IntRect& r) { + if (!o->isProgress()) + return true; + StylePainter p(this, pi); if (!p.isValid()) return true; diff --git a/WebCore/platform/qt/ScreenQt.cpp b/WebCore/platform/qt/ScreenQt.cpp index def1995..d648c53 100644 --- a/WebCore/platform/qt/ScreenQt.cpp +++ b/WebCore/platform/qt/ScreenQt.cpp @@ -23,18 +23,18 @@ * 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 "Screen.h" -#include "Page.h" +#include "FloatRect.h" #include "Frame.h" #include "FrameView.h" -#include "Widget.h" #include "IntRect.h" -#include "FloatRect.h" +#include "Page.h" +#include "Widget.h" #include <QApplication> #include <QDesktopWidget> diff --git a/WebCore/platform/qt/ScrollbarQt.cpp b/WebCore/platform/qt/ScrollbarQt.cpp index 8eac15f..70aa5db 100644 --- a/WebCore/platform/qt/ScrollbarQt.cpp +++ b/WebCore/platform/qt/ScrollbarQt.cpp @@ -29,8 +29,8 @@ #include "Scrollbar.h" #include "EventHandler.h" -#include "FrameView.h" #include "Frame.h" +#include "FrameView.h" #include "GraphicsContext.h" #include "IntRect.h" #include "PlatformMouseEvent.h" @@ -38,9 +38,9 @@ #include <QApplication> #include <QDebug> +#include <QMenu> #include <QPainter> #include <QStyle> -#include <QMenu> using namespace std; diff --git a/WebCore/platform/qt/ScrollbarThemeQt.cpp b/WebCore/platform/qt/ScrollbarThemeQt.cpp index eb2d934..67226b0 100644 --- a/WebCore/platform/qt/ScrollbarThemeQt.cpp +++ b/WebCore/platform/qt/ScrollbarThemeQt.cpp @@ -22,7 +22,7 @@ * 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" @@ -31,15 +31,15 @@ #include "GraphicsContext.h" #include "PlatformMouseEvent.h" #include "RenderThemeQt.h" -#include "Scrollbar.h" #include "ScrollView.h" +#include "Scrollbar.h" #include <QApplication> #include <QDebug> +#include <QMenu> #include <QPainter> #include <QStyle> #include <QStyleOptionSlider> -#include <QMenu> namespace WebCore { @@ -56,20 +56,20 @@ ScrollbarThemeQt::~ScrollbarThemeQt() static QStyle::SubControl scPart(const ScrollbarPart& part) { switch (part) { - case NoPart: - return QStyle::SC_None; - case BackButtonStartPart: - case BackButtonEndPart: - return QStyle::SC_ScrollBarSubLine; - case BackTrackPart: - return QStyle::SC_ScrollBarSubPage; - case ThumbPart: - return QStyle::SC_ScrollBarSlider; - case ForwardTrackPart: - return QStyle::SC_ScrollBarAddPage; - case ForwardButtonStartPart: - case ForwardButtonEndPart: - return QStyle::SC_ScrollBarAddLine; + case NoPart: + return QStyle::SC_None; + case BackButtonStartPart: + case BackButtonEndPart: + return QStyle::SC_ScrollBarSubLine; + case BackTrackPart: + return QStyle::SC_ScrollBarSubPage; + case ThumbPart: + return QStyle::SC_ScrollBarSlider; + case ForwardTrackPart: + return QStyle::SC_ScrollBarAddPage; + case ForwardButtonStartPart: + case ForwardButtonEndPart: + return QStyle::SC_ScrollBarAddLine; } return QStyle::SC_None; @@ -78,18 +78,18 @@ static QStyle::SubControl scPart(const ScrollbarPart& part) static ScrollbarPart scrollbarPart(const QStyle::SubControl& sc) { switch (sc) { - case QStyle::SC_None: - return NoPart; - case QStyle::SC_ScrollBarSubLine: - return BackButtonStartPart; - case QStyle::SC_ScrollBarSubPage: - return BackTrackPart; - case QStyle::SC_ScrollBarSlider: - return ThumbPart; - case QStyle::SC_ScrollBarAddPage: - return ForwardTrackPart; - case QStyle::SC_ScrollBarAddLine: - return ForwardButtonStartPart; + case QStyle::SC_None: + return NoPart; + case QStyle::SC_ScrollBarSubLine: + return BackButtonStartPart; + case QStyle::SC_ScrollBarSubPage: + return BackTrackPart; + case QStyle::SC_ScrollBarSlider: + return ThumbPart; + case QStyle::SC_ScrollBarAddPage: + return ForwardTrackPart; + case QStyle::SC_ScrollBarAddLine: + return ForwardButtonStartPart; } return NoPart; } @@ -122,9 +122,9 @@ static QStyleOptionSlider* styleOptionSlider(Scrollbar* scrollbar, QWidget* widg ScrollbarPart hoveredPart = scrollbar->hoveredPart(); if (pressedPart != NoPart) { opt.activeSubControls = scPart(scrollbar->pressedPart()); - if (pressedPart == BackButtonStartPart || pressedPart == ForwardButtonStartPart || - pressedPart == BackButtonEndPart || pressedPart == ForwardButtonEndPart || - pressedPart == ThumbPart) + if (pressedPart == BackButtonStartPart || pressedPart == ForwardButtonStartPart + || pressedPart == BackButtonEndPart || pressedPart == ForwardButtonEndPart + || pressedPart == ThumbPart) opt.state |= QStyle::State_Sunken; } else opt.activeSubControls = scPart(hoveredPart); diff --git a/WebCore/platform/qt/SharedTimerQt.cpp b/WebCore/platform/qt/SharedTimerQt.cpp index 7c0fd05..8a6bd81 100644 --- a/WebCore/platform/qt/SharedTimerQt.cpp +++ b/WebCore/platform/qt/SharedTimerQt.cpp @@ -24,18 +24,17 @@ * 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 <wtf/CurrentTime.h> - #include <QBasicTimer> #include <QCoreApplication> #include <QDebug> #include <QPointer> +#include <wtf/CurrentTime.h> namespace WebCore { diff --git a/WebCore/platform/qt/SoundQt.cpp b/WebCore/platform/qt/SoundQt.cpp index 0996328..bf9e142 100644 --- a/WebCore/platform/qt/SoundQt.cpp +++ b/WebCore/platform/qt/SoundQt.cpp @@ -26,11 +26,10 @@ */ #include "config.h" +#include "Sound.h" #include <QApplication> -#include "Sound.h" - namespace WebCore { void systemBeep() diff --git a/WebCore/platform/qt/TemporaryLinkStubsQt.cpp b/WebCore/platform/qt/TemporaryLinkStubsQt.cpp index 432bd2b..51e25b8 100644 --- a/WebCore/platform/qt/TemporaryLinkStubsQt.cpp +++ b/WebCore/platform/qt/TemporaryLinkStubsQt.cpp @@ -33,27 +33,21 @@ #include "config.h" #include "AXObjectCache.h" -#include "DNS.h" #include "CachedResource.h" #include "CookieJar.h" #include "Cursor.h" +#include "DNS.h" +#include "FTPDirectoryDocument.h" +#include "FileSystem.h" #include "Font.h" #include "Frame.h" #include "FrameLoader.h" -#include "FTPDirectoryDocument.h" -#include "IntPoint.h" -#include "Widget.h" -#include "GraphicsContext.h" -#include "Cursor.h" -#include "loader.h" -#include "FileSystem.h" #include "FrameView.h" #include "GraphicsContext.h" #include "IconLoader.h" #include "IntPoint.h" #include "KURL.h" #include "Language.h" -#include "loader.h" #include "LocalizedStrings.h" #include "Node.h" #include "NotImplemented.h" @@ -67,9 +61,11 @@ #include "SystemTime.h" #include "TextBoundaries.h" #include "Widget.h" +#include "loader.h" + +#include <float.h> #include <stdio.h> #include <stdlib.h> -#include <float.h> #include <wtf/text/CString.h> using namespace WebCore; diff --git a/WebCore/platform/qt/WheelEventQt.cpp b/WebCore/platform/qt/WheelEventQt.cpp index 9349c70..57a7ebc 100644 --- a/WebCore/platform/qt/WheelEventQt.cpp +++ b/WebCore/platform/qt/WheelEventQt.cpp @@ -18,14 +18,15 @@ */ #include "config.h" -#include "PlatformWheelEvent.h" +#include "WheelEvent.h" #include "PlatformMouseEvent.h" +#include "PlatformWheelEvent.h" #include "Scrollbar.h" -#include <qapplication.h> -#include <QWheelEvent> #include <QGraphicsSceneWheelEvent> +#include <QWheelEvent> +#include <qapplication.h> namespace WebCore { @@ -57,11 +58,7 @@ void PlatformWheelEvent::applyDelta(int delta, Qt::Orientation orientation) } PlatformWheelEvent::PlatformWheelEvent(QGraphicsSceneWheelEvent* e) -#ifdef QT_NO_WHEELEVENT -{ - Q_UNUSED(e); -} -#else +#ifndef QT_NO_WHEELEVENT : m_position(e->pos().toPoint()) , m_globalPosition(e->screenPos()) , m_granularity(ScrollByPixelWheelEvent) @@ -70,17 +67,17 @@ PlatformWheelEvent::PlatformWheelEvent(QGraphicsSceneWheelEvent* e) , m_ctrlKey(e->modifiers() & Qt::ControlModifier) , m_altKey(e->modifiers() & Qt::AltModifier) , m_metaKey(e->modifiers() & Qt::MetaModifier) +#endif { +#ifndef QT_NO_WHEELEVENT applyDelta(e->delta(), e->orientation()); +#else + Q_UNUSED(e); +#endif } -#endif // QT_NO_WHEELEVENT PlatformWheelEvent::PlatformWheelEvent(QWheelEvent* e) -#ifdef QT_NO_WHEELEVENT -{ - Q_UNUSED(e); -} -#else +#ifndef QT_NO_WHEELEVENT : m_position(e->pos()) , m_globalPosition(e->globalPos()) , m_granularity(ScrollByPixelWheelEvent) @@ -89,9 +86,13 @@ PlatformWheelEvent::PlatformWheelEvent(QWheelEvent* e) , m_ctrlKey(e->modifiers() & Qt::ControlModifier) , m_altKey(e->modifiers() & Qt::AltModifier) , m_metaKey(e->modifiers() & Qt::MetaModifier) +#endif { +#ifndef QT_NO_WHEELEVENT applyDelta(e->delta(), e->orientation()); +#else + Q_UNUSED(e); +#endif } -#endif // QT_NO_WHEELEVENT } // namespace WebCore diff --git a/WebCore/platform/qt/WidgetQt.cpp b/WebCore/platform/qt/WidgetQt.cpp index 43252a8..00a58a4 100644 --- a/WebCore/platform/qt/WidgetQt.cpp +++ b/WebCore/platform/qt/WidgetQt.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2006 Dirk Mueller <mueller@kde.org> - * Copyright (C) 2006 George Stiakos <staikos@kde.org> + * Copyright (C) 2006 George Staikos <staikos@kde.org> * Copyright (C) 2006 Zack Rusin <zack@kde.org> * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> * Copyright (C) 2008 Holger Hans Peter Freyther @@ -37,19 +37,18 @@ #include "GraphicsContext.h" #include "HostWindow.h" #include "IntRect.h" -#include "ScrollView.h" #include "NotImplemented.h" #include "QWebPageClient.h" +#include "ScrollView.h" #include "qwebframe.h" #include "qwebframe_p.h" #include "qwebpage.h" #include <QCoreApplication> -#include <QPainter> -#include <QPaintEngine> - #include <QDebug> +#include <QPaintEngine> +#include <QPainter> namespace WebCore { diff --git a/WebCore/platform/text/SegmentedString.cpp b/WebCore/platform/text/SegmentedString.cpp index d75032f..9ff1c45 100644 --- a/WebCore/platform/text/SegmentedString.cpp +++ b/WebCore/platform/text/SegmentedString.cpp @@ -51,6 +51,7 @@ const SegmentedString& SegmentedString::operator=(const SegmentedString &other) m_currentChar = &m_pushedChar2; else m_currentChar = other.m_currentChar; + m_closed = other.m_closed; return *this; } @@ -152,8 +153,7 @@ void SegmentedString::prepend(const SegmentedString &s) void SegmentedString::advanceSubstring() { if (m_composite) { - m_currentString = m_substrings.first(); - m_substrings.removeFirst(); + m_currentString = m_substrings.takeFirst(); if (m_substrings.isEmpty()) m_composite = false; } else { diff --git a/WebCore/platform/text/qt/TextBreakIteratorQt.cpp b/WebCore/platform/text/qt/TextBreakIteratorQt.cpp index 5a8a812..dda443f 100644 --- a/WebCore/platform/text/qt/TextBreakIteratorQt.cpp +++ b/WebCore/platform/text/qt/TextBreakIteratorQt.cpp @@ -33,31 +33,49 @@ namespace WebCore { + static unsigned char buffer[1024]; + class TextBreakIterator : public QTextBoundaryFinder { + public: + TextBreakIterator(QTextBoundaryFinder::BoundaryType type, const UChar* string, int length) + : QTextBoundaryFinder(type, (const QChar*)string, length, buffer, sizeof(buffer)) + , length(length) + , string(string) {} + TextBreakIterator() + : QTextBoundaryFinder() + , length(0) + , string(0) {} + + int length; + const UChar* string; }; - static QTextBoundaryFinder* iterator = 0; - static unsigned char buffer[1024]; - TextBreakIterator* wordBreakIterator(const UChar* string, int length) + TextBreakIterator* setUpIterator(TextBreakIterator& iterator, QTextBoundaryFinder::BoundaryType type, const UChar* string, int length) { if (!string || !length) return 0; - if (!iterator) - iterator = new QTextBoundaryFinder; - *iterator = QTextBoundaryFinder(QTextBoundaryFinder::Word, (const QChar *)string, length, buffer, sizeof(buffer)); - return static_cast<TextBreakIterator*>(iterator); + if (iterator.isValid() && type == iterator.type() && length == iterator.length + && memcmp(string, iterator.string, length) == 0) { + iterator.toStart(); + return &iterator; + } + + iterator = TextBreakIterator(type, string, length); + + return &iterator; } - TextBreakIterator* characterBreakIterator(const UChar* string, int length) + TextBreakIterator* wordBreakIterator(const UChar* string, int length) { - if (!string || !length) - return 0; - if (!iterator) - iterator = new QTextBoundaryFinder; + static TextBreakIterator staticWordBreakIterator; + return setUpIterator(staticWordBreakIterator, QTextBoundaryFinder::Word, string, length); + } - *iterator = QTextBoundaryFinder(QTextBoundaryFinder::Grapheme, (const QChar *)string, length, buffer, sizeof(buffer)); - return static_cast<TextBreakIterator*>(iterator); + TextBreakIterator* characterBreakIterator(const UChar* string, int length) + { + static TextBreakIterator staticCharacterBreakIterator; + return setUpIterator(staticCharacterBreakIterator, QTextBoundaryFinder::Grapheme, string, length); } TextBreakIterator* cursorMovementIterator(const UChar* string, int length) @@ -67,25 +85,15 @@ namespace WebCore { TextBreakIterator* lineBreakIterator(const UChar* string, int length) { - static QTextBoundaryFinder *iterator = 0; - if (!string || !length) - return 0; - if (!iterator) - iterator = new QTextBoundaryFinder; - - *iterator = QTextBoundaryFinder(QTextBoundaryFinder::Line, (const QChar *)string, length, buffer, sizeof(buffer)); - return static_cast<TextBreakIterator*>(iterator); + static TextBreakIterator staticLineBreakIterator; + return setUpIterator(staticLineBreakIterator, QTextBoundaryFinder::Line, string, length); } TextBreakIterator* sentenceBreakIterator(const UChar* string, int length) { - if (!string || !length) - return 0; - if (!iterator) - iterator = new QTextBoundaryFinder; + static TextBreakIterator staticSentenceBreakIterator; + return setUpIterator(staticSentenceBreakIterator, QTextBoundaryFinder::Sentence, string, length); - *iterator = QTextBoundaryFinder(QTextBoundaryFinder::Sentence, (const QChar *)string, length, buffer, sizeof(buffer)); - return static_cast<TextBreakIterator*>(iterator); } int textBreakFirst(TextBreakIterator* bi) diff --git a/WebCore/platform/win/ClipboardUtilitiesWin.cpp b/WebCore/platform/win/ClipboardUtilitiesWin.cpp index d340c89..fbd0011 100644 --- a/WebCore/platform/win/ClipboardUtilitiesWin.cpp +++ b/WebCore/platform/win/ClipboardUtilitiesWin.cpp @@ -289,7 +289,7 @@ static bool urlFromPath(CFStringRef path, String& url) return true; } -String getURL(IDataObject* dataObject, bool& success, String* title) +String getURL(IDataObject* dataObject, DragData::FilenameConversionPolicy filenamePolicy, bool& success, String* title) { STGMEDIUM store; String url; @@ -311,32 +311,34 @@ String getURL(IDataObject* dataObject, bool& success, String* title) GlobalUnlock(store.hGlobal); ReleaseStgMedium(&store); success = true; - } else if (SUCCEEDED(dataObject->GetData(filenameWFormat(), &store))) { - //file using unicode - wchar_t* data = (wchar_t*)GlobalLock(store.hGlobal); - if (data && data[0] && (PathFileExists(data) || PathIsUNC(data))) { - RetainPtr<CFStringRef> pathAsCFString(AdoptCF, CFStringCreateWithCharacters(kCFAllocatorDefault, (const UniChar*)data, wcslen(data))); - if (urlFromPath(pathAsCFString.get(), url)) { - if (title) - *title = url; - success = true; + } else if (filenamePolicy == DragData::ConvertFilenames) { + if (SUCCEEDED(dataObject->GetData(filenameWFormat(), &store))) { + // file using unicode + wchar_t* data = (wchar_t*)GlobalLock(store.hGlobal); + if (data && data[0] && (PathFileExists(data) || PathIsUNC(data))) { + RetainPtr<CFStringRef> pathAsCFString(AdoptCF, CFStringCreateWithCharacters(kCFAllocatorDefault, (const UniChar*)data, wcslen(data))); + if (urlFromPath(pathAsCFString.get(), url)) { + if (title) + *title = url; + success = true; + } } - } - GlobalUnlock(store.hGlobal); - ReleaseStgMedium(&store); - } else if (SUCCEEDED(dataObject->GetData(filenameFormat(), &store))) { - //filename using ascii - char* data = (char*)GlobalLock(store.hGlobal); - if (data && data[0] && (PathFileExistsA(data) || PathIsUNCA(data))) { - RetainPtr<CFStringRef> pathAsCFString(AdoptCF, CFStringCreateWithCString(kCFAllocatorDefault, data, kCFStringEncodingASCII)); - if (urlFromPath(pathAsCFString.get(), url)) { - if (title) - *title = url; - success = true; + GlobalUnlock(store.hGlobal); + ReleaseStgMedium(&store); + } else if (SUCCEEDED(dataObject->GetData(filenameFormat(), &store))) { + // filename using ascii + char* data = (char*)GlobalLock(store.hGlobal); + if (data && data[0] && (PathFileExistsA(data) || PathIsUNCA(data))) { + RetainPtr<CFStringRef> pathAsCFString(AdoptCF, CFStringCreateWithCString(kCFAllocatorDefault, data, kCFStringEncodingASCII)); + if (urlFromPath(pathAsCFString.get(), url)) { + if (title) + *title = url; + success = true; + } } + GlobalUnlock(store.hGlobal); + ReleaseStgMedium(&store); } - GlobalUnlock(store.hGlobal); - ReleaseStgMedium(&store); } return url; } @@ -350,20 +352,21 @@ String getPlainText(IDataObject* dataObject, bool& success) //unicode text UChar* data = (UChar*)GlobalLock(store.hGlobal); text = String(data); - GlobalUnlock(store.hGlobal); + GlobalUnlock(store.hGlobal); ReleaseStgMedium(&store); success = true; } else if (SUCCEEDED(dataObject->GetData(plainTextFormat(), &store))) { //ascii text char* data = (char*)GlobalLock(store.hGlobal); text = String(data); - GlobalUnlock(store.hGlobal); + GlobalUnlock(store.hGlobal); ReleaseStgMedium(&store); success = true; } else { - //If a file is dropped on the window, it does not provide either of the - //plain text formats, so here we try to forcibly get a url. - text = getURL(dataObject, success); + // FIXME: Originally, we called getURL() here because dragging and dropping files doesn't + // populate the drag with text data. Per https://bugs.webkit.org/show_bug.cgi?id=38826, this + // is undesirable, so maybe this line can be removed. + text = getURL(dataObject, DragData::DoNotConvertFilenames, success); success = true; } return text; diff --git a/WebCore/platform/win/ClipboardUtilitiesWin.h b/WebCore/platform/win/ClipboardUtilitiesWin.h index ec15231..ac5efd8 100644 --- a/WebCore/platform/win/ClipboardUtilitiesWin.h +++ b/WebCore/platform/win/ClipboardUtilitiesWin.h @@ -61,9 +61,10 @@ PassRefPtr<DocumentFragment> fragmentFromFilenames(Document*, const IDataObject* PassRefPtr<DocumentFragment> fragmentFromHTML(Document*, IDataObject*); PassRefPtr<DocumentFragment> fragmentFromCF_HTML(Document*, const String& cf_html); -String getURL(IDataObject*, bool& success, String* title = 0); +String getURL(IDataObject*, DragData::FilenameConversionPolicy, bool& success, String* title = 0); String getPlainText(IDataObject*, bool& success); } // namespace WebCore -#endif // ClipboardUtilitiesWin_h \ No newline at end of file +#endif // ClipboardUtilitiesWin_h + diff --git a/WebCore/platform/win/ClipboardWin.cpp b/WebCore/platform/win/ClipboardWin.cpp index 32b6561..3c3a205 100644 --- a/WebCore/platform/win/ClipboardWin.cpp +++ b/WebCore/platform/win/ClipboardWin.cpp @@ -499,7 +499,7 @@ String ClipboardWin::getData(const String& type, bool& success) const if (dataType == ClipboardDataTypeText) return getPlainText(m_dataObject.get(), success); else if (dataType == ClipboardDataTypeURL) - return getURL(m_dataObject.get(), success); + return getURL(m_dataObject.get(), DragData::DoNotConvertFilenames, success); return ""; } diff --git a/WebCore/platform/win/CursorWin.cpp b/WebCore/platform/win/CursorWin.cpp index 48cf10b..22a535d 100644 --- a/WebCore/platform/win/CursorWin.cpp +++ b/WebCore/platform/win/CursorWin.cpp @@ -52,8 +52,9 @@ static inline bool supportsAlphaCursors() return osinfo.dwMajorVersion > 5 || (osinfo.dwMajorVersion == 5 && osinfo.dwMinorVersion > 0); } -Cursor::Cursor(Image* img, const IntPoint& hotspot) -{ +Cursor::Cursor(Image* img, const IntPoint& hotSpot) +{ + IntPoint effectiveHotSpot = determineHotSpot(img, hotSpot); static bool doAlpha = supportsAlphaCursors(); BitmapInfo cursorImage = BitmapInfo::create(IntSize(img->width(), img->height())); @@ -74,8 +75,8 @@ Cursor::Cursor(Image* img, const IntPoint& hotspot) ICONINFO ii; ii.fIcon = FALSE; - ii.xHotspot = hotspot.x(); - ii.yHotspot = hotspot.y(); + ii.xHotspot = effectiveHotSpot.x(); + ii.yHotspot = effectiveHotSpot.y(); ii.hbmMask = hMask.get(); ii.hbmColor = hCursor.get(); @@ -110,8 +111,8 @@ Cursor::Cursor(Image* img, const IntPoint& hotspot) ICONINFO icon = {0}; icon.fIcon = FALSE; - icon.xHotspot = hotspot.x(); - icon.yHotspot = hotspot.y(); + icon.xHotspot = effectiveHotSpot.x(); + icon.yHotspot = effectiveHotSpot.y(); icon.hbmMask = andMask.get(); icon.hbmColor = xorMask.get(); m_impl = SharedCursor::create(CreateIconIndirect(&icon)); diff --git a/WebCore/platform/win/DragDataWin.cpp b/WebCore/platform/win/DragDataWin.cpp index 30487b8..82e537e 100644 --- a/WebCore/platform/win/DragDataWin.cpp +++ b/WebCore/platform/win/DragDataWin.cpp @@ -44,18 +44,19 @@ PassRefPtr<Clipboard> DragData::createClipboard(ClipboardAccessPolicy policy) co return ClipboardWin::create(true, m_platformDragData, policy); } -bool DragData::containsURL() const +bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const { return SUCCEEDED(m_platformDragData->QueryGetData(urlWFormat())) || SUCCEEDED(m_platformDragData->QueryGetData(urlFormat())) - || SUCCEEDED(m_platformDragData->QueryGetData(filenameWFormat())) - || SUCCEEDED(m_platformDragData->QueryGetData(filenameFormat())); + || (filenamePolicy == ConvertFilenames + && (SUCCEEDED(m_platformDragData->QueryGetData(filenameWFormat())) + || SUCCEEDED(m_platformDragData->QueryGetData(filenameFormat())))); } -String DragData::asURL(String* title) const +String DragData::asURL(FilenameConversionPolicy filenamePolicy, String* title) const { bool success; - return getURL(m_platformDragData, success, title); + return getURL(m_platformDragData, filenamePolicy, success, title); } bool DragData::containsFiles() const diff --git a/WebCore/platform/wince/DragDataWince.cpp b/WebCore/platform/wince/DragDataWince.cpp index 881d7d4..5f2a7ba 100644 --- a/WebCore/platform/wince/DragDataWince.cpp +++ b/WebCore/platform/wince/DragDataWince.cpp @@ -32,12 +32,12 @@ PassRefPtr<Clipboard> DragData::createClipboard(ClipboardAccessPolicy policy) co return 0; } -bool DragData::containsURL() const +bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const { return false; } -String DragData::asURL(String* title) const +String DragData::asURL(FilenameConversionPolicy filenamePolicy, String* title) const { return String(); } diff --git a/WebCore/platform/wx/DragDataWx.cpp b/WebCore/platform/wx/DragDataWx.cpp index 97ea38c..278f123 100644 --- a/WebCore/platform/wx/DragDataWx.cpp +++ b/WebCore/platform/wx/DragDataWx.cpp @@ -76,12 +76,12 @@ bool DragData::containsCompatibleContent() const return false; } -bool DragData::containsURL() const +bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const { return false; } -String DragData::asURL(String* title) const +String DragData::asURL(FilenameConversionPolicy filenamePolicy, String* title) const { return String(); } diff --git a/WebCore/plugins/mac/PluginViewMac.cpp b/WebCore/plugins/mac/PluginViewMac.cpp deleted file mode 100644 index 562e975..0000000 --- a/WebCore/plugins/mac/PluginViewMac.cpp +++ /dev/null @@ -1,834 +0,0 @@ -/* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. - * Copyright (C) 2008 Collabora Ltd. All rights reserved. - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) - * Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in> - * - * 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 "PluginView.h" - -#include "Bridge.h" -#include "Document.h" -#include "DocumentLoader.h" -#include "Element.h" -#include "EventNames.h" -#include "FocusController.h" -#include "FrameLoader.h" -#include "FrameLoadRequest.h" -#include "FrameTree.h" -#include "Frame.h" -#include "FrameView.h" -#include "GraphicsContext.h" -#include "HostWindow.h" -#include "HTMLNames.h" -#include "HTMLPlugInElement.h" -#include "Image.h" -#include "JSDOMBinding.h" -#include "KeyboardEvent.h" -#include "MouseEvent.h" -#include "NotImplemented.h" -#include "Page.h" -#include "PlatformMouseEvent.h" -#include "PlatformKeyboardEvent.h" -#include "PluginDebug.h" -#include "PluginPackage.h" -#include "PluginMainThreadScheduler.h" -#include "RenderLayer.h" -#include "ScriptController.h" -#include "Settings.h" -#include "npruntime_impl.h" -#include "runtime_root.h" -#include <runtime/JSLock.h> -#include <runtime/JSValue.h> -#include <wtf/RetainPtr.h> - - -using JSC::ExecState; -using JSC::Interpreter; -using JSC::JSLock; -using JSC::JSObject; -using JSC::JSValue; -using JSC::UString; - -#if PLATFORM(QT) -#include <QWidget> -#include <QKeyEvent> -#include <QPainter> -#include "QWebPageClient.h" -QT_BEGIN_NAMESPACE -extern Q_GUI_EXPORT OSWindowRef qt_mac_window_for(const QWidget* w); -QT_END_NAMESPACE -#endif - -#if PLATFORM(WX) -#include <wx/defs.h> -#include <wx/wx.h> -#endif - -using std::min; - -using namespace WTF; - -namespace WebCore { - -using namespace HTMLNames; - -#ifndef NP_NO_CARBON -static int modifiersForEvent(UIEventWithKeyState *event); -#endif - -static inline WindowRef nativeWindowFor(PlatformWidget widget) -{ -#if PLATFORM(QT) - if (widget) - return static_cast<WindowRef>(qt_mac_window_for(widget)); -#endif -#if PLATFORM(WX) - if (widget) - return (WindowRef)widget->MacGetTopLevelWindowRef(); -#endif - return 0; -} - -static inline CGContextRef cgHandleFor(PlatformWidget widget) -{ -#if PLATFORM(QT) - if (widget) - return (CGContextRef)widget->macCGHandle(); -#endif -#if PLATFORM(WX) - if (widget) - return (CGContextRef)widget->MacGetCGContextRef(); -#endif - return 0; -} - -static inline IntPoint topLevelOffsetFor(PlatformWidget widget) -{ -#if PLATFORM(QT) - if (widget) { - PlatformWidget topLevel = widget->window(); - return widget->mapTo(topLevel, QPoint(0, 0)) + topLevel->geometry().topLeft() - topLevel->pos(); - } -#endif -#if PLATFORM(WX) - if (widget) { - PlatformWidget toplevel = wxGetTopLevelParent(widget); - return toplevel->ScreenToClient(widget->GetScreenPosition()); - } -#endif - return IntPoint(); -} - -// --------------- Lifetime management ----------------- - -bool PluginView::platformStart() -{ - ASSERT(m_isStarted); - ASSERT(m_status == PluginStatusLoadedSuccessfully); - - if (m_drawingModel == NPDrawingModel(-1)) { - // We default to QuickDraw, even though we don't support it, - // since that's what Safari does, and some plugins expect this - // behavior and never set the drawing model explicitly. -#ifndef NP_NO_QUICKDRAW - m_drawingModel = NPDrawingModelQuickDraw; -#else - // QuickDraw not available, so we have to default to CoreGraphics - m_drawingModel = NPDrawingModelCoreGraphics; -#endif - } - - if (m_eventModel == NPEventModel(-1)) { - // If the plug-in did not specify an event model - // we default to Carbon, when it is available. -#ifndef NP_NO_CARBON - m_eventModel = NPEventModelCarbon; -#else - m_eventModel = NPEventModelCocoa; -#endif - } - - // Gracefully handle unsupported drawing or event models. We can do this - // now since the drawing and event model can only be set during NPP_New. -#ifndef NP_NO_CARBON - NPBool eventModelSupported; - if (getValueStatic(NPNVariable(NPNVsupportsCarbonBool + m_eventModel), &eventModelSupported) != NPERR_NO_ERROR - || !eventModelSupported) { -#endif - m_status = PluginStatusCanNotLoadPlugin; - LOG(Plugins, "Plug-in '%s' uses unsupported event model %s", - m_plugin->name().utf8().data(), prettyNameForEventModel(m_eventModel)); - return false; -#ifndef NP_NO_CARBON - } -#endif - -#ifndef NP_NO_QUICKDRAW - NPBool drawingModelSupported; - if (getValueStatic(NPNVariable(NPNVsupportsQuickDrawBool + m_drawingModel), &drawingModelSupported) != NPERR_NO_ERROR - || !drawingModelSupported) { -#endif - m_status = PluginStatusCanNotLoadPlugin; - LOG(Plugins, "Plug-in '%s' uses unsupported drawing model %s", - m_plugin->name().utf8().data(), prettyNameForDrawingModel(m_drawingModel)); - return false; -#ifndef NP_NO_QUICKDRAW - } -#endif - -#if PLATFORM(QT) - // Set the platformPluginWidget only in the case of QWebView so that the context menu appears in the right place. - // In all other cases, we use off-screen rendering - if (QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient()) { - if (QWidget* widget = qobject_cast<QWidget*>(client->pluginParent())) - setPlatformPluginWidget(widget); - } -#endif -#if PLATFORM(WX) - if (wxWindow* widget = m_parentFrame->view()->hostWindow()->platformPageClient()) - setPlatformPluginWidget(widget); -#endif - - // Create a fake window relative to which all events will be sent when using offscreen rendering - if (!platformPluginWidget()) { -#ifndef NP_NO_CARBON - // Make the default size really big. It is unclear why this is required but with a smaller size, mouse move - // events don't get processed. Resizing the fake window to flash's size doesn't help. - ::Rect windowBounds = { 0, 0, 1000, 1000 }; - CreateNewWindow(kDocumentWindowClass, kWindowStandardDocumentAttributes, &windowBounds, &m_fakeWindow); - // Flash requires the window to be hilited to process mouse move events. - HiliteWindow(m_fakeWindow, true); -#endif - } - - show(); - - // TODO: Implement null timer throttling depending on plugin activation - m_nullEventTimer.set(new Timer<PluginView>(this, &PluginView::nullEventTimerFired)); - m_nullEventTimer->startRepeating(0.02); - - m_lastMousePos.h = m_lastMousePos.v = 0; - - return true; -} - -void PluginView::platformDestroy() -{ - if (platformPluginWidget()) - setPlatformPluginWidget(0); - else { - CGContextRelease(m_contextRef); -#ifndef NP_NO_CARBON - if (m_fakeWindow) - DisposeWindow(m_fakeWindow); -#endif - } -} - -// Used before the plugin view has been initialized properly, and as a -// fallback for variables that do not require a view to resolve. -bool PluginView::platformGetValueStatic(NPNVariable variable, void* value, NPError* result) -{ - switch (variable) { - case NPNVToolkit: - *static_cast<uint32_t*>(value) = 0; - *result = NPERR_NO_ERROR; - return true; - - case NPNVjavascriptEnabledBool: - *static_cast<NPBool*>(value) = true; - *result = NPERR_NO_ERROR; - return true; - -#ifndef NP_NO_CARBON - case NPNVsupportsCarbonBool: - *static_cast<NPBool*>(value) = true; - *result = NPERR_NO_ERROR; - return true; - -#endif - case NPNVsupportsCocoaBool: - *static_cast<NPBool*>(value) = false; - *result = NPERR_NO_ERROR; - return true; - - // CoreGraphics is the only drawing model we support - case NPNVsupportsCoreGraphicsBool: - *static_cast<NPBool*>(value) = true; - *result = NPERR_NO_ERROR; - return true; - -#ifndef NP_NO_QUICKDRAW - // QuickDraw is deprecated in 10.5 and not supported on 64-bit - case NPNVsupportsQuickDrawBool: -#endif - case NPNVsupportsOpenGLBool: - case NPNVsupportsCoreAnimationBool: - *static_cast<NPBool*>(value) = false; - *result = NPERR_NO_ERROR; - return true; - - default: - return false; - } -} - -// Used only for variables that need a view to resolve -bool PluginView::platformGetValue(NPNVariable variable, void* value, NPError* error) -{ - return false; -} - -void PluginView::setParent(ScrollView* parent) -{ - LOG(Plugins, "PluginView::setParent(%p)", parent); - - Widget::setParent(parent); - - if (parent) - init(); -} - -// -------------- Geometry and painting ---------------- - -void PluginView::show() -{ - LOG(Plugins, "PluginView::show()"); - - setSelfVisible(true); - - Widget::show(); -} - -void PluginView::hide() -{ - LOG(Plugins, "PluginView::hide()"); - - setSelfVisible(false); - - Widget::hide(); -} - -void PluginView::setFocus(bool focused) -{ - LOG(Plugins, "PluginView::setFocus(%d)", focused); - if (!focused) { - Widget::setFocus(focused); - return; - } - - if (platformPluginWidget()) -#if PLATFORM(QT) - platformPluginWidget()->setFocus(Qt::OtherFocusReason); -#else - platformPluginWidget()->SetFocus(); -#endif - else - Widget::setFocus(focused); - - // TODO: Also handle and pass on blur events (focus lost) - -#ifndef NP_NO_CARBON - EventRecord record; - record.what = getFocusEvent; - record.message = 0; - record.when = TickCount(); - record.where = globalMousePosForPlugin(); - record.modifiers = GetCurrentKeyModifiers(); - - if (!dispatchNPEvent(record)) - LOG(Events, "PluginView::setFocus(%d): Focus event not accepted", focused); -#endif -} - -void PluginView::setParentVisible(bool visible) -{ - if (isParentVisible() == visible) - return; - - Widget::setParentVisible(visible); -} - -void PluginView::setNPWindowRect(const IntRect&) -{ - setNPWindowIfNeeded(); -} - -void PluginView::setNPWindowIfNeeded() -{ - if (!m_isStarted || !parent() || !m_plugin->pluginFuncs()->setwindow) - return; - - CGContextRef newContextRef = 0; - WindowRef newWindowRef = 0; - if (platformPluginWidget()) { - newContextRef = cgHandleFor(platformPluginWidget()); - newWindowRef = nativeWindowFor(platformPluginWidget()); - m_npWindow.type = NPWindowTypeWindow; - } else { - newContextRef = m_contextRef; - newWindowRef = m_fakeWindow; - m_npWindow.type = NPWindowTypeDrawable; - } - - if (!newContextRef || !newWindowRef) - return; - - m_npWindow.window = (void*)&m_npCgContext; -#ifndef NP_NO_CARBON - m_npCgContext.window = newWindowRef; -#endif - m_npCgContext.context = newContextRef; - - m_npWindow.x = m_windowRect.x(); - m_npWindow.y = m_windowRect.y(); - m_npWindow.width = m_windowRect.width(); - m_npWindow.height = m_windowRect.height(); - - // TODO: (also clip against scrollbars, etc.) - m_npWindow.clipRect.left = max(0, m_windowRect.x()); - m_npWindow.clipRect.top = max(0, m_windowRect.y()); - m_npWindow.clipRect.right = m_windowRect.x() + m_windowRect.width(); - m_npWindow.clipRect.bottom = m_windowRect.y() + m_windowRect.height(); - - LOG(Plugins, "PluginView::setNPWindowIfNeeded(): window=%p, context=%p," - " window.x:%d window.y:%d window.width:%d window.height:%d window.clipRect size:%dx%d", - newWindowRef, newContextRef, m_npWindow.x, m_npWindow.y, m_npWindow.width, m_npWindow.height, - m_npWindow.clipRect.right - m_npWindow.clipRect.left, m_npWindow.clipRect.bottom - m_npWindow.clipRect.top); - - PluginView::setCurrentPluginView(this); - JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly); - setCallingPlugin(true); - m_plugin->pluginFuncs()->setwindow(m_instance, &m_npWindow); - setCallingPlugin(false); - PluginView::setCurrentPluginView(0); -} - -void PluginView::updatePluginWidget() -{ - if (!parent()) - return; - - ASSERT(parent()->isFrameView()); - FrameView* frameView = static_cast<FrameView*>(parent()); - - IntRect oldWindowRect = m_windowRect; - IntRect oldClipRect = m_clipRect; - - m_windowRect = frameView->contentsToWindow(frameRect()); - IntPoint offset = topLevelOffsetFor(platformPluginWidget()); - m_windowRect.move(offset.x(), offset.y()); - - if (!platformPluginWidget()) { - if (m_windowRect.size() != oldWindowRect.size()) { - CGContextRelease(m_contextRef); -#if PLATFORM(QT) - m_pixmap = QPixmap(m_windowRect.size()); - m_pixmap.fill(Qt::transparent); - m_contextRef = m_pixmap.isNull() ? 0 : qt_mac_cg_context(&m_pixmap); -#endif - } - } - - m_clipRect = windowClipRect(); - m_clipRect.move(-m_windowRect.x(), -m_windowRect.y()); - - if (platformPluginWidget() && (m_windowRect != oldWindowRect || m_clipRect != oldClipRect)) - setNPWindowIfNeeded(); -} - -void PluginView::paint(GraphicsContext* context, const IntRect& rect) -{ - if (!m_isStarted || m_status != PluginStatusLoadedSuccessfully) { - paintMissingPluginIcon(context, rect); - return; - } - - if (context->paintingDisabled()) - return; - - setNPWindowIfNeeded(); - - CGContextRef cgContext = m_npCgContext.context; - if (!cgContext) - return; - - CGContextSaveGState(cgContext); - if (platformPluginWidget()) { - IntPoint offset = frameRect().location(); - CGContextTranslateCTM(cgContext, offset.x(), offset.y()); - } - - IntRect targetRect(frameRect()); - targetRect.intersects(rect); - - // clip the context so that plugin only updates the interested area. - CGRect r; - r.origin.x = targetRect.x() - frameRect().x(); - r.origin.y = targetRect.y() - frameRect().y(); - r.size.width = targetRect.width(); - r.size.height = targetRect.height(); - CGContextClipToRect(cgContext, r); - - if (!platformPluginWidget() && m_isTransparent) { // clean the pixmap in transparent mode -#if PLATFORM(QT) - QPainter painter(&m_pixmap); - painter.setCompositionMode(QPainter::CompositionMode_Clear); - painter.fillRect(QRectF(r.origin.x, r.origin.y, r.size.width, r.size.height), Qt::transparent); -#endif - } - -#ifndef NP_NO_CARBON - EventRecord event; - event.what = updateEvt; - event.message = (long unsigned int)m_npCgContext.window; - event.when = TickCount(); - event.where.h = 0; - event.where.v = 0; - event.modifiers = GetCurrentKeyModifiers(); - - if (!dispatchNPEvent(event)) - LOG(Events, "PluginView::paint(): Paint event not accepted"); -#endif - - CGContextRestoreGState(cgContext); - - if (!platformPluginWidget()) { -#if PLATFORM(QT) - QPainter* painter = context->platformContext(); - painter->drawPixmap(targetRect.x(), targetRect.y(), m_pixmap, - targetRect.x() - frameRect().x(), targetRect.y() - frameRect().y(), targetRect.width(), targetRect.height()); -#endif - } -} - -void PluginView::invalidateRect(const IntRect& rect) -{ - if (platformPluginWidget()) -#if PLATFORM(QT) - platformPluginWidget()->update(convertToContainingWindow(rect)); -#else - platformPluginWidget()->RefreshRect(convertToContainingWindow(rect)); -#endif - else - invalidateWindowlessPluginRect(rect); -} - -void PluginView::invalidateRect(NPRect* rect) -{ - IntRect r(rect->left, rect->top, rect->right - rect->left, rect->bottom - rect->top); - invalidateRect(r); -} - -void PluginView::invalidateRegion(NPRegion region) -{ - // TODO: optimize - invalidate(); -} - -void PluginView::forceRedraw() -{ - notImplemented(); -} - - -// ----------------- Event handling -------------------- - -void PluginView::handleMouseEvent(MouseEvent* event) -{ - if (!m_isStarted) - return; - -#ifndef NP_NO_CARBON - EventRecord record; - - if (event->type() == eventNames().mousemoveEvent) { - // Mouse movement is handled by null timer events - m_lastMousePos = mousePosForPlugin(event); - return; - } else if (event->type() == eventNames().mouseoverEvent) { - record.what = adjustCursorEvent; - } else if (event->type() == eventNames().mouseoutEvent) { - record.what = adjustCursorEvent; - } else if (event->type() == eventNames().mousedownEvent) { - record.what = mouseDown; - // The plugin needs focus to receive keyboard events - if (Page* page = m_parentFrame->page()) - page->focusController()->setFocusedFrame(m_parentFrame); - m_parentFrame->document()->setFocusedNode(m_element); - } else if (event->type() == eventNames().mouseupEvent) { - record.what = mouseUp; - } else { - return; - } - record.where = mousePosForPlugin(event); - record.modifiers = modifiersForEvent(event); - - if (!event->buttonDown()) - record.modifiers |= btnState; - - if (event->button() == 2) - record.modifiers |= controlKey; - - if (!dispatchNPEvent(record)) { - if (record.what == adjustCursorEvent) - return; // Signals that the plugin wants a normal cursor - - LOG(Events, "PluginView::handleMouseEvent(): Mouse event type %d at %d,%d not accepted", - record.what, record.where.h, record.where.v); - } else { - event->setDefaultHandled(); - } -#endif -} - -void PluginView::handleKeyboardEvent(KeyboardEvent* event) -{ - if (!m_isStarted) - return; - - LOG(Plugins, "PluginView::handleKeyboardEvent() ----------------- "); - - LOG(Plugins, "PV::hKE(): KE.keyCode: 0x%02X, KE.charCode: %d", - event->keyCode(), event->charCode()); - -#ifndef NP_NO_CARBON - EventRecord record; - - if (event->type() == eventNames().keydownEvent) { - // This event is the result of a PlatformKeyboardEvent::KeyDown which - // was disambiguated into a PlatformKeyboardEvent::RawKeyDown. Since - // we don't have access to the text here, we return, and wait for the - // corresponding event based on PlatformKeyboardEvent::Char. - return; - } else if (event->type() == eventNames().keypressEvent) { - // Which would be this one. This event was disambiguated from the same - // PlatformKeyboardEvent::KeyDown, but to a PlatformKeyboardEvent::Char, - // which retains the text from the original event. So, we can safely pass - // on the event as a key-down event to the plugin. - record.what = keyDown; - } else if (event->type() == eventNames().keyupEvent) { - // PlatformKeyboardEvent::KeyUp events always have the text, so nothing - // fancy here. - record.what = keyUp; - } else { - return; - } - - const PlatformKeyboardEvent* platformEvent = event->keyEvent(); - int keyCode = platformEvent->nativeVirtualKeyCode(); - - const String text = platformEvent->text(); - if (text.length() < 1) { - event->setDefaultHandled(); - return; - } - - WTF::RetainPtr<CFStringRef> cfText(WTF::AdoptCF, text.createCFString()); - - LOG(Plugins, "PV::hKE(): PKE.text: %s, PKE.unmodifiedText: %s, PKE.keyIdentifier: %s", - text.ascii().data(), platformEvent->unmodifiedText().ascii().data(), - platformEvent->keyIdentifier().ascii().data()); - - char charCodes[2] = { 0, 0 }; - if (!CFStringGetCString(cfText.get(), charCodes, 2, CFStringGetSystemEncoding())) { - LOG_ERROR("Could not resolve character code using system encoding."); - event->setDefaultHandled(); - return; - } - - record.where = globalMousePosForPlugin(); - record.modifiers = modifiersForEvent(event); - record.message = ((keyCode & 0xFF) << 8) | (charCodes[0] & 0xFF); - record.when = TickCount(); - - LOG(Plugins, "PV::hKE(): record.modifiers: %d", record.modifiers); - -#if PLATFORM(QT) - LOG(Plugins, "PV::hKE(): PKE.qtEvent()->nativeVirtualKey: 0x%02X, charCode: %d", - keyCode, int(uchar(charCodes[0]))); -#endif - - if (!dispatchNPEvent(record)) - LOG(Events, "PluginView::handleKeyboardEvent(): Keyboard event type %d not accepted", record.what); - else - event->setDefaultHandled(); -#endif -} - -#ifndef NP_NO_CARBON -void PluginView::nullEventTimerFired(Timer<PluginView>*) -{ - EventRecord record; - - record.what = nullEvent; - record.message = 0; - record.when = TickCount(); - record.where = m_lastMousePos; - record.modifiers = GetCurrentKeyModifiers(); - if (!Button()) - record.modifiers |= btnState; - - if (!dispatchNPEvent(record)) - LOG(Events, "PluginView::nullEventTimerFired(): Null event not accepted"); -} -#endif - -#ifndef NP_NO_CARBON -static int modifiersForEvent(UIEventWithKeyState* event) -{ - int modifiers = 0; - - if (event->ctrlKey()) - modifiers |= controlKey; - - if (event->altKey()) - modifiers |= optionKey; - - if (event->metaKey()) - modifiers |= cmdKey; - - if (event->shiftKey()) - modifiers |= shiftKey; - - return modifiers; -} -#endif - -#ifndef NP_NO_CARBON -static bool tigerOrBetter() -{ - static SInt32 systemVersion = 0; - - if (!systemVersion) { - if (Gestalt(gestaltSystemVersion, &systemVersion) != noErr) - return false; - } - - return systemVersion >= 0x1040; -} -#endif - -#ifndef NP_NO_CARBON -Point PluginView::globalMousePosForPlugin() const -{ - Point pos; - GetGlobalMouse(&pos); - - float scaleFactor = tigerOrBetter() ? HIGetScaleFactor() : 1; - - pos.h = short(pos.h * scaleFactor); - pos.v = short(pos.v * scaleFactor); - -#if PLATFORM(WX) - // make sure the titlebar/toolbar size is included - WindowRef windowRef = nativeWindowFor(platformPluginWidget()); - ::Rect content, structure; - - GetWindowBounds(windowRef, kWindowStructureRgn, &structure); - GetWindowBounds(windowRef, kWindowContentRgn, &content); - - int top = content.top - structure.top; - pos.v -= top; -#endif - - return pos; -} -#endif - -#ifndef NP_NO_CARBON -Point PluginView::mousePosForPlugin(MouseEvent* event) const -{ - ASSERT(event); - if (platformPluginWidget()) - return globalMousePosForPlugin(); - - if (event->button() == 2) { - // always pass the global position for right-click since Flash uses it to position the context menu - return globalMousePosForPlugin(); - } - - Point pos; - IntPoint postZoomPos = roundedIntPoint(m_element->renderer()->absoluteToLocal(event->absoluteLocation())); - pos.h = postZoomPos.x() + m_windowRect.x(); - // The number 22 is the height of the title bar. As to why it figures in the calculation below - // is left as an exercise to the reader :-) - pos.v = postZoomPos.y() + m_windowRect.y() - 22; - return pos; -} -#endif - -#ifndef NP_NO_CARBON -bool PluginView::dispatchNPEvent(NPEvent& event) -{ - PluginView::setCurrentPluginView(this); - JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly); - setCallingPlugin(true); - - bool accepted = m_plugin->pluginFuncs()->event(m_instance, &event); - - setCallingPlugin(false); - PluginView::setCurrentPluginView(0); - return accepted; -} -#endif - -// ------------------- Miscellaneous ------------------ - -NPError PluginView::handlePostReadFile(Vector<char>& buffer, uint32_t len, const char* buf) -{ - String filename(buf, len); - - if (filename.startsWith("file:///")) - filename = filename.substring(8); - - if (!fileExists(filename)) - return NPERR_FILE_NOT_FOUND; - - FILE* fileHandle = fopen((filename.utf8()).data(), "r"); - - if (fileHandle == 0) - return NPERR_FILE_NOT_FOUND; - - int bytesRead = fread(buffer.data(), 1, 0, fileHandle); - - fclose(fileHandle); - - if (bytesRead <= 0) - return NPERR_FILE_NOT_FOUND; - - return NPERR_NO_ERROR; -} - -void PluginView::halt() -{ -} - -void PluginView::restart() -{ -} - -} // namespace WebCore diff --git a/WebCore/plugins/mac/PluginViewMac.mm b/WebCore/plugins/mac/PluginViewMac.mm new file mode 100644 index 0000000..8d64c24 --- /dev/null +++ b/WebCore/plugins/mac/PluginViewMac.mm @@ -0,0 +1,837 @@ +/* + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2008 Collabora Ltd. All rights reserved. + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in> + * + * 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 "PluginView.h" + +#include "Bridge.h" +#include "Document.h" +#include "DocumentLoader.h" +#include "Element.h" +#include "EventNames.h" +#include "FocusController.h" +#include "FrameLoader.h" +#include "FrameLoadRequest.h" +#include "FrameTree.h" +#include "Frame.h" +#include "FrameView.h" +#include "GraphicsContext.h" +#include "HostWindow.h" +#include "HTMLNames.h" +#include "HTMLPlugInElement.h" +#include "Image.h" +#include "JSDOMBinding.h" +#include "KeyboardEvent.h" +#include "MouseEvent.h" +#include "NotImplemented.h" +#include "Page.h" +#include "PlatformMouseEvent.h" +#include "PlatformKeyboardEvent.h" +#include "PluginDebug.h" +#include "PluginPackage.h" +#include "PluginMainThreadScheduler.h" +#include "RenderLayer.h" +#include "ScriptController.h" +#include "Settings.h" +#include "npruntime_impl.h" +#include "runtime_root.h" +#include <runtime/JSLock.h> +#include <runtime/JSValue.h> +#include <wtf/RetainPtr.h> + + +using JSC::ExecState; +using JSC::Interpreter; +using JSC::JSLock; +using JSC::JSObject; +using JSC::JSValue; +using JSC::UString; + +#if PLATFORM(QT) +#include <QWidget> +#include <QKeyEvent> +#include <QPainter> +#include "QWebPageClient.h" +QT_BEGIN_NAMESPACE +extern Q_GUI_EXPORT OSWindowRef qt_mac_window_for(const QWidget* w); +QT_END_NAMESPACE +#endif + +#if PLATFORM(WX) +#include <wx/defs.h> +#include <wx/wx.h> +#endif + +using std::min; + +using namespace WTF; + +namespace WebCore { + +using namespace HTMLNames; + +#ifndef NP_NO_CARBON +static int modifiersForEvent(UIEventWithKeyState *event); +#endif + +static inline WindowRef nativeWindowFor(PlatformWidget widget) +{ +#if PLATFORM(QT) + if (widget) +#if QT_MAC_USE_COCOA + return static_cast<WindowRef>([qt_mac_window_for(widget) windowRef]); +#else + return static_cast<WindowRef>(qt_mac_window_for(widget)); +#endif +#elif PLATFORM(WX) + if (widget) + return (WindowRef)widget->MacGetTopLevelWindowRef(); +#endif + return 0; +} + +static inline CGContextRef cgHandleFor(PlatformWidget widget) +{ +#if PLATFORM(QT) + if (widget) + return (CGContextRef)widget->macCGHandle(); +#endif +#if PLATFORM(WX) + if (widget) + return (CGContextRef)widget->MacGetCGContextRef(); +#endif + return 0; +} + +static inline IntPoint topLevelOffsetFor(PlatformWidget widget) +{ +#if PLATFORM(QT) + if (widget) { + PlatformWidget topLevel = widget->window(); + return widget->mapTo(topLevel, QPoint(0, 0)) + topLevel->geometry().topLeft() - topLevel->pos(); + } +#endif +#if PLATFORM(WX) + if (widget) { + PlatformWidget toplevel = wxGetTopLevelParent(widget); + return toplevel->ScreenToClient(widget->GetScreenPosition()); + } +#endif + return IntPoint(); +} + +// --------------- Lifetime management ----------------- + +bool PluginView::platformStart() +{ + ASSERT(m_isStarted); + ASSERT(m_status == PluginStatusLoadedSuccessfully); + + if (m_drawingModel == NPDrawingModel(-1)) { + // We default to QuickDraw, even though we don't support it, + // since that's what Safari does, and some plugins expect this + // behavior and never set the drawing model explicitly. +#ifndef NP_NO_QUICKDRAW + m_drawingModel = NPDrawingModelQuickDraw; +#else + // QuickDraw not available, so we have to default to CoreGraphics + m_drawingModel = NPDrawingModelCoreGraphics; +#endif + } + + if (m_eventModel == NPEventModel(-1)) { + // If the plug-in did not specify an event model + // we default to Carbon, when it is available. +#ifndef NP_NO_CARBON + m_eventModel = NPEventModelCarbon; +#else + m_eventModel = NPEventModelCocoa; +#endif + } + + // Gracefully handle unsupported drawing or event models. We can do this + // now since the drawing and event model can only be set during NPP_New. +#ifndef NP_NO_CARBON + NPBool eventModelSupported; + if (getValueStatic(NPNVariable(NPNVsupportsCarbonBool + m_eventModel), &eventModelSupported) != NPERR_NO_ERROR + || !eventModelSupported) { +#endif + m_status = PluginStatusCanNotLoadPlugin; + LOG(Plugins, "Plug-in '%s' uses unsupported event model %s", + m_plugin->name().utf8().data(), prettyNameForEventModel(m_eventModel)); + return false; +#ifndef NP_NO_CARBON + } +#endif + +#ifndef NP_NO_QUICKDRAW + NPBool drawingModelSupported; + if (getValueStatic(NPNVariable(NPNVsupportsQuickDrawBool + m_drawingModel), &drawingModelSupported) != NPERR_NO_ERROR + || !drawingModelSupported) { +#endif + m_status = PluginStatusCanNotLoadPlugin; + LOG(Plugins, "Plug-in '%s' uses unsupported drawing model %s", + m_plugin->name().utf8().data(), prettyNameForDrawingModel(m_drawingModel)); + return false; +#ifndef NP_NO_QUICKDRAW + } +#endif + +#if PLATFORM(QT) + // Set the platformPluginWidget only in the case of QWebView so that the context menu appears in the right place. + // In all other cases, we use off-screen rendering + if (QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient()) { + if (QWidget* widget = qobject_cast<QWidget*>(client->pluginParent())) + setPlatformPluginWidget(widget); + } +#endif +#if PLATFORM(WX) + if (wxWindow* widget = m_parentFrame->view()->hostWindow()->platformPageClient()) + setPlatformPluginWidget(widget); +#endif + + // Create a fake window relative to which all events will be sent when using offscreen rendering + if (!platformPluginWidget()) { +#ifndef NP_NO_CARBON + // Make the default size really big. It is unclear why this is required but with a smaller size, mouse move + // events don't get processed. Resizing the fake window to flash's size doesn't help. + ::Rect windowBounds = { 0, 0, 1000, 1000 }; + CreateNewWindow(kDocumentWindowClass, kWindowStandardDocumentAttributes, &windowBounds, &m_fakeWindow); + // Flash requires the window to be hilited to process mouse move events. + HiliteWindow(m_fakeWindow, true); +#endif + } + + show(); + + // TODO: Implement null timer throttling depending on plugin activation + m_nullEventTimer.set(new Timer<PluginView>(this, &PluginView::nullEventTimerFired)); + m_nullEventTimer->startRepeating(0.02); + + m_lastMousePos.h = m_lastMousePos.v = 0; + + return true; +} + +void PluginView::platformDestroy() +{ + if (platformPluginWidget()) + setPlatformPluginWidget(0); + else { + CGContextRelease(m_contextRef); +#ifndef NP_NO_CARBON + if (m_fakeWindow) + DisposeWindow(m_fakeWindow); +#endif + } +} + +// Used before the plugin view has been initialized properly, and as a +// fallback for variables that do not require a view to resolve. +bool PluginView::platformGetValueStatic(NPNVariable variable, void* value, NPError* result) +{ + switch (variable) { + case NPNVToolkit: + *static_cast<uint32_t*>(value) = 0; + *result = NPERR_NO_ERROR; + return true; + + case NPNVjavascriptEnabledBool: + *static_cast<NPBool*>(value) = true; + *result = NPERR_NO_ERROR; + return true; + +#ifndef NP_NO_CARBON + case NPNVsupportsCarbonBool: + *static_cast<NPBool*>(value) = true; + *result = NPERR_NO_ERROR; + return true; + +#endif + case NPNVsupportsCocoaBool: + *static_cast<NPBool*>(value) = false; + *result = NPERR_NO_ERROR; + return true; + + // CoreGraphics is the only drawing model we support + case NPNVsupportsCoreGraphicsBool: + *static_cast<NPBool*>(value) = true; + *result = NPERR_NO_ERROR; + return true; + +#ifndef NP_NO_QUICKDRAW + // QuickDraw is deprecated in 10.5 and not supported on 64-bit + case NPNVsupportsQuickDrawBool: +#endif + case NPNVsupportsOpenGLBool: + case NPNVsupportsCoreAnimationBool: + *static_cast<NPBool*>(value) = false; + *result = NPERR_NO_ERROR; + return true; + + default: + return false; + } +} + +// Used only for variables that need a view to resolve +bool PluginView::platformGetValue(NPNVariable variable, void* value, NPError* error) +{ + return false; +} + +void PluginView::setParent(ScrollView* parent) +{ + LOG(Plugins, "PluginView::setParent(%p)", parent); + + Widget::setParent(parent); + + if (parent) + init(); +} + +// -------------- Geometry and painting ---------------- + +void PluginView::show() +{ + LOG(Plugins, "PluginView::show()"); + + setSelfVisible(true); + + Widget::show(); +} + +void PluginView::hide() +{ + LOG(Plugins, "PluginView::hide()"); + + setSelfVisible(false); + + Widget::hide(); +} + +void PluginView::setFocus(bool focused) +{ + LOG(Plugins, "PluginView::setFocus(%d)", focused); + if (!focused) { + Widget::setFocus(focused); + return; + } + + if (platformPluginWidget()) +#if PLATFORM(QT) + platformPluginWidget()->setFocus(Qt::OtherFocusReason); +#else + platformPluginWidget()->SetFocus(); +#endif + else + Widget::setFocus(focused); + + // TODO: Also handle and pass on blur events (focus lost) + +#ifndef NP_NO_CARBON + EventRecord record; + record.what = getFocusEvent; + record.message = 0; + record.when = TickCount(); + record.where = globalMousePosForPlugin(); + record.modifiers = GetCurrentKeyModifiers(); + + if (!dispatchNPEvent(record)) + LOG(Events, "PluginView::setFocus(%d): Focus event not accepted", focused); +#endif +} + +void PluginView::setParentVisible(bool visible) +{ + if (isParentVisible() == visible) + return; + + Widget::setParentVisible(visible); +} + +void PluginView::setNPWindowRect(const IntRect&) +{ + setNPWindowIfNeeded(); +} + +void PluginView::setNPWindowIfNeeded() +{ + if (!m_isStarted || !parent() || !m_plugin->pluginFuncs()->setwindow) + return; + + CGContextRef newContextRef = 0; + WindowRef newWindowRef = 0; + if (platformPluginWidget()) { + newContextRef = cgHandleFor(platformPluginWidget()); + newWindowRef = nativeWindowFor(platformPluginWidget()); + m_npWindow.type = NPWindowTypeWindow; + } else { + newContextRef = m_contextRef; + newWindowRef = m_fakeWindow; + m_npWindow.type = NPWindowTypeDrawable; + } + + if (!newContextRef || !newWindowRef) + return; + + m_npWindow.window = (void*)&m_npCgContext; +#ifndef NP_NO_CARBON + m_npCgContext.window = newWindowRef; +#endif + m_npCgContext.context = newContextRef; + + m_npWindow.x = m_windowRect.x(); + m_npWindow.y = m_windowRect.y(); + m_npWindow.width = m_windowRect.width(); + m_npWindow.height = m_windowRect.height(); + + // TODO: (also clip against scrollbars, etc.) + m_npWindow.clipRect.left = max(0, m_windowRect.x()); + m_npWindow.clipRect.top = max(0, m_windowRect.y()); + m_npWindow.clipRect.right = m_windowRect.x() + m_windowRect.width(); + m_npWindow.clipRect.bottom = m_windowRect.y() + m_windowRect.height(); + + LOG(Plugins, "PluginView::setNPWindowIfNeeded(): window=%p, context=%p," + " window.x:%d window.y:%d window.width:%d window.height:%d window.clipRect size:%dx%d", + newWindowRef, newContextRef, m_npWindow.x, m_npWindow.y, m_npWindow.width, m_npWindow.height, + m_npWindow.clipRect.right - m_npWindow.clipRect.left, m_npWindow.clipRect.bottom - m_npWindow.clipRect.top); + + PluginView::setCurrentPluginView(this); + JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly); + setCallingPlugin(true); + m_plugin->pluginFuncs()->setwindow(m_instance, &m_npWindow); + setCallingPlugin(false); + PluginView::setCurrentPluginView(0); +} + +void PluginView::updatePluginWidget() +{ + if (!parent()) + return; + + ASSERT(parent()->isFrameView()); + FrameView* frameView = static_cast<FrameView*>(parent()); + + IntRect oldWindowRect = m_windowRect; + IntRect oldClipRect = m_clipRect; + + m_windowRect = frameView->contentsToWindow(frameRect()); + IntPoint offset = topLevelOffsetFor(platformPluginWidget()); + m_windowRect.move(offset.x(), offset.y()); + + if (!platformPluginWidget()) { + if (m_windowRect.size() != oldWindowRect.size()) { + CGContextRelease(m_contextRef); +#if PLATFORM(QT) + m_pixmap = QPixmap(m_windowRect.size()); + m_pixmap.fill(Qt::transparent); + m_contextRef = m_pixmap.isNull() ? 0 : qt_mac_cg_context(&m_pixmap); +#endif + } + } + + m_clipRect = windowClipRect(); + m_clipRect.move(-m_windowRect.x(), -m_windowRect.y()); + + if (platformPluginWidget() && (m_windowRect != oldWindowRect || m_clipRect != oldClipRect)) + setNPWindowIfNeeded(); +} + +void PluginView::paint(GraphicsContext* context, const IntRect& rect) +{ + if (!m_isStarted || m_status != PluginStatusLoadedSuccessfully) { + paintMissingPluginIcon(context, rect); + return; + } + + if (context->paintingDisabled()) + return; + + setNPWindowIfNeeded(); + + CGContextRef cgContext = m_npCgContext.context; + if (!cgContext) + return; + + CGContextSaveGState(cgContext); + if (platformPluginWidget()) { + IntPoint offset = frameRect().location(); + CGContextTranslateCTM(cgContext, offset.x(), offset.y()); + } + + IntRect targetRect(frameRect()); + targetRect.intersects(rect); + + // clip the context so that plugin only updates the interested area. + CGRect r; + r.origin.x = targetRect.x() - frameRect().x(); + r.origin.y = targetRect.y() - frameRect().y(); + r.size.width = targetRect.width(); + r.size.height = targetRect.height(); + CGContextClipToRect(cgContext, r); + + if (!platformPluginWidget() && m_isTransparent) { // clean the pixmap in transparent mode +#if PLATFORM(QT) + QPainter painter(&m_pixmap); + painter.setCompositionMode(QPainter::CompositionMode_Clear); + painter.fillRect(QRectF(r.origin.x, r.origin.y, r.size.width, r.size.height), Qt::transparent); +#endif + } + +#ifndef NP_NO_CARBON + EventRecord event; + event.what = updateEvt; + event.message = (long unsigned int)m_npCgContext.window; + event.when = TickCount(); + event.where.h = 0; + event.where.v = 0; + event.modifiers = GetCurrentKeyModifiers(); + + if (!dispatchNPEvent(event)) + LOG(Events, "PluginView::paint(): Paint event not accepted"); +#endif + + CGContextRestoreGState(cgContext); + + if (!platformPluginWidget()) { +#if PLATFORM(QT) + QPainter* painter = context->platformContext(); + painter->drawPixmap(targetRect.x(), targetRect.y(), m_pixmap, + targetRect.x() - frameRect().x(), targetRect.y() - frameRect().y(), targetRect.width(), targetRect.height()); +#endif + } +} + +void PluginView::invalidateRect(const IntRect& rect) +{ + if (platformPluginWidget()) +#if PLATFORM(QT) + platformPluginWidget()->update(convertToContainingWindow(rect)); +#else + platformPluginWidget()->RefreshRect(convertToContainingWindow(rect)); +#endif + else + invalidateWindowlessPluginRect(rect); +} + +void PluginView::invalidateRect(NPRect* rect) +{ + IntRect r(rect->left, rect->top, rect->right - rect->left, rect->bottom - rect->top); + invalidateRect(r); +} + +void PluginView::invalidateRegion(NPRegion region) +{ + // TODO: optimize + invalidate(); +} + +void PluginView::forceRedraw() +{ + notImplemented(); +} + + +// ----------------- Event handling -------------------- + +void PluginView::handleMouseEvent(MouseEvent* event) +{ + if (!m_isStarted) + return; + +#ifndef NP_NO_CARBON + EventRecord record; + + if (event->type() == eventNames().mousemoveEvent) { + // Mouse movement is handled by null timer events + m_lastMousePos = mousePosForPlugin(event); + return; + } else if (event->type() == eventNames().mouseoverEvent) { + record.what = adjustCursorEvent; + } else if (event->type() == eventNames().mouseoutEvent) { + record.what = adjustCursorEvent; + } else if (event->type() == eventNames().mousedownEvent) { + record.what = mouseDown; + // The plugin needs focus to receive keyboard events + if (Page* page = m_parentFrame->page()) + page->focusController()->setFocusedFrame(m_parentFrame); + m_parentFrame->document()->setFocusedNode(m_element); + } else if (event->type() == eventNames().mouseupEvent) { + record.what = mouseUp; + } else { + return; + } + record.where = mousePosForPlugin(event); + record.modifiers = modifiersForEvent(event); + + if (!event->buttonDown()) + record.modifiers |= btnState; + + if (event->button() == 2) + record.modifiers |= controlKey; + + if (!dispatchNPEvent(record)) { + if (record.what == adjustCursorEvent) + return; // Signals that the plugin wants a normal cursor + + LOG(Events, "PluginView::handleMouseEvent(): Mouse event type %d at %d,%d not accepted", + record.what, record.where.h, record.where.v); + } else { + event->setDefaultHandled(); + } +#endif +} + +void PluginView::handleKeyboardEvent(KeyboardEvent* event) +{ + if (!m_isStarted) + return; + + LOG(Plugins, "PluginView::handleKeyboardEvent() ----------------- "); + + LOG(Plugins, "PV::hKE(): KE.keyCode: 0x%02X, KE.charCode: %d", + event->keyCode(), event->charCode()); + +#ifndef NP_NO_CARBON + EventRecord record; + + if (event->type() == eventNames().keydownEvent) { + // This event is the result of a PlatformKeyboardEvent::KeyDown which + // was disambiguated into a PlatformKeyboardEvent::RawKeyDown. Since + // we don't have access to the text here, we return, and wait for the + // corresponding event based on PlatformKeyboardEvent::Char. + return; + } else if (event->type() == eventNames().keypressEvent) { + // Which would be this one. This event was disambiguated from the same + // PlatformKeyboardEvent::KeyDown, but to a PlatformKeyboardEvent::Char, + // which retains the text from the original event. So, we can safely pass + // on the event as a key-down event to the plugin. + record.what = keyDown; + } else if (event->type() == eventNames().keyupEvent) { + // PlatformKeyboardEvent::KeyUp events always have the text, so nothing + // fancy here. + record.what = keyUp; + } else { + return; + } + + const PlatformKeyboardEvent* platformEvent = event->keyEvent(); + int keyCode = platformEvent->nativeVirtualKeyCode(); + + const String text = platformEvent->text(); + if (text.length() < 1) { + event->setDefaultHandled(); + return; + } + + WTF::RetainPtr<CFStringRef> cfText(WTF::AdoptCF, text.createCFString()); + + LOG(Plugins, "PV::hKE(): PKE.text: %s, PKE.unmodifiedText: %s, PKE.keyIdentifier: %s", + text.ascii().data(), platformEvent->unmodifiedText().ascii().data(), + platformEvent->keyIdentifier().ascii().data()); + + char charCodes[2] = { 0, 0 }; + if (!CFStringGetCString(cfText.get(), charCodes, 2, CFStringGetSystemEncoding())) { + LOG_ERROR("Could not resolve character code using system encoding."); + event->setDefaultHandled(); + return; + } + + record.where = globalMousePosForPlugin(); + record.modifiers = modifiersForEvent(event); + record.message = ((keyCode & 0xFF) << 8) | (charCodes[0] & 0xFF); + record.when = TickCount(); + + LOG(Plugins, "PV::hKE(): record.modifiers: %d", record.modifiers); + +#if PLATFORM(QT) + LOG(Plugins, "PV::hKE(): PKE.qtEvent()->nativeVirtualKey: 0x%02X, charCode: %d", + keyCode, int(uchar(charCodes[0]))); +#endif + + if (!dispatchNPEvent(record)) + LOG(Events, "PluginView::handleKeyboardEvent(): Keyboard event type %d not accepted", record.what); + else + event->setDefaultHandled(); +#endif +} + +#ifndef NP_NO_CARBON +void PluginView::nullEventTimerFired(Timer<PluginView>*) +{ + EventRecord record; + + record.what = nullEvent; + record.message = 0; + record.when = TickCount(); + record.where = m_lastMousePos; + record.modifiers = GetCurrentKeyModifiers(); + if (!Button()) + record.modifiers |= btnState; + + if (!dispatchNPEvent(record)) + LOG(Events, "PluginView::nullEventTimerFired(): Null event not accepted"); +} +#endif + +#ifndef NP_NO_CARBON +static int modifiersForEvent(UIEventWithKeyState* event) +{ + int modifiers = 0; + + if (event->ctrlKey()) + modifiers |= controlKey; + + if (event->altKey()) + modifiers |= optionKey; + + if (event->metaKey()) + modifiers |= cmdKey; + + if (event->shiftKey()) + modifiers |= shiftKey; + + return modifiers; +} +#endif + +#ifndef NP_NO_CARBON +static bool tigerOrBetter() +{ + static SInt32 systemVersion = 0; + + if (!systemVersion) { + if (Gestalt(gestaltSystemVersion, &systemVersion) != noErr) + return false; + } + + return systemVersion >= 0x1040; +} +#endif + +#ifndef NP_NO_CARBON +Point PluginView::globalMousePosForPlugin() const +{ + Point pos; + GetGlobalMouse(&pos); + + float scaleFactor = tigerOrBetter() ? HIGetScaleFactor() : 1; + + pos.h = short(pos.h * scaleFactor); + pos.v = short(pos.v * scaleFactor); + +#if PLATFORM(WX) + // make sure the titlebar/toolbar size is included + WindowRef windowRef = nativeWindowFor(platformPluginWidget()); + ::Rect content, structure; + + GetWindowBounds(windowRef, kWindowStructureRgn, &structure); + GetWindowBounds(windowRef, kWindowContentRgn, &content); + + int top = content.top - structure.top; + pos.v -= top; +#endif + + return pos; +} +#endif + +#ifndef NP_NO_CARBON +Point PluginView::mousePosForPlugin(MouseEvent* event) const +{ + ASSERT(event); + if (platformPluginWidget()) + return globalMousePosForPlugin(); + + if (event->button() == 2) { + // always pass the global position for right-click since Flash uses it to position the context menu + return globalMousePosForPlugin(); + } + + Point pos; + IntPoint postZoomPos = roundedIntPoint(m_element->renderer()->absoluteToLocal(event->absoluteLocation())); + pos.h = postZoomPos.x() + m_windowRect.x(); + // The number 22 is the height of the title bar. As to why it figures in the calculation below + // is left as an exercise to the reader :-) + pos.v = postZoomPos.y() + m_windowRect.y() - 22; + return pos; +} +#endif + +#ifndef NP_NO_CARBON +bool PluginView::dispatchNPEvent(NPEvent& event) +{ + PluginView::setCurrentPluginView(this); + JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly); + setCallingPlugin(true); + + bool accepted = m_plugin->pluginFuncs()->event(m_instance, &event); + + setCallingPlugin(false); + PluginView::setCurrentPluginView(0); + return accepted; +} +#endif + +// ------------------- Miscellaneous ------------------ + +NPError PluginView::handlePostReadFile(Vector<char>& buffer, uint32_t len, const char* buf) +{ + String filename(buf, len); + + if (filename.startsWith("file:///")) + filename = filename.substring(8); + + if (!fileExists(filename)) + return NPERR_FILE_NOT_FOUND; + + FILE* fileHandle = fopen((filename.utf8()).data(), "r"); + + if (fileHandle == 0) + return NPERR_FILE_NOT_FOUND; + + int bytesRead = fread(buffer.data(), 1, 0, fileHandle); + + fclose(fileHandle); + + if (bytesRead <= 0) + return NPERR_FILE_NOT_FOUND; + + return NPERR_NO_ERROR; +} + +void PluginView::halt() +{ +} + +void PluginView::restart() +{ +} + +} // namespace WebCore diff --git a/WebCore/rendering/HitTestRequest.h b/WebCore/rendering/HitTestRequest.h index ca1445a..97d8680 100644 --- a/WebCore/rendering/HitTestRequest.h +++ b/WebCore/rendering/HitTestRequest.h @@ -27,11 +27,12 @@ namespace WebCore { class HitTestRequest { public: enum RequestType { - ReadOnly = 0x1, - Active = 0x2, - MouseMove = 0x4, - MouseUp = 0x8, - IgnoreClipping = 0x10 + ReadOnly = 1 << 1, + Active = 1 << 2, + MouseMove = 1 << 3, + MouseUp = 1 << 4, + IgnoreClipping = 1 << 5, + SVGClipContent = 1 << 6 }; HitTestRequest(int requestType) @@ -44,6 +45,7 @@ public: bool mouseMove() const { return m_requestType & MouseMove; } bool mouseUp() const { return m_requestType & MouseUp; } bool ignoreClipping() const { return m_requestType & IgnoreClipping; } + bool svgClipContent() const { return m_requestType & SVGClipContent; } private: int m_requestType; diff --git a/WebCore/rendering/InlineTextBox.cpp b/WebCore/rendering/InlineTextBox.cpp index 0933ae4..2fc5823 100644 --- a/WebCore/rendering/InlineTextBox.cpp +++ b/WebCore/rendering/InlineTextBox.cpp @@ -382,8 +382,8 @@ void InlineTextBox::paint(RenderObject::PaintInfo& paintInfo, int tx, int ty) GraphicsContext* context = paintInfo.context; // Determine whether or not we have composition underlines to draw. - bool containsComposition = renderer()->node() && renderer()->document()->frame()->editor()->compositionNode() == renderer()->node(); - bool useCustomUnderlines = containsComposition && renderer()->document()->frame()->editor()->compositionUsesCustomUnderlines(); + bool containsComposition = renderer()->node() && renderer()->frame()->editor()->compositionNode() == renderer()->node(); + bool useCustomUnderlines = containsComposition && renderer()->frame()->editor()->compositionUsesCustomUnderlines(); // Set our font. RenderStyle* styleToUse = renderer()->style(m_firstLine); @@ -401,8 +401,8 @@ void InlineTextBox::paint(RenderObject::PaintInfo& paintInfo, int tx, int ty) if (containsComposition && !useCustomUnderlines) paintCompositionBackground(context, tx, ty, styleToUse, font, - renderer()->document()->frame()->editor()->compositionStart(), - renderer()->document()->frame()->editor()->compositionEnd()); + renderer()->frame()->editor()->compositionStart(), + renderer()->frame()->editor()->compositionEnd()); paintDocumentMarkers(context, tx, ty, styleToUse, font, true); @@ -531,7 +531,7 @@ void InlineTextBox::paint(RenderObject::PaintInfo& paintInfo, int tx, int ty) paintDocumentMarkers(context, tx, ty, styleToUse, font, false); if (useCustomUnderlines) { - const Vector<CompositionUnderline>& underlines = renderer()->document()->frame()->editor()->customCompositionUnderlines(); + const Vector<CompositionUnderline>& underlines = renderer()->frame()->editor()->customCompositionUnderlines(); size_t numUnderlines = underlines.size(); for (size_t index = 0; index < numUnderlines; ++index) { @@ -634,7 +634,7 @@ void InlineTextBox::paintCompositionBackground(GraphicsContext* context, int tx, void InlineTextBox::paintCustomHighlight(int tx, int ty, const AtomicString& type) { - Frame* frame = renderer()->document()->frame(); + Frame* frame = renderer()->frame(); if (!frame) return; Page* page = frame->page(); @@ -818,7 +818,7 @@ void InlineTextBox::paintTextMatchMarker(GraphicsContext* pt, int tx, int ty, co renderer()->document()->setRenderedRectForMarker(renderer()->node(), marker, markerRect); // Optionally highlight the text - if (renderer()->document()->frame()->markedTextMatchesAreHighlighted()) { + if (renderer()->frame()->markedTextMatchesAreHighlighted()) { Color color = marker.activeMatch ? renderer()->theme()->platformActiveTextSearchHighlightColor() : renderer()->theme()->platformInactiveTextSearchHighlightColor(); diff --git a/WebCore/rendering/LayoutState.cpp b/WebCore/rendering/LayoutState.cpp index c94e77b..18c3da7 100644 --- a/WebCore/rendering/LayoutState.cpp +++ b/WebCore/rendering/LayoutState.cpp @@ -90,6 +90,13 @@ LayoutState::LayoutState(RenderObject* root) RenderObject* container = root->container(); FloatPoint absContentPoint = container->localToAbsolute(FloatPoint(), false, true); m_offset = IntSize(absContentPoint.x(), absContentPoint.y()); + + if (container->hasOverflowClip()) { + RenderLayer* layer = toRenderBoxModelObject(container)->layer(); + m_clipped = true; + m_clipRect = IntRect(toPoint(m_offset), layer->size()); + m_offset -= layer->scrolledContentOffset(); + } } #ifndef NDEBUG diff --git a/WebCore/rendering/PointerEventsHitRules.cpp b/WebCore/rendering/PointerEventsHitRules.cpp index ababcfd..cc5aae4 100644 --- a/WebCore/rendering/PointerEventsHitRules.cpp +++ b/WebCore/rendering/PointerEventsHitRules.cpp @@ -22,13 +22,16 @@ namespace WebCore { -PointerEventsHitRules::PointerEventsHitRules(EHitTesting hitTesting, EPointerEvents pointerEvents) +PointerEventsHitRules::PointerEventsHitRules(EHitTesting hitTesting, const HitTestRequest& request, EPointerEvents pointerEvents) : requireVisible(false) , requireFill(false) , requireStroke(false) , canHitStroke(false) , canHitFill(false) { + if (request.svgClipContent()) + pointerEvents = PE_FILL; + if (hitTesting == SVG_PATH_HITTESTING) { switch (pointerEvents) { diff --git a/WebCore/rendering/PointerEventsHitRules.h b/WebCore/rendering/PointerEventsHitRules.h index c17c19c..72fbc45 100644 --- a/WebCore/rendering/PointerEventsHitRules.h +++ b/WebCore/rendering/PointerEventsHitRules.h @@ -20,6 +20,7 @@ #ifndef PointerEventsHitRules_h #define PointerEventsHitRules_h +#include "HitTestRequest.h" #include "RenderStyleConstants.h" namespace WebCore { @@ -32,7 +33,7 @@ public: SVG_TEXT_HITTESTING }; - PointerEventsHitRules(EHitTesting, EPointerEvents); + PointerEventsHitRules(EHitTesting, const HitTestRequest&, EPointerEvents); bool requireVisible; bool requireFill; diff --git a/WebCore/rendering/RenderApplet.cpp b/WebCore/rendering/RenderApplet.cpp index 7411c54..a1689a5 100644 --- a/WebCore/rendering/RenderApplet.cpp +++ b/WebCore/rendering/RenderApplet.cpp @@ -70,7 +70,7 @@ void RenderApplet::createWidgetIfNecessary() } } - Frame* frame = document()->frame(); + Frame* frame = this->frame(); ASSERT(frame); setWidget(frame->loader()->createJavaAppletWidget(IntSize(contentWidth, contentHeight), element, m_args)); } diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp index 5ac57f0..f60b13c 100644 --- a/WebCore/rendering/RenderBlock.cpp +++ b/WebCore/rendering/RenderBlock.cpp @@ -36,6 +36,7 @@ #include "RenderFlexibleBox.h" #include "RenderImage.h" #include "RenderInline.h" +#include "RenderLayer.h" #include "RenderMarquee.h" #include "RenderReplica.h" #include "RenderTableCell.h" @@ -234,6 +235,16 @@ void RenderBlock::styleDidChange(StyleDifference diff, const RenderStyle* oldSty { RenderBox::styleDidChange(diff, oldStyle); + if (!isAnonymousBlock()) { + // Ensure that all of our continuation blocks pick up the new style. + for (RenderBlock* currCont = blockElementContinuation(); currCont; currCont = currCont->blockElementContinuation()) { + RenderBoxModelObject* nextCont = currCont->continuation(); + currCont->setContinuation(0); + currCont->setStyle(style()); + currCont->setContinuation(nextCont); + } + } + // FIXME: We could save this call when the change only affected non-inherited properties for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { if (child->isAnonymousBlock()) { @@ -268,6 +279,68 @@ void RenderBlock::updateBeforeAfterContent(PseudoId pseudoId) return children()->updateBeforeAfterContent(this, pseudoId); } +RenderBlock* RenderBlock::continuationBefore(RenderObject* beforeChild) +{ + if (beforeChild && beforeChild->parent() == this) + return this; + + RenderBlock* curr = toRenderBlock(continuation()); + RenderBlock* nextToLast = this; + RenderBlock* last = this; + while (curr) { + if (beforeChild && beforeChild->parent() == curr) { + if (curr->firstChild() == beforeChild) + return last; + return curr; + } + + nextToLast = last; + last = curr; + curr = toRenderBlock(curr->continuation()); + } + + if (!beforeChild && !last->firstChild()) + return nextToLast; + return last; +} + +void RenderBlock::addChildToContinuation(RenderObject* newChild, RenderObject* beforeChild) +{ + RenderBlock* flow = continuationBefore(beforeChild); + ASSERT(!beforeChild || beforeChild->parent()->isAnonymousColumnSpanBlock() || beforeChild->parent()->isRenderBlock()); + RenderBoxModelObject* beforeChildParent = 0; + if (beforeChild) + beforeChildParent = toRenderBoxModelObject(beforeChild->parent()); + else { + RenderBoxModelObject* cont = flow->continuation(); + if (cont) + beforeChildParent = cont; + else + beforeChildParent = flow; + } + + if (newChild->isFloatingOrPositioned()) + return beforeChildParent->addChildIgnoringContinuation(newChild, beforeChild); + + // A continuation always consists of two potential candidates: a block or an anonymous + // column span box holding column span children. + bool childIsNormal = newChild->isInline() || !newChild->style()->columnSpan(); + bool bcpIsNormal = beforeChildParent->isInline() || !beforeChildParent->style()->columnSpan(); + bool flowIsNormal = flow->isInline() || !flow->style()->columnSpan(); + + if (flow == beforeChildParent) + return flow->addChildIgnoringContinuation(newChild, beforeChild); + + // The goal here is to match up if we can, so that we can coalesce and create the + // minimal # of continuations needed for the inline. + if (childIsNormal == bcpIsNormal) + return beforeChildParent->addChildIgnoringContinuation(newChild, beforeChild); + if (flowIsNormal == childIsNormal) + return flow->addChildIgnoringContinuation(newChild, 0); // Just treat like an append. + return beforeChildParent->addChildIgnoringContinuation(newChild, beforeChild); +} + + void RenderBlock::addChildToAnonymousColumnBlocks(RenderObject* newChild, RenderObject* beforeChild) { ASSERT(!continuation()); // We don't yet support column spans that aren't immediate children of the multi-column block. @@ -314,12 +387,158 @@ void RenderBlock::addChildToAnonymousColumnBlocks(RenderObject* newChild, Render return; } +RenderBlock* RenderBlock::containingColumnsBlock(bool allowAnonymousColumnBlock) +{ + for (RenderObject* curr = this; curr; curr = curr->parent()) { + if (!curr->isRenderBlock() || curr->isFloatingOrPositioned() || curr->isTableCell() || curr->isRoot() || curr->isRenderView() || curr->hasOverflowClip() + || curr->isInlineBlockOrInlineTable()) + return 0; + + RenderBlock* currBlock = toRenderBlock(curr); + if (currBlock->style()->specifiesColumns() && (allowAnonymousColumnBlock || !currBlock->isAnonymousColumnsBlock())) + return currBlock; + + if (currBlock->isAnonymousColumnSpanBlock()) + return 0; + } + return 0; +} + +RenderBlock* RenderBlock::clone() const +{ + RenderBlock* o = new (renderArena()) RenderBlock(node()); + o->setStyle(style()); + o->setChildrenInline(childrenInline()); + return o; +} + +void RenderBlock::splitBlocks(RenderBlock* fromBlock, RenderBlock* toBlock, + RenderBlock* middleBlock, + RenderObject* beforeChild, RenderBoxModelObject* oldCont) +{ + // Create a clone of this inline. + RenderBlock* cloneBlock = clone(); + cloneBlock->setContinuation(oldCont); + + // Now take all of the children from beforeChild to the end and remove + // them from |this| and place them in the clone. + if (!beforeChild && isAfterContent(lastChild())) + beforeChild = lastChild(); + moveChildrenTo(cloneBlock, beforeChild, 0); + + // Hook |clone| up as the continuation of the middle block. + middleBlock->setContinuation(cloneBlock); + + // We have been reparented and are now under the fromBlock. We need + // to walk up our block parent chain until we hit the containing anonymous columns block. + // Once we hit the anonymous columns block we're done. + RenderBoxModelObject* curr = toRenderBoxModelObject(parent()); + RenderBoxModelObject* currChild = this; + + while (curr && curr != fromBlock) { + ASSERT(curr->isRenderBlock() && !curr->isAnonymousBlock()); + + RenderBlock* blockCurr = toRenderBlock(curr); + + // Create a new clone. + RenderBlock* cloneChild = cloneBlock; + cloneBlock = blockCurr->clone(); + + // Insert our child clone as the first child. + cloneBlock->children()->appendChildNode(cloneBlock, cloneChild); + + // Hook the clone up as a continuation of |curr|. Note we do encounter + // anonymous blocks possibly as we walk up the block chain. When we split an + // anonymous block, there's no need to do any continuation hookup, since we haven't + // actually split a real element. + if (!blockCurr->isAnonymousBlock()) { + oldCont = blockCurr->continuation(); + blockCurr->setContinuation(cloneBlock); + cloneBlock->setContinuation(oldCont); + } + + // Someone may have indirectly caused a <q> to split. When this happens, the :after content + // has to move into the inline continuation. Call updateBeforeAfterContent to ensure that the inline's :after + // content gets properly destroyed. + if (document()->usesBeforeAfterRules()) + blockCurr->children()->updateBeforeAfterContent(blockCurr, AFTER); + + // Now we need to take all of the children starting from the first child + // *after* currChild and append them all to the clone. + RenderObject* afterContent = isAfterContent(cloneBlock->lastChild()) ? cloneBlock->lastChild() : 0; + blockCurr->moveChildrenTo(cloneBlock, currChild->nextSibling(), 0, afterContent); + + // Keep walking up the chain. + currChild = curr; + curr = toRenderBoxModelObject(curr->parent()); + } + + // Now we are at the columns block level. We need to put the clone into the toBlock. + toBlock->children()->appendChildNode(toBlock, cloneBlock); + + // Now take all the children after currChild and remove them from the fromBlock + // and put them in the toBlock. + fromBlock->moveChildrenTo(toBlock, currChild->nextSibling(), 0); +} + +void RenderBlock::splitFlow(RenderObject* beforeChild, RenderBlock* newBlockBox, + RenderObject* newChild, RenderBoxModelObject* oldCont) +{ + RenderBlock* pre = 0; + RenderBlock* block = containingColumnsBlock(); + + // Delete our line boxes before we do the inline split into continuations. + block->deleteLineBoxTree(); + + bool madeNewBeforeBlock = false; + if (block->isAnonymousColumnsBlock()) { + // We can reuse this block and make it the preBlock of the next continuation. + pre = block; + pre->removePositionedObjects(0); + block = toRenderBlock(block->parent()); + } else { + // No anonymous block available for use. Make one. + pre = block->createAnonymousColumnsBlock(); + pre->setChildrenInline(false); + madeNewBeforeBlock = true; + } + + RenderBlock* post = block->createAnonymousColumnsBlock(); + post->setChildrenInline(false); + + RenderObject* boxFirst = madeNewBeforeBlock ? block->firstChild() : pre->nextSibling(); + if (madeNewBeforeBlock) + block->children()->insertChildNode(block, pre, boxFirst); + block->children()->insertChildNode(block, newBlockBox, boxFirst); + block->children()->insertChildNode(block, post, boxFirst); + block->setChildrenInline(false); + + if (madeNewBeforeBlock) + block->moveChildrenTo(pre, boxFirst, 0); + + splitBlocks(pre, post, newBlockBox, beforeChild, oldCont); + + // We already know the newBlockBox isn't going to contain inline kids, so avoid wasting + // time in makeChildrenNonInline by just setting this explicitly up front. + newBlockBox->setChildrenInline(false); + + // We delayed adding the newChild until now so that the |newBlockBox| would be fully + // connected, thus allowing newChild access to a renderArena should it need + // to wrap itself in additional boxes (e.g., table construction). + newBlockBox->addChild(newChild); + + // Always just do a full layout in order to ensure that line boxes (especially wrappers for images) + // get deleted properly. Because objects moves from the pre block into the post block, we want to + // make new line boxes instead of leaving the old line boxes around. + pre->setNeedsLayoutAndPrefWidthsRecalc(); + block->setNeedsLayoutAndPrefWidthsRecalc(); + post->setNeedsLayoutAndPrefWidthsRecalc(); +} + RenderObject* RenderBlock::splitAnonymousBlocksAroundChild(RenderObject* beforeChild) { while (beforeChild->parent() != this) { RenderBlock* blockToSplit = toRenderBlock(beforeChild->parent()); - ASSERT(blockToSplit->isAnonymousBlock() && !blockToSplit->continuation()); - if (blockToSplit->firstChild() != beforeChild) { // We have to split the parentBlock into two blocks. RenderBlock* post = createAnonymousBlockWithSameTypeAs(blockToSplit); @@ -333,7 +552,6 @@ RenderObject* RenderBlock::splitAnonymousBlocksAroundChild(RenderObject* beforeC } else beforeChild = blockToSplit; } - return beforeChild; } @@ -346,10 +564,10 @@ void RenderBlock::makeChildrenAnonymousColumnBlocks(RenderObject* beforeChild, R // Delete the block's line boxes before we do the split. block->deleteLineBoxTree(); - + if (beforeChild && beforeChild->parent() != this) beforeChild = splitAnonymousBlocksAroundChild(beforeChild); - + if (beforeChild != firstChild()) { pre = block->createAnonymousColumnsBlock(); pre->setChildrenInline(block->childrenInline()); @@ -391,19 +609,24 @@ void RenderBlock::makeChildrenAnonymousColumnBlocks(RenderObject* beforeChild, R post->setNeedsLayoutAndPrefWidthsRecalc(); } -static RenderBlock* columnsBlockForSpanningElement(RenderBlock* block, RenderObject* newChild) +RenderBlock* RenderBlock::columnsBlockForSpanningElement(RenderObject* newChild) { - // FIXME: The style of this function may seem weird. - // This function is the gateway for the addition of column-span support. Support will be added in three stages: + // FIXME: This function is the gateway for the addition of column-span support. It will + // be added to in three stages: // (1) Immediate children of a multi-column block can span. // (2) Nested block-level children with only block-level ancestors between them and the multi-column block can span. // (3) Nested children with block or inline ancestors between them and the multi-column block can span (this is when we // cross the streams and have to cope with both types of continuations mixed together). - // This function currently only supports (1). - if (!newChild->isText() && newChild->style()->columnSpan() && !newChild->isFloatingOrPositioned() - && !newChild->isInline() && !block->isAnonymousColumnSpanBlock() && block->style()->specifiesColumns()) - return block; - return 0; + // This function currently supports (1) and (2). + RenderBlock* columnsBlockAncestor = 0; + if (!newChild->isText() && newChild->style()->columnSpan() && !newChild->isFloatingOrPositioned() + && !newChild->isInline() && !isAnonymousColumnSpanBlock()) { + if (style()->specifiesColumns()) + columnsBlockAncestor = this; + else + columnsBlockAncestor = toRenderBlock(parent())->containingColumnsBlock(false); + } + return columnsBlockAncestor; } void RenderBlock::addChildIgnoringAnonymousColumnBlocks(RenderObject* newChild, RenderObject* beforeChild) @@ -418,26 +641,34 @@ void RenderBlock::addChildIgnoringAnonymousColumnBlocks(RenderObject* newChild, } // Check for a spanning element in columns. - RenderBlock* columnsBlockAncestor = columnsBlockForSpanningElement(this, newChild); + RenderBlock* columnsBlockAncestor = columnsBlockForSpanningElement(newChild); if (columnsBlockAncestor) { - ASSERT(columnsBlockAncestor == this); - - // We are placing a column-span element inside a block. We have to perform a split of this - // block's children. This involves creating an anonymous block box to hold - // the column-spanning |newChild|. We take all of the children from before |newChild| and put them into - // one anonymous columns block, and all of the children after |newChild| go into another anonymous block. + // We are placing a column-span element inside a block. RenderBlock* newBox = createAnonymousColumnSpanBlock(); - // Someone may have put the spanning element inside an element with generated content, causing a split. When this happens, - // the :after content has to move into the last anonymous block. Call updateBeforeAfterContent to ensure that our :after - // content gets properly destroyed. - bool isLastChild = (beforeChild == lastChild()); - if (document()->usesBeforeAfterRules()) - children()->updateBeforeAfterContent(this, AFTER); - if (isLastChild && beforeChild != lastChild()) - beforeChild = 0; // We destroyed the last child, so now we need to update our insertion - // point to be 0. It's just a straight append now. + if (columnsBlockAncestor != this) { + // We are nested inside a multi-column element and are being split by the span. We have to break up + // our block into continuations. + RenderBoxModelObject* oldContinuation = continuation(); + setContinuation(newBox); + + // Someone may have put a <p> inside a <q>, causing a split. When this happens, the :after content + // has to move into the inline continuation. Call updateBeforeAfterContent to ensure that our :after + // content gets properly destroyed. + bool isLastChild = (beforeChild == lastChild()); + if (document()->usesBeforeAfterRules()) + children()->updateBeforeAfterContent(this, AFTER); + if (isLastChild && beforeChild != lastChild()) + beforeChild = 0; // We destroyed the last child, so now we need to update our insertion + // point to be 0. It's just a straight append now. + + splitFlow(beforeChild, newBox, newChild, oldContinuation); + return; + } + // We have to perform a split of this block's children. This involves creating an anonymous block box to hold + // the column-spanning |newChild|. We take all of the children from before |newChild| and put them into + // one anonymous columns block, and all of the children after |newChild| go into another anonymous block. makeChildrenAnonymousColumnBlocks(beforeChild, newBox, newChild); return; } @@ -521,7 +752,14 @@ void RenderBlock::addChildIgnoringAnonymousColumnBlocks(RenderObject* newChild, void RenderBlock::addChild(RenderObject* newChild, RenderObject* beforeChild) { - if (!isAnonymous() && firstChild() && (firstChild()->isAnonymousColumnsBlock() || firstChild()->isAnonymousColumnSpanBlock())) + if (continuation() && !isAnonymousBlock()) + return addChildToContinuation(newChild, beforeChild); + return addChildIgnoringContinuation(newChild, beforeChild); +} + +void RenderBlock::addChildIgnoringContinuation(RenderObject* newChild, RenderObject* beforeChild) +{ + if (!isAnonymousBlock() && firstChild() && (firstChild()->isAnonymousColumnsBlock() || firstChild()->isAnonymousColumnSpanBlock())) return addChildToAnonymousColumnBlocks(newChild, beforeChild); return addChildIgnoringAnonymousColumnBlocks(newChild, beforeChild); } @@ -1885,11 +2123,13 @@ void RenderBlock::paintChildren(PaintInfo& paintInfo, int tx, int ty) PaintInfo info(paintInfo); info.phase = newPhase; info.paintingRoot = paintingRootForChildren(paintInfo); - bool isPrinting = document()->printing(); + bool checkPageBreaks = document()->printing() && !document()->settings()->paginateDuringLayoutEnabled(); + bool checkColumnBreaks = !checkPageBreaks && !view()->printRect().isEmpty() && !document()->settings()->paginateDuringLayoutEnabled(); for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) { // Check for page-break-before: always, and if it's set, break and bail. - if (isPrinting && !childrenInline() && child->style()->pageBreakBefore() == PBALWAYS + bool checkBeforeAlways = !childrenInline() && (checkPageBreaks && child->style()->pageBreakBefore() == PBALWAYS || checkColumnBreaks && child->style()->columnBreakBefore() == PBALWAYS); + if (checkBeforeAlways && (ty + child->y()) > paintInfo.rect.y() && (ty + child->y()) < paintInfo.rect.bottom()) { view()->setBestTruncatedAt(ty + child->y(), this, true); @@ -1897,7 +2137,8 @@ void RenderBlock::paintChildren(PaintInfo& paintInfo, int tx, int ty) } // Check for page-break-inside: avoid, and it it's set, break and bail. - if (isPrinting && !childrenInline() && child->style()->pageBreakInside() == PBAVOID + bool checkInsideAvoid = !childrenInline() && (checkPageBreaks && child->style()->pageBreakInside() == PBAVOID || checkColumnBreaks && child->style()->columnBreakInside() == PBAVOID); + if (checkInsideAvoid && ty + child->y() > paintInfo.rect.y() && ty + child->y() < paintInfo.rect.bottom() && ty + child->y() + child->height() > paintInfo.rect.bottom()) { @@ -1909,7 +2150,8 @@ void RenderBlock::paintChildren(PaintInfo& paintInfo, int tx, int ty) child->paint(info, tx, ty); // Check for page-break-after: always, and if it's set, break and bail. - if (isPrinting && !childrenInline() && child->style()->pageBreakAfter() == PBALWAYS + bool checkAfterAlways = !childrenInline() && (checkPageBreaks && child->style()->pageBreakAfter() == PBALWAYS || checkColumnBreaks && child->style()->columnBreakAfter() == PBALWAYS); + if (checkAfterAlways && (ty + child->y() + child->height()) > paintInfo.rect.y() && (ty + child->y() + child->height()) < paintInfo.rect.bottom()) { view()->setBestTruncatedAt(ty + child->y() + child->height() + max(0, child->collapsedMarginBottom()), this, true); @@ -1920,10 +2162,10 @@ void RenderBlock::paintChildren(PaintInfo& paintInfo, int tx, int ty) void RenderBlock::paintCaret(PaintInfo& paintInfo, int tx, int ty, CaretType type) { - SelectionController* selection = type == CursorCaret ? document()->frame()->selection() : document()->frame()->dragCaretController(); + SelectionController* selection = type == CursorCaret ? frame()->selection() : frame()->dragCaretController(); // Paint the caret if the SelectionController says so or if caret browsing is enabled - bool caretBrowsing = document()->frame()->settings() && document()->frame()->settings()->caretBrowsingEnabled(); + bool caretBrowsing = frame()->settings() && frame()->settings()->caretBrowsingEnabled(); RenderObject* caretPainter = selection->caretRenderer(); if (caretPainter == this && (selection->isContentEditable() || caretBrowsing)) { // Convert the painting offset into the local coordinate system of this renderer, @@ -1931,9 +2173,9 @@ void RenderBlock::paintCaret(PaintInfo& paintInfo, int tx, int ty, CaretType typ offsetForContents(tx, ty); if (type == CursorCaret) - document()->frame()->selection()->paintCaret(paintInfo.context, tx, ty, paintInfo.rect); + frame()->selection()->paintCaret(paintInfo.context, tx, ty, paintInfo.rect); else - document()->frame()->paintDragCaret(paintInfo.context, tx, ty, paintInfo.rect); + frame()->paintDragCaret(paintInfo.context, tx, ty, paintInfo.rect); } } @@ -2082,7 +2324,7 @@ RenderBlock* RenderBlock::blockElementContinuation() const RenderBlock* nextContinuation = toRenderBlock(m_continuation); if (nextContinuation->isAnonymousBlock()) return nextContinuation->blockElementContinuation(); - return 0; + return nextContinuation; } static ContinuationOutlineTableMap* continuationOutlineTable() @@ -3209,6 +3451,12 @@ void RenderBlock::clearFloats() m_floatingObjects->clear(); } + // We should not process floats if the parent node is not a RenderBlock. Otherwise, we will add + // floats in an invalid context. This will cause a crash arising from a bad cast on the parent. + // See <rdar://problem/8049753>, where float property is applied on a text node in a SVG. + if (!parent() || !parent()->isRenderBlock()) + return; + // Attempt to locate a previous sibling with overhanging floats. We skip any elements that are // out of flow (like floating/positioned elements), and we also skip over any objects that may have shifted // to avoid floats. @@ -3777,16 +4025,15 @@ VisiblePosition RenderBlock::positionForPointWithInlineChildren(const IntPoint& } } - Settings* settings = document()->settings(); - bool useWindowsBehavior = settings && settings->editingBehavior() == EditingWindowsBehavior; + bool moveCaretToBoundary = document()->frame()->editor()->behavior().shouldMoveCaretToHorizontalBoundaryWhenPastTopOrBottom(); - if (useWindowsBehavior && !closestBox && lastRootBoxWithChildren) { + if (!moveCaretToBoundary && !closestBox && lastRootBoxWithChildren) { // y coordinate is below last root line box, pretend we hit it closestBox = lastRootBoxWithChildren->closestLeafChildForXPos(pointInContents.x()); } if (closestBox) { - if (!useWindowsBehavior && pointInContents.y() < firstRootBoxWithChildren->lineTop() - verticalLineClickFudgeFactor) { + if (moveCaretToBoundary && pointInContents.y() < firstRootBoxWithChildren->lineTop() - verticalLineClickFudgeFactor) { // y coordinate is above first root line box, so return the start of the first return VisiblePosition(positionForBox(firstRootBoxWithChildren->firstLeafChild(), true), DOWNSTREAM); } @@ -3797,7 +4044,7 @@ VisiblePosition RenderBlock::positionForPointWithInlineChildren(const IntPoint& if (lastRootBoxWithChildren) { // We hit this case for Mac behavior when the Y coordinate is below the last box. - ASSERT(!useWindowsBehavior); + ASSERT(moveCaretToBoundary); return VisiblePosition(positionForBox(lastRootBoxWithChildren->lastLeafChild(), false), DOWNSTREAM); } @@ -3932,7 +4179,8 @@ void RenderBlock::setDesiredColumnCountAndWidth(int count, int width) bool destroyColumns = !firstChild() || (count == 1 && style()->hasAutoColumnWidth()) || firstChild()->isAnonymousColumnsBlock() - || firstChild()->isAnonymousColumnSpanBlock(); + || firstChild()->isAnonymousColumnSpanBlock() + || document()->settings()->paginateDuringLayoutEnabled(); if (destroyColumns) { if (hasColumns()) { delete gColumnInfoMap->take(this); @@ -3997,7 +4245,7 @@ int RenderBlock::layoutColumns(int endOfContent, int requestedColumnHeight) if (computeIntrinsicHeight && requestedColumnHeight >= 0) colHeight = requestedColumnHeight; else if (computeIntrinsicHeight) - colHeight = availableHeight / desiredColumnCount + columnSlop; + colHeight = min(availableHeight, availableHeight / desiredColumnCount + columnSlop); else colHeight = availableHeight; int originalColHeight = colHeight; diff --git a/WebCore/rendering/RenderBlock.h b/WebCore/rendering/RenderBlock.h index 7d9e2fc..8c61e2c 100644 --- a/WebCore/rendering/RenderBlock.h +++ b/WebCore/rendering/RenderBlock.h @@ -243,6 +243,8 @@ private: virtual void dirtyLinesFromChangedChild(RenderObject* child) { m_lineBoxes.dirtyLinesFromChangedChild(this, child); } + void addChildToContinuation(RenderObject* newChild, RenderObject* beforeChild); + void addChildIgnoringContinuation(RenderObject* newChild, RenderObject* beforeChild); void addChildToAnonymousColumnBlocks(RenderObject* newChild, RenderObject* beforeChild); virtual void addChildIgnoringAnonymousColumnBlocks(RenderObject* newChild, RenderObject* beforeChild = 0); @@ -410,6 +412,14 @@ private: void updateScrollInfoAfterLayout(); RenderObject* splitAnonymousBlocksAroundChild(RenderObject* beforeChild); + void splitBlocks(RenderBlock* fromBlock, RenderBlock* toBlock, RenderBlock* middleBlock, + RenderObject* beforeChild, RenderBoxModelObject* oldCont); + void splitFlow(RenderObject* beforeChild, RenderBlock* newBlockBox, + RenderObject* newChild, RenderBoxModelObject* oldCont); + RenderBlock* clone() const; + RenderBlock* continuationBefore(RenderObject* beforeChild); + RenderBlock* containingColumnsBlock(bool allowAnonymousColumnBlock = true); + RenderBlock* columnsBlockForSpanningElement(RenderObject* newChild); struct FloatingObject : Noncopyable { enum Type { diff --git a/WebCore/rendering/RenderBlockLineLayout.cpp b/WebCore/rendering/RenderBlockLineLayout.cpp index 96b4c6e..2cf3865 100644 --- a/WebCore/rendering/RenderBlockLineLayout.cpp +++ b/WebCore/rendering/RenderBlockLineLayout.cpp @@ -29,6 +29,7 @@ #include "Logging.h" #include "RenderArena.h" #include "RenderInline.h" +#include "RenderLayer.h" #include "RenderListMarker.h" #include "RenderView.h" #include "TrailingFloatsRootInlineBox.h" diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp index caadbf0..c845ba7 100644 --- a/WebCore/rendering/RenderBox.cpp +++ b/WebCore/rendering/RenderBox.cpp @@ -858,7 +858,7 @@ bool RenderBox::repaintLayerRectsForImage(WrappedImagePtr image, const FillLayer void RenderBox::paintCustomHighlight(int tx, int ty, const AtomicString& type, bool behindText) { - Frame* frame = document()->frame(); + Frame* frame = this->frame(); if (!frame) return; Page* page = frame->page(); diff --git a/WebCore/rendering/RenderDataGrid.cpp b/WebCore/rendering/RenderDataGrid.cpp index 00cbd7c..916d253 100644 --- a/WebCore/rendering/RenderDataGrid.cpp +++ b/WebCore/rendering/RenderDataGrid.cpp @@ -182,7 +182,7 @@ void RenderDataGrid::invalidateScrollbarRect(Scrollbar*, const IntRect&) bool RenderDataGrid::isActive() const { - Page* page = document()->frame()->page(); + Page* page = frame()->page(); return page && page->focusController()->isActive(); } diff --git a/WebCore/rendering/RenderFileUploadControl.cpp b/WebCore/rendering/RenderFileUploadControl.cpp index d4d73bc..f42a657 100644 --- a/WebCore/rendering/RenderFileUploadControl.cpp +++ b/WebCore/rendering/RenderFileUploadControl.cpp @@ -28,6 +28,7 @@ #include "GraphicsContext.h" #include "HTMLInputElement.h" #include "HTMLNames.h" +#include "ShadowElement.h" #include "Icon.h" #include "LocalizedStrings.h" #include "Page.h" @@ -50,30 +51,6 @@ const int iconFilenameSpacing = 2; const int defaultWidthNumChars = 34; const int buttonShadowHeight = 2; -class ShadowInputElement : public HTMLInputElement { -public: - static PassRefPtr<ShadowInputElement> create(Node* shadowParent); - -private: - ShadowInputElement(Node* shadowParent); - - virtual bool isShadowNode() const { return true; } - virtual Node* shadowParentNode() { return m_shadowParent; } - - Node* m_shadowParent; -}; - -inline ShadowInputElement::ShadowInputElement(Node* shadowParent) - : HTMLInputElement(inputTag, shadowParent->document()) - , m_shadowParent(shadowParent) -{ -} - -inline PassRefPtr<ShadowInputElement> ShadowInputElement::create(Node* shadowParent) -{ - return new ShadowInputElement(shadowParent); -} - RenderFileUploadControl::RenderFileUploadControl(HTMLInputElement* input) : RenderBlock(input) , m_button(0) diff --git a/WebCore/rendering/RenderFrameSet.cpp b/WebCore/rendering/RenderFrameSet.cpp index 3ab2fff..600d65e 100644 --- a/WebCore/rendering/RenderFrameSet.cpp +++ b/WebCore/rendering/RenderFrameSet.cpp @@ -749,7 +749,7 @@ void RenderFrameSet::positionFramesWithFlattening() bool RenderFrameSet::flattenFrameSet() const { - return document()->frame() && document()->frame()->settings()->frameFlatteningEnabled(); + return frame() && frame()->settings()->frameFlatteningEnabled(); } void RenderFrameSet::startResizing(GridAxis& axis, int position) @@ -817,7 +817,7 @@ void RenderFrameSet::setIsResizing(bool isResizing) if (ancestor->isFrameSet()) toRenderFrameSet(ancestor)->m_isChildResizing = isResizing; } - if (Frame* frame = document()->frame()) + if (Frame* frame = this->frame()) frame->eventHandler()->setResizingFrameSet(isResizing ? frameSet() : 0); } diff --git a/WebCore/rendering/RenderIFrame.cpp b/WebCore/rendering/RenderIFrame.cpp index 146e028..8421c9e 100644 --- a/WebCore/rendering/RenderIFrame.cpp +++ b/WebCore/rendering/RenderIFrame.cpp @@ -27,6 +27,7 @@ #include "RenderIFrame.h" #include "FrameView.h" +#include "HTMLNames.h" #include "HTMLIFrameElement.h" #include "RenderView.h" #include "Settings.h" diff --git a/WebCore/rendering/RenderImage.cpp b/WebCore/rendering/RenderImage.cpp index 2e376e7..98b0f47 100644 --- a/WebCore/rendering/RenderImage.cpp +++ b/WebCore/rendering/RenderImage.cpp @@ -36,6 +36,7 @@ #include "HTMLNames.h" #include "HitTestResult.h" #include "Page.h" +#include "RenderLayer.h" #include "RenderTheme.h" #include "RenderView.h" #include "SelectionController.h" @@ -451,7 +452,7 @@ void RenderImage::paint(PaintInfo& paintInfo, int tx, int ty) void RenderImage::paintFocusRings(PaintInfo& paintInfo, const RenderStyle* style) { // Don't draw focus rings if printing. - if (document()->printing() || !document()->frame()->selection()->isFocusedAndActive()) + if (document()->printing() || !frame()->selection()->isFocusedAndActive()) return; if (paintInfo.context->paintingDisabled() && !paintInfo.context->updatingControlTints()) diff --git a/WebCore/rendering/RenderInline.cpp b/WebCore/rendering/RenderInline.cpp index 7531f93..e91822e 100644 --- a/WebCore/rendering/RenderInline.cpp +++ b/WebCore/rendering/RenderInline.cpp @@ -30,6 +30,7 @@ #include "Page.h" #include "RenderArena.h" #include "RenderBlock.h" +#include "RenderLayer.h" #include "RenderView.h" #include "TransformState.h" #include "VisiblePosition.h" @@ -1114,8 +1115,8 @@ void RenderInline::addDashboardRegions(Vector<DashboardRegionValue>& regions) region.bounds.setX(absPos.x() + region.bounds.x()); region.bounds.setY(absPos.y() + region.bounds.y()); - if (document()->frame()) { - float pageScaleFactor = document()->frame()->page()->chrome()->scaleFactor(); + if (frame()) { + float pageScaleFactor = frame()->page()->chrome()->scaleFactor(); if (pageScaleFactor != 1.0f) { region.bounds.scale(pageScaleFactor); region.clip.scale(pageScaleFactor); diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp index 3eab1f8..5d206dd 100644 --- a/WebCore/rendering/RenderLayer.cpp +++ b/WebCore/rendering/RenderLayer.cpp @@ -189,7 +189,7 @@ RenderLayer::RenderLayer(RenderBoxModelObject* renderer) RenderLayer::~RenderLayer() { if (inResizeMode() && !renderer()->documentBeingDestroyed()) { - if (Frame* frame = renderer()->document()->frame()) + if (Frame* frame = renderer()->frame()) frame->eventHandler()->resizeLayerDestroyed(); } @@ -1216,7 +1216,7 @@ static inline int adjustedScrollDelta(int beginningDelta) { void RenderLayer::panScrollFromPoint(const IntPoint& sourcePoint) { - Frame* frame = renderer()->document()->frame(); + Frame* frame = renderer()->frame(); if (!frame) return; @@ -1267,7 +1267,7 @@ void RenderLayer::scrollByRecursively(int xDelta, int yDelta) nextRenderer = nextRenderer->parent(); } - Frame* frame = renderer()->document()->frame(); + Frame* frame = renderer()->frame(); if (frame) frame->eventHandler()->updateAutoscrollRenderer(); } @@ -1347,7 +1347,7 @@ void RenderLayer::scrollToOffset(int x, int y, bool updateScrollbars, bool repai RenderBoxModelObject* repaintContainer = renderer()->containerForRepaint(); IntRect rectForRepaint = renderer()->clippedOverflowRectForRepaint(repaintContainer); - Frame* frame = renderer()->document()->frame(); + Frame* frame = renderer()->frame(); if (frame) { // The caret rect needs to be invalidated after scrolling frame->selection()->setNeedsLayout(); @@ -1538,7 +1538,7 @@ IntRect RenderLayer::getRectToExpose(const IntRect &visibleRect, const IntRect & void RenderLayer::autoscroll() { - Frame* frame = renderer()->document()->frame(); + Frame* frame = renderer()->frame(); if (!frame) return; @@ -1645,7 +1645,7 @@ void RenderLayer::valueChanged(Scrollbar*) bool RenderLayer::isActive() const { - Page* page = renderer()->document()->frame()->page(); + Page* page = renderer()->frame()->page(); return page && page->focusController()->isActive(); } @@ -3896,7 +3896,7 @@ void showLayerTree(const WebCore::RenderLayer* layer) if (!layer) return; - if (WebCore::Frame* frame = layer->renderer()->document()->frame()) { + if (WebCore::Frame* frame = layer->renderer()->frame()) { WebCore::String output = externalRepresentation(frame, WebCore::RenderAsTextShowAllLayers | WebCore::RenderAsTextShowLayerNesting | WebCore::RenderAsTextShowCompositedLayers | WebCore::RenderAsTextShowAddresses); fprintf(stderr, "%s\n", output.utf8().data()); } diff --git a/WebCore/rendering/RenderLayerBacking.cpp b/WebCore/rendering/RenderLayerBacking.cpp index 97c5544..b55a474 100644 --- a/WebCore/rendering/RenderLayerBacking.cpp +++ b/WebCore/rendering/RenderLayerBacking.cpp @@ -1029,7 +1029,7 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext* #if ENABLE(INSPECTOR) static InspectorTimelineAgent* inspectorTimelineAgent(RenderObject* renderer) { - Frame* frame = renderer->document()->frame(); + Frame* frame = renderer->frame(); if (!frame) return 0; Page* page = frame->page(); @@ -1252,10 +1252,9 @@ String RenderLayerBacking::nameForLayer() const String name = renderer()->renderName(); if (Node* node = renderer()->node()) { if (node->isElementNode()) - name += " " + static_cast<Element *>(node)->tagName(); - - if (node->isHTMLElement() && static_cast<HTMLElement *>(node)->hasID()) - name += " \'" + static_cast<Element *>(node)->getIDAttribute() + "\'"; + name += " " + static_cast<Element*>(node)->tagName(); + if (node->hasID()) + name += " \'" + static_cast<Element*>(node)->getIdAttribute() + "\'"; } if (m_owningLayer->isReflection()) diff --git a/WebCore/rendering/RenderLayerCompositor.cpp b/WebCore/rendering/RenderLayerCompositor.cpp index ff6e3b2..f68623b 100644 --- a/WebCore/rendering/RenderLayerCompositor.cpp +++ b/WebCore/rendering/RenderLayerCompositor.cpp @@ -29,19 +29,16 @@ #include "RenderLayerCompositor.h" #include "AnimationController.h" +#include "CSSPropertyNames.h" #include "Chrome.h" #include "ChromeClient.h" -#include "CSSPropertyNames.h" #include "Frame.h" #include "FrameView.h" #include "GraphicsLayer.h" -#include "HitTestResult.h" #include "HTMLCanvasElement.h" #include "HTMLIFrameElement.h" -#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) -#include "HTMLMediaElement.h" #include "HTMLNames.h" -#endif +#include "HitTestResult.h" #include "NodeList.h" #include "Page.h" #include "RenderEmbeddedObject.h" @@ -52,6 +49,10 @@ #include "RenderView.h" #include "Settings.h" +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) +#include "HTMLMediaElement.h" +#endif + #if PROFILE_LAYER_REBUILD #include <wtf/CurrentTime.h> #endif @@ -1439,7 +1440,8 @@ void RenderLayerCompositor::detachRootPlatformLayer() else m_rootPlatformLayer->removeFromParent(); - m_renderView->document()->ownerElement()->setNeedsStyleRecalc(SyntheticStyleChange); + if (Element* ownerElement = m_renderView->document()->ownerElement()) + ownerElement->setNeedsStyleRecalc(SyntheticStyleChange); break; } case RootLayerAttachedViaChromeClient: { diff --git a/WebCore/rendering/RenderLineBoxList.cpp b/WebCore/rendering/RenderLineBoxList.cpp index 92952b7..2d3ee7e 100644 --- a/WebCore/rendering/RenderLineBoxList.cpp +++ b/WebCore/rendering/RenderLineBoxList.cpp @@ -37,6 +37,7 @@ #include "RenderInline.h" #include "RenderView.h" #include "RootInlineBox.h" +#include "Settings.h" // FIXME: This include can be removed when paginateDuringLayoutEnabled is taken out. using namespace std; @@ -162,7 +163,7 @@ void RenderLineBoxList::paint(RenderBoxModelObject* renderer, RenderObject::Pain return; RenderView* v = renderer->view(); - bool usePrintRect = !v->printRect().isEmpty(); + bool usePrintRect = !v->printRect().isEmpty() && !renderer->document()->settings()->paginateDuringLayoutEnabled(); // We can check the first box and last box and avoid painting if we don't // intersect. This is a quick short-circuit that we can take to avoid walking any lines. diff --git a/WebCore/rendering/RenderListBox.cpp b/WebCore/rendering/RenderListBox.cpp index 1c21af4..2ecc2d0 100644 --- a/WebCore/rendering/RenderListBox.cpp +++ b/WebCore/rendering/RenderListBox.cpp @@ -314,7 +314,7 @@ void RenderListBox::paintItemForeground(PaintInfo& paintInfo, int tx, int ty, in Color textColor = element->renderStyle() ? element->renderStyle()->visitedDependentColor(CSSPropertyColor) : style()->visitedDependentColor(CSSPropertyColor); if (optionElement && optionElement->selected()) { - if (document()->frame()->selection()->isFocusedAndActive() && document()->focusedNode() == node()) + if (frame()->selection()->isFocusedAndActive() && document()->focusedNode() == node()) textColor = theme()->activeListBoxSelectionForegroundColor(); // Honor the foreground color for disabled items else if (!element->disabled()) @@ -350,7 +350,7 @@ void RenderListBox::paintItemBackground(PaintInfo& paintInfo, int tx, int ty, in Color backColor; if (optionElement && optionElement->selected()) { - if (document()->frame()->selection()->isFocusedAndActive() && document()->focusedNode() == node()) + if (frame()->selection()->isFocusedAndActive() && document()->focusedNode() == node()) backColor = theme()->activeListBoxSelectionBackgroundColor(); else backColor = theme()->inactiveListBoxSelectionBackgroundColor(); @@ -408,7 +408,7 @@ void RenderListBox::panScroll(const IntPoint& panStartMousePosition) // FIXME: This doesn't work correctly with transforms. FloatPoint absOffset = localToAbsolute(); - IntPoint currentMousePosition = document()->frame()->eventHandler()->currentMousePosition(); + IntPoint currentMousePosition = frame()->eventHandler()->currentMousePosition(); // We need to check if the current mouse position is out of the window. When the mouse is out of the window, the position is incoherent static IntPoint previousMousePosition; if (currentMousePosition.y() < 0) @@ -466,7 +466,7 @@ int RenderListBox::scrollToward(const IntPoint& destination) void RenderListBox::autoscroll() { - IntPoint pos = document()->frame()->view()->windowToContents(document()->frame()->eventHandler()->currentMousePosition()); + IntPoint pos = frame()->view()->windowToContents(frame()->eventHandler()->currentMousePosition()); int endIndex = scrollToward(pos); if (endIndex >= 0) { @@ -613,7 +613,7 @@ IntRect RenderListBox::controlClipRect(int tx, int ty) const bool RenderListBox::isActive() const { - Page* page = document()->frame()->page(); + Page* page = frame()->page(); return page && page->focusController()->isActive(); } diff --git a/WebCore/rendering/RenderMenuList.h b/WebCore/rendering/RenderMenuList.h index 5ee8588..9e51996 100644 --- a/WebCore/rendering/RenderMenuList.h +++ b/WebCore/rendering/RenderMenuList.h @@ -101,6 +101,8 @@ private: virtual bool valueShouldChangeOnHotTrack() const { return true; } virtual bool shouldPopOver() const { return !POPUP_MENU_PULLS_DOWN; } virtual void valueChanged(unsigned listIndex, bool fireOnChange = true); + virtual void selectionChanged(unsigned, bool) {} + virtual void selectionCleared() {} virtual FontSelector* fontSelector() const; virtual HostWindow* hostWindow() const; virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize); diff --git a/WebCore/rendering/RenderMeter.cpp b/WebCore/rendering/RenderMeter.cpp index 9dc6a26..d443ceb 100644 --- a/WebCore/rendering/RenderMeter.cpp +++ b/WebCore/rendering/RenderMeter.cpp @@ -19,11 +19,13 @@ */ #include "config.h" + #if ENABLE(METER_TAG) #include "RenderMeter.h" #include "HTMLMeterElement.h" +#include "HTMLNames.h" #include "RenderTheme.h" using namespace std; @@ -37,6 +39,18 @@ RenderMeter::RenderMeter(HTMLMeterElement* element) { } +void RenderMeter::calcWidth() +{ + RenderBox::calcWidth(); + setWidth(theme()->meterSizeForBounds(this, frameRect()).width()); +} + +void RenderMeter::calcHeight() +{ + RenderBox::calcHeight(); + setHeight(theme()->meterSizeForBounds(this, frameRect()).height()); +} + void RenderMeter::layout() { ASSERT(needsLayout()); @@ -59,4 +73,5 @@ void RenderMeter::updateFromElement() } } // namespace WebCore + #endif diff --git a/WebCore/rendering/RenderMeter.h b/WebCore/rendering/RenderMeter.h index 2fc7844..fd95adb 100644 --- a/WebCore/rendering/RenderMeter.h +++ b/WebCore/rendering/RenderMeter.h @@ -38,6 +38,8 @@ private: virtual bool isMeter() const { return true; } virtual void layout(); virtual void updateFromElement(); + virtual void calcWidth(); + virtual void calcHeight(); }; inline RenderMeter* toRenderMeter(RenderObject* object) diff --git a/WebCore/rendering/RenderObject.cpp b/WebCore/rendering/RenderObject.cpp index 2893d67..e9e9ffc 100644 --- a/WebCore/rendering/RenderObject.cpp +++ b/WebCore/rendering/RenderObject.cpp @@ -42,6 +42,7 @@ #include "RenderFlexibleBox.h" #include "RenderImageGeneratedContent.h" #include "RenderInline.h" +#include "RenderLayer.h" #include "RenderListItem.h" #include "RenderRuby.h" #include "RenderRubyText.h" @@ -222,7 +223,7 @@ RenderObject::RenderObject(Node* node) RenderObject::~RenderObject() { - ASSERT(!node() || documentBeingDestroyed() || !document()->frame()->view() || document()->frame()->view()->layoutRoot() != this); + ASSERT(!node() || documentBeingDestroyed() || !frame()->view() || frame()->view()->layoutRoot() != this); #ifndef NDEBUG ASSERT(!m_hasAXObject); renderObjectCounter.decrement(); @@ -1389,7 +1390,7 @@ Color RenderObject::selectionBackgroundColor() const if (pseudoStyle && pseudoStyle->visitedDependentColor(CSSPropertyBackgroundColor).isValid()) color = pseudoStyle->visitedDependentColor(CSSPropertyBackgroundColor).blendWithWhite(); else - color = document()->frame()->selection()->isFocusedAndActive() ? + color = frame()->selection()->isFocusedAndActive() ? theme()->activeSelectionBackgroundColor() : theme()->inactiveSelectionBackgroundColor(); } @@ -1408,7 +1409,7 @@ Color RenderObject::selectionForegroundColor() const if (!color.isValid()) color = pseudoStyle->visitedDependentColor(CSSPropertyColor); } else - color = document()->frame()->selection()->isFocusedAndActive() ? + color = frame()->selection()->isFocusedAndActive() ? theme()->activeSelectionForegroundColor() : theme()->inactiveSelectionForegroundColor(); @@ -1948,9 +1949,9 @@ void RenderObject::destroy() // FIXME: RenderObject::destroy should not get called with a renderer whose document // has a null frame, so we assert this. However, we don't want release builds to crash which is why we // check that the frame is not null. - ASSERT(document()->frame()); - if (document()->frame() && document()->frame()->eventHandler()->autoscrollRenderer() == this) - document()->frame()->eventHandler()->stopAutoscrollTimer(true); + ASSERT(frame()); + if (frame() && frame()->eventHandler()->autoscrollRenderer() == this) + frame()->eventHandler()->stopAutoscrollTimer(true); if (m_hasCounterNodeMap) RenderCounter::destroyCounterNodes(this); @@ -2276,8 +2277,8 @@ void RenderObject::addDashboardRegions(Vector<DashboardRegionValue>& regions) region.bounds.setX(absPos.x() + styleRegion.offset.left().value()); region.bounds.setY(absPos.y() + styleRegion.offset.top().value()); - if (document()->frame()) { - float pageScaleFactor = document()->frame()->page()->chrome()->scaleFactor(); + if (frame()) { + float pageScaleFactor = frame()->page()->chrome()->scaleFactor(); if (pageScaleFactor != 1.0f) { region.bounds.scale(pageScaleFactor); region.clip.scale(pageScaleFactor); @@ -2382,7 +2383,7 @@ void RenderObject::adjustRectForOutlineAndShadow(IntRect& rect) const AnimationController* RenderObject::animation() const { - return document()->frame()->animation(); + return frame()->animation(); } void RenderObject::imageChanged(CachedImage* image, const IntRect* rect) diff --git a/WebCore/rendering/RenderObject.h b/WebCore/rendering/RenderObject.h index 3ff38ab..9f1e8dd 100644 --- a/WebCore/rendering/RenderObject.h +++ b/WebCore/rendering/RenderObject.h @@ -66,6 +66,7 @@ class RenderSVGResourceContainer; * three phases invoked on them during this phase. */ +// FIXME: These enums should move to their own header since they're used by other headers. enum PaintPhase { PaintPhaseBlockBackground, PaintPhaseChildBlockBackground, @@ -450,9 +451,11 @@ public: bool isRooted(RenderView** = 0); Node* node() const { return m_isAnonymous ? 0 : m_node; } - Document* document() const { return m_node->document(); } void setNode(Node* node) { m_node = node; } + Document* document() const { return m_node->document(); } + Frame* frame() const { return document()->frame(); } + bool hasOutlineAnnotation() const; bool hasOutline() const { return style()->hasOutline() || hasOutlineAnnotation(); } diff --git a/WebCore/rendering/RenderPath.cpp b/WebCore/rendering/RenderPath.cpp index ccb9562..238a4e6 100644 --- a/WebCore/rendering/RenderPath.cpp +++ b/WebCore/rendering/RenderPath.cpp @@ -5,6 +5,7 @@ 2009 Google, Inc. 2009 Dirk Schulze <krit@webkit.org> Copyright (C) Research In Motion Limited 2010. All rights reserved. + 2009 Jeff Schiller <codedread@gmail.com> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -30,6 +31,7 @@ #include "FloatPoint.h" #include "FloatQuad.h" #include "GraphicsContext.h" +#include "HitTestRequest.h" #include "PointerEventsHitRules.h" #include "RenderSVGContainer.h" #include "RenderSVGResourceFilter.h" @@ -71,7 +73,7 @@ RenderPath::RenderPath(SVGStyledTransformableElement* node) { } -bool RenderPath::fillContains(const FloatPoint& point, bool requiresFill) const +bool RenderPath::fillContains(const FloatPoint& point, bool requiresFill, WindRule fillRule) const { if (!m_fillBoundingBox.contains(point)) return false; @@ -79,7 +81,7 @@ bool RenderPath::fillContains(const FloatPoint& point, bool requiresFill) const if (requiresFill && !RenderSVGResource::fillPaintingResource(this, style())) return false; - return m_path.contains(point, style()->svgStyle()->fillRule()); + return m_path.contains(point, fillRule); } bool RenderPath::strokeContains(const FloatPoint& point, bool requiresStroke) const @@ -130,16 +132,28 @@ void RenderPath::layout() static inline void fillAndStrokePath(const Path& path, GraphicsContext* context, RenderPath* object) { context->beginPath(); + RenderStyle* style = object->style(); - if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(object, object->style())) { + if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(object, style)) { context->addPath(path); - if (fillPaintingResource->applyResource(object, object->style(), context, ApplyToFillMode)) + if (fillPaintingResource->applyResource(object, style, context, ApplyToFillMode)) fillPaintingResource->postApplyResource(object, context, ApplyToFillMode); } - if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(object, object->style())) { - context->addPath(path); - if (strokePaintingResource->applyResource(object, object->style(), context, ApplyToStrokeMode)) + if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(object, style)) { + if (style->svgStyle()->vectorEffect() == VE_NON_SCALING_STROKE) { + SVGStyledTransformableElement* element = static_cast<SVGStyledTransformableElement*>(object->node()); + AffineTransform transform = element->getScreenCTM(); + if (!transform.isInvertible()) + return; + + Path transformedPath = path; + context->concatCTM(transform.inverse()); + transformedPath.transform(transform); + context->addPath(transformedPath); + } else + context->addPath(path); + if (strokePaintingResource->applyResource(object, style, context, ApplyToStrokeMode)) strokePaintingResource->postApplyResource(object, context, ApplyToStrokeMode); } } @@ -195,7 +209,7 @@ void RenderPath::addFocusRingRects(Vector<IntRect>& rects, int, int) rects.append(rect); } -bool RenderPath::nodeAtFloatPoint(const HitTestRequest&, HitTestResult& result, const FloatPoint& pointInParent, HitTestAction hitTestAction) +bool RenderPath::nodeAtFloatPoint(const HitTestRequest& request, HitTestResult& result, const FloatPoint& pointInParent, HitTestAction hitTestAction) { // We only draw in the forground phase, so we only hit-test then. if (hitTestAction != HitTestForeground) @@ -203,17 +217,22 @@ bool RenderPath::nodeAtFloatPoint(const HitTestRequest&, HitTestResult& result, FloatPoint localPoint = m_localTransform.inverse().mapPoint(pointInParent); - PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_PATH_HITTESTING, style()->pointerEvents()); + if (!pointInClippingArea(this, localPoint)) + return false; + PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_PATH_HITTESTING, request, style()->pointerEvents()); bool isVisible = (style()->visibility() == VISIBLE); if (isVisible || !hitRules.requireVisible) { - if ((hitRules.canHitStroke && (style()->svgStyle()->hasStroke() || !hitRules.requireStroke) && strokeContains(localPoint, hitRules.requireStroke)) - || (hitRules.canHitFill && (style()->svgStyle()->hasFill() || !hitRules.requireFill) && fillContains(localPoint, hitRules.requireFill))) { + const SVGRenderStyle* svgStyle = style()->svgStyle(); + WindRule fillRule = svgStyle->fillRule(); + if (request.svgClipContent()) + fillRule = svgStyle->clipRule(); + if ((hitRules.canHitStroke && (svgStyle->hasStroke() || !hitRules.requireStroke) && strokeContains(localPoint, hitRules.requireStroke)) + || (hitRules.canHitFill && (svgStyle->hasFill() || !hitRules.requireFill) && fillContains(localPoint, hitRules.requireFill, fillRule))) { updateHitTestResult(result, roundedIntPoint(localPoint)); return true; } } - return false; } @@ -297,23 +316,8 @@ void RenderPath::updateCachedBoundaries() } // Cache smallest possible repaint rectangle - - // FIXME: We need to be careful here. We assume that there is no resource, if the rect is empty. - FloatRect rect = filterBoundingBoxForRenderer(this); - if (rect.isEmpty()) - m_repaintBoundingBox = m_strokeAndMarkerBoundingBox; - else - m_repaintBoundingBox = rect; - - rect = clipperBoundingBoxForRenderer(this); - if (!rect.isEmpty()) - m_repaintBoundingBox.intersect(rect); - - rect = maskerBoundingBoxForRenderer(this); - if (!rect.isEmpty()) - m_repaintBoundingBox.intersect(rect); - - svgStyle->inflateForShadow(m_repaintBoundingBox); + m_repaintBoundingBox = m_strokeAndMarkerBoundingBox; + intersectRepaintRectWithResources(this, m_repaintBoundingBox); } } diff --git a/WebCore/rendering/RenderPath.h b/WebCore/rendering/RenderPath.h index 5509057..3748f39 100644 --- a/WebCore/rendering/RenderPath.h +++ b/WebCore/rendering/RenderPath.h @@ -47,7 +47,7 @@ public: private: // Hit-detection seperated for the fill and the stroke - bool fillContains(const FloatPoint&, bool requiresFill = true) const; + bool fillContains(const FloatPoint&, bool requiresFill = true, WindRule fillRule = RULE_NONZERO) const; bool strokeContains(const FloatPoint&, bool requiresStroke = true) const; virtual FloatRect objectBoundingBox() const { return m_fillBoundingBox; } diff --git a/WebCore/rendering/RenderProgress.cpp b/WebCore/rendering/RenderProgress.cpp index ac3fb15..e4e045d 100644 --- a/WebCore/rendering/RenderProgress.cpp +++ b/WebCore/rendering/RenderProgress.cpp @@ -23,8 +23,8 @@ #if ENABLE(PROGRESS_TAG) #include "RenderProgress.h" - -#include "HTMLDivElement.h" +#include "ShadowElement.h" +#include "HTMLNames.h" #include "HTMLProgressElement.h" #include "RenderTheme.h" #include "RenderView.h" @@ -35,32 +35,6 @@ using namespace std; namespace WebCore { -using namespace HTMLNames; - -class ProgressValueElement : public HTMLDivElement { -public: - static PassRefPtr<ProgressValueElement> create(Node* shadowParent); - -private: - ProgressValueElement(Node* shadowParent); - - virtual bool isShadowNode() const { return true; } - virtual Node* shadowParentNode() { return m_shadowParent; } - - Node* m_shadowParent; -}; - -inline ProgressValueElement::ProgressValueElement(Node* shadowParent) - : HTMLDivElement(divTag, shadowParent->document()) - , m_shadowParent(shadowParent) -{ -} - -inline PassRefPtr<ProgressValueElement> ProgressValueElement::create(Node* shadowParent) -{ - return new ProgressValueElement(shadowParent); -} - RenderProgress::RenderProgress(HTMLProgressElement* element) : RenderBlock(element) , m_position(-1) @@ -144,7 +118,7 @@ void RenderProgress::updateValuePartState() { bool needLayout = !style()->hasAppearance() || m_valuePart; if (!style()->hasAppearance() && !m_valuePart) { - m_valuePart = ProgressValueElement::create(node()); + m_valuePart = ShadowBlockElement::create(node()); RefPtr<RenderStyle> styleForValuePart = createStyleForValuePart(style()); m_valuePart->setRenderer(m_valuePart->createRenderer(renderArena(), styleForValuePart.get())); m_valuePart->renderer()->setStyle(styleForValuePart.release()); diff --git a/WebCore/rendering/RenderProgress.h b/WebCore/rendering/RenderProgress.h index 1137e99..4d1a88f 100644 --- a/WebCore/rendering/RenderProgress.h +++ b/WebCore/rendering/RenderProgress.h @@ -27,7 +27,7 @@ namespace WebCore { class HTMLProgressElement; -class ProgressValueElement; +class ShadowBlockElement; class RenderProgress : public RenderBlock { public: @@ -63,7 +63,7 @@ private: double m_animationDuration; bool m_animating; Timer<RenderProgress> m_animationTimer; - RefPtr<ProgressValueElement> m_valuePart; + RefPtr<ShadowBlockElement> m_valuePart; }; inline RenderProgress* toRenderProgress(RenderObject* object) diff --git a/WebCore/rendering/RenderSVGContainer.cpp b/WebCore/rendering/RenderSVGContainer.cpp index 56846a9..66889ac 100644 --- a/WebCore/rendering/RenderSVGContainer.cpp +++ b/WebCore/rendering/RenderSVGContainer.cpp @@ -146,20 +146,7 @@ FloatRect RenderSVGContainer::strokeBoundingBox() const FloatRect RenderSVGContainer::repaintRectInLocalCoordinates() const { FloatRect repaintRect = computeContainerBoundingBox(this, true); - - FloatRect rect = filterBoundingBoxForRenderer(this); - if (!rect.isEmpty()) - repaintRect = rect; - - rect = clipperBoundingBoxForRenderer(this); - if (!rect.isEmpty()) - repaintRect.intersect(rect); - - rect = maskerBoundingBoxForRenderer(this); - if (!rect.isEmpty()) - repaintRect.intersect(rect); - - style()->svgStyle()->inflateForShadow(repaintRect); + intersectRepaintRectWithResources(this, repaintRect); return repaintRect; } @@ -172,6 +159,9 @@ bool RenderSVGContainer::nodeAtFloatPoint(const HitTestRequest& request, HitTest FloatPoint localPoint = localToParentTransform().inverse().mapPoint(pointInParent); + if (!pointInClippingArea(this, localPoint)) + return false; + for (RenderObject* child = lastChild(); child; child = child->previousSibling()) { if (child->nodeAtFloatPoint(request, result, localPoint, hitTestAction)) { updateHitTestResult(result, roundedIntPoint(localPoint)); diff --git a/WebCore/rendering/RenderSVGImage.cpp b/WebCore/rendering/RenderSVGImage.cpp index 006142c..d1a3037 100644 --- a/WebCore/rendering/RenderSVGImage.cpp +++ b/WebCore/rendering/RenderSVGImage.cpp @@ -112,17 +112,19 @@ void RenderSVGImage::destroy() RenderImage::destroy(); } -bool RenderSVGImage::nodeAtFloatPoint(const HitTestRequest&, HitTestResult& result, const FloatPoint& pointInParent, HitTestAction hitTestAction) +bool RenderSVGImage::nodeAtFloatPoint(const HitTestRequest& request, HitTestResult& result, const FloatPoint& pointInParent, HitTestAction hitTestAction) { // We only draw in the forground phase, so we only hit-test then. if (hitTestAction != HitTestForeground) return false; - PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_IMAGE_HITTESTING, style()->pointerEvents()); - + PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_IMAGE_HITTESTING, request, style()->pointerEvents()); bool isVisible = (style()->visibility() == VISIBLE); if (isVisible || !hitRules.requireVisible) { FloatPoint localPoint = localToParentTransform().inverse().mapPoint(pointInParent); + + if (!pointInClippingArea(this, localPoint)) + return false; if (hitRules.canHitFill) { if (m_localBounds.contains(localPoint)) { @@ -153,22 +155,7 @@ FloatRect RenderSVGImage::repaintRectInLocalCoordinates() const return m_cachedLocalRepaintRect; m_cachedLocalRepaintRect = m_localBounds; - - // FIXME: We need to be careful here. We assume that there is no filter, - // clipper or masker if the rects are empty. - FloatRect rect = filterBoundingBoxForRenderer(this); - if (!rect.isEmpty()) - m_cachedLocalRepaintRect = rect; - - rect = clipperBoundingBoxForRenderer(this); - if (!rect.isEmpty()) - m_cachedLocalRepaintRect.intersect(rect); - - rect = maskerBoundingBoxForRenderer(this); - if (!rect.isEmpty()) - m_cachedLocalRepaintRect.intersect(rect); - - style()->svgStyle()->inflateForShadow(m_cachedLocalRepaintRect); + intersectRepaintRectWithResources(this, m_cachedLocalRepaintRect); return m_cachedLocalRepaintRect; } diff --git a/WebCore/rendering/RenderSVGResource.h b/WebCore/rendering/RenderSVGResource.h index 5334025..a14a972 100644 --- a/WebCore/rendering/RenderSVGResource.h +++ b/WebCore/rendering/RenderSVGResource.h @@ -61,7 +61,7 @@ public: virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode) = 0; virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short) { } - virtual FloatRect resourceBoundingBox(const FloatRect&) = 0; + virtual FloatRect resourceBoundingBox(RenderObject*) = 0; virtual RenderSVGResourceType resourceType() const = 0; diff --git a/WebCore/rendering/RenderSVGResourceClipper.cpp b/WebCore/rendering/RenderSVGResourceClipper.cpp index 7957df4..450c5d6 100644 --- a/WebCore/rendering/RenderSVGResourceClipper.cpp +++ b/WebCore/rendering/RenderSVGResourceClipper.cpp @@ -27,6 +27,8 @@ #include "AffineTransform.h" #include "FloatRect.h" #include "GraphicsContext.h" +#include "HitTestRequest.h" +#include "HitTestResult.h" #include "ImageBuffer.h" #include "IntRect.h" #include "RenderObject.h" @@ -266,12 +268,49 @@ void RenderSVGResourceClipper::calculateClipContentRepaintRect() } } -FloatRect RenderSVGResourceClipper::resourceBoundingBox(const FloatRect& objectBoundingBox) +bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundingBox, const FloatPoint& nodeAtPoint) { + FloatPoint point = nodeAtPoint; + if (!pointInClippingArea(this, point)) + return false; + + if (static_cast<SVGClipPathElement*>(node())->clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { + AffineTransform transform; + transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); + transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height()); + point = transform.inverse().mapPoint(point); + } + + for (Node* childNode = node()->firstChild(); childNode; childNode = childNode->nextSibling()) { + RenderObject* renderer = childNode->renderer(); + if (!childNode->isSVGElement() || !static_cast<SVGElement*>(childNode)->isStyled() || !renderer) + continue; + if (!renderer->isRenderPath() && !renderer->isSVGText() && !renderer->isSVGShadowTreeRootContainer()) + continue; + IntPoint hitPoint; + HitTestResult result(hitPoint); + if (renderer->nodeAtFloatPoint(HitTestRequest(HitTestRequest::SVGClipContent), result, point, HitTestForeground)) + return true; + } + + return false; +} + +FloatRect RenderSVGResourceClipper::resourceBoundingBox(RenderObject* object) +{ + // Save the reference to the calling object for relayouting it on changing resource properties. + if (!m_clipper.contains(object)) + m_clipper.set(object, new ClipperData); + + // Resource was not layouted yet. Give back the boundingBox of the object. + if (selfNeedsLayout()) + return object->objectBoundingBox(); + if (m_clipBoundaries.isEmpty()) calculateClipContentRepaintRect(); if (static_cast<SVGClipPathElement*>(node())->clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { + FloatRect objectBoundingBox = object->objectBoundingBox(); AffineTransform transform; transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height()); diff --git a/WebCore/rendering/RenderSVGResourceClipper.h b/WebCore/rendering/RenderSVGResourceClipper.h index d8e2eed..78ec75b 100644 --- a/WebCore/rendering/RenderSVGResourceClipper.h +++ b/WebCore/rendering/RenderSVGResourceClipper.h @@ -51,9 +51,11 @@ public: virtual void invalidateClient(RenderObject*); virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode); - virtual FloatRect resourceBoundingBox(const FloatRect&); + virtual FloatRect resourceBoundingBox(RenderObject*); virtual RenderSVGResourceType resourceType() const { return ClipperResourceType; } + + bool hitTestClipContent(const FloatRect&, const FloatPoint&); SVGUnitTypes::SVGUnitType clipPathUnits() const { return toUnitType(static_cast<SVGClipPathElement*>(node())->clipPathUnits()); } diff --git a/WebCore/rendering/RenderSVGResourceContainer.h b/WebCore/rendering/RenderSVGResourceContainer.h index b63575d..54617bb 100644 --- a/WebCore/rendering/RenderSVGResourceContainer.h +++ b/WebCore/rendering/RenderSVGResourceContainer.h @@ -23,6 +23,8 @@ #if ENABLE(SVG) #include "RenderSVGHiddenContainer.h" + +#include "SVGStyledTransformableElement.h" #include "RenderSVGResource.h" namespace WebCore { @@ -33,7 +35,8 @@ public: RenderSVGResourceContainer(SVGStyledElement* node) : RenderSVGHiddenContainer(node) , RenderSVGResource() - , m_id(node->getIDAttribute()) + // FIXME: Should probably be using getIdAttribute rather than idForStyleResolution. + , m_id(node->hasID() ? node->idForStyleResolution() : nullAtom) { ASSERT(node->document()); node->document()->accessSVGExtensions()->addResource(m_id, this); @@ -55,7 +58,8 @@ public: // Remove old id, that is guaranteed to be present in cache extensions->removeResource(m_id); - m_id = static_cast<Element*>(node())->getIDAttribute(); + // FIXME: Should probably be using getIdAttribute rather than idForStyleResolution. + m_id = node()->hasID() ? static_cast<Element*>(node())->idForStyleResolution() : nullAtom; // It's possible that an element is referencing us with the new id, and has to be notified that we're existing now if (extensions->isPendingResource(m_id)) { @@ -80,6 +84,17 @@ public: virtual bool drawsContents() { return false; } virtual RenderSVGResourceContainer* toRenderSVGResourceContainer() { return this; } + + static AffineTransform transformOnNonScalingStroke(RenderObject* object, const AffineTransform resourceTransform) + { + if (!object->isRenderPath()) + return resourceTransform; + + SVGStyledTransformableElement* element = static_cast<SVGStyledTransformableElement*>(object->node()); + AffineTransform transform = resourceTransform; + transform.multiply(element->getScreenCTM()); + return transform; + } private: AtomicString m_id; diff --git a/WebCore/rendering/RenderSVGResourceFilter.cpp b/WebCore/rendering/RenderSVGResourceFilter.cpp index e197d5b..b0220a9 100644 --- a/WebCore/rendering/RenderSVGResourceFilter.cpp +++ b/WebCore/rendering/RenderSVGResourceFilter.cpp @@ -279,10 +279,10 @@ void RenderSVGResourceFilter::postApplyResource(RenderObject* object, GraphicsCo filterData->sourceGraphicBuffer.clear(); } -FloatRect RenderSVGResourceFilter::resourceBoundingBox(const FloatRect& objectBoundingBox) +FloatRect RenderSVGResourceFilter::resourceBoundingBox(RenderObject* object) { if (SVGFilterElement* element = static_cast<SVGFilterElement*>(node())) - return element->filterBoundingBox(objectBoundingBox); + return element->filterBoundingBox(object->objectBoundingBox()); return FloatRect(); } diff --git a/WebCore/rendering/RenderSVGResourceFilter.h b/WebCore/rendering/RenderSVGResourceFilter.h index 4d875c0..105b256 100644 --- a/WebCore/rendering/RenderSVGResourceFilter.h +++ b/WebCore/rendering/RenderSVGResourceFilter.h @@ -70,7 +70,7 @@ public: virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode); virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode); - virtual FloatRect resourceBoundingBox(const FloatRect&); + virtual FloatRect resourceBoundingBox(RenderObject*); PassOwnPtr<SVGFilterBuilder> buildPrimitives(); diff --git a/WebCore/rendering/RenderSVGResourceGradient.cpp b/WebCore/rendering/RenderSVGResourceGradient.cpp index 6c9d784..e715f6f 100644 --- a/WebCore/rendering/RenderSVGResourceGradient.cpp +++ b/WebCore/rendering/RenderSVGResourceGradient.cpp @@ -159,17 +159,35 @@ bool RenderSVGResourceGradient::applyResource(RenderObject* object, RenderStyle* GradientData* gradientData = m_gradient.get(object); + bool isPaintingText = resourceMode & ApplyToTextMode; + // Create gradient object - if (!gradientData->gradient) + if (!gradientData->gradient) { buildGradient(gradientData, gradientElement); + // CG platforms will handle the gradient space transform for text after applying the + // resource, so don't apply it here. For non-CG platforms, we want the text bounding + // box applied to the gradient space transform now, so the gradient shader can use it. +#if PLATFORM(CG) + if (gradientData->boundingBoxMode && !isPaintingText) { +#else + if (gradientData->boundingBoxMode) { +#endif + FloatRect objectBoundingBox = object->objectBoundingBox(); + gradientData->userspaceTransform.translate(objectBoundingBox.x(), objectBoundingBox.y()); + gradientData->userspaceTransform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height()); + } + + gradientData->userspaceTransform.multiply(gradientData->transform); + gradientData->gradient->setGradientSpaceTransform(gradientData->userspaceTransform); + } + if (!gradientData->gradient) return false; // Draw gradient context->save(); - bool isPaintingText = resourceMode & ApplyToTextMode; if (isPaintingText) { #if PLATFORM(CG) if (!createMaskAndSwapContextForTextGradient(context, m_savedContext, m_imageBuffer, object)) { @@ -181,24 +199,6 @@ bool RenderSVGResourceGradient::applyResource(RenderObject* object, RenderStyle* context->setTextDrawingMode(resourceMode & ApplyToFillMode ? cTextFill : cTextStroke); } - AffineTransform transform; - - // CG platforms will handle the gradient space transform for text after applying the - // resource, so don't apply it here. For non-CG platforms, we want the text bounding - // box applied to the gradient space transform now, so the gradient shader can use it. -#if PLATFORM(CG) - if (gradientData->boundingBoxMode && !isPaintingText) { -#else - if (gradientData->boundingBoxMode) { -#endif - FloatRect objectBoundingBox = object->objectBoundingBox(); - transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); - transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height()); - } - - transform.multiply(gradientData->transform); - gradientData->gradient->setGradientSpaceTransform(transform); - const SVGRenderStyle* svgStyle = style->svgStyle(); ASSERT(svgStyle); @@ -207,6 +207,8 @@ bool RenderSVGResourceGradient::applyResource(RenderObject* object, RenderStyle* context->setFillGradient(gradientData->gradient); context->setFillRule(svgStyle->fillRule()); } else if (resourceMode & ApplyToStrokeMode) { + if (svgStyle->vectorEffect() == VE_NON_SCALING_STROKE) + gradientData->gradient->setGradientSpaceTransform(transformOnNonScalingStroke(object, gradientData->userspaceTransform)); context->setAlpha(svgStyle->strokeOpacity()); context->setStrokeGradient(gradientData->gradient); applyStrokeStyleToContext(context, style, object); diff --git a/WebCore/rendering/RenderSVGResourceGradient.h b/WebCore/rendering/RenderSVGResourceGradient.h index 4d848af..b01af6d 100644 --- a/WebCore/rendering/RenderSVGResourceGradient.h +++ b/WebCore/rendering/RenderSVGResourceGradient.h @@ -39,6 +39,7 @@ struct GradientData { RefPtr<Gradient> gradient; bool boundingBoxMode; + AffineTransform userspaceTransform; AffineTransform transform; }; @@ -54,7 +55,7 @@ public: virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode); virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode); - virtual FloatRect resourceBoundingBox(const FloatRect&) { return FloatRect(); } + virtual FloatRect resourceBoundingBox(RenderObject*) { return FloatRect(); } protected: void addStops(GradientData*, const Vector<Gradient::ColorStop>&) const; diff --git a/WebCore/rendering/RenderSVGResourceMarker.h b/WebCore/rendering/RenderSVGResourceMarker.h index fe848a9..533a03b 100644 --- a/WebCore/rendering/RenderSVGResourceMarker.h +++ b/WebCore/rendering/RenderSVGResourceMarker.h @@ -58,7 +58,7 @@ public: AffineTransform markerTransformation(const FloatPoint& origin, float angle, float strokeWidth) const; virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short) { return false; } - virtual FloatRect resourceBoundingBox(const FloatRect&) { return FloatRect(); } + virtual FloatRect resourceBoundingBox(RenderObject*) { return FloatRect(); } FloatPoint referencePoint() const; float angle() const; diff --git a/WebCore/rendering/RenderSVGResourceMasker.cpp b/WebCore/rendering/RenderSVGResourceMasker.cpp index 2bfb283..ea79439 100644 --- a/WebCore/rendering/RenderSVGResourceMasker.cpp +++ b/WebCore/rendering/RenderSVGResourceMasker.cpp @@ -210,12 +210,22 @@ void RenderSVGResourceMasker::calculateMaskContentRepaintRect() } } -FloatRect RenderSVGResourceMasker::resourceBoundingBox(const FloatRect& objectBoundingBox) +FloatRect RenderSVGResourceMasker::resourceBoundingBox(RenderObject* object) { + // Save the reference to the calling object for relayouting it on changing resource properties. + if (!m_masker.contains(object)) + m_masker.set(object, new MaskerData); + + // Resource was not layouted yet. Give back clipping rect of the mask. + SVGMaskElement* maskElement = static_cast<SVGMaskElement*>(node()); + FloatRect objectBoundingBox = object->objectBoundingBox(); + FloatRect maskBoundaries = maskElement->maskBoundingBox(objectBoundingBox); + if (selfNeedsLayout()) + return maskBoundaries; + if (m_maskBoundaries.isEmpty()) calculateMaskContentRepaintRect(); - SVGMaskElement* maskElement = static_cast<SVGMaskElement*>(node()); if (!maskElement) return FloatRect(); @@ -227,7 +237,7 @@ FloatRect RenderSVGResourceMasker::resourceBoundingBox(const FloatRect& objectBo maskRect = transform.mapRect(maskRect); } - maskRect.intersect(maskElement->maskBoundingBox(objectBoundingBox)); + maskRect.intersect(maskBoundaries); return maskRect; } diff --git a/WebCore/rendering/RenderSVGResourceMasker.h b/WebCore/rendering/RenderSVGResourceMasker.h index 2de5f3f..f6301cb 100644 --- a/WebCore/rendering/RenderSVGResourceMasker.h +++ b/WebCore/rendering/RenderSVGResourceMasker.h @@ -57,7 +57,7 @@ public: virtual void invalidateClient(RenderObject*); virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode); - virtual FloatRect resourceBoundingBox(const FloatRect&); + virtual FloatRect resourceBoundingBox(RenderObject*); SVGUnitTypes::SVGUnitType maskUnits() const { return toUnitType(static_cast<SVGMaskElement*>(node())->maskUnits()); } SVGUnitTypes::SVGUnitType maskContentUnits() const { return toUnitType(static_cast<SVGMaskElement*>(node())->maskContentUnits()); } diff --git a/WebCore/rendering/RenderSVGResourcePattern.cpp b/WebCore/rendering/RenderSVGResourcePattern.cpp index 8302030..040b2e2 100644 --- a/WebCore/rendering/RenderSVGResourcePattern.cpp +++ b/WebCore/rendering/RenderSVGResourcePattern.cpp @@ -90,25 +90,19 @@ bool RenderSVGResourcePattern::applyResource(RenderObject* object, RenderStyle* PatternData* patternData = m_pattern.get(object); if (!patternData->pattern) { - FloatRect patternBoundaries; - AffineTransform patternTransform; // Create tile image - OwnPtr<ImageBuffer> tileImage = createTileImage(patternBoundaries, patternTransform, patternElement, object); + OwnPtr<ImageBuffer> tileImage = createTileImage(patternData, patternElement, object); if (!tileImage) return false; // Create pattern object - buildPattern(patternData, patternBoundaries, tileImage.release()); + buildPattern(patternData, tileImage.release()); if (!patternData->pattern) return false; - // Compute pattern transformation - AffineTransform transform; - transform.translate(patternBoundaries.x(), patternBoundaries.y()); - transform.multiply(patternTransform); - patternData->pattern->setPatternSpaceTransform(transform); + patternData->pattern->setPatternSpaceTransform(patternData->transform); } // Draw pattern @@ -122,6 +116,8 @@ bool RenderSVGResourcePattern::applyResource(RenderObject* object, RenderStyle* context->setFillPattern(patternData->pattern); context->setFillRule(svgStyle->fillRule()); } else if (resourceMode & ApplyToStrokeMode) { + if (svgStyle->vectorEffect() == VE_NON_SCALING_STROKE) + patternData->pattern->setPatternSpaceTransform(transformOnNonScalingStroke(object, patternData->transform)); context->setAlpha(svgStyle->strokeOpacity()); context->setStrokePattern(patternData->pattern); applyStrokeStyleToContext(context, style, object); @@ -212,8 +208,7 @@ FloatRect RenderSVGResourcePattern::calculatePatternBoundariesIncludingOverflow( return patternBoundariesIncludingOverflow; } -PassOwnPtr<ImageBuffer> RenderSVGResourcePattern::createTileImage(FloatRect& patternBoundaries, - AffineTransform& patternTransform, +PassOwnPtr<ImageBuffer> RenderSVGResourcePattern::createTileImage(PatternData* patternData, const SVGPatternElement* patternElement, RenderObject* object) const { @@ -224,8 +219,8 @@ PassOwnPtr<ImageBuffer> RenderSVGResourcePattern::createTileImage(FloatRect& pat return 0; FloatRect objectBoundingBox = object->objectBoundingBox(); - patternBoundaries = calculatePatternBoundaries(attributes, objectBoundingBox, patternElement); - patternTransform = attributes.patternTransform(); + FloatRect patternBoundaries = calculatePatternBoundaries(attributes, objectBoundingBox, patternElement); + AffineTransform patternTransform = attributes.patternTransform(); AffineTransform viewBoxCTM = patternElement->viewBoxToViewTransform(patternElement->viewBox(), patternElement->preserveAspectRatio(), @@ -276,11 +271,17 @@ PassOwnPtr<ImageBuffer> RenderSVGResourcePattern::createTileImage(FloatRect& pat renderSubtreeToImage(tileImage.get(), node->renderer()); } + patternData->boundaries = patternBoundaries; + + // Compute pattern transformation + patternData->transform.translate(patternBoundaries.x(), patternBoundaries.y()); + patternData->transform.multiply(patternTransform); + context->restore(); return tileImage.release(); } -void RenderSVGResourcePattern::buildPattern(PatternData* patternData, const FloatRect& patternBoundaries, PassOwnPtr<ImageBuffer> tileImage) const +void RenderSVGResourcePattern::buildPattern(PatternData* patternData, PassOwnPtr<ImageBuffer> tileImage) const { if (!tileImage->image()) { patternData->pattern = 0; @@ -288,14 +289,14 @@ void RenderSVGResourcePattern::buildPattern(PatternData* patternData, const Floa } IntRect tileRect = tileImage->image()->rect(); - if (tileRect.width() <= patternBoundaries.width() && tileRect.height() <= patternBoundaries.height()) { + if (tileRect.width() <= patternData->boundaries.width() && tileRect.height() <= patternData->boundaries.height()) { patternData->pattern = Pattern::create(tileImage->image(), true, true); return; } // Draw the first cell of the pattern manually to support overflow="visible" on all platforms. - int tileWidth = static_cast<int>(patternBoundaries.width() + 0.5f); - int tileHeight = static_cast<int>(patternBoundaries.height() + 0.5f); + int tileWidth = static_cast<int>(patternData->boundaries.width() + 0.5f); + int tileHeight = static_cast<int>(patternData->boundaries.height() + 0.5f); // Don't create ImageBuffers with image size of 0 if (!tileWidth || !tileHeight) { @@ -310,14 +311,14 @@ void RenderSVGResourcePattern::buildPattern(PatternData* patternData, const Floa int numX = static_cast<int>(ceilf(tileRect.width() / tileWidth)) + 1; newTileImageContext->save(); - newTileImageContext->translate(-patternBoundaries.width() * numX, -patternBoundaries.height() * numY); + newTileImageContext->translate(-patternData->boundaries.width() * numX, -patternData->boundaries.height() * numY); for (int i = numY; i > 0; --i) { - newTileImageContext->translate(0, patternBoundaries.height()); + newTileImageContext->translate(0, patternData->boundaries.height()); for (int j = numX; j > 0; --j) { - newTileImageContext->translate(patternBoundaries.width(), 0); + newTileImageContext->translate(patternData->boundaries.width(), 0); newTileImageContext->drawImage(tileImage->image(), style()->colorSpace(), tileRect, tileRect); } - newTileImageContext->translate(-patternBoundaries.width() * numX, 0); + newTileImageContext->translate(-patternData->boundaries.width() * numX, 0); } newTileImageContext->restore(); diff --git a/WebCore/rendering/RenderSVGResourcePattern.h b/WebCore/rendering/RenderSVGResourcePattern.h index 4129934..690b0de 100644 --- a/WebCore/rendering/RenderSVGResourcePattern.h +++ b/WebCore/rendering/RenderSVGResourcePattern.h @@ -38,6 +38,8 @@ namespace WebCore { struct PatternData { RefPtr<Pattern> pattern; + FloatRect boundaries; + AffineTransform transform; }; struct PatternAttributes; @@ -54,14 +56,14 @@ public: virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode); virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode); - virtual FloatRect resourceBoundingBox(const FloatRect&) { return FloatRect(); } + virtual FloatRect resourceBoundingBox(RenderObject*) { return FloatRect(); } virtual RenderSVGResourceType resourceType() const { return s_resourceType; } static RenderSVGResourceType s_resourceType; private: - PassOwnPtr<ImageBuffer> createTileImage(FloatRect& patternBoundaries, AffineTransform& patternTransform, const SVGPatternElement*, RenderObject*) const; - void buildPattern(PatternData*, const FloatRect& patternBoundaries, PassOwnPtr<ImageBuffer> tileImage) const; + PassOwnPtr<ImageBuffer> createTileImage(PatternData*, const SVGPatternElement*, RenderObject*) const; + void buildPattern(PatternData*, PassOwnPtr<ImageBuffer> tileImage) const; FloatRect calculatePatternBoundariesIncludingOverflow(PatternAttributes&, const FloatRect& objectBoundingBox, const AffineTransform& viewBoxCTM, const FloatRect& patternBoundaries) const; diff --git a/WebCore/rendering/RenderSVGResourceSolidColor.h b/WebCore/rendering/RenderSVGResourceSolidColor.h index a4de62d..ad7fd27 100644 --- a/WebCore/rendering/RenderSVGResourceSolidColor.h +++ b/WebCore/rendering/RenderSVGResourceSolidColor.h @@ -38,7 +38,7 @@ public: virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode); virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode); - virtual FloatRect resourceBoundingBox(const FloatRect&) { return FloatRect(); } + virtual FloatRect resourceBoundingBox(RenderObject*) { return FloatRect(); } virtual RenderSVGResourceType resourceType() const { return s_resourceType; } static RenderSVGResourceType s_resourceType; diff --git a/WebCore/rendering/RenderSVGText.cpp b/WebCore/rendering/RenderSVGText.cpp index 966196b..072b6d1 100644 --- a/WebCore/rendering/RenderSVGText.cpp +++ b/WebCore/rendering/RenderSVGText.cpp @@ -33,6 +33,7 @@ #include "FloatConversion.h" #include "FloatQuad.h" #include "GraphicsContext.h" +#include "HitTestRequest.h" #include "PointerEventsHitRules.h" #include "RenderLayer.h" #include "RenderSVGRoot.h" @@ -98,12 +99,16 @@ RootInlineBox* RenderSVGText::createRootInlineBox() bool RenderSVGText::nodeAtFloatPoint(const HitTestRequest& request, HitTestResult& result, const FloatPoint& pointInParent, HitTestAction hitTestAction) { - PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_TEXT_HITTESTING, style()->pointerEvents()); + PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_TEXT_HITTESTING, request, style()->pointerEvents()); bool isVisible = (style()->visibility() == VISIBLE); if (isVisible || !hitRules.requireVisible) { if ((hitRules.canHitStroke && (style()->svgStyle()->hasStroke() || !hitRules.requireStroke)) || (hitRules.canHitFill && (style()->svgStyle()->hasFill() || !hitRules.requireFill))) { FloatPoint localPoint = localToParentTransform().inverse().mapPoint(pointInParent); + + if (!pointInClippingArea(this, localPoint)) + return false; + return RenderBlock::nodeAtPoint(request, result, (int)localPoint.x(), (int)localPoint.y(), 0, 0, hitTestAction); } } @@ -186,7 +191,7 @@ FloatRect RenderSVGText::objectBoundingBox() const FloatRect RenderSVGText::strokeBoundingBox() const { - FloatRect repaintRect = objectBoundingBox(); + FloatRect strokeRect = objectBoundingBox(); // SVG needs to include the strokeWidth(), not the textStrokeWidth(). if (style()->svgStyle()->hasStroke()) { @@ -202,33 +207,31 @@ FloatRect RenderSVGText::strokeBoundingBox() const } #endif - repaintRect.inflate(strokeWidth); + strokeRect.inflate(strokeWidth); } - return repaintRect; + return strokeRect; } FloatRect RenderSVGText::repaintRectInLocalCoordinates() const { FloatRect repaintRect = strokeBoundingBox(); + intersectRepaintRectWithResources(this, repaintRect); - // FIXME: We need to be careful here. We assume that there is no filter, - // clipper or masker if the rects are empty. - FloatRect rect = filterBoundingBoxForRenderer(this); - if (!rect.isEmpty()) - repaintRect = rect; - - rect = clipperBoundingBoxForRenderer(this); - if (!rect.isEmpty()) - repaintRect.intersect(rect); - - rect = maskerBoundingBoxForRenderer(this); - if (!rect.isEmpty()) - repaintRect.intersect(rect); + return repaintRect; +} - style()->svgStyle()->inflateForShadow(repaintRect); +// Fix for <rdar://problem/8048875>. We should not render :first-line CSS Style +// in a SVG text element context. +RenderBlock* RenderSVGText::firstLineBlock() const +{ + return 0; +} - return repaintRect; +// Fix for <rdar://problem/8048875>. We should not render :first-letter CSS Style +// in a SVG text element context. +void RenderSVGText::updateFirstLetter() +{ } } diff --git a/WebCore/rendering/RenderSVGText.h b/WebCore/rendering/RenderSVGText.h index 66f7eb3..162c958 100644 --- a/WebCore/rendering/RenderSVGText.h +++ b/WebCore/rendering/RenderSVGText.h @@ -71,6 +71,9 @@ private: virtual RootInlineBox* createRootInlineBox(); + virtual RenderBlock* firstLineBlock() const; + virtual void updateFirstLetter(); + bool m_needsTransformUpdate : 1; AffineTransform m_localTransform; }; diff --git a/WebCore/rendering/RenderSlider.cpp b/WebCore/rendering/RenderSlider.cpp index aed8a8c..60b2369 100644 --- a/WebCore/rendering/RenderSlider.cpp +++ b/WebCore/rendering/RenderSlider.cpp @@ -28,14 +28,14 @@ #include "EventNames.h" #include "Frame.h" #include "HTMLInputElement.h" -#include "HTMLDivElement.h" #include "HTMLNames.h" -#include "HTMLParser.h" +#include "LegacyHTMLTreeConstructor.h" #include "MediaControlElements.h" #include "MouseEvent.h" #include "RenderLayer.h" #include "RenderTheme.h" #include "RenderView.h" +#include "ShadowElement.h" #include "StepRange.h" #include <wtf/MathExtras.h> @@ -47,8 +47,6 @@ using std::min; namespace WebCore { -using namespace HTMLNames; - static const int defaultTrackLength = 129; // Returns a value between 0 and 1. @@ -59,7 +57,7 @@ static double sliderPosition(HTMLInputElement* element) } // FIXME: Could share code with the SliderDivElement class in RenderProgress. -class SliderThumbElement : public HTMLDivElement { +class SliderThumbElement : public ShadowBlockElement { public: static PassRefPtr<SliderThumbElement> create(Node* shadowParent); @@ -71,17 +69,12 @@ public: private: SliderThumbElement(Node* shadowParent); - virtual bool isShadowNode() const { return true; } - virtual Node* shadowParentNode() { return m_shadowParent; } - FloatPoint m_offsetToThumb; - Node* m_shadowParent; bool m_inDragMode; }; inline SliderThumbElement::SliderThumbElement(Node* shadowParent) - : HTMLDivElement(divTag, shadowParent->document()) - , m_shadowParent(shadowParent) + : ShadowBlockElement(shadowParent) , m_inDragMode(false) { } @@ -94,7 +87,7 @@ inline PassRefPtr<SliderThumbElement> SliderThumbElement::create(Node* shadowPar void SliderThumbElement::defaultEventHandler(Event* event) { if (!event->isMouseEvent()) { - HTMLDivElement::defaultEventHandler(event); + ShadowBlockElement::defaultEventHandler(event); return; } @@ -118,7 +111,7 @@ void SliderThumbElement::defaultEventHandler(Event* event) } m_inDragMode = true; - document()->frame()->eventHandler()->setCapturingMouseEventsNode(m_shadowParent); + document()->frame()->eventHandler()->setCapturingMouseEventsNode(shadowParentNode()); event->setDefaultHandled(); return; } @@ -144,7 +137,7 @@ void SliderThumbElement::defaultEventHandler(Event* event) } } - HTMLDivElement::defaultEventHandler(event); + ShadowBlockElement::defaultEventHandler(event); } void SliderThumbElement::detach() @@ -153,7 +146,7 @@ void SliderThumbElement::detach() if (Frame* frame = document()->frame()) frame->eventHandler()->setCapturingMouseEventsNode(0); } - HTMLDivElement::detach(); + ShadowBlockElement::detach(); } RenderSlider::RenderSlider(HTMLInputElement* element) diff --git a/WebCore/rendering/RenderTextControl.cpp b/WebCore/rendering/RenderTextControl.cpp index 7724619..d1c8039 100644 --- a/WebCore/rendering/RenderTextControl.cpp +++ b/WebCore/rendering/RenderTextControl.cpp @@ -169,7 +169,7 @@ void RenderTextControl::setInnerTextValue(const String& innerTextValue) String value = innerTextValue; if (value != text() || !m_innerText->hasChildNodes()) { if (value != text()) { - if (Frame* frame = document()->frame()) { + if (Frame* frame = this->frame()) { frame->editor()->clearUndoRedoOperations(); if (AXObjectCache::accessibilityEnabled()) @@ -201,7 +201,7 @@ void RenderTextControl::setLastChangeWasUserEdit(bool lastChangeWasUserEdit) int RenderTextControl::selectionStart() { - Frame* frame = document()->frame(); + Frame* frame = this->frame(); if (!frame) return 0; return indexForVisiblePosition(frame->selection()->start()); @@ -209,7 +209,7 @@ int RenderTextControl::selectionStart() int RenderTextControl::selectionEnd() { - Frame* frame = document()->frame(); + Frame* frame = this->frame(); if (!frame) return 0; return indexForVisiblePosition(frame->selection()->end()); @@ -255,7 +255,7 @@ void RenderTextControl::setSelectionRange(int start, int end) } VisibleSelection newSelection = VisibleSelection(startPosition, endPosition); - if (Frame* frame = document()->frame()) + if (Frame* frame = this->frame()) frame->selection()->setSelection(newSelection); } @@ -545,7 +545,7 @@ void RenderTextControl::selectionChanged(bool userTriggered) { cacheSelection(selectionStart(), selectionEnd()); - if (Frame* frame = document()->frame()) { + if (Frame* frame = this->frame()) { if (frame->selection()->isRange() && userTriggered) node()->dispatchEvent(Event::create(eventNames().selectEvent, true, false)); } diff --git a/WebCore/rendering/RenderTextControlMultiLine.cpp b/WebCore/rendering/RenderTextControlMultiLine.cpp index 76bf612..976d1ac 100644 --- a/WebCore/rendering/RenderTextControlMultiLine.cpp +++ b/WebCore/rendering/RenderTextControlMultiLine.cpp @@ -57,7 +57,7 @@ void RenderTextControlMultiLine::subtreeHasChanged() node()->dispatchEvent(Event::create(eventNames().inputEvent, true, false)); - if (Frame* frame = document()->frame()) + if (Frame* frame = this->frame()) frame->textDidChangeInTextArea(textArea); } diff --git a/WebCore/rendering/RenderTextControlSingleLine.cpp b/WebCore/rendering/RenderTextControlSingleLine.cpp index 20f33c3..d3892e9 100644 --- a/WebCore/rendering/RenderTextControlSingleLine.cpp +++ b/WebCore/rendering/RenderTextControlSingleLine.cpp @@ -27,13 +27,14 @@ #include "EventNames.h" #include "Frame.h" #include "FrameView.h" -#include "HitTestResult.h" #include "HTMLInputElement.h" #include "HTMLNames.h" +#include "HitTestResult.h" #include "InputElement.h" #include "LocalizedStrings.h" #include "MouseEvent.h" #include "PlatformKeyboardEvent.h" +#include "RenderLayer.h" #include "RenderScrollbar.h" #include "RenderTheme.h" #include "SearchPopupMenu.h" @@ -171,7 +172,7 @@ void RenderTextControlSingleLine::subtreeHasChanged() startSearchEventTimer(); if (!wasChanged && node()->focused()) { - if (Frame* frame = document()->frame()) + if (Frame* frame = this->frame()) frame->textFieldDidBeginEditing(static_cast<Element*>(node())); } diff --git a/WebCore/rendering/RenderTextControlSingleLine.h b/WebCore/rendering/RenderTextControlSingleLine.h index b093954..dff9e5f 100644 --- a/WebCore/rendering/RenderTextControlSingleLine.h +++ b/WebCore/rendering/RenderTextControlSingleLine.h @@ -108,6 +108,8 @@ private: // PopupMenuClient methods virtual void valueChanged(unsigned listIndex, bool fireEvents = true); + virtual void selectionChanged(unsigned, bool) {} + virtual void selectionCleared() {} virtual String itemText(unsigned listIndex) const; virtual String itemToolTip(unsigned) const { return String(); } virtual String itemAccessibilityText(unsigned) const { return String(); } diff --git a/WebCore/rendering/RenderTheme.cpp b/WebCore/rendering/RenderTheme.cpp index c37de8d..2b5efc9 100644 --- a/WebCore/rendering/RenderTheme.cpp +++ b/WebCore/rendering/RenderTheme.cpp @@ -226,6 +226,10 @@ void RenderTheme::adjustStyle(CSSStyleSelector* selector, RenderStyle* style, El #endif #if ENABLE(METER_TAG) case MeterPart: + case RelevancyLevelIndicatorPart: + case ContinuousCapacityLevelIndicatorPart: + case DiscreteCapacityLevelIndicatorPart: + case RatingLevelIndicatorPart: return adjustMeterStyle(selector, style, e); #endif default: @@ -288,6 +292,10 @@ bool RenderTheme::paint(RenderObject* o, const RenderObject::PaintInfo& paintInf return paintMenuList(o, paintInfo, r); #if ENABLE(METER_TAG) case MeterPart: + case RelevancyLevelIndicatorPart: + case ContinuousCapacityLevelIndicatorPart: + case DiscreteCapacityLevelIndicatorPart: + case RatingLevelIndicatorPart: return paintMeter(o, paintInfo, r); #endif #if ENABLE(PROGRESS_TAG) @@ -386,6 +394,10 @@ bool RenderTheme::paintBorderOnly(RenderObject* o, const RenderObject::PaintInfo case MenulistPart: #if ENABLE(METER_TAG) case MeterPart: + case RelevancyLevelIndicatorPart: + case ContinuousCapacityLevelIndicatorPart: + case DiscreteCapacityLevelIndicatorPart: + case RatingLevelIndicatorPart: #endif #if ENABLE(PROGRESS_TAG) case ProgressBarPart: @@ -427,6 +439,10 @@ bool RenderTheme::paintDecorations(RenderObject* o, const RenderObject::PaintInf case MenulistPart: #if ENABLE(METER_TAG) case MeterPart: + case RelevancyLevelIndicatorPart: + case ContinuousCapacityLevelIndicatorPart: + case DiscreteCapacityLevelIndicatorPart: + case RatingLevelIndicatorPart: #endif #if ENABLE(PROGRESS_TAG) case ProgressBarPart: @@ -897,8 +913,16 @@ void RenderTheme::adjustMeterStyle(CSSStyleSelector*, RenderStyle* style, Elemen style->setBoxShadow(0); } +IntSize RenderTheme::meterSizeForBounds(const RenderMeter*, const IntRect& bounds) const +{ + return bounds.size(); +} + bool RenderTheme::paintMeter(RenderObject* renderObject, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) { + if (!renderObject->isMeter()) + return true; + // Some platforms do not have a native gauge widget, so we draw here a default implementation. RenderMeter* renderMeter = toRenderMeter(renderObject); RenderStyle* style = renderObject->style(); diff --git a/WebCore/rendering/RenderTheme.h b/WebCore/rendering/RenderTheme.h index a4514a5..2d196c7 100644 --- a/WebCore/rendering/RenderTheme.h +++ b/WebCore/rendering/RenderTheme.h @@ -39,6 +39,9 @@ namespace WebCore { class Element; class PopupMenu; class RenderMenuList; +#if ENABLE(METER_TAG) +class RenderMeter; +#endif #if ENABLE(PROGRESS_TAG) class RenderProgress; #endif @@ -190,6 +193,10 @@ public: virtual String formatMediaControlsRemainingTime(float currentTime, float duration) const; #endif +#if ENABLE(METER_TAG) + virtual IntSize meterSizeForBounds(const RenderMeter*, const IntRect&) const; +#endif + protected: // The platform selection color. virtual Color platformActiveSelectionBackgroundColor() const; diff --git a/WebCore/rendering/RenderThemeChromiumSkia.cpp b/WebCore/rendering/RenderThemeChromiumSkia.cpp index 0956e38..e3afd1f 100644 --- a/WebCore/rendering/RenderThemeChromiumSkia.cpp +++ b/WebCore/rendering/RenderThemeChromiumSkia.cpp @@ -26,6 +26,7 @@ #include "ChromiumBridge.h" #include "CSSValueKeywords.h" +#include "CurrentTime.h" #include "GraphicsContext.h" #include "HTMLMediaElement.h" #include "HTMLNames.h" @@ -35,6 +36,7 @@ #include "RenderBox.h" #include "RenderMediaControlsChromium.h" #include "RenderObject.h" +#include "RenderProgress.h" #include "RenderSlider.h" #include "ScrollbarTheme.h" #include "TimeRanges.h" @@ -768,4 +770,113 @@ int RenderThemeChromiumSkia::menuListInternalPadding(RenderStyle* style, int pad return padding; } +#if ENABLE(PROGRESS_TAG) + +// +// Following values are come from default of GTK+ +// +static const int progressDeltaPixelsPerSecond = 100; +static const int progressActivityBlocks = 5; +static const int progressAnimationFrmaes = 10; +static const double progressAnimationInterval = 0.125; + +IntRect RenderThemeChromiumSkia::determinateProgressValueRectFor(RenderProgress* renderProgress, const IntRect& rect) const +{ + int dx = rect.width() * renderProgress->position(); + if (renderProgress->style()->direction() == RTL) + return IntRect(rect.x() + rect.width() - dx, rect.y(), dx, rect.height()); + return IntRect(rect.x(), rect.y(), dx, rect.height()); +} + +IntRect RenderThemeChromiumSkia::indeterminateProgressValueRectFor(RenderProgress* renderProgress, const IntRect& rect) const +{ + + int valueWidth = rect.width() / progressActivityBlocks; + int movableWidth = rect.width() - valueWidth; + if (movableWidth <= 0) + return IntRect(); + + double progress = renderProgress->animationProgress(); + if (progress < 0.5) + return IntRect(rect.x() + progress * 2 * movableWidth, rect.y(), valueWidth, rect.height()); + return IntRect(rect.x() + (1.0 - progress) * 2 * movableWidth, rect.y(), valueWidth, rect.height()); +} + +double RenderThemeChromiumSkia::animationRepeatIntervalForProgressBar(RenderProgress*) const +{ + return progressAnimationInterval; +} + +double RenderThemeChromiumSkia::animationDurationForProgressBar(RenderProgress* renderProgress) const +{ + return progressAnimationInterval * progressAnimationFrmaes * 2; // "2" for back and forth +} + +bool RenderThemeChromiumSkia::paintProgressBar(RenderObject* renderObject, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) +{ + static Image* barImage = Image::loadPlatformResource("linuxProgressBar").releaseRef(); + static Image* valueImage = Image::loadPlatformResource("linuxProgressValue").releaseRef(); + static Image* leftBorderImage = Image::loadPlatformResource("linuxProgressBorderLeft").releaseRef(); + static Image* rightBorderImage = Image::loadPlatformResource("linuxProgressBorderRight").releaseRef(); + ASSERT(barImage->height() == valueImage->height()); + + if (!renderObject->isProgress()) + return true; + + paintInfo.context->platformContext()->setImageResamplingHint(barImage->size(), rect.size()); + + RenderProgress* renderProgress = toRenderProgress(renderObject); + double tileScale = static_cast<double>(rect.height()) / barImage->height(); + IntSize barTileSize(static_cast<int>(barImage->width() * tileScale), rect.height()); + ColorSpace colorSpace = renderObject->style()->colorSpace(); + + paintInfo.context->drawTiledImage(barImage, colorSpace, rect, IntPoint(0, 0), barTileSize); + + IntRect valueRect = progressValueRectFor(renderProgress, rect); + if (valueRect.width()) { + + IntSize valueTileSize(static_cast<int>(valueImage->width() * tileScale), valueRect.height()); + int leftOffset = valueRect.x() - rect.x(); + int roundedLeftOffset= (leftOffset / valueTileSize.width()) * valueTileSize.width(); + int dstLeftValueWidth = roundedLeftOffset - leftOffset + (leftOffset % valueImage->width()) ? valueTileSize.width() : 0; + + IntRect dstLeftValueRect(valueRect.x(), valueRect.y(), dstLeftValueWidth, valueRect.height()); + int srcLeftValueWidth = dstLeftValueWidth / tileScale; + IntRect srcLeftValueRect(valueImage->width() - srcLeftValueWidth, 0, srcLeftValueWidth, valueImage->height()); + paintInfo.context->drawImage(valueImage, colorSpace, dstLeftValueRect, srcLeftValueRect); + + int rightOffset = valueRect.right() - rect.x(); + int roundedRightOffset = (rightOffset / valueTileSize.width()) * valueTileSize.width(); + int dstRightValueWidth = rightOffset - roundedRightOffset; + IntRect dstRightValueRect(rect.x() + roundedRightOffset, valueRect.y(), dstRightValueWidth, valueTileSize.height()); + int srcRightValueWidth = dstRightValueWidth / tileScale; + IntRect srcRightValueRect(0, 0, srcRightValueWidth, valueImage->height()); + paintInfo.context->drawImage(valueImage, colorSpace, dstRightValueRect, srcRightValueRect); + + IntRect alignedValueRect(dstLeftValueRect.right(), dstLeftValueRect.y(), + dstRightValueRect.x() - dstLeftValueRect.right(), dstLeftValueRect.height()); + paintInfo.context->drawTiledImage(valueImage, colorSpace, alignedValueRect, IntPoint(0, 0), valueTileSize); + } + + int dstLeftBorderWidth = leftBorderImage->width() * tileScale; + IntRect dstLeftBorderRect(rect.x(), rect.y(), dstLeftBorderWidth, rect.height()); + paintInfo.context->drawImage(leftBorderImage, colorSpace, dstLeftBorderRect, leftBorderImage->rect()); + + int dstRightBorderWidth = rightBorderImage->width() * tileScale; + IntRect dstRightBorderRect(rect.right() - dstRightBorderWidth, rect.y(), dstRightBorderWidth, rect.height()); + paintInfo.context->drawImage(rightBorderImage, colorSpace, dstRightBorderRect, rightBorderImage->rect()); + + paintInfo.context->platformContext()->clearImageResamplingHint(); + + return false; +} + + +IntRect RenderThemeChromiumSkia::progressValueRectFor(RenderProgress* renderProgress, const IntRect& rect) const +{ + return renderProgress->isDeterminate() ? determinateProgressValueRectFor(renderProgress, rect) : indeterminateProgressValueRectFor(renderProgress, rect); +} + +#endif + } // namespace WebCore diff --git a/WebCore/rendering/RenderThemeChromiumSkia.h b/WebCore/rendering/RenderThemeChromiumSkia.h index dc920b1cf..56c315e 100644 --- a/WebCore/rendering/RenderThemeChromiumSkia.h +++ b/WebCore/rendering/RenderThemeChromiumSkia.h @@ -32,6 +32,8 @@ namespace WebCore { +class RenderProgress; + class RenderThemeChromiumSkia : public RenderTheme { public: RenderThemeChromiumSkia(); @@ -117,6 +119,12 @@ namespace WebCore { virtual bool paintSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); virtual bool paintSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); +#if ENABLE(PROGRESS_TAG) + virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const; + virtual double animationDurationForProgressBar(RenderProgress*) const; + virtual bool paintProgressBar(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); +#endif + // These methods define the padding for the MenuList's inner block. virtual int popupInternalPaddingLeft(RenderStyle*) const; virtual int popupInternalPaddingRight(RenderStyle*) const; @@ -145,6 +153,12 @@ namespace WebCore { virtual double caretBlinkIntervalInternal() const; +#if ENABLE(PROGRESS_TAG) + IntRect determinateProgressValueRectFor(RenderProgress*, const IntRect&) const; + IntRect indeterminateProgressValueRectFor(RenderProgress*, const IntRect&) const; + IntRect progressValueRectFor(RenderProgress*, const IntRect&) const; +#endif + private: int menuListInternalPadding(RenderStyle*, int paddingType) const; bool paintMediaButtonInternal(GraphicsContext*, const IntRect&, Image*); diff --git a/WebCore/rendering/RenderThemeChromiumWin.cpp b/WebCore/rendering/RenderThemeChromiumWin.cpp index cc7570c..d82fddc 100644 --- a/WebCore/rendering/RenderThemeChromiumWin.cpp +++ b/WebCore/rendering/RenderThemeChromiumWin.cpp @@ -679,21 +679,13 @@ void RenderThemeChromiumWin::adjustProgressBarStyle(CSSStyleSelector*, RenderSty bool RenderThemeChromiumWin::paintProgressBar(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { - RenderProgress* renderProgress = toRenderProgress(o); - - IntRect valueRect; - if (renderProgress->isDeterminate()) { - int dx = r.width() * renderProgress->position(); - if (renderProgress->style()->direction() == RTL) - valueRect = IntRect(r.x() + r.width() - dx, r.y(), dx, r.height()); - else - valueRect = IntRect(r.x(), r.y(), dx, r.height()); - } else { - // For indeterminate bar, valueRect is ignored and it is computed by the theme engine - // because the animation is a platform detail and WebKit doesn't need to know how. - valueRect = IntRect(0, 0, 0, 0); - } + if (!o->isProgress()) + return true; + RenderProgress* renderProgress = toRenderProgress(o); + // For indeterminate bar, valueRect is ignored and it is computed by the theme engine + // because the animation is a platform detail and WebKit doesn't need to know how. + IntRect valueRect = renderProgress->isDeterminate() ? determinateProgressValueRectFor(renderProgress, r) : IntRect(0, 0, 0, 0); double animatedSeconds = renderProgress->animationStartTime() ? WTF::currentTime() - renderProgress->animationStartTime() : 0; ThemePainter painter(i.context, r); ChromiumBridge::paintProgressBar(painter.context(), r, valueRect, renderProgress->isDeterminate(), animatedSeconds); diff --git a/WebCore/rendering/RenderThemeMac.h b/WebCore/rendering/RenderThemeMac.h index cb604b9..7cb4e3b 100644 --- a/WebCore/rendering/RenderThemeMac.h +++ b/WebCore/rendering/RenderThemeMac.h @@ -80,6 +80,11 @@ public: virtual bool paintCapsLockIndicator(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); +#if ENABLE(METER_TAG) + virtual IntSize meterSizeForBounds(const RenderMeter*, const IntRect&) const; + virtual bool paintMeter(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); +#endif + #if ENABLE(PROGRESS_TAG) // Returns the repeat interval of the animation for the progress bar. virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const; @@ -201,12 +206,18 @@ private: NSSliderCell* sliderThumbHorizontal() const; NSSliderCell* sliderThumbVertical() const; +#if ENABLE(METER_TAG) + NSLevelIndicatorStyle levelIndicatorStyleFor(ControlPart) const; + NSLevelIndicatorCell* levelIndicatorFor(const RenderMeter*) const; +#endif + private: mutable RetainPtr<NSPopUpButtonCell> m_popupButton; mutable RetainPtr<NSSearchFieldCell> m_search; mutable RetainPtr<NSMenu> m_searchMenuTemplate; mutable RetainPtr<NSSliderCell> m_sliderThumbHorizontal; mutable RetainPtr<NSSliderCell> m_sliderThumbVertical; + mutable RetainPtr<NSLevelIndicatorCell> m_levelIndicator; bool m_isSliderThumbHorizontalPressed; bool m_isSliderThumbVerticalPressed; diff --git a/WebCore/rendering/RenderThemeMac.mm b/WebCore/rendering/RenderThemeMac.mm index f1de775..d0289de 100644 --- a/WebCore/rendering/RenderThemeMac.mm +++ b/WebCore/rendering/RenderThemeMac.mm @@ -51,6 +51,11 @@ #import "RenderProgress.h" +#if ENABLE(METER_TAG) +#include "RenderMeter.h" +#include "HTMLMeterElement.h" +#endif + #ifdef BUILDING_ON_TIGER typedef int NSInteger; typedef unsigned NSUInteger; @@ -801,7 +806,100 @@ bool RenderThemeMac::paintMenuList(RenderObject* o, const RenderObject::PaintInf return false; } - + +#if ENABLE(METER_TAG) + +IntSize RenderThemeMac::meterSizeForBounds(const RenderMeter* renderMeter, const IntRect& bounds) const +{ + if (NoControlPart == renderMeter->style()->appearance()) + return bounds.size(); + + NSLevelIndicatorCell* cell = levelIndicatorFor(renderMeter); + // Makes enough room for cell's intrinsic size. + NSSize cellSize = [cell cellSizeForBounds:IntRect(IntPoint(), bounds.size())]; + return IntSize(bounds.width() < cellSize.width ? cellSize.width : bounds.width(), + bounds.height() < cellSize.height ? cellSize.height : bounds.height()); +} + +bool RenderThemeMac::paintMeter(RenderObject* renderObject, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) +{ + if (!renderObject->isMeter()) + return true; + + // Becaue NSLevelIndicatorCell doesn't support vertical gauge, we use a portable version + if (rect.width() < rect.height()) + return RenderTheme::paintMeter(renderObject, paintInfo, rect); + + NSLevelIndicatorCell* cell = levelIndicatorFor(toRenderMeter(renderObject)); + paintInfo.context->save(); + [cell drawWithFrame:rect inView:documentViewFor(renderObject)]; + [cell setControlView:nil]; + paintInfo.context->restore(); + + return false; +} + +NSLevelIndicatorStyle RenderThemeMac::levelIndicatorStyleFor(ControlPart part) const +{ + switch (part) { + case RelevancyLevelIndicatorPart: + return NSRelevancyLevelIndicatorStyle; + case DiscreteCapacityLevelIndicatorPart: + return NSDiscreteCapacityLevelIndicatorStyle; + case RatingLevelIndicatorPart: + return NSRatingLevelIndicatorStyle; + case MeterPart: + case ContinuousCapacityLevelIndicatorPart: + default: + return NSContinuousCapacityLevelIndicatorStyle; + } + +} + +NSLevelIndicatorCell* RenderThemeMac::levelIndicatorFor(const RenderMeter* renderMeter) const +{ + RenderStyle* style = renderMeter->style(); + ASSERT(style->appearance() != NoControlPart); + + if (!m_levelIndicator) + m_levelIndicator.adoptNS([[NSLevelIndicatorCell alloc] initWithLevelIndicatorStyle:NSContinuousCapacityLevelIndicatorStyle]); + NSLevelIndicatorCell* cell = m_levelIndicator.get(); + + HTMLMeterElement* element = static_cast<HTMLMeterElement*>(renderMeter->node()); + double value = element->value(); + + // Because NSLevelIndicatorCell does not support optimum-in-the-middle type coloring, + // we explicitly control the color instead giving low and high value to NSLevelIndicatorCell as is. + switch (element->gaugeRegion()) { + case HTMLMeterElement::GaugeRegionOptimum: + // Make meter the green + [cell setWarningValue:value + 1]; + [cell setCriticalValue:value + 2]; + break; + case HTMLMeterElement::GaugeRegionSuboptimal: + // Make the meter yellow + [cell setWarningValue:value - 1]; + [cell setCriticalValue:value + 1]; + break; + case HTMLMeterElement::GaugeRegionEvenLessGood: + // Make the meter red + [cell setWarningValue:value - 2]; + [cell setCriticalValue:value - 1]; + break; + } + + [cell setLevelIndicatorStyle:levelIndicatorStyleFor(style->appearance())]; + [cell setBaseWritingDirection:style->direction() == LTR ? NSWritingDirectionLeftToRight : NSWritingDirectionRightToLeft]; + [cell setMinValue:element->min()]; + [cell setMaxValue:element->max()]; + RetainPtr<NSNumber> valueObject = [NSNumber numberWithDouble:value]; + [cell setObjectValue:valueObject.get()]; + + return cell; +} + +#endif + #if ENABLE(PROGRESS_TAG) double RenderThemeMac::animationRepeatIntervalForProgressBar(RenderProgress*) const @@ -820,6 +918,9 @@ void RenderThemeMac::adjustProgressBarStyle(CSSStyleSelector*, RenderStyle*, Ele bool RenderThemeMac::paintProgressBar(RenderObject* renderObject, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) { + if (!renderObject->isProgress()) + return true; + RenderProgress* renderProgress = toRenderProgress(renderObject); HIThemeTrackDrawInfo trackInfo; trackInfo.version = 0; diff --git a/WebCore/rendering/RenderTreeAsText.cpp b/WebCore/rendering/RenderTreeAsText.cpp index cf76f0b..b05d97a 100644 --- a/WebCore/rendering/RenderTreeAsText.cpp +++ b/WebCore/rendering/RenderTreeAsText.cpp @@ -38,6 +38,7 @@ #include "RenderBR.h" #include "RenderFileUploadControl.h" #include "RenderInline.h" +#include "RenderLayer.h" #include "RenderListItem.h" #include "RenderListMarker.h" #include "RenderPart.h" diff --git a/WebCore/rendering/RenderWidget.cpp b/WebCore/rendering/RenderWidget.cpp index e477676..2556bbb 100644 --- a/WebCore/rendering/RenderWidget.cpp +++ b/WebCore/rendering/RenderWidget.cpp @@ -27,6 +27,7 @@ #include "AnimationController.h" #include "GraphicsContext.h" #include "HitTestResult.h" +#include "RenderLayer.h" #include "RenderView.h" #include "RenderWidgetProtector.h" @@ -333,7 +334,7 @@ void RenderWidget::updateWidgetPosition() #ifndef ANDROID_FLATTEN_IFRAME // if the frame bounds got changed, or if view needs layout (possibly indicating // content size is wrong) we have to do a layout to set the right widget size - if (m_widget->isFrameView()) { + if (m_widget && m_widget->isFrameView()) { FrameView* frameView = static_cast<FrameView*>(m_widget.get()); if (boundsChanged || frameView->needsLayout()) frameView->layout(); diff --git a/WebCore/rendering/RootInlineBox.cpp b/WebCore/rendering/RootInlineBox.cpp index 691179d..24e49c6 100644 --- a/WebCore/rendering/RootInlineBox.cpp +++ b/WebCore/rendering/RootInlineBox.cpp @@ -126,7 +126,7 @@ void RootInlineBox::paintEllipsisBox(RenderObject::PaintInfo& paintInfo, int tx, void RootInlineBox::addHighlightOverflow() { - Frame* frame = renderer()->document()->frame(); + Frame* frame = renderer()->frame(); if (!frame) return; Page* page = frame->page(); @@ -145,7 +145,7 @@ void RootInlineBox::paintCustomHighlight(RenderObject::PaintInfo& paintInfo, int if (!renderer()->shouldPaintWithinRoot(paintInfo) || renderer()->style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseForeground) return; - Frame* frame = renderer()->document()->frame(); + Frame* frame = renderer()->frame(); if (!frame) return; Page* page = frame->page(); diff --git a/WebCore/rendering/SVGRenderSupport.cpp b/WebCore/rendering/SVGRenderSupport.cpp index 2600512..2ae90de 100644 --- a/WebCore/rendering/SVGRenderSupport.cpp +++ b/WebCore/rendering/SVGRenderSupport.cpp @@ -32,6 +32,7 @@ #include "Document.h" #include "ImageBuffer.h" #include "NodeRenderStyle.h" +#include "RenderLayer.h" #include "RenderObject.h" #include "RenderSVGContainer.h" #include "RenderSVGResource.h" @@ -81,7 +82,7 @@ void SVGRenderBase::mapLocalToContainer(const RenderObject* object, RenderBoxMod object->parent()->mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState); } -bool SVGRenderBase::prepareToRenderSVGContent(RenderObject* object, RenderObject::PaintInfo& paintInfo, const FloatRect& repaintRect, RenderSVGResourceFilter*& filter, RenderSVGResourceFilter* rootFilter) +bool SVGRenderBase::prepareToRenderSVGContent(RenderObject* object, RenderObject::PaintInfo& paintInfo, const FloatRect& repaintRect, RenderSVGResourceFilter*& filter) { #if !ENABLE(FILTERS) UNUSED_PARAM(filter); @@ -99,7 +100,7 @@ bool SVGRenderBase::prepareToRenderSVGContent(RenderObject* object, RenderObject const SVGRenderStyle* svgStyle = style->svgStyle(); ASSERT(svgStyle); - // Setup transparency layers before setting up filters! + // Setup transparency layers before setting up SVG resources! float opacity = style->opacity(); if (opacity < 1.0f) { paintInfo.context->clip(repaintRect); @@ -112,43 +113,35 @@ bool SVGRenderBase::prepareToRenderSVGContent(RenderObject* object, RenderObject paintInfo.context->beginTransparencyLayer(1.0f); } -#if ENABLE(FILTERS) - AtomicString filterId(svgStyle->filterResource()); -#endif - - AtomicString clipperId(svgStyle->clipperResource()); - AtomicString maskerId(svgStyle->maskerResource()); - Document* document = object->document(); -#if ENABLE(FILTERS) - RenderSVGResourceFilter* newFilter = getRenderSVGResourceById<RenderSVGResourceFilter>(document, filterId); - if (newFilter == rootFilter) { - // Catch <text filter="url(#foo)">Test<tspan filter="url(#foo)">123</tspan></text>. - // The filter is NOT meant to be applied twice in that case! - filter = 0; - filterId = String(); - } else - filter = newFilter; -#endif - - if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(document, maskerId)) { - if (!masker->applyResource(object, style, paintInfo.context, ApplyToDefaultMode)) - return false; - } else if (!maskerId.isEmpty()) - svgElement->document()->accessSVGExtensions()->addPendingResource(maskerId, styledElement); + if (svgStyle->hasMasker()) { + AtomicString maskerId(svgStyle->maskerResource()); + if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(document, maskerId)) { + if (!masker->applyResource(object, style, paintInfo.context, ApplyToDefaultMode)) + return false; + } else + svgElement->document()->accessSVGExtensions()->addPendingResource(maskerId, styledElement); + } - if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(document, clipperId)) - clipper->applyResource(object, style, paintInfo.context, ApplyToDefaultMode); - else if (!clipperId.isEmpty()) - svgElement->document()->accessSVGExtensions()->addPendingResource(clipperId, styledElement); + if (svgStyle->hasClipper()) { + AtomicString clipperId(svgStyle->clipperResource()); + if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(document, clipperId)) + clipper->applyResource(object, style, paintInfo.context, ApplyToDefaultMode); + else + svgElement->document()->accessSVGExtensions()->addPendingResource(clipperId, styledElement); + } #if ENABLE(FILTERS) - if (filter) { - if (!filter->applyResource(object, style, paintInfo.context, ApplyToDefaultMode)) - return false; - } else if (!filterId.isEmpty()) - svgElement->document()->accessSVGExtensions()->addPendingResource(filterId, styledElement); + if (svgStyle->hasFilter()) { + AtomicString filterId(svgStyle->filterResource()); + filter = getRenderSVGResourceById<RenderSVGResourceFilter>(document, filterId); + if (filter) { + if (!filter->applyResource(object, style, paintInfo.context, ApplyToDefaultMode)) + return false; + } else + svgElement->document()->accessSVGExtensions()->addPendingResource(filterId, styledElement); + } #endif return true; @@ -280,31 +273,33 @@ bool SVGRenderBase::isOverflowHidden(const RenderObject* object) return object->style()->overflowX() == OHIDDEN; } -FloatRect SVGRenderBase::filterBoundingBoxForRenderer(const RenderObject* object) const +void SVGRenderBase::intersectRepaintRectWithResources(const RenderObject* object, FloatRect& repaintRect) const { + ASSERT(object); + ASSERT(object->style()); + const SVGRenderStyle* svgStyle = object->style()->svgStyle(); + if (!svgStyle) + return; + + RenderObject* renderer = const_cast<RenderObject*>(object); #if ENABLE(FILTERS) - if (RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(object->document(), object->style()->svgStyle()->filterResource())) - return filter->resourceBoundingBox(object->objectBoundingBox()); -#else - UNUSED_PARAM(object); + if (svgStyle->hasFilter()) { + if (RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(object->document(), svgStyle->filterResource())) + repaintRect = filter->resourceBoundingBox(renderer); + } #endif - return FloatRect(); -} - -FloatRect SVGRenderBase::clipperBoundingBoxForRenderer(const RenderObject* object) const -{ - if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(object->document(), object->style()->svgStyle()->clipperResource())) - return clipper->resourceBoundingBox(object->objectBoundingBox()); - - return FloatRect(); -} -FloatRect SVGRenderBase::maskerBoundingBoxForRenderer(const RenderObject* object) const -{ - if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(object->document(), object->style()->svgStyle()->maskerResource())) - return masker->resourceBoundingBox(object->objectBoundingBox()); - - return FloatRect(); + if (svgStyle->hasClipper()) { + if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(object->document(), svgStyle->clipperResource())) + repaintRect.intersect(clipper->resourceBoundingBox(renderer)); + } + + if (svgStyle->hasMasker()) { + if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(object->document(), svgStyle->maskerResource())) + repaintRect.intersect(masker->resourceBoundingBox(renderer)); + } + + svgStyle->inflateForShadow(repaintRect); } static inline void invalidatePaintingResource(SVGPaint* paint, RenderObject* object) @@ -320,6 +315,27 @@ static inline void invalidatePaintingResource(SVGPaint* paint, RenderObject* obj paintingResource->invalidateClient(object); } +bool pointInClippingArea(const RenderObject* object, const FloatPoint& point) +{ + ASSERT(object); + ASSERT(object->style()); + + Document* document = object->document(); + ASSERT(document); + + const SVGRenderStyle* svgStyle = object->style()->svgStyle(); + ASSERT(svgStyle); + + // We just take clippers into account to determine if a point is on the node. The Specification may + // change later and we also need to check maskers. + if (svgStyle->hasClipper()) { + if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(document, svgStyle->clipperResource())) + return clipper->hitTestClipContent(object->objectBoundingBox(), point); + } + + return true; +} + void deregisterFromResources(RenderObject* object) { ASSERT(object); diff --git a/WebCore/rendering/SVGRenderSupport.h b/WebCore/rendering/SVGRenderSupport.h index b8a014a..e961c73 100644 --- a/WebCore/rendering/SVGRenderSupport.h +++ b/WebCore/rendering/SVGRenderSupport.h @@ -46,7 +46,7 @@ public: // FIXME: These are only public for SVGRootInlineBox. // It's unclear if these should be exposed or not. SVGRootInlineBox may // pass the wrong RenderObject* and boundingBox to these functions. - static bool prepareToRenderSVGContent(RenderObject*, RenderObject::PaintInfo&, const FloatRect& boundingBox, RenderSVGResourceFilter*&, RenderSVGResourceFilter* rootFilter = 0); + static bool prepareToRenderSVGContent(RenderObject*, RenderObject::PaintInfo&, const FloatRect& boundingBox, RenderSVGResourceFilter*&); static void finishRenderSVGContent(RenderObject*, RenderObject::PaintInfo&, RenderSVGResourceFilter*&, GraphicsContext* savedContext); // Layout all children of the passed render object @@ -58,10 +58,8 @@ public: // strokeBoundingBox() includes the marker boundaries for a RenderPath object virtual FloatRect strokeBoundingBox() const { return FloatRect(); } - // returns the bounding box of filter, clipper, marker and masker (or the empty rect if no filter) in local coordinates - FloatRect filterBoundingBoxForRenderer(const RenderObject*) const; - FloatRect clipperBoundingBoxForRenderer(const RenderObject*) const; - FloatRect maskerBoundingBoxForRenderer(const RenderObject*) const; + // Calculates the repaintRect in combination with filter, clipper and masker in local coordinates. + void intersectRepaintRectWithResources(const RenderObject*, FloatRect&) const; protected: static IntRect clippedOverflowRectForRepaint(RenderObject*, RenderBoxModelObject* repaintContainer); @@ -81,6 +79,8 @@ void applyTransformToPaintInfo(RenderObject::PaintInfo&, const AffineTransform& // This offers a way to render parts of a WebKit rendering tree into a ImageBuffer. void renderSubtreeToImage(ImageBuffer*, RenderObject*); +bool pointInClippingArea(const RenderObject*, const FloatPoint&); + void deregisterFromResources(RenderObject*); void clampImageBufferSizeToViewport(FrameView*, IntSize& imageBufferSize); diff --git a/WebCore/rendering/SVGRenderTreeAsText.cpp b/WebCore/rendering/SVGRenderTreeAsText.cpp index 8668780..2a71dee 100644 --- a/WebCore/rendering/SVGRenderTreeAsText.cpp +++ b/WebCore/rendering/SVGRenderTreeAsText.cpp @@ -351,7 +351,7 @@ static void writeSVGPaintingResource(TextStream& ts, RenderSVGResource* resource else if (resource->resourceType() == RadialGradientResourceType) ts << "[type=RADIAL-GRADIENT]"; - ts << " [id=\"" << static_cast<SVGElement*>(node)->getIDAttribute() << "\"]"; + ts << " [id=\"" << static_cast<SVGElement*>(node)->getIdAttribute() << "\"]"; } static void writeStyle(TextStream& ts, const RenderObject& object) @@ -581,7 +581,7 @@ void writeSVGResourceContainer(TextStream& ts, const RenderObject& object, int i writeStandardPrefix(ts, object, indent); Element* element = static_cast<Element*>(object.node()); - const AtomicString& id = element->getIDAttribute(); + const AtomicString& id = element->getIdAttribute(); writeNameAndQuotedValue(ts, "id", id); RenderSVGResourceContainer* resource = const_cast<RenderObject&>(object).toRenderSVGResourceContainer(); @@ -734,6 +734,7 @@ void writeResources(TextStream& ts, const RenderObject& object, int indent) const RenderStyle* style = object.style(); const SVGRenderStyle* svgStyle = style->svgStyle(); + RenderObject& renderer = const_cast<RenderObject&>(object); if (!svgStyle->maskerResource().isEmpty()) { if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(object.document(), svgStyle->maskerResource())) { writeIndent(ts, indent); @@ -741,7 +742,7 @@ void writeResources(TextStream& ts, const RenderObject& object, int indent) writeNameAndQuotedValue(ts, "masker", svgStyle->maskerResource()); ts << " "; writeStandardPrefix(ts, *masker, 0); - ts << " " << masker->resourceBoundingBox(object.objectBoundingBox()) << "\n"; + ts << " " << masker->resourceBoundingBox(&renderer) << "\n"; } } if (!svgStyle->clipperResource().isEmpty()) { @@ -751,7 +752,7 @@ void writeResources(TextStream& ts, const RenderObject& object, int indent) writeNameAndQuotedValue(ts, "clipPath", svgStyle->clipperResource()); ts << " "; writeStandardPrefix(ts, *clipper, 0); - ts << " " << clipper->resourceBoundingBox(object.objectBoundingBox()) << "\n"; + ts << " " << clipper->resourceBoundingBox(&renderer) << "\n"; } } #if ENABLE(FILTERS) @@ -762,7 +763,7 @@ void writeResources(TextStream& ts, const RenderObject& object, int indent) writeNameAndQuotedValue(ts, "filter", svgStyle->filterResource()); ts << " "; writeStandardPrefix(ts, *filter, 0); - ts << " " << filter->resourceBoundingBox(object.objectBoundingBox()) << "\n"; + ts << " " << filter->resourceBoundingBox(&renderer) << "\n"; } } #endif diff --git a/WebCore/rendering/SVGRootInlineBox.cpp b/WebCore/rendering/SVGRootInlineBox.cpp index 8760fe5..6b750be 100644 --- a/WebCore/rendering/SVGRootInlineBox.cpp +++ b/WebCore/rendering/SVGRootInlineBox.cpp @@ -73,14 +73,13 @@ RenderSVGRoot* findSVGRootObject(RenderObject* start) // Helper class for paint() struct SVGRootInlineBoxPaintWalker { - SVGRootInlineBoxPaintWalker(SVGRootInlineBox* rootBox, RenderSVGResourceFilter* rootFilter, RenderObject::PaintInfo paintInfo, int tx, int ty) + SVGRootInlineBoxPaintWalker(SVGRootInlineBox* rootBox, RenderObject::PaintInfo paintInfo, int tx, int ty) : m_rootBox(rootBox) , m_chunkStarted(false) , m_paintInfo(paintInfo) , m_savedInfo(paintInfo) , m_boundingBox(tx + rootBox->x(), ty + rootBox->y(), rootBox->width(), rootBox->height()) , m_filter(0) - , m_rootFilter(rootFilter) , m_fillPaintingResource(0) , m_strokePaintingResource(0) , m_fillPaintingResourceObject(0) @@ -143,7 +142,7 @@ struct SVGRootInlineBoxPaintWalker { // FIXME: Why is this done here instead of in RenderSVGText? if (!flowBox->isRootInlineBox()) - SVGRenderBase::prepareToRenderSVGContent(object, m_paintInfo, m_boundingBox, m_filter, m_rootFilter); + SVGRenderBase::prepareToRenderSVGContent(object, m_paintInfo, m_boundingBox, m_filter); } void chunkEndCallback(InlineBox* box) @@ -403,7 +402,6 @@ private: FloatRect m_boundingBox; RenderSVGResourceFilter* m_filter; - RenderSVGResourceFilter* m_rootFilter; RenderSVGResource* m_fillPaintingResource; RenderSVGResource* m_strokePaintingResource; @@ -431,7 +429,7 @@ void SVGRootInlineBox::paint(RenderObject::PaintInfo& paintInfo, int tx, int ty) // Initialize text rendering if (SVGRenderBase::prepareToRenderSVGContent(renderer(), paintInfo, boundingBox, filter)) { // Render text, chunk-by-chunk - SVGRootInlineBoxPaintWalker walkerCallback(this, filter, paintInfo, tx, ty); + SVGRootInlineBoxPaintWalker walkerCallback(this, paintInfo, tx, ty); SVGTextChunkWalker<SVGRootInlineBoxPaintWalker> walker(&walkerCallback, &SVGRootInlineBoxPaintWalker::chunkPortionCallback, &SVGRootInlineBoxPaintWalker::chunkStartCallback, diff --git a/WebCore/rendering/ShadowElement.cpp b/WebCore/rendering/ShadowElement.cpp new file mode 100644 index 0000000..dea9233 --- /dev/null +++ b/WebCore/rendering/ShadowElement.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * 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 "ShadowElement.h" + +#include "HTMLNames.h" + +namespace WebCore { + +PassRefPtr<ShadowBlockElement> ShadowBlockElement::create(Node* shadowParent) +{ + return new ShadowBlockElement(shadowParent); +} + +ShadowBlockElement::ShadowBlockElement(Node* shadowParent) + : ShadowElement<HTMLDivElement>(HTMLNames::divTag, shadowParent) +{ +} + +PassRefPtr<ShadowInputElement> ShadowInputElement::create(Node* shadowParent) +{ + return new ShadowInputElement(shadowParent); +} + +ShadowInputElement::ShadowInputElement(Node* shadowParent) + : ShadowElement<HTMLInputElement>(HTMLNames::inputTag, shadowParent) +{ +} + +} // namespace WebCore diff --git a/WebCore/rendering/ShadowElement.h b/WebCore/rendering/ShadowElement.h new file mode 100644 index 0000000..90030ee --- /dev/null +++ b/WebCore/rendering/ShadowElement.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 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 + * 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 ShadowElement_h +#define ShadowElement_h + +#include "HTMLDivElement.h" +#include "HTMLInputElement.h" + +namespace WebCore { + +template<class BaseElement> +class ShadowElement : public BaseElement { +protected: + ShadowElement(const QualifiedName& name, Node* shadowParent) + : BaseElement(name, shadowParent->document()) + , m_shadowParent(shadowParent) + {} + + virtual bool isShadowNode() const { return true; } + virtual Node* shadowParentNode() { return m_shadowParent; } + +private: + Node* m_shadowParent; +}; + +class ShadowBlockElement : public ShadowElement<HTMLDivElement> { +public: + static PassRefPtr<ShadowBlockElement> create(Node*); +protected: + ShadowBlockElement(Node*); +}; + +class ShadowInputElement : public ShadowElement<HTMLInputElement> { +public: + static PassRefPtr<ShadowInputElement> create(Node*); +protected: + ShadowInputElement(Node*); +}; + +} // namespace WebCore + +#endif // ShadowElement_h diff --git a/WebCore/rendering/style/RenderStyle.cpp b/WebCore/rendering/style/RenderStyle.cpp index 220e657..af4e055 100644 --- a/WebCore/rendering/style/RenderStyle.cpp +++ b/WebCore/rendering/style/RenderStyle.cpp @@ -916,11 +916,12 @@ const Animation* RenderStyle::transitionForProperty(int property) const void RenderStyle::setBlendedFontSize(int size) { + FontSelector* currentFontSelector = font().fontSelector(); FontDescription desc(fontDescription()); desc.setSpecifiedSize(size); desc.setComputedSize(size); setFontDescription(desc); - font().update(font().fontSelector()); + font().update(currentFontSelector); } void RenderStyle::getBoxShadowExtent(int &top, int &right, int &bottom, int &left) const diff --git a/WebCore/rendering/style/SVGRenderStyle.cpp b/WebCore/rendering/style/SVGRenderStyle.cpp index 042b8f7..f4e6cb5 100644 --- a/WebCore/rendering/style/SVGRenderStyle.cpp +++ b/WebCore/rendering/style/SVGRenderStyle.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> + 2004, 2005, 2010 Rob Buis <buis@kde.org> Copyright (C) Research In Motion Limited 2010. All rights reserved. Based on khtml code by: @@ -146,14 +146,14 @@ float SVGRenderStyle::cssPrimitiveToLength(const RenderObject* item, CSSValue* v return primitive->computeLengthFloat(const_cast<RenderStyle*>(item->style()), item->document()->documentElement()->renderStyle()); } -static void getSVGShadowExtent(ShadowData* shadow, int& top, int& right, int& bottom, int& left) +static void getSVGShadowExtent(ShadowData* shadow, float& top, float& right, float& bottom, float& left) { - top = 0; - right = 0; - bottom = 0; - left = 0; + top = 0.0f; + right = 0.0f; + bottom = 0.0f; + left = 0.0f; - int blurAndSpread = shadow->blur() + shadow->spread(); + float blurAndSpread = shadow->blur() + shadow->spread(); top = min(top, shadow->y() - blurAndSpread); right = max(right, shadow->x() + blurAndSpread); @@ -178,21 +178,14 @@ void SVGRenderStyle::inflateForShadow(FloatRect& repaintRect) const if (!svgShadow) return; - int shadowTop; - int shadowRight; - int shadowBottom; - int shadowLeft; + float shadowTop; + float shadowRight; + float shadowBottom; + float shadowLeft; getSVGShadowExtent(svgShadow, shadowTop, shadowRight, shadowBottom, shadowLeft); - int overflowLeft = repaintRect.x() + shadowLeft; - int overflowRight = repaintRect.right() + shadowRight; - int overflowTop = repaintRect.y() + shadowTop; - int overflowBottom = repaintRect.bottom() + shadowBottom; - - repaintRect.setX(overflowLeft); - repaintRect.setY(overflowTop); - repaintRect.setWidth(overflowRight - overflowLeft); - repaintRect.setHeight(overflowBottom - overflowTop); + repaintRect.move(shadowLeft, shadowTop); + repaintRect.setSize(repaintRect.size() + FloatSize(shadowRight - shadowLeft, shadowBottom - shadowTop)); } } diff --git a/WebCore/rendering/style/SVGRenderStyle.h b/WebCore/rendering/style/SVGRenderStyle.h index 3d6a7da..b0bef61 100644 --- a/WebCore/rendering/style/SVGRenderStyle.h +++ b/WebCore/rendering/style/SVGRenderStyle.h @@ -58,6 +58,7 @@ public: SVG_RS_DEFINE_ATTRIBUTE(EAlignmentBaseline, AlignmentBaseline, alignmentBaseline, AB_AUTO) SVG_RS_DEFINE_ATTRIBUTE(EDominantBaseline, DominantBaseline, dominantBaseline, DB_AUTO) SVG_RS_DEFINE_ATTRIBUTE(EBaselineShift, BaselineShift, baselineShift, BS_BASELINE) + SVG_RS_DEFINE_ATTRIBUTE(EVectorEffect, VectorEffect, vectorEffect, VE_NONE) SVG_RS_DEFINE_ATTRIBUTE_INHERITED(LineCap, CapStyle, capStyle, ButtCap) SVG_RS_DEFINE_ATTRIBUTE_INHERITED(WindRule, ClipRule, clipRule, RULE_NONZERO) @@ -108,6 +109,9 @@ public: SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, inheritedResources, markerEnd, MarkerEndResource, markerEndResource, String()) // convenience + bool hasClipper() const { return !clipperResource().isEmpty(); } + bool hasMasker() const { return !maskerResource().isEmpty(); } + bool hasFilter() const { return !filterResource().isEmpty(); } bool hasMarkers() const { return !markerStartResource().isEmpty() || !markerMidResource().isEmpty() || !markerEndResource().isEmpty(); } bool hasStroke() const { return strokePaint()->paintType() != SVGPaint::SVG_PAINTTYPE_NONE; } bool hasFill() const { return fillPaint()->paintType() != SVGPaint::SVG_PAINTTYPE_NONE; } @@ -165,7 +169,8 @@ protected: unsigned _alignmentBaseline : 4; // EAlignmentBaseline unsigned _dominantBaseline : 4; // EDominantBaseline unsigned _baselineShift : 2; // EBaselineShift - // 22 bits unused + unsigned _vectorEffect: 1; // EVectorEffect + // 21 bits unused } f; uint32_t _niflags; }; @@ -210,6 +215,7 @@ private: svg_noninherited_flags.f._alignmentBaseline = initialAlignmentBaseline(); svg_noninherited_flags.f._dominantBaseline = initialDominantBaseline(); svg_noninherited_flags.f._baselineShift = initialBaselineShift(); + svg_noninherited_flags.f._vectorEffect = initialVectorEffect(); } }; diff --git a/WebCore/rendering/style/SVGRenderStyleDefs.h b/WebCore/rendering/style/SVGRenderStyleDefs.h index e0354e6..207cefa 100644 --- a/WebCore/rendering/style/SVGRenderStyleDefs.h +++ b/WebCore/rendering/style/SVGRenderStyleDefs.h @@ -121,6 +121,11 @@ namespace WebCore { DB_IDEOGRAPHIC, DB_ALPHABETIC, DB_HANGING, DB_MATHEMATICAL, DB_CENTRAL, DB_MIDDLE, DB_TEXT_AFTER_EDGE, DB_TEXT_BEFORE_EDGE }; + + enum EVectorEffect { + VE_NONE, + VE_NON_SCALING_STROKE + }; class CSSValue; class CSSValueList; diff --git a/WebCore/storage/ChangeVersionWrapper.cpp b/WebCore/storage/ChangeVersionWrapper.cpp index 17a9407..66ca63f 100644 --- a/WebCore/storage/ChangeVersionWrapper.cpp +++ b/WebCore/storage/ChangeVersionWrapper.cpp @@ -30,6 +30,9 @@ #if ENABLE(DATABASE) #include "Database.h" +#include "SQLError.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> namespace WebCore { diff --git a/WebCore/storage/ChangeVersionWrapper.h b/WebCore/storage/ChangeVersionWrapper.h index b14fe55..86cc182 100644 --- a/WebCore/storage/ChangeVersionWrapper.h +++ b/WebCore/storage/ChangeVersionWrapper.h @@ -32,9 +32,12 @@ #include "PlatformString.h" #include "SQLTransaction.h" +#include <wtf/Forward.h> namespace WebCore { +class SQLError; + class ChangeVersionWrapper : public SQLTransactionWrapper { public: static PassRefPtr<ChangeVersionWrapper> create(const String& oldVersion, const String& newVersion) { return adoptRef(new ChangeVersionWrapper(oldVersion, newVersion)); } diff --git a/WebCore/storage/Database.cpp b/WebCore/storage/Database.cpp index 0644df5..c96dfba 100644 --- a/WebCore/storage/Database.cpp +++ b/WebCore/storage/Database.cpp @@ -29,8 +29,6 @@ #include "config.h" #include "Database.h" -#include <wtf/StdLibExtras.h> - #if ENABLE(DATABASE) #include "ChangeVersionWrapper.h" #include "DatabaseAuthorizer.h" @@ -40,21 +38,25 @@ #include "DatabaseTracker.h" #include "Document.h" #include "ExceptionCode.h" -#include "Frame.h" #include "InspectorController.h" #include "Logging.h" #include "NotImplemented.h" #include "Page.h" -#include "OriginQuotaManager.h" -#include "ScriptController.h" -#include "SQLiteDatabase.h" -#include "SQLiteFileSystem.h" -#include "SQLiteStatement.h" -#include "SQLResultSet.h" +#include "SQLTransactionCallback.h" #include "SQLTransactionClient.h" #include "SQLTransactionCoordinator.h" - -#endif // ENABLE(DATABASE) +#include "SQLTransactionErrorCallback.h" +#include "SQLiteStatement.h" +#include "ScriptController.h" +#include "ScriptExecutionContext.h" +#include "SecurityOrigin.h" +#include "StringHash.h" +#include "VoidCallback.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> +#include <wtf/StdLibExtras.h> #if USE(JSC) #include "JSDOMWindow.h" @@ -71,8 +73,6 @@ const String& Database::databaseInfoTableName() return name; } -#if ENABLE(DATABASE) - static bool isDatabaseAvailable = true; void Database::setIsAvailable(bool available) @@ -213,8 +213,8 @@ Database::Database(ScriptExecutionContext* context, const String& name, const St , m_creationCallback(creationCallback) { ASSERT(m_scriptExecutionContext.get()); - m_mainThreadSecurityOrigin = m_scriptExecutionContext->securityOrigin(); - m_databaseThreadSecurityOrigin = m_mainThreadSecurityOrigin->threadsafeCopy(); + m_contextThreadSecurityOrigin = m_scriptExecutionContext->securityOrigin(); + m_databaseThreadSecurityOrigin = m_contextThreadSecurityOrigin->threadsafeCopy(); if (m_name.isNull()) m_name = ""; @@ -491,6 +491,30 @@ void Database::setAuthorizerReadOnly() m_databaseAuthorizer->setReadOnly(); } +bool Database::lastActionChangedDatabase() +{ + ASSERT(m_databaseAuthorizer); + return m_databaseAuthorizer->lastActionChangedDatabase(); +} + +bool Database::lastActionWasInsert() +{ + ASSERT(m_databaseAuthorizer); + return m_databaseAuthorizer->lastActionWasInsert(); +} + +void Database::resetDeletes() +{ + ASSERT(m_databaseAuthorizer); + m_databaseAuthorizer->resetDeletes(); +} + +bool Database::hadDeletes() +{ + ASSERT(m_databaseAuthorizer); + return m_databaseAuthorizer->hadDeletes(); +} + static int guidForOriginAndName(const String& origin, const String& name) { String stringID; @@ -643,14 +667,20 @@ void Database::transaction(PassRefPtr<SQLTransactionCallback> callback, PassRefP scheduleTransaction(); } +void Database::inProgressTransactionCompleted() +{ + MutexLocker locker(m_transactionInProgressMutex); + m_transactionInProgress = false; + scheduleTransaction(); +} + void Database::scheduleTransaction() { ASSERT(!m_transactionInProgressMutex.tryLock()); // Locked by caller. RefPtr<SQLTransaction> transaction; if (m_isTransactionQueueEnabled && !m_transactionQueue.isEmpty()) { - transaction = m_transactionQueue.first(); - m_transactionQueue.removeFirst(); + transaction = m_transactionQueue.takeFirst(); } if (transaction && m_scriptExecutionContext->databaseThread()) { @@ -780,8 +810,8 @@ void Database::setExpectedVersion(const String& version) SecurityOrigin* Database::securityOrigin() const { - if (scriptExecutionContext()->isContextThread()) - return m_mainThreadSecurityOrigin.get(); + if (m_scriptExecutionContext->isContextThread()) + return m_contextThreadSecurityOrigin.get(); if (currentThread() == m_scriptExecutionContext->databaseThread()->getThreadID()) return m_databaseThreadSecurityOrigin.get(); return 0; @@ -818,6 +848,6 @@ void Database::incrementalVacuumIfNeeded() m_sqliteDatabase.runIncrementalVacuumCommand(); } -#endif // ENABLE(DATABASE) - } // namespace WebCore + +#endif // ENABLE(DATABASE) diff --git a/WebCore/storage/Database.h b/WebCore/storage/Database.h index 890d98c..f9fd3cd 100644 --- a/WebCore/storage/Database.h +++ b/WebCore/storage/Database.h @@ -31,42 +31,31 @@ #if ENABLE(DATABASE) #include "PlatformString.h" -#include "SecurityOrigin.h" #include "SQLiteDatabase.h" -#include "SQLTransaction.h" -#include "StringHash.h" -#include "Timer.h" -#include "VoidCallback.h" +#ifndef NDEBUG +#include "SecurityOrigin.h" +#endif -#include <wtf/Forward.h> -#include <wtf/HashSet.h> -#include <wtf/PassRefPtr.h> -#include <wtf/RefPtr.h> #include <wtf/Deque.h> -#else -#include "PlatformString.h" -#endif +#include <wtf/Forward.h> -#if ENABLE(DATABASE) namespace WebCore { class DatabaseAuthorizer; class DatabaseCallback; class DatabaseThread; class ScriptExecutionContext; -class SQLResultSet; +class SecurityOrigin; +class SQLTransaction; class SQLTransactionCallback; class SQLTransactionClient; class SQLTransactionCoordinator; class SQLTransactionErrorCallback; -class SQLValue; +class VoidCallback; typedef int ExceptionCode; class Database : public ThreadSafeShared<Database> { - friend class DatabaseTransactionTask; - friend class SQLStatement; - friend class SQLTransaction; public: static void setIsAvailable(bool); static bool isAvailable(); @@ -74,15 +63,12 @@ public: ~Database(); // Direct support for the DOM API - static PassRefPtr<Database> openDatabase(ScriptExecutionContext* context, const String& name, - const String& expectedVersion, const String& displayName, - unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback, - ExceptionCode&); + static PassRefPtr<Database> openDatabase(ScriptExecutionContext*, const String& name, const String& expectedVersion, const String& displayName, + unsigned long estimatedSize, PassRefPtr<DatabaseCallback>, ExceptionCode&); String version() const; - void changeVersion(const String& oldVersion, const String& newVersion, - PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback, - PassRefPtr<VoidCallback> successCallback); - void transaction(PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback, + void changeVersion(const String& oldVersion, const String& newVersion, PassRefPtr<SQLTransactionCallback>, + PassRefPtr<SQLTransactionErrorCallback>, PassRefPtr<VoidCallback> successCallback); + void transaction(PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>, PassRefPtr<VoidCallback> successCallback, bool readOnly); // Internal engine support @@ -91,11 +77,16 @@ public: void disableAuthorizer(); void enableAuthorizer(); void setAuthorizerReadOnly(); + bool lastActionChangedDatabase(); + bool lastActionWasInsert(); + void resetDeletes(); + bool hadDeletes(); Vector<String> tableNames(); ScriptExecutionContext* scriptExecutionContext() const { return m_scriptExecutionContext.get(); } SecurityOrigin* securityOrigin() const; + SQLiteDatabase& sqliteDatabase() { return m_sqliteDatabase; } String stringIdentifier() const; String displayName() const; unsigned long estimatedSize() const; @@ -127,6 +118,10 @@ public: bool performOpenAndVerify(ExceptionCode&); + void inProgressTransactionCompleted(); + void scheduleTransactionCallback(SQLTransaction*); + void scheduleTransactionStep(SQLTransaction*, bool immediately = false); + Vector<String> performGetTableNames(); void performCreationCallback(); @@ -136,15 +131,12 @@ public: void incrementalVacuumIfNeeded(); private: - Database(ScriptExecutionContext* context, const String& name, - const String& expectedVersion, const String& displayName, - unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback); + Database(ScriptExecutionContext*, const String& name, const String& expectedVersion, + const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback>); bool openAndVerifyVersion(ExceptionCode&); void scheduleTransaction(); - void scheduleTransactionCallback(SQLTransaction*); - void scheduleTransactionStep(SQLTransaction* transaction, bool immediately = false); Deque<RefPtr<SQLTransaction> > m_transactionQueue; Mutex m_transactionInProgressMutex; @@ -154,7 +146,7 @@ private: static void deliverPendingCallback(void*); RefPtr<ScriptExecutionContext> m_scriptExecutionContext; - RefPtr<SecurityOrigin> m_mainThreadSecurityOrigin; + RefPtr<SecurityOrigin> m_contextThreadSecurityOrigin; RefPtr<SecurityOrigin> m_databaseThreadSecurityOrigin; String m_name; int m_guid; @@ -177,21 +169,12 @@ private: RefPtr<DatabaseCallback> m_creationCallback; #ifndef NDEBUG - String databaseDebugName() const { return m_mainThreadSecurityOrigin->toString() + "::" + m_name; } + String databaseDebugName() const { return m_contextThreadSecurityOrigin->toString() + "::" + m_name; } #endif }; } // namespace WebCore -#else - -namespace WebCore { -class Database : public ThreadSafeShared<Database> { -public: - static const String& databaseInfoTableName(); -}; -} // namespace WebCore - #endif // ENABLE(DATABASE) #endif // Database_h diff --git a/WebCore/storage/DatabaseAuthorizer.cpp b/WebCore/storage/DatabaseAuthorizer.cpp index 05d9a66..1ea99d9 100644 --- a/WebCore/storage/DatabaseAuthorizer.cpp +++ b/WebCore/storage/DatabaseAuthorizer.cpp @@ -29,6 +29,7 @@ #include "config.h" #include "DatabaseAuthorizer.h" +#if ENABLE(DATABASE) #include "Database.h" #include "PlatformString.h" @@ -48,6 +49,11 @@ void DatabaseAuthorizer::reset() m_readOnly = false; } +void DatabaseAuthorizer::resetDeletes() +{ + m_hadDeletes = false; +} + void DatabaseAuthorizer::addWhitelistedFunctions() { // SQLite functions used to help implement some operations @@ -137,7 +143,7 @@ int DatabaseAuthorizer::dropTable(const String& tableName) if (m_readOnly && m_securityEnabled) return SQLAuthDeny; - return denyBasedOnTableName(tableName); + return updateDeletesBasedOnTableName(tableName); } int DatabaseAuthorizer::dropTempTable(const String& tableName) @@ -148,7 +154,7 @@ int DatabaseAuthorizer::dropTempTable(const String& tableName) if (m_readOnly && m_securityEnabled) return SQLAuthDeny; - return denyBasedOnTableName(tableName); + return updateDeletesBasedOnTableName(tableName); } int DatabaseAuthorizer::allowAlterTable(const String&, const String& tableName) @@ -185,7 +191,7 @@ int DatabaseAuthorizer::dropIndex(const String&, const String& tableName) if (m_readOnly && m_securityEnabled) return SQLAuthDeny; - return denyBasedOnTableName(tableName); + return updateDeletesBasedOnTableName(tableName); } int DatabaseAuthorizer::dropTempIndex(const String&, const String& tableName) @@ -196,7 +202,7 @@ int DatabaseAuthorizer::dropTempIndex(const String&, const String& tableName) if (m_readOnly && m_securityEnabled) return SQLAuthDeny; - return denyBasedOnTableName(tableName); + return updateDeletesBasedOnTableName(tableName); } int DatabaseAuthorizer::createTrigger(const String&, const String& tableName) @@ -224,7 +230,7 @@ int DatabaseAuthorizer::dropTrigger(const String&, const String& tableName) if (m_readOnly && m_securityEnabled) return SQLAuthDeny; - return denyBasedOnTableName(tableName); + return updateDeletesBasedOnTableName(tableName); } int DatabaseAuthorizer::dropTempTrigger(const String&, const String& tableName) @@ -235,7 +241,7 @@ int DatabaseAuthorizer::dropTempTrigger(const String&, const String& tableName) if (m_readOnly && m_securityEnabled) return SQLAuthDeny; - return denyBasedOnTableName(tableName); + return updateDeletesBasedOnTableName(tableName); } int DatabaseAuthorizer::createView(const String&) @@ -253,7 +259,11 @@ int DatabaseAuthorizer::createTempView(const String&) int DatabaseAuthorizer::dropView(const String&) { - return (m_readOnly && m_securityEnabled ? SQLAuthDeny : SQLAuthAllow); + if (m_readOnly && m_securityEnabled) + return SQLAuthDeny; + + m_hadDeletes = true; + return SQLAuthAllow; } int DatabaseAuthorizer::dropTempView(const String&) @@ -261,7 +271,11 @@ int DatabaseAuthorizer::dropTempView(const String&) // SQLITE_DROP_TEMP_VIEW results in a DELETE operation, which is not // allowed in read-only transactions or private browsing, so we might as // well disallow SQLITE_DROP_TEMP_VIEW in these cases - return (m_readOnly && m_securityEnabled ? SQLAuthDeny : SQLAuthAllow); + if (m_readOnly && m_securityEnabled) + return SQLAuthDeny; + + m_hadDeletes = true; + return SQLAuthAllow; } int DatabaseAuthorizer::createVTable(const String& tableName, const String& moduleName) @@ -286,7 +300,7 @@ int DatabaseAuthorizer::dropVTable(const String& tableName, const String& module if (moduleName != "fts3") return SQLAuthDeny; - return denyBasedOnTableName(tableName); + return updateDeletesBasedOnTableName(tableName); } int DatabaseAuthorizer::allowDelete(const String& tableName) @@ -294,7 +308,7 @@ int DatabaseAuthorizer::allowDelete(const String& tableName) if (m_readOnly && m_securityEnabled) return SQLAuthDeny; - return denyBasedOnTableName(tableName); + return updateDeletesBasedOnTableName(tableName); } int DatabaseAuthorizer::allowInsert(const String& tableName) @@ -391,4 +405,14 @@ int DatabaseAuthorizer::denyBasedOnTableName(const String& tableName) return SQLAuthAllow; } +int DatabaseAuthorizer::updateDeletesBasedOnTableName(const String& tableName) +{ + int allow = denyBasedOnTableName(tableName); + if (allow) + m_hadDeletes = true; + return allow; +} + } // namespace WebCore + +#endif // ENABLE(DATABASE) diff --git a/WebCore/storage/DatabaseAuthorizer.h b/WebCore/storage/DatabaseAuthorizer.h index 037409e..7da0143 100644 --- a/WebCore/storage/DatabaseAuthorizer.h +++ b/WebCore/storage/DatabaseAuthorizer.h @@ -90,19 +90,23 @@ public: void setReadOnly(); void reset(); + void resetDeletes(); bool lastActionWasInsert() const { return m_lastActionWasInsert; } bool lastActionChangedDatabase() const { return m_lastActionChangedDatabase; } + bool hadDeletes() const { return m_hadDeletes; } private: DatabaseAuthorizer(); void addWhitelistedFunctions(); int denyBasedOnTableName(const String&); + int updateDeletesBasedOnTableName(const String&); bool m_securityEnabled : 1; bool m_lastActionWasInsert : 1; bool m_lastActionChangedDatabase : 1; bool m_readOnly : 1; + bool m_hadDeletes : 1; HashSet<String, CaseFoldingHash> m_whitelistedFunctions; }; diff --git a/WebCore/storage/DatabaseTask.cpp b/WebCore/storage/DatabaseTask.cpp index a8038c3..8d5f0a8 100644 --- a/WebCore/storage/DatabaseTask.cpp +++ b/WebCore/storage/DatabaseTask.cpp @@ -143,11 +143,8 @@ DatabaseTransactionTask::~DatabaseTransactionTask() void DatabaseTransactionTask::doPerformTask() { - if (m_transaction->performNextStep()) { - // The transaction is complete, we can move on to the next one. - MutexLocker locker(m_transaction->database()->m_transactionInProgressMutex); - m_transaction->database()->scheduleTransaction(); - } + if (m_transaction->performNextStep()) + m_transaction->database()->inProgressTransactionCompleted(); } #ifndef NDEBUG diff --git a/WebCore/storage/DatabaseTask.h b/WebCore/storage/DatabaseTask.h index b473f8f..1a820a5 100644 --- a/WebCore/storage/DatabaseTask.h +++ b/WebCore/storage/DatabaseTask.h @@ -32,6 +32,7 @@ #include "Database.h" #include "ExceptionCode.h" #include "PlatformString.h" +#include "SQLTransaction.h" #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> #include <wtf/PassRefPtr.h> @@ -40,13 +41,6 @@ namespace WebCore { -class DatabaseTask; -class DatabaseThread; -class SQLValue; -class SQLCallback; -class SQLTransaction; -class VersionChangeCallback; - // Can be used to wait until DatabaseTask is completed. // Has to be passed into DatabaseTask::create to be associated with the task. class DatabaseTaskSynchronizer : public Noncopyable { diff --git a/WebCore/storage/IDBCallbacks.h b/WebCore/storage/IDBCallbacks.h index ff6272a..c90acc5 100644 --- a/WebCore/storage/IDBCallbacks.h +++ b/WebCore/storage/IDBCallbacks.h @@ -32,6 +32,7 @@ #include "IDBDatabase.h" #include "IDBDatabaseError.h" #include "IDBIndex.h" +#include "IDBObjectStore.h" #include "SerializedScriptValue.h" #include <wtf/RefCounted.h> @@ -47,6 +48,7 @@ public: virtual void onSuccess() = 0; // For "null". virtual void onSuccess(PassRefPtr<IDBDatabase>) = 0; virtual void onSuccess(PassRefPtr<IDBIndex>) = 0; + virtual void onSuccess(PassRefPtr<IDBObjectStore>) = 0; virtual void onSuccess(PassRefPtr<SerializedScriptValue>) = 0; }; diff --git a/WebCore/storage/IDBDatabase.h b/WebCore/storage/IDBDatabase.h index 5bfb3c7..0055ad1 100644 --- a/WebCore/storage/IDBDatabase.h +++ b/WebCore/storage/IDBDatabase.h @@ -35,6 +35,9 @@ namespace WebCore { class DOMStringList; +class Frame; +class IDBCallbacks; +class IDBObjectStore; // This class is shared by IDBDatabaseRequest (async) and IDBDatabaseSync (sync). // This is implemented by IDBDatabaseImpl and optionally others (in order to proxy @@ -44,10 +47,16 @@ class IDBDatabase : public ThreadSafeShared<IDBDatabase> { public: virtual ~IDBDatabase() { } - virtual String name() = 0; - virtual String description() = 0; - virtual String version() = 0; - virtual PassRefPtr<DOMStringList> objectStores() = 0; + virtual String name() const = 0; + virtual String description() const = 0; + virtual String version() const = 0; + virtual PassRefPtr<DOMStringList> objectStores() const = 0; + + // FIXME: Add transaction and setVersion. + + virtual void createObjectStore(const String& name, const String& keyPath, bool autoIncrement, PassRefPtr<IDBCallbacks>) = 0; + virtual PassRefPtr<IDBObjectStore> objectStore(const String& name, unsigned short mode) = 0; + virtual void removeObjectStore(const String& name, PassRefPtr<IDBCallbacks>) = 0; }; } // namespace WebCore diff --git a/WebCore/storage/IDBDatabaseImpl.cpp b/WebCore/storage/IDBDatabaseImpl.cpp index 655bd59..712830a 100644 --- a/WebCore/storage/IDBDatabaseImpl.cpp +++ b/WebCore/storage/IDBDatabaseImpl.cpp @@ -27,6 +27,8 @@ #include "IDBDatabaseImpl.h" #include "DOMStringList.h" +#include "IDBDatabaseException.h" +#include "IDBObjectStoreImpl.h" #if ENABLE(INDEXED_DATABASE) @@ -43,10 +45,42 @@ IDBDatabaseImpl::~IDBDatabaseImpl() { } -PassRefPtr<DOMStringList> IDBDatabaseImpl::objectStores() +PassRefPtr<DOMStringList> IDBDatabaseImpl::objectStores() const { - // FIXME: This should return the actual list. - return DOMStringList::create(); + RefPtr<DOMStringList> objectStoreNames = DOMStringList::create(); + for (ObjectStoreMap::const_iterator it = m_objectStores.begin(); it != m_objectStores.end(); ++it) + objectStoreNames->append(it->first); + return objectStoreNames.release(); +} + +void IDBDatabaseImpl::createObjectStore(const String& name, const String& keyPath, bool autoIncrement, PassRefPtr<IDBCallbacks> callbacks) +{ + if (m_objectStores.contains(name)) { + callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::CONSTRAINT_ERR, "An objectStore with that name already exists.")); + return; + } + + RefPtr<IDBObjectStore> objectStore = IDBObjectStoreImpl::create(name, keyPath, autoIncrement); + m_objectStores.set(name, objectStore); + callbacks->onSuccess(objectStore.release()); +} + +PassRefPtr<IDBObjectStore> IDBDatabaseImpl::objectStore(const String& name, unsigned short mode) +{ + // FIXME: If no transaction is running, this should implicitly start one. + ASSERT(!mode); // FIXME: Handle non-standard modes. + return m_objectStores.get(name); +} + +void IDBDatabaseImpl::removeObjectStore(const String& name, PassRefPtr<IDBCallbacks> callbacks) +{ + if (!m_objectStores.contains(name)) { + callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_FOUND_ERR, "No objectStore with that name exists.")); + return; + } + + m_objectStores.remove(name); + callbacks->onSuccess(); } } // namespace WebCore diff --git a/WebCore/storage/IDBDatabaseImpl.h b/WebCore/storage/IDBDatabaseImpl.h index 679017d..7203c5a 100644 --- a/WebCore/storage/IDBDatabaseImpl.h +++ b/WebCore/storage/IDBDatabaseImpl.h @@ -26,7 +26,10 @@ #ifndef IDBDatabaseImpl_h #define IDBDatabaseImpl_h +#include "IDBCallbacks.h" #include "IDBDatabase.h" +#include "StringHash.h" +#include <wtf/HashMap.h> #if ENABLE(INDEXED_DATABASE) @@ -41,10 +44,14 @@ public: virtual ~IDBDatabaseImpl(); // Implements IDBDatabase - virtual String name() { return m_name; } - virtual String description() { return m_description; } - virtual String version() { return m_version; } - virtual PassRefPtr<DOMStringList> objectStores(); + virtual String name() const { return m_name; } + virtual String description() const { return m_description; } + virtual String version() const { return m_version; } + virtual PassRefPtr<DOMStringList> objectStores() const; + + virtual void createObjectStore(const String& name, const String& keyPath, bool autoIncrement, PassRefPtr<IDBCallbacks>); + virtual PassRefPtr<IDBObjectStore> objectStore(const String& name, unsigned short mode); + virtual void removeObjectStore(const String& name, PassRefPtr<IDBCallbacks>); private: IDBDatabaseImpl(const String& name, const String& description, const String& version); @@ -52,6 +59,9 @@ private: String m_name; String m_description; String m_version; + + typedef HashMap<String, RefPtr<IDBObjectStore> > ObjectStoreMap; + ObjectStoreMap m_objectStores; }; } // namespace WebCore diff --git a/WebCore/storage/IDBDatabaseRequest.cpp b/WebCore/storage/IDBDatabaseRequest.cpp index 311fb25..c620279 100644 --- a/WebCore/storage/IDBDatabaseRequest.cpp +++ b/WebCore/storage/IDBDatabaseRequest.cpp @@ -26,21 +26,48 @@ #include "config.h" #include "IDBDatabaseRequest.h" +#include "IDBAny.h" +#include "IDBObjectStoreRequest.h" +#include "IDBRequest.h" #include "IndexedDatabase.h" +#include "ScriptExecutionContext.h" #if ENABLE(INDEXED_DATABASE) namespace WebCore { -IDBDatabaseRequest::IDBDatabaseRequest(PassRefPtr<IDBDatabase> idbDatabase) - : m_idbDatabase(idbDatabase) +IDBDatabaseRequest::IDBDatabaseRequest(PassRefPtr<IDBDatabase> database) + : m_database(database) { + m_this = IDBAny::create(); + m_this->set(this); } IDBDatabaseRequest::~IDBDatabaseRequest() { } +PassRefPtr<IDBRequest> IDBDatabaseRequest::createObjectStore(ScriptExecutionContext* context, const String& name, const String& keyPath, bool autoIncrement) +{ + RefPtr<IDBRequest> request = IDBRequest::create(context, m_this); + m_database->createObjectStore(name, keyPath, autoIncrement, request); + return request; +} + +PassRefPtr<IDBObjectStoreRequest> IDBDatabaseRequest::objectStore(const String& name, unsigned short mode) +{ + RefPtr<IDBObjectStore> objectStore = m_database->objectStore(name, mode); + ASSERT(objectStore); // FIXME: If this is null, we should raise a NOT_FOUND_ERR. + return IDBObjectStoreRequest::create(objectStore.release()); +} + +PassRefPtr<IDBRequest> IDBDatabaseRequest::removeObjectStore(ScriptExecutionContext* context, const String& name) +{ + RefPtr<IDBRequest> request = IDBRequest::create(context, m_this); + m_database->removeObjectStore(name, request); + return request; +} + } // namespace WebCore #endif // ENABLE(INDEXED_DATABASE) diff --git a/WebCore/storage/IDBDatabaseRequest.h b/WebCore/storage/IDBDatabaseRequest.h index 26f6a86..6b9e107 100644 --- a/WebCore/storage/IDBDatabaseRequest.h +++ b/WebCore/storage/IDBDatabaseRequest.h @@ -36,24 +36,34 @@ namespace WebCore { +class IDBAny; +class IDBObjectStoreRequest; +class IDBRequest; +class ScriptExecutionContext; + class IDBDatabaseRequest : public RefCounted<IDBDatabaseRequest> { public: - static PassRefPtr<IDBDatabaseRequest> create(PassRefPtr<IDBDatabase> idbDatabase) + static PassRefPtr<IDBDatabaseRequest> create(PassRefPtr<IDBDatabase> database) { - return adoptRef(new IDBDatabaseRequest(idbDatabase)); + return adoptRef(new IDBDatabaseRequest(database)); } ~IDBDatabaseRequest(); // Implement the IDL - String name() const { return m_idbDatabase->name(); } - String description() const { return m_idbDatabase->description(); } - String version() const { return m_idbDatabase->version(); } - PassRefPtr<DOMStringList> objectStores() const { return m_idbDatabase->objectStores(); } + String name() const { return m_database->name(); } + String description() const { return m_database->description(); } + String version() const { return m_database->version(); } + PassRefPtr<DOMStringList> objectStores() const { return m_database->objectStores(); } + + PassRefPtr<IDBRequest> createObjectStore(ScriptExecutionContext*, const String& name, const String& keyPath = "", bool autoIncrement = false); + PassRefPtr<IDBObjectStoreRequest> objectStore(const String& name, unsigned short mode = 0); // FIXME: Use constant rather than 0. + PassRefPtr<IDBRequest> removeObjectStore(ScriptExecutionContext*, const String& name); private: IDBDatabaseRequest(PassRefPtr<IDBDatabase>); - RefPtr<IDBDatabase> m_idbDatabase; + RefPtr<IDBDatabase> m_database; + RefPtr<IDBAny> m_this; }; } // namespace WebCore diff --git a/WebCore/storage/IDBDatabaseRequest.idl b/WebCore/storage/IDBDatabaseRequest.idl index b835ace..c018bbf 100644 --- a/WebCore/storage/IDBDatabaseRequest.idl +++ b/WebCore/storage/IDBDatabaseRequest.idl @@ -28,12 +28,18 @@ module storage { interface [ Conditional=INDEXED_DATABASE ] IDBDatabaseRequest { - // FIXME: Complete this file. - readonly attribute DOMString name; - // readonly attribute DOMString description; + readonly attribute DOMString description; readonly attribute DOMString version; readonly attribute DOMStringList objectStores; + + // FIXME: Add transaction. + // FIXME: Add setVersion. + + [CallWith=ScriptExecutionContext] IDBRequest createObjectStore(in DOMString name, in [Optional] DOMString path, in [Optional] boolean autoIncrement); + // FIXME: objectStore needs to be able to raise an IDBDatabaseException. + IDBObjectStoreRequest objectStore(in DOMString name, in [Optional] unsigned short mode); + [CallWith=ScriptExecutionContext] IDBRequest removeObjectStore(in DOMString name); }; } diff --git a/WebCore/storage/IDBKeyRange.cpp b/WebCore/storage/IDBKeyRange.cpp new file mode 100644 index 0000000..34c11fe --- /dev/null +++ b/WebCore/storage/IDBKeyRange.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "IDBKeyRange.h" + +#include "IDBAny.h" +#include "SerializedScriptValue.h" + +#if ENABLE(INDEXED_DATABASE) + +namespace WebCore { + +IDBKeyRange::IDBKeyRange(PassRefPtr<SerializedScriptValue> left, PassRefPtr<SerializedScriptValue> right, unsigned short flags) + : m_left(IDBAny::create()) + , m_right(IDBAny::create()) + , m_flags(flags) +{ + m_left->set(left); + m_right->set(right); +} + +} // namespace WebCore + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebCore/storage/IDBKeyRange.h b/WebCore/storage/IDBKeyRange.h new file mode 100644 index 0000000..58c1399 --- /dev/null +++ b/WebCore/storage/IDBKeyRange.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef IDBKeyRange_h +#define IDBKeyRange_h + +#if ENABLE(INDEXED_DATABASE) + +#include "IDBAny.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class SerializedScriptValue; + +class IDBKeyRange : public RefCounted<IDBKeyRange> { +public: + // Keep in sync with what's in the .idl file. + enum Flags { + SINGLE = 0, + LEFT_OPEN = 1, + RIGHT_OPEN = 2, + LEFT_BOUND = 4, + RIGHT_BOUND = 8, + }; + + static PassRefPtr<IDBKeyRange> create(PassRefPtr<SerializedScriptValue> left, PassRefPtr<SerializedScriptValue> right, unsigned short flags) + { + return adoptRef(new IDBKeyRange(left, right, flags)); + } + ~IDBKeyRange() { } + + + PassRefPtr<IDBAny> left() const { return m_left; } + PassRefPtr<IDBAny> right() const { return m_right; } + unsigned short flags() const { return m_flags; } + +private: + IDBKeyRange(PassRefPtr<SerializedScriptValue> left, PassRefPtr<SerializedScriptValue> right, unsigned short flags); + + RefPtr<IDBAny> m_left; + RefPtr<IDBAny> m_right; + unsigned short m_flags; +}; + +} // namespace WebCore + +#endif + +#endif // IDBKeyRange_h diff --git a/WebCore/storage/IDBKeyRange.idl b/WebCore/storage/IDBKeyRange.idl new file mode 100644 index 0000000..05f6505 --- /dev/null +++ b/WebCore/storage/IDBKeyRange.idl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module storage { + + interface [ + Conditional=INDEXED_DATABASE + ] IDBKeyRange { + // Keep in sync with what's in the .h file. + const unsigned short SINGLE = 0; + const unsigned short LEFT_OPEN = 1; + const unsigned short RIGHT_OPEN = 2; + const unsigned short LEFT_BOUND = 4; + const unsigned short RIGHT_BOUND = 8; + + readonly attribute IDBAny left; + readonly attribute IDBAny right; + readonly attribute unsigned short flags; + }; + +} diff --git a/WebCore/storage/IDBObjectStore.cpp b/WebCore/storage/IDBObjectStore.cpp deleted file mode 100644 index 4aef460..0000000 --- a/WebCore/storage/IDBObjectStore.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "IDBObjectStore.h" - -#include "DOMStringList.h" -#include "IDBCallbacks.h" -#include "IDBDatabaseException.h" -#include "IDBIndexImpl.h" - -#if ENABLE(INDEXED_DATABASE) - -namespace WebCore { - -IDBObjectStore::IDBObjectStore() -{ -} - -IDBObjectStore::~IDBObjectStore() -{ -} - -PassRefPtr<DOMStringList> IDBObjectStore::indexNames() const -{ - RefPtr<DOMStringList> indexNames = DOMStringList::create(); - for (IndexMap::const_iterator it = m_indexes.begin(); it != m_indexes.end(); ++it) - indexNames->append(it->first); - return indexNames.release(); -} - -void IDBObjectStore::createIndex(const String& name, const String& keyPath, bool unique, PassRefPtr<IDBCallbacks> callbacks) -{ - if (m_indexes.contains(name)) { - callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::CONSTRAINT_ERR, "Index name already exists.")); - return; - } - - RefPtr<IDBIndex> index = IDBIndexImpl::create(name, keyPath, unique); - ASSERT(index->name() == name); - m_indexes.set(name, index); - callbacks->onSuccess(index.release()); -} - -PassRefPtr<IDBIndex> IDBObjectStore::index(const String& name) -{ - return m_indexes.get(name); -} - -void IDBObjectStore::removeIndex(const String& name, PassRefPtr<IDBCallbacks> callbacks) -{ - if (!m_indexes.contains(name)) { - callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_FOUND_ERR, "Index name does not exist.")); - return; - } - - m_indexes.remove(name); - callbacks->onSuccess(); -} - -} // namespace WebCore - -#endif // ENABLE(INDEXED_DATABASE) - diff --git a/WebCore/storage/IDBObjectStore.h b/WebCore/storage/IDBObjectStore.h index c1ce129..837b65a 100644 --- a/WebCore/storage/IDBObjectStore.h +++ b/WebCore/storage/IDBObjectStore.h @@ -27,8 +27,6 @@ #define IDBObjectStore_h #include "PlatformString.h" -#include "StringHash.h" -#include <wtf/HashMap.h> #include <wtf/Threading.h> #if ENABLE(INDEXED_DATABASE) @@ -36,33 +34,20 @@ namespace WebCore { class DOMStringList; -class IDBIndex; class IDBCallbacks; +class IDBIndex; -// FIXME: This needs to be split into an interface and Impl classes. class IDBObjectStore : public ThreadSafeShared<IDBObjectStore> { public: - static PassRefPtr<IDBObjectStore> create() - { - return adoptRef(new IDBObjectStore()); - } - virtual ~IDBObjectStore(); - - String name() const { return m_name; } - String keyPath() const { return m_keyPath; } - PassRefPtr<DOMStringList> indexNames() const; - - void createIndex(const String& name, const String& keyPath, bool unique, PassRefPtr<IDBCallbacks>); - PassRefPtr<IDBIndex> index(const String& name); - void removeIndex(const String& name, PassRefPtr<IDBCallbacks>); + virtual ~IDBObjectStore() { } -private: - IDBObjectStore(); + virtual String name() const = 0; + virtual String keyPath() const = 0; + virtual PassRefPtr<DOMStringList> indexNames() const = 0; - String m_name; - String m_keyPath; - typedef HashMap<String, RefPtr<IDBIndex> > IndexMap; - IndexMap m_indexes; + virtual void createIndex(const String& name, const String& keyPath, bool unique, PassRefPtr<IDBCallbacks>) = 0; + virtual PassRefPtr<IDBIndex> index(const String& name) = 0; + virtual void removeIndex(const String& name, PassRefPtr<IDBCallbacks>) = 0; }; } // namespace WebCore diff --git a/WebCore/storage/IDBObjectStoreImpl.cpp b/WebCore/storage/IDBObjectStoreImpl.cpp new file mode 100755 index 0000000..b84ceb2 --- /dev/null +++ b/WebCore/storage/IDBObjectStoreImpl.cpp @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "IDBObjectStoreImpl.h" + +#include "DOMStringList.h" +#include "IDBCallbacks.h" +#include "IDBDatabaseException.h" +#include "IDBIndexImpl.h" + +#if ENABLE(INDEXED_DATABASE) + +namespace WebCore { + +IDBObjectStoreImpl::~IDBObjectStoreImpl() +{ +} + +IDBObjectStoreImpl::IDBObjectStoreImpl(const String& name, const String& keyPath, bool autoIncrement) + : m_name(name) + , m_keyPath(keyPath) + , m_autoIncrement(autoIncrement) +{ +} + +PassRefPtr<DOMStringList> IDBObjectStoreImpl::indexNames() const +{ + RefPtr<DOMStringList> indexNames = DOMStringList::create(); + for (IndexMap::const_iterator it = m_indexes.begin(); it != m_indexes.end(); ++it) + indexNames->append(it->first); + return indexNames.release(); +} + +void IDBObjectStoreImpl::createIndex(const String& name, const String& keyPath, bool unique, PassRefPtr<IDBCallbacks> callbacks) +{ + if (m_indexes.contains(name)) { + callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::CONSTRAINT_ERR, "Index name already exists.")); + return; + } + + RefPtr<IDBIndex> index = IDBIndexImpl::create(name, keyPath, unique); + ASSERT(index->name() == name); + m_indexes.set(name, index); + callbacks->onSuccess(index.release()); +} + +PassRefPtr<IDBIndex> IDBObjectStoreImpl::index(const String& name) +{ + return m_indexes.get(name); +} + +void IDBObjectStoreImpl::removeIndex(const String& name, PassRefPtr<IDBCallbacks> callbacks) +{ + if (!m_indexes.contains(name)) { + callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_FOUND_ERR, "Index name does not exist.")); + return; + } + + m_indexes.remove(name); + callbacks->onSuccess(); +} + + +} // namespace WebCore + +#endif diff --git a/WebCore/storage/IDBObjectStoreImpl.h b/WebCore/storage/IDBObjectStoreImpl.h new file mode 100755 index 0000000..89a06db --- /dev/null +++ b/WebCore/storage/IDBObjectStoreImpl.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef IDBObjectStoreImpl_h +#define IDBObjectStoreImpl_h + +#include "IDBObjectStore.h" +#include "StringHash.h" +#include <wtf/HashMap.h> + +#if ENABLE(INDEXED_DATABASE) + +namespace WebCore { + +class IDBObjectStoreImpl : public IDBObjectStore { +public: + static PassRefPtr<IDBObjectStore> create(const String& name, const String& keyPath, bool autoIncrement) + { + return adoptRef(new IDBObjectStoreImpl(name, keyPath, autoIncrement)); + } + virtual ~IDBObjectStoreImpl(); + + String name() const { return m_name; } + String keyPath() const { return m_keyPath; } + PassRefPtr<DOMStringList> indexNames() const; + + void createIndex(const String& name, const String& keyPath, bool unique, PassRefPtr<IDBCallbacks>); + PassRefPtr<IDBIndex> index(const String& name); + void removeIndex(const String& name, PassRefPtr<IDBCallbacks>); + +private: + IDBObjectStoreImpl(const String& name, const String& keyPath, bool autoIncrement); + + String m_name; + String m_keyPath; + bool m_autoIncrement; + + typedef HashMap<String, RefPtr<IDBIndex> > IndexMap; + IndexMap m_indexes; +}; + +} // namespace WebCore + +#endif + +#endif // IDBObjectStoreImpl_h diff --git a/WebCore/storage/IDBObjectStoreRequest.cpp b/WebCore/storage/IDBObjectStoreRequest.cpp index 35763cb..b2c36dc 100644 --- a/WebCore/storage/IDBObjectStoreRequest.cpp +++ b/WebCore/storage/IDBObjectStoreRequest.cpp @@ -29,7 +29,6 @@ #include "DOMStringList.h" #include "IDBAny.h" #include "IDBIndexRequest.h" -#include "ScriptExecutionContext.h" #include "SerializedScriptValue.h" #include <wtf/UnusedParam.h> @@ -37,9 +36,8 @@ namespace WebCore { -IDBObjectStoreRequest::IDBObjectStoreRequest(ScriptExecutionContext* context, PassRefPtr<IDBObjectStore> idbObjectStore) +IDBObjectStoreRequest::IDBObjectStoreRequest(PassRefPtr<IDBObjectStore> idbObjectStore) : m_objectStore(idbObjectStore) - , m_scriptExecutionContext(context) { m_this = IDBAny::create(); m_this->set(this); @@ -60,63 +58,68 @@ PassRefPtr<DOMStringList> IDBObjectStoreRequest::indexNames() const return m_objectStore->indexNames(); } -PassRefPtr<IDBRequest> IDBObjectStoreRequest::get(PassRefPtr<SerializedScriptValue> key) +PassRefPtr<IDBRequest> IDBObjectStoreRequest::get(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> key) { // FIXME: implement + UNUSED_PARAM(context); UNUSED_PARAM(key); return 0; } -PassRefPtr<IDBRequest> IDBObjectStoreRequest::add(PassRefPtr<SerializedScriptValue> value, PassRefPtr<SerializedScriptValue> key) +PassRefPtr<IDBRequest> IDBObjectStoreRequest::add(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, PassRefPtr<SerializedScriptValue> key) { // FIXME: implement + UNUSED_PARAM(context); UNUSED_PARAM(value); UNUSED_PARAM(key); return 0; } -PassRefPtr<IDBRequest> IDBObjectStoreRequest::modify(PassRefPtr<SerializedScriptValue> value, PassRefPtr<SerializedScriptValue> key) +PassRefPtr<IDBRequest> IDBObjectStoreRequest::modify(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, PassRefPtr<SerializedScriptValue> key) { // FIXME: implement + UNUSED_PARAM(context); UNUSED_PARAM(value); UNUSED_PARAM(key); return 0; } -PassRefPtr<IDBRequest> IDBObjectStoreRequest::addOrModify(PassRefPtr<SerializedScriptValue> value, PassRefPtr<SerializedScriptValue> key) +PassRefPtr<IDBRequest> IDBObjectStoreRequest::addOrModify(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, PassRefPtr<SerializedScriptValue> key) { // FIXME: implement + UNUSED_PARAM(context); UNUSED_PARAM(value); UNUSED_PARAM(key); return 0; } -PassRefPtr<IDBRequest> IDBObjectStoreRequest::remove(PassRefPtr<SerializedScriptValue> key) +PassRefPtr<IDBRequest> IDBObjectStoreRequest::remove(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> key) { // FIXME: implement + UNUSED_PARAM(context); UNUSED_PARAM(key); return 0; } -PassRefPtr<IDBRequest> IDBObjectStoreRequest::createIndex(const String& name, const String& keyPath, bool unique) const +PassRefPtr<IDBRequest> IDBObjectStoreRequest::createIndex(ScriptExecutionContext* context, const String& name, const String& keyPath, bool unique) { - // FIXME: Implement. - UNUSED_PARAM(name); - UNUSED_PARAM(keyPath); - UNUSED_PARAM(unique); - return 0; + RefPtr<IDBRequest> request = IDBRequest::create(context, m_this); + m_objectStore->createIndex(name, keyPath, unique, request); + return request; } -PassRefPtr<IDBIndexRequest> IDBObjectStoreRequest::index(const String& name) const +PassRefPtr<IDBIndexRequest> IDBObjectStoreRequest::index(const String& name) { - return IDBIndexRequest::create(m_objectStore->index(name)); + RefPtr<IDBIndex> index = m_objectStore->index(name); + ASSERT(index); // FIXME: If this is null, we should raise a NOT_FOUND_ERR. + return IDBIndexRequest::create(index.release()); } -PassRefPtr<IDBRequest> IDBObjectStoreRequest::removeIndex(const String& name) const +PassRefPtr<IDBRequest> IDBObjectStoreRequest::removeIndex(ScriptExecutionContext* context, const String& name) { - // FIXME: Implement. - UNUSED_PARAM(name); - return 0; + RefPtr<IDBRequest> request = IDBRequest::create(context, m_this); + m_objectStore->removeIndex(name, request); + return request; } } // namespace WebCore diff --git a/WebCore/storage/IDBObjectStoreRequest.h b/WebCore/storage/IDBObjectStoreRequest.h index f03b406..f1a9f5b 100644 --- a/WebCore/storage/IDBObjectStoreRequest.h +++ b/WebCore/storage/IDBObjectStoreRequest.h @@ -40,14 +40,13 @@ namespace WebCore { class DOMStringList; class IDBAny; class IDBIndexRequest; -class ScriptExecutionContext; class SerializedScriptValue; class IDBObjectStoreRequest : public RefCounted<IDBObjectStoreRequest> { public: - static PassRefPtr<IDBObjectStoreRequest> create(ScriptExecutionContext* context, PassRefPtr<IDBObjectStore> idbObjectStore) + static PassRefPtr<IDBObjectStoreRequest> create(PassRefPtr<IDBObjectStore> idbObjectStore) { - return adoptRef(new IDBObjectStoreRequest(context, idbObjectStore)); + return adoptRef(new IDBObjectStoreRequest(idbObjectStore)); } ~IDBObjectStoreRequest() { } @@ -55,21 +54,20 @@ public: String keyPath() const; PassRefPtr<DOMStringList> indexNames() const; - PassRefPtr<IDBRequest> get(PassRefPtr<SerializedScriptValue> key); - PassRefPtr<IDBRequest> add(PassRefPtr<SerializedScriptValue> value, PassRefPtr<SerializedScriptValue> key = 0); - PassRefPtr<IDBRequest> modify(PassRefPtr<SerializedScriptValue> value, PassRefPtr<SerializedScriptValue> key = 0); - PassRefPtr<IDBRequest> addOrModify(PassRefPtr<SerializedScriptValue> value, PassRefPtr<SerializedScriptValue> key = 0); - PassRefPtr<IDBRequest> remove(PassRefPtr<SerializedScriptValue> key); + PassRefPtr<IDBRequest> get(ScriptExecutionContext*, PassRefPtr<SerializedScriptValue> key); + PassRefPtr<IDBRequest> add(ScriptExecutionContext*, PassRefPtr<SerializedScriptValue> value, PassRefPtr<SerializedScriptValue> key = 0); + PassRefPtr<IDBRequest> modify(ScriptExecutionContext*, PassRefPtr<SerializedScriptValue> value, PassRefPtr<SerializedScriptValue> key = 0); + PassRefPtr<IDBRequest> addOrModify(ScriptExecutionContext*, PassRefPtr<SerializedScriptValue> value, PassRefPtr<SerializedScriptValue> key = 0); + PassRefPtr<IDBRequest> remove(ScriptExecutionContext*, PassRefPtr<SerializedScriptValue> key); - PassRefPtr<IDBRequest> createIndex(const String& name, const String& keyPath, bool unique = false) const; - PassRefPtr<IDBIndexRequest> index(const String& name) const; - PassRefPtr<IDBRequest> removeIndex(const String& name) const; + PassRefPtr<IDBRequest> createIndex(ScriptExecutionContext*, const String& name, const String& keyPath, bool unique = false); + PassRefPtr<IDBIndexRequest> index(const String& name); + PassRefPtr<IDBRequest> removeIndex(ScriptExecutionContext*, const String& name); private: - IDBObjectStoreRequest(ScriptExecutionContext*, PassRefPtr<IDBObjectStore>); + IDBObjectStoreRequest(PassRefPtr<IDBObjectStore>); RefPtr<IDBObjectStore> m_objectStore; - RefPtr<ScriptExecutionContext> m_scriptExecutionContext; RefPtr<IDBAny> m_this; }; @@ -77,5 +75,5 @@ private: #endif -#endif // IDBDatabaseRequest_h +#endif // IDBObjectStoreRequest_h diff --git a/WebCore/storage/IDBObjectStoreRequest.idl b/WebCore/storage/IDBObjectStoreRequest.idl index 2d4c8be..873629d 100644 --- a/WebCore/storage/IDBObjectStoreRequest.idl +++ b/WebCore/storage/IDBObjectStoreRequest.idl @@ -28,16 +28,20 @@ module storage { interface [ Conditional=INDEXED_DATABASE ] IDBObjectStoreRequest { - IDBRequest get(in SerializedScriptValue key); + [CallWith=ScriptExecutionContext] IDBRequest get(in SerializedScriptValue key); + // FIXME: Come to concensus re getAll. - IDBRequest add(in SerializedScriptValue value, in [Optional] SerializedScriptValue key); - IDBRequest modify(in SerializedScriptValue value, in [Optional] SerializedScriptValue key); - IDBRequest addOrModify(in SerializedScriptValue value, in [Optional] SerializedScriptValue key); - IDBRequest remove(in SerializedScriptValue key); + // FIXME: SerializedScriptValue raises an exception if you pass in something that can't be serialized. + // We need to instead "raise" this error via an error callback. + [CallWith=ScriptExecutionContext] IDBRequest add(in SerializedScriptValue value, in [Optional] SerializedScriptValue key); + [CallWith=ScriptExecutionContext] IDBRequest modify(in SerializedScriptValue value, in [Optional] SerializedScriptValue key); + [CallWith=ScriptExecutionContext] IDBRequest addOrModify(in SerializedScriptValue value, in [Optional] SerializedScriptValue key); + [CallWith=ScriptExecutionContext] IDBRequest remove(in SerializedScriptValue key); // FIXME: write openCursor - IDBRequest createIndex(in DOMString name, in DOMString keyPath, in [Optional] boolean unique); + [CallWith=ScriptExecutionContext] IDBRequest createIndex(in DOMString name, in DOMString keyPath, in [Optional] boolean unique); + // FIXME: This needs to raise an IDBDatabaseException on errors. IDBIndexRequest index(in DOMString name); - IDBRequest removeIndex(in DOMString name); + [CallWith=ScriptExecutionContext] IDBRequest removeIndex(in DOMString name); readonly attribute DOMString name; readonly attribute DOMString keyPath; diff --git a/WebCore/storage/IDBRequest.cpp b/WebCore/storage/IDBRequest.cpp index f86abcb..f0ba25b 100644 --- a/WebCore/storage/IDBRequest.cpp +++ b/WebCore/storage/IDBRequest.cpp @@ -38,6 +38,7 @@ #include "IDBDatabaseRequest.h" #include "IDBIndexRequest.h" #include "IDBErrorEvent.h" +#include "IDBObjectStoreRequest.h" #include "IDBSuccessEvent.h" #include "ScriptExecutionContext.h" @@ -84,6 +85,12 @@ void IDBRequest::onSuccess(PassRefPtr<IDBIndex> idbIndex) m_result->set(IDBIndexRequest::create(idbIndex)); } +void IDBRequest::onSuccess(PassRefPtr<IDBObjectStore> idbObjectStore) +{ + onEventCommon(); + m_result->set(IDBObjectStoreRequest::create(idbObjectStore)); +} + void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> serializedScriptValue) { onEventCommon(); diff --git a/WebCore/storage/IDBRequest.h b/WebCore/storage/IDBRequest.h index 5836f78..4fb4eed 100644 --- a/WebCore/storage/IDBRequest.h +++ b/WebCore/storage/IDBRequest.h @@ -66,8 +66,8 @@ public: virtual void onSuccess(); // For "null". virtual void onSuccess(PassRefPtr<IDBDatabase>); virtual void onSuccess(PassRefPtr<IDBIndex>); + virtual void onSuccess(PassRefPtr<IDBObjectStore>); virtual void onSuccess(PassRefPtr<SerializedScriptValue>); - // FIXME: Have one onSuccess function for each possible result type. // EventTarget virtual IDBRequest* toIDBRequest() { return this; } diff --git a/WebCore/storage/IndexedDatabase.h b/WebCore/storage/IndexedDatabase.h index d47de72..e6abf4a 100644 --- a/WebCore/storage/IndexedDatabase.h +++ b/WebCore/storage/IndexedDatabase.h @@ -50,7 +50,7 @@ public: static PassRefPtr<IndexedDatabase> create(); virtual ~IndexedDatabase() { } - virtual void open(const String& name, const String& description, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*, ExceptionCode&) = 0; + virtual void open(const String& name, const String& description, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*) = 0; }; } // namespace WebCore diff --git a/WebCore/storage/IndexedDatabaseImpl.cpp b/WebCore/storage/IndexedDatabaseImpl.cpp index 25502de..793af9e 100644 --- a/WebCore/storage/IndexedDatabaseImpl.cpp +++ b/WebCore/storage/IndexedDatabaseImpl.cpp @@ -51,7 +51,7 @@ IndexedDatabaseImpl::~IndexedDatabaseImpl() { } -void IndexedDatabaseImpl::open(const String& name, const String& description, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin>, Frame*, ExceptionCode&) +void IndexedDatabaseImpl::open(const String& name, const String& description, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin>, Frame*) { RefPtr<IDBDatabase> database; IDBDatabaseMap::iterator it = m_databaseMap.find(name); diff --git a/WebCore/storage/IndexedDatabaseImpl.h b/WebCore/storage/IndexedDatabaseImpl.h index fa95674..b9520ee 100644 --- a/WebCore/storage/IndexedDatabaseImpl.h +++ b/WebCore/storage/IndexedDatabaseImpl.h @@ -41,7 +41,7 @@ public: static PassRefPtr<IndexedDatabaseImpl> create(); virtual ~IndexedDatabaseImpl(); - virtual void open(const String& name, const String& description, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*, ExceptionCode&); + virtual void open(const String& name, const String& description, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*); private: IndexedDatabaseImpl(); diff --git a/WebCore/storage/IndexedDatabaseRequest.cpp b/WebCore/storage/IndexedDatabaseRequest.cpp index 196fff7..93e052c 100644 --- a/WebCore/storage/IndexedDatabaseRequest.cpp +++ b/WebCore/storage/IndexedDatabaseRequest.cpp @@ -33,6 +33,7 @@ #include "ExceptionCode.h" #include "Frame.h" #include "IDBDatabase.h" +#include "IDBKeyRange.h" #include "IDBRequest.h" #include "IndexedDatabase.h" @@ -40,9 +41,8 @@ namespace WebCore { -IndexedDatabaseRequest::IndexedDatabaseRequest(IndexedDatabase* indexedDatabase, Frame* frame) +IndexedDatabaseRequest::IndexedDatabaseRequest(IndexedDatabase* indexedDatabase) : m_indexedDatabase(indexedDatabase) - , m_frame(frame) { m_this = IDBAny::create(); m_this->set(this); @@ -52,13 +52,45 @@ IndexedDatabaseRequest::~IndexedDatabaseRequest() { } -PassRefPtr<IDBRequest> IndexedDatabaseRequest::open(const String& name, const String& description, ExceptionCode& exception) +PassRefPtr<IDBRequest> IndexedDatabaseRequest::open(ScriptExecutionContext* context, const String& name, const String& description) { - RefPtr<IDBRequest> request = IDBRequest::create(m_frame->document(), m_this); - m_indexedDatabase->open(name, description, request, m_frame->document()->securityOrigin(), m_frame, exception); + if (!context->isDocument()) { + // FIXME: make this work with workers. + return 0; + } + + Document* document = static_cast<Document*>(context); + if (!document->frame()) + return 0; + + RefPtr<IDBRequest> request = IDBRequest::create(document, m_this); + m_indexedDatabase->open(name, description, request, document->securityOrigin(), document->frame()); return request; } +PassRefPtr<IDBKeyRange> IndexedDatabaseRequest::makeSingleKeyRange(PassRefPtr<SerializedScriptValue> prpValue) +{ + RefPtr<SerializedScriptValue> value = prpValue; + return IDBKeyRange::create(value, value, IDBKeyRange::SINGLE); +} + +PassRefPtr<IDBKeyRange> IndexedDatabaseRequest::makeLeftBoundKeyRange(PassRefPtr<SerializedScriptValue> bound, bool open) +{ + return IDBKeyRange::create(bound, SerializedScriptValue::create(), open ? IDBKeyRange::LEFT_OPEN : IDBKeyRange::LEFT_BOUND); +} + +PassRefPtr<IDBKeyRange> IndexedDatabaseRequest::makeRightBoundKeyRange(PassRefPtr<SerializedScriptValue> bound, bool open) +{ + return IDBKeyRange::create(SerializedScriptValue::create(), bound, open ? IDBKeyRange::RIGHT_OPEN : IDBKeyRange::RIGHT_BOUND); +} + +PassRefPtr<IDBKeyRange> IndexedDatabaseRequest::makeBoundKeyRange(PassRefPtr<SerializedScriptValue> left, PassRefPtr<SerializedScriptValue> right, bool openLeft, bool openRight) +{ + unsigned short flags = openLeft ? IDBKeyRange::LEFT_OPEN : IDBKeyRange::LEFT_BOUND; + flags |= openRight ? IDBKeyRange::RIGHT_OPEN : IDBKeyRange::RIGHT_BOUND; + return IDBKeyRange::create(left, right, flags); +} + } // namespace WebCore #endif // ENABLE(INDEXED_DATABASE) diff --git a/WebCore/storage/IndexedDatabaseRequest.h b/WebCore/storage/IndexedDatabaseRequest.h index 3f89460..9802380 100644 --- a/WebCore/storage/IndexedDatabaseRequest.h +++ b/WebCore/storage/IndexedDatabaseRequest.h @@ -39,28 +39,32 @@ namespace WebCore { -class Frame; class IDBAny; +class IDBKeyRange; +class IDBRequest; class IndexedDatabase; +class ScriptExecutionContext; +class SerializedScriptValue; class IndexedDatabaseRequest : public RefCounted<IndexedDatabaseRequest> { public: - static PassRefPtr<IndexedDatabaseRequest> create(IndexedDatabase* indexedDatabase, Frame* frame) + static PassRefPtr<IndexedDatabaseRequest> create(IndexedDatabase* indexedDatabase) { - return adoptRef(new IndexedDatabaseRequest(indexedDatabase, frame)); + return adoptRef(new IndexedDatabaseRequest(indexedDatabase)); } ~IndexedDatabaseRequest(); - PassRefPtr<IDBRequest> open(const String& name, const String& description, ExceptionCode&); - - void disconnectFrame() { m_frame = 0; } + PassRefPtr<IDBRequest> open(ScriptExecutionContext*, const String& name, const String& description); + PassRefPtr<IDBKeyRange> makeSingleKeyRange(PassRefPtr<SerializedScriptValue> value); + PassRefPtr<IDBKeyRange> makeLeftBoundKeyRange(PassRefPtr<SerializedScriptValue> bound, bool open = false); + PassRefPtr<IDBKeyRange> makeRightBoundKeyRange(PassRefPtr<SerializedScriptValue> bound, bool open = false); + PassRefPtr<IDBKeyRange> makeBoundKeyRange(PassRefPtr<SerializedScriptValue> left, PassRefPtr<SerializedScriptValue> right, bool openLeft = false, bool openRight = false); private: - IndexedDatabaseRequest(IndexedDatabase*, Frame*); + IndexedDatabaseRequest(IndexedDatabase*); RefPtr<IndexedDatabase> m_indexedDatabase; RefPtr<IDBAny> m_this; - Frame* m_frame; }; } // namespace WebCore diff --git a/WebCore/storage/IndexedDatabaseRequest.idl b/WebCore/storage/IndexedDatabaseRequest.idl index a87e033..502e804 100644 --- a/WebCore/storage/IndexedDatabaseRequest.idl +++ b/WebCore/storage/IndexedDatabaseRequest.idl @@ -28,9 +28,11 @@ module storage { interface [ Conditional=INDEXED_DATABASE ] IndexedDatabaseRequest { - // FIXME: This should no longer raise. - IDBRequest open(in DOMString name, in DOMString description) - raises(IDBDatabaseException); + [CallWith=ScriptExecutionContext] IDBRequest open(in DOMString name, in DOMString description); + IDBKeyRange makeSingleKeyRange(in SerializedScriptValue value); + IDBKeyRange makeLeftBoundKeyRange(in SerializedScriptValue bound, in [Optional] boolean open); + IDBKeyRange makeRightBoundKeyRange(in SerializedScriptValue bound, in [Optional] boolean open); + IDBKeyRange makeBoundKeyRange(in SerializedScriptValue left, in SerializedScriptValue right, in [Optional] boolean openLeft, in [Optional] boolean openRight); }; } diff --git a/WebCore/storage/SQLResultSet.idl b/WebCore/storage/SQLResultSet.idl index 0b70e01..52f06da 100644 --- a/WebCore/storage/SQLResultSet.idl +++ b/WebCore/storage/SQLResultSet.idl @@ -35,8 +35,14 @@ module storage { ] SQLResultSet { readonly attribute SQLResultSetRowList rows; +#if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP readonly attribute long insertId getter raises(DOMException); +#else + // Explicitely choose 'long long' here to avoid a 64bit->32bit shortening warning for us. + readonly attribute long long insertId + getter raises(DOMException); +#endif readonly attribute long rowsAffected; }; } diff --git a/WebCore/storage/SQLStatement.cpp b/WebCore/storage/SQLStatement.cpp index 2e1aea2..cd96535 100644 --- a/WebCore/storage/SQLStatement.cpp +++ b/WebCore/storage/SQLStatement.cpp @@ -31,12 +31,10 @@ #if ENABLE(DATABASE) #include "Database.h" -#include "DatabaseAuthorizer.h" #include "Logging.h" #include "SQLError.h" #include "SQLiteDatabase.h" #include "SQLiteStatement.h" -#include "SQLResultSet.h" #include "SQLStatementCallback.h" #include "SQLStatementErrorCallback.h" #include "SQLTransaction.h" @@ -73,7 +71,7 @@ bool SQLStatement::execute(Database* db) if (m_readOnly) db->setAuthorizerReadOnly(); - SQLiteDatabase* database = &db->m_sqliteDatabase; + SQLiteDatabase* database = &db->sqliteDatabase(); SQLiteStatement statement(*database, m_statement); int result = statement.prepare(); @@ -130,7 +128,7 @@ bool SQLStatement::execute(Database* db) } } else if (result == SQLResultDone) { // Didn't find anything, or was an insert - if (db->m_databaseAuthorizer->lastActionWasInsert()) + if (db->lastActionWasInsert()) resultSet->setInsertId(database->lastInsertRowID()); } else if (result == SQLResultFull) { // Return the Quota error - the delegate will be asked for more space and this statement might be re-run diff --git a/WebCore/storage/SQLStatement.h b/WebCore/storage/SQLStatement.h index f01f7bf..89af377 100644 --- a/WebCore/storage/SQLStatement.h +++ b/WebCore/storage/SQLStatement.h @@ -31,23 +31,18 @@ #if ENABLE(DATABASE) #include "PlatformString.h" - -#include "SQLError.h" #include "SQLResultSet.h" -#include "SQLStatementCallback.h" -#include "SQLStatementErrorCallback.h" #include "SQLValue.h" - -#include <wtf/PassRefPtr.h> -#include <wtf/RefPtr.h> -#include <wtf/Threading.h> +#include <wtf/Forward.h> #include <wtf/Vector.h> namespace WebCore { class Database; +class SQLError; +class SQLStatementCallback; +class SQLStatementErrorCallback; class SQLTransaction; -class String; class SQLStatement : public ThreadSafeShared<SQLStatement> { public: @@ -66,7 +61,7 @@ public: SQLError* sqlError() const { return m_error.get(); } private: - SQLStatement(const String& statement, const Vector<SQLValue>& arguments, PassRefPtr<SQLStatementCallback> callback, PassRefPtr<SQLStatementErrorCallback> errorCallback, bool readOnly); + SQLStatement(const String& statement, const Vector<SQLValue>& arguments, PassRefPtr<SQLStatementCallback>, PassRefPtr<SQLStatementErrorCallback>, bool readOnly); void setFailureDueToQuota(); void clearFailureDueToQuota(); diff --git a/WebCore/storage/SQLTransaction.cpp b/WebCore/storage/SQLTransaction.cpp index 7f16b63..b06d865 100644 --- a/WebCore/storage/SQLTransaction.cpp +++ b/WebCore/storage/SQLTransaction.cpp @@ -31,26 +31,26 @@ #if ENABLE(DATABASE) -#include "ChromeClient.h" #include "Database.h" -#include "DatabaseAuthorizer.h" -#include "DatabaseDetails.h" #include "DatabaseThread.h" #include "ExceptionCode.h" #include "Logging.h" -#include "Page.h" #include "PlatformString.h" #include "ScriptExecutionContext.h" -#include "Settings.h" #include "SQLError.h" #include "SQLiteTransaction.h" -#include "SQLResultSet.h" #include "SQLStatement.h" #include "SQLStatementCallback.h" #include "SQLStatementErrorCallback.h" +#include "SQLTransactionCallback.h" #include "SQLTransactionClient.h" #include "SQLTransactionCoordinator.h" +#include "SQLTransactionErrorCallback.h" #include "SQLValue.h" +#include "VoidCallback.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> // There's no way of knowing exactly how much more space will be required when a statement hits the quota limit. // For now, we'll arbitrarily choose currentQuota + 1mb. @@ -65,8 +65,8 @@ PassRefPtr<SQLTransaction> SQLTransaction::create(Database* db, PassRefPtr<SQLTr return adoptRef(new SQLTransaction(db, callback, errorCallback, successCallback, wrapper, readOnly)); } -SQLTransaction::SQLTransaction(Database* db, PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback, PassRefPtr<VoidCallback> successCallback, - PassRefPtr<SQLTransactionWrapper> wrapper, bool readOnly) +SQLTransaction::SQLTransaction(Database* db, PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback, + PassRefPtr<VoidCallback> successCallback, PassRefPtr<SQLTransactionWrapper> wrapper, bool readOnly) : m_nextStep(&SQLTransaction::acquireLock) , m_executeSqlAllowed(false) , m_database(db) @@ -234,7 +234,7 @@ void SQLTransaction::lockAcquired() void SQLTransaction::openTransactionAndPreflight() { - ASSERT(!m_database->m_sqliteDatabase.transactionInProgress()); + ASSERT(!m_database->sqliteDatabase().transactionInProgress()); ASSERT(m_lockAcquired); LOG(StorageAPI, "Opening and preflighting transaction %p", this); @@ -248,18 +248,19 @@ void SQLTransaction::openTransactionAndPreflight() // Set the maximum usage for this transaction if this transactions is not read-only if (!m_readOnly) - m_database->m_sqliteDatabase.setMaximumSize(m_database->maximumSize()); + m_database->sqliteDatabase().setMaximumSize(m_database->maximumSize()); ASSERT(!m_sqliteTransaction); - m_sqliteTransaction.set(new SQLiteTransaction(m_database->m_sqliteDatabase, m_readOnly)); + m_sqliteTransaction.set(new SQLiteTransaction(m_database->sqliteDatabase(), m_readOnly)); - m_database->m_databaseAuthorizer->disable(); + m_database->resetDeletes(); + m_database->disableAuthorizer(); m_sqliteTransaction->begin(); - m_database->m_databaseAuthorizer->enable(); + m_database->enableAuthorizer(); // Transaction Steps 1+2 - Open a transaction to the database, jumping to the error callback if that fails if (!m_sqliteTransaction->inProgress()) { - ASSERT(!m_database->m_sqliteDatabase.transactionInProgress()); + ASSERT(!m_database->sqliteDatabase().transactionInProgress()); m_sqliteTransaction.clear(); m_transactionError = SQLError::create(0, "unable to open a transaction to the database"); handleTransactionError(false); @@ -268,7 +269,7 @@ void SQLTransaction::openTransactionAndPreflight() // Transaction Steps 3 - Peform preflight steps, jumping to the error callback if they fail if (m_wrapper && !m_wrapper->performPreflight(this)) { - ASSERT(!m_database->m_sqliteDatabase.transactionInProgress()); + ASSERT(!m_database->sqliteDatabase().transactionInProgress()); m_sqliteTransaction.clear(); m_transactionError = m_wrapper->sqlError(); if (!m_transactionError) @@ -326,7 +327,7 @@ void SQLTransaction::runStatements() // m_shouldRetryCurrentStatement is set to true only when a statement exceeds // the quota, which can happen only in a read-write transaction. Therefore, there // is no need to check here if the transaction is read-write. - m_database->m_sqliteDatabase.setMaximumSize(m_database->maximumSize()); + m_database->sqliteDatabase().setMaximumSize(m_database->maximumSize()); } else { // If the current statement has already been run, failed due to quota constraints, and we're not retrying it, // that means it ended in an error. Handle it now @@ -353,8 +354,7 @@ void SQLTransaction::getNextStatement() MutexLocker locker(m_statementMutex); if (!m_statementQueue.isEmpty()) { - m_currentStatement = m_statementQueue.first(); - m_statementQueue.removeFirst(); + m_currentStatement = m_statementQueue.takeFirst(); } } @@ -363,10 +363,10 @@ bool SQLTransaction::runCurrentStatement() if (!m_currentStatement) return false; - m_database->m_databaseAuthorizer->reset(); + m_database->resetAuthorizer(); if (m_currentStatement->execute(m_database.get())) { - if (m_database->m_databaseAuthorizer->lastActionChangedDatabase()) { + if (m_database->lastActionChangedDatabase()) { // Flag this transaction as having changed the database for later delegate notification m_modifiedDatabase = true; // Also dirty the size of this database file for calculating quota usage @@ -455,9 +455,9 @@ void SQLTransaction::postflightAndCommit() // Transacton Step 8+9 - Commit the transaction, jumping to the error callback if that fails ASSERT(m_sqliteTransaction); - m_database->m_databaseAuthorizer->disable(); + m_database->disableAuthorizer(); m_sqliteTransaction->commit(); - m_database->m_databaseAuthorizer->enable(); + m_database->enableAuthorizer(); // If the commit failed, the transaction will still be marked as "in progress" if (m_sqliteTransaction->inProgress()) { @@ -466,12 +466,13 @@ void SQLTransaction::postflightAndCommit() return; } - // The commit was successful. If the transaction modified this database, - // vacuum the database if needed and notify the delegates. - if (m_modifiedDatabase) { + // Vacuum the database if anything was deleted. + if (m_database->hadDeletes()) m_database->incrementalVacuumIfNeeded(); + + // The commit was successful. If the transaction modified this database, notify the delegates. + if (m_modifiedDatabase) m_database->transactionClient()->didCommitTransaction(this); - } // Now release our unneeded callbacks, to break reference cycles. m_callback = 0; @@ -509,7 +510,7 @@ void SQLTransaction::cleanupAfterSuccessCallback() // Transaction Step 11 - End transaction steps // There is no next step LOG(StorageAPI, "Transaction %p is complete\n", this); - ASSERT(!m_database->m_sqliteDatabase.transactionInProgress()); + ASSERT(!m_database->sqliteDatabase().transactionInProgress()); m_sqliteTransaction.clear(); m_nextStep = 0; @@ -559,15 +560,15 @@ void SQLTransaction::cleanupAfterTransactionErrorCallback() { ASSERT(m_lockAcquired); - m_database->m_databaseAuthorizer->disable(); + m_database->disableAuthorizer(); if (m_sqliteTransaction) { // Transaction Step 12 - Rollback the transaction. m_sqliteTransaction->rollback(); - ASSERT(!m_database->m_sqliteDatabase.transactionInProgress()); + ASSERT(!m_database->sqliteDatabase().transactionInProgress()); m_sqliteTransaction.clear(); } - m_database->m_databaseAuthorizer->enable(); + m_database->enableAuthorizer(); // Transaction Step 12 - Any still-pending statements in the transaction are discarded. { @@ -577,7 +578,7 @@ void SQLTransaction::cleanupAfterTransactionErrorCallback() // Transaction is complete! There is no next step LOG(StorageAPI, "Transaction %p is complete with an error\n", this); - ASSERT(!m_database->m_sqliteDatabase.transactionInProgress()); + ASSERT(!m_database->sqliteDatabase().transactionInProgress()); m_nextStep = 0; // Now release our callbacks, to break reference cycles. diff --git a/WebCore/storage/SQLTransaction.h b/WebCore/storage/SQLTransaction.h index 1b02d01..3cef036 100644 --- a/WebCore/storage/SQLTransaction.h +++ b/WebCore/storage/SQLTransaction.h @@ -32,14 +32,9 @@ #include <wtf/Threading.h> -#include "SQLiteTransaction.h" #include "SQLStatement.h" -#include "SQLTransactionCallback.h" -#include "SQLTransactionErrorCallback.h" #include <wtf/Deque.h> #include <wtf/Forward.h> -#include <wtf/OwnPtr.h> -#include <wtf/RefPtr.h> #include <wtf/Vector.h> namespace WebCore { @@ -48,9 +43,12 @@ typedef int ExceptionCode; class Database; class SQLError; +class SQLiteTransaction; class SQLStatementCallback; class SQLStatementErrorCallback; class SQLTransaction; +class SQLTransactionCallback; +class SQLTransactionErrorCallback; class SQLValue; class String; class VoidCallback; @@ -72,7 +70,7 @@ public: ~SQLTransaction(); void executeSQL(const String& sqlStatement, const Vector<SQLValue>& arguments, - PassRefPtr<SQLStatementCallback> callback, PassRefPtr<SQLStatementErrorCallback> callbackError, ExceptionCode& e); + PassRefPtr<SQLStatementCallback>, PassRefPtr<SQLStatementErrorCallback>, ExceptionCode&); void lockAcquired(); bool performNextStep(); diff --git a/WebCore/storage/SQLTransactionCoordinator.cpp b/WebCore/storage/SQLTransactionCoordinator.cpp index dbd2739..104ea10 100644 --- a/WebCore/storage/SQLTransactionCoordinator.cpp +++ b/WebCore/storage/SQLTransactionCoordinator.cpp @@ -57,8 +57,7 @@ void SQLTransactionCoordinator::processPendingTransactions(CoordinationInfo& inf RefPtr<SQLTransaction> firstPendingTransaction = info.pendingTransactions.first(); if (firstPendingTransaction->isReadOnly()) { do { - firstPendingTransaction = info.pendingTransactions.first(); - info.pendingTransactions.removeFirst(); + firstPendingTransaction = info.pendingTransactions.takeFirst(); info.activeReadTransactions.add(firstPendingTransaction); firstPendingTransaction->lockAcquired(); } while (!info.pendingTransactions.isEmpty() && info.pendingTransactions.first()->isReadOnly()); diff --git a/WebCore/storage/StorageAreaSync.cpp b/WebCore/storage/StorageAreaSync.cpp index 4c385b7..59f558b 100644 --- a/WebCore/storage/StorageAreaSync.cpp +++ b/WebCore/storage/StorageAreaSync.cpp @@ -29,6 +29,7 @@ #if ENABLE(DOM_STORAGE) #include "EventNames.h" +#include "FileSystem.h" #include "HTMLElement.h" #include "SecurityOrigin.h" #include "SQLiteStatement.h" @@ -62,6 +63,7 @@ StorageAreaSync::StorageAreaSync(PassRefPtr<StorageSyncManager> storageSyncManag , m_clearItemsWhileSyncing(false) , m_syncScheduled(false) , m_syncInProgress(false) + , m_databaseOpenFailed(false) , m_importComplete(false) { ASSERT(isMainThread()); @@ -198,28 +200,47 @@ void StorageAreaSync::syncTimerFired(Timer<StorageAreaSync>*) } } -void StorageAreaSync::performImport() +void StorageAreaSync::openDatabase(OpenDatabaseParamType openingStrategy) { ASSERT(!isMainThread()); ASSERT(!m_database.isOpen()); + ASSERT(!m_databaseOpenFailed); String databaseFilename = m_syncManager->fullDatabaseFilename(m_databaseIdentifier); + if (!fileExists(databaseFilename) && openingStrategy == SkipIfNonExistent) + return; + if (databaseFilename.isEmpty()) { LOG_ERROR("Filename for local storage database is empty - cannot open for persistent storage"); markImported(); + m_databaseOpenFailed = true; return; } if (!m_database.open(databaseFilename)) { LOG_ERROR("Failed to open database file %s for local storage", databaseFilename.utf8().data()); markImported(); + m_databaseOpenFailed = true; return; } if (!m_database.executeCommand("CREATE TABLE IF NOT EXISTS ItemTable (key TEXT UNIQUE ON CONFLICT REPLACE, value TEXT NOT NULL ON CONFLICT FAIL)")) { LOG_ERROR("Failed to create table ItemTable for local storage"); markImported(); + m_databaseOpenFailed = true; + return; + } +} + +void StorageAreaSync::performImport() +{ + ASSERT(!isMainThread()); + ASSERT(!m_database.isOpen()); + + openDatabase(SkipIfNonExistent); + if (!m_database.isOpen()) { + markImported(); return; } @@ -285,6 +306,10 @@ void StorageAreaSync::sync(bool clearItems, const HashMap<String, String>& items { ASSERT(!isMainThread()); + if (m_databaseOpenFailed) + return; + if (!m_database.isOpen()) + openDatabase(CreateIfNonExistent); if (!m_database.isOpen()) return; diff --git a/WebCore/storage/StorageAreaSync.h b/WebCore/storage/StorageAreaSync.h index 0e46763..d26d399 100644 --- a/WebCore/storage/StorageAreaSync.h +++ b/WebCore/storage/StorageAreaSync.h @@ -75,7 +75,13 @@ namespace WebCore { void performSync(); private: + enum OpenDatabaseParamType { + CreateIfNonExistent, + SkipIfNonExistent + }; + void syncTimerFired(Timer<StorageAreaSync>*); + void openDatabase(OpenDatabaseParamType openingStrategy); void sync(bool clearItems, const HashMap<String, String>& items); const String m_databaseIdentifier; @@ -85,6 +91,7 @@ namespace WebCore { bool m_clearItemsWhileSyncing; bool m_syncScheduled; bool m_syncInProgress; + bool m_databaseOpenFailed; mutable Mutex m_importLock; mutable ThreadCondition m_importCondition; diff --git a/WebCore/svg/SVGColor.cpp b/WebCore/svg/SVGColor.cpp index ede0b0a..803753d 100644 --- a/WebCore/svg/SVGColor.cpp +++ b/WebCore/svg/SVGColor.cpp @@ -77,10 +77,7 @@ void SVGColor::setRGBColor(const String& rgbColor, ExceptionCode& ec) Color SVGColor::colorFromRGBColorString(const String& colorString) { String s = colorString.stripWhiteSpace(); - // hsl, hsla and rgba are not in the SVG spec. // FIXME: rework css parser so it is more svg aware - if (s.startsWith("hsl") || s.startsWith("rgba")) - return Color(); RGBA32 color; if (CSSParser::parseColor(color, s)) return color; diff --git a/WebCore/svg/SVGDocumentExtensions.cpp b/WebCore/svg/SVGDocumentExtensions.cpp index 0db682f..7b285eb 100644 --- a/WebCore/svg/SVGDocumentExtensions.cpp +++ b/WebCore/svg/SVGDocumentExtensions.cpp @@ -37,7 +37,7 @@ #include "SVGSMILElement.h" #include "SVGSVGElement.h" #include "SMILTimeContainer.h" -#include "XMLTokenizer.h" +#include "XMLDocumentParser.h" #include "ScriptController.h" namespace WebCore { @@ -128,13 +128,13 @@ bool SVGDocumentExtensions::sampleAnimationAtTime(const String& elementId, SVGSM void SVGDocumentExtensions::reportWarning(const String& message) { if (Frame* frame = m_doc->frame()) - frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Warning: " + message, m_doc->tokenizer() ? m_doc->tokenizer()->lineNumber() : 1, String()); + frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Warning: " + message, m_doc->parser() ? m_doc->parser()->lineNumber() : 1, String()); } void SVGDocumentExtensions::reportError(const String& message) { if (Frame* frame = m_doc->frame()) - frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Error: " + message, m_doc->tokenizer() ? m_doc->tokenizer()->lineNumber() : 1, String()); + frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Error: " + message, m_doc->parser() ? m_doc->parser()->lineNumber() : 1, String()); } void SVGDocumentExtensions::addPendingResource(const AtomicString& id, SVGStyledElement* obj) diff --git a/WebCore/svg/SVGElement.cpp b/WebCore/svg/SVGElement.cpp index a94329e..293e4d6 100644 --- a/WebCore/svg/SVGElement.cpp +++ b/WebCore/svg/SVGElement.cpp @@ -280,7 +280,7 @@ void SVGElement::insertedIntoDocument() StyledElement::insertedIntoDocument(); SVGDocumentExtensions* extensions = document()->accessSVGExtensions(); - String resourceId = getAttribute(idAttributeName()); + String resourceId = getIdAttribute(); if (extensions->isPendingResource(resourceId)) { OwnPtr<HashSet<SVGStyledElement*> > clients(extensions->removePendingResource(resourceId)); if (clients->isEmpty()) diff --git a/WebCore/svg/SVGFEColorMatrixElement.cpp b/WebCore/svg/SVGFEColorMatrixElement.cpp index c644fd6..6ac1496 100644 --- a/WebCore/svg/SVGFEColorMatrixElement.cpp +++ b/WebCore/svg/SVGFEColorMatrixElement.cpp @@ -89,7 +89,7 @@ PassRefPtr<FilterEffect> SVGFEColorMatrixElement::build(SVGFilterBuilder* filter Vector<float> filterValues; SVGNumberList* numbers = values(); - const ColorMatrixType filterType(static_cast<const ColorMatrixType>(type())); + const ColorMatrixType filterType(static_cast<ColorMatrixType>(type())); // Use defaults if values is empty (SVG 1.1 15.10). if (!hasAttribute(SVGNames::valuesAttr)) { diff --git a/WebCore/svg/SVGFitToViewBox.cpp b/WebCore/svg/SVGFitToViewBox.cpp index f4de46b..1c1521a 100644 --- a/WebCore/svg/SVGFitToViewBox.cpp +++ b/WebCore/svg/SVGFitToViewBox.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> + 2004, 2005, 2006, 2007, 2010 Rob Buis <buis@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -42,35 +42,49 @@ SVGFitToViewBox::~SVGFitToViewBox() { } -bool SVGFitToViewBox::parseViewBox(Document* doc, const UChar*& c, const UChar* end, float& x, float& y, float& w, float& h, bool validate) +bool SVGFitToViewBox::parseViewBox(Document* doc, const String& s, FloatRect& viewBox) +{ + const UChar* c = s.characters(); + const UChar* end = c + s.length(); + return parseViewBox(doc, c, end, viewBox, true); +} + +bool SVGFitToViewBox::parseViewBox(Document* doc, const UChar*& c, const UChar* end, FloatRect& viewBox, bool validate) { String str(c, end - c); skipOptionalSpaces(c, end); + float x = 0.0f; + float y = 0.0f; + float width = 0.0f; + float height = 0.0f; bool valid = (parseNumber(c, end, x) && parseNumber(c, end, y) && - parseNumber(c, end, w) && parseNumber(c, end, h, false)); - if (!validate) + parseNumber(c, end, width) && parseNumber(c, end, height, false)); + if (!validate) { + viewBox = FloatRect(x, y, width, height); return true; + } if (!valid) { doc->accessSVGExtensions()->reportWarning("Problem parsing viewBox=\"" + str + "\""); return false; } - if (w < 0.0) { // check that width is positive + if (width < 0.0) { // check that width is positive doc->accessSVGExtensions()->reportError("A negative value for ViewBox width is not allowed"); return false; - } else if (h < 0.0) { // check that height is positive + } + if (height < 0.0) { // check that height is positive doc->accessSVGExtensions()->reportError("A negative value for ViewBox height is not allowed"); return false; - } else { - skipOptionalSpaces(c, end); - if (c < end) { // nothing should come after the last, fourth number - doc->accessSVGExtensions()->reportWarning("Problem parsing viewBox=\"" + str + "\""); - return false; - } + } + skipOptionalSpaces(c, end); + if (c < end) { // nothing should come after the last, fourth number + doc->accessSVGExtensions()->reportWarning("Problem parsing viewBox=\"" + str + "\""); + return false; } + viewBox = FloatRect(x, y, width, height); return true; } @@ -85,12 +99,12 @@ AffineTransform SVGFitToViewBox::viewBoxToViewTransform(const FloatRect& viewBox bool SVGFitToViewBox::parseMappedAttribute(Document* document, Attribute* attr) { if (attr->name() == SVGNames::viewBoxAttr) { - float x = 0.0f, y = 0.0f, w = 0.0f, h = 0.0f; - const UChar* c = attr->value().characters(); - const UChar* end = c + attr->value().length(); - if (parseViewBox(document, c, end, x, y, w, h)) - setViewBoxBaseValue(FloatRect(x, y, w, h)); - return true; + FloatRect viewBox; + if (!attr->value().isNull()) { + if (!parseViewBox(document, attr->value(), viewBox)) + return true; + } + setViewBoxBaseValue(viewBox); } else if (attr->name() == SVGNames::preserveAspectRatioAttr) { SVGPreserveAspectRatio::parsePreserveAspectRatio(this, attr->value()); return true; diff --git a/WebCore/svg/SVGFitToViewBox.h b/WebCore/svg/SVGFitToViewBox.h index c4a0d11..32ecc29 100644 --- a/WebCore/svg/SVGFitToViewBox.h +++ b/WebCore/svg/SVGFitToViewBox.h @@ -1,6 +1,6 @@ /* Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> + 2004, 2005, 2006, 2007, 2010 Rob Buis <buis@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -34,7 +34,7 @@ public: SVGFitToViewBox(); virtual ~SVGFitToViewBox(); - bool parseViewBox(Document*, const UChar*& start, const UChar* end, float& x, float& y, float& w, float& h, bool validate = true); + bool parseViewBox(Document*, const UChar*& start, const UChar* end, FloatRect& viewBox, bool validate = true); static AffineTransform viewBoxToViewTransform(const FloatRect& viewBoxRect, const SVGPreserveAspectRatio&, float viewWidth, float viewHeight); bool parseMappedAttribute(Document*, Attribute*); @@ -42,6 +42,9 @@ public: virtual void setViewBoxBaseValue(SVGAnimatedPropertyTraits<FloatRect>::PassType) = 0; virtual void setPreserveAspectRatioBaseValue(SVGAnimatedPropertyTraits<SVGPreserveAspectRatio>::PassType) = 0; + +private: + bool parseViewBox(Document*, const String&, FloatRect&); }; } // namespace WebCore diff --git a/WebCore/svg/SVGLocatable.cpp b/WebCore/svg/SVGLocatable.cpp index 49600d1..e03ef93 100644 --- a/WebCore/svg/SVGLocatable.cpp +++ b/WebCore/svg/SVGLocatable.cpp @@ -91,14 +91,18 @@ AffineTransform SVGLocatable::computeCTM(const SVGElement* element, CTMScope mod AffineTransform ctm; SVGElement* stopAtElement = mode == NearestViewportScope ? nearestViewportElement(element) : 0; - for (const Node* current = element; current && current->isSVGElement(); current = current->parentNode()) { - const SVGElement* currentElement = static_cast<const SVGElement*>(current); + + Node* current = const_cast<SVGElement*>(element); + while (current && current->isSVGElement()) { + SVGElement* currentElement = static_cast<SVGElement*>(current); if (currentElement->isStyled()) - ctm = static_cast<const SVGStyledElement*>(currentElement)->localCoordinateSpaceTransform(mode).multLeft(ctm); + ctm = static_cast<SVGStyledElement*>(currentElement)->localCoordinateSpaceTransform(mode).multLeft(ctm); // For getCTM() computation, stop at the nearest viewport element if (currentElement == stopAtElement) break; + + current = current->isShadowNode() ? current->shadowParentNode() : current->parentNode(); } return ctm; diff --git a/WebCore/svg/SVGStyledElement.cpp b/WebCore/svg/SVGStyledElement.cpp index 94ddf0b..bd461c0 100644 --- a/WebCore/svg/SVGStyledElement.cpp +++ b/WebCore/svg/SVGStyledElement.cpp @@ -185,6 +185,7 @@ int SVGStyledElement::cssPropertyIdForSVGAttributeName(const QualifiedName& attr mapAttributeToCSSProperty(propertyNameToIdMap, text_decorationAttr); mapAttributeToCSSProperty(propertyNameToIdMap, text_renderingAttr); mapAttributeToCSSProperty(propertyNameToIdMap, unicode_bidiAttr); + mapAttributeToCSSProperty(propertyNameToIdMap, vector_effectAttr); mapAttributeToCSSProperty(propertyNameToIdMap, visibilityAttr); mapAttributeToCSSProperty(propertyNameToIdMap, word_spacingAttr); mapAttributeToCSSProperty(propertyNameToIdMap, writing_modeAttr); @@ -232,7 +233,7 @@ bool SVGStyledElement::isKnownAttribute(const QualifiedName& attrName) if (propId > 0) return true; - return (attrName == idAttributeName() || attrName == HTMLNames::styleAttr); + return isIdAttributeName(attrName) || attrName == HTMLNames::styleAttr; } void SVGStyledElement::svgAttributeChanged(const QualifiedName& attrName) @@ -244,7 +245,7 @@ void SVGStyledElement::svgAttributeChanged(const QualifiedName& attrName) RenderObject* object = renderer(); - if (attrName == idAttributeName()) { + if (isIdAttributeName(attrName)) { // Notify resources about id changes, this is important as we cache resources by id in SVGDocumentExtensions if (object && object->isSVGResourceContainer()) object->toRenderSVGResourceContainer()->idChanged(); diff --git a/WebCore/svg/SVGUseElement.cpp b/WebCore/svg/SVGUseElement.cpp index a33a56e..17b4212 100644 --- a/WebCore/svg/SVGUseElement.cpp +++ b/WebCore/svg/SVGUseElement.cpp @@ -342,7 +342,7 @@ void dumpInstanceTree(unsigned int& depth, String& text, SVGElementInstance* tar SVGElement* shadowTreeElement = targetInstance->shadowTreeElement(); ASSERT(shadowTreeElement); - String elementId = element->getIDAttribute(); + String elementId = element->getIdAttribute(); String elementNodeName = element->nodeName(); String shadowTreeElementNodeName = shadowTreeElement->nodeName(); String parentNodeName = element->parentNode() ? element->parentNode()->nodeName() : "null"; @@ -681,7 +681,8 @@ void SVGUseElement::handleDeepUseReferencing(SVGUseElement* use, SVGElementInsta while (instance) { SVGElement* element = instance->correspondingElement(); - if (element->getIDAttribute() == id) { + // FIXME: This should probably be using getIdAttribute instead of idForStyleResolution. + if (element->hasID() && element->idForStyleResolution() == id) { foundProblem = true; return; } diff --git a/WebCore/svg/SVGViewSpec.cpp b/WebCore/svg/SVGViewSpec.cpp index 608bdbf..53194a9 100644 --- a/WebCore/svg/SVGViewSpec.cpp +++ b/WebCore/svg/SVGViewSpec.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Rob Buis <buis@kde.org> + Copyright (C) 2007, 2010 Rob Buis <buis@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -48,14 +48,14 @@ void SVGViewSpec::setTransform(const String& transform) SVGTransformable::parseTransformAttribute(m_transform.get(), transform); } -void SVGViewSpec::setViewBoxString(const String& viewBox) +void SVGViewSpec::setViewBoxString(const String& viewBoxStr) { - float x, y, w, h; - const UChar* c = viewBox.characters(); - const UChar* end = c + viewBox.length(); - if (!parseViewBox(m_contextElement->document(), c, end, x, y, w, h, false)) - return; - setViewBoxBaseValue(FloatRect(x, y, w, h)); + FloatRect viewBox; + const UChar* c = viewBoxStr.characters(); + const UChar* end = c + viewBoxStr.length(); + if (!parseViewBox(m_contextElement->document(), c, end, viewBox, false)) + return; + setViewBoxBaseValue(viewBox); } void SVGViewSpec::setPreserveAspectRatioString(const String& preserve) @@ -101,10 +101,10 @@ bool SVGViewSpec::parseViewSpec(const String& viewSpec) if (currViewSpec >= end || *currViewSpec != '(') return false; currViewSpec++; - float x, y, w, h; - if (!parseViewBox(m_contextElement->document(), currViewSpec, end, x, y, w, h, false)) + FloatRect viewBox; + if (!parseViewBox(m_contextElement->document(), currViewSpec, end, viewBox, false)) return false; - setViewBoxBaseValue(FloatRect(x, y, w, h)); + setViewBoxBaseValue(viewBox); if (currViewSpec >= end || *currViewSpec != ')') return false; currViewSpec++; diff --git a/WebCore/svg/animation/SMILTimeContainer.cpp b/WebCore/svg/animation/SMILTimeContainer.cpp index f0b479d..e7b8cc7 100644 --- a/WebCore/svg/animation/SMILTimeContainer.cpp +++ b/WebCore/svg/animation/SMILTimeContainer.cpp @@ -236,7 +236,8 @@ void SMILTimeContainer::updateAnimations(SMILTime elapsed) ASSERT(animation->timeContainer() == this); SVGElement* targetElement = animation->targetElement(); - if (!targetElement || targetElement->getIDAttribute() != m_nextSamplingTarget) + // FIXME: This should probably be using getIdAttribute instead of idForStyleResolution. + if (!targetElement || !targetElement->hasID() || targetElement->idForStyleResolution() != m_nextSamplingTarget) continue; samplingDiff = animation->intervalBegin(); diff --git a/WebCore/svg/graphics/SVGImage.cpp b/WebCore/svg/graphics/SVGImage.cpp index 0737112..8260d99 100644 --- a/WebCore/svg/graphics/SVGImage.cpp +++ b/WebCore/svg/graphics/SVGImage.cpp @@ -268,7 +268,7 @@ bool SVGImage::dataChanged(bool allDataReceived) loader->setForcedSandboxFlags(SandboxAll); loader->load(fakeRequest, false); // Make sure the DocumentLoader is created loader->policyChecker()->cancelCheck(); // cancel any policy checks - loader->commitProvisionalLoad(0); + loader->commitProvisionalLoad(); loader->writer()->setMIMEType("image/svg+xml"); loader->writer()->begin(KURL()); // create the empty document loader->writer()->addData(data()->data(), data()->size()); diff --git a/WebCore/svg/svgattrs.in b/WebCore/svg/svgattrs.in index 6081039..dbe7663 100644 --- a/WebCore/svg/svgattrs.in +++ b/WebCore/svg/svgattrs.in @@ -228,6 +228,7 @@ v-hanging v-ideographic v-mathematical values +vector-effect version vert-adv-y vert-origin-x diff --git a/WebCore/wml/WMLDocument.cpp b/WebCore/wml/WMLDocument.cpp index 44f4e2b..ba4bb57 100644 --- a/WebCore/wml/WMLDocument.cpp +++ b/WebCore/wml/WMLDocument.cpp @@ -26,7 +26,7 @@ #include "BackForwardList.h" #include "Frame.h" #include "Page.h" -#include "Tokenizer.h" +#include "DocumentParser.h" #include "WMLCardElement.h" #include "WMLErrorHandling.h" #include "WMLPageState.h" @@ -47,8 +47,8 @@ WMLDocument::~WMLDocument() void WMLDocument::finishedParsing() { - if (Tokenizer* tokenizer = this->tokenizer()) { - if (!tokenizer->wellFormed()) { + if (DocumentParser* parser = this->parser()) { + if (!parser->wellFormed()) { Document::finishedParsing(); return; } diff --git a/WebCore/wml/WMLElement.cpp b/WebCore/wml/WMLElement.cpp index dbe55a9..f359236 100644 --- a/WebCore/wml/WMLElement.cpp +++ b/WebCore/wml/WMLElement.cpp @@ -60,7 +60,7 @@ bool WMLElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& void WMLElement::parseMappedAttribute(Attribute* attr) { - if (attr->name() == idAttributeName() + if (isIdAttributeName(attr->name()) || attr->name() == HTMLNames::classAttr || attr->name() == HTMLNames::styleAttr) return StyledElement::parseMappedAttribute(attr); diff --git a/WebCore/wml/WMLErrorHandling.cpp b/WebCore/wml/WMLErrorHandling.cpp index 6184772..8532822 100644 --- a/WebCore/wml/WMLErrorHandling.cpp +++ b/WebCore/wml/WMLErrorHandling.cpp @@ -27,7 +27,7 @@ #include "Frame.h" #include "Document.h" #include "DOMWindow.h" -#include "XMLTokenizer.h" +#include "XMLDocumentParser.h" #include <wtf/text/CString.h> namespace WebCore { @@ -38,17 +38,17 @@ void reportWMLError(Document* doc, WMLErrorCode error) return; String errorMessage = errorMessageForErrorCode(error); - XMLTokenizer* tokenizer = static_cast<XMLTokenizer*>(doc->tokenizer()); - if (tokenizer && error != WMLErrorDeckNotAccessible) { + XMLDocumentParser* parser = static_cast<XMLDocumentParser*>(doc->parser()); + if (parser && error != WMLErrorDeckNotAccessible) { // Some errors are reported as result of an insertedIntoDocument() call. // If this happened, parsing has been stopped, and the document fragment // is wrapped in a XHTML error document. That means insertedIntoDocument() // will be called again - do NOT report the error twice, that would result // in an infinite error reporting loop. - if (!tokenizer->wellFormed()) + if (!parser->wellFormed()) return; - tokenizer->handleError(XMLTokenizer::fatal, errorMessage.latin1().data(), tokenizer->lineNumber(), tokenizer->columnNumber()); + parser->handleError(XMLDocumentParser::fatal, errorMessage.latin1().data(), parser->lineNumber(), parser->columnNumber()); } else { Frame* frame = doc->frame(); if (!frame) diff --git a/WebCore/wml/WMLTemplateElement.cpp b/WebCore/wml/WMLTemplateElement.cpp index 2537c3b..27c828c 100644 --- a/WebCore/wml/WMLTemplateElement.cpp +++ b/WebCore/wml/WMLTemplateElement.cpp @@ -98,7 +98,7 @@ void WMLTemplateElement::registerTemplatesInDocument(Document* doc) return; // Only one template element should be allowed in a document - // Calling setTemplateElement() twice on a WMLCardElement, will result in a tokenizer error. + // Calling setTemplateElement() twice on a WMLCardElement, will result in a parser error. for (unsigned i = 0; i < length; ++i) { WMLTemplateElement* temp = static_cast<WMLTemplateElement*>(nodeList->item(i)); diff --git a/WebCore/workers/DedicatedWorkerContext.idl b/WebCore/workers/DedicatedWorkerContext.idl index 8b73a06..22d3525 100644 --- a/WebCore/workers/DedicatedWorkerContext.idl +++ b/WebCore/workers/DedicatedWorkerContext.idl @@ -39,6 +39,7 @@ module threads { OmitConstructor ] DedicatedWorkerContext : WorkerContext { +#if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT [Custom] void postMessage(in any message, in [Optional] Array messagePorts) raises(DOMException); @@ -47,6 +48,8 @@ module threads { void postMessage(in DOMString message, in [Optional] MessagePort messagePort) raises(DOMException); #endif +#endif + attribute EventListener onmessage; }; diff --git a/WebCore/workers/WorkerContext.idl b/WebCore/workers/WorkerContext.idl index 8567324..902c985 100644 --- a/WebCore/workers/WorkerContext.idl +++ b/WebCore/workers/WorkerContext.idl @@ -79,6 +79,7 @@ module threads { readonly attribute [EnabledAtRuntime] NotificationCenter webkitNotifications; #endif +#if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP // Constructors attribute MessageEventConstructor MessageEvent; attribute WorkerLocationConstructor WorkerLocation; @@ -93,6 +94,7 @@ module threads { #if defined(ENABLE_WEB_SOCKETS) && ENABLE_WEB_SOCKETS attribute [JSCCustomGetter,EnabledAtRuntime] WebSocketConstructor WebSocket; // Usable with the new operator #endif +#endif }; } diff --git a/WebCore/workers/WorkerScriptLoaderClient.h b/WebCore/workers/WorkerScriptLoaderClient.h index 7004ea6..2f4569e 100644 --- a/WebCore/workers/WorkerScriptLoaderClient.h +++ b/WebCore/workers/WorkerScriptLoaderClient.h @@ -32,6 +32,8 @@ namespace WebCore { + class ResourceResponse; + class WorkerScriptLoaderClient { public: virtual void didReceiveResponse(const ResourceResponse&) { } diff --git a/WebCore/wscript b/WebCore/wscript index 62d767b..f923e87 100644 --- a/WebCore/wscript +++ b/WebCore/wscript @@ -30,6 +30,7 @@ from settings import * webcore_sources = {} if build_port == "wx": + webcore_sources['wx'] = ['platform/KillRingNone.cpp'] if building_on_win32: # make sure platform/wx comes after this so we get the right # FontPlatformData.h @@ -69,7 +70,7 @@ if build_port == "wx": 'platform/wx/wxcode/mac/carbon/fontprops.mm', 'plugins/wx/PluginDataWx.cpp', 'plugins/mac/PluginPackageMac.cpp', - 'plugins/mac/PluginViewMac.cpp' + 'plugins/mac/PluginViewMac.mm' ] else: webcore_sources['wx-gtk'] = [ diff --git a/WebCore/xml/XMLHttpRequest.cpp b/WebCore/xml/XMLHttpRequest.cpp index 5cde24d..831ada9 100644 --- a/WebCore/xml/XMLHttpRequest.cpp +++ b/WebCore/xml/XMLHttpRequest.cpp @@ -478,11 +478,7 @@ void XMLHttpRequest::send(Blob* body, ExceptionCode& ec) // FIXME: Should we set a Content-Type if one is not set. // FIXME: add support for uploading bundles. m_requestEntityBody = FormData::create(); -#if ENABLE(BLOB_SLICE) - m_requestEntityBody->appendFileRange(body->path(), body->start(), body->length(), body->modificationTime()); -#else - m_requestEntityBody->appendFile(body->path(), false); -#endif + m_requestEntityBody->appendItems(body->items()); } createRequest(ec); @@ -494,7 +490,7 @@ void XMLHttpRequest::send(DOMFormData* body, ExceptionCode& ec) return; if (m_method != "GET" && m_method != "HEAD" && m_url.protocolInHTTPFamily()) { - m_requestEntityBody = FormData::createMultiPart(*body, document()); + m_requestEntityBody = FormData::createMultiPart(body->items(), body->encoding(), document()); // We need to ask the client to provide the generated file names if needed. When FormData fills the element // for the file, it could set a flag to use the generated file name, i.e. a package file on Mac. diff --git a/WebCore/xml/XMLHttpRequest.idl b/WebCore/xml/XMLHttpRequest.idl index 3574766..58413ff 100644 --- a/WebCore/xml/XMLHttpRequest.idl +++ b/WebCore/xml/XMLHttpRequest.idl @@ -29,7 +29,9 @@ module xml { interface [ - CustomConstructor, + CanBeConstructed, + CustomConstructFunction, + V8CustomConstructor, CustomMarkFunction, EventTarget, NoStaticTables diff --git a/WebCore/xml/XSLStyleSheetLibxslt.cpp b/WebCore/xml/XSLStyleSheetLibxslt.cpp index c3feca9..10919ef 100644 --- a/WebCore/xml/XSLStyleSheetLibxslt.cpp +++ b/WebCore/xml/XSLStyleSheetLibxslt.cpp @@ -31,8 +31,8 @@ #include "Frame.h" #include "Node.h" #include "TransformSource.h" -#include "XMLTokenizer.h" -#include "XMLTokenizerScope.h" +#include "XMLDocumentParser.h" +#include "XMLDocumentParserScope.h" #include "XSLImportRule.h" #include "XSLTProcessor.h" #include "loader.h" @@ -148,7 +148,7 @@ bool XSLStyleSheet::parseString(const String& string, bool) if (Frame* frame = ownerDocument()->frame()) console = frame->domWindow()->console(); - XMLTokenizerScope scope(docLoader(), XSLTProcessor::genericErrorFunc, XSLTProcessor::parseErrorFunc, console); + XMLDocumentParserScope scope(docLoader(), XSLTProcessor::genericErrorFunc, XSLTProcessor::parseErrorFunc, console); const char* buffer = reinterpret_cast<const char*>(string.characters()); int size = string.length() * sizeof(UChar); diff --git a/WebCore/xml/XSLTProcessor.cpp b/WebCore/xml/XSLTProcessor.cpp index b530d52..97b5466 100644 --- a/WebCore/xml/XSLTProcessor.cpp +++ b/WebCore/xml/XSLTProcessor.cpp @@ -33,11 +33,11 @@ #include "FrameLoader.h" #include "FrameView.h" #include "HTMLDocument.h" -#include "HTMLTokenizer.h" // for parseHTMLDocumentFragment +#include "HTMLDocumentParser.h" // for parseHTMLDocumentFragment #include "Page.h" #include "Text.h" #include "TextResourceDecoder.h" -#include "XMLTokenizer.h" +#include "XMLDocumentParser.h" #include "loader.h" #include "markup.h" #include <wtf/Assertions.h> diff --git a/WebCore/xml/XSLTProcessorLibxslt.cpp b/WebCore/xml/XSLTProcessorLibxslt.cpp index 9c3fafd..4ac9f4c 100644 --- a/WebCore/xml/XSLTProcessorLibxslt.cpp +++ b/WebCore/xml/XSLTProcessorLibxslt.cpp @@ -35,7 +35,7 @@ #include "ResourceRequest.h" #include "ResourceResponse.h" #include "TransformSource.h" -#include "XMLTokenizer.h" +#include "XMLDocumentParser.h" #include "XSLStyleSheet.h" #include "XSLTExtensions.h" #include "XSLTUnicodeSort.h" diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog index c283bb7..77dc9cf 100644 --- a/WebKit/ChangeLog +++ b/WebKit/ChangeLog @@ -1,3 +1,56 @@ +2010-06-14 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Pavel Feldman. + + WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc + data from inspected page to WebInspector as JSON string via http. The native + serialization to JSON string is supported by InspectorValue's classes. This patch + has the implementation of sendMessageToFrontend function. WebKit version of it still + uses ScriptFunctionCall and will be switched to another transport a little bit later. + https://bugs.webkit.org/show_bug.cgi?id=40134 + + * efl/WebCoreSupport/InspectorClientEfl.cpp: + (WebCore::InspectorClientEfl::sendMessageToFrontend): + * efl/WebCoreSupport/InspectorClientEfl.h: + +2010-06-09 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r60889. + http://trac.webkit.org/changeset/60889 + https://bugs.webkit.org/show_bug.cgi?id=40365 + + gtk bot has some kind of memory corruption (Requested by + loislo on #webkit). + + * efl/WebCoreSupport/InspectorClientEfl.cpp: + * efl/WebCoreSupport/InspectorClientEfl.h: + +2010-06-07 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Pavel Feldman. + + WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc + data from inspected page to WebInspector as JSON string via http. The native + serialization to JSON string is supported by InspectorValue's classes. This patch + has the implementation of sendMessageToFrontend function. WebKit version of it still + uses ScriptFunctionCall and will be switched to another transport a little bit later. + https://bugs.webkit.org/show_bug.cgi?id=40134 + + * efl/WebCoreSupport/InspectorClientEfl.cpp: + (WebCore::InspectorClientEfl::sendMessageToFrontend): + * efl/WebCoreSupport/InspectorClientEfl.h: + +2010-06-01 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=39434 + REGRESSION (r59811): Geolocation callbacks cannot be created + + Removing unused WebGeolocationMock. + + * WebKit.xcodeproj/project.pbxproj: + 2010-05-31 Lyon Chen <liachen@rim.com> Reviewed by Kent Tamura. diff --git a/WebKit/WebKit.xcodeproj/project.pbxproj b/WebKit/WebKit.xcodeproj/project.pbxproj index d80e3aa..2972a3d 100644 --- a/WebKit/WebKit.xcodeproj/project.pbxproj +++ b/WebKit/WebKit.xcodeproj/project.pbxproj @@ -110,8 +110,6 @@ 51FDC4D30B0AF5C100F84EB3 /* WebHistoryItemPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 51FDC4D20B0AF5C100F84EB3 /* WebHistoryItemPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5241ADF50B1BC48A004012BD /* WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 5241ADF30B1BC48A004012BD /* WebCache.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5241ADF60B1BC48A004012BD /* WebCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5241ADF40B1BC48A004012BD /* WebCache.mm */; }; - 59C77F3510545F7E00506104 /* WebGeolocationMock.mm in Sources */ = {isa = PBXBuildFile; fileRef = 59C77F3310545F7E00506104 /* WebGeolocationMock.mm */; }; - 59C77F4B105471E700506104 /* WebGeolocationMockPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 59C77F4A105471E700506104 /* WebGeolocationMockPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5D7BF8140C2A1D90008CE06D /* WebInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D7BF8120C2A1D90008CE06D /* WebInspector.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5D7BF8150C2A1D90008CE06D /* WebInspector.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5D7BF8130C2A1D90008CE06D /* WebInspector.mm */; }; 5DE83A7A0D0F7F9400CAD12A /* WebJavaScriptTextInputPanel.nib in Resources */ = {isa = PBXBuildFile; fileRef = 5DE83A740D0F7F9400CAD12A /* WebJavaScriptTextInputPanel.nib */; }; @@ -510,8 +508,6 @@ 51FDC4D20B0AF5C100F84EB3 /* WebHistoryItemPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebHistoryItemPrivate.h; sourceTree = "<group>"; }; 5241ADF30B1BC48A004012BD /* WebCache.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCache.h; sourceTree = "<group>"; }; 5241ADF40B1BC48A004012BD /* WebCache.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCache.mm; sourceTree = "<group>"; }; - 59C77F3310545F7E00506104 /* WebGeolocationMock.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebGeolocationMock.mm; sourceTree = "<group>"; }; - 59C77F4A105471E700506104 /* WebGeolocationMockPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGeolocationMockPrivate.h; sourceTree = "<group>"; }; 5D7BF8120C2A1D90008CE06D /* WebInspector.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebInspector.h; sourceTree = "<group>"; }; 5D7BF8130C2A1D90008CE06D /* WebInspector.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebInspector.mm; sourceTree = "<group>"; }; 5DE83A750D0F7F9400CAD12A /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/WebJavaScriptTextInputPanel.nib; sourceTree = SOURCE_ROOT; }; @@ -1234,8 +1230,6 @@ 931633EE0AEDFFAE0062B92D /* WebFrameLoaderClient.mm */, BC7F884910C8775A00D6133D /* WebGeolocationControllerClient.h */, BC7F884A10C8775A00D6133D /* WebGeolocationControllerClient.mm */, - 59C77F3310545F7E00506104 /* WebGeolocationMock.mm */, - 59C77F4A105471E700506104 /* WebGeolocationMockPrivate.h */, 51494CD40C7EBDE0004178C5 /* WebIconDatabaseClient.h */, 51494CD50C7EBDE0004178C5 /* WebIconDatabaseClient.mm */, 9CE1F8A302A5C6F30ECA2ACD /* WebImageRendererFactory.m */, @@ -1414,7 +1408,6 @@ 9398106F0824BF01008DF038 /* WebFrameViewInternal.h in Headers */, 939810AF0824BF01008DF038 /* WebFrameViewPrivate.h in Headers */, BC7F884B10C8775A00D6133D /* WebGeolocationControllerClient.h in Headers */, - 59C77F4B105471E700506104 /* WebGeolocationMockPrivate.h in Headers */, BC7F889E10C9D30C00D6133D /* WebGeolocationPosition.h in Headers */, BC7F88A510C9D88B00D6133D /* WebGeolocationPositionInternal.h in Headers */, 939810120824BF01008DF038 /* WebHistory.h in Headers */, @@ -1813,7 +1806,6 @@ 931633EF0AEDFFAE0062B92D /* WebFrameLoaderClient.mm in Sources */, 939811060824BF01008DF038 /* WebFrameView.mm in Sources */, BC7F884C10C8775A00D6133D /* WebGeolocationControllerClient.mm in Sources */, - 59C77F3510545F7E00506104 /* WebGeolocationMock.mm in Sources */, BC7F889F10C9D30C00D6133D /* WebGeolocationPosition.mm in Sources */, 939811130824BF01008DF038 /* WebHistory.mm in Sources */, 939810BD0824BF01008DF038 /* WebHistoryItem.mm in Sources */, diff --git a/WebKit/cf/ChangeLog b/WebKit/cf/ChangeLog index 1f59dec..957dce1 100644 --- a/WebKit/cf/ChangeLog +++ b/WebKit/cf/ChangeLog @@ -1,3 +1,45 @@ +2010-06-14 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Pavel Feldman. + + WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc + data from inspected page to WebInspector as JSON string via http. The native + serialization to JSON string is supported by InspectorValue's classes. This patch + has the implementation of sendMessageToFrontend function. WebKit version of it still + uses ScriptFunctionCall and will be switched to another transport a little bit later. + https://bugs.webkit.org/show_bug.cgi?id=40134 + + * WebCoreSupport/WebInspectorClientCF.cpp: + (WebInspectorClient::releaseFrontendPage): + (WebInspectorClient::sendMessageToFrontend): + +2010-06-09 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r60889. + http://trac.webkit.org/changeset/60889 + https://bugs.webkit.org/show_bug.cgi?id=40365 + + gtk bot has some kind of memory corruption (Requested by + loislo on #webkit). + + * WebCoreSupport/WebInspectorClientCF.cpp: + (WebInspectorClient::storeSetting): + +2010-06-07 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Pavel Feldman. + + WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc + data from inspected page to WebInspector as JSON string via http. The native + serialization to JSON string is supported by InspectorValue's classes. This patch + has the implementation of sendMessageToFrontend function. WebKit version of it still + uses ScriptFunctionCall and will be switched to another transport a little bit later. + https://bugs.webkit.org/show_bug.cgi?id=40134 + + * WebCoreSupport/WebInspectorClientCF.cpp: + (WebInspectorClient::releaseFrontendPage): + (WebInspectorClient::sendMessageToFrontend): + 2010-01-07 Alexey Proskuryakov <ap@apple.com> Reviewed by Geoffrey Garen. diff --git a/WebKit/cf/WebCoreSupport/WebInspectorClientCF.cpp b/WebKit/cf/WebCoreSupport/WebInspectorClientCF.cpp index 0d66b83..dc5a186 100644 --- a/WebKit/cf/WebCoreSupport/WebInspectorClientCF.cpp +++ b/WebKit/cf/WebCoreSupport/WebInspectorClientCF.cpp @@ -53,6 +53,8 @@ #include <CoreFoundation/CoreFoundation.h> +#include <WebCore/Frame.h> +#include <WebCore/Page.h> #include <WebCore/PlatformString.h> #include <wtf/RetainPtr.h> @@ -92,3 +94,28 @@ void WebInspectorClient::storeSetting(const String& key, const String& setting) RetainPtr<CFStringRef> preferencesKey(AdoptCF, createKeyForPreferences(key)); CFPreferencesSetAppValue(preferencesKey.get(), objectToStore.get(), kCFPreferencesCurrentApplication); } + +void WebInspectorClient::releaseFrontendPage() +{ + m_frontendPage = 0; +} + +bool WebInspectorClient::sendMessageToFrontend(const String& message) +{ + if (!m_frontendPage) + return false; + + Frame* frame = m_frontendPage->mainFrame(); + if (!frame) + return false; + + ScriptController* scriptController = frame->script(); + if (!scriptController) + return false; + + String dispatchToFrontend("WebInspector.dispatchMessageFromBackend("); + dispatchToFrontend += message; + dispatchToFrontend += ");"; + scriptController->executeScript(dispatchToFrontend); + return true; +} diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog index 50ae8ae..452c79d 100644 --- a/WebKit/chromium/ChangeLog +++ b/WebKit/chromium/ChangeLog @@ -1,3 +1,803 @@ +2010-06-14 Jeremy Orlow <jorlow@chromium.org> + + Build fix. + + * src/IDBCallbacksProxy.h: + +2010-06-14 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Pavel Feldman. + + WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc + data from inspected page to WebInspector as JSON string via http. The native + serialization to JSON string is supported by InspectorValue's classes. This patch + has the implementation of sendMessageToFrontend function. WebKit version of it still + uses ScriptFunctionCall and will be switched to another transport a little bit later. + https://bugs.webkit.org/show_bug.cgi?id=40134 + + * src/InspectorClientImpl.cpp: + (WebKit::InspectorClientImpl::sendMessageToFrontend): + * src/InspectorClientImpl.h: + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::setInspectorFrontendProxyToInspectorController): + +2010-06-13 Tony Chang <tony@chromium.org> + + Build fix, not reviewed. + + fix chromium compile after r61094 (id attribute refactor) + https://bugs.webkit.org/show_bug.cgi?id=40553 + + * src/ChromeClientImpl.cpp: + * src/WebFormControlElement.cpp: + (WebKit::WebFormControlElement::nameForAutofill): + +2010-06-13 Andras Becsi <abecsi@inf.u-szeged.hu> + + Reviewed by Darin Adler. + + Centralize the gperf code generation commands into make-hash-tools.pl + to avoid redundancy across multiple build systems. + Do this in preparation of refactoring the usage of these generated + sources to fix the debug linking error on Linux with gcc >= 4.4.0. + + webkit.org/b/29244 + + * src/WebEntities.cpp: + +2010-06-11 Eric Seidel <eric@webkit.org> + + Reviewed by Adam Barth. + + Rename the rest of the *Tokenizer classes to *DocumentParser + https://bugs.webkit.org/show_bug.cgi?id=40507 + + * src/WebEntities.cpp: + - Fix a comment to match new class names. + +2010-06-12 Evan Stade <estade@chromium.org> + + Reviewed by Eric Seidel. + + [chromium] Menu key should act on current selection even if it is not editable + https://bugs.webkit.org/show_bug.cgi?id=40348 + + Allow the menu key to act on non-editable selections. + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::sendContextMenuEvent): + +2010-06-11 James Hawkins <jhawkins@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Notify the WebView when the AutoFill popup hides. + + https://bugs.webkit.org/show_bug.cgi?id=40459 + + * src/AutoFillPopupMenuClient.cpp: + (WebKit::AutoFillPopupMenuClient::selectionCleared): + +2010-06-11 Tony Gentilcore <tonyg@chromium.org> + + Reviewed by Dimitri Glazkov. + + Roll chromium DEPS 49376:49521 + https://bugs.webkit.org/show_bug.cgi?id=40488 + + * DEPS: + +2010-06-10 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Steve Block. + + Implement more of IndexedDB's Indexes and ObjectStores + https://bugs.webkit.org/show_bug.cgi?id=40424 + + Add plumbing for both of these classes. + + * public/WebIDBDatabase.h: + (WebKit::WebIDBDatabase::name): + (WebKit::WebIDBDatabase::description): + (WebKit::WebIDBDatabase::version): + (WebKit::WebIDBDatabase::objectStores): + (WebKit::WebIDBDatabase::objectStore): + (WebKit::WebIDBDatabase::removeObjectStore): + * public/WebIDBObjectStore.h: + (WebKit::WebIDBObjectStore::indexNames): + (WebKit::WebIDBObjectStore::createIndex): + (WebKit::WebIDBObjectStore::index): + (WebKit::WebIDBObjectStore::removeIndex): + * src/IDBDatabaseProxy.cpp: + (WebCore::IDBDatabaseProxy::name): + (WebCore::IDBDatabaseProxy::description): + (WebCore::IDBDatabaseProxy::version): + (WebCore::IDBDatabaseProxy::objectStores): + (WebCore::IDBDatabaseProxy::objectStore): + (WebCore::IDBDatabaseProxy::removeObjectStore): + * src/IDBDatabaseProxy.h: + * src/IDBObjectStoreProxy.cpp: + (WebCore::IDBObjectStoreProxy::indexNames): + (WebCore::IDBObjectStoreProxy::createIndex): + (WebCore::IDBObjectStoreProxy::index): + (WebCore::IDBObjectStoreProxy::removeIndex): + * src/IDBObjectStoreProxy.h: + * src/WebIDBDatabaseImpl.cpp: + (WebKit::WebIDBDatabaseImpl::WebIDBDatabaseImpl): + (WebKit::WebIDBDatabaseImpl::name): + (WebKit::WebIDBDatabaseImpl::description): + (WebKit::WebIDBDatabaseImpl::version): + (WebKit::WebIDBDatabaseImpl::objectStores): + (WebKit::WebIDBDatabaseImpl::createObjectStore): + (WebKit::WebIDBDatabaseImpl::objectStore): + (WebKit::WebIDBDatabaseImpl::removeObjectStore): + * src/WebIDBDatabaseImpl.h: + * src/WebIDBObjectStoreImpl.cpp: + (WebKit::WebIDBObjectStoreImpl::WebIDBObjectStoreImpl): + (WebKit::WebIDBObjectStoreImpl::name): + (WebKit::WebIDBObjectStoreImpl::keyPath): + (WebKit::WebIDBObjectStoreImpl::indexNames): + (WebKit::WebIDBObjectStoreImpl::createIndex): + (WebKit::WebIDBObjectStoreImpl::index): + (WebKit::WebIDBObjectStoreImpl::removeIndex): + * src/WebIDBObjectStoreImpl.h: + +2010-06-11 Alexander Pavlov <apavlov@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: Enable serialization/deserialization of the frontend state + https://bugs.webkit.org/show_bug.cgi?id=40228 + + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + +2010-06-10 Søren Gjesse <sgjesse@chromium.org> + + Reviewed by Pavel Feldman. + + V8: Chromium test expectations not matching improved V8 JavaScript stepping + https://bugs.webkit.org/show_bug.cgi?id=40419 + + Update test expetations to match chaged V8 break locations. + + * src/js/Tests.js: + +2010-06-10 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: Port performSearch from InjectedScript to InspectorDOMAgent. + + https://bugs.webkit.org/show_bug.cgi?id=40422 + + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + +2010-06-11 Vangelis Kokkevis <vangelis@chromium.org> + + Reviewed by David Levin. + + [chromium] Adding a build dependency to the gles2 C library to the webkit_unit_tests + project to allow it to link when WebCore is compiled with the ACCELERATED_COMPOSITING + flag. + https://bugs.webkit.org/show_bug.cgi?id=40341 + + * WebKit.gyp: + +2010-06-10 Kent Tamura <tkent@chromium.org> + + Reviewed by Dimitri Glazkov. + + [DRT/Chromium] Support plugin tests + https://bugs.webkit.org/show_bug.cgi?id=40413 + + * DEPS: + Bump the Chromium revision to r49376 to have a npapi_layout_test_plugin + change and Linux <progress> resources. + Add third_party/mesa because app/ depends on them + since r49332. + * WebKit.gyp: + Copy a plugin binary for DRT to recognize it. + +2010-06-10 James Hawkins <jhawkins@chromium.org> + + Not reviwed. + + Build fix for Chromium Mac Release. + + * src/AutoFillPopupMenuClient.cpp: + (WebKit::AutoFillPopupMenuClient::getSuggestion): + (WebKit::AutoFillPopupMenuClient::valueChanged): + (WebKit::AutoFillPopupMenuClient::selectionChanged): + (WebKit::AutoFillPopupMenuClient::itemIsSeparator): + +2010-06-09 James Hawkins <jhawkins@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Add the ability to specify a separator in + AutoFillPopupMenuClient. + + https://bugs.webkit.org/show_bug.cgi?id=40397 + + * public/WebViewClient.h: + (WebKit::WebViewClient::didAcceptAutoFillSuggestion): + * src/AutoFillPopupMenuClient.cpp: + (WebKit::AutoFillPopupMenuClient::getSuggestionsCount): + (WebKit::AutoFillPopupMenuClient::getSuggestion): + (WebKit::AutoFillPopupMenuClient::valueChanged): + (WebKit::AutoFillPopupMenuClient::selectionChanged): + (WebKit::AutoFillPopupMenuClient::itemIsSeparator): + (WebKit::AutoFillPopupMenuClient::initialize): + (WebKit::AutoFillPopupMenuClient::setSuggestions): + * src/AutoFillPopupMenuClient.h: + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::applyAutoFillSuggestions): + * src/WebViewImpl.h: + +2010-06-10 Dmitry Titov <dimich@chromium.org> + + Not reviewed, Chromium build fix from Abhishek Arya. + + * src/WebImageCG.cpp: + (WebKit::WebImage::WebImage): + (WebKit::WebImage::operator=): + +2010-06-10 Abhishek Arya <inferno@chromium.org> + + Reviewed by Dimitri Glazkov. + + Add null pointer checks for nativeImageForCurrentFrame + function calls. + https://bugs.webkit.org/show_bug.cgi?id=39797 + + * src/WebImageCG.cpp: + (WebKit::WebImage::WebImage): + (WebKit::WebImage::operator=): + +2010-06-10 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: to reduce the front end start up time don't push script + sources to frontend if debugger is always enabled, instead request + script content lazily at the moment it should be displyed. It is critical for + always enabled debugger because in that case lots of script may have + already been parsed when the front end is opening and pushing all + of them at once may slow things down(even though the script sources will never + be used if scripts panel isn't open). + https://bugs.webkit.org/show_bug.cgi?id=40364 + + * src/js/DevTools.js: + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + (.devtools.InspectorBackendImpl.prototype.getScriptSource): + +2010-06-10 Mike Belshe <mbelshe@google.com> + + Reviewed by David Levin + + Track whether a resource is loaded via a proxy. + + https://bugs.webkit.org/show_bug.cgi?id=40312 + + * public/WebURLResponse.h: + * src/WebURLResponse.cpp: + (WebKit::WebURLResponse::wasFetchedViaProxy): + (WebKit::WebURLResponse::setWasFetchedViaProxy): + +2010-06-10 Vangelis Kokkevis <vangelis@chromium.org> + + Reviewed by Dimitri Glazkov. + + [chromium] Adding the ANGLE project to the DEPS file as it's required + by the gpu-accelerated compositor. + https://bugs.webkit.org/show_bug.cgi?id=40379 + + * DEPS: + +2010-06-09 Bo Liu <boliu@chromium.org> + + Reviewed by David Levin. + + [Chromium] Pass <video> full screen calls to Chromium port client + https://bugs.webkit.org/show_bug.cgi?id=40317 + + * public/WebViewClient.h: + (WebKit::WebViewClient::supportsFullscreen): + (WebKit::WebViewClient::enterFullscreenForNode): + (WebKit::WebViewClient::exitFullscreenForNode): + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::supportsFullscreenForNode): + (WebKit::ChromeClientImpl::enterFullscreenForNode): + (WebKit::ChromeClientImpl::exitFullscreenForNode): + * src/ChromeClientImpl.h: + +2010-06-09 Kenneth Russell <kbr@google.com> + + Reviewed by Dimitri Glazkov. + + Rename FloatArray to Float32Array + https://bugs.webkit.org/show_bug.cgi?id=40323 + + Used do-webcore-rename to perform renaming. Manually undid + incorrect changes to WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp, + WebCore/manual-tests/resources/ArrayParameterTestApplet.java and + ArrayParameterTestApplet.class. Updated LayoutTests. Built and ran + all layout tests on Safari; built Chromium and ran selected WebGL + tests. + + * src/GraphicsContext3D.cpp: + +2010-06-09 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r60889. + http://trac.webkit.org/changeset/60889 + https://bugs.webkit.org/show_bug.cgi?id=40365 + + gtk bot has some kind of memory corruption (Requested by + loislo on #webkit). + + * src/InspectorClientImpl.cpp: + * src/InspectorClientImpl.h: + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::setInspectorFrontendProxyToInspectorController): + +2010-06-09 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: retreive debugger script source synchronously when + frontend is attached. We need this to be able to stop on top-level + breakpoints. + https://bugs.webkit.org/show_bug.cgi?id=40289 + + * WebKit.gypi: + * src/DebuggerAgent.h: + * src/DebuggerAgentImpl.cpp: + * src/DebuggerAgentImpl.h: + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::createInspectorFrontendProxy): + * src/js/DebuggerScript.js: + * src/js/DevTools.js: + (WebInspector.loaded): + * src/js/DevToolsHostStub.js: + +2010-06-07 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Pavel Feldman. + + WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc + data from inspected page to WebInspector as JSON string via http. The native + serialization to JSON string is supported by InspectorValue's classes. This patch + has the implementation of sendMessageToFrontend function. WebKit version of it still + uses ScriptFunctionCall and will be switched to another transport a little bit later. + https://bugs.webkit.org/show_bug.cgi?id=40134 + + * src/InspectorClientImpl.cpp: + (WebKit::InspectorClientImpl::sendMessageToFrontend): + * src/InspectorClientImpl.h: + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::setInspectorFrontendProxyToInspectorController): + +2010-06-09 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: update stack trace after script source editing + https://bugs.webkit.org/show_bug.cgi?id=40357 + + * src/js/DebuggerAgent.js: + (devtools.DebuggerAgent.prototype.editScriptSource.this.requestSeqToCallback_.cmd.getSequenceNumber): + (devtools.DebuggerAgent.prototype.editScriptSource.requestBacktrace): + (devtools.DebuggerAgent.prototype.editScriptSource.handleBacktraceResponse): + (devtools.DebuggerAgent.prototype.editScriptSource.reportDidCommitEditing): + (devtools.DebuggerAgent.prototype.editScriptSource): + (devtools.DebuggerAgent.prototype.requestBacktrace_): + (devtools.DebuggerAgent.prototype.handleDebuggerOutput_): + (devtools.DebuggerAgent.prototype.doHandleBacktraceResponse_): + (devtools.DebuggerAgent.prototype.updateCallFramesFromBacktraceResponse_): + * src/js/InspectorControllerImpl.js: + (.devtools.InspectorBackendImpl.prototype.editScriptSource): + +2010-06-08 Tony Chang <tony@chromium.org> + + Reviewed by David Levin. + + [chromium] compile linux chromium in WebKit/out instead of WebKit/WebKit/chromium/out + https://bugs.webkit.org/show_bug.cgi?id=40285 + + Take 2 at landing this patch, this time rolling DEPS just a bit + further to pick up some chromium fixes. + + * DEPS + * gyp_webkit: + +2010-06-08 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r60878. + http://trac.webkit.org/changeset/60878 + https://bugs.webkit.org/show_bug.cgi?id=40349 + + broke linux build (Requested by tony^work on #webkit). + + * DEPS: + * gyp_webkit: + +2010-06-08 Tony Chang <tony@chromium.org> + + Reviewed by David Levin. + + [chromium] compile linux chromium in WebKit/out instead of WebKit/WebKit/chromium/out + https://bugs.webkit.org/show_bug.cgi?id=40285 + + * gyp_webkit: + +2010-06-08 Tony Chang <tony@chromium.org> + + Not reviewed, build fix. + + [chromium] fix linux compile + https://bugs.webkit.org/show_bug.cgi?id=40343 + + * DEPS: + +2010-06-08 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: extend ScriptDebugServer to support script source editing + https://bugs.webkit.org/show_bug.cgi?id=40297 + + * src/js/DebuggerAgent.js: + (devtools.ScriptInfo.prototype.worldType): + * src/js/DebuggerScript.js: + (debuggerScriptConstructor.DebuggerScript.editScriptSource): + * src/js/DevTools.js: + (WebInspector.loaded): + * src/js/InspectorControllerImpl.js: + (devtools.InspectorBackendImpl): + +2010-06-08 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Ojan Vafai and Darin Adler. + + Refactor platform dependent editing behavior code out of Settings + https://bugs.webkit.org/show_bug.cgi?id=39854 + + EditingBehavior enum was renamed to EditingBehaviorTypes and moved out from Settings.h to + EditingBehaviorTypes.h . Call sites in WebKit/ adjusted accordingly. + + * src/WebSettingsImpl.cpp: + (WebKit::WebSettingsImpl::setEditingBehavior): +2010-06-07 Tony Chang <tony@chromium.org> + + Reviewed by Kent Tamura. + + [chromium] roll chromium DEPS + https://bugs.webkit.org/show_bug.cgi?id=40277 + + * DEPS: + +2010-06-07 Kinuko Yasuda <kinuko@chromium.org> + + Reviewed by Jian Li. + + Refactor FormData and Blob for better support of Blobs synthesized by BlobBuilder. + https://bugs.webkit.org/show_bug.cgi?id=39083 + + Replace FormDataList::Item list with BlobItemList to get it compiled + with the refactoring in FormDataList. + + * src/WebSearchableFormData.cpp: + (WebCore::HasSuitableTextElement): + +2010-06-07 Andrei Popescu <andreip@google.com> + + Reviewed by Jeremy Orlow. + + [indexedDB] It is impossible to create object stores + https://bugs.webkit.org/show_bug.cgi?id=40054 + + * WebKit.gyp: + * public/WebIDBCallbacks.h: + (WebKit::WebIDBCallbacks::onSuccess): + * public/WebIDBDatabase.h: + (WebKit::WebIDBDatabase::createObjectStore): + * public/WebIDBObjectStore.h: Added. + (WebKit::WebIDBObjectStore::~WebIDBObjectStore): + (WebKit::WebIDBObjectStore::name): + (WebKit::WebIDBObjectStore::keyPath): + * src/IDBCallbacksProxy.cpp: + (WebCore::IDBCallbacksProxy::onSuccess): + * src/IDBCallbacksProxy.h: + * src/IDBDatabaseProxy.cpp: + (WebCore::IDBDatabaseProxy::createObjectStore): + * src/IDBDatabaseProxy.h: + * src/IDBObjectStoreProxy.cpp: Added. + (WebCore::IDBObjectStoreProxy::create): + (WebCore::IDBObjectStoreProxy::IDBObjectStoreProxy): + (WebCore::IDBObjectStoreProxy::~IDBObjectStoreProxy): + (WebCore::IDBObjectStoreProxy::name): + (WebCore::IDBObjectStoreProxy::keyPath): + (WebCore::IDBObjectStoreProxy::indexNames): + (WebCore::IDBObjectStoreProxy::createIndex): + (WebCore::IDBObjectStoreProxy::index): + (WebCore::IDBObjectStoreProxy::removeIndex): + * src/IDBObjectStoreProxy.h: Added. + * src/IndexedDatabaseProxy.cpp: + (WebCore::IndexedDatabaseProxy::open): + * src/WebIDBCallbacksImpl.cpp: + (WebCore::WebIDBCallbacksImpl::onSuccess): + * src/WebIDBCallbacksImpl.h: + * src/WebIDBDatabaseImpl.cpp: + (WebKit::WebIDBDatabaseImpl::createObjectStore): + * src/WebIDBDatabaseImpl.h: + * src/WebIDBObjectStoreImpl.cpp: Added. + (WebKit::WebIDBObjectStoreImpl::WebIDBObjectStoreImpl): + (WebKit::WebIDBObjectStoreImpl::~WebIDBObjectStoreImpl): + (WebKit::WebIDBObjectStoreImpl::name): + (WebKit::WebIDBObjectStoreImpl::keyPath): + * src/WebIDBObjectStoreImpl.h: Added. + * src/WebIndexedDatabaseImpl.cpp: + (WebKit::WebIndexedDatabaseImpl::open): + +2010-06-07 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: should be possible to distinguish extension scripts from main world scripts + https://bugs.webkit.org/show_bug.cgi?id=40220 + + * src/js/DebuggerAgent.js: + (devtools.DebuggerAgent.prototype.initUI): + (devtools.DebuggerAgent.prototype.addScriptInfo_): + (devtools.DebuggerAgent.prototype.formatCallFrame_): + (devtools.ScriptInfo.prototype.worldType): + * src/js/DebuggerScript.js: + (debuggerScriptConstructor.DebuggerScript.getScripts): use only context id without context type + when filtering scripts so that extension scripts are also included. + (debuggerScriptConstructor.DebuggerScript._formatScript): + * src/js/devTools.css: + +2010-06-04 Jay Civelli <jcivelli@chromium.org> + + Reviewed by Dimitri Glazkov. + + Accessibility focus change notifications are now sent from + ChromeClientImpl::focusedNodeChanged(). + https://bugs.webkit.org/show_bug.cgi?id=39792 + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::focus): + (WebKit::ChromeClientImpl::focusedNodeChanged): + +2010-06-04 Jay Civelli <jcivelli@chromium.org> + + Reviewed by David Levin. + + [chromium] Adding support for the left and right Windows keys to the + NativeWebKeyboardEvent. + https://bugs.webkit.org/show_bug.cgi?id=39752 + + * src/gtk/WebInputEventFactory.cpp: + (WebKit::gdkEventToWindowsKeyCode): + +2010-06-04 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: Create resource for DebuggerScript.js. + https://bugs.webkit.org/show_bug.cgi?id=40122 + + * WebKit.grd: + * public/WebDevToolsAgentClient.h: + (WebKit::WebDevToolsAgentClient::debuggerScriptSource): + +2010-05-26 MORITA Hajime <morrita@google.com> + + Reviewed by Jian Li. + + [Chromium] Dragging over an element with scrollbars should scroll the element when dragging near edges + https://bugs.webkit.org/show_bug.cgi?id=39725 + + Added WebViewImpl::scrollForDragging() to handle scroll-on-drag. + Note that this change handes both source and destination cases. + + * public/WebView.h: + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::dragSourceMovedTo): + (WebKit::WebViewImpl::dragTargetDragEnterOrOver): + (WebKit::WebViewImpl::scrollForDragging): + * src/WebViewImpl.h: + +2010-06-03 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + [v8] Web Inspector: show "Object" as description for values with anonymous constructor + https://bugs.webkit.org/show_bug.cgi?id=40121 + + * src/js/DevTools.js: don't call DebuggerAgent methods if ScriptDebugServer is used. + +2010-06-03 Kent Tamura <tkent@chromium.org> + + Reviewed by Dimitri Glazkov. + + [DRT/Chromium] Checking out lighttpd + https://bugs.webkit.org/show_bug.cgi?id=39948 + + - Add lighttpd only on Windows. It is used by new-run-webkit-tests. + - Add libvpx. + - Remove pthreads-win32 from DEPS. + It has not been used since Chromium r28642. + - Update Chromium revision to use Windows resource query code and + webkit_glue dependency fix. + + * DEPS: + +2010-06-02 Tony Chang <tony@chromium.org> + + Reviewed by Kent Tamura. + + [chromium] refactor WebKit.gyp's DRT section so the conditions are less messy + https://bugs.webkit.org/show_bug.cgi?id=40104 + + * WebKit.gyp: + +2010-06-02 Tony Chang <tony@chromium.org> + + Not reviewed, build fix in downstream chromium. + + Fix the path to repack.py so it works in a chromium checkout too. + + * WebKit.gyp: + +2010-06-02 Tony Chang <tony@chromium.org> + + Reviewed by Kent Tamura. + + [chromium] generate DumpRenderTree.pak on DRT linux + https://bugs.webkit.org/show_bug.cgi?id=40098 + + * WebKit.gyp: + +2010-06-02 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r60592. + http://trac.webkit.org/changeset/60592 + https://bugs.webkit.org/show_bug.cgi?id=40099 + + broke the build, need to coordiate updating DEPS (Requested by + tony^work on #webkit). + + * DEPS: + * public/WebMediaPlayer.h: + +2010-06-02 Victoria Kirst <vrk@google.com> + + Reviewed by David Levin. + + Modifying the WebMediaPlayer interface to be compatible with + a change in chrome. + This is a part 2 of 3 one-sided changes to chrome and WebKit. Chrome + has been updated, so this commit should NOT break chromium anymore. + https://bugs.webkit.org/show_bug.cgi?id=39445 + + * DEPS: Updated to a newer chrome revision number. + * public/WebMediaPlayer.h: Changed buffered() to be non-const. + +2010-06-02 Peter Kasting <pkasting@google.com> + + Unreviewed, emergency fix for test crashes (verbal r+ beforehand from + John Gregg). + + Temporarily make notificationObjectDestroyed() a no-op to avoid an + ASSERT failure. + + https://bugs.webkit.org/show_bug.cgi?id=40097 + + * src/NotificationPresenterImpl.cpp: + (WebKit::NotificationPresenterImpl::notificationObjectDestroyed): + +2010-06-02 Sterling Swigart <sswigart@google.com> + + Reviewed by David Levin. + + Image Resizer Patch 0: Added compilation argument to conditionally compile pending patches. + https://bugs.webkit.org/show_bug.cgi?id=39906 + + * features.gypi: + +2010-06-01 James Hawkins <jhawkins@chromium.org> + + UNREVIEWED: build fix. + + Implement the added virtual methods from PopupMenuClient to + TestPopupMenuClient. + + * tests/PopupMenuTest.cpp: + (WebKit::TestPopupMenuClient::selectionChanged): + (WebKit::TestPopupMenuClient::selectionCleared): + +2010-05-24 James Hawkins <jhawkins@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Implement new PopupMenuClient methods selectionChanged() + and selectionCleared(). Expose placeHolder methods and isAutoFilled() + in WebInputElement. + + https://bugs.webkit.org/show_bug.cgi?id=39639 + + * public/WebInputElement.h: + * public/WebViewClient.h: + (WebKit::WebViewClient::didSelectAutoFillSuggestion): + (WebKit::WebViewClient::didClearAutoFillSelection): + * src/AutoFillPopupMenuClient.cpp: + (WebKit::AutoFillPopupMenuClient::selectionChanged): + (WebKit::AutoFillPopupMenuClient::selectionCleared): + (WebKit::AutoFillPopupMenuClient::popupDidHide): + * src/AutoFillPopupMenuClient.h: + * src/SuggestionsPopupMenuClient.h: + (WebKit::SuggestionsPopupMenuClient::selectionChanged): + (WebKit::SuggestionsPopupMenuClient::selectionCleared): + * src/WebInputElement.cpp: + (WebKit::WebInputElement::setPlaceholder): + (WebKit::WebInputElement::placeholder): + (WebKit::WebInputElement::isAutofilled): + +2010-06-01 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r60483. + http://trac.webkit.org/changeset/60483 + https://bugs.webkit.org/show_bug.cgi?id=40013 + + Breaks Mac and Linux builds (Requested by antonm on #webkit). + + * DEPS: + +2010-06-01 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Darin Fisher. + + IndexedDB cleanup + https://bugs.webkit.org/show_bug.cgi?id=40007 + + Remove the exception code paramter (that hasn't been used for a while). + Add asserts to default implementations. + + * public/WebIDBDatabase.h: + (WebKit::WebIDBDatabase::name): + (WebKit::WebIDBDatabase::description): + (WebKit::WebIDBDatabase::version): + (WebKit::WebIDBDatabase::objectStores): + * public/WebIndexedDatabase.h: + (WebKit::WebIndexedDatabase::open): + * src/WebIndexedDatabaseImpl.cpp: + (WebKit::WebIndexedDatabaseImpl::open): + * src/WebIndexedDatabaseImpl.h: + +2010-06-01 Anton Muhin <antonm@chromium.org> + + Reviewed by Dimitri Glazkov. + + Rolling Chromium revision to bring recent changes to V8. + + * DEPS: + +2010-06-01 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r60470. + http://trac.webkit.org/changeset/60470 + https://bugs.webkit.org/show_bug.cgi?id=39990 + + Need to rollout until bot can be updated (Requested by jorlow + on #webkit). + + * DEPS: + 2010-05-31 Pavel Podivilov <podivilov@chromium.org> Reviewed by Pavel Feldman. diff --git a/WebKit/chromium/DEPS b/WebKit/chromium/DEPS index c633a79..973e78d 100644 --- a/WebKit/chromium/DEPS +++ b/WebKit/chromium/DEPS @@ -32,9 +32,7 @@ vars = { 'chromium_svn': 'http://src.chromium.org/svn/trunk/src', - 'chromium_rev': '47248', - - 'pthreads-win32_rev': '26716', + 'chromium_rev': '49521', } deps = { @@ -82,7 +80,7 @@ deps = { 'googleurl': From('chromium_deps', 'src/googleurl'), - # webkit dependencis + # webkit dependencies 'webkit': Var('chromium_svn')+'/webkit@'+Var('chromium_rev'), 'app': @@ -91,10 +89,18 @@ deps = { Var('chromium_svn')+'/gpu@'+Var('chromium_rev'), 'media': Var('chromium_svn')+'/media@'+Var('chromium_rev'), + 'third_party/angle': # needed by the gpu process + From('chromium_deps', 'src/third_party/angle'), 'third_party/glew': # webgl related Var('chromium_svn')+'/third_party/glew@'+Var('chromium_rev'), 'third_party/ffmpeg': # needed by webkit/media - Var('chromium_svn')+'/third_party/ffmpeg@'+Var('chromium_rev'), + From('chromium_deps', 'src/third_party/ffmpeg'), + 'third_party/libvpx/include': + From('chromium_deps', 'src/third_party/libvpx/include'), + 'third_party/libvpx/lib': + From('chromium_deps', 'src/third_party/libvpx/lib'), + 'third_party/mesa': + Var('chromium_svn')+'/third_party/mesa@'+Var('chromium_rev'), 'third_party/yasm': # needed by ffmpeg Var('chromium_svn')+'/third_party/yasm@'+Var('chromium_rev'), 'third_party/openmax': # needed by webkit/media @@ -147,8 +153,8 @@ deps = { 'third_party/zlib': Var('chromium_svn')+'/third_party/zlib@'+Var('chromium_rev'), - 'third_party/ffmpeg/source/patched-ffmpeg-mt': - From('chromium_deps', 'src/third_party/ffmpeg/source/patched-ffmpeg-mt'), + 'third_party/mozilla': + Var('chromium_svn')+'/third_party/mozilla@'+Var('chromium_rev'), } deps_os = { @@ -159,9 +165,8 @@ deps_os = { From('chromium_deps', 'src/third_party/python_24'), 'third_party/ffmpeg/binaries/chromium/win/ia32': From('chromium_deps', 'src/third_party/ffmpeg/binaries/chromium/win/ia32'), - 'third_party/pthreads-win32': - 'http://src.chromium.org/svn/trunk/deps/third_party/pthreads-win32@'+Var('pthreads-win32_rev'), - # base.gypi depends on nss on Windows + 'third_party/lighttpd': + From('chromium_deps', 'src/third_party/lighttpd'), 'third_party/nss': From('chromium_deps', 'src/third_party/nss'), 'third_party/wtl': @@ -171,6 +176,8 @@ deps_os = { # needed by ffmpeg 'third_party/yasm/source/patched-yasm': From('chromium_deps', 'src/third_party/yasm/source/patched-yasm'), + 'third_party/nss': + From('chromium_deps', 'src/third_party/nss'), }, 'unix': { # Linux, actually. diff --git a/WebKit/chromium/WebKit.grd b/WebKit/chromium/WebKit.grd index a0783d7..1f80034 100644 --- a/WebKit/chromium/WebKit.grd +++ b/WebKit/chromium/WebKit.grd @@ -9,6 +9,7 @@ </outputs> <release seq="1"> <includes> + <include name="IDR_DEVTOOLS_DEBUGGER_SCRIPT_JS" file="src\js\DebuggerScript.js" type="BINDATA"/> <include name="IDR_DEVTOOLS_INJECT_DISPATCH_JS" file="src\js\InjectDispatch.js" type="BINDATA"/> <include name="IDR_DEVTOOLS_INJECT_WEBKIT_JS" file="..\..\WebCore\inspector\front-end\InjectedScript.js" type="BINDATA"/> </includes> diff --git a/WebKit/chromium/WebKit.gyp b/WebKit/chromium/WebKit.gyp index 937f4b3..83ae631 100644 --- a/WebKit/chromium/WebKit.gyp +++ b/WebKit/chromium/WebKit.gyp @@ -140,6 +140,7 @@ 'public/WebIDBDatabase.h', 'public/WebIDBDatabaseError.h', 'public/WebIDBIndex.h', + 'public/WebIDBObjectStore.h', 'public/WebIndexedDatabase.h', 'public/WebInputElement.h', 'public/WebInputEvent.h', @@ -269,6 +270,8 @@ 'src/IDBDatabaseProxy.h', 'src/IDBIndexProxy.cpp', 'src/IDBIndexProxy.h', + 'src/IDBObjectStoreProxy.cpp', + 'src/IDBObjectStoreProxy.h', 'src/IndexedDatabaseProxy.cpp', 'src/IndexedDatabaseProxy.h', 'src/InspectorClientImpl.cpp', @@ -358,6 +361,8 @@ 'src/WebIDBDatabaseImpl.h', 'src/WebIDBIndexImpl.cpp', 'src/WebIDBIndexImpl.h', + 'src/WebIDBObjectStoreImpl.cpp', + 'src/WebIDBObjectStoreImpl.h', 'src/WebImageCG.cpp', 'src/WebImageDecoder.cpp', 'src/WebImageSkia.cpp', @@ -518,6 +523,7 @@ '<(chromium_src_dir)/testing/gtest.gyp:gtest', '<(chromium_src_dir)/base/base.gyp:base', '<(chromium_src_dir)/base/base.gyp:base_i18n', + '<(chromium_src_dir)/gpu/gpu.gyp:gles2_c_lib', ], 'include_dirs': [ 'public', @@ -570,7 +576,9 @@ 'webkit', '../../JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf_config', '<(chromium_src_dir)/third_party/icu/icu.gyp:icuuc', + '<(chromium_src_dir)/webkit/support/webkit_support.gyp:npapi_layout_test_plugin', '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support', + '<(chromium_src_dir)/gpu/gpu.gyp:gles2_c_lib' ], 'include_dirs': [ '.', @@ -600,23 +608,20 @@ 'copies': [{ 'destination': '<(PRODUCT_DIR)', 'files': ['<(ahem_path)'], + }, { + # This should really be done in the 'npapi_layout_test_plugin' + # target, but the current VS generator handles 'copies' + # settings as AdditionalDependencies, which means that + # when it's over there, it tries to do the copy *before* + # the file is built, instead of after. We work around this + # by attaching the copy here, since it depends on that + # target. + 'destination': '<(PRODUCT_DIR)/plugins', + 'files': ['<(PRODUCT_DIR)/npapi_layout_test_plugin.dll'], }], - }], - ['OS=="mac"', { - 'dependencies': ['LayoutTestHelper'], - - 'mac_bundle_resources': [ - '<(ahem_path)', - '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher100.ttf', - '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher200.ttf', - '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher300.ttf', - '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher400.ttf', - '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher500.ttf', - '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher600.ttf', - '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher700.ttf', - '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher800.ttf', - '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher900.ttf', - '<(SHARED_INTERMEDIATE_DIR)/webkit/textAreaResizeCorner.png', + },{ # OS!="win" + 'sources/': [ + ['exclude', 'Win\\.cpp$'], ], 'actions': [ { @@ -624,6 +629,7 @@ 'variables': { 'repack_path': '<(chromium_src_dir)/tools/data_pack/repack.py', 'pak_inputs': [ + '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak', '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.pak', '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_en-US.pak', '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.pak', @@ -640,31 +646,49 @@ }, ], # actions }], - ['OS=="linux"', { + ['OS=="mac"', { + 'dependencies': ['LayoutTestHelper'], + + 'mac_bundle_resources': [ + '<(ahem_path)', + '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher100.ttf', + '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher200.ttf', + '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher300.ttf', + '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher400.ttf', + '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher500.ttf', + '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher600.ttf', + '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher700.ttf', + '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher800.ttf', + '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher900.ttf', + '<(SHARED_INTERMEDIATE_DIR)/webkit/textAreaResizeCorner.png', + ], + 'copies': [{ + 'destination': '<(PRODUCT_DIR)/DumpRenderTree.app/Contents/PlugIns/', + 'files': ['<(PRODUCT_DIR)/TestNetscapePlugIn.plugin/'], + }], + },{ # OS!="mac" + 'sources/': [ + # .mm is already excluded by common.gypi + ['exclude', 'Mac\\.cpp$'], + ] + }], + ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', { 'copies': [{ 'destination': '<(PRODUCT_DIR)', 'files': [ '<(ahem_path)', '../../WebKitTools/DumpRenderTree/chromium/fonts.conf', - ], + '<(INTERMEDIATE_DIR)/repack/DumpRenderTree.pak', + ] + }, { + 'destination': '<(PRODUCT_DIR)/plugins', + 'files': ['<(PRODUCT_DIR)/libnpapi_layout_test_plugin.so'], }], - }], - ['OS!="linux" and OS!="freebsd" and OS!="openbsd"', { + },{ # OS!="linux" and OS!="freebsd" and OS!="openbsd" and OS!="solaris" 'sources/': [ ['exclude', '(Gtk|Linux)\\.cpp$'] ] }], - ['OS!="win"', { - 'sources/': [ - ['exclude', 'Win\\.cpp$'], - ] - }], - ['OS!="mac"', { - 'sources/': [ - # .mm is already excluded by common.gypi - ['exclude', 'Mac\\.cpp$'], - ] - }], ], }, ], # targets diff --git a/WebKit/chromium/WebKit.gypi b/WebKit/chromium/WebKit.gypi index a9df3f5..69b1479 100644 --- a/WebKit/chromium/WebKit.gypi +++ b/WebKit/chromium/WebKit.gypi @@ -35,7 +35,6 @@ 'devtools_js_files': [ 'src/js/InspectorControllerImpl.js', 'src/js/DebuggerAgent.js', - 'src/js/DebuggerScript.js', 'src/js/ProfilerAgent.js', 'src/js/ProfilerProcessor.js', 'src/js/HeapProfilerPanel.js', diff --git a/WebKit/chromium/features.gypi b/WebKit/chromium/features.gypi index c7d40cf..9a23949 100644 --- a/WebKit/chromium/features.gypi +++ b/WebKit/chromium/features.gypi @@ -51,6 +51,7 @@ 'ENABLE_FILTERS=1', 'ENABLE_GEOLOCATION=1', 'ENABLE_ICONDATABASE=0', + 'ENABLE_IMAGE_RESIZER=0', 'ENABLE_INDEXED_DATABASE=1', 'ENABLE_JAVASCRIPT_DEBUGGER=1', 'ENABLE_JSC_MULTIPLE_THREADS=0', diff --git a/WebKit/chromium/gyp_webkit b/WebKit/chromium/gyp_webkit index 1ca6133..b7d2308 100755 --- a/WebKit/chromium/gyp_webkit +++ b/WebKit/chromium/gyp_webkit @@ -78,7 +78,11 @@ if __name__ == '__main__': # On linux, we want gyp to output a makefile (default is scons). if sys.platform == 'linux2': - args.extend(['-fmake']) + args.extend(['-fmake', + '--suffix=.chromium', + '--toplevel-dir=../..', + # auto_regeneration doesn't work with toplevel-dir + '-Gauto_regeneration=0']) # Other command args: args.extend([ @@ -90,7 +94,7 @@ if __name__ == '__main__': # gyp hack: otherwise gyp assumes its in chromium's src/ dir. '--depth=./', - # gyp files to execute. + # gyp file to execute. 'WebKit.gyp']) print 'Updating webkit projects from gyp files...' diff --git a/WebKit/chromium/public/WebDevToolsAgentClient.h b/WebKit/chromium/public/WebDevToolsAgentClient.h index 0f7421d..622f788 100644 --- a/WebKit/chromium/public/WebDevToolsAgentClient.h +++ b/WebKit/chromium/public/WebDevToolsAgentClient.h @@ -55,6 +55,7 @@ public: virtual WebCString injectedScriptSource() { return WebCString(); } virtual WebCString injectedScriptDispatcherSource() { return WebCString(); } + virtual WebCString debuggerScriptSource() { return WebCString(); } class WebKitClientMessageLoop { public: diff --git a/WebKit/chromium/public/WebIDBCallbacks.h b/WebKit/chromium/public/WebIDBCallbacks.h index bba7c74..0e28961 100644 --- a/WebKit/chromium/public/WebIDBCallbacks.h +++ b/WebKit/chromium/public/WebIDBCallbacks.h @@ -33,6 +33,7 @@ namespace WebKit { class WebIDBDatabase; class WebIDBDatabaseError; class WebIDBIndex; +class WebIDBObjectStore; class WebSerializedScriptValue; class WebIDBCallbacks { @@ -45,6 +46,7 @@ public: virtual void onSuccess() { WEBKIT_ASSERT_NOT_REACHED(); } // For "null". virtual void onSuccess(WebIDBDatabase*) { WEBKIT_ASSERT_NOT_REACHED(); } virtual void onSuccess(WebIDBIndex*) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void onSuccess(WebIDBObjectStore*) { WEBKIT_ASSERT_NOT_REACHED(); } virtual void onSuccess(const WebSerializedScriptValue&) { WEBKIT_ASSERT_NOT_REACHED(); } }; diff --git a/WebKit/chromium/public/WebIDBDatabase.h b/WebKit/chromium/public/WebIDBDatabase.h index 0f65c6f..b0d6086 100644 --- a/WebKit/chromium/public/WebIDBDatabase.h +++ b/WebKit/chromium/public/WebIDBDatabase.h @@ -31,15 +31,49 @@ namespace WebKit { +class WebFrame; +class WebIDBCallbacks; +class WebIDBObjectStore; + // See comment in WebIndexedDatabase for a high level overview of these classes. class WebIDBDatabase { public: virtual ~WebIDBDatabase() { } - virtual WebString name() { return WebString(); } - virtual WebString description() { return WebString(); } - virtual WebString version() { return WebString(); } - virtual WebDOMStringList objectStores() { return WebDOMStringList(); } + virtual WebString name() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebString(); + } + virtual WebString description() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebString(); + } + virtual WebString version() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebString(); + } + virtual WebDOMStringList objectStores() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebDOMStringList(); + } + virtual void createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, WebIDBCallbacks*) + { + WEBKIT_ASSERT_NOT_REACHED(); + } + // Transfers ownership of the WebIDBObjectStore to the caller. + virtual WebIDBObjectStore* objectStore(const WebString& name, unsigned short mode) + { + WEBKIT_ASSERT_NOT_REACHED(); + return 0; + } + virtual void removeObjectStore(const WebString& name, WebIDBCallbacks* callbacks) + { + WEBKIT_ASSERT_NOT_REACHED(); + } }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebIDBObjectStore.h b/WebKit/chromium/public/WebIDBObjectStore.h new file mode 100755 index 0000000..fead881 --- /dev/null +++ b/WebKit/chromium/public/WebIDBObjectStore.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebIDBObjectStore_h +#define WebIDBObjectStore_h + +#include "WebCommon.h" +#include "WebDOMStringList.h" +#include "WebIDBCallbacks.h" +#include "WebString.h" + +namespace WebKit { + +// See comment in WebIndexedDatabase for a high level overview these classes. +class WebIDBObjectStore { +public: + virtual ~WebIDBObjectStore() { } + + virtual WebString name() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebString(); + } + virtual WebString keyPath() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebString(); + } + virtual WebDOMStringList indexNames() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebDOMStringList(); + } + void createIndex(const WebString& name, const WebString& keyPath, bool unique, WebIDBCallbacks*) + { + WEBKIT_ASSERT_NOT_REACHED(); + } + // Transfers ownership of the WebIDBIndex to the caller. + WebIDBIndex* index(const WebString& name) + { + WEBKIT_ASSERT_NOT_REACHED(); + return 0; + } + void removeIndex(const WebString& name, WebIDBCallbacks*) + { + WEBKIT_ASSERT_NOT_REACHED(); + } + // FIXME: finish. +}; + +} // namespace WebKit + +#endif // WebIDBObjectStore_h diff --git a/WebKit/chromium/public/WebIndexedDatabase.h b/WebKit/chromium/public/WebIndexedDatabase.h index 8e4bf5b..5517a0c 100644 --- a/WebKit/chromium/public/WebIndexedDatabase.h +++ b/WebKit/chromium/public/WebIndexedDatabase.h @@ -51,16 +51,16 @@ public: virtual ~WebIndexedDatabase() { } // The WebKit implementation of open ignores the WebFrame* parameter. - virtual void open(const WebString& name, const WebString& description, - WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* webFrame, int& exceptionCode) + virtual void open(const WebString& name, const WebString& description, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* webFrame) { - open(name, description, false, callbacks, origin, webFrame, exceptionCode); + int exceptionCode; + open(name, description, callbacks, origin, webFrame, exceptionCode); } // FIXME: Delete soon. Compatability hack. - virtual void open(const WebString& name, const WebString& description, bool modifyDatabase, + virtual void open(const WebString& name, const WebString& description, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* webFrame, int& exceptionCode) { - open(name, description, callbacks, origin, webFrame, exceptionCode); + open(name, description, callbacks, origin, webFrame); } }; diff --git a/WebKit/chromium/public/WebInputElement.h b/WebKit/chromium/public/WebInputElement.h index 0de96a7..95f8aa7 100644 --- a/WebKit/chromium/public/WebInputElement.h +++ b/WebKit/chromium/public/WebInputElement.h @@ -86,8 +86,11 @@ namespace WebKit { WEBKIT_API bool isActivatedSubmit() const; WEBKIT_API void setActivatedSubmit(bool); WEBKIT_API int size() const; - WEBKIT_API void setValue(const WebString& value); + WEBKIT_API void setValue(const WebString&); WEBKIT_API WebString value() const; + WEBKIT_API void setPlaceholder(const WebString&); + WEBKIT_API WebString placeholder() const; + WEBKIT_API bool isAutofilled() const; WEBKIT_API void setAutofilled(bool); WEBKIT_API void dispatchFormControlChangeEvent(); WEBKIT_API void setSelectionRange(int, int); diff --git a/WebKit/chromium/public/WebURLResponse.h b/WebKit/chromium/public/WebURLResponse.h index b3c084c..4462394 100644 --- a/WebKit/chromium/public/WebURLResponse.h +++ b/WebKit/chromium/public/WebURLResponse.h @@ -131,6 +131,10 @@ public: WEBKIT_API bool wasNpnNegotiated() const; WEBKIT_API void setWasNpnNegotiated(bool); + // Flag whether this request was loaded via an explicit proxy (HTTP, SOCKS, etc). + WEBKIT_API bool wasFetchedViaProxy() const; + WEBKIT_API void setWasFetchedViaProxy(bool); + // Flag whether this request is part of a multipart response. WEBKIT_API bool isMultipartPayload() const; WEBKIT_API void setIsMultipartPayload(bool); diff --git a/WebKit/chromium/public/WebView.h b/WebKit/chromium/public/WebView.h index 56ea68d..9054d8c 100644 --- a/WebKit/chromium/public/WebView.h +++ b/WebKit/chromium/public/WebView.h @@ -169,6 +169,11 @@ public: const WebPoint& clientPoint, const WebPoint& screenPoint, WebDragOperation operation) = 0; + // Notifies the WebView that a drag is going on. + virtual void dragSourceMovedTo( + const WebPoint& clientPoint, const WebPoint& screenPoint, + WebDragOperation operation) = 0; + // Notfies the WebView that the system drag and drop operation has ended. virtual void dragSourceSystemDragEnded() = 0; diff --git a/WebKit/chromium/public/WebViewClient.h b/WebKit/chromium/public/WebViewClient.h index e0fe71d..31ef028 100644 --- a/WebKit/chromium/public/WebViewClient.h +++ b/WebKit/chromium/public/WebViewClient.h @@ -202,6 +202,9 @@ public: virtual bool runModalBeforeUnloadDialog( WebFrame*, const WebString& message) { return true; } + virtual bool supportsFullscreen() { return false; } + virtual void enterFullscreenForNode(const WebNode&) { } + virtual void exitFullscreenForNode(const WebNode&) { } // UI ------------------------------------------------------------------ @@ -273,7 +276,7 @@ public: virtual void didUpdateInspectorSetting(const WebString& key, const WebString& value) { } - // Autofill ------------------------------------------------------------ + // AutoFill ------------------------------------------------------------ // Queries the browser for suggestions to be shown for the form text // field named |name|. |value| is the text entered by the user so @@ -282,18 +285,33 @@ public: const WebString& name, const WebString& value) { } - // Instructs the browser to remove the autofill entry specified from + // Instructs the browser to remove the Autocomplete entry specified from // its DB. + // FIXME: This method should be named removeAutocompleteSugestion. virtual void removeAutofillSuggestions(const WebString& name, const WebString& value) { } - // Informs the browser that the user has selected an AutoFill suggestion - // for a WebNode. |name| and |label| form a key into the set of AutoFill - // profiles. + // Informs the browser that the user has accepted an AutoFill suggestion for + // a WebNode. |name| and |label| form a key into the set of AutoFill + // profiles. |index| is an index of the selected suggestion in the list of + // suggestions provided by the client virtual void didAcceptAutoFillSuggestion(const WebNode&, const WebString& name, + const WebString& label, + unsigned index) { } + + // Informs the browser that the user has selected an AutoFill suggestion for + // a WebNode. This happens when the user hovers over a suggestion or uses + // the arrow keys to navigate to a suggestion. + virtual void didSelectAutoFillSuggestion(const WebNode&, + const WebString& name, const WebString& label) { } + // Informs the browser that the user has cleared the selection from the + // AutoFill suggestions dropdown. This happens when a user uses the arrow + // keys to navigate outside the range of possible selections. + virtual void didClearAutoFillSelection(const WebNode&) { } + // Geolocation --------------------------------------------------------- // Access the embedder API for geolocation services. diff --git a/WebKit/chromium/src/AutoFillPopupMenuClient.cpp b/WebKit/chromium/src/AutoFillPopupMenuClient.cpp index 4f8793a..8084aad 100644 --- a/WebKit/chromium/src/AutoFillPopupMenuClient.cpp +++ b/WebKit/chromium/src/AutoFillPopupMenuClient.cpp @@ -44,14 +44,25 @@ namespace WebKit { unsigned AutoFillPopupMenuClient::getSuggestionsCount() const { - return m_names.size(); + return m_names.size() + ((m_separatorIndex == -1) ? 0 : 1); } WebString AutoFillPopupMenuClient::getSuggestion(unsigned listIndex) const { + if (listIndex == static_cast<unsigned>(m_separatorIndex)) + return WebString(); + + if (m_separatorIndex != -1 && listIndex > static_cast<unsigned>(m_separatorIndex)) + --listIndex; + // 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(")"); + + WebString suggestion = m_names[listIndex]; + if (m_labels[listIndex].isEmpty()) + return suggestion; + + return suggestion + String(" (") + m_labels[listIndex] + String(")"); } void AutoFillPopupMenuClient::removeSuggestionAtIndex(unsigned listIndex) @@ -64,37 +75,85 @@ void AutoFillPopupMenuClient::removeSuggestionAtIndex(unsigned listIndex) void AutoFillPopupMenuClient::valueChanged(unsigned listIndex, bool fireEvents) { + WebViewImpl* webView = getWebView(); + if (!webView) + return; + + if (m_separatorIndex != -1 && listIndex > static_cast<unsigned>(m_separatorIndex)) + --listIndex; + ASSERT(listIndex >= 0 && listIndex < m_names.size()); + webView->client()->didAcceptAutoFillSuggestion(WebNode(getTextField()), + m_names[listIndex], + m_labels[listIndex], + listIndex); +} + +void AutoFillPopupMenuClient::selectionChanged(unsigned listIndex, bool fireEvents) +{ WebViewImpl* webView = getWebView(); if (!webView) return; - webView->client()->didAcceptAutoFillSuggestion(WebNode(getTextField()), + if (m_separatorIndex != -1 && listIndex > static_cast<unsigned>(m_separatorIndex)) + --listIndex; + + ASSERT(listIndex >= 0 && listIndex < m_names.size()); + + webView->client()->didSelectAutoFillSuggestion(WebNode(getTextField()), m_names[listIndex], m_labels[listIndex]); } +void AutoFillPopupMenuClient::selectionCleared() +{ + WebViewImpl* webView = getWebView(); + if (!webView) + return; + + webView->suggestionsPopupDidHide(); + webView->client()->didClearAutoFillSelection(WebNode(getTextField())); +} + +void AutoFillPopupMenuClient::popupDidHide() +{ + // FIXME: Refactor this method, as selectionCleared() and popupDidHide() + // share the exact same functionality. + WebViewImpl* webView = getWebView(); + if (!webView) + return; + + webView->client()->didClearAutoFillSelection(WebNode(getTextField())); +} + +bool AutoFillPopupMenuClient::itemIsSeparator(unsigned listIndex) const +{ + return (m_separatorIndex != -1 && static_cast<unsigned>(m_separatorIndex) == listIndex); +} + void AutoFillPopupMenuClient::initialize( HTMLInputElement* textField, const WebVector<WebString>& names, const WebVector<WebString>& labels, - int defaultSuggestionIndex) + int separatorIndex) { ASSERT(names.size() == labels.size()); - ASSERT(defaultSuggestionIndex < static_cast<int>(names.size())); + ASSERT(separatorIndex < static_cast<int>(names.size())); // The suggestions must be set before initializing the // SuggestionsPopupMenuClient. - setSuggestions(names, labels); + setSuggestions(names, labels, separatorIndex); - SuggestionsPopupMenuClient::initialize(textField, defaultSuggestionIndex); + SuggestionsPopupMenuClient::initialize(textField, -1); } void AutoFillPopupMenuClient::setSuggestions(const WebVector<WebString>& names, - const WebVector<WebString>& labels) + const WebVector<WebString>& labels, + int separatorIndex) { ASSERT(names.size() == labels.size()); + ASSERT(separatorIndex < static_cast<int>(names.size())); m_names.clear(); m_labels.clear(); @@ -103,6 +162,8 @@ void AutoFillPopupMenuClient::setSuggestions(const WebVector<WebString>& names, m_labels.append(labels[i]); } + m_separatorIndex = separatorIndex; + // Try to preserve selection if possible. if (getSelectedIndex() >= static_cast<int>(names.size())) setSelectedIndex(-1); diff --git a/WebKit/chromium/src/AutoFillPopupMenuClient.h b/WebKit/chromium/src/AutoFillPopupMenuClient.h index 568ce4d..488bdb1 100644 --- a/WebKit/chromium/src/AutoFillPopupMenuClient.h +++ b/WebKit/chromium/src/AutoFillPopupMenuClient.h @@ -52,18 +52,26 @@ public: // WebCore::PopupMenuClient implementation: virtual void valueChanged(unsigned listIndex, bool fireEvents = true); + virtual void selectionChanged(unsigned listIndex, bool fireEvents = true); + virtual void selectionCleared(); + virtual void popupDidHide(); + virtual bool itemIsSeparator(unsigned listIndex) const; void initialize(WebCore::HTMLInputElement*, const WebVector<WebString>& names, const WebVector<WebString>& labels, - int defaultSuggestionIndex); + int separatorIndex); void setSuggestions(const WebVector<WebString>& names, - const WebVector<WebString>& labels); + const WebVector<WebString>& labels, + int separatorIndex); private: Vector<WebCore::String> m_names; Vector<WebCore::String> m_labels; + + // The index of the separator. -1 if there is no separator. + int m_separatorIndex; }; } // namespace WebKit diff --git a/WebKit/chromium/src/ChromeClientImpl.cpp b/WebKit/chromium/src/ChromeClientImpl.cpp index d54f328..559a62b 100644 --- a/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/WebKit/chromium/src/ChromeClientImpl.cpp @@ -48,6 +48,7 @@ #include "WebGeolocationService.h" #include "GeolocationServiceChromium.h" #include "GraphicsLayer.h" +#include "HTMLNames.h" #include "HitTestResult.h" #include "IntRect.h" #include "Node.h" @@ -159,35 +160,8 @@ float ChromeClientImpl::scaleFactor() void ChromeClientImpl::focus() { - if (!m_webView->client()) - return; - - m_webView->client()->didFocus(); - - // If accessibility is enabled, we should notify assistive technology that - // the active AccessibilityObject changed. - const Frame* frame = m_webView->focusedWebCoreFrame(); - if (!frame) - return; - - Document* doc = frame->document(); - - if (doc && doc->axObjectCache()->accessibilityEnabled()) { - Node* focusedNode = m_webView->focusedWebCoreNode(); - - if (!focusedNode) { - // Could not retrieve focused Node. - return; - } - - // Retrieve the focused AccessibilityObject. - AccessibilityObject* focusedAccObj = - doc->axObjectCache()->getOrCreate(focusedNode->renderer()); - - // Alert assistive technology that focus changed. - if (focusedAccObj) - m_webView->client()->focusAccessibilityObject(WebAccessibilityObject(focusedAccObj)); - } + if (m_webView->client()) + m_webView->client()->didFocus(); } void ChromeClientImpl::unfocus() @@ -217,17 +191,37 @@ void ChromeClientImpl::focusedNodeChanged(Node* node) { m_webView->client()->focusedNodeChanged(WebNode(node)); - WebURL focus_url; + WebURL focusURL; if (node && node->isLink()) { // This HitTestResult hack is the easiest way to get a link URL out of a // WebCore::Node. - HitTestResult hit_test(IntPoint(0, 0)); + HitTestResult hitTest(IntPoint(0, 0)); // This cast must be valid because of the isLink() check. - hit_test.setURLElement(reinterpret_cast<Element*>(node)); - if (hit_test.isLiveLink()) - focus_url = hit_test.absoluteLinkURL(); + hitTest.setURLElement(static_cast<Element*>(node)); + if (hitTest.isLiveLink()) + focusURL = hitTest.absoluteLinkURL(); + } + m_webView->client()->setKeyboardFocusURL(focusURL); + + if (!node) + return; + + // If accessibility is enabled, we should notify assistive technology that + // the active AccessibilityObject changed. + Document* document = node->document(); + if (!document) { + ASSERT_NOT_REACHED(); + return; + } + if (document && document->axObjectCache()->accessibilityEnabled()) { + // Retrieve the focused AccessibilityObject. + AccessibilityObject* focusedAccObj = + document->axObjectCache()->getOrCreate(node->renderer()); + + // Alert assistive technology that focus changed. + if (focusedAccObj) + m_webView->client()->focusAccessibilityObject(WebAccessibilityObject(focusedAccObj)); } - m_webView->client()->setKeyboardFocusURL(focus_url); } Page* ChromeClientImpl::createWindow( @@ -736,4 +730,23 @@ void ChromeClientImpl::scheduleCompositingLayerSync() } #endif +bool ChromeClientImpl::supportsFullscreenForNode(const WebCore::Node* node) +{ + if (m_webView->client() && node->hasTagName(WebCore::HTMLNames::videoTag)) + return m_webView->client()->supportsFullscreen(); + return false; +} + +void ChromeClientImpl::enterFullscreenForNode(WebCore::Node* node) +{ + if (m_webView->client()) + m_webView->client()->enterFullscreenForNode(WebNode(node)); +} + +void ChromeClientImpl::exitFullscreenForNode(WebCore::Node* node) +{ + if (m_webView->client()) + m_webView->client()->exitFullscreenForNode(WebNode(node)); +} + } // namespace WebKit diff --git a/WebKit/chromium/src/ChromeClientImpl.h b/WebKit/chromium/src/ChromeClientImpl.h index 3b5ebd5..84355c3 100644 --- a/WebKit/chromium/src/ChromeClientImpl.h +++ b/WebKit/chromium/src/ChromeClientImpl.h @@ -146,6 +146,10 @@ public: // to do an eager layout before the drawing. virtual void scheduleCompositingLayerSync(); #endif + virtual bool supportsFullscreenForNode(const WebCore::Node*); + virtual void enterFullscreenForNode(WebCore::Node*); + virtual void exitFullscreenForNode(WebCore::Node*); + // ChromeClientChromium methods: virtual void popupOpened(WebCore::PopupContainer* popupContainer, const WebCore::IntRect& bounds, diff --git a/WebKit/chromium/src/DebuggerAgent.h b/WebKit/chromium/src/DebuggerAgent.h index 7f3dbbb..17cde11 100644 --- a/WebKit/chromium/src/DebuggerAgent.h +++ b/WebKit/chromium/src/DebuggerAgent.h @@ -40,10 +40,7 @@ namespace WebKit { METHOD0(getContextId) \ \ /* Request v8 to process all debug commands in the queue. */ \ - METHOD0(processDebugCommands) \ - \ - /* Push DebuggerScript.js content to the agent. */ \ - METHOD1(setDebuggerScriptSource, String) + METHOD0(processDebugCommands) DEFINE_RPC_CLASS(DebuggerAgent, DEBUGGER_AGENT_STRUCT) diff --git a/WebKit/chromium/src/DebuggerAgentImpl.cpp b/WebKit/chromium/src/DebuggerAgentImpl.cpp index 673482a..dde9e1d 100644 --- a/WebKit/chromium/src/DebuggerAgentImpl.cpp +++ b/WebKit/chromium/src/DebuggerAgentImpl.cpp @@ -79,11 +79,6 @@ void DebuggerAgentImpl::processDebugCommands() v8::Debug::ProcessDebugMessages(); } -void DebuggerAgentImpl::setDebuggerScriptSource(const String& source) -{ - WebCore::ScriptDebugServer::shared().setDebuggerScriptSource(source); -} - void DebuggerAgentImpl::debuggerOutput(const String& command) { m_delegate->debuggerOutput(command); diff --git a/WebKit/chromium/src/DebuggerAgentImpl.h b/WebKit/chromium/src/DebuggerAgentImpl.h index bd9ddf6..0e6e6af 100644 --- a/WebKit/chromium/src/DebuggerAgentImpl.h +++ b/WebKit/chromium/src/DebuggerAgentImpl.h @@ -60,7 +60,6 @@ public: // DebuggerAgent implementation. virtual void getContextId(); virtual void processDebugCommands(); - virtual void setDebuggerScriptSource(const String&); void debuggerOutput(const WebCore::String& out); diff --git a/WebKit/chromium/src/GraphicsContext3D.cpp b/WebKit/chromium/src/GraphicsContext3D.cpp index 7c5635b..0681675 100644 --- a/WebKit/chromium/src/GraphicsContext3D.cpp +++ b/WebKit/chromium/src/GraphicsContext3D.cpp @@ -41,7 +41,7 @@ #include "ImageData.h" #include "WebGLBuffer.h" #include "Int8Array.h" -#include "FloatArray.h" +#include "Float32Array.h" #include "WebGLFramebuffer.h" #include "Int32Array.h" #include "WebGLProgram.h" diff --git a/WebKit/chromium/src/IDBCallbacksProxy.cpp b/WebKit/chromium/src/IDBCallbacksProxy.cpp index 3e5f00a..42be08d 100644 --- a/WebKit/chromium/src/IDBCallbacksProxy.cpp +++ b/WebKit/chromium/src/IDBCallbacksProxy.cpp @@ -35,6 +35,7 @@ #include "WebIDBDatabaseImpl.h" #include "WebIDBDatabaseError.h" #include "WebIDBIndexImpl.h" +#include "WebIDBObjectStoreImpl.h" #include "WebSerializedScriptValue.h" #if ENABLE(INDEXED_DATABASE) @@ -79,6 +80,12 @@ void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBIndex> idbIndex) m_callbacks.clear(); } +void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBObjectStore> idbObjectStore) +{ + m_callbacks->onSuccess(new WebKit::WebIDBObjectStoreImpl(idbObjectStore)); + m_callbacks.clear(); +} + void IDBCallbacksProxy::onSuccess(PassRefPtr<SerializedScriptValue> serializedScriptValue) { m_callbacks->onSuccess(WebKit::WebSerializedScriptValue(serializedScriptValue)); diff --git a/WebKit/chromium/src/IDBCallbacksProxy.h b/WebKit/chromium/src/IDBCallbacksProxy.h index d98e2ed..8f2da28 100644 --- a/WebKit/chromium/src/IDBCallbacksProxy.h +++ b/WebKit/chromium/src/IDBCallbacksProxy.h @@ -30,6 +30,7 @@ #define IDBCallbacksProxy_h #include "IDBCallbacks.h" +#include <wtf/PassOwnPtr.h> #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> @@ -43,6 +44,7 @@ namespace WebCore { class IDBDatabaseError; class IDBDatabase; +class IDBObjectStore; class SerializedScriptValue; class IDBCallbacksProxy : public IDBCallbacks { @@ -54,6 +56,7 @@ public: virtual void onSuccess(); // For "null". virtual void onSuccess(PassRefPtr<IDBDatabase>); virtual void onSuccess(PassRefPtr<IDBIndex>); + virtual void onSuccess(PassRefPtr<IDBObjectStore>); virtual void onSuccess(PassRefPtr<SerializedScriptValue>); private: diff --git a/WebKit/chromium/src/IDBDatabaseProxy.cpp b/WebKit/chromium/src/IDBDatabaseProxy.cpp index deb2f99..9d009c0 100644 --- a/WebKit/chromium/src/IDBDatabaseProxy.cpp +++ b/WebKit/chromium/src/IDBDatabaseProxy.cpp @@ -27,8 +27,13 @@ #include "IDBDatabaseProxy.h" #include "DOMStringList.h" +#include "IDBCallbacks.h" +#include "IDBObjectStoreProxy.h" +#include "WebFrameImpl.h" +#include "WebIDBCallbacksImpl.h" #include "WebIDBDatabase.h" #include "WebIDBDatabaseError.h" +#include "WebIDBObjectStore.h" #if ENABLE(INDEXED_DATABASE) @@ -48,26 +53,44 @@ IDBDatabaseProxy::~IDBDatabaseProxy() { } -String IDBDatabaseProxy::name() +String IDBDatabaseProxy::name() const { return m_webIDBDatabase->name(); } -String IDBDatabaseProxy::description() +String IDBDatabaseProxy::description() const { return m_webIDBDatabase->description(); } -String IDBDatabaseProxy::version() +String IDBDatabaseProxy::version() const { return m_webIDBDatabase->version(); } -PassRefPtr<DOMStringList> IDBDatabaseProxy::objectStores() +PassRefPtr<DOMStringList> IDBDatabaseProxy::objectStores() const { return m_webIDBDatabase->objectStores(); } +void IDBDatabaseProxy::createObjectStore(const String& name, const String& keyPath, bool autoIncrement, PassRefPtr<IDBCallbacks> callbacks) +{ + m_webIDBDatabase->createObjectStore(name, keyPath, autoIncrement, new WebIDBCallbacksImpl(callbacks)); +} + +PassRefPtr<IDBObjectStore> IDBDatabaseProxy::objectStore(const String& name, unsigned short mode) +{ + WebKit::WebIDBObjectStore* objectStore = m_webIDBDatabase->objectStore(name, mode); + if (!objectStore) + return 0; + return IDBObjectStoreProxy::create(objectStore); +} + +void IDBDatabaseProxy::removeObjectStore(const String& name, PassRefPtr<IDBCallbacks> callbacks) +{ + m_webIDBDatabase->removeObjectStore(name, new WebIDBCallbacksImpl(callbacks)); +} + } // namespace WebCore #endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/IDBDatabaseProxy.h b/WebKit/chromium/src/IDBDatabaseProxy.h index e5e5125..36588f0 100644 --- a/WebKit/chromium/src/IDBDatabaseProxy.h +++ b/WebKit/chromium/src/IDBDatabaseProxy.h @@ -42,12 +42,16 @@ public: static PassRefPtr<IDBDatabase> create(PassOwnPtr<WebKit::WebIDBDatabase>); virtual ~IDBDatabaseProxy(); - virtual String name(); - virtual String description(); - virtual String version(); - virtual PassRefPtr<DOMStringList> objectStores(); + virtual String name() const; + virtual String description() const; + virtual String version() const; + virtual PassRefPtr<DOMStringList> objectStores() const; - // FIXME: Add other methods. + // FIXME: Add transaction and setVersion. + + virtual void createObjectStore(const String& name, const String& keyPath, bool autoIncrement, PassRefPtr<IDBCallbacks>); + virtual PassRefPtr<IDBObjectStore> objectStore(const String& name, unsigned short mode); + virtual void removeObjectStore(const String& name, PassRefPtr<IDBCallbacks>); private: IDBDatabaseProxy(PassOwnPtr<WebKit::WebIDBDatabase>); diff --git a/WebKit/chromium/src/IDBObjectStoreProxy.cpp b/WebKit/chromium/src/IDBObjectStoreProxy.cpp new file mode 100755 index 0000000..5942e2a --- /dev/null +++ b/WebKit/chromium/src/IDBObjectStoreProxy.cpp @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "IDBObjectStoreProxy.h" + +#include "DOMStringList.h" +#include "IDBCallbacks.h" +#include "IDBIndexProxy.h" +#include "WebIDBCallbacksImpl.h" +#include "WebIDBIndex.h" +#include "WebIDBObjectStore.h" + +#if ENABLE(INDEXED_DATABASE) + +namespace WebCore { + +PassRefPtr<IDBObjectStore> IDBObjectStoreProxy::create(PassOwnPtr<WebKit::WebIDBObjectStore> objectStore) +{ + return adoptRef(new IDBObjectStoreProxy(objectStore)); +} + +IDBObjectStoreProxy::IDBObjectStoreProxy(PassOwnPtr<WebKit::WebIDBObjectStore> objectStore) + : m_webIDBObjectStore(objectStore) +{ +} + +IDBObjectStoreProxy::~IDBObjectStoreProxy() +{ +} + +String IDBObjectStoreProxy::name() const +{ + return m_webIDBObjectStore->name(); +} + +String IDBObjectStoreProxy::keyPath() const +{ + return m_webIDBObjectStore->keyPath(); +} + +PassRefPtr<DOMStringList> IDBObjectStoreProxy::indexNames() const +{ + return m_webIDBObjectStore->indexNames(); +} + +void IDBObjectStoreProxy::createIndex(const String& name, const String& keyPath, bool unique, PassRefPtr<IDBCallbacks> callbacks) +{ + m_webIDBObjectStore->createIndex(name, keyPath, unique, new WebIDBCallbacksImpl(callbacks)); +} + +PassRefPtr<IDBIndex> IDBObjectStoreProxy::index(const String& name) +{ + WebKit::WebIDBIndex* index = m_webIDBObjectStore->index(name); + if (!index) + return 0; + return IDBIndexProxy::create(index); +} + +void IDBObjectStoreProxy::removeIndex(const String& name, PassRefPtr<IDBCallbacks> callbacks) +{ + m_webIDBObjectStore->removeIndex(name, new WebIDBCallbacksImpl(callbacks)); +} + +} // namespace WebCore + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/IDBObjectStoreProxy.h b/WebKit/chromium/src/IDBObjectStoreProxy.h new file mode 100755 index 0000000..78983cb --- /dev/null +++ b/WebKit/chromium/src/IDBObjectStoreProxy.h @@ -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: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef IDBObjectStoreProxy_h +#define IDBObjectStoreProxy_h + +#include "IDBObjectStore.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/PassRefPtr.h> + +#if ENABLE(INDEXED_DATABASE) + +namespace WebKit { class WebIDBObjectStore; } + +namespace WebCore { + +class DOMStringList; +class IDBIndex; + +class IDBObjectStoreProxy : public IDBObjectStore { +public: + static PassRefPtr<IDBObjectStore> create(PassOwnPtr<WebKit::WebIDBObjectStore>); + virtual ~IDBObjectStoreProxy(); + + virtual String name() const; + virtual String keyPath() const; + virtual PassRefPtr<DOMStringList> indexNames() const; + + virtual void createIndex(const String& name, const String& keyPath, bool unique, PassRefPtr<IDBCallbacks>); + virtual PassRefPtr<IDBIndex> index(const String& name); + virtual void removeIndex(const String& name, PassRefPtr<IDBCallbacks>); + +private: + IDBObjectStoreProxy(PassOwnPtr<WebKit::WebIDBObjectStore>); + + OwnPtr<WebKit::WebIDBObjectStore> m_webIDBObjectStore; +}; + +} // namespace WebCore + +#endif + +#endif // IDBObjectStoreProxy_h + diff --git a/WebKit/chromium/src/IndexedDatabaseProxy.cpp b/WebKit/chromium/src/IndexedDatabaseProxy.cpp index 2572877..bee99b2 100644 --- a/WebKit/chromium/src/IndexedDatabaseProxy.cpp +++ b/WebKit/chromium/src/IndexedDatabaseProxy.cpp @@ -57,12 +57,10 @@ IndexedDatabaseProxy::~IndexedDatabaseProxy() { } -void IndexedDatabaseProxy::open(const String& name, const String& description, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> origin, Frame* frame, ExceptionCode& ec) +void IndexedDatabaseProxy::open(const String& name, const String& description, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> origin, Frame* frame) { - if (!frame || !frame->document()) - return; WebKit::WebFrame* webFrame = WebKit::WebFrameImpl::fromFrame(frame); - m_webIndexedDatabase->open(name, description, new WebIDBCallbacksImpl(callbacks), origin, webFrame, ec); + m_webIndexedDatabase->open(name, description, new WebIDBCallbacksImpl(callbacks), origin, webFrame); } } // namespace WebCore diff --git a/WebKit/chromium/src/IndexedDatabaseProxy.h b/WebKit/chromium/src/IndexedDatabaseProxy.h index 206099c..53097f0 100644 --- a/WebKit/chromium/src/IndexedDatabaseProxy.h +++ b/WebKit/chromium/src/IndexedDatabaseProxy.h @@ -42,7 +42,7 @@ public: static PassRefPtr<IndexedDatabase> create(); virtual ~IndexedDatabaseProxy(); - virtual void open(const String& name, const String& description, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*, ExceptionCode&); + virtual void open(const String& name, const String& description, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*); private: IndexedDatabaseProxy(); diff --git a/WebKit/chromium/src/InspectorClientImpl.cpp b/WebKit/chromium/src/InspectorClientImpl.cpp index 22b515f..91d10d5 100644 --- a/WebKit/chromium/src/InspectorClientImpl.cpp +++ b/WebKit/chromium/src/InspectorClientImpl.cpp @@ -35,6 +35,8 @@ #include "FloatRect.h" #include "NotImplemented.h" #include "Page.h" +#include "WebDevToolsAgentImpl.h" +#include "WebDevToolsMessageData.h" #include "WebRect.h" #include "WebURL.h" #include "WebURLRequest.h" @@ -102,4 +104,20 @@ void InspectorClientImpl::storeSetting(const String& key, const String& value) m_inspectedWebView->setInspectorSetting(key, value); } +bool InspectorClientImpl::sendMessageToFrontend(const WebCore::String& message) +{ + WebDevToolsAgentImpl* devToolsAgent = static_cast<WebDevToolsAgentImpl*>(m_inspectedWebView->devToolsAgent()); + if (!devToolsAgent) + return false; + + WebVector<WebString> arguments(size_t(1)); + arguments[0] = message; + WebDevToolsMessageData data; + data.className = "ToolsAgentDelegate"; + data.methodName = "dispatchOnClient"; + data.arguments.swap(arguments); + devToolsAgent->sendRpcMessage(data); + return true; +} + } // namespace WebKit diff --git a/WebKit/chromium/src/InspectorClientImpl.h b/WebKit/chromium/src/InspectorClientImpl.h index 7447d0c..f4994e3 100644 --- a/WebKit/chromium/src/InspectorClientImpl.h +++ b/WebKit/chromium/src/InspectorClientImpl.h @@ -36,6 +36,8 @@ #include <wtf/OwnPtr.h> namespace WebKit { + +class WebDevToolsAgentClient; class WebViewImpl; class InspectorClientImpl : public WebCore::InspectorClient { @@ -46,15 +48,14 @@ public: // InspectorClient methods: virtual void inspectorDestroyed(); virtual void openInspectorFrontend(WebCore::InspectorController*); + virtual void highlight(WebCore::Node*); virtual void hideHighlight(); - virtual void populateSetting( - const WebCore::String& key, - WebCore::String* value); - virtual void storeSetting( - const WebCore::String& key, - const WebCore::String& value); + virtual void populateSetting(const WebCore::String& key, WebCore::String* value); + virtual void storeSetting(const WebCore::String& key, const WebCore::String& value); + + virtual bool sendMessageToFrontend(const WebCore::String&); private: // The WebViewImpl of the page being inspected; gets passed to the constructor diff --git a/WebKit/chromium/src/NotificationPresenterImpl.cpp b/WebKit/chromium/src/NotificationPresenterImpl.cpp index dca1856..c928c91 100644 --- a/WebKit/chromium/src/NotificationPresenterImpl.cpp +++ b/WebKit/chromium/src/NotificationPresenterImpl.cpp @@ -88,7 +88,10 @@ void NotificationPresenterImpl::cancel(Notification* notification) void NotificationPresenterImpl::notificationObjectDestroyed(Notification* notification) { - m_presenter->objectDestroyed(PassRefPtr<Notification>(notification)); + // TODO(pkasting): We cannot ref an object that's being destroyed. Either + // this function needs to be called earlier than in ~Notification(), or it + // needs to not ref this object. + //m_presenter->objectDestroyed(PassRefPtr<Notification>(notification)); } NotificationPresenter::Permission NotificationPresenterImpl::checkPermission(const KURL& sourceURL) diff --git a/WebKit/chromium/src/SuggestionsPopupMenuClient.h b/WebKit/chromium/src/SuggestionsPopupMenuClient.h index 77b3890..7717593 100644 --- a/WebKit/chromium/src/SuggestionsPopupMenuClient.h +++ b/WebKit/chromium/src/SuggestionsPopupMenuClient.h @@ -61,6 +61,8 @@ public: // WebCore::PopupMenuClient methods: virtual void valueChanged(unsigned listIndex, bool fireEvents = true); + virtual void selectionChanged(unsigned, bool) {} + virtual void selectionCleared() {} virtual WebCore::String itemText(unsigned listIndex) const; virtual WebCore::String itemToolTip(unsigned lastIndex) const { return WebCore::String(); } virtual WebCore::String itemAccessibilityText(unsigned lastIndex) const { return WebCore::String(); } diff --git a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp index 8dde31f..c4bbbfa 100644 --- a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp +++ b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp @@ -462,6 +462,11 @@ void WebDevToolsAgentImpl::createInspectorFrontendProxy() m_utilityContext = v8::Context::New(); compileUtilityScripts(); initDevToolsAgentHost(); +#if ENABLE(V8_SCRIPT_DEBUG_SERVER) + WebCString debuggerScriptJs = m_client->debuggerScriptSource(); + WebCore::ScriptDebugServer::shared().setDebuggerScriptSource( + WebCore::String(debuggerScriptJs.data(), debuggerScriptJs.length())); +#endif } void WebDevToolsAgentImpl::setInspectorFrontendProxyToInspectorController() @@ -470,8 +475,7 @@ void WebDevToolsAgentImpl::setInspectorFrontendProxyToInspectorController() ScriptState* state = ScriptState::forContext( v8::Local<v8::Context>::New(m_utilityContext)); InspectorController* ic = inspectorController(); - ic->setFrontend(new InspectorFrontend( - ScriptObject(state, m_utilityContext->Global()))); + ic->connectFrontend(ScriptObject(state, m_utilityContext->Global())); } void WebDevToolsAgentImpl::setApuAgentEnabled(bool enabled) diff --git a/WebKit/chromium/src/WebEntities.cpp b/WebKit/chromium/src/WebEntities.cpp index b9143d9..2b8ae3c 100644 --- a/WebKit/chromium/src/WebEntities.cpp +++ b/WebKit/chromium/src/WebEntities.cpp @@ -42,12 +42,12 @@ using namespace WebCore; namespace { -// Note that this file is also included by HTMLTokenizer.cpp so we are getting +// Note that this file is also included by HTMLDocumentParser.cpp so we are getting // two copies of the data in memory. We can fix this by changing the script // that generated the array to create a static const that is its length, but // this is low priority since the data is less than 4K. We use anonymous // namespace to prevent name collisions. -#include "HTMLEntityNames.c" // NOLINT +#include "HTMLEntityNames.cpp" // NOLINT } namespace WebKit { diff --git a/WebKit/chromium/src/WebFormControlElement.cpp b/WebKit/chromium/src/WebFormControlElement.cpp index 007673e..a75fe5c 100644 --- a/WebKit/chromium/src/WebFormControlElement.cpp +++ b/WebKit/chromium/src/WebFormControlElement.cpp @@ -59,7 +59,7 @@ WebString WebFormControlElement::nameForAutofill() const String trimmedName = name.stripWhiteSpace(); if (!trimmedName.isEmpty()) return trimmedName; - name = constUnwrap<HTMLFormControlElement>()->getAttribute(HTMLNames::idAttr); + name = constUnwrap<HTMLFormControlElement>()->getIdAttribute(); trimmedName = name.stripWhiteSpace(); if (!trimmedName.isEmpty()) return trimmedName; diff --git a/WebKit/chromium/src/WebIDBCallbacksImpl.cpp b/WebKit/chromium/src/WebIDBCallbacksImpl.cpp index ea1c0b1..891e3b3 100644 --- a/WebKit/chromium/src/WebIDBCallbacksImpl.cpp +++ b/WebKit/chromium/src/WebIDBCallbacksImpl.cpp @@ -30,10 +30,12 @@ #include "IDBDatabaseError.h" #include "IDBDatabaseProxy.h" #include "IDBIndexProxy.h" +#include "IDBObjectStoreProxy.h" #include "WebIDBCallbacks.h" #include "WebIDBDatabase.h" #include "WebIDBDatabaseError.h" #include "WebIDBIndex.h" +#include "WebIDBObjectStore.h" #include "WebSerializedScriptValue.h" #if ENABLE(INDEXED_DATABASE) @@ -73,6 +75,12 @@ void WebIDBCallbacksImpl::onSuccess(WebKit::WebIDBIndex* webKitInstance) m_callbacks.clear(); } +void WebIDBCallbacksImpl::onSuccess(WebKit::WebIDBObjectStore* webKitInstance) +{ + m_callbacks->onSuccess(IDBObjectStoreProxy::create(webKitInstance)); + m_callbacks.clear(); +} + void WebIDBCallbacksImpl::onSuccess(const WebKit::WebSerializedScriptValue& serializedScriptValue) { m_callbacks->onSuccess(serializedScriptValue); diff --git a/WebKit/chromium/src/WebIDBCallbacksImpl.h b/WebKit/chromium/src/WebIDBCallbacksImpl.h index 8e5ada7..519f692 100644 --- a/WebKit/chromium/src/WebIDBCallbacksImpl.h +++ b/WebKit/chromium/src/WebIDBCallbacksImpl.h @@ -45,6 +45,7 @@ public: virtual void onSuccess(); // For "null". virtual void onSuccess(WebKit::WebIDBDatabase*); virtual void onSuccess(WebKit::WebIDBIndex*); + virtual void onSuccess(WebKit::WebIDBObjectStore*); virtual void onSuccess(const WebKit::WebSerializedScriptValue&); private: diff --git a/WebKit/chromium/src/WebIDBDatabaseImpl.cpp b/WebKit/chromium/src/WebIDBDatabaseImpl.cpp index 3a00ccb..e2f771a 100644 --- a/WebKit/chromium/src/WebIDBDatabaseImpl.cpp +++ b/WebKit/chromium/src/WebIDBDatabaseImpl.cpp @@ -27,7 +27,10 @@ #include "WebIDBDatabaseImpl.h" #include "DOMStringList.h" +#include "IDBCallbacksProxy.h" #include "IDBDatabase.h" +#include "WebIDBCallbacks.h" +#include "WebIDBObjectStoreImpl.h" #if ENABLE(INDEXED_DATABASE) @@ -35,8 +38,8 @@ using namespace WebCore; namespace WebKit { -WebIDBDatabaseImpl::WebIDBDatabaseImpl(PassRefPtr<IDBDatabase> idbDatabase) - : m_idbDatabase(idbDatabase) +WebIDBDatabaseImpl::WebIDBDatabaseImpl(PassRefPtr<IDBDatabase> database) + : m_database(database) { } @@ -44,24 +47,42 @@ WebIDBDatabaseImpl::~WebIDBDatabaseImpl() { } -WebString WebIDBDatabaseImpl::name() +WebString WebIDBDatabaseImpl::name() const { - return m_idbDatabase->name(); + return m_database->name(); } -WebString WebIDBDatabaseImpl::description() +WebString WebIDBDatabaseImpl::description() const { - return m_idbDatabase->description(); + return m_database->description(); } -WebString WebIDBDatabaseImpl::version() +WebString WebIDBDatabaseImpl::version() const { - return m_idbDatabase->version(); + return m_database->version(); } -WebDOMStringList WebIDBDatabaseImpl::objectStores() +WebDOMStringList WebIDBDatabaseImpl::objectStores() const { - return m_idbDatabase->objectStores(); + return m_database->objectStores(); +} + +void WebIDBDatabaseImpl::createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, WebIDBCallbacks* callbacks) +{ + m_database->createObjectStore(name, keyPath, autoIncrement, IDBCallbacksProxy::create(callbacks)); +} + +WebIDBObjectStore* WebIDBDatabaseImpl::objectStore(const WebString& name, unsigned short mode) +{ + RefPtr<IDBObjectStore> objectStore = m_database->objectStore(name, mode); + if (!objectStore) + return 0; + return new WebIDBObjectStoreImpl(objectStore); +} + +void WebIDBDatabaseImpl::removeObjectStore(const WebString& name, WebIDBCallbacks* callbacks) +{ + m_database->removeObjectStore(name, IDBCallbacksProxy::create(callbacks)); } } // namespace WebCore diff --git a/WebKit/chromium/src/WebIDBDatabaseImpl.h b/WebKit/chromium/src/WebIDBDatabaseImpl.h index f99a759..c83d8d7 100644 --- a/WebKit/chromium/src/WebIDBDatabaseImpl.h +++ b/WebKit/chromium/src/WebIDBDatabaseImpl.h @@ -35,19 +35,25 @@ namespace WebCore { class IDBDatabase; } namespace WebKit { +class WebIDBObjectStore; + // See comment in WebIndexedDatabase for a high level overview these classes. class WebIDBDatabaseImpl : public WebIDBDatabase { public: - WebIDBDatabaseImpl(WTF::PassRefPtr<WebCore::IDBDatabase> idbDatabase); + WebIDBDatabaseImpl(WTF::PassRefPtr<WebCore::IDBDatabase> database); virtual ~WebIDBDatabaseImpl(); - virtual WebString name(); - virtual WebString description(); - virtual WebString version(); - virtual WebDOMStringList objectStores(); + virtual WebString name() const; + virtual WebString description() const; + virtual WebString version() const; + virtual WebDOMStringList objectStores() const; + + virtual void createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, WebIDBCallbacks* callbacks); + virtual WebIDBObjectStore* objectStore(const WebString& name, unsigned short mode); + virtual void removeObjectStore(const WebString& name, WebIDBCallbacks* callbacks); private: - WTF::RefPtr<WebCore::IDBDatabase> m_idbDatabase; + WTF::RefPtr<WebCore::IDBDatabase> m_database; }; } // namespace WebKit diff --git a/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp b/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp new file mode 100755 index 0000000..a41010a --- /dev/null +++ b/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebIDBObjectStoreImpl.h" + +#include "DOMStringList.h" +#include "IDBCallbacksProxy.h" +#include "IDBObjectStore.h" +#include "WebIDBIndexImpl.h" + +#if ENABLE(INDEXED_DATABASE) + +using namespace WebCore; + +namespace WebKit { + +WebIDBObjectStoreImpl::WebIDBObjectStoreImpl(PassRefPtr<IDBObjectStore> objectStore) + : m_objectStore(objectStore) +{ +} + +WebIDBObjectStoreImpl::~WebIDBObjectStoreImpl() +{ +} + +WebString WebIDBObjectStoreImpl::name() const +{ + return m_objectStore->name(); +} + +WebString WebIDBObjectStoreImpl::keyPath() const +{ + return m_objectStore->keyPath(); +} + +WebDOMStringList WebIDBObjectStoreImpl::indexNames() const +{ + return m_objectStore->indexNames(); +} + +void WebIDBObjectStoreImpl::createIndex(const WebString& name, const WebString& keyPath, bool unique, WebIDBCallbacks* callbacks) +{ + m_objectStore->createIndex(name, keyPath, unique, IDBCallbacksProxy::create(callbacks)); +} + +WebIDBIndex* WebIDBObjectStoreImpl::index(const WebString& name) +{ + RefPtr<IDBIndex> index = m_objectStore->index(name); + if (!index) + return 0; + return new WebIDBIndexImpl(index); +} + +void WebIDBObjectStoreImpl::removeIndex(const WebString& name, WebIDBCallbacks* callbacks) +{ + m_objectStore->removeIndex(name, IDBCallbacksProxy::create(callbacks)); +} + +} // namespace WebCore + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/WebIDBObjectStoreImpl.h b/WebKit/chromium/src/WebIDBObjectStoreImpl.h new file mode 100755 index 0000000..f59840f --- /dev/null +++ b/WebKit/chromium/src/WebIDBObjectStoreImpl.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebIDBObjectStoreImpl_h +#define WebIDBObjectStoreImpl_h + +#include "WebCommon.h" +#include "WebIDBObjectStore.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { class IDBObjectStore; } + +namespace WebKit { + +class WebIDBIndex; + +// See comment in WebIndexedObjectStore for a high level overview these classes. +class WebIDBObjectStoreImpl : public WebIDBObjectStore { +public: + WebIDBObjectStoreImpl(WTF::PassRefPtr<WebCore::IDBObjectStore> objectStore); + virtual ~WebIDBObjectStoreImpl(); + + virtual WebString name() const; + virtual WebString keyPath() const; + virtual WebDOMStringList indexNames() const; + + virtual void createIndex(const WebString& name, const WebString& keyPath, bool unique, WebIDBCallbacks* callbacks); + virtual WebIDBIndex* index(const WebString& name); + virtual void removeIndex(const WebString& name, WebIDBCallbacks* callbacks); + + private: + WTF::RefPtr<WebCore::IDBObjectStore> m_objectStore; +}; + +} // namespace WebKit + +#endif // WebIDBObjectStoreImpl_h diff --git a/WebKit/chromium/src/WebImageCG.cpp b/WebKit/chromium/src/WebImageCG.cpp index 60b2449..045c8be 100644 --- a/WebKit/chromium/src/WebImageCG.cpp +++ b/WebKit/chromium/src/WebImageCG.cpp @@ -89,14 +89,16 @@ WebSize WebImage::size() const WebImage::WebImage(const PassRefPtr<Image>& image) : m_imageRef(0) { - if (image.get()) - assign(image->nativeImageForCurrentFrame()); + NativeImagePtr p; + if (image.get() && (p = image->nativeImageForCurrentFrame())) + assign(p); } WebImage& WebImage::operator=(const PassRefPtr<Image>& image) { - if (image.get()) - assign(image->nativeImageForCurrentFrame()); + NativeImagePtr p; + if (image.get() && (p = image->nativeImageForCurrentFrame())) + assign(p); else reset(); return *this; diff --git a/WebKit/chromium/src/WebIndexedDatabaseImpl.cpp b/WebKit/chromium/src/WebIndexedDatabaseImpl.cpp index 00122ad..27a6247 100644 --- a/WebKit/chromium/src/WebIndexedDatabaseImpl.cpp +++ b/WebKit/chromium/src/WebIndexedDatabaseImpl.cpp @@ -57,9 +57,9 @@ WebIndexedDatabaseImpl::~WebIndexedDatabaseImpl() { } -void WebIndexedDatabaseImpl::open(const WebString& name, const WebString& description, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame*, int& exceptionCode) +void WebIndexedDatabaseImpl::open(const WebString& name, const WebString& description, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame*) { - m_indexedDatabase->open(name, description, IDBCallbacksProxy::create(callbacks), origin, 0, exceptionCode); + m_indexedDatabase->open(name, description, IDBCallbacksProxy::create(callbacks), origin, 0); } } // namespace WebKit diff --git a/WebKit/chromium/src/WebIndexedDatabaseImpl.h b/WebKit/chromium/src/WebIndexedDatabaseImpl.h index 072a92b..76781e5 100644 --- a/WebKit/chromium/src/WebIndexedDatabaseImpl.h +++ b/WebKit/chromium/src/WebIndexedDatabaseImpl.h @@ -41,7 +41,7 @@ public: WebIndexedDatabaseImpl(); virtual ~WebIndexedDatabaseImpl(); - virtual void open(const WebString& name, const WebString& description, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*, int& exceptionCode); + virtual void open(const WebString& name, const WebString& description, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*); private: WTF::RefPtr<WebCore::IndexedDatabase> m_indexedDatabase; diff --git a/WebKit/chromium/src/WebInputElement.cpp b/WebKit/chromium/src/WebInputElement.cpp index 68bb91e..18bafd6 100644 --- a/WebKit/chromium/src/WebInputElement.cpp +++ b/WebKit/chromium/src/WebInputElement.cpp @@ -85,6 +85,21 @@ WebString WebInputElement::value() const return constUnwrap<HTMLInputElement>()->value(); } +void WebInputElement::setPlaceholder(const WebString& value) +{ + unwrap<HTMLInputElement>()->setPlaceholder(value); +} + +WebString WebInputElement::placeholder() const +{ + return constUnwrap<HTMLInputElement>()->placeholder(); +} + +bool WebInputElement::isAutofilled() const +{ + return constUnwrap<HTMLInputElement>()->isAutofilled(); +} + void WebInputElement::setAutofilled(bool autoFilled) { unwrap<HTMLInputElement>()->setAutofilled(autoFilled); diff --git a/WebKit/chromium/src/WebPluginContainerImpl.cpp b/WebKit/chromium/src/WebPluginContainerImpl.cpp index 5807a79..d099048 100644 --- a/WebKit/chromium/src/WebPluginContainerImpl.cpp +++ b/WebKit/chromium/src/WebPluginContainerImpl.cpp @@ -60,6 +60,7 @@ #include "KeyboardEvent.h" #include "MouseEvent.h" #include "Page.h" +#include "RenderBox.h" #include "ScrollView.h" #include "WheelEvent.h" diff --git a/WebKit/chromium/src/WebSearchableFormData.cpp b/WebKit/chromium/src/WebSearchableFormData.cpp index 601a497..14ece13 100644 --- a/WebKit/chromium/src/WebSearchableFormData.cpp +++ b/WebKit/chromium/src/WebSearchableFormData.cpp @@ -187,8 +187,8 @@ bool HasSuitableTextElement(const HTMLFormElement* form, Vector<char>* encodedSt if (!formElement->appendFormData(dataList, false)) continue; - const Vector<FormDataList::Item>& itemList = dataList.list(); - if (isTextElement && !itemList.isEmpty()) { + const BlobItemList& items = dataList.items(); + if (isTextElement && !items.isEmpty()) { if (textElement) { // The auto-complete bar only knows how to fill in one value. // This form has multiple fields; don't treat it as searchable. @@ -196,20 +196,22 @@ bool HasSuitableTextElement(const HTMLFormElement* form, Vector<char>* encodedSt } textElement = static_cast<HTMLInputElement*>(formElement); } - for (Vector<FormDataList::Item>::const_iterator j(itemList.begin()); j != itemList.end(); ++j) { + for (BlobItemList::const_iterator j(items.begin()); j != items.end(); ++j) { + const StringBlobItem* item = (*j)->toStringBlobItem(); + ASSERT(item); // Handle ISINDEX / <input name=isindex> specially, but only if it's // the first entry. - if (!encodedString->isEmpty() || j->data() != "isindex") { + if (!encodedString->isEmpty() || item->cstr() != "isindex") { if (!encodedString->isEmpty()) encodedString->append('&'); - FormDataBuilder::encodeStringAsFormData(*encodedString, j->data()); + FormDataBuilder::encodeStringAsFormData(*encodedString, item->cstr()); encodedString->append('='); } ++j; if (formElement == textElement) encodedString->append("{searchTerms}", 13); else - FormDataBuilder::encodeStringAsFormData(*encodedString, j->data()); + FormDataBuilder::encodeStringAsFormData(*encodedString, item->cstr()); } } diff --git a/WebKit/chromium/src/WebSettingsImpl.cpp b/WebKit/chromium/src/WebSettingsImpl.cpp index 946782b..7e89a77 100644 --- a/WebKit/chromium/src/WebSettingsImpl.cpp +++ b/WebKit/chromium/src/WebSettingsImpl.cpp @@ -271,7 +271,7 @@ void WebSettingsImpl::setShowDebugBorders(bool show) void WebSettingsImpl::setEditingBehavior(EditingBehavior behavior) { - m_settings->setEditingBehavior(static_cast<WebCore::EditingBehavior>(behavior)); + m_settings->setEditingBehaviorType(static_cast<WebCore::EditingBehaviorType>(behavior)); } void WebSettingsImpl::setAcceleratedCompositingEnabled(bool enabled) diff --git a/WebKit/chromium/src/WebURLResponse.cpp b/WebKit/chromium/src/WebURLResponse.cpp index 1aba54e..d5ba707 100644 --- a/WebKit/chromium/src/WebURLResponse.cpp +++ b/WebKit/chromium/src/WebURLResponse.cpp @@ -287,6 +287,16 @@ void WebURLResponse::setWasNpnNegotiated(bool value) m_private->m_resourceResponse->setWasNpnNegotiated(value); } +bool WebURLResponse::wasFetchedViaProxy() const +{ + return m_private->m_resourceResponse->wasFetchedViaProxy(); +} + +void WebURLResponse::setWasFetchedViaProxy(bool value) +{ + m_private->m_resourceResponse->setWasFetchedViaProxy(value); +} + bool WebURLResponse::isMultipartPayload() const { return m_private->m_resourceResponse->isMultipartPayload(); diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp index a38995e..5adc35c 100644 --- a/WebKit/chromium/src/WebViewImpl.cpp +++ b/WebKit/chromium/src/WebViewImpl.cpp @@ -681,7 +681,7 @@ bool WebViewImpl::sendContextMenuEvent(const WebKeyboardEvent& event) Node* focusedNode = focusedFrame->document()->focusedNode(); Position start = mainFrameImpl->selection()->selection().start(); - if (focusedFrame->editor() && focusedFrame->editor()->canEdit() && start.node()) { + if (start.node()) { RenderObject* renderer = start.node()->renderer(); if (!renderer) return false; @@ -827,6 +827,45 @@ bool WebViewImpl::mapKeyCodeForScroll(int keyCode, return true; } +// Computes the distance from a point outside a rect to the nearest edge of the rect. +static IntSize distanceToRect(const IntPoint& point, const IntRect& rect) +{ + int dx = 0, dy = 0; + if (point.x() < rect.x()) + dx = point.x() - rect.x(); + else if (rect.right() < point.x()) + dx = point.x() - rect.right(); + if (point.y() < rect.y()) + dy = point.y() - rect.y(); + else if (rect.bottom() < point.y()) + dy = point.y() - rect.bottom(); + return IntSize(dx, dy); +} + +void WebViewImpl::scrollForDragging(const WebPoint& clientPoint) +{ + // This margin approximates Safari behavior, derived from an observation. + static const int scrollMargin = 30; + + FrameView* view = mainFrameImpl()->frameView(); + if (!view) + return; + + IntRect bounds(0, 0, view->visibleWidth(), view->visibleHeight()); + bounds.setY(bounds.y() + scrollMargin); + bounds.setHeight(bounds.height() - scrollMargin * 2); + bounds.setX(bounds.x() + scrollMargin); + bounds.setWidth(bounds.width() - scrollMargin * 2); + + IntPoint point = clientPoint; + if (bounds.contains(point)) + return; + + IntSize toScroll = distanceToRect(point, bounds); + if (!toScroll.isZero()) + view->scrollBy(toScroll); +} + void WebViewImpl::hideSelectPopup() { if (m_selectPopup.get()) @@ -1539,6 +1578,14 @@ void WebViewImpl::dragSourceEndedAt( static_cast<DragOperation>(operation)); } +void WebViewImpl::dragSourceMovedTo( + const WebPoint& clientPoint, + const WebPoint& screenPoint, + WebDragOperation operation) +{ + scrollForDragging(clientPoint); +} + void WebViewImpl::dragSourceSystemDragEnded() { // It's possible for us to get this callback while not doing a drag if @@ -1659,6 +1706,9 @@ WebDragOperation WebViewImpl::dragTargetDragEnterOrOver(const WebPoint& clientPo } else m_dragOperation = static_cast<WebDragOperation>(effect); + if (dragAction == DragOver) + scrollForDragging(clientPoint); + return m_dragOperation; } @@ -1736,10 +1786,10 @@ void WebViewImpl::applyAutoFillSuggestions( const WebNode& node, const WebVector<WebString>& names, const WebVector<WebString>& labels, - int defaultSuggestionIndex) + int separatorIndex) { ASSERT(names.size() == labels.size()); - ASSERT(defaultSuggestionIndex < static_cast<int>(names.size())); + ASSERT(separatorIndex < static_cast<int>(names.size())); if (names.isEmpty()) { hideSuggestionsPopup(); @@ -1764,7 +1814,7 @@ void WebViewImpl::applyAutoFillSuggestions( m_autoFillPopupClient.set(new AutoFillPopupMenuClient); m_autoFillPopupClient->initialize(inputElem, names, labels, - defaultSuggestionIndex); + separatorIndex); if (m_suggestionsPopupClient != m_autoFillPopupClient.get()) { hideSuggestionsPopup(); @@ -1781,7 +1831,7 @@ void WebViewImpl::applyAutoFillSuggestions( m_suggestionsPopup = m_autoFillPopup.get(); if (m_suggestionsPopupShowing) { - m_autoFillPopupClient->setSuggestions(names, labels); + m_autoFillPopupClient->setSuggestions(names, labels, separatorIndex); refreshSuggestionsPopup(); } else { m_suggestionsPopup->show(focusedNode->getRect(), diff --git a/WebKit/chromium/src/WebViewImpl.h b/WebKit/chromium/src/WebViewImpl.h index b2fc680..8b15f8a 100644 --- a/WebKit/chromium/src/WebViewImpl.h +++ b/WebKit/chromium/src/WebViewImpl.h @@ -132,6 +132,10 @@ public: const WebPoint& clientPoint, const WebPoint& screenPoint, WebDragOperation operation); + virtual void dragSourceMovedTo( + const WebPoint& clientPoint, + const WebPoint& screenPoint, + WebDragOperation operation); virtual void dragSourceSystemDragEnded(); virtual WebDragOperation dragTargetDragEnter( const WebDragData& dragData, int identity, @@ -162,7 +166,7 @@ public: const WebNode&, const WebVector<WebString>& names, const WebVector<WebString>& labels, - int defaultSuggestionIndex); + int separatorIndex); virtual void applyAutocompleteSuggestions( const WebNode&, const WebVector<WebString>& suggestions, @@ -347,6 +351,8 @@ private: // Returns true if the view was scrolled. bool scrollViewWithKeyboard(int keyCode, int modifiers); + void scrollForDragging(const WebPoint&); + void hideSelectPopup(); // Converts |pos| from window coordinates to contents coordinates and gets diff --git a/WebKit/chromium/src/gtk/WebInputEventFactory.cpp b/WebKit/chromium/src/gtk/WebInputEventFactory.cpp index f4db5ee..dc46b07 100644 --- a/WebKit/chromium/src/gtk/WebInputEventFactory.cpp +++ b/WebKit/chromium/src/gtk/WebInputEventFactory.cpp @@ -151,6 +151,60 @@ static int gdkEventToWindowsKeyCode(const GdkEventKey* event) GDK_period, // 0x3C: GDK_period GDK_slash, // 0x3D: GDK_slash 0, // 0x3E: GDK_Shift_R + 0, // 0x3F: + 0, // 0x40: + 0, // 0x41: + 0, // 0x42: + 0, // 0x43: + 0, // 0x44: + 0, // 0x45: + 0, // 0x46: + 0, // 0x47: + 0, // 0x48: + 0, // 0x49: + 0, // 0x4A: + 0, // 0x4B: + 0, // 0x4C: + 0, // 0x4D: + 0, // 0x4E: + 0, // 0x4F: + 0, // 0x50: + 0, // 0x51: + 0, // 0x52: + 0, // 0x53: + 0, // 0x54: + 0, // 0x55: + 0, // 0x56: + 0, // 0x57: + 0, // 0x58: + 0, // 0x59: + 0, // 0x5A: + 0, // 0x5B: + 0, // 0x5C: + 0, // 0x5D: + 0, // 0x5E: + 0, // 0x5F: + 0, // 0x60: + 0, // 0x61: + 0, // 0x62: + 0, // 0x63: + 0, // 0x64: + 0, // 0x65: + 0, // 0x66: + 0, // 0x67: + 0, // 0x68: + 0, // 0x69: + 0, // 0x6A: + 0, // 0x6B: + 0, // 0x6C: + 0, // 0x6D: + 0, // 0x6E: + 0, // 0x6F: + 0, // 0x70: + 0, // 0x71: + 0, // 0x72: + GDK_Super_L, // 0x73: GDK_Super_L + GDK_Super_R, // 0x74: GDK_Super_R }; // |windowsKeyCode| has to include a valid virtual-key code even when we diff --git a/WebKit/chromium/src/js/DebuggerAgent.js b/WebKit/chromium/src/js/DebuggerAgent.js index 67e54aa..8d2457f 100644 --- a/WebKit/chromium/src/js/DebuggerAgent.js +++ b/WebKit/chromium/src/js/DebuggerAgent.js @@ -181,7 +181,7 @@ devtools.DebuggerAgent.prototype.initUI = function() // 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() + 1); + WebInspector.parsedScriptSource(scriptId, script.getUrl(), undefined /* script source */, script.getLineOffset() + 1, script.worldType()); this.restoreBreakpoints_(scriptId, script.getUrl()); } return; @@ -307,7 +307,7 @@ devtools.DebuggerAgent.prototype.addBreakpoint = function(sourceId, line, enable /** - * Changes given line of the script. + * Changes given line of the script. */ devtools.DebuggerAgent.prototype.editScriptSource = function(sourceId, newContent, callback) { @@ -319,12 +319,31 @@ devtools.DebuggerAgent.prototype.editScriptSource = function(sourceId, newConten var cmd = new devtools.DebugCommand("changelive", commandArguments); devtools.DebuggerAgent.sendCommand_(cmd); this.requestSeqToCallback_[cmd.getSequenceNumber()] = function(msg) { - if (!msg.isSuccess()) - WebInspector.log("Unable to modify source code within given scope. Only function bodies are editable at the moment.", WebInspector.ConsoleMessage.MessageLevel.Warning); - this.resolveScriptSource(sourceId, callback); - if (WebInspector.panels.scripts.paused) - this.requestBacktrace_(); + if (!msg.isSuccess()) { + callback(false, "Unable to modify source code within given scope. Only function bodies are editable at the moment.", null); + return; + } + + this.resolveScriptSource(sourceId, requestBacktrace.bind(this)); }.bind(this); + + + function requestBacktrace(newScriptSource) { + if (WebInspector.panels.scripts.paused) + this.requestBacktrace_(handleBacktraceResponse.bind(this, newScriptSource)); + else + reportDidCommitEditing(newScriptSource); + } + + function handleBacktraceResponse(newScriptSource, msg) { + this.updateCallFramesFromBacktraceResponse_(msg); + reportDidCommitEditing(newScriptSource, this.callFrames_); + } + + function reportDidCommitEditing(newScriptSource, callFrames) { + callback(true, newScriptSource, callFrames); + } + RemoteDebuggerAgent.processDebugCommands(); }; @@ -679,12 +698,14 @@ devtools.DebuggerAgent.prototype.requestClearBreakpoint_ = function(breakpointId /** * Sends "backtrace" request to v8. */ -devtools.DebuggerAgent.prototype.requestBacktrace_ = function() +devtools.DebuggerAgent.prototype.requestBacktrace_ = function(opt_customHandler) { var cmd = new devtools.DebugCommand("backtrace", { "compactFormat":true }); devtools.DebuggerAgent.sendCommand_(cmd); + var responseHandler = opt_customHandler ? opt_customHandler : this.handleBacktraceResponse_.bind(this); + this.requestSeqToCallback_[cmd.getSequenceNumber()] = responseHandler; }; @@ -800,7 +821,7 @@ devtools.DebuggerAgent.prototype.handleDebuggerOutput_ = function(output) else if (msg.getCommand() === "clearbreakpoint") this.handleClearBreakpointResponse_(msg); else if (msg.getCommand() === "backtrace") - this.handleBacktraceResponse_(msg); + this.invokeCallbackForResponse_(msg); else if (msg.getCommand() === "lookup") this.invokeCallbackForResponse_(msg); else if (msg.getCommand() === "evaluate") @@ -948,17 +969,17 @@ devtools.DebuggerAgent.prototype.handleAfterCompileEvent_ = function(msg) 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); + return; + var contextType = context.data.substring(0, comma); + var info = new devtools.ScriptInfo(script.id, script.name, script.lineOffset, contextType); + this.parsedScripts_[script.id] = info; if (this.scriptsPanelInitialized_) { // Only report script as parsed after scripts panel has been shown. - WebInspector.parsedScriptSource(script.id, script.name, script.source, script.lineOffset + 1); + WebInspector.parsedScriptSource(script.id, script.name, script.source, script.lineOffset + 1, info.worldType()); this.restoreBreakpoints_(script.id, script.name); } }; @@ -991,13 +1012,20 @@ devtools.DebuggerAgent.prototype.handleBacktraceResponse_ = function(msg) */ devtools.DebuggerAgent.prototype.doHandleBacktraceResponse_ = function(msg) { + this.updateCallFramesFromBacktraceResponse_(msg); + WebInspector.pausedScript(this.callFrames_); + this.showPendingExceptionMessage_(); + InspectorFrontendHost.bringToFront(); +}; + + +devtools.DebuggerAgent.prototype.updateCallFramesFromBacktraceResponse_ = 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.bringToFront(); + return this.callFrames_; }; @@ -1044,7 +1072,7 @@ devtools.DebuggerAgent.prototype.formatCallFrame_ = function(stackFrame) 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); + WebInspector.parsedScriptSource(sourceId, null, null, 0, WebInspector.Script.WorldType.MAIN_WORLD); } var funcName = func.name || func.inferredName || "(anonymous function)"; @@ -1257,6 +1285,14 @@ devtools.ScriptInfo.prototype.isUnresolved = function() }; +devtools.ScriptInfo.prototype.worldType = function() +{ + if (this.contextType_ === "injected") + return WebInspector.Script.WorldType.EXTENSIONS_WORLD; + return WebInspector.Script.WorldType.MAIN_WORLD; +}; + + /** * @param {number} line 0-based line number in the script. * @return {?devtools.BreakpointInfo} Information on a breakpoint at the diff --git a/WebKit/chromium/src/js/DebuggerScript.js b/WebKit/chromium/src/js/DebuggerScript.js index 7e5b430..3ff3eb7 100644 --- a/WebKit/chromium/src/js/DebuggerScript.js +++ b/WebKit/chromium/src/js/DebuggerScript.js @@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -function debuggerScriptConstructor() { +(function () { var DebuggerScript = {}; DebuggerScript._breakpoints = {}; @@ -39,6 +39,11 @@ DebuggerScript.PauseOnExceptionsState = { PauseOnUncaughtExceptions: 2 }; +DebuggerScript.ScriptWorldType = { + MainWorld : 0, + ExtensionsWorld : 1 +}; + DebuggerScript._pauseOnExceptionsState = DebuggerScript.PauseOnExceptionsState.DontPauseOnExceptions; Debug.clearBreakOnException(); Debug.clearBreakOnUncaughtException(); @@ -50,11 +55,21 @@ DebuggerScript.getAfterCompileScript = function(eventData) DebuggerScript.getScripts = function(contextData) { - var scripts = Debug.scripts(); var result = []; + + if (!contextData) + return result; + var comma = contextData.indexOf(","); + if (comma === -1) + return result; + // Context data is a string in the following format: + // ("page"|"injected")","<page id> + var idSuffix = contextData.substring(comma); // including the comma + + var scripts = Debug.scripts(); for (var i = 0; i < scripts.length; ++i) { var script = scripts[i]; - if (contextData === script.context_data) + if (script.context_data && script.context_data.lastIndexOf(idSuffix) != -1) result.push(DebuggerScript._formatScript(script)); } return result; @@ -62,13 +77,16 @@ DebuggerScript.getScripts = function(contextData) DebuggerScript._formatScript = function(script) { + var scriptWorldType = DebuggerScript.ScriptWorldType.MainWorld; + if (script.context_data && script.context_data.indexOf("injected") == 0) + scriptWorldType = DebuggerScript.ScriptWorldType.ExtensionsWorld; return { id: script.id, name: script.name, source: script.source, lineOffset: script.line_offset, lineCount: script.lineCount(), - contextData: script.context_data + scriptWorldType: scriptWorldType }; } @@ -152,6 +170,24 @@ DebuggerScript.stepOutOfFunction = function(execState) execState.prepareStep(Debug.StepAction.StepOut, 1); } +DebuggerScript.editScriptSource = function(scriptId, newSource) +{ + var scripts = Debug.scripts(); + var scriptToEdit = null; + for (var i = 0; i < scripts.length; i++) { + if (scripts[i].id == scriptId) { + scriptToEdit = scripts[i]; + break; + } + } + if (!scriptToEdit) + throw("Script not found"); + + var changeLog = []; + Debug.LiveEdit.SetScriptSource(scriptToEdit, newSource, changeLog); + return scriptToEdit.source; +} + DebuggerScript.clearBreakpoints = function(execState, args) { for (var key in DebuggerScript._breakpoints) { @@ -239,4 +275,4 @@ DebuggerScript._v8ToWebkitLineNumber = function(line) return DebuggerScript; -} +})(); diff --git a/WebKit/chromium/src/js/DevTools.js b/WebKit/chromium/src/js/DevTools.js index 6e9c090..398d358 100644 --- a/WebKit/chromium/src/js/DevTools.js +++ b/WebKit/chromium/src/js/DevTools.js @@ -183,8 +183,8 @@ WebInspector.loaded = function() Preferences.heapProfilerPresent = true; Preferences.debuggerAlwaysEnabled = true; Preferences.profilerAlwaysEnabled = true; - RemoteDebuggerAgent.setDebuggerScriptSource("(" + debuggerScriptConstructor + ")();"); - + Preferences.canEditScriptSource = true; + oldLoaded.call(this); InspectorFrontendHost.loaded(); @@ -210,42 +210,6 @@ document.addEventListener("DOMContentLoaded", devtools.domContentLoaded, false); if (!window.v8ScriptDebugServerEnabled) { -/** - * 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._prependWhitespace(this.script.source)); - this._sourceFrameSetup = true; - delete this._frameNeedsSetup; -}; - - (function() { var oldShow = WebInspector.ScriptsPanel.prototype.show; @@ -296,6 +260,21 @@ InjectedScriptAccess.prototype.getCompletions = function(expressionString, inclu }; })(); +// 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; + }; +})(); + } @@ -349,22 +328,6 @@ WebInspector.UIString = function(string) })(); -// 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() { diff --git a/WebKit/chromium/src/js/DevToolsHostStub.js b/WebKit/chromium/src/js/DevToolsHostStub.js index cae4a1e..da5929a 100644 --- a/WebKit/chromium/src/js/DevToolsHostStub.js +++ b/WebKit/chromium/src/js/DevToolsHostStub.js @@ -55,10 +55,6 @@ RemoteDebuggerAgentStub.prototype.processDebugCommands = function() }; -RemoteDebuggerAgentStub.prototype.setDebuggerScriptSource = function(source) -{ -}; - /** * @constructor diff --git a/WebKit/chromium/src/js/InspectorControllerImpl.js b/WebKit/chromium/src/js/InspectorControllerImpl.js index 86f885a..327ca8f 100644 --- a/WebKit/chromium/src/js/InspectorControllerImpl.js +++ b/WebKit/chromium/src/js/InspectorControllerImpl.js @@ -61,13 +61,16 @@ devtools.InspectorBackendImpl = function() this.installInspectorControllerDelegate_("getResourceContent"); this.installInspectorControllerDelegate_("highlightDOMNode"); this.installInspectorControllerDelegate_("hideDOMNodeHighlight"); + this.installInspectorControllerDelegate_("performSearch"); this.installInspectorControllerDelegate_("releaseWrapperObjectGroup"); this.installInspectorControllerDelegate_("removeAllScriptsToEvaluateOnLoad"); this.installInspectorControllerDelegate_("reloadPage"); this.installInspectorControllerDelegate_("removeAttribute"); this.installInspectorControllerDelegate_("removeDOMStorageItem"); this.installInspectorControllerDelegate_("removeNode"); - this.installInspectorControllerDelegate_("saveFrontendSettings"); + this.installInspectorControllerDelegate_("saveApplicationSettings"); + this.installInspectorControllerDelegate_("saveSessionSettings"); + this.installInspectorControllerDelegate_("searchCanceled"); this.installInspectorControllerDelegate_("setAttribute"); this.installInspectorControllerDelegate_("setDOMStorageItem"); this.installInspectorControllerDelegate_("setInjectedScriptSource"); @@ -93,6 +96,8 @@ devtools.InspectorBackendImpl = function() if (window.v8ScriptDebugServerEnabled) { this.installInspectorControllerDelegate_("disableDebugger"); + this.installInspectorControllerDelegate_("editScriptSource"); + this.installInspectorControllerDelegate_("getScriptSource"); this.installInspectorControllerDelegate_("enableDebugger"); this.installInspectorControllerDelegate_("setBreakpoint"); this.installInspectorControllerDelegate_("removeBreakpoint"); @@ -143,12 +148,22 @@ devtools.InspectorBackendImpl.prototype.removeBreakpoint = function(sourceID, li devtools.InspectorBackendImpl.prototype.editScriptSource = function(callID, sourceID, newContent) { - devtools.tools.getDebuggerAgent().editScriptSource(sourceID, newContent, function(newFullBody) { - WebInspector.didEditScriptSource(callID, newFullBody); + devtools.tools.getDebuggerAgent().editScriptSource(sourceID, newContent, function(success, newBodyOrErrorMessage, callFrames) { + WebInspector.didEditScriptSource(callID, success, newBodyOrErrorMessage, callFrames); }); }; +devtools.InspectorBackendImpl.prototype.getScriptSource = function(callID, sourceID) +{ + devtools.tools.getDebuggerAgent().resolveScriptSource( + sourceID, + function(source) { + WebInspector.didGetScriptSource(callID, source); + }); +}; + + devtools.InspectorBackendImpl.prototype.activateBreakpoints = function() { devtools.tools.getDebuggerAgent().setBreakpointsActivated(true); diff --git a/WebKit/chromium/src/js/Tests.js b/WebKit/chromium/src/js/Tests.js index 758b8c0..fa910ab 100644 --- a/WebKit/chromium/src/js/Tests.js +++ b/WebKit/chromium/src/js/Tests.js @@ -1279,8 +1279,8 @@ TestSuite.prototype.testStepIn = function() }, { functionsOnStack: ["fact","d","a","(anonymous function)"], - lineNumber: 15, - lineText: " return r;" + lineNumber: 10, + lineText: " var r = 1;" }, function() { test.releaseControl(); diff --git a/WebKit/chromium/src/js/devTools.css b/WebKit/chromium/src/js/devTools.css index 2cb4ab3..0e6d284 100755 --- a/WebKit/chromium/src/js/devTools.css +++ b/WebKit/chromium/src/js/devTools.css @@ -1,7 +1,3 @@ -#scripts-files option.injected { - color: rgb(70, 134, 240); -} - .data-grid table { line-height: 120%; } diff --git a/WebKit/chromium/tests/PopupMenuTest.cpp b/WebKit/chromium/tests/PopupMenuTest.cpp index c98ea74..2756f9d 100644 --- a/WebKit/chromium/tests/PopupMenuTest.cpp +++ b/WebKit/chromium/tests/PopupMenuTest.cpp @@ -59,6 +59,8 @@ public: { m_selectIndex = listIndex; } + virtual void selectionChanged(unsigned, bool) {} + virtual void selectionCleared() {} virtual String itemText(unsigned listIndex) const { diff --git a/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp b/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp index 8892d7f..2fa860a 100644 --- a/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp +++ b/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp @@ -58,4 +58,11 @@ void InspectorClientEfl::storeSetting(const String&, const String&) notImplemented(); } +bool InspectorClientEfl::sendMessageToFrontend(const String&) +{ + notImpelemented(); + return false; +} + + } diff --git a/WebKit/efl/WebCoreSupport/InspectorClientEfl.h b/WebKit/efl/WebCoreSupport/InspectorClientEfl.h index 30c9caf..1ca646d 100644 --- a/WebKit/efl/WebCoreSupport/InspectorClientEfl.h +++ b/WebKit/efl/WebCoreSupport/InspectorClientEfl.h @@ -50,6 +50,8 @@ public: virtual void populateSetting(const String& key, String* value); virtual void storeSetting(const String& key, const String& value); + + virtual bool sendMessageToFrontend(const String&); }; } diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog index ec1727d..d1652dc 100644 --- a/WebKit/gtk/ChangeLog +++ b/WebKit/gtk/ChangeLog @@ -1,3 +1,243 @@ +2010-06-14 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Pavel Feldman. + + WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc + data from inspected page to WebInspector as JSON string via http. The native + serialization to JSON string is supported by InspectorValue's classes. This patch + has the implementation of sendMessageToFrontend function. WebKit version of it still + uses ScriptFunctionCall and will be switched to another transport a little bit later. + https://bugs.webkit.org/show_bug.cgi?id=40134 + + * WebCoreSupport/InspectorClientGtk.cpp: + (WebKit::InspectorClient::releaseFrontendPage): + (WebKit::InspectorClient::sendMessageToFrontend): + * WebCoreSupport/InspectorClientGtk.h: + +2010-06-10 Eric Seidel <eric@webkit.org> + + Reviewed by Adam Barth. + + Reduce FrameView.h includes to speed up build times + https://bugs.webkit.org/show_bug.cgi?id=40408 + + * webkit/webkitwebinspector.cpp: + - Include RenderLayer.h + +2010-06-09 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r60889. + http://trac.webkit.org/changeset/60889 + https://bugs.webkit.org/show_bug.cgi?id=40365 + + gtk bot has some kind of memory corruption (Requested by + loislo on #webkit). + + * WebCoreSupport/InspectorClientGtk.cpp: + (WebKit::InspectorClient::InspectorClient): + (WebKit::InspectorClient::openInspectorFrontend): + (WebKit::InspectorFrontendClient::InspectorFrontendClient): + (WebKit::InspectorFrontendClient::destroyInspectorWindow): + * WebCoreSupport/InspectorClientGtk.h: + +2010-06-07 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Pavel Feldman. + + WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc + data from inspected page to WebInspector as JSON string via http. The native + serialization to JSON string is supported by InspectorValue's classes. This patch + has the implementation of sendMessageToFrontend function. WebKit version of it still + uses ScriptFunctionCall and will be switched to another transport a little bit later. + https://bugs.webkit.org/show_bug.cgi?id=40134 + + * WebCoreSupport/InspectorClientGtk.cpp: + (WebKit::InspectorClient::releaseFrontendPage): + (WebKit::InspectorClient::sendMessageToFrontend): + * WebCoreSupport/InspectorClientGtk.h: + +2010-06-08 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + [GTK] Unit testing for WebKitDOMNode hierarchy walk + https://bugs.webkit.org/show_bug.cgi?id=40171 + + Add some DOM node unit testing. + + * tests/testdomnode.c: Added. + (finish_loading): + (dom_node_fixture_setup): + (dom_node_fixture_teardown): + (test_dom_node_hierarchy_navigation): + (main): + +2010-06-08 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Ojan Vafai and Darin Adler. + + Refactor platform dependent editing behavior code out of Settings + https://bugs.webkit.org/show_bug.cgi?id=39854 + + EditingBehavior enum was renamed to EditingBehaviorTypes and moved out from Settings.h to + EditingBehaviorTypes.h . Call sites in WebKit/ adjusted accordingly. + + * webkit/webkitprivate.cpp: + (WebKit::core): + * webkit/webkitprivate.h: + * webkit/webkitwebview.cpp: + (webkit_web_view_update_settings): + (webkit_web_view_settings_notify): + +2010-06-08 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + [GTK] Add inner-node property to WebKitHitTestResult + https://bugs.webkit.org/show_bug.cgi?id=40131 + + Add a 'inner-node' property to WebKitHitTestResult, carrying the + DOM node where the hit test happened. + + * tests/testhittestresult.c: + (load_status_cb): + * webkit/webkithittestresult.cpp: + (webkit_hit_test_result_get_property): + (webkit_hit_test_result_set_property): + (webkit_hit_test_result_class_init): + * webkit/webkitprivate.cpp: + (WebKit::kit): + +2010-06-07 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] gtk_widget_get_window should replace widget->window + https://bugs.webkit.org/show_bug.cgi?id=40180 + + Replace uses of widget->window with gtk_widget_get_window. + + * WebCoreSupport/ChromeClientGtk.cpp: + (WebKit::ChromeClient::invalidateContentsAndWindow): Replace widget->window uses. + (WebKit::ChromeClient::scroll): Ditto. + (WebKit::widgetScreenPosition): Ditto. + * WebCoreSupport/DragClientGtk.cpp: Move gtk_widget_get_window define to GtkVersioning.h. + * webkit/webkitwebview.cpp: + (webkit_web_view_popup_menu_handler): Replace widget->window uses. + (webkit_web_view_button_press_event): Ditto. + +2010-06-04 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] Drag gesture can take mouse grab indefinitely + https://bugs.webkit.org/show_bug.cgi?id=32840 + + Initiate drag events with the current GTK+ event instead of synthesizing + an event. Something about synthesized events is causing a drag freeze in + certain situations. + + * WebCoreSupport/DragClientGtk.cpp: + (WebKit::DragClient::startDrag): Start the drag with the current GTK+ event. + +2010-06-03 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r60632. + http://trac.webkit.org/changeset/60632 + https://bugs.webkit.org/show_bug.cgi?id=40143 + + This change broke the 64-bit bots. (Requested by mrobinson on + #webkit). + + * WebCoreSupport/DragClientGtk.cpp: + (WebKit::DragClient::DragClient): + (WebKit::DragClient::startDrag): + * WebCoreSupport/DragClientGtk.h: + +2010-06-03 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] Drag gesture can take mouse grab indefinitely + https://bugs.webkit.org/show_bug.cgi?id=32840 + + Start GTK+ drags with the previous mouse button down event instead of + synthesizing the event. The synthesized event was not completely valid + and froze some drags indefinitely. + + * WebCoreSupport/DragClientGtk.cpp: + (WebKit::buttonPressEvent): Added. + (WebKit::DragClient::DragClient): + Connect to the 'button-press-event' signal of the WebView. + (WebKit::DragClient::startDrag): + Instead of synthesizing a button press event use the last real one. + * WebCoreSupport/DragClientGtk.h: + (WebKit::DragClient::setLastButtonPressEvent): Added. + +2010-06-01 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + Memory Leak: The main resource of page is not free. + https://bugs.webkit.org/show_bug.cgi?id=39973 + + Fix refcount tracking of the main resource. Patch by Genhua Liu. + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::dispatchDidFinishLoading): + +2010-06-01 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + Fix-up for previous leak fix, the identifier was not always duped. + + * webkit/webkitprivate.h: + * webkit/webkitwebview.cpp: + (webkit_web_view_add_resource): + +2010-06-01 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + Plug a small leak. + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::assignIdentifierToInitialRequest): + +2010-06-01 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] Double clicks cause three button press events + https://bugs.webkit.org/show_bug.cgi?id=38853 + + Handle click counting much like the Windows port. GTK+ only + counts triple-clicks natively, so use GTK+ double-click settings + to count clicks with even larger click counts. Also filter the + extra GDK_BUTTON_PRESS before GDK_{2,3}BUTTON_PRESS events using + gdk_event_peek(). + + * webkit/webkitwebview.cpp: + (webkit_web_view_button_press_event): Count clicks manually. Filter extra events. + +2010-05-31 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Xan Lopez. + + [GTK] Missing links to documentation of general functions + https://bugs.webkit.org/show_bug.cgi?id=39964 + + Add global functions section, and move those functions that are + currently in WebKitWebView's source file to the bottom, along with + the description. + + * docs/webkitgtk-docs.sgml: + * docs/webkitgtk-sections.txt: + * webkit/webkitwebview.cpp: + (webkit_web_view_get_dom_document): + (webkit_get_default_session): + 2010-05-31 Martin Robinson <mrobinson@igalia.com> Reviewed by Gustavo Noronha Silva. diff --git a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp index 8a1d48b..5759601 100644 --- a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp @@ -336,7 +336,7 @@ void ChromeClient::invalidateWindow(const IntRect&, bool) void ChromeClient::invalidateContentsAndWindow(const IntRect& updateRect, bool immediate) { GdkRectangle rect = updateRect; - GdkWindow* window = GTK_WIDGET(m_webView)->window; + GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(m_webView)); if (window) { gdk_window_invalidate_rect(window, &rect, FALSE); @@ -353,7 +353,7 @@ void ChromeClient::invalidateContentsForSlowScroll(const IntRect& updateRect, bo void ChromeClient::scroll(const IntSize& delta, const IntRect& rectToScroll, const IntRect& clipRect) { - GdkWindow* window = GTK_WIDGET(m_webView)->window; + GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(m_webView)); if (!window) return; @@ -391,7 +391,7 @@ static IntPoint widgetScreenPosition(GtkWidget* widget) IntPoint result(widgetX, widgetY); int originX, originY; - gdk_window_get_origin(window->window, &originX, &originY); + gdk_window_get_origin(gtk_widget_get_window(window), &originX, &originY); result.move(originX, originY); return result; diff --git a/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp b/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp index c1e8e74..6c395c7 100644 --- a/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp @@ -26,17 +26,15 @@ #include "DragController.h" #include "Element.h" #include "Frame.h" +#include "GOwnPtrGtk.h" #include "GRefPtrGtk.h" +#include "GtkVersioning.h" #include "NotImplemented.h" #include "PasteboardHelper.h" #include "RenderObject.h" #include "webkitprivate.h" #include "webkitwebview.h" - #include <gtk/gtk.h> -#if !GTK_CHECK_VERSION(2, 14, 0) -#define gtk_widget_get_window(widget) (widget)->window -#endif using namespace WebCore; @@ -75,22 +73,16 @@ void DragClient::startDrag(DragImageRef image, const IntPoint& dragImageOrigin, WebKitWebView* webView = webkit_web_frame_get_web_view(kit(frame)); RefPtr<DataObjectGtk> dataObject = clipboardGtk->dataObject(); - GRefPtr<GtkTargetList> targetList(clipboardGtk->helper()->targetListForDataObject(dataObject.get())); - GdkEvent* event = gdk_event_new(GDK_BUTTON_PRESS); - // This will be decremented by gdk_event_free() below. - event->button.window = static_cast<GdkWindow*>(g_object_ref(gtk_widget_get_window(GTK_WIDGET(m_webView)))); - event->button.time = GDK_CURRENT_TIME; + GOwnPtr<GdkEvent> currentEvent(gtk_get_current_event()); - GdkDragContext* context = gtk_drag_begin(GTK_WIDGET(m_webView), targetList.get(), dragOperationToGdkDragActions(clipboard->sourceOperation()), 1, event); + GdkDragContext* context = gtk_drag_begin(GTK_WIDGET(m_webView), targetList.get(), dragOperationToGdkDragActions(clipboard->sourceOperation()), 1, currentEvent.get()); webView->priv->draggingDataObjects.set(context, dataObject); if (image) gtk_drag_set_icon_pixbuf(context, image, eventPos.x() - dragImageOrigin.x(), eventPos.y() - dragImageOrigin.y()); else gtk_drag_set_icon_default(context); - - gdk_event_free(event); } DragImageRef DragClient::createDragImageForLink(KURL&, const String&, Frame*) diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp index fd2d7ed..021374c 100644 --- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp @@ -235,7 +235,8 @@ void FrameLoaderClient::dispatchWillSendRequest(WebCore::DocumentLoader* loader, void FrameLoaderClient::assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader*, const ResourceRequest& request) { - webkit_web_view_add_resource(getViewFromFrame(m_frame), toString(identifier), + GOwnPtr<gchar> identifierString(toString(identifier)); + webkit_web_view_add_resource(getViewFromFrame(m_frame), identifierString.get(), WEBKIT_WEB_RESOURCE(g_object_new(WEBKIT_TYPE_WEB_RESOURCE, "uri", request.url().string().utf8().data(), 0))); } @@ -930,7 +931,7 @@ void FrameLoaderClient::dispatchDidFinishLoading(WebCore::DocumentLoader* loader return; if (!coreResource) - coreResource = loader->mainResource().releaseRef(); + coreResource = loader->mainResource(); webkit_web_resource_init_with_core_resource(webResource, coreResource.get()); diff --git a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp index 317a058..5e69c31 100644 --- a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp @@ -19,6 +19,7 @@ #include "config.h" #include "InspectorClientGtk.h" +#include "Frame.h" #include "webkitwebview.h" #include "webkitwebinspector.h" #include "webkitprivate.h" @@ -38,8 +39,18 @@ static void notifyWebViewDestroyed(WebKitWebView* webView, InspectorFrontendClie InspectorClient::InspectorClient(WebKitWebView* webView) : m_inspectedWebView(webView) + , m_frontendPage(0) + , m_frontendClient(0) {} +InspectorClient::~InspectorClient() +{ + if (m_frontendClient) { + m_frontendClient->disconnectInspectorClient(); + m_frontendClient = 0; + } +} + void InspectorClient::inspectorDestroyed() { delete this; @@ -80,8 +91,14 @@ void InspectorClient::openInspectorFrontend(InspectorController* controller) gtk_widget_show(GTK_WIDGET(inspectorWebView)); - Page* inspectorPage = core(inspectorWebView); - inspectorPage->inspectorController()->setInspectorFrontendClient(new InspectorFrontendClient(m_inspectedWebView, inspectorWebView, webInspector, inspectorPage)); + m_frontendPage = core(inspectorWebView); + m_frontendClient = new InspectorFrontendClient(m_inspectedWebView, inspectorWebView, webInspector, m_frontendPage, this); + m_frontendPage->inspectorController()->setInspectorFrontendClient(m_frontendClient); +} + +void InspectorClient::releaseFrontendPage() +{ + m_frontendPage = 0; } void InspectorClient::highlight(Node* node) @@ -104,14 +121,34 @@ void InspectorClient::storeSetting(const String& key, const String& value) notImplemented(); } +bool InspectorClient::sendMessageToFrontend(const String& message) +{ + if (!m_frontendPage) + return false; + + Frame* frame = m_frontendPage->mainFrame(); + if (!frame) + return false; + + ScriptController* scriptController = frame->script(); + if (!scriptController) + return false; + + String dispatchToFrontend("WebInspector.dispatchMessageToFrontend("); + dispatchToFrontend += message; + dispatchToFrontend += ");"; + scriptController->executeScript(dispatchToFrontend); + return true; +} bool destroyed = TRUE; -InspectorFrontendClient::InspectorFrontendClient(WebKitWebView* inspectedWebView, WebKitWebView* inspectorWebView, WebKitWebInspector* webInspector, Page* inspectorPage) +InspectorFrontendClient::InspectorFrontendClient(WebKitWebView* inspectedWebView, WebKitWebView* inspectorWebView, WebKitWebInspector* webInspector, Page* inspectorPage, InspectorClient* inspectorClient) : InspectorFrontendClientLocal(core(inspectedWebView)->inspectorController(), inspectorPage) , m_inspectorWebView(inspectorWebView) , m_inspectedWebView(inspectedWebView) , m_webInspector(webInspector) + , m_inspectorClient(inspectorClient) { g_signal_connect(m_inspectorWebView, "destroy", G_CALLBACK(notifyWebViewDestroyed), (gpointer)this); @@ -119,6 +156,10 @@ InspectorFrontendClient::InspectorFrontendClient(WebKitWebView* inspectedWebView InspectorFrontendClient::~InspectorFrontendClient() { + if (m_inspectorClient) { + m_inspectorClient->disconnectFrontendClient(); + m_inspectorClient = 0; + } ASSERT(!m_webInspector); } @@ -138,6 +179,9 @@ void InspectorFrontendClient::destroyInspectorWindow() g_signal_emit_by_name(webInspector, "close-window", &handled); ASSERT(handled); + if (m_inspectorClient) + m_inspectorClient->releaseFrontendPage(); + /* we should now dispose our own reference */ g_object_unref(webInspector); } diff --git a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h index cdb5375..fc9b6d8 100644 --- a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h +++ b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h @@ -42,9 +42,14 @@ namespace WebCore { namespace WebKit { + class InspectorFrontendClient; + class InspectorClient : public WebCore::InspectorClient { public: InspectorClient(WebKitWebView* webView); + ~InspectorClient(); + + void disconnectFrontendClient() { m_frontendClient = 0; } virtual void inspectorDestroyed(); @@ -56,13 +61,21 @@ namespace WebKit { virtual void populateSetting(const WebCore::String& key, WebCore::String* value); virtual void storeSetting(const WebCore::String& key, const WebCore::String& value); + virtual bool sendMessageToFrontend(const WebCore::String&); + + void releaseFrontendPage(); + private: WebKitWebView* m_inspectedWebView; + WebCore::Page* m_frontendPage; + InspectorFrontendClient* m_frontendClient; }; class InspectorFrontendClient : public WebCore::InspectorFrontendClientLocal { public: - InspectorFrontendClient(WebKitWebView* inspectedWebView, WebKitWebView* inspectorWebView, WebKitWebInspector* webInspector, WebCore::Page* inspectorPage); + InspectorFrontendClient(WebKitWebView* inspectedWebView, WebKitWebView* inspectorWebView, WebKitWebInspector* webInspector, WebCore::Page* inspectorPage, InspectorClient* inspectorClient); + + void disconnectInspectorClient() { m_inspectorClient = 0; } void destroyInspectorWindow(); @@ -86,6 +99,7 @@ namespace WebKit { WebKitWebView* m_inspectorWebView; WebKitWebView* m_inspectedWebView; WebKitWebInspector* m_webInspector; + InspectorClient* m_inspectorClient; }; } diff --git a/WebKit/gtk/docs/webkitgtk-docs.sgml b/WebKit/gtk/docs/webkitgtk-docs.sgml index 6201ca5..c6539af 100644 --- a/WebKit/gtk/docs/webkitgtk-docs.sgml +++ b/WebKit/gtk/docs/webkitgtk-docs.sgml @@ -10,6 +10,11 @@ </bookinfo> <chapter> + <title>Global functions + + + + Class Overview @@ -30,7 +35,6 @@ - diff --git a/WebKit/gtk/docs/webkitgtk-sections.txt b/WebKit/gtk/docs/webkitgtk-sections.txt index 864b991..0083146 100644 --- a/WebKit/gtk/docs/webkitgtk-sections.txt +++ b/WebKit/gtk/docs/webkitgtk-sections.txt @@ -528,6 +528,7 @@ WebKitWebWindowFeaturesPrivate
webkit +Global functions webkit_init webkit_get_default_session webkit_get_default_web_database_quota @@ -535,6 +536,11 @@ webkit_get_web_database_directory_path webkit_remove_all_web_databases webkit_set_default_web_database_quota webkit_set_web_database_directory_path + +WebKitCacheModel +webkit_get_cache_model +webkit_set_cache_model +
@@ -605,10 +611,3 @@ webkit_major_version webkit_micro_version webkit_minor_version
- -
-webkitcachemodel -WebKitCacheModel -webkit_get_cache_model -webkit_set_cache_model -
diff --git a/WebKit/gtk/tests/testdomnode.c b/WebKit/gtk/tests/testdomnode.c new file mode 100644 index 0000000..1050587 --- /dev/null +++ b/WebKit/gtk/tests/testdomnode.c @@ -0,0 +1,147 @@ +/* + * Copyright (C) 2010 Igalia S.L. + * + * 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 "test_utils.h" + +#include +#include +#include +#include + +#if GLIB_CHECK_VERSION(2, 16, 0) && GTK_CHECK_VERSION(2, 14, 0) + +#define HTML_DOCUMENT_HIERARCHY_NAVIGATION "This is the title

1

2

3

" + +typedef struct { + GtkWidget* webView; + GMainLoop* loop; +} DomNodeFixture; + +static gboolean finish_loading(DomNodeFixture* fixture) +{ + if (g_main_loop_is_running(fixture->loop)) + g_main_loop_quit(fixture->loop); + + return FALSE; +} + +static void dom_node_fixture_setup(DomNodeFixture* fixture, gconstpointer data) +{ + fixture->loop = g_main_loop_new(NULL, TRUE); + fixture->webView = webkit_web_view_new(); + g_object_ref_sink(fixture->webView); + + if (data != NULL) + webkit_web_view_load_string(WEBKIT_WEB_VIEW(fixture->webView), (const char*)data, NULL, NULL, NULL); + + g_idle_add((GSourceFunc)finish_loading, fixture); + g_main_loop_run(fixture->loop); +} + +static void dom_node_fixture_teardown(DomNodeFixture* fixture, gconstpointer data) +{ + g_object_unref(fixture->webView); + g_main_loop_unref(fixture->loop); +} + +static void test_dom_node_hierarchy_navigation(DomNodeFixture* fixture, gconstpointer data) +{ + WebKitDOMDocument* document; + WebKitDOMHTMLHeadElement* head; + WebKitDOMHTMLBodyElement* body; + WebKitDOMNodeList* list; + WebKitDOMNode* ptr; + gulong i, length; + + document = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(fixture->webView)); + g_assert(document); + g_assert(WEBKIT_DOM_IS_DOCUMENT(document)); + head = webkit_dom_document_get_head(document); + g_assert(head); + g_assert(WEBKIT_DOM_IS_HTML_HEAD_ELEMENT(head)); + + /* Title, head's child */ + g_assert(webkit_dom_node_has_child_nodes(WEBKIT_DOM_NODE(head))); + list = webkit_dom_node_get_child_nodes(WEBKIT_DOM_NODE(head)); + g_assert_cmpint(webkit_dom_node_list_get_length(list), ==, 1); + ptr = webkit_dom_node_list_item(list, 0); + g_assert(ptr); + g_assert(WEBKIT_DOM_IS_HTML_TITLE_ELEMENT(ptr)); + + /* Body, Head sibling */ + ptr = webkit_dom_node_get_next_sibling(WEBKIT_DOM_NODE(head)); + g_assert(ptr); + body = WEBKIT_DOM_HTML_BODY_ELEMENT(ptr); + g_assert(WEBKIT_DOM_IS_HTML_BODY_ELEMENT(body)); + + /* There is no third sibling */ + ptr = webkit_dom_node_get_next_sibling(ptr); + g_assert(ptr == NULL); + + /* Body's previous sibling is Head */ + ptr = webkit_dom_node_get_previous_sibling(WEBKIT_DOM_NODE(body)); + g_assert(ptr); + g_assert(WEBKIT_DOM_IS_HTML_HEAD_ELEMENT(ptr)); + + /* Body has 3 children */ + g_assert(webkit_dom_node_has_child_nodes(WEBKIT_DOM_NODE(body))); + list = webkit_dom_node_get_child_nodes(WEBKIT_DOM_NODE(body)); + length = webkit_dom_node_list_get_length(list); + g_assert_cmpint(length, ==, 3); + + /* The three of them are P tags */ + for (i = 0; i < length; i++) { + ptr = webkit_dom_node_list_item(list, i); + g_assert(ptr); + g_assert(WEBKIT_DOM_IS_HTML_PARAGRAPH_ELEMENT(ptr)); + } + + /* Go backwards */ + for (i = 0; ptr; ptr = webkit_dom_node_get_previous_sibling(ptr), i++) + /* Nothing */; + + g_assert_cmpint(i, ==, 3); +} + +int main(int argc, char** argv) +{ + if (!g_thread_supported()) + g_thread_init(NULL); + + gtk_test_init(&argc, &argv, NULL); + + g_test_bug_base("https://bugs.webkit.org/"); + + g_test_add("/webkit/domnode/test_hierarchy_navigation", + DomNodeFixture, HTML_DOCUMENT_HIERARCHY_NAVIGATION, + dom_node_fixture_setup, + test_dom_node_hierarchy_navigation, + dom_node_fixture_teardown); + + return g_test_run(); +} + +#else +int main(int argc, char** argv) +{ + g_critical("You will need at least glib-2.16.0 and gtk-2.14.0 to run the unit tests. Doing nothing now."); + return 0; +} + +#endif diff --git a/WebKit/gtk/tests/testhittestresult.c b/WebKit/gtk/tests/testhittestresult.c index defda7a..89fe95c 100644 --- a/WebKit/gtk/tests/testhittestresult.c +++ b/WebKit/gtk/tests/testhittestresult.c @@ -82,6 +82,8 @@ load_status_cb(WebKitWebView* webView, WebKitHitTestResult* result; guint context; GdkEventButton event; + WebKitDOMNode* node; + event.type = GDK_BUTTON_PRESS; /* Close enough to 0,0 */ event.x = 5; @@ -89,8 +91,28 @@ load_status_cb(WebKitWebView* webView, result = webkit_web_view_get_hit_test_result(webView, &event); g_assert(result); + g_object_get(result, "context", &context, NULL); g_assert(context & info->flag); + + g_object_get(result, "inner-node", &node, NULL); + g_assert(node); + g_assert(WEBKIT_DOM_IS_NODE(node)); + /* We can only test these node types at the moment. In the + * input case there seems to be an extra layer with a DIV on + * top of the input, which gets assigned to the inner-node. + * tag */ + if (info->flag == WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT) + g_assert(WEBKIT_DOM_IS_HTML_HTML_ELEMENT(node)); + else if (info->flag == WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE) + g_assert(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(node)); + else if (info->flag == WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK) { + /* The hit test will give us the inner text node, we want + * the A tag */ + WebKitDOMNode* parent = webkit_dom_node_get_parent_node(node); + g_assert(WEBKIT_DOM_IS_HTML_ANCHOR_ELEMENT(parent)); + } + g_object_unref(result); g_main_loop_quit(loop); } diff --git a/WebKit/gtk/webkit/webkithittestresult.cpp b/WebKit/gtk/webkit/webkithittestresult.cpp index 1f8dce6..862d94a 100644 --- a/WebKit/gtk/webkit/webkithittestresult.cpp +++ b/WebKit/gtk/webkit/webkithittestresult.cpp @@ -22,6 +22,7 @@ #include "webkithittestresult.h" #include "GOwnPtr.h" +#include "WebKitDOMNode.h" #include "webkitenumtypes.h" #include "webkitprivate.h" #include @@ -43,6 +44,7 @@ struct _WebKitHitTestResultPrivate { char* linkURI; char* imageURI; char* mediaURI; + WebKitDOMNode* innerNode; }; #define WEBKIT_HIT_TEST_RESULT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_HIT_TEST_RESULT, WebKitHitTestResultPrivate)) @@ -53,7 +55,8 @@ enum { PROP_CONTEXT, PROP_LINK_URI, PROP_IMAGE_URI, - PROP_MEDIA_URI + PROP_MEDIA_URI, + PROP_INNER_NODE }; static void webkit_hit_test_result_finalize(GObject* object) @@ -86,6 +89,9 @@ static void webkit_hit_test_result_get_property(GObject* object, guint propertyI case PROP_MEDIA_URI: g_value_set_string(value, priv->mediaURI); break; + case PROP_INNER_NODE: + g_value_set_object(value, priv->innerNode); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyID, pspec); } @@ -112,6 +118,9 @@ static void webkit_hit_test_result_set_property(GObject* object, guint propertyI g_free (priv->mediaURI); priv->mediaURI = g_value_dup_string(value); break; + case PROP_INNER_NODE: + priv->innerNode = static_cast(g_value_get_object(value)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyID, pspec); } @@ -184,6 +193,28 @@ static void webkit_hit_test_result_class_init(WebKitHitTestResultClass* webHitTe NULL, static_cast(WEBKIT_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY))); + /** + * WebKitHitTestResult:inner-node: + * + * The DOM node at the coordinates where the hit test + * happened. Keep in mind that the node might not be + * representative of the information given in the context + * property, since WebKit uses a series of heuristics to figure + * out that information. One common example is inner-node having + * the text node inside the anchor () tag; WebKit knows the + * whole context and will put WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK + * in the 'context' property, but the user might be confused by + * the lack of any link tag in 'inner-node'. + * + * Since: 1.3.2 + */ + g_object_class_install_property(objectClass, PROP_INNER_NODE, + g_param_spec_object("inner-node", + _("Inner node"), + _("The inner DOM node associated with the hit test result."), + WEBKIT_TYPE_DOM_NODE, + static_cast(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY))); + g_type_class_add_private(webHitTestResultClass, sizeof(WebKitHitTestResultPrivate)); } diff --git a/WebKit/gtk/webkit/webkitprivate.cpp b/WebKit/gtk/webkit/webkitprivate.cpp index d274708..41de76e 100644 --- a/WebKit/gtk/webkit/webkitprivate.cpp +++ b/WebKit/gtk/webkit/webkitprivate.cpp @@ -41,6 +41,7 @@ #include "ResourceResponse.h" #include "SecurityOrigin.h" #include "TextEncodingRegistry.h" +#include "WebKitDOMBinding.h" #include "webkitnetworkresponse.h" #include "webkitsoupauthdialog.h" #include @@ -129,9 +130,9 @@ WebCore::ResourceResponse core(WebKitNetworkResponse* response) return ResourceResponse(); } -WebCore::EditingBehavior core(WebKitEditingBehavior type) +WebCore::EditingBehaviorType core(WebKitEditingBehavior type) { - return (WebCore::EditingBehavior)type; + return (WebCore::EditingBehaviorType)type; } WebKitHitTestResult* kit(const WebCore::HitTestResult& result) @@ -140,6 +141,7 @@ WebKitHitTestResult* kit(const WebCore::HitTestResult& result) GOwnPtr linkURI(0); GOwnPtr imageURI(0); GOwnPtr mediaURI(0); + WebKitDOMNode* node = 0; if (!result.absoluteLinkURL().isEmpty()) { context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK; @@ -162,12 +164,16 @@ WebKitHitTestResult* kit(const WebCore::HitTestResult& result) if (result.isContentEditable()) context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE; + if (result.innerNonSharedNode()) + node = static_cast(kit(result.innerNonSharedNode())); + return WEBKIT_HIT_TEST_RESULT(g_object_new(WEBKIT_TYPE_HIT_TEST_RESULT, - "link-uri", linkURI.get(), - "image-uri", imageURI.get(), - "media-uri", mediaURI.get(), - "context", context, - NULL)); + "link-uri", linkURI.get(), + "image-uri", imageURI.get(), + "media-uri", mediaURI.get(), + "context", context, + "inner-node", node, + NULL)); } PasteboardHelperGtk* pasteboardHelperInstance() diff --git a/WebKit/gtk/webkit/webkitprivate.h b/WebKit/gtk/webkit/webkitprivate.h index 057b0e5..44ffc1e 100644 --- a/WebKit/gtk/webkit/webkitprivate.h +++ b/WebKit/gtk/webkit/webkitprivate.h @@ -95,7 +95,7 @@ namespace WebKit { WebCore::ResourceResponse core(WebKitNetworkResponse* response); - WebCore::EditingBehavior core(WebKitEditingBehavior type); + WebCore::EditingBehaviorType core(WebKitEditingBehavior type); WebKitSecurityOrigin* kit(WebCore::SecurityOrigin*); WebCore::SecurityOrigin* core(WebKitSecurityOrigin*); @@ -241,7 +241,7 @@ extern "C" { webkit_web_view_request_download(WebKitWebView* web_view, WebKitNetworkRequest* request, const WebCore::ResourceResponse& response = WebCore::ResourceResponse(), WebCore::ResourceHandle* handle = 0); void - webkit_web_view_add_resource(WebKitWebView*, char*, WebKitWebResource*); + webkit_web_view_add_resource(WebKitWebView*, const char*, WebKitWebResource*); WebKitWebResource* webkit_web_view_get_resource(WebKitWebView*, char*); diff --git a/WebKit/gtk/webkit/webkitwebinspector.cpp b/WebKit/gtk/webkit/webkitwebinspector.cpp index 820b20f..2dc9315 100644 --- a/WebKit/gtk/webkit/webkitwebinspector.cpp +++ b/WebKit/gtk/webkit/webkitwebinspector.cpp @@ -30,6 +30,7 @@ #include "InspectorClientGtk.h" #include "IntPoint.h" #include "Page.h" +#include "RenderLayer.h" #include "RenderView.h" #include "webkitmarshal.h" #include "webkitprivate.h" diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp index 2c95558..6744732 100644 --- a/WebKit/gtk/webkit/webkitwebview.cpp +++ b/WebKit/gtk/webkit/webkitwebview.cpp @@ -63,6 +63,7 @@ #include "FrameView.h" #include #include +#include #include "GraphicsContext.h" #include "GtkVersioning.h" #include "HitTestRequest.h" @@ -370,7 +371,7 @@ static gboolean webkit_web_view_popup_menu_handler(GtkWidget* widget) } int x, y; - gdk_window_get_origin(GTK_WIDGET(view->hostWindow()->platformPageClient())->window, &x, &y); + gdk_window_get_origin(gtk_widget_get_window(GTK_WIDGET(view->hostWindow()->platformPageClient())), &x, &y); // FIXME: The IntSize(0, -1) is a hack to get the hit-testing to result in the selected element. // Ideally we'd have the position of a context menu event be separate from its target node. @@ -588,11 +589,52 @@ static gboolean webkit_web_view_key_release_event(GtkWidget* widget, GdkEventKey static gboolean webkit_web_view_button_press_event(GtkWidget* widget, GdkEventButton* event) { + // Eventually it may make sense for these to be per-view and per-device, + // but at this time the implementation matches the Windows port. + static int currentClickCount = 1; + static IntPoint previousPoint; + static guint previousButton; + static guint32 previousTime; + WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); // FIXME: need to keep track of subframe focus for key events gtk_widget_grab_focus(widget); + // For double and triple clicks GDK sends both a normal button press event + // and a specific type (like GDK_2BUTTON_PRESS). If we detect a special press + // coming up, ignore this event as it certainly generated the double or triple + // click. The consequence of not eating this event is two DOM button press events + // are generated. + GOwnPtr nextEvent(gdk_event_peek()); + if (nextEvent && (nextEvent->any.type == GDK_2BUTTON_PRESS || nextEvent->any.type == GDK_3BUTTON_PRESS)) + return TRUE; + + gint doubleClickDistance = 250; + gint doubleClickTime = 5; + GtkSettings* settings = gtk_settings_get_for_screen(gdk_drawable_get_screen(gtk_widget_get_window(widget))); + g_object_get(settings, + "gtk-double-click-distance", &doubleClickDistance, + "gtk-double-click-time", &doubleClickTime, NULL); + + // GTK+ only counts up to triple clicks, but WebCore wants to know about + // quadruple clicks, quintuple clicks, ad infinitum. Here, we replicate the + // GDK logic for counting clicks. + if ((event->type == GDK_2BUTTON_PRESS || event->type == GDK_3BUTTON_PRESS) + || ((abs(event->x - previousPoint.x()) < doubleClickDistance) + && (abs(event->y - previousPoint.y()) < doubleClickDistance) + && (event->time - previousTime < static_cast(doubleClickTime)) + && (event->button == previousButton))) + currentClickCount++; + else + currentClickCount = 1; + + PlatformMouseEvent platformEvent(event); + platformEvent.setClickCount(currentClickCount); + previousPoint = platformEvent.pos(); + previousButton = event->button; + previousTime = event->time; + if (event->button == 3) return webkit_web_view_forward_context_menu_event(webView, PlatformMouseEvent(event)); @@ -600,7 +642,8 @@ static gboolean webkit_web_view_button_press_event(GtkWidget* widget, GdkEventBu if (!frame->view()) return FALSE; - gboolean result = frame->eventHandler()->handleMousePressEvent(PlatformMouseEvent(event)); + + gboolean result = frame->eventHandler()->handleMousePressEvent(platformEvent); #if PLATFORM(X11) /* Copy selection to the X11 selection clipboard */ @@ -2695,7 +2738,7 @@ static void webkit_web_view_update_settings(WebKitWebView* webView) settings->setJavaScriptCanOpenWindowsAutomatically(javascriptCanOpenWindows); settings->setJavaScriptCanAccessClipboard(javaScriptCanAccessClipboard); settings->setOfflineWebApplicationCacheEnabled(enableOfflineWebAppCache); - settings->setEditingBehavior(core(editingBehavior)); + settings->setEditingBehaviorType(core(editingBehavior)); settings->setAllowUniversalAccessFromFileURLs(enableUniversalAccessFromFileURI); settings->setAllowFileAccessFromFileURLs(enableFileAccessFromFileURI); settings->setDOMPasteAllowed(enableDOMPaste); @@ -2796,7 +2839,7 @@ static void webkit_web_view_settings_notify(WebKitWebSettings* webSettings, GPar else if (name == g_intern_string("enable-offline-web-application-cache")) settings->setOfflineWebApplicationCacheEnabled(g_value_get_boolean(&value)); else if (name == g_intern_string("editing-behavior")) - settings->setEditingBehavior(core(static_cast(g_value_get_enum(&value)))); + settings->setEditingBehaviorType(core(static_cast(g_value_get_enum(&value)))); else if (name == g_intern_string("enable-universal-access-from-file-uris")) settings->setAllowUniversalAccessFromFileURLs(g_value_get_boolean(&value)); else if (name == g_intern_string("enable-file-access-from-file-uris")) @@ -3892,24 +3935,6 @@ void webkit_web_view_set_full_content_zoom(WebKitWebView* webView, gboolean zoom } /** - * webkit_get_default_session: - * - * Retrieves the default #SoupSession used by all web views. - * Note that the session features are added by WebKit on demand, - * so if you insert your own #SoupCookieJar before any network - * traffic occurs, WebKit will use it instead of the default. - * - * Return value: the default #SoupSession - * - * Since: 1.1.1 - */ -SoupSession* webkit_get_default_session () -{ - webkit_init(); - return ResourceHandle::defaultSession(); -} - -/** * webkit_web_view_get_load_status: * @web_view: a #WebKitWebView * @@ -4152,7 +4177,7 @@ gboolean webkit_web_view_get_view_source_mode (WebKitWebView* webView) } // Internal subresource management -void webkit_web_view_add_resource(WebKitWebView* webView, char* identifier, WebKitWebResource* webResource) +void webkit_web_view_add_resource(WebKitWebView* webView, const char* identifier, WebKitWebResource* webResource) { WebKitWebViewPrivate* priv = webView->priv; @@ -4162,7 +4187,7 @@ void webkit_web_view_add_resource(WebKitWebView* webView, char* identifier, WebK return; } - g_hash_table_insert(priv->subResources, identifier, webResource); + g_hash_table_insert(priv->subResources, g_strdup(identifier), webResource); } WebKitWebResource* webkit_web_view_get_resource(WebKitWebView* webView, char* identifier) @@ -4295,6 +4320,57 @@ G_CONST_RETURN gchar* webkit_web_view_get_icon_uri(WebKitWebView* webView) } /** + * webkit_web_view_get_dom_document: + * @webView: a #WebKitWebView + * + * Returns: the #WebKitDOMDocument currently loaded in the @webView + * + * Since: 1.3.1 + **/ +WebKitDOMDocument* +webkit_web_view_get_dom_document(WebKitWebView* webView) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); + + Frame* coreFrame = core(webView)->mainFrame(); + if (!coreFrame) + return 0; + + Document* doc = coreFrame->document(); + if (!doc) + return 0; + + return static_cast(kit(doc)); +} + +/** + * SECTION:webkit + * @short_description: Global functions controlling WebKit + * + * WebKit manages many resources which are not related to specific + * views. These functions relate to cross-view limits, such as cache + * sizes, database quotas, and the HTTP session management. + */ + +/** + * webkit_get_default_session: + * + * Retrieves the default #SoupSession used by all web views. + * Note that the session features are added by WebKit on demand, + * so if you insert your own #SoupCookieJar before any network + * traffic occurs, WebKit will use it instead of the default. + * + * Return value: the default #SoupSession + * + * Since: 1.1.1 + */ +SoupSession* webkit_get_default_session () +{ + webkit_init(); + return ResourceHandle::defaultSession(); +} + +/** * webkit_set_cache_model: * @cache_model: a #WebKitCacheModel * @@ -4375,26 +4451,3 @@ WebKitCacheModel webkit_get_cache_model() return cacheModel; } -/** - * webkit_web_view_get_dom_document: - * @webView: a #WebKitWebView - * - * Returns: the #WebKitDOMDocument currently loaded in the @webView - * - * Since: 1.3.1 - **/ -WebKitDOMDocument* -webkit_web_view_get_dom_document(WebKitWebView* webView) -{ - g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); - - Frame* coreFrame = core(webView)->mainFrame(); - if (!coreFrame) - return 0; - - Document* doc = coreFrame->document(); - if (!doc) - return 0; - - return static_cast(kit(doc)); -} diff --git a/WebKit/haiku/ChangeLog b/WebKit/haiku/ChangeLog index 35ad98a..d71c5e4 100644 --- a/WebKit/haiku/ChangeLog +++ b/WebKit/haiku/ChangeLog @@ -1,3 +1,45 @@ +2010-06-14 Ilya Tikhonovsky + + Reviewed by Pavel Feldman. + + WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc + data from inspected page to WebInspector as JSON string via http. The native + serialization to JSON string is supported by InspectorValue's classes. This patch + has the implementation of sendMessageToFrontend function. WebKit version of it still + uses ScriptFunctionCall and will be switched to another transport a little bit later. + https://bugs.webkit.org/show_bug.cgi?id=40134 + + * WebCoreSupport/InspectorClientHaiku.cpp: + (WebCore::InspectorClientHaiku::sendMessageToFrontend): + * WebCoreSupport/InspectorClientHaiku.h: + +2010-06-09 Sheriff Bot + + Unreviewed, rolling out r60889. + http://trac.webkit.org/changeset/60889 + https://bugs.webkit.org/show_bug.cgi?id=40365 + + gtk bot has some kind of memory corruption (Requested by + loislo on #webkit). + + * WebCoreSupport/InspectorClientHaiku.cpp: + * WebCoreSupport/InspectorClientHaiku.h: + +2010-06-07 Ilya Tikhonovsky + + Reviewed by Pavel Feldman. + + WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc + data from inspected page to WebInspector as JSON string via http. The native + serialization to JSON string is supported by InspectorValue's classes. This patch + has the implementation of sendMessageToFrontend function. WebKit version of it still + uses ScriptFunctionCall and will be switched to another transport a little bit later. + https://bugs.webkit.org/show_bug.cgi?id=40134 + + * WebCoreSupport/InspectorClientHaiku.cpp: + (WebCore::InspectorClientHaiku::sendMessageToFrontend): + * WebCoreSupport/InspectorClientHaiku.h: + 2010-05-31 Lyon Chen Reviewed by Kent Tamura. diff --git a/WebKit/haiku/WebCoreSupport/InspectorClientHaiku.cpp b/WebKit/haiku/WebCoreSupport/InspectorClientHaiku.cpp index 59232e9..883fcd3 100644 --- a/WebKit/haiku/WebCoreSupport/InspectorClientHaiku.cpp +++ b/WebKit/haiku/WebCoreSupport/InspectorClientHaiku.cpp @@ -67,5 +67,11 @@ void InspectorClientHaiku::storeSetting(const String& key, const String& value) notImplemented(); } +bool InspectorClientHaiku::sendMessageToFrontend(const String&) +{ + notImplemented(); + return false; +} + } // namespace WebCore diff --git a/WebKit/haiku/WebCoreSupport/InspectorClientHaiku.h b/WebKit/haiku/WebCoreSupport/InspectorClientHaiku.h index d427670..3828d04 100644 --- a/WebKit/haiku/WebCoreSupport/InspectorClientHaiku.h +++ b/WebKit/haiku/WebCoreSupport/InspectorClientHaiku.h @@ -49,6 +49,8 @@ namespace WebCore { virtual void populateSetting(const WebCore::String& key, WebCore::String* value); virtual void storeSetting(const WebCore::String& key, const WebCore::String& value); + + virtual bool sendMessageToFrontend(const WebCore::String&); }; } // namespace WebCore diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog index 7d88fed..c6151ad 100644 --- a/WebKit/mac/ChangeLog +++ b/WebKit/mac/ChangeLog @@ -1,3 +1,187 @@ +2010-06-14 Ilya Tikhonovsky + + Reviewed by Pavel Feldman. + + WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc + data from inspected page to WebInspector as JSON string via http. The native + serialization to JSON string is supported by InspectorValue's classes. This patch + has the implementation of sendMessageToFrontend function. WebKit version of it still + uses ScriptFunctionCall and will be switched to another transport a little bit later. + https://bugs.webkit.org/show_bug.cgi?id=40134 + + * WebCoreSupport/WebInspectorClient.h: + * WebCoreSupport/WebInspectorClient.mm: + (WebInspectorClient::WebInspectorClient): + (WebInspectorClient::openInspectorFrontend): + +2010-06-10 David Hyatt + + Reviewed by John Sullivan. + + https://bugs.webkit.org/show_bug.cgi?id=40441, back out the original fix for 29601, since it has broken continuous + wheel delta values. + + * WebView/WebDynamicScrollBarsView.mm: + (-[WebDynamicScrollBarsView scrollWheel:]): + +2010-06-09 Sheriff Bot + + Unreviewed, rolling out r60889. + http://trac.webkit.org/changeset/60889 + https://bugs.webkit.org/show_bug.cgi?id=40365 + + gtk bot has some kind of memory corruption (Requested by + loislo on #webkit). + + * WebCoreSupport/WebInspectorClient.h: + * WebCoreSupport/WebInspectorClient.mm: + (WebInspectorClient::WebInspectorClient): + (WebInspectorClient::openInspectorFrontend): + (-[WebInspectorWindowController destroyInspectorView]): + +2010-06-07 Ilya Tikhonovsky + + Reviewed by Pavel Feldman. + + WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc + data from inspected page to WebInspector as JSON string via http. The native + serialization to JSON string is supported by InspectorValue's classes. This patch + has the implementation of sendMessageToFrontend function. WebKit version of it still + uses ScriptFunctionCall and will be switched to another transport a little bit later. + https://bugs.webkit.org/show_bug.cgi?id=40134 + + * WebCoreSupport/WebInspectorClient.h: + * WebCoreSupport/WebInspectorClient.mm: + (WebInspectorClient::WebInspectorClient): + (WebInspectorClient::openInspectorFrontend): + +2010-06-08 Mark Rowe + + Reviewed by Adele Peterson. + + REGRESSION (r56051): Inspect Element context menu does nothing in applications linked against 10.4 SDK + + * WebCoreSupport/WebContextMenuClient.mm: + (fixMenusReceivedFromOldClients): Fix up the tag on the Inspect Element menu item. This ensures that even if the + context menu layout doesn't match our expectations that the menu item will continue to trigger the web inspector. + +2010-06-08 Antonio Gomes + + Reviewed by Ojan Vafai and Darin Adler. + + Refactor platform dependent editing behavior code out of Settings + https://bugs.webkit.org/show_bug.cgi?id=39854 + + EditingBehavior enum was renamed to EditingBehaviorTypes and moved out from Settings.h to + EditingBehaviorTypes.h . Call sites in WebKit/ adjusted accordingly. + + * WebView/WebFrame.mm: + (core): + * WebView/WebFrameInternal.h: + * WebView/WebView.mm: + (-[WebView _preferencesChangedNotification:]): + +2010-06-06 MORITA Hajime + + Unreviewd, follow up to r60820 + + https://bugs.webkit.org/show_bug.cgi?id=40219 + [Mac] ENABLE_METER_TAG should be enabled + + Added ENABLE_METER_TAG. + + * Configurations/FeatureDefines.xcconfig: + +2010-06-06 Gavin Barraclough + + Reviewed by Sam Weinig. + + Bug 40214 - Clean up error construction / throwing in JSC. + + The one egregious insanity here is that creating an error requires + a VM-entry-esqe-host call (the string argument is wrapped as a JS + object & pushed on the RegisterFile, then unwrapped back to a + UString). Changing this also means you only require a global + object, not an ExecState, to create an error. + + The methods to create error objects are also parameterized + requiring a switch on the type, which can be made cleaner and + faster by moving to a separate method per error type. Code to add + divot information to error had been duplicated, and is coalesced + back into a single function. + + Convenience methods added to create & throw type & syntax error + with a default error message, since this is a common case. + + Also, errors are currently thrown either using + "throwError(exec, error)" or "exec->setException(error)" - unify + on the former, since this is more commonly used. Add + "throwVMError(exec, error)" equivalents, as a convenience for + cases where the result was being wrapped in "JSValue::encode(...)". + + * Plugins/Hosted/NetscapePluginInstanceProxy.mm: + (WebKit::NetscapePluginInstanceProxy::moveGlobalExceptionToExecState): + * Plugins/Hosted/ProxyInstance.mm: + (WebKit::ProxyInstance::invokeMethod): + +2010-06-02 Gavin Barraclough + + Reviewed by Oliver Hunt. + + Bug 40094 - The return type of NativeFunction should be EncodedJSValue + On Windows & Linux, using JSVALUE32_64, EncodedJSValue is returned in registers, but JSValue is not. + + * Plugins/Hosted/NetscapePluginInstanceProxy.h: + * Plugins/Hosted/NetscapePluginInstanceProxy.mm: + (WebKit::NetscapePluginInstanceProxy::invoke): + +2010-06-02 Sterling Swigart + + Reviewed by David Levin. + + Image Resizer Patch 0: Added compilation argument to conditionally compile pending patches. + https://bugs.webkit.org/show_bug.cgi?id=39906 + + * Configurations/FeatureDefines.xcconfig: + +2010-06-01 David Hyatt + + Reviewed by Anders Carlsson. + + Add a preference for paginating during layout (the new model for computing page breaks). + + * WebView/WebPreferenceKeysPrivate.h: + * WebView/WebPreferences.mm: + (-[WebPreferences paginateDuringLayoutEnabled]): + (-[WebPreferences setPaginateDuringLayoutEnabled:]): + * WebView/WebPreferencesPrivate.h: + * WebView/WebView.mm: + (-[WebView _preferencesChangedNotification:]): + +2010-06-01 Kevin Decker + + Reviewed by Simon Fraser. + + https://bugs.webkit.org/show_bug.cgi?id=40025 + All Flash content crashes after installing CS5 Design Premium. + + * Plugins/WebBaseNetscapePluginView.mm: + (-[WebBaseNetscapePluginView supportsSnapshotting]): Do not support snapshotting Flash 10.1 if + the version is less than 10.1.53.60. + +2010-06-01 Alexey Proskuryakov + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=39434 + REGRESSION (r59811): Geolocation callbacks cannot be created + + Removing unused WebGeolocationMock. + + * WebCoreSupport/WebGeolocationMock.mm: Removed. + * WebCoreSupport/WebGeolocationMockPrivate.h: Removed. + * WebKit.exp: + 2010-05-30 Darin Adler Reviewed by Sam Weinig. diff --git a/WebKit/mac/Configurations/FeatureDefines.xcconfig b/WebKit/mac/Configurations/FeatureDefines.xcconfig index c64d94c..5b52793 100644 --- a/WebKit/mac/Configurations/FeatureDefines.xcconfig +++ b/WebKit/mac/Configurations/FeatureDefines.xcconfig @@ -55,9 +55,11 @@ ENABLE_FILE_READER = ENABLE_FILE_READER; ENABLE_FILE_WRITER = ; ENABLE_GEOLOCATION = ENABLE_GEOLOCATION; ENABLE_ICONDATABASE = ENABLE_ICONDATABASE; +ENABLE_IMAGE_RESIZER = ; ENABLE_INDEXED_DATABASE = ; ENABLE_JAVASCRIPT_DEBUGGER = ENABLE_JAVASCRIPT_DEBUGGER; ENABLE_MATHML = ; +ENABLE_METER_TAG = ENABLE_METER_TAG; ENABLE_NOTIFICATIONS = ; ENABLE_OFFLINE_WEB_APPLICATIONS = ENABLE_OFFLINE_WEB_APPLICATIONS; ENABLE_PROGRESS_TAG = ENABLE_PROGRESS_TAG; @@ -79,4 +81,4 @@ ENABLE_XHTMLMP = ; ENABLE_XPATH = ENABLE_XPATH; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(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_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(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/Plugins/Hosted/NetscapePluginInstanceProxy.h b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h index 62c0f38..7391c1e 100644 --- a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h +++ b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h @@ -47,6 +47,7 @@ namespace JSC { class Instance; class RootObject; } + class ArgList; } @class WebHostedNetscapePluginView; @class WebFrame; diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm index 8b0a2bf..9c90dae 100644 --- a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm +++ b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm @@ -901,7 +901,7 @@ bool NetscapePluginInstanceProxy::invoke(uint32_t objectID, const Identifier& me JSLock lock(SilenceAssertionsOnly); JSValue function = object->get(exec, methodName); CallData callData; - CallType callType = function.getCallData(callData); + CallType callType = getCallData(function, callData); if (callType == CallTypeNone) return false; @@ -1659,7 +1659,7 @@ void NetscapePluginInstanceProxy::moveGlobalExceptionToExecState(ExecState* exec { JSLock lock(SilenceAssertionsOnly); - throwError(exec, GeneralError, stringToUString(globalExceptionString())); + throwError(exec, createError(exec, stringToUString(globalExceptionString()))); } globalExceptionString() = String(); diff --git a/WebKit/mac/Plugins/Hosted/ProxyInstance.mm b/WebKit/mac/Plugins/Hosted/ProxyInstance.mm index b9a674d..b3799ca 100644 --- a/WebKit/mac/Plugins/Hosted/ProxyInstance.mm +++ b/WebKit/mac/Plugins/Hosted/ProxyInstance.mm @@ -199,7 +199,7 @@ JSValue ProxyInstance::getMethod(JSC::ExecState* exec, const JSC::Identifier& pr JSValue ProxyInstance::invokeMethod(ExecState* exec, JSC::RuntimeMethod* runtimeMethod) { if (!asObject(runtimeMethod)->inherits(&ProxyRuntimeMethod::s_info)) - return throwError(exec, TypeError, "Attempt to invoke non-plug-in method on plug-in object."); + return throwError(exec, createTypeError(exec, "Attempt to invoke non-plug-in method on plug-in object.")); const MethodList& methodList = *runtimeMethod->methods(); diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm index acd5152..a75251e 100644 --- a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm +++ b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm @@ -584,8 +584,14 @@ String WebHaltablePlugin::pluginName() const // Flash has a bogus Info.plist entry for CFBundleVersionString, so use CFBundleShortVersionString. NSString *versionString = [pluginBundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"]; - // Flash 10.1d51 has a crashing bug if sent a drawRect event when using the CA rendering model: - return ![versionString isEqual:@"10.1.51.95"]; + + static const NSString *flash10dotOnePrefix = @"10.1"; + if (![versionString hasPrefix:flash10dotOnePrefix]) + return YES; + + // Some prerelease versions of Flash 10.1 crash when sent a drawRect event using the CA drawing model: + static const CFStringRef knownGoodFlash10dot1Release = CFSTR("10.1.53.60"); + return CFStringCompare((CFStringRef)versionString, knownGoodFlash10dot1Release, kCFCompareNumerically) != kCFCompareLessThan; } - (BOOL)hasBeenHalted diff --git a/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm b/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm index 639f3c1..e4e069a 100644 --- a/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm +++ b/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm @@ -213,6 +213,8 @@ static void fixMenusReceivedFromOldClients(NSMutableArray *newMenuItems, NSMutab modernTag = WebMenuItemTagLeftToRight; else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagRightToLeft]]) modernTag = WebMenuItemTagRightToLeft; + else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagInspectElement]]) + modernTag = WebMenuItemTagInspectElement; else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagCorrectSpellingAutomatically]]) modernTag = WebMenuItemTagCorrectSpellingAutomatically; else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagSubstitutionsMenu]]) diff --git a/WebKit/mac/WebCoreSupport/WebGeolocationMock.mm b/WebKit/mac/WebCoreSupport/WebGeolocationMock.mm deleted file mode 100644 index 1bdb616..0000000 --- a/WebKit/mac/WebCoreSupport/WebGeolocationMock.mm +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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. - */ - -#import "WebGeolocationMockPrivate.h" - -#import -#import -#import -#import - - -using namespace WebCore; -using namespace WTF; - -@implementation WebGeolocationMock - -+ (void)setPosition:(double)latitude:(double)longitude:(double)accuracy -{ -#if ENABLE(GEOLOCATION) - RefPtr coordinates = Coordinates::create(latitude, - longitude, - false, 0.0, // altitude - accuracy, - false, 0.0, // altitudeAccuracy - false, 0.0, // heading - false, 0.0); // speed - RefPtr position = Geoposition::create(coordinates.release(), currentTime() * 1000.0); - GeolocationServiceMock::setPosition(position.release()); -#endif -} - -+ (void)setError:(int)code:(NSString *)message -{ -#if ENABLE(GEOLOCATION) - PositionError::ErrorCode codeEnum = static_cast(code); - RefPtr error = PositionError::create(codeEnum, message); - GeolocationServiceMock::setError(error.release()); -#endif -} - -@end diff --git a/WebKit/mac/WebCoreSupport/WebGeolocationMockPrivate.h b/WebKit/mac/WebCoreSupport/WebGeolocationMockPrivate.h deleted file mode 100644 index 28895f2..0000000 --- a/WebKit/mac/WebCoreSupport/WebGeolocationMockPrivate.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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. - */ - -#import - -@interface WebGeolocationMock : NSObject { -} - -+ (void)setPosition:(double)latitude:(double)longitude:(double)accuracy; -+ (void)setError:(int)code:(NSString *)message; -@end diff --git a/WebKit/mac/WebCoreSupport/WebInspectorClient.h b/WebKit/mac/WebCoreSupport/WebInspectorClient.h index ee81b25..bd52954 100644 --- a/WebKit/mac/WebCoreSupport/WebInspectorClient.h +++ b/WebKit/mac/WebCoreSupport/WebInspectorClient.h @@ -42,6 +42,12 @@ class WebNodeHighlighter; class WebView; #endif +namespace WebCore { + +class Page; + +} + class WebInspectorClient : public WebCore::InspectorClient { public: WebInspectorClient(WebView *); @@ -56,26 +62,32 @@ public: virtual void populateSetting(const WebCore::String& key, WebCore::String* value); virtual void storeSetting(const WebCore::String& key, const WebCore::String& value); + virtual bool sendMessageToFrontend(const WebCore::String&); + + void releaseFrontendPage(); + private: WebView *m_webView; RetainPtr m_highlighter; + WebCore::Page* m_frontendPage; }; + class WebInspectorFrontendClient : public WebCore::InspectorFrontendClientLocal { public: WebInspectorFrontendClient(WebView*, WebInspectorWindowController*, WebCore::InspectorController*, WebCore::Page*); virtual void frontendLoaded(); - + virtual WebCore::String localizedStringsURL(); virtual WebCore::String hiddenPanels(); - + virtual void bringToFront(); virtual void closeWindow(); - + virtual void attachWindow(); virtual void detachWindow(); - + virtual void setAttachedWindowHeight(unsigned height); virtual void inspectedURLChanged(const WebCore::String& newURL); diff --git a/WebKit/mac/WebCoreSupport/WebInspectorClient.mm b/WebKit/mac/WebCoreSupport/WebInspectorClient.mm index 661b0d2..d59109e 100644 --- a/WebKit/mac/WebCoreSupport/WebInspectorClient.mm +++ b/WebKit/mac/WebCoreSupport/WebInspectorClient.mm @@ -50,6 +50,7 @@ using namespace WebCore; WebView *_inspectedWebView; WebView *_webView; WebInspectorFrontendClient* _frontendClient; + WebInspectorClient* _inspectorClient; BOOL _attachedToInspectedWebView; BOOL _shouldAttach; BOOL _visible; @@ -61,6 +62,7 @@ using namespace WebCore; - (void)detach; - (BOOL)attached; - (void)setFrontendClient:(WebInspectorFrontendClient*)frontendClient; +- (void)setInspectorClient:(WebInspectorClient*)inspectorClient; - (void)setAttachedWindowHeight:(unsigned)height; - (void)destroyInspectorView; @end @@ -83,6 +85,7 @@ using namespace WebCore; WebInspectorClient::WebInspectorClient(WebView *webView) : m_webView(webView) , m_highlighter(AdoptNS, [[WebNodeHighlighter alloc] initWithInspectedWebView:webView]) +, m_frontendPage(0) { } @@ -94,9 +97,9 @@ void WebInspectorClient::inspectorDestroyed() void WebInspectorClient::openInspectorFrontend(InspectorController* inspectorController) { RetainPtr windowController(AdoptNS, [[WebInspectorWindowController alloc] initWithInspectedWebView:m_webView]); - Page* frontendPage = core([windowController.get() webView]); - - frontendPage->inspectorController()->setInspectorFrontendClient(new WebInspectorFrontendClient(m_webView, windowController.get(), inspectorController, frontendPage)); + [windowController.get() setInspectorClient:this]; + m_frontendPage = core([windowController.get() webView]); + m_frontendPage->inspectorController()->setInspectorFrontendClient(new WebInspectorFrontendClient(m_webView, windowController.get(), inspectorController, m_frontendPage)); } void WebInspectorClient::highlight(Node* node) @@ -407,6 +410,11 @@ void WebInspectorFrontendClient::updateWindowTitle() const _frontendClient = frontendClient; } +- (void)setInspectorClient:(WebInspectorClient*)inspectorClient +{ + _inspectorClient = inspectorClient; +} + - (void)setAttachedWindowHeight:(unsigned)height { if (!_attachedToInspectedWebView) @@ -439,6 +447,8 @@ void WebInspectorFrontendClient::updateWindowTitle() const if (Page* inspectedPage = [_inspectedWebView page]) inspectedPage->inspectorController()->disconnectFrontend(); + _inspectorClient->releaseFrontendPage(); + [_webView close]; } diff --git a/WebKit/mac/WebKit.exp b/WebKit/mac/WebKit.exp index d14d805..b2ddb18 100644 --- a/WebKit/mac/WebKit.exp +++ b/WebKit/mac/WebKit.exp @@ -12,7 +12,6 @@ .objc_class_name_WebFormDelegate .objc_class_name_WebFrame .objc_class_name_WebFrameView -.objc_class_name_WebGeolocationMock .objc_class_name_WebGeolocationPosition .objc_class_name_WebHTMLRepresentation .objc_class_name_WebHTMLView diff --git a/WebKit/mac/WebView/WebDynamicScrollBarsView.mm b/WebKit/mac/WebView/WebDynamicScrollBarsView.mm index 2041ac0..86090be 100644 --- a/WebKit/mac/WebView/WebDynamicScrollBarsView.mm +++ b/WebKit/mac/WebView/WebDynamicScrollBarsView.mm @@ -470,10 +470,8 @@ static const unsigned cMaxUpdateScrollbarsPass = 2; { float deltaX; float deltaY; - float wheelTicksX; - float wheelTicksY; BOOL isContinuous; - WKGetWheelEventDeltas(event, &deltaX, &deltaY, &wheelTicksX, &wheelTicksY, &isContinuous); + WKGetWheelEventDeltas(event, &deltaX, &deltaY, &isContinuous); BOOL isLatchingEvent = WKIsLatchingWheelEvent(event); diff --git a/WebKit/mac/WebView/WebFrame.mm b/WebKit/mac/WebView/WebFrame.mm index 999f177..7c59615 100644 --- a/WebKit/mac/WebView/WebFrame.mm +++ b/WebKit/mac/WebView/WebFrame.mm @@ -196,7 +196,7 @@ EditableLinkBehavior core(WebKitEditableLinkBehavior editableLinkBehavior) return EditableLinkDefaultBehavior; } -WebCore::EditingBehavior core(WebKitEditingBehavior behavior) +WebCore::EditingBehaviorType core(WebKitEditingBehavior behavior) { switch (behavior) { case WebKitEditingMacBehavior: diff --git a/WebKit/mac/WebView/WebFrameInternal.h b/WebKit/mac/WebView/WebFrameInternal.h index 9b2248a..586b4c3 100644 --- a/WebKit/mac/WebView/WebFrameInternal.h +++ b/WebKit/mac/WebView/WebFrameInternal.h @@ -71,7 +71,7 @@ WebView *kit(WebCore::Page*); WebCore::EditableLinkBehavior core(WebKitEditableLinkBehavior); WebCore::TextDirectionSubmenuInclusionBehavior core(WebTextDirectionSubmenuInclusionBehavior); -WebCore::EditingBehavior core(WebKitEditingBehavior); +WebCore::EditingBehaviorType core(WebKitEditingBehavior); WebView *getWebView(WebFrame *webFrame); diff --git a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h index ba4df8f..c38b395 100644 --- a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h +++ b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h @@ -94,6 +94,7 @@ #define WebKitPluginAllowedRunTimePreferenceKey @"WebKitPluginAllowedRunTime" #define WebKitFrameFlatteningEnabledPreferenceKey @"WebKitFrameFlatteningEnabled" #define WebKitHTML5ParserEnabledPreferenceKey @"WebKitHTML5ParserEnabled" +#define WebKitPaginateDuringLayoutEnabledPreferenceKey @"WebKitPaginateDuringLayoutEnabled" // 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 ac98282..36aef1f 100644 --- a/WebKit/mac/WebView/WebPreferences.mm +++ b/WebKit/mac/WebView/WebPreferences.mm @@ -1248,6 +1248,16 @@ static NSString *classIBCreatorID = nil; [self _setBoolValue:flag forKey:WebKitHTML5ParserEnabledPreferenceKey]; } +- (BOOL)paginateDuringLayoutEnabled +{ + return [self _boolValueForKey:WebKitPaginateDuringLayoutEnabledPreferenceKey]; +} + +- (void)setPaginateDuringLayoutEnabled:(BOOL)flag +{ + [self _setBoolValue:flag forKey:WebKitPaginateDuringLayoutEnabledPreferenceKey]; +} + - (WebKitEditingBehavior)editingBehavior { return static_cast([self _integerValueForKey:WebKitEditingBehaviorPreferenceKey]); diff --git a/WebKit/mac/WebView/WebPreferencesPrivate.h b/WebKit/mac/WebView/WebPreferencesPrivate.h index 0031860..c9a89ee 100644 --- a/WebKit/mac/WebView/WebPreferencesPrivate.h +++ b/WebKit/mac/WebView/WebPreferencesPrivate.h @@ -178,6 +178,9 @@ extern NSString *WebPreferencesRemovedNotification; - (BOOL)html5ParserEnabled; - (void)setHTML5ParserEnabled:(BOOL)flag; +- (BOOL)paginateDuringLayoutEnabled; +- (void)setPaginateDuringLayoutEnabled:(BOOL)flag; + - (BOOL)usesProxiedOpenPanel; - (void)setUsesProxiedOpenPanel:(BOOL)enabled; diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm index 97c799b..0023509 100644 --- a/WebKit/mac/WebView/WebView.mm +++ b/WebKit/mac/WebView/WebView.mm @@ -1369,7 +1369,7 @@ static bool fastDocumentTeardownEnabled() settings->setTextAreasAreResizable([preferences textAreasAreResizable]); settings->setShrinksStandaloneImagesToFit([preferences shrinksStandaloneImagesToFit]); settings->setEditableLinkBehavior(core([preferences editableLinkBehavior])); - settings->setEditingBehavior(core([preferences editingBehavior])); + settings->setEditingBehaviorType(core([preferences editingBehavior])); settings->setTextDirectionSubmenuInclusionBehavior(core([preferences textDirectionSubmenuInclusionBehavior])); settings->setDOMPasteAllowed([preferences isDOMPasteAllowed]); settings->setUsesPageCache([self usesPageCache]); @@ -1408,6 +1408,7 @@ static bool fastDocumentTeardownEnabled() settings->setLoadDeferringEnabled(shouldEnableLoadDeferring()); settings->setFrameFlatteningEnabled([preferences isFrameFlatteningEnabled]); settings->setHTML5ParserEnabled([preferences html5ParserEnabled]); + settings->setPaginateDuringLayoutEnabled([preferences paginateDuringLayoutEnabled]); } static inline IMP getMethod(id o, SEL s) diff --git a/WebKit/qt/Api/qwebframe.cpp b/WebKit/qt/Api/qwebframe.cpp index 7a28f83..3eba058 100644 --- a/WebKit/qt/Api/qwebframe.cpp +++ b/WebKit/qt/Api/qwebframe.cpp @@ -48,6 +48,7 @@ #include "PlatformWheelEvent.h" #include "PrintContext.h" #include "PutPropertySlot.h" +#include "RenderLayer.h" #include "RenderTreeAsText.h" #include "RenderView.h" #include "ResourceRequest.h" @@ -475,7 +476,12 @@ void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object JSC::JSLock lock(JSC::SilenceAssertionsOnly); JSDOMWindow* window = toJSDOMWindow(d->frame, mainThreadNormalWorld()); - JSC::Bindings::RootObject* root = d->frame->script()->bindingRootObject(); + JSC::Bindings::RootObject* root; + if (ownership == QScriptEngine::QtOwnership) + root = d->frame->script()->cacheableBindingRootObject(); + else + root = d->frame->script()->bindingRootObject(); + if (!window) { qDebug() << "Warning: couldn't get window object"; return; diff --git a/WebKit/qt/Api/qwebhistory.cpp b/WebKit/qt/Api/qwebhistory.cpp index 06e6cfa..0147f92 100644 --- a/WebKit/qt/Api/qwebhistory.cpp +++ b/WebKit/qt/Api/qwebhistory.cpp @@ -555,3 +555,8 @@ QWebPagePrivate* QWebHistoryPrivate::page() { return QWebFramePrivate::kit(lst->page()->mainFrame())->page()->handle(); } + +WebCore::HistoryItem* QWebHistoryItemPrivate::core(QWebHistoryItem* q) +{ + return q->d->item; +} diff --git a/WebKit/qt/Api/qwebhistory.h b/WebKit/qt/Api/qwebhistory.h index cce4553..3456784 100644 --- a/WebKit/qt/Api/qwebhistory.h +++ b/WebKit/qt/Api/qwebhistory.h @@ -61,6 +61,7 @@ private: friend class QWebPage; friend class WebCore::FrameLoaderClientQt; friend class QWebHistoryItemPrivate; + friend class DumpRenderTreeSupportQt; //friend QDataStream & operator<<(QDataStream& out,const QWebHistoryItem& hist); //friend QDataStream & operator>>(QDataStream& in,QWebHistoryItem& hist); QExplicitlySharedDataPointer d; diff --git a/WebKit/qt/Api/qwebhistory_p.h b/WebKit/qt/Api/qwebhistory_p.h index a6682cd..c9ff91b 100644 --- a/WebKit/qt/Api/qwebhistory_p.h +++ b/WebKit/qt/Api/qwebhistory_p.h @@ -45,6 +45,8 @@ public: item->deref(); } + static WebCore::HistoryItem* core(QWebHistoryItem* q); + WebCore::HistoryItem* item; }; diff --git a/WebKit/qt/Api/qwebkitplatformplugin.h b/WebKit/qt/Api/qwebkitplatformplugin.h index 7d024ae..bac618c 100644 --- a/WebKit/qt/Api/qwebkitplatformplugin.h +++ b/WebKit/qt/Api/qwebkitplatformplugin.h @@ -58,20 +58,43 @@ Q_SIGNALS: void didHide(); }; +class QWebNotificationData +{ +public: + virtual const QString title() const = 0; + virtual const QString message() const = 0; + virtual const QByteArray iconData() const = 0; +}; + +class QWebNotificationPresenter : public QObject +{ + Q_OBJECT +public: + QWebNotificationPresenter() {} + virtual ~QWebNotificationPresenter() {} + + virtual void showNotification(const QWebNotificationData*) = 0; + +Q_SIGNALS: + void notificationClosed(); +}; + class QWebKitPlatformPlugin { public: - inline ~QWebKitPlatformPlugin() {} + virtual ~QWebKitPlatformPlugin() {} enum Extension { - MultipleSelections + MultipleSelections, + Notifications }; - virtual QWebSelectMethod* createSelectInputMethod() const = 0; virtual bool supportsExtension(Extension extension) const = 0; + virtual QWebSelectMethod* createSelectInputMethod() const = 0; + virtual QWebNotificationPresenter* createNotificationPresenter() const = 0; }; -Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.0"); +Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.2"); #endif // QWEBKITPLATFORMPLUGIN_H diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp index 0e9d92f..d49ac14 100644 --- a/WebKit/qt/Api/qwebpage.cpp +++ b/WebKit/qt/Api/qwebpage.cpp @@ -267,6 +267,9 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) JSC::initializeThreading(); WTF::initializeMainThread(); WebCore::SecurityOrigin::setLocalLoadPolicy(WebCore::SecurityOrigin::AllowLocalLoadsForLocalAndSubstituteData); +#if QT_VERSION < QT_VERSION_CHECK(4, 7, 0) + WebCore::Font::setCodePath(WebCore::Font::Complex); +#endif chromeClient = new ChromeClientQt(q); contextMenuClient = new ContextMenuClientQt(); @@ -299,7 +302,7 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) PageGroup::setShouldTrackVisitedLinks(true); #if ENABLE(NOTIFICATIONS) - notificationPresenterClient = new NotificationPresenterClientQt(q); + NotificationPresenterClientQt::notificationPresenter()->addClient(); #endif } @@ -315,7 +318,7 @@ QWebPagePrivate::~QWebPagePrivate() delete page; #if ENABLE(NOTIFICATIONS) - delete notificationPresenterClient; + NotificationPresenterClientQt::notificationPresenter()->removeClient(); #endif } @@ -1008,7 +1011,7 @@ void QWebPagePrivate::dragEnterEvent(QGraphicsSceneDragDropEvent* ev) Qt::DropAction action = dragOpToDropAction(page->dragController()->dragEntered(&dragData)); ev->setDropAction(action); if (action != Qt::IgnoreAction) - ev->accept(); + ev->acceptProposedAction(); #endif } @@ -1021,7 +1024,7 @@ void QWebPagePrivate::dragEnterEvent(QDragEnterEvent* ev) ev->setDropAction(action); // We must accept this event in order to receive the drag move events that are sent // while the drag and drop action is in progress. - ev->accept(); + ev->acceptProposedAction(); #endif } @@ -1051,7 +1054,7 @@ void QWebPagePrivate::dragMoveEvent(QGraphicsSceneDragDropEvent* ev) Qt::DropAction action = dragOpToDropAction(page->dragController()->dragUpdated(&dragData)); ev->setDropAction(action); if (action != Qt::IgnoreAction) - ev->accept(); + ev->acceptProposedAction(); #endif } @@ -1065,7 +1068,7 @@ void QWebPagePrivate::dragMoveEvent(QDragMoveEvent* ev) ev->setDropAction(action); // We must accept this event in order to receive the drag move events that are sent // while the drag and drop action is in progress. - ev->accept(); + ev->acceptProposedAction(); #endif } @@ -1075,7 +1078,7 @@ void QWebPagePrivate::dropEvent(QGraphicsSceneDragDropEvent* ev) DragData dragData(ev->mimeData(), ev->pos().toPoint(), QCursor::pos(), dropActionToDragOp(ev->possibleActions())); if (page->dragController()->performDrag(&dragData)) - ev->accept(); + ev->acceptProposedAction(); #endif } @@ -1087,7 +1090,7 @@ void QWebPagePrivate::dropEvent(QDropEvent* ev) DragData dragData(ev->mimeData(), ev->pos(), QCursor::pos(), dropActionToDragOp(Qt::DropAction(ev->dropAction()))); if (page->dragController()->performDrag(&dragData)) - ev->accept(); + ev->acceptProposedAction(); #endif } @@ -1203,6 +1206,7 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev) ev->accept(); } +#ifndef QT_NO_PROPERTIES void QWebPagePrivate::dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent* event) { if (event->propertyName() == "_q_viewMode") { @@ -1257,6 +1261,7 @@ void QWebPagePrivate::dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent* ev } #endif } +#endif void QWebPagePrivate::shortcutOverrideEvent(QKeyEvent* event) { @@ -1931,6 +1936,30 @@ bool QWebPage::shouldInterruptJavaScript() } /*! + \fn bool QWebPage::allowGeolocationRequest() + \since 4.7 + + This function is called whenever a JavaScript program running inside \a frame tries to access user location through navigator.geolocation. + + If the user wants to allow access to location then it should return true; otherwise false. + + The default implementation executes the query using QMessageBox::information with QMessageBox::Yes and QMessageBox::No buttons. + + \warning Because of binary compatibility constraints, this function is not virtual. If you want to + provide your own implementation in a QWebPage subclass, reimplement the allowGeolocationRequest() + slot in your subclass instead. QtWebKit will dynamically detect the slot and call it. +*/ +bool QWebPage::allowGeolocationRequest(QWebFrame *frame) +{ +#ifdef QT_NO_MESSAGEBOX + return false; +#else + QWidget* parent = (d->client) ? d->client->ownerWidget() : 0; + return QMessageBox::Yes == QMessageBox::information(parent, tr("Location Request by- %1").arg(frame->url().host()), tr("The page wants to access your location information. Do you want to allow the request?"), QMessageBox::Yes, QMessageBox::No); +#endif +} + +/*! This function is called whenever WebKit wants to create a new window of the given \a type, for example when a JavaScript program requests to open a document in a new window. @@ -2641,9 +2670,11 @@ bool QWebPage::event(QEvent *ev) d->touchEvent(static_cast(ev)); break; #endif +#ifndef QT_NO_PROPERTIES case QEvent::DynamicPropertyChange: d->dynamicPropertyChangeEvent(static_cast(ev)); break; +#endif default: return QObject::event(ev); } @@ -3095,6 +3126,14 @@ bool QWebPage::findText(const QString &subString, FindFlags options) } else return d->page->markAllMatchesForText(subString, caseSensitivity, true, 0); } else { + if (subString.isEmpty()) { + d->page->mainFrame()->selection()->clear(); + Frame* frame = d->page->mainFrame()->tree()->firstChild(); + while (frame) { + frame->selection()->clear(); + frame = frame->tree()->traverseNextWithWrap(false); + } + } ::FindDirection direction = ::FindDirectionForward; if (options & FindBackward) direction = ::FindDirectionBackward; diff --git a/WebKit/qt/Api/qwebpage.h b/WebKit/qt/Api/qwebpage.h index a4b555a..721f4a8 100644 --- a/WebKit/qt/Api/qwebpage.h +++ b/WebKit/qt/Api/qwebpage.h @@ -307,6 +307,7 @@ public: public Q_SLOTS: bool shouldInterruptJavaScript(); + bool allowGeolocationRequest(QWebFrame *frame); Q_SIGNALS: void loadStarted(); diff --git a/WebKit/qt/Api/qwebpage_p.h b/WebKit/qt/Api/qwebpage_p.h index 7414716..272f96b 100644 --- a/WebKit/qt/Api/qwebpage_p.h +++ b/WebKit/qt/Api/qwebpage_p.h @@ -44,7 +44,6 @@ namespace WebCore { class EditorClientQt; class Element; class InspectorController; - class NotificationPresenterClientQt; class Node; class Page; class Frame; @@ -113,7 +112,9 @@ public: void inputMethodEvent(QInputMethodEvent*); +#ifndef QT_NO_PROPERTIES void dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent*); +#endif void shortcutOverrideEvent(QKeyEvent*); void leaveEvent(QEvent*); @@ -191,8 +192,6 @@ public: bool inspectorIsInternalOnly; // True if created through the Inspect context menu action Qt::DropAction m_lastDropAction; - WebCore::NotificationPresenterClientQt* notificationPresenterClient; - QString viewMode; static bool drtRun; diff --git a/WebKit/qt/Api/qwebpluginfactory.cpp b/WebKit/qt/Api/qwebpluginfactory.cpp index f715430..b9180be 100644 --- a/WebKit/qt/Api/qwebpluginfactory.cpp +++ b/WebKit/qt/Api/qwebpluginfactory.cpp @@ -63,7 +63,7 @@ /*! \class QWebPluginFactory::Plugin \since 4.4 - \brief the QWebPluginFactory::Plugin structure describes the properties of a plugin a QWebPluginFactory can create. + \brief The QWebPluginFactory::Plugin structure describes the properties of a plugin a QWebPluginFactory can create. \inmodule QtWebKit */ @@ -147,7 +147,7 @@ QWebPluginFactory::~QWebPluginFactory() supported plugins the factory can create. \note Currently, this function is only called when JavaScript programs - access the global \c plugins or \c mimetypes objects. + access the global \c plugins or \c mimetypes objects. */ /*! diff --git a/WebKit/qt/Api/qwebsettings.cpp b/WebKit/qt/Api/qwebsettings.cpp index a649658..4881bac 100644 --- a/WebKit/qt/Api/qwebsettings.cpp +++ b/WebKit/qt/Api/qwebsettings.cpp @@ -184,9 +184,10 @@ void QWebSettingsPrivate::apply() global->attributes.value(QWebSettings::SpatialNavigationEnabled)); settings->setSpatialNavigationEnabled(value); - value = attributes.value(QWebSettings::DOMPasteAllowed, - global->attributes.value(QWebSettings::DOMPasteAllowed)); + value = attributes.value(QWebSettings::JavascriptCanAccessClipboard, + global->attributes.value(QWebSettings::JavascriptCanAccessClipboard)); settings->setDOMPasteAllowed(value); + settings->setJavaScriptCanAccessClipboard(value); value = attributes.value(QWebSettings::DeveloperExtrasEnabled, global->attributes.value(QWebSettings::DeveloperExtrasEnabled)); @@ -235,10 +236,6 @@ void QWebSettingsPrivate::apply() global->attributes.value(QWebSettings::LocalContentCanAccessFileUrls)); settings->setAllowFileAccessFromFileURLs(value); - value = attributes.value(QWebSettings::JavaScriptCanAccessClipboard, - global->attributes.value(QWebSettings::JavaScriptCanAccessClipboard)); - settings->setJavaScriptCanAccessClipboard(value); - value = attributes.value(QWebSettings::XSSAuditingEnabled, global->attributes.value(QWebSettings::XSSAuditingEnabled)); settings->setXSSAuditorEnabled(value); @@ -249,6 +246,10 @@ void QWebSettingsPrivate::apply() settings->setTiledBackingStoreEnabled(value); #endif + value = attributes.value(QWebSettings::SiteSpecificQuirksEnabled, + global->attributes.value(QWebSettings::SiteSpecificQuirksEnabled)); + settings->setNeedsSiteSpecificQuirks(value); + settings->setUsesPageCache(WebCore::pageCache()->capacity()); } else { QList settings = *::allSettings(); @@ -376,8 +377,6 @@ QWebSettings* QWebSettings::globalSettings() recording visited pages in the history and storing web page icons. This is disabled by default. \value JavascriptCanOpenWindows Specifies whether JavaScript programs can open new windows. This is disabled by default. - \value DOMPasteAllowed Specifies whether JavaScript programs can - read clipboard contents. \value JavascriptCanAccessClipboard Specifies whether JavaScript programs can read or write to the clipboard. This is disabled by default. \value DeveloperExtrasEnabled Enables extra tools for Web developers. @@ -433,6 +432,8 @@ QWebSettings* QWebSettings::globalSettings() and at other times scrolling the page itself. For this reason iframes and framesets are barely usable on touch devices. This will flatten all the frames to become one scrollable page. This is disabled by default. + \value SiteSpecificQuirksEnabled This setting enables WebKit's workaround for broken sites. It is + enabled by default. */ /*! @@ -469,6 +470,7 @@ QWebSettings::QWebSettings() d->attributes.insert(QWebSettings::WebGLEnabled, false); d->attributes.insert(QWebSettings::TiledBackingStoreEnabled, false); d->attributes.insert(QWebSettings::FrameFlatteningEnabled, false); + d->attributes.insert(QWebSettings::SiteSpecificQuirksEnabled, true); d->offlineStorageDefaultQuota = 5 * 1024 * 1024; d->defaultTextEncoding = QLatin1String("iso-8859-1"); } diff --git a/WebKit/qt/Api/qwebsettings.h b/WebKit/qt/Api/qwebsettings.h index 040f9b4..c063bcd 100644 --- a/WebKit/qt/Api/qwebsettings.h +++ b/WebKit/qt/Api/qwebsettings.h @@ -55,7 +55,7 @@ public: PluginsEnabled, PrivateBrowsingEnabled, JavascriptCanOpenWindows, - DOMPasteAllowed, + JavascriptCanAccessClipboard, DeveloperExtrasEnabled, LinksIncludedInFocusChain, ZoomTextOnly, @@ -68,14 +68,14 @@ public: #endif LocalContentCanAccessRemoteUrls, DnsPrefetchEnabled, - JavaScriptCanAccessClipboard, XSSAuditingEnabled, AcceleratedCompositingEnabled, SpatialNavigationEnabled, LocalContentCanAccessFileUrls, TiledBackingStoreEnabled, FrameFlatteningEnabled, - WebGLEnabled + WebGLEnabled, + SiteSpecificQuirksEnabled }; enum WebGraphic { MissingImageGraphic, diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog index 14548d9..f83d64d 100644 --- a/WebKit/qt/ChangeLog +++ b/WebKit/qt/ChangeLog @@ -1,3 +1,689 @@ +2010-06-13 Yael Aharon + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Platform plugin support for Notifications UI + https://bugs.webkit.org/show_bug.cgi?id=40005 + + Add an interface to the platform plugin to display notifications. + Implemented the notification in the example platform plugin. + This interface is enabled by default, but could be turned off with + a build flag. The platform plugin should control its own lifecycle, + so now the close timer applies only when using the QSystemTrayIcon. + That's because QSystemTrayIcon does not inform its caller when it + is closed. + + Changed the way NotificationPresenterClientQt is deleted because it + is being accessed when GC is deleting the Notification objects. + NotificationPresenterClientQt is now detaching itself from the + Notifications before it is deleted. + + * Api/qwebkitplatformplugin.h: + (QWebNotificationPresenter::QWebNotificationPresenter): + (QWebNotificationPresenter::~QWebNotificationPresenter): + (QWebKitPlatformPlugin::): + * WebCoreSupport/NotificationPresenterClientQt.cpp: + (WebCore::NotificationIconWrapper::NotificationIconWrapper): + (WebCore::NotificationIconWrapper::title): + (WebCore::NotificationIconWrapper::message): + (WebCore::NotificationIconWrapper::iconData): + (WebCore::NotificationPresenterClientQt::~NotificationPresenterClientQt): + (WebCore::NotificationIconWrapper::notificationClosed): + (WebCore::NotificationPresenterClientQt::displayNotification): + (WebCore::NotificationPresenterClientQt::cancel): + (WebCore::NotificationPresenterClientQt::notificationForWrapper): + (WebCore::NotificationPresenterClientQt::removeReplacedNotificationFromQueue): + (WebCore::NotificationPresenterClientQt::detachNotification): + * WebCoreSupport/NotificationPresenterClientQt.h: + * WebCoreSupport/QtPlatformPlugin.cpp: + (WebCore::QtPlatformPlugin::createNotificationPresenter): + * WebCoreSupport/QtPlatformPlugin.h: + * examples/platformplugin/WebNotificationPresenter.cpp: Added. + (WebNotificationWidget::WebNotificationWidget): + (WebNotificationWidget::~WebNotificationWidget): + (WebNotificationWidget::showNotification): + (WebNotificationWidget::event): + * examples/platformplugin/WebNotificationPresenter.h: Added. + (WebNotificationPresenter::WebNotificationPresenter): + (WebNotificationPresenter::~WebNotificationPresenter): + (WebNotificationPresenter::showNotification): + * examples/platformplugin/WebPlugin.cpp: + (WebPlugin::supportsExtension): + * examples/platformplugin/WebPlugin.h: + (WebPlugin::createNotificationPresenter): + * examples/platformplugin/platformplugin.pro: + * examples/platformplugin/qwebkitplatformplugin.h: + (QWebNotificationPresenter::QWebNotificationPresenter): + (QWebNotificationPresenter::~QWebNotificationPresenter): + (QWebKitPlatformPlugin::): + +2010-06-14 Mahesh Kulkarni + + Reviewed by Laszlo Gombos. + + [Qt] navigator.geolocation support for Qt port + https://bugs.webkit.org/show_bug.cgi?id=39724 + + Implement ChromeClientQt::requestGeolocationPermissionForFrame() which delegates call to QWebPage::allowGeolocationRequest + Layout and unit test cases for the are also added. + + * Api/qwebpage.cpp: + (QWebPage::allowGeolocationRequest): + * Api/qwebpage.h: + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::requestGeolocationPermissionForFrame): + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::setMockGeolocationPosition): + (DumpRenderTreeSupportQt::setMockGeolocationError): + * WebCoreSupport/DumpRenderTreeSupportQt.h: + * tests/qwebpage/tst_qwebpage.cpp: + (JSTestPage::shouldInterruptJavaScript): + (JSTestPage::allowGeolocationRequest): + (JSTestPage::setGeolocationPermission): + (tst_QWebPage::geolocationRequestJS): + +2010-06-14 Ilya Tikhonovsky + + Reviewed by Pavel Feldman. + + WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc + data from inspected page to WebInspector as JSON string via http. The native + serialization to JSON string is supported by InspectorValue's classes. This patch + has the implementation of sendMessageToFrontend function. WebKit version of it still + uses ScriptFunctionCall and will be switched to another transport a little bit later. + https://bugs.webkit.org/show_bug.cgi?id=40134 + + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientQt::InspectorClientQt): + (WebCore::InspectorClientQt::openInspectorFrontend): + (WebCore::InspectorClientQt::releaseFrontendPage): + (WebCore::InspectorClientQt::sendMessageToFrontend): + * WebCoreSupport/InspectorClientQt.h: + +2010-06-13 Charles Wei + + Reviewed by George Staikos. + + Fix the QtWebKit which doesn't recognize the MIME type of HTML/TEXT in uppercase + https://bugs.webkit.org/show_bug.cgi?id=39492 + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::canShowMIMEType): + +2010-06-08 Robert Hogan + + Reviewed by Eric Seidel. + + [Qt] Add support for callShouldCloseOnWebView() to DRT + https://bugs.webkit.org/show_bug.cgi?id=40330 + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::shouldClose): + * WebCoreSupport/DumpRenderTreeSupportQt.h: + +2010-06-12 Dawit Alemayehu + + Reviewed by Kenneth Rohde Christiansen. + + Added an attribute to enable/disable site specific quirks mode in WebKit. + The attribute is enabled by default. + + https://bugs.webkit.org/show_bug.cgi?id=40073 + + * Api/qwebsettings.cpp: + (QWebSettingsPrivate::apply): + (QWebSettings::QWebSettings): + * Api/qwebsettings.h: + +2010-06-12 Robert Hogan + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Fix tst_qwebframe regression from http://trac.webkit.org/changeset/61062 + + Only use cacheableBindingRootObject() if the object has QtOwnership. + + https://bugs.webkit.org/show_bug.cgi?id=40527 + + * Api/qwebframe.cpp: + (QWebFrame::addToJavaScriptWindowObject): + +2010-06-13 Robert Hogan + + Reviewed by Alexey Proskuryakov. + + FrameLoader::clear() clears JS objects that cached pages later rely on + + https://bugs.webkit.org/show_bug.cgi?id=37725 + https://bugs.webkit.org/show_bug.cgi?id=31626 + + Fix the following tests for Qt: + + fast/events/pageshow-pagehide-on-back-cached.html + fast/events/pageshow-pagehide-on-back-cached-with-frames.html + fast/loader/input-element-page-cache-crash.html + fast/dom/Window/timer-resume-on-navigation-back.html + loader/go-back-to-different-window-size.html + fast/dom/javascript-url-crash-function.html + fast/dom/location-new-window-no-crash.html + http/tests/security/javascriptURL/xss-ALLOWED-from-javascript-url-window-open.html + + which currently fail because the page's Qt-bindings runtime objects are + cleared when navigating away from the page containing them. + + Track Qt-bindings objects in a separate ScriptController::cacheableRootBindingObject(). + RuntimeObjects tracked by this root object will not get invalidated on page navigations, + so they will still be available when the pages containing them are retrieved from the + b/f cache. + + This means the Qt bindings objects will only get cleared on Frame::pageDestroyed(). + + * Api/qwebframe.cpp: + (QWebFrame::addToJavaScriptWindowObject): + +2010-06-12 No'am Rosenthal + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Add documentation to the QtWebkit bridge + https://bugs.webkit.org/show_bug.cgi?id=35861 + + The previous accepted patch was actually a faulty one; It was hard to trace since it's just a documentation + change. The new patch amends that, with the correct snippets and grammar fixes. + + * docs/qtwebkit-bridge.qdoc: + * docs/webkitsnippets/qtwebkit_bridge_snippets.cpp: + (wrapInFunction): + +2010-06-12 Robert Hogan + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Back-forward list dumping is incorrect + + https://bugs.webkit.org/show_bug.cgi?id=36392 + + Support dumping child history items in DRT. + + Unskip: + + fast/loader/frame-src-change-added-to-history.html + fast/loader/frame-src-change-not-added-to-history.html + fast/loader/frame-location-change-not-added-to-history.html + + * Api/qwebhistory.cpp: + (QWebHistoryItemPrivate::core): + * Api/qwebhistory.h: + * Api/qwebhistory_p.h: + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::isTargetItem): + (DumpRenderTreeSupportQt::historyItemTarget): + (DumpRenderTreeSupportQt::getChildHistoryItems): + * WebCoreSupport/DumpRenderTreeSupportQt.h: + +2010-06-11 Jesus Sanchez-Palencia + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Typo error in QWebPluginFactory Documentation + https://bugs.webkit.org/show_bug.cgi?id=40490 + + * Api/qwebpluginfactory.cpp: + +2010-06-11 Jocelyn Turcotte + + Reviewed by nobody, build fix. + + [Qt] Second fix attempt for the build break introduced by r61002. + + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + +2010-06-11 Jocelyn Turcotte + + Reviewed by nobody, build fix. + + [Qt] Fix build break introduced by r61002. + + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + +2010-05-31 Jocelyn Turcotte + + Reviewed by Simon Hausmann. + + [Qt] Implement the simple text code path. + https://bugs.webkit.org/show_bug.cgi?id=40077 + + Remove the FONT_FAST_PATH macro and use the Qt's + fast text implementation instead of the one of WebKit. + + The Qt::TextBypassShaping flag is used to tell Qt to + only use the glyph advances. + + Qt 4.7 is needed to get this flag thus the complex path is always + used if QtWebKit is compiled against an earlier version. + + Contrary to the WebKit's implementation, the complex code path + is taken if the text is RightToLeft, justified or is formatted + with non-zero letter or word spacing. + + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + +2010-06-10 Yael Aharon + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Support for loading notification icons + https://bugs.webkit.org/show_bug.cgi?id=40004 + + Take into use the icon that was loaded for the notification. + + * WebCoreSupport/NotificationPresenterClientQt.cpp: + (WebCore::NotificationPresenterClientQt::show): + +2010-06-10 Mahesh Kulkarni + + Reviewed by Simon Hausmann. + + [Qt] Memory leak in qwebpage unit test cases + https://bugs.webkit.org/show_bug.cgi?id=40405 + + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::infiniteLoopJS): + +2010-06-10 Raine Makelainen + + Reviewed by Kenneth Rohde Christiansen. + + Impossible to set input method hints based HTML5 input types + https://bugs.webkit.org/show_bug.cgi?id=40107 + + EditorClientQt to set input method hints for "number", "tel", + "email", and "url" HTML input elements. + + Tests for HTML input elements and input method hints added for + QGraphicsWebView and QWebView. + + * WebCoreSupport/EditorClientQt.cpp: + (WebCore::EditorClientQt::setInputMethodState): + * tests/qgraphicswebview/resources/input_types.html: Added. + * tests/qgraphicswebview/tst_qgraphicswebview.cpp: + (GraphicsWebView::GraphicsWebView): + (GraphicsWebView::fireMouseClick): + (tst_QGraphicsWebView::focusInputTypes): + * tests/qgraphicswebview/tst_qgraphicswebview.qrc: Added. + * tests/qwebview/resources/input_types.html: Added. + * tests/qwebview/tst_qwebview.cpp: + (WebView::fireMouseClick): + (tst_QWebView::focusInputTypes): + * tests/qwebview/tst_qwebview.qrc: + +2010-06-10 Eric Seidel + + Reviewed by Adam Barth. + + Reduce FrameView.h includes to speed up build times + https://bugs.webkit.org/show_bug.cgi?id=40408 + + * Api/qwebframe.cpp: + - Include RenderLayer.h since it's used in this file. + +2010-06-10 Andy Shaw + + Reviewed by Simon Hausmann. + + REGRESSION: [Qt] When dragging onto a page that handles the drag in Javascript it will be a move and not a copy by default + https://bugs.webkit.org/show_bug.cgi?id=40401 + + The correct pattern in Qt for Dnd events is to use acceptProposedAction() instead + of accept(). + + * Api/qwebpage.cpp: + (QWebPagePrivate::dragEnterEvent): + (QWebPagePrivate::dragMoveEvent): + (QWebPagePrivate::dropEvent): + +2010-06-09 Pierre Rossi + + Reviewed by Kenneth Rohde Christiansen. + + QWebPage::findText() does not clear selection when passed empty string + https://bugs.webkit.org/show_bug.cgi?id=31779 + + * Api/qwebpage.cpp: + (QWebPage::findText): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::findText): + +2010-06-09 Anders Bakken + + Reviewed by David Levin. + + [Qt] PageClientQt.h has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=40257 + + * WebCoreSupport/PageClientQt.h: + +2010-06-09 Anders Bakken + + Reviewed by David Levin. + + [Qt] InspectorClientQt.cpp has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=40255 + + * WebCoreSupport/InspectorClientQt.cpp: + +2010-06-09 Anders Bakken + + Reviewed by David Levin. + + [Qt] FrameLoaderClientQt.h has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=40251 + + * WebCoreSupport/FrameLoaderClientQt.h: + (WebCore::FrameLoaderClientQt::dispatchWillSendSubmitEvent): + +2010-06-09 Anders Bakken + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] EditorClientQt.h has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=40249 + + * WebCoreSupport/EditorClientQt.h: + +2010-06-09 Anders Bakken + + Reviewed by David Levin. + + [Qt] EditCommandQt.cpp/h have coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=40248 + + * WebCoreSupport/EditCommandQt.cpp: + (EditCommandQt::EditCommandQt): + (EditCommandQt::~EditCommandQt): + (EditCommandQt::redo): + (EditCommandQt::undo): + * WebCoreSupport/EditCommandQt.h: + +2010-06-09 Anders Bakken + + Reviewed by David Levin. + + [Qt] DumpRenderTreeSupportQt.cpp has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=40247 + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::firstRectForCharacterRange): + +2010-06-09 Anders Bakken + + Reviewed by David Levin. + + [Qt] DragClientQt.cpp has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=40246 + + * WebCoreSupport/DragClientQt.cpp: + (WebCore::DragClientQt::startDrag): + +2010-06-09 Anders Bakken + + Reviewed by Laszlo Gombos. + + [Qt] ContextMenuClientQt.h has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=40242 + + * WebCoreSupport/ContextMenuClientQt.h: + +2010-06-09 Anders Bakken + + Reviewed by David Levin. + + [Qt] ChromeClientQt.cpp has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=40240 + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::pageRect): + (WebCore::ChromeClientQt::createWindow): + (WebCore::ChromeClientQt::runJavaScriptAlert): + (WebCore::ChromeClientQt::runJavaScriptConfirm): + (WebCore::ChromeClientQt::runJavaScriptPrompt): + (WebCore::ChromeClientQt::print): + (WebCore::ChromeClientQt::attachRootGraphicsLayer): + (WebCore::ChromeClientQt::visibleRectForTiledBackingStore): + +2010-06-09 Sheriff Bot + + Unreviewed, rolling out r60889. + http://trac.webkit.org/changeset/60889 + https://bugs.webkit.org/show_bug.cgi?id=40365 + + gtk bot has some kind of memory corruption (Requested by + loislo on #webkit). + + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientQt::InspectorClientQt): + (WebCore::InspectorClientQt::openInspectorFrontend): + (WebCore::InspectorFrontendClientQt::InspectorFrontendClientQt): + (WebCore::InspectorFrontendClientQt::closeWindow): + * WebCoreSupport/InspectorClientQt.h: + +2010-06-07 Ilya Tikhonovsky + + Reviewed by Pavel Feldman. + + WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc + data from inspected page to WebInspector as JSON string via http. The native + serialization to JSON string is supported by InspectorValue's classes. This patch + has the implementation of sendMessageToFrontend function. WebKit version of it still + uses ScriptFunctionCall and will be switched to another transport a little bit later. + https://bugs.webkit.org/show_bug.cgi?id=40134 + + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientQt::InspectorClientQt): + (WebCore::InspectorClientQt::openInspectorFrontend): + (WebCore::InspectorClientQt::releaseFrontendPage): + (WebCore::InspectorClientQt::sendMessageToFrontend): + * WebCoreSupport/InspectorClientQt.h: + +2010-06-08 Antonio Gomes + + Reviewed by Ojan Vafai and Darin Adler. + + Refactor platform dependent editing behavior code out of Settings + https://bugs.webkit.org/show_bug.cgi?id=39854 + + EditingBehavior enum was renamed to EditingBehaviorTypes and moved out from Settings.h to + EditingBehaviorTypes.h . Call sites in WebKit/ adjusted accordingly. + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::setEditingBehavior): + +2010-06-07 Anders Bakken + + Reviewed by David Levin. + + [Qt] NotificationPresenterClientQt.cpp has coding-style errors + https://bugs.webkit.org/show_bug.cgi?id=40256 + + * WebCoreSupport/NotificationPresenterClientQt.cpp: + (WebCore::NotificationPresenterClientQt::show): + +2010-06-06 Antonio Gomes , Laszlo Gombos + + Reviewed by Kenneth Christiansen, Eric Seidel. + + [Qt] Expose the editing behavior setting in DRT to test all editing code paths + https://bugs.webkit.org/show_bug.cgi?id=39680 + + Make setEditingBehavior() a no-operation if the editingBehavior + argument is not recognized to avoid using an uninitialized variable. + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::setEditingBehavior): + +2010-06-04 Laszlo Gombos + + Symbian build fix. + + [Qt] Updated the def file with recent new exports. + + * symbian/eabi/QtWebKitu.def: + +2010-06-03 Yael Aharon + + Reviewed by Laszlo Gombos. + + [Qt] Don't send notifications event after the page was navigated away + https://bugs.webkit.org/show_bug.cgi?id=40127 + + Added a check before sending events to the notification and before logging. + + * WebCoreSupport/NotificationPresenterClientQt.cpp: + (WebCore::NotificationPresenterClientQt::cancel): + (WebCore::NotificationPresenterClientQt::sendEvent): + +2010-06-02 Tasuku Suzuki + + Reviewed by Shinichiro Hamaji. + + [Qt] Fix compilation with QT_NO_PROPERTIES + https://bugs.webkit.org/show_bug.cgi?id=38324 + + * Api/qwebpage.cpp: + (QWebPage::event): + * Api/qwebpage_p.h: + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientQt::openInspectorFrontend): + +2010-06-02 Luiz Agostini + + Reviewed by Simon Hausmann. + + [Qt] Shared platform plugin + https://bugs.webkit.org/show_bug.cgi?id=39968 + + Allow several instances of class QtPlatformPlugin to share the QWebKitPlatformPlugin + object provided by a plugin. + + Updated plugin interface version number due to ABI breaking change. + + * Api/qwebkitplatformplugin.h: + (QWebKitPlatformPlugin::~QWebKitPlatformPlugin): + * WebCoreSupport/QtPlatformPlugin.cpp: + (WebCore::QtPlatformPlugin::load): + (WebCore::QtPlatformPlugin::~QtPlatformPlugin): + (WebCore::QtPlatformPlugin::plugin): + * WebCoreSupport/QtPlatformPlugin.h: + * examples/platformplugin/qwebkitplatformplugin.h: + (QWebKitPlatformPlugin::~QWebKitPlatformPlugin): + +2010-06-02 Raine Makelainen + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] On Maemo6 platform auto upper case and predictive text input method hints are not disabled for password field. + https://bugs.webkit.org/show_bug.cgi?id=40062 + + Introducing Q_WS_MAEMO_6 for Maemo6 specific code. Enabling code that sets input + method hints Qt::ImhNoAutoUppercase and Qt::ImhNoPredictiveText true for Maemo6. + + * WebCoreSupport/EditorClientQt.cpp: + (WebCore::EditorClientQt::setInputMethodState): + +2010-06-01 Yael Aharon + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Fix the lifecycle of notification objects + https://bugs.webkit.org/show_bug.cgi?id=40003 + + Notification objects are not tightly related to the page that created them, + and should be decoupled from the page. + Create one NotificationPresenter that handles all notifications. + Add ref/deref to the notification objects when they are added/removed from + the queue of active notifications. The same technique is used for XMLHttpRequest. + Instead of deleting all notifications associated with a page when the page is navigated, + delete them on a timer, using the same timeout that QSystemTrayIcon is using. + Break up the show() method into smaller methods. + Use OwnPtr instead of raw pointer for QSystemTrayIcon. + Move creating the QIcon to just before showing it in the QSyetemTrayIcon. + + No new tests as this is just a refactoring. Existing notifications test cover the code. + + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + (QWebPagePrivate::~QWebPagePrivate): + * Api/qwebpage_p.h: + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::notificationPresenter): + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::setNotificationsReceiver): + (DumpRenderTreeSupportQt::allowNotificationForOrigin): + * WebCoreSupport/DumpRenderTreeSupportQt.h: + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::dispatchDidClearWindowObjectInWorld): + * WebCoreSupport/NotificationPresenterClientQt.cpp: + (WebCore::NotificationPresenterClientQt::notificationPresenter): + (WebCore::NotificationIconWrapper::NotificationIconWrapper): + (WebCore::NotificationIconWrapper::~NotificationIconWrapper): + (WebCore::NotificationIconWrapper::close): + (WebCore::NotificationPresenterClientQt::NotificationPresenterClientQt): + (WebCore::NotificationPresenterClientQt::removeClient): + (WebCore::NotificationPresenterClientQt::show): + (WebCore::NotificationPresenterClientQt::displayNotification): + (WebCore::NotificationPresenterClientQt::cancel): + (WebCore::NotificationPresenterClientQt::notificationObjectDestroyed): + (WebCore::NotificationPresenterClientQt::requestPermission): + (WebCore::NotificationPresenterClientQt::sendEvent): + (WebCore::NotificationPresenterClientQt::removeReplacedNotificationFromQueue): + (WebCore::NotificationPresenterClientQt::dumpReplacedIdText): + (WebCore::NotificationPresenterClientQt::dumpShowText): + * WebCoreSupport/NotificationPresenterClientQt.h: + (WebCore::NotificationPresenterClientQt::addClient): + +2010-06-01 Noam Rosenthal + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Add documentation to the QtWebkit bridge + https://bugs.webkit.org/show_bug.cgi?id=35861 + + This patch includes comprehensive qdoc documentation for the QtWebkit bridge. + + * docs/qtwebkit-bridge.qdoc: Added. + * docs/qtwebkit.qdoc: + * docs/webkitsnippets/doc_src_qtscript.qdoc: Added. + * docs/webkitsnippets/qtwebkit_bridge_snippets.cpp: Added. + (wrapInFunction): + +2010-06-01 Raine Makelainen + + Reviewed by Simon Hausmann. + + [Qt]: REGRESSION(r58703): QWebSettings::JavascriptCanAccessClipboard has wrong case in "Javascript" part. + https://bugs.webkit.org/show_bug.cgi?id=39878 + + QWebSettings::JavaScriptCanAccessClipboard reverted back to + QWebSettings::JavascriptCanAccessClipboard. QWebSettings::DOMPasteAllowed enum removed. + + Value of QWebSettings::JavascriptCanAccessClipboard to setDOMPasteAllowed and + setJavaScriptCanAccessClipboard of WebCore::Settings. + + * Api/qwebsettings.cpp: + (QWebSettingsPrivate::apply): + * Api/qwebsettings.h: + +2010-06-01 Simon Hausmann + + Reviewed by Laszlo Gombos. + + [Qt] Rename versioning .pri file to what Qt's mkspecs/features/qt.pri expects. + + * qt_webkit_version.pri: Renamed from WebKit/qt/qtwebkit_version.pri. + 2010-05-31 Lyon Chen Reviewed by Kent Tamura. diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp index bcb07ee..98ffd8a 100644 --- a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp @@ -29,19 +29,20 @@ #include "config.h" #include "ChromeClientQt.h" +#include "DatabaseTracker.h" #include "FileChooser.h" #include "Frame.h" #include "FrameLoadRequest.h" #include "FrameLoader.h" #include "FrameLoaderClientQt.h" #include "FrameView.h" +#include "Geolocation.h" #include "HitTestResult.h" #include "Icon.h" -#include "NotificationPresenterClientQt.h" #include "NotImplemented.h" +#include "NotificationPresenterClientQt.h" #include "ScrollbarTheme.h" #include "WindowFeatures.h" -#include "DatabaseTracker.h" #if defined(Q_WS_MAEMO_5) #include "QtMaemoWebPopup.h" #else @@ -50,18 +51,18 @@ #include "QWebPageClient.h" #include "SecurityOrigin.h" -#include -#include -#include -#include - +#include "qwebframe_p.h" #include "qwebpage.h" #include "qwebpage_p.h" -#include "qwebframe_p.h" #include "qwebsecurityorigin.h" #include "qwebsecurityorigin_p.h" #include "qwebview.h" +#include +#include +#include +#include + #if USE(ACCELERATED_COMPOSITING) #include "GraphicsLayerQt.h" #endif @@ -106,7 +107,7 @@ FloatRect ChromeClientQt::pageRect() { if (!m_webPage) return FloatRect(); - return FloatRect(QRectF(QPointF(0,0), m_webPage->viewportSize())); + return FloatRect(QRectF(QPointF(0, 0), m_webPage->viewportSize())); } @@ -163,7 +164,7 @@ void ChromeClientQt::focusedNodeChanged(WebCore::Node*) Page* ChromeClientQt::createWindow(Frame*, const FrameLoadRequest& request, const WindowFeatures& features) { - QWebPage *newPage = m_webPage->createWindow(features.dialog ? QWebPage::WebModalDialog : QWebPage::WebBrowserWindow); + QWebPage* newPage = m_webPage->createWindow(features.dialog ? QWebPage::WebModalDialog : QWebPage::WebBrowserWindow); if (!newPage) return 0; @@ -290,21 +291,21 @@ void ChromeClientQt::closeWindowSoon() void ChromeClientQt::runJavaScriptAlert(Frame* f, const String& msg) { QString x = msg; - FrameLoaderClientQt *fl = static_cast(f->loader()->client()); + FrameLoaderClientQt* fl = static_cast(f->loader()->client()); m_webPage->javaScriptAlert(fl->webFrame(), x); } bool ChromeClientQt::runJavaScriptConfirm(Frame* f, const String& msg) { QString x = msg; - FrameLoaderClientQt *fl = static_cast(f->loader()->client()); + FrameLoaderClientQt* fl = static_cast(f->loader()->client()); return m_webPage->javaScriptConfirm(fl->webFrame(), x); } bool ChromeClientQt::runJavaScriptPrompt(Frame* f, const String& message, const String& defaultValue, String& result) { QString x = result; - FrameLoaderClientQt *fl = static_cast(f->loader()->client()); + FrameLoaderClientQt* fl = static_cast(f->loader()->client()); bool rc = m_webPage->javaScriptPrompt(fl->webFrame(), (QString)message, (QString)defaultValue, &x); // Fix up a quirk in the QInputDialog class. If no input happened the string should be empty @@ -459,7 +460,7 @@ void ChromeClientQt::setToolTip(const String &tip, TextDirection) #endif } -void ChromeClientQt::print(Frame *frame) +void ChromeClientQt::print(Frame* frame) { emit m_webPage->printRequested(QWebFramePrivate::kit(frame)); } @@ -487,7 +488,7 @@ void ChromeClientQt::reachedMaxAppCacheSize(int64_t) #if ENABLE(NOTIFICATIONS) NotificationPresenter* ChromeClientQt::notificationPresenter() const { - return m_webPage->d->notificationPresenterClient; + return NotificationPresenterClientQt::notificationPresenter(); } #endif @@ -534,15 +535,17 @@ bool ChromeClientQt::setCursor(PlatformCursorHandle) return false; } -void ChromeClientQt::requestGeolocationPermissionForFrame(Frame*, Geolocation*) +void ChromeClientQt::requestGeolocationPermissionForFrame(Frame* frame, Geolocation* geolocation) { - // See the comment in WebCore/page/ChromeClient.h - notImplemented(); + bool allow = false; + QWebFrame* webFrame = QWebFramePrivate::kit(frame); + QMetaObject::invokeMethod(m_webPage, "allowGeolocationRequest", Qt::DirectConnection, Q_RETURN_ARG(bool, allow), Q_ARG(QWebFrame*, webFrame)); + geolocation->setIsAllowed(allow); } #if USE(ACCELERATED_COMPOSITING) void ChromeClientQt::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* graphicsLayer) -{ +{ if (platformPageClient()) platformPageClient()->setRootGraphicsLayer(graphicsLayer ? graphicsLayer->nativeLayer() : 0); } @@ -567,10 +570,10 @@ bool ChromeClientQt::allowsAcceleratedCompositing() const } #endif - + #if ENABLE(TILED_BACKING_STORE) IntRect ChromeClientQt::visibleRectForTiledBackingStore() const -{ +{ if (!platformPageClient() || !m_webPage) return IntRect(); diff --git a/WebKit/qt/WebCoreSupport/ContextMenuClientQt.h b/WebKit/qt/WebCoreSupport/ContextMenuClientQt.h index 8440ff5..1b4475f 100644 --- a/WebKit/qt/WebCoreSupport/ContextMenuClientQt.h +++ b/WebKit/qt/WebCoreSupport/ContextMenuClientQt.h @@ -31,23 +31,22 @@ #include namespace WebCore { - class ContextMenu; - - class ContextMenuClientQt : public ContextMenuClient - { - public: - virtual void contextMenuDestroyed(); - - virtual PlatformMenuDescription getCustomMenuFromDefaultItems(ContextMenu*); - virtual void contextMenuItemSelected(ContextMenuItem*, const ContextMenu*); - - virtual void downloadURL(const KURL& url); - virtual void lookUpInDictionary(Frame*); - virtual void speak(const String&); - virtual bool isSpeaking(); - virtual void stopSpeaking(); - virtual void searchWithGoogle(const Frame*); - }; +class ContextMenu; + +class ContextMenuClientQt : public ContextMenuClient { +public: + virtual void contextMenuDestroyed(); + + virtual PlatformMenuDescription getCustomMenuFromDefaultItems(ContextMenu*); + virtual void contextMenuItemSelected(ContextMenuItem*, const ContextMenu*); + + virtual void downloadURL(const KURL& url); + virtual void lookUpInDictionary(Frame*); + virtual void speak(const String&); + virtual bool isSpeaking(); + virtual void stopSpeaking(); + virtual void searchWithGoogle(const Frame*); +}; } #endif diff --git a/WebKit/qt/WebCoreSupport/DragClientQt.cpp b/WebKit/qt/WebCoreSupport/DragClientQt.cpp index e48c3e3..52229dc 100644 --- a/WebKit/qt/WebCoreSupport/DragClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/DragClientQt.cpp @@ -93,7 +93,7 @@ void DragClientQt::startDrag(DragImageRef, const IntPoint&, const IntPoint&, Cli static_cast(clipboard)->invalidateWritableData(); QWidget* view = m_webPage->view(); if (view) { - QDrag *drag = new QDrag(view); + QDrag* drag = new QDrag(view); if (clipboardData && clipboardData->hasImage()) drag->setPixmap(qvariant_cast(clipboardData->imageData())); DragOperation dragOperationMask = clipboard->sourceOperation(); diff --git a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp index 0b2e9a5..c92e43f 100644 --- a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp +++ b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp @@ -35,12 +35,17 @@ #include "FrameLoaderClientQt.h" #include "FrameView.h" #include "GCController.h" +#include "Geolocation.h" +#include "GeolocationServiceMock.h" +#include "Geoposition.h" +#include "HistoryItem.h" #include "HTMLInputElement.h" #include "InspectorController.h" #include "NotificationPresenterClientQt.h" #include "Page.h" #include "PageGroup.h" #include "PluginDatabase.h" +#include "PositionError.h" #include "PrintContext.h" #include "RenderListItem.h" #include "RenderTreeAsText.h" @@ -51,10 +56,13 @@ #endif #include "TextIterator.h" #include "WorkerThread.h" +#include #include "qwebelement.h" #include "qwebframe.h" #include "qwebframe_p.h" +#include "qwebhistory.h" +#include "qwebhistory_p.h" #include "qwebpage.h" #include "qwebpage_p.h" @@ -437,7 +445,7 @@ QVariantList DumpRenderTreeSupportQt::firstRectForCharacterRange(QWebPage* page, WebCore::Frame* frame = page->handle()->page->focusController()->focusedOrMainFrame(); QVariantList rect; - if ((location + length < location) && (location + length != 0)) + if ((location + length < location) && (location + length)) length = 0; Element* selectionRoot = frame->selection()->rootEditableElement(); @@ -476,18 +484,22 @@ bool DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId(QWebFrame* void DumpRenderTreeSupportQt::setEditingBehavior(QWebPage* page, const QString& editingBehavior) { - WebCore::EditingBehavior coreEditingBehavior; + WebCore::EditingBehaviorType coreEditingBehavior; if (editingBehavior == "win") coreEditingBehavior = EditingWindowsBehavior; else if (editingBehavior == "mac") coreEditingBehavior = EditingMacBehavior; + else { + ASSERT_NOT_REACHED(); + return; + } Page* corePage = QWebPagePrivate::core(page); if (!corePage) return; - corePage->settings()->setEditingBehavior(coreEditingBehavior); + corePage->settings()->setEditingBehaviorType(coreEditingBehavior); } void DumpRenderTreeSupportQt::dumpFrameLoader(bool b) @@ -537,17 +549,33 @@ void DumpRenderTreeSupportQt::dumpNotification(bool b) #endif } -void DumpRenderTreeSupportQt::setNotificationsReceiver(QWebPage* page, QObject* receiver) +void DumpRenderTreeSupportQt::setNotificationsReceiver(QObject* receiver) { #if ENABLE(NOTIFICATIONS) - page->d->notificationPresenterClient->setReceiver(receiver); + NotificationPresenterClientQt::notificationPresenter()->setReceiver(receiver); #endif } -void DumpRenderTreeSupportQt::allowNotificationForOrigin(QWebPage* page, const QString& origin) +void DumpRenderTreeSupportQt::allowNotificationForOrigin(const QString& origin) { #if ENABLE(NOTIFICATIONS) - page->d->notificationPresenterClient->allowNotificationForOrigin(origin); + NotificationPresenterClientQt::notificationPresenter()->allowNotificationForOrigin(origin); +#endif +} + +void DumpRenderTreeSupportQt::setMockGeolocationPosition(double latitude, double longitude, double accuracy) +{ +#if ENABLE(GEOLOCATION) + RefPtr geoposition = Geoposition::create(Coordinates::create(latitude, longitude, false, 0, accuracy, true, 0, false, 0, false, 0), currentTime() * 1000.0); + GeolocationServiceMock::setPosition(geoposition); +#endif +} + +void DumpRenderTreeSupportQt::setMockGeolocationError(int errorCode, const QString& message) +{ +#if ENABLE(GEOLOCATION) + RefPtr positionError = PositionError::create(static_cast(errorCode), message); + GeolocationServiceMock::setError(positionError); #endif } @@ -561,6 +589,41 @@ void DumpRenderTreeSupportQt::setRequestPermissionFunction(RequestPermissionFunc requestPermissionFunction = f; } +bool DumpRenderTreeSupportQt::isTargetItem(const QWebHistoryItem& historyItem) +{ + QWebHistoryItem it = historyItem; + if (QWebHistoryItemPrivate::core(&it)->isTargetItem()) + return true; + return false; +} + +QString DumpRenderTreeSupportQt::historyItemTarget(const QWebHistoryItem& historyItem) +{ + QWebHistoryItem it = historyItem; + return (QWebHistoryItemPrivate::core(&it)->target()); +} + +QList DumpRenderTreeSupportQt::getChildHistoryItems(const QWebHistoryItem& historyItem) +{ + QWebHistoryItem it = historyItem; + HistoryItem* item = QWebHistoryItemPrivate::core(&it); + const WebCore::HistoryItemVector& children = item->children(); + + unsigned size = children.size(); + QList kids; + for (unsigned i = 0; i < size; ++i) { + QWebHistoryItem kid(new QWebHistoryItemPrivate(children[i].get())); + kids.prepend(kid); + } + return kids; +} + +bool DumpRenderTreeSupportQt::shouldClose(QWebFrame* frame) +{ + WebCore::Frame* coreFrame = QWebFramePrivate::core(frame); + return coreFrame->shouldClose(); +} + // Provide a backward compatibility with previously exported private symbols as of QtWebKit 4.6 release void QWEBKIT_EXPORT qt_resumeActiveDOMObjects(QWebFrame* frame) diff --git a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h index 0d348cf..e3408e3 100644 --- a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h +++ b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h @@ -29,6 +29,7 @@ class QWebElement; class QWebFrame; class QWebPage; +class QWebHistoryItem; enum NotificationPermission { NotificationAllowed, @@ -37,7 +38,7 @@ enum NotificationPermission { }; typedef void (CheckPermissionFunctionType) (QObject* receiver, const QUrl&, NotificationPermission&); -typedef void (RequestPermissionFunctionType) (QObject* receiver, QWebPage* page, const QString&); +typedef void (RequestPermissionFunctionType) (QObject* receiver, const QString&); extern CheckPermissionFunctionType* checkPermissionFunction; extern RequestPermissionFunctionType* requestPermissionFunction; @@ -96,6 +97,9 @@ public: static void removeWhiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains); static void resetOriginAccessWhiteLists(); + static void setMockGeolocationPosition(double latitude, double longitude, double accuracy); + static void setMockGeolocationError(int errorCode, const QString& message); + static int workerThreadCount(); static QString markerTextForListItem(const QWebElement& listItem); @@ -114,10 +118,16 @@ public: static void dumpNotification(bool b); // These functions should eventually turn into public API // and the "receiver" concept would go away - static void setNotificationsReceiver(QWebPage* page, QObject* receiver); - static void allowNotificationForOrigin(QWebPage* page, const QString& origin); + static void setNotificationsReceiver(QObject* receiver); + static void allowNotificationForOrigin(const QString& origin); static void setCheckPermissionFunction(CheckPermissionFunctionType*); static void setRequestPermissionFunction(RequestPermissionFunctionType*); + + static QList getChildHistoryItems(const QWebHistoryItem& historyItem); + static bool isTargetItem(const QWebHistoryItem& historyItem); + static QString historyItemTarget(const QWebHistoryItem& historyItem); + + static bool shouldClose(QWebFrame* frame); }; #endif diff --git a/WebKit/qt/WebCoreSupport/EditCommandQt.cpp b/WebKit/qt/WebCoreSupport/EditCommandQt.cpp index 756ba4c..9c4ff87 100644 --- a/WebKit/qt/WebCoreSupport/EditCommandQt.cpp +++ b/WebKit/qt/WebCoreSupport/EditCommandQt.cpp @@ -27,30 +27,31 @@ EditCommandQt::EditCommandQt(WTF::RefPtr cmd, QUndoCommand *parent) #ifndef QT_NO_UNDOCOMMAND QUndoCommand(parent), #endif - _cmd(cmd), _first(true) + m_cmd(cmd), m_first(true) { } -EditCommandQt::~EditCommandQt() { +EditCommandQt::~EditCommandQt() +{ } -void EditCommandQt::redo() { - if (_first) { - _first = false; +void EditCommandQt::redo() +{ + if (m_first) { + m_first = false; return; } - if (_cmd) { - _cmd->reapply(); - } + if (m_cmd) + m_cmd->reapply(); } -void EditCommandQt::undo() { - if (_cmd) { - _cmd->unapply(); - } +void EditCommandQt::undo() +{ + if (m_cmd) + m_cmd->unapply(); } diff --git a/WebKit/qt/WebCoreSupport/EditCommandQt.h b/WebKit/qt/WebCoreSupport/EditCommandQt.h index ae6ea51..e03b9b2 100644 --- a/WebKit/qt/WebCoreSupport/EditCommandQt.h +++ b/WebKit/qt/WebCoreSupport/EditCommandQt.h @@ -17,16 +17,12 @@ Boston, MA 02110-1301, USA. */ -#ifndef EDITCOMMANDQT_H -#define EDITCOMMANDQT_H +#ifndef EditCommandQt_h +#define EditCommandQt_h -#include -QT_BEGIN_NAMESPACE -class QUndoCommand; -QT_END_NAMESPACE - -#include #include +#include +#include class EditCommandQt #ifndef QT_NO_UNDOCOMMAND @@ -41,8 +37,8 @@ class EditCommandQt void undo(); private: - WTF::RefPtr _cmd; - bool _first; + WTF::RefPtr m_cmd; + bool m_first; }; #endif diff --git a/WebKit/qt/WebCoreSupport/EditorClientQt.cpp b/WebKit/qt/WebCoreSupport/EditorClientQt.cpp index 0f54e21..93e5745 100644 --- a/WebKit/qt/WebCoreSupport/EditorClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/EditorClientQt.cpp @@ -592,25 +592,33 @@ void EditorClientQt::setInputMethodState(bool active) QWebPageClient* webPageClient = m_page->d->client; if (webPageClient) { #if QT_VERSION >= 0x040600 - bool isPasswordField = false; - if (!active) { - // Setting the Qt::WA_InputMethodEnabled attribute true and Qt::ImhHiddenText flag - // for password fields. The Qt platform is responsible for determining which widget - // will receive input method events for password fields. - Frame* frame = m_page->d->page->focusController()->focusedOrMainFrame(); - if (frame && frame->document() && frame->document()->focusedNode()) { - if (frame->document()->focusedNode()->hasTagName(HTMLNames::inputTag)) { - HTMLInputElement* inputElement = static_cast(frame->document()->focusedNode()); - active = isPasswordField = inputElement->isPasswordField(); - } + HTMLInputElement* inputElement = 0; + Frame* frame = m_page->d->page->focusController()->focusedOrMainFrame(); + if (frame && frame->document() && frame->document()->focusedNode()) + if (frame->document()->focusedNode()->hasTagName(HTMLNames::inputTag)) + inputElement = static_cast(frame->document()->focusedNode()); + + if (inputElement) { + if (!active) { + // Setting the Qt::WA_InputMethodEnabled attribute true and Qt::ImhHiddenText flag + // for password fields. The Qt platform is responsible for determining which widget + // will receive input method events for password fields. + active = inputElement->isPasswordField(); + webPageClient->setInputMethodHint(Qt::ImhHiddenText, active); + } else { + // Set input method hints for "number", "tel", "email", and "url" input elements. + webPageClient->setInputMethodHint(Qt::ImhDialableCharactersOnly, inputElement->isTelephoneField()); + webPageClient->setInputMethodHint(Qt::ImhDigitsOnly, inputElement->isNumberField()); + webPageClient->setInputMethodHint(Qt::ImhEmailCharactersOnly, inputElement->isEmailField()); + webPageClient->setInputMethodHint(Qt::ImhUrlCharactersOnly, inputElement->isUrlField()); } } - webPageClient->setInputMethodHint(Qt::ImhHiddenText, isPasswordField); -#if defined(Q_WS_MAEMO_5) || defined(Q_OS_SYMBIAN) + +#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) || defined(Q_OS_SYMBIAN) // disables auto-uppercase and predictive text for mobile devices webPageClient->setInputMethodHint(Qt::ImhNoAutoUppercase, true); webPageClient->setInputMethodHint(Qt::ImhNoPredictiveText, true); -#endif // Q_WS_MAEMO_5 || Q_OS_SYMBIAN +#endif // Q_WS_MAEMO_5 || Q_WS_MAEMO_6 || Q_OS_SYMBIAN #endif // QT_VERSION check webPageClient->setInputMethodEnabled(active); } diff --git a/WebKit/qt/WebCoreSupport/EditorClientQt.h b/WebKit/qt/WebCoreSupport/EditorClientQt.h index 811298b..a5f6b23 100644 --- a/WebKit/qt/WebCoreSupport/EditorClientQt.h +++ b/WebKit/qt/WebCoreSupport/EditorClientQt.h @@ -27,8 +27,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef EditorClientQt_H -#define EditorClientQt_H +#ifndef EditorClientQt_h +#define EditorClientQt_h #include "EditorClient.h" #include "RefCounted.h" diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 3cf19a6..e86a84a 100644 --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -51,7 +51,6 @@ #include "HTMLFormElement.h" #include "HTMLPlugInElement.h" #include "HTTPParsers.h" -#include "NotificationPresenterClientQt.h" #include "NotImplemented.h" #include "QNetworkReplyHandler.h" #include "ResourceHandleInternal.h" @@ -543,14 +542,16 @@ void FrameLoaderClientQt::finishedLoading(DocumentLoader* loader) bool FrameLoaderClientQt::canShowMIMEType(const String& MIMEType) const { - if (MIMETypeRegistry::isSupportedImageMIMEType(MIMEType)) + String type = MIMEType; + type.makeLower(); + if (MIMETypeRegistry::isSupportedImageMIMEType(type)) return true; - if (MIMETypeRegistry::isSupportedNonImageMIMEType(MIMEType)) + if (MIMETypeRegistry::isSupportedNonImageMIMEType(type)) return true; if (m_frame && m_frame->settings() && m_frame->settings()->arePluginsEnabled() - && PluginDatabase::installedPlugins()->isMIMETypeRegistered(MIMEType)) + && PluginDatabase::installedPlugins()->isMIMETypeRegistered(type)) return true; return false; @@ -641,9 +642,6 @@ void FrameLoaderClientQt::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld* w if (m_webFrame) { emit m_webFrame->javaScriptWindowObjectCleared(); -#if ENABLE(NOTIFICATIONS) - m_webFrame->page()->d->notificationPresenterClient->clearNotificationsList(); -#endif } } diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h index 9aa9344..d858589 100644 --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h @@ -27,210 +27,210 @@ * (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 FrameLoaderClientQt_H -#define FrameLoaderClientQt_H +#ifndef FrameLoaderClientQt_h +#define FrameLoaderClientQt_h -#include -#include -#include "FrameLoaderClient.h" -#include "KURL.h" #include "Frame.h" #include "FrameLoader.h" +#include "FrameLoaderClient.h" +#include "KURL.h" +#include "PluginView.h" #include "RefCounted.h" #include "ResourceResponse.h" -#include "PluginView.h" +#include +#include class QWebFrame; namespace WebCore { - class AuthenticationChallenge; - class DocumentLoader; - class Element; - class FormState; - class NavigationAction; - class String; - class ResourceLoader; - - struct LoadErrorResetToken; - - class FrameLoaderClientQt : public QObject, public FrameLoaderClient { - Q_OBJECT - - friend class ::QWebFrame; - void callPolicyFunction(FramePolicyFunction function, PolicyAction action); - void callErrorPageExtension(const ResourceError&); - signals: - void loadStarted(); - void loadProgress(int d); - void loadFinished(bool); - void titleChanged(const QString& title); - - public: - FrameLoaderClientQt(); - ~FrameLoaderClientQt(); - virtual void frameLoaderDestroyed(); - - void setFrame(QWebFrame* webFrame, Frame* frame); - QWebFrame* webFrame() const; - - virtual bool hasWebView() const; // mainly for assertions - - virtual void makeRepresentation(DocumentLoader*); - virtual void forceLayout(); - virtual void forceLayoutForNonHTML(); - - virtual void setCopiesOnScroll(); - - virtual void detachedFromParent2(); - virtual void detachedFromParent3(); - - virtual void assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader*, const WebCore::ResourceRequest&); - - virtual void dispatchWillSendRequest(WebCore::DocumentLoader*, unsigned long, WebCore::ResourceRequest&, const WebCore::ResourceResponse&); - virtual bool shouldUseCredentialStorage(DocumentLoader*, unsigned long identifier); - virtual void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&); - virtual void dispatchDidCancelAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&); - virtual void dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long, const WebCore::ResourceResponse&); - virtual void dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long, int); - virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long); - virtual void dispatchDidFailLoading(WebCore::DocumentLoader*, unsigned long, const WebCore::ResourceError&); - virtual bool dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int); - - virtual void dispatchDidHandleOnloadEvents(); - virtual void dispatchDidReceiveServerRedirectForProvisionalLoad(); - virtual void dispatchDidCancelClientRedirect(); - virtual void dispatchWillPerformClientRedirect(const KURL&, double interval, double fireDate); - virtual void dispatchDidChangeLocationWithinPage(); - virtual void dispatchDidPushStateWithinPage(); - virtual void dispatchDidReplaceStateWithinPage(); - virtual void dispatchDidPopStateWithinPage(); - virtual void dispatchWillClose(); - virtual void dispatchDidReceiveIcon(); - virtual void dispatchDidStartProvisionalLoad(); - virtual void dispatchDidReceiveTitle(const String& title); - virtual void dispatchDidChangeIcons(); - virtual void dispatchDidCommitLoad(); - virtual void dispatchDidFailProvisionalLoad(const ResourceError&); - virtual void dispatchDidFailLoad(const WebCore::ResourceError&); - virtual void dispatchDidFinishDocumentLoad(); - virtual void dispatchDidFinishLoad(); - virtual void dispatchDidFirstLayout(); - virtual void dispatchDidFirstVisuallyNonEmptyLayout(); - - virtual WebCore::Frame* dispatchCreatePage(); - virtual void dispatchShow(); - - virtual void dispatchDecidePolicyForMIMEType(FramePolicyFunction function, const WebCore::String&, const WebCore::ResourceRequest&); - virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr, const WebCore::String&); - virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr); - virtual void cancelPolicyCheck(); - - virtual void dispatchUnableToImplementPolicy(const WebCore::ResourceError&); - - virtual void dispatchWillSendSubmitEvent(HTMLFormElement*) { } - virtual void dispatchWillSubmitForm(FramePolicyFunction, PassRefPtr); - - virtual void dispatchDidLoadMainResource(DocumentLoader*); - virtual void revertToProvisionalState(DocumentLoader*); - virtual void setMainDocumentError(DocumentLoader*, const ResourceError&); - - virtual void postProgressStartedNotification(); - virtual void postProgressEstimateChangedNotification(); - virtual void postProgressFinishedNotification(); - - virtual void setMainFrameDocumentReady(bool); - - virtual void startDownload(const WebCore::ResourceRequest&); - - virtual void willChangeTitle(DocumentLoader*); - virtual void didChangeTitle(DocumentLoader*); - - virtual void committedLoad(WebCore::DocumentLoader*, const char*, int); - virtual void finishedLoading(DocumentLoader*); - - virtual void updateGlobalHistory(); - virtual void updateGlobalHistoryRedirectLinks(); - virtual bool shouldGoToHistoryItem(HistoryItem*) const; - virtual void dispatchDidAddBackForwardItem(HistoryItem*) const; - virtual void dispatchDidRemoveBackForwardItem(HistoryItem*) const; - virtual void dispatchDidChangeBackForwardIndex() const; - virtual void didDisplayInsecureContent(); - virtual void didRunInsecureContent(SecurityOrigin*); - - virtual ResourceError cancelledError(const ResourceRequest&); - virtual ResourceError blockedError(const ResourceRequest&); - virtual ResourceError cannotShowURLError(const ResourceRequest&); - virtual ResourceError interruptForPolicyChangeError(const ResourceRequest&); - - virtual ResourceError cannotShowMIMETypeError(const ResourceResponse&); - virtual ResourceError fileDoesNotExistError(const ResourceResponse&); - virtual ResourceError pluginWillHandleLoadError(const ResourceResponse&); - - virtual bool shouldFallBack(const ResourceError&); - - virtual bool canHandleRequest(const WebCore::ResourceRequest&) const; - virtual bool canShowMIMEType(const String& MIMEType) const; - virtual bool representationExistsForURLScheme(const String& URLScheme) const; - virtual String generatedMIMETypeForURLScheme(const String& URLScheme) const; - - virtual void frameLoadCompleted(); - virtual void saveViewStateToItem(WebCore::HistoryItem*); - virtual void restoreViewState(); - virtual void provisionalLoadStarted(); - virtual void didFinishLoad(); - virtual void prepareForDataSourceReplacement(); - - virtual WTF::PassRefPtr createDocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&); - virtual void setTitle(const String& title, const KURL&); - - virtual String userAgent(const WebCore::KURL&); - - virtual void savePlatformDataToCachedFrame(WebCore::CachedFrame*); - virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*); - virtual void transitionToCommittedForNewPage(); - - virtual bool canCachePage() const; - virtual void download(WebCore::ResourceHandle*, const WebCore::ResourceRequest&, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&); - - virtual PassRefPtr createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, - const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) ; - virtual void didTransferChildFrameToNewDocument(); - virtual PassRefPtr createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector&, const Vector&, const String&, bool); - virtual void redirectDataToPlugin(Widget* pluginWidget); - - virtual PassRefPtr createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL, const Vector& paramNames, const Vector& paramValues); - - virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType); - virtual String overrideMediaType() const; - - virtual void dispatchDidClearWindowObjectInWorld(DOMWrapperWorld*); - virtual void documentElementAvailable(); - virtual void didPerformFirstNavigation() const; - - virtual void registerForIconNotification(bool); +class AuthenticationChallenge; +class DocumentLoader; +class Element; +class FormState; +class NavigationAction; +class String; +class ResourceLoader; + +struct LoadErrorResetToken; + +class FrameLoaderClientQt : public QObject, public FrameLoaderClient { + Q_OBJECT + + friend class ::QWebFrame; + void callPolicyFunction(FramePolicyFunction function, PolicyAction action); + void callErrorPageExtension(const ResourceError&); +signals: + void loadStarted(); + void loadProgress(int d); + void loadFinished(bool); + void titleChanged(const QString& title); + +public: + FrameLoaderClientQt(); + ~FrameLoaderClientQt(); + virtual void frameLoaderDestroyed(); + + void setFrame(QWebFrame* webFrame, Frame* frame); + QWebFrame* webFrame() const; + + virtual bool hasWebView() const; // mainly for assertions + + virtual void makeRepresentation(DocumentLoader*); + virtual void forceLayout(); + virtual void forceLayoutForNonHTML(); + + virtual void setCopiesOnScroll(); + + virtual void detachedFromParent2(); + virtual void detachedFromParent3(); + + virtual void assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader*, const WebCore::ResourceRequest&); + + virtual void dispatchWillSendRequest(WebCore::DocumentLoader*, unsigned long, WebCore::ResourceRequest&, const WebCore::ResourceResponse&); + virtual bool shouldUseCredentialStorage(DocumentLoader*, unsigned long identifier); + virtual void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&); + virtual void dispatchDidCancelAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&); + virtual void dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long, const WebCore::ResourceResponse&); + virtual void dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long, int); + virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long); + virtual void dispatchDidFailLoading(WebCore::DocumentLoader*, unsigned long, const WebCore::ResourceError&); + virtual bool dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int); + + virtual void dispatchDidHandleOnloadEvents(); + virtual void dispatchDidReceiveServerRedirectForProvisionalLoad(); + virtual void dispatchDidCancelClientRedirect(); + virtual void dispatchWillPerformClientRedirect(const KURL&, double interval, double fireDate); + virtual void dispatchDidChangeLocationWithinPage(); + virtual void dispatchDidPushStateWithinPage(); + virtual void dispatchDidReplaceStateWithinPage(); + virtual void dispatchDidPopStateWithinPage(); + virtual void dispatchWillClose(); + virtual void dispatchDidReceiveIcon(); + virtual void dispatchDidStartProvisionalLoad(); + virtual void dispatchDidReceiveTitle(const String& title); + virtual void dispatchDidChangeIcons(); + virtual void dispatchDidCommitLoad(); + virtual void dispatchDidFailProvisionalLoad(const ResourceError&); + virtual void dispatchDidFailLoad(const WebCore::ResourceError&); + virtual void dispatchDidFinishDocumentLoad(); + virtual void dispatchDidFinishLoad(); + virtual void dispatchDidFirstLayout(); + virtual void dispatchDidFirstVisuallyNonEmptyLayout(); + + virtual WebCore::Frame* dispatchCreatePage(); + virtual void dispatchShow(); + + virtual void dispatchDecidePolicyForMIMEType(FramePolicyFunction function, const WebCore::String&, const WebCore::ResourceRequest&); + virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr, const WebCore::String&); + virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr); + virtual void cancelPolicyCheck(); + + virtual void dispatchUnableToImplementPolicy(const WebCore::ResourceError&); + + virtual void dispatchWillSendSubmitEvent(HTMLFormElement*) { } + virtual void dispatchWillSubmitForm(FramePolicyFunction, PassRefPtr); + + virtual void dispatchDidLoadMainResource(DocumentLoader*); + virtual void revertToProvisionalState(DocumentLoader*); + virtual void setMainDocumentError(DocumentLoader*, const ResourceError&); + + virtual void postProgressStartedNotification(); + virtual void postProgressEstimateChangedNotification(); + virtual void postProgressFinishedNotification(); + + virtual void setMainFrameDocumentReady(bool); + + virtual void startDownload(const WebCore::ResourceRequest&); + + virtual void willChangeTitle(DocumentLoader*); + virtual void didChangeTitle(DocumentLoader*); + + virtual void committedLoad(WebCore::DocumentLoader*, const char*, int); + virtual void finishedLoading(DocumentLoader*); + + virtual void updateGlobalHistory(); + virtual void updateGlobalHistoryRedirectLinks(); + virtual bool shouldGoToHistoryItem(HistoryItem*) const; + virtual void dispatchDidAddBackForwardItem(HistoryItem*) const; + virtual void dispatchDidRemoveBackForwardItem(HistoryItem*) const; + virtual void dispatchDidChangeBackForwardIndex() const; + virtual void didDisplayInsecureContent(); + virtual void didRunInsecureContent(SecurityOrigin*); + + virtual ResourceError cancelledError(const ResourceRequest&); + virtual ResourceError blockedError(const ResourceRequest&); + virtual ResourceError cannotShowURLError(const ResourceRequest&); + virtual ResourceError interruptForPolicyChangeError(const ResourceRequest&); + + virtual ResourceError cannotShowMIMETypeError(const ResourceResponse&); + virtual ResourceError fileDoesNotExistError(const ResourceResponse&); + virtual ResourceError pluginWillHandleLoadError(const ResourceResponse&); + + virtual bool shouldFallBack(const ResourceError&); + + virtual bool canHandleRequest(const WebCore::ResourceRequest&) const; + virtual bool canShowMIMEType(const String& MIMEType) const; + virtual bool representationExistsForURLScheme(const String& URLScheme) const; + virtual String generatedMIMETypeForURLScheme(const String& URLScheme) const; + + virtual void frameLoadCompleted(); + virtual void saveViewStateToItem(WebCore::HistoryItem*); + virtual void restoreViewState(); + virtual void provisionalLoadStarted(); + virtual void didFinishLoad(); + virtual void prepareForDataSourceReplacement(); + + virtual WTF::PassRefPtr createDocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&); + virtual void setTitle(const String& title, const KURL&); + + virtual String userAgent(const WebCore::KURL&); + + virtual void savePlatformDataToCachedFrame(WebCore::CachedFrame*); + virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*); + virtual void transitionToCommittedForNewPage(); + + virtual bool canCachePage() const; + virtual void download(WebCore::ResourceHandle*, const WebCore::ResourceRequest&, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&); + + virtual PassRefPtr createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, + const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight); + virtual void didTransferChildFrameToNewDocument(); + virtual PassRefPtr createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector&, const Vector&, const String&, bool); + virtual void redirectDataToPlugin(Widget* pluginWidget); + + virtual PassRefPtr createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL, const Vector& paramNames, const Vector& paramValues); + + virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType); + virtual String overrideMediaType() const; + + virtual void dispatchDidClearWindowObjectInWorld(DOMWrapperWorld*); + virtual void documentElementAvailable(); + virtual void didPerformFirstNavigation() const; + + virtual void registerForIconNotification(bool); - QString chooseFile(const QString& oldFile); + QString chooseFile(const QString& oldFile); - static bool dumpFrameLoaderCallbacks; - static bool dumpResourceLoadCallbacks; - static QString dumpResourceLoadCallbacksPath; - static bool sendRequestReturnsNullOnRedirect; - static bool sendRequestReturnsNull; - static QStringList sendRequestClearHeaders; + static bool dumpFrameLoaderCallbacks; + static bool dumpResourceLoadCallbacks; + static QString dumpResourceLoadCallbacksPath; + static bool sendRequestReturnsNullOnRedirect; + static bool sendRequestReturnsNull; + static QStringList sendRequestClearHeaders; - private: - Frame *m_frame; - QWebFrame *m_webFrame; - ResourceResponse m_response; - bool m_firstData; +private: + Frame *m_frame; + QWebFrame *m_webFrame; + ResourceResponse m_response; + bool m_firstData; - // Plugin view to redirect data to - WebCore::PluginView* m_pluginView; - bool m_hasSentResponseToPlugin; + // Plugin view to redirect data to + WebCore::PluginView* m_pluginView; + bool m_hasSentResponseToPlugin; - ResourceError m_loadError; - }; + ResourceError m_loadError; +}; } diff --git a/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp index 725c5fb..fde0556 100644 --- a/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp @@ -31,19 +31,19 @@ #include "config.h" #include "InspectorClientQt.h" +#include "Frame.h" +#include "InspectorController.h" +#include "NotImplemented.h" +#include "Page.h" +#include "PlatformString.h" +#include "ScriptController.h" #include "qwebinspector.h" #include "qwebinspector_p.h" #include "qwebpage.h" #include "qwebpage_p.h" #include "qwebview.h" - -#include #include - -#include "InspectorController.h" -#include "NotImplemented.h" -#include "Page.h" -#include "PlatformString.h" +#include namespace WebCore { @@ -74,6 +74,7 @@ public: InspectorClientQt::InspectorClientQt(QWebPage* page) : m_inspectedWebPage(page) + , m_frontendWebPage(0) {} void InspectorClientQt::inspectorDestroyed() @@ -93,14 +94,23 @@ void InspectorClientQt::openInspectorFrontend(WebCore::InspectorController*) // Web inspector. This is used for SDK purposes. Please keep this hook // around and don't remove it. // https://bugs.webkit.org/show_bug.cgi?id=35340 - QUrl inspectorUrl = inspector->property("_q_inspectorUrl").toUrl(); + QUrl inspectorUrl; +#ifndef QT_NO_PROPERTIES + inspectorUrl = inspector->property("_q_inspectorUrl").toUrl(); +#endif if (!inspectorUrl.isValid()) inspectorUrl = QUrl("qrc:/webkit/inspector/inspector.html"); inspectorView->page()->mainFrame()->load(inspectorUrl); m_inspectedWebPage->d->inspectorFrontend = inspectorView; inspector->d->setFrontend(inspectorView); - inspectorView->page()->d->page->inspectorController()->setInspectorFrontendClient(new InspectorFrontendClientQt(m_inspectedWebPage, inspectorView)); + inspectorView->page()->d->page->inspectorController()->setInspectorFrontendClient(new InspectorFrontendClientQt(m_inspectedWebPage, inspectorView, this)); + m_frontendWebPage = inspectorPage; +} + +void InspectorClientQt::releaseFrontendPage() +{ + m_frontendWebPage = 0; } void InspectorClientQt::highlight(Node*) @@ -157,6 +167,30 @@ void InspectorClientQt::storeSetting(const String& key, const String& setting) #endif // QT_NO_SETTINGS } +bool InspectorClientQt::sendMessageToFrontend(const String& message) +{ + if (!m_frontendWebPage) + return false; + + Page* frontendPage = QWebPagePrivate::core(m_frontendWebPage); + if (!frontendPage) + return false; + + Frame* frame = frontendPage->mainFrame(); + if (!frame) + return false; + + ScriptController* scriptController = frame->script(); + if (!scriptController) + return false; + + String dispatchToFrontend("WebInspector.dispatchMessageToFrontend("); + dispatchToFrontend += message; + dispatchToFrontend += ");"; + scriptController->executeScript(dispatchToFrontend); + return true; +} + static String variantToSetting(const QVariant& qvariant) { String retVal; @@ -180,11 +214,12 @@ static QVariant settingToVariant(const String& setting) return retVal; } -InspectorFrontendClientQt::InspectorFrontendClientQt(QWebPage* inspectedWebPage, PassOwnPtr inspectorView) +InspectorFrontendClientQt::InspectorFrontendClientQt(QWebPage* inspectedWebPage, PassOwnPtr inspectorView, InspectorClientQt* inspectorClient) : InspectorFrontendClientLocal(inspectedWebPage->d->page->inspectorController(), inspectorView->page()->d->page) , m_inspectedWebPage(inspectedWebPage) , m_inspectorView(inspectorView) , m_destroyingInspectorView(false) + , m_inspectorClient(inspectorClient) { } @@ -222,6 +257,8 @@ void InspectorFrontendClientQt::closeWindow() #if ENABLE(INSPECTOR) m_inspectedWebPage->d->inspectorController()->disconnectFrontend(); #endif + m_inspectorClient->releaseFrontendPage(); + // Clear pointer before deleting WebView to avoid recursive calls to its destructor. delete m_inspectorView.release(); } diff --git a/WebKit/qt/WebCoreSupport/InspectorClientQt.h b/WebKit/qt/WebCoreSupport/InspectorClientQt.h index 4beadab..c996f55 100644 --- a/WebKit/qt/WebCoreSupport/InspectorClientQt.h +++ b/WebKit/qt/WebCoreSupport/InspectorClientQt.h @@ -58,13 +58,18 @@ public: virtual void populateSetting(const String& key, String* value); virtual void storeSetting(const String& key, const String& value); + virtual bool sendMessageToFrontend(const String&); + + void releaseFrontendPage(); + private: QWebPage* m_inspectedWebPage; + QWebPage* m_frontendWebPage; }; class InspectorFrontendClientQt : public InspectorFrontendClientLocal { public: - InspectorFrontendClientQt(QWebPage* inspectedWebPage, PassOwnPtr inspectorView); + InspectorFrontendClientQt(QWebPage* inspectedWebPage, PassOwnPtr inspectorView, InspectorClientQt* inspectorClient); virtual void frontendLoaded(); @@ -88,6 +93,7 @@ private: OwnPtr m_inspectorView; QString m_inspectedURL; bool m_destroyingInspectorView; + InspectorClientQt* m_inspectorClient; }; } diff --git a/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp b/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp index f76868d..8bde5c4 100644 --- a/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp @@ -32,106 +32,209 @@ #include "config.h" #include "NotificationPresenterClientQt.h" -#include "DumpRenderTreeSupportQt.h" #include "Document.h" +#include "DumpRenderTreeSupportQt.h" #include "EventNames.h" #include "KURL.h" +#include "QtPlatformPlugin.h" #include "SecurityOrigin.h" -#include "qwebframe.h" #include "qwebkitglobal.h" -#include "qwebpage.h" #include - #if ENABLE(NOTIFICATIONS) -using namespace WebCore; +namespace WebCore { + +const double notificationTimeout = 10.0; bool NotificationPresenterClientQt::dumpNotification = false; +NotificationPresenterClientQt* s_notificationPresenter = 0; + +NotificationPresenterClientQt* NotificationPresenterClientQt::notificationPresenter() +{ + if (s_notificationPresenter) + return s_notificationPresenter; + + s_notificationPresenter = new NotificationPresenterClientQt(); + return s_notificationPresenter; +} + NotificationIconWrapper::NotificationIconWrapper() + : m_closeTimer(this, &NotificationIconWrapper::close) { #ifndef QT_NO_SYSTEMTRAYICON m_notificationIcon = 0; #endif + m_presenter = 0; } NotificationIconWrapper::~NotificationIconWrapper() { -#ifndef QT_NO_SYSTEMTRAYICON - delete m_notificationIcon; -#endif } -NotificationPresenterClientQt::NotificationPresenterClientQt(QWebPage* page) : m_page(page) +void NotificationIconWrapper::close(Timer*) { + NotificationPresenterClientQt::notificationPresenter()->cancel(this); } -bool NotificationPresenterClientQt::show(Notification* notification) +const QString NotificationIconWrapper::title() const { - QHash ::Iterator end = m_notifications.end(); - QHash ::Iterator iter = m_notifications.begin(); + Notification* notification = NotificationPresenterClientQt::notificationPresenter()->notificationForWrapper(this); + if (notification) + return notification->contents().title(); + return QString(); +} - if (!notification->replaceId().isEmpty()) { - while (iter != end) { - Notification* existingNotification = iter.key(); - if (existingNotification->replaceId() == notification->replaceId() && existingNotification->url().protocol() == notification->url().protocol() && existingNotification->url().host() == notification->url().host()) - break; - iter++; - } - } else - iter = end; +const QString NotificationIconWrapper::message() const +{ + Notification* notification = NotificationPresenterClientQt::notificationPresenter()->notificationForWrapper(this); + if (notification) + return notification->contents().body(); + return QString(); +} - if (dumpNotification) { - if (iter != end) { - Notification* oldNotification = iter.key(); - printf("REPLACING NOTIFICATION %s\n", oldNotification->isHTML() ? QString(oldNotification->url().string()).toUtf8().constData() : QString(oldNotification->contents().title()).toUtf8().constData()); - } - if (notification->isHTML()) - printf("DESKTOP NOTIFICATION: contents at %s\n", QString(notification->url().string()).toUtf8().constData()); - else { - printf("DESKTOP NOTIFICATION:%s icon %s, title %s, text %s\n", - notification->dir() == "rtl" ? "(RTL)" : "", - QString(notification->contents().icon().string()).toUtf8().constData(), QString(notification->contents().title()).toUtf8().constData(), - QString(notification->contents().body()).toUtf8().constData()); - } +const QByteArray NotificationIconWrapper::iconData() const +{ + Notification* notification = NotificationPresenterClientQt::notificationPresenter()->notificationForWrapper(this); + QByteArray iconData; + if (notification) { + if (notification->iconData()) + iconData = QByteArray::fromRawData(notification->iconData()->data(), notification->iconData()->size()); } + return iconData; +} - if (iter != end) { - sendEvent(iter.key(), eventNames().closeEvent); - delete m_notifications.take(iter.key()); +NotificationPresenterClientQt::NotificationPresenterClientQt() : m_clientCount(0) +{ +} + +NotificationPresenterClientQt::~NotificationPresenterClientQt() +{ + while (!m_notifications.isEmpty()) { + NotificationsQueue::Iterator iter = m_notifications.begin(); + detachNotification(iter.key()); } +} + +void NotificationPresenterClientQt::removeClient() +{ + m_clientCount--; + if (!m_clientCount) { + s_notificationPresenter = 0; + delete this; + } +} + +void NotificationIconWrapper::notificationClosed() +{ + NotificationPresenterClientQt::notificationPresenter()->cancel(this); +} + +bool NotificationPresenterClientQt::show(Notification* notification) +{ + // FIXME: workers based notifications are not supported yet. + if (notification->scriptExecutionContext()->isWorkerContext()) + return false; + notification->setPendingActivity(notification); + if (!notification->replaceId().isEmpty()) + removeReplacedNotificationFromQueue(notification); + if (dumpNotification) + dumpShowText(notification); + QByteArray iconData; + if (notification->iconData()) + iconData = QByteArray::fromRawData(notification->iconData()->data(), notification->iconData()->size()); + displayNotification(notification, iconData); + notification->releaseIconData(); + return true; +} + +void NotificationPresenterClientQt::displayNotification(Notification* notification, const QByteArray& bytes) +{ NotificationIconWrapper* wrapper = new NotificationIconWrapper(); m_notifications.insert(notification, wrapper); + QString title; + QString message; + // FIXME: download & display HTML notifications + if (notification->isHTML()) + message = notification->url().string(); + else { + title = notification->contents().title(); + message = notification->contents().body(); + } + + if (m_platformPlugin.plugin() && m_platformPlugin.plugin()->supportsExtension(QWebKitPlatformPlugin::Notifications)) + wrapper->m_presenter = m_platformPlugin.createNotificationPresenter(); + + if (!wrapper->m_presenter) { +#ifndef QT_NO_SYSTEMTRAYICON + wrapper->m_closeTimer.startOneShot(notificationTimeout); + QPixmap pixmap; + if (bytes.length() && pixmap.loadFromData(bytes)) { + QIcon icon(pixmap); + wrapper->m_notificationIcon = new QSystemTrayIcon(icon); + } else + wrapper->m_notificationIcon = new QSystemTrayIcon(); +#endif + } + sendEvent(notification, "display"); + // Make sure the notification was not cancelled during handling the display event + if (m_notifications.find(notification) == m_notifications.end()) + return; + + if (wrapper->m_presenter) { + wrapper->connect(wrapper->m_presenter.get(), SIGNAL(notificationClosed()), wrapper, SLOT(notificationClosed()), Qt::QueuedConnection); + wrapper->m_presenter->showNotification(wrapper); + return; + } + #ifndef QT_NO_SYSTEMTRAYICON - wrapper->m_notificationIcon = new QSystemTrayIcon; wrapper->m_notificationIcon->show(); wrapper->m_notificationIcon->showMessage(notification->contents().title(), notification->contents().body()); #endif - return true; } void NotificationPresenterClientQt::cancel(Notification* notification) -{ - if (dumpNotification) { +{ + if (dumpNotification && notification->scriptExecutionContext()) { if (notification->isHTML()) printf("DESKTOP NOTIFICATION CLOSED: %s\n", QString(notification->url().string()).toUtf8().constData()); else printf("DESKTOP NOTIFICATION CLOSED: %s\n", QString(notification->contents().title()).toUtf8().constData()); } - QHash ::Iterator iter = m_notifications.find(notification); - if (iter != m_notifications.end()) - sendEvent(iter.key(), eventNames().closeEvent); + NotificationsQueue::Iterator iter = m_notifications.find(notification); + if (iter != m_notifications.end()) { + sendEvent(notification, eventNames().closeEvent); + detachNotification(notification); + } +} + +void NotificationPresenterClientQt::cancel(NotificationIconWrapper* wrapper) +{ + Notification* notification = notificationForWrapper(wrapper); + if (notification) + cancel(notification); +} + +Notification* NotificationPresenterClientQt::notificationForWrapper(const NotificationIconWrapper* wrapper) const +{ + NotificationsQueue::ConstIterator end = m_notifications.end(); + NotificationsQueue::ConstIterator iter = m_notifications.begin(); + while (iter != end && iter.value() != wrapper) + iter++; + if (iter != end) + return iter.key(); + return 0; } void NotificationPresenterClientQt::notificationObjectDestroyed(Notification* notification) { // Called from ~Notification(), Remove the entry from the notifications list and delete the icon. - QHash ::Iterator iter = m_notifications.find(notification); + NotificationsQueue::Iterator iter = m_notifications.find(notification); if (iter != m_notifications.end()) delete m_notifications.take(notification); } @@ -139,7 +242,7 @@ void NotificationPresenterClientQt::notificationObjectDestroyed(Notification* no void NotificationPresenterClientQt::requestPermission(SecurityOrigin* origin, PassRefPtr callback) { if (dumpNotification) - printf("DESKTOP NOTIFICATION PERMISSION REQUESTED: %s\n", QString(origin->toString()).toUtf8().constData()); + printf("DESKTOP NOTIFICATION PERMISSION REQUESTED: %s\n", QString(origin->toString()).toUtf8().constData()); QString originString = origin->toString(); QHash > >::iterator iter = m_pendingPermissionRequests.find(originString); @@ -151,7 +254,7 @@ void NotificationPresenterClientQt::requestPermission(SecurityOrigin* origin, Pa callbacks.append(cb); m_pendingPermissionRequests.insert(originString, callbacks); if (requestPermissionFunction) - requestPermissionFunction(m_receiver, m_page, originString); + requestPermissionFunction(m_receiver, originString); } } @@ -184,19 +287,59 @@ void NotificationPresenterClientQt::allowNotificationForOrigin(const QString& or } } -void NotificationPresenterClientQt::clearNotificationsList() +void NotificationPresenterClientQt::sendEvent(Notification* notification, const AtomicString& eventName) { - m_pendingPermissionRequests.clear(); - while (!m_notifications.isEmpty()) { - QHash ::Iterator iter = m_notifications.begin(); - delete m_notifications.take(iter.key()); + if (notification->scriptExecutionContext()) + notification->dispatchEvent(Event::create(eventName, false, true)); +} + +void NotificationPresenterClientQt::removeReplacedNotificationFromQueue(Notification* notification) +{ + Notification* oldNotification = 0; + NotificationsQueue::Iterator end = m_notifications.end(); + NotificationsQueue::Iterator iter = m_notifications.begin(); + + while (iter != end) { + Notification* existingNotification = iter.key(); + if (existingNotification->replaceId() == notification->replaceId() && existingNotification->url().protocol() == notification->url().protocol() && existingNotification->url().host() == notification->url().host()) { + oldNotification = iter.key(); + break; + } + iter++; + } + + if (oldNotification) { + if (dumpNotification) + dumpReplacedIdText(oldNotification); + sendEvent(oldNotification, eventNames().closeEvent); + detachNotification(oldNotification); } } -void NotificationPresenterClientQt::sendEvent(Notification* notification, const AtomicString& eventName) +void NotificationPresenterClientQt::detachNotification(Notification* notification) { - RefPtr event = Event::create(eventName, false, true); - notification->dispatchEvent(event.release()); + delete m_notifications.take(notification); + notification->detachPresenter(); + notification->unsetPendingActivity(notification); } +void NotificationPresenterClientQt::dumpReplacedIdText(Notification* notification) +{ + if (notification) + printf("REPLACING NOTIFICATION %s\n", notification->isHTML() ? QString(notification->url().string()).toUtf8().constData() : QString(notification->contents().title()).toUtf8().constData()); +} + +void NotificationPresenterClientQt::dumpShowText(Notification* notification) +{ + if (notification->isHTML()) + printf("DESKTOP NOTIFICATION: contents at %s\n", QString(notification->url().string()).toUtf8().constData()); + else { + printf("DESKTOP NOTIFICATION:%s icon %s, title %s, text %s\n", + notification->dir() == "rtl" ? "(RTL)" : "", + QString(notification->contents().icon().string()).toUtf8().constData(), QString(notification->contents().title()).toUtf8().constData(), + QString(notification->contents().body()).toUtf8().constData()); + } +} + +} #endif // ENABLE(NOTIFICATIONS) diff --git a/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h b/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h index c949513..1630cd9 100644 --- a/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h +++ b/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h @@ -34,30 +34,51 @@ #include "Notification.h" #include "NotificationPresenter.h" +#include "QtPlatformPlugin.h" +#include "Timer.h" + +#include "qwebkitplatformplugin.h" #include #include - -#if ENABLE(NOTIFICATIONS) -class QWebPage; - namespace WebCore { + class Document; class KURL; -struct NotificationIconWrapper { +class NotificationIconWrapper : public QObject, public QWebNotificationData { + Q_OBJECT +public: NotificationIconWrapper(); ~NotificationIconWrapper(); + + void close(); + void close(Timer*); + const QString title() const; + const QString message() const; + const QByteArray iconData() const; + +public Q_SLOTS: + void notificationClosed(); + +public: #ifndef QT_NO_SYSTEMTRAYICON - QSystemTrayIcon* m_notificationIcon; + OwnPtr m_notificationIcon; #endif + + OwnPtr m_presenter; + Timer m_closeTimer; }; +#if ENABLE(NOTIFICATIONS) + +typedef QHash NotificationsQueue; + class NotificationPresenterClientQt : public NotificationPresenter { public: - NotificationPresenterClientQt(QWebPage*); - ~NotificationPresenterClientQt() {} + NotificationPresenterClientQt(); + ~NotificationPresenterClientQt(); /* WebCore::NotificationPresenter interface */ virtual bool show(Notification*); @@ -66,22 +87,37 @@ public: virtual void requestPermission(SecurityOrigin*, PassRefPtr); virtual NotificationPresenter::Permission checkPermission(const KURL&); + void cancel(NotificationIconWrapper*); + void allowNotificationForOrigin(const QString& origin); - void clearNotificationsList(); static bool dumpNotification; void setReceiver(QObject* receiver) { m_receiver = receiver; } + void addClient() { m_clientCount++; } + void removeClient(); + static NotificationPresenterClientQt* notificationPresenter(); + + Notification* notificationForWrapper(const NotificationIconWrapper*) const; + private: void sendEvent(Notification*, const AtomicString& eventName); - QWebPage* m_page; - QMultiHash > > m_pendingPermissionRequests; - QHash m_notifications; + void displayNotification(Notification*, const QByteArray&); + void removeReplacedNotificationFromQueue(Notification*); + void detachNotification(Notification*); + void dumpReplacedIdText(Notification*); + void dumpShowText(Notification*); + + int m_clientCount; + QHash > > m_pendingPermissionRequests; + NotificationsQueue m_notifications; QObject* m_receiver; + QtPlatformPlugin m_platformPlugin; }; -} #endif -#endif +} + +#endif diff --git a/WebKit/qt/WebCoreSupport/PageClientQt.h b/WebKit/qt/WebCoreSupport/PageClientQt.h index 6dab4e1..818c67a 100644 --- a/WebKit/qt/WebCoreSupport/PageClientQt.h +++ b/WebKit/qt/WebCoreSupport/PageClientQt.h @@ -24,12 +24,12 @@ #include "FrameView.h" #include "GraphicsContext.h" #include "IntRect.h" +#include "QWebPageClient.h" +#include "TiledBackingStore.h" #include "qwebframe.h" #include "qwebframe_p.h" #include "qwebpage.h" #include "qwebpage_p.h" -#include "QWebPageClient.h" -#include "TiledBackingStore.h" #include #include diff --git a/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp b/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp index a097bf7..5e7e6d1 100644 --- a/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp +++ b/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp @@ -85,45 +85,62 @@ void SelectInputMethodWrapper::didHide() // QtPlatformPlugin -static QWebKitPlatformPlugin* getPluginObject() +bool QtPlatformPlugin::load(const QString& file) +{ + m_loader.setFileName(file); + if (!m_loader.load()) + return false; + + QObject* obj = m_loader.instance(); + if (obj) { + m_plugin = qobject_cast(obj); + if (m_plugin) + return true; + } + + m_loader.unload(); + return false; +} + +bool QtPlatformPlugin::load() { const QLatin1String suffix("/webkit/"); const QStringList paths = QCoreApplication::libraryPaths(); - QObject* obj = 0; - for (int i = 0; !obj && i < paths.count(); ++i) { + + for (int i = 0; i < paths.count(); ++i) { const QDir dir(paths[i] + suffix); if (!dir.exists()) continue; const QStringList files = dir.entryList(QDir::Files); - for (int i = 0; i < files.count(); ++i) { - QPluginLoader pluginLoader(dir.absoluteFilePath(files.at(i))); - if (!pluginLoader.load()) - continue; - obj = pluginLoader.instance(); - if (obj) { - QWebKitPlatformPlugin* result = qobject_cast(obj); - if (result) - return result; - delete obj; - } - pluginLoader.unload(); + for (int j = 0; j < files.count(); ++j) { + if (load(dir.absoluteFilePath(files.at(j)))) + return true; } } - return 0; + return false; } QtPlatformPlugin::~QtPlatformPlugin() { - delete m_plugin; + m_loader.unload(); } QWebKitPlatformPlugin* QtPlatformPlugin::plugin() { if (m_loaded) return m_plugin; - m_loaded = true; - m_plugin = getPluginObject(); + + // Plugin path is stored in a static variable to avoid searching for the plugin + // more then once. + static QString pluginPath; + + if (pluginPath.isNull()) { + if (load()) + pluginPath = m_loader.fileName(); + } else + load(pluginPath); + return m_plugin; } @@ -140,4 +157,13 @@ QtAbstractWebPopup* QtPlatformPlugin::createSelectInputMethod() return new SelectInputMethodWrapper(selector); } + +QWebNotificationPresenter* QtPlatformPlugin::createNotificationPresenter() +{ + QWebKitPlatformPlugin* p = plugin(); + if (!p) + return 0; + return p->createNotificationPresenter(); +} + } diff --git a/WebKit/qt/WebCoreSupport/QtPlatformPlugin.h b/WebKit/qt/WebCoreSupport/QtPlatformPlugin.h index 9b73079..ff10d58 100644 --- a/WebKit/qt/WebCoreSupport/QtPlatformPlugin.h +++ b/WebKit/qt/WebCoreSupport/QtPlatformPlugin.h @@ -23,9 +23,11 @@ #include "QtAbstractWebPopup.h" #include +#include class QWebSelectMethod; class QWebKitPlatformPlugin; +class QWebNotificationPresenter; namespace WebCore { @@ -51,12 +53,16 @@ public: ~QtPlatformPlugin(); QtAbstractWebPopup* createSelectInputMethod(); + QWebNotificationPresenter* createNotificationPresenter(); + + QWebKitPlatformPlugin* plugin(); private: bool m_loaded; QWebKitPlatformPlugin* m_plugin; - - QWebKitPlatformPlugin* plugin(); + QPluginLoader m_loader; + bool load(); + bool load(const QString& file); }; } diff --git a/WebKit/qt/docs/qtwebkit-bridge.qdoc b/WebKit/qt/docs/qtwebkit-bridge.qdoc new file mode 100644 index 0000000..fa93293 --- /dev/null +++ b/WebKit/qt/docs/qtwebkit-bridge.qdoc @@ -0,0 +1,427 @@ +/*! + \inmodule QtWebKit + \page qtwebkit-bridge.html + \title The QtWebKit Bridge + \contentspage QtWebKit + \section1 Overview + \section2 The technology + + The QtWebKit bridge is a mechanism that extends WebKit's JavaScript environment to access native + objects that are represented as \l{QObject}s. It takes advantage of the \l{QObject} introspection, + a part of the \l{Qt Object Model}, which makes it easy to integrate with the dynamic JavaScript environment, + for example \l{QObject} properties map directly to JavaScript properties. + + For example, both JavaScript and QObjects have properties: a construct that represent a getter/setter + pair under one name. + + \section2 Use Cases + + There are two main use cases for the QtWebKit bridge. Web content in a native application, and Thin Clients. + + \section3 Web Content in a Native Application + + This is a common use case in classic Qt application, and a design pattern used by several modern + applications. For example, an application that contains a media-player, playlist manager, and music store. + The playlist manager is usually best authored as a classic desktop application, + with the native-looking robust \l{QWidget}s helping with producing that application. + The media-player control, which usually looks custom, can be written using \l{The Graphics View framework} + or with in a declarative way with \l{QtDeclarative}. The music store, which shows dynamic content + from the internet and gets modified rapidly, is best authored in HTML and maintained on the server. + + With the QtWebKit bridge, that music store component can interact with native parts of the application, + for example, if a file needs to be saved to a specific location. + + \section3 Thin Client + + Another use case is using Qt as a native backend to a full web application, + referred to here as a thin client. In this use-case, the entire UI is driven by + HTML, JavaScript and CSS, and native Qt-based components are used to allow that application + access to native features not usually exposed to the web, or to enable helper components that + are best written with C++. + + An example for such a client is a UI for a video-on-demand service on a TV. The entire content and + UI can be kept on the server, served dynamically through HTTP and rendered with WebKit, with additional + native components for accessing hardware-specific features like extracting the list of images + out of the video. + + \section2 Difference from Other Bridge Technologies + + Of course QtWebKit is not the only bridge technology out there. NPAPI, for example, + is a long-time standard or web-native bridging. Due to Qt's meta-object system, full applications + built partially with web-technologies are much easier to develop. NPAPI, however, is more geared + towards cross-browser plugins, due to it being an accepted standard. + + When developing a plugin for a browser, NPAPI is recommended. When developing a full application + that utilizes HTML-rendering, the QtWebKit bridge is recommended. + + \section2 Relationship with QtScript + + The QtWebKit bridge is similar to \l{QtScript}, especially to some of the features described in the + \l{Making Applications Scriptable} page. However, as of Qt 4.7, full QtScript API is not supported for web applications. + That is planned as an enhancement for future versions. You might notice that some of the features + described here are an exact copy of the ones described in the \l{Making Applications Scriptable} page. That is because + the QtWebKit bridge is a subset of that functionality, and this page tries to capture the full + capabilities available through the QtWebKit bridge specifically. + + \section1 Accessing QObjects + + \section2 Creating the link via QWebFrame + + By default, no QObjects are accessible through the web environment, for security reasons. + To enable web content access for a native QObject, the application must explicitly grant it access, + using the following call: + + \snippet webkitsnippets/qtwebkit_bridge_snippets.cpp 0 + + See \l{QWebFrame::addToJavaScriptWindowObject()} for more information. + + \section2 Using Signals and Slots + + The QtWebKit bridge adapts Qt's central \l{Signals and Slots} feature for + scripting. There are three principal ways to use signals and slots + with the QtWebKit bridge: + + \list + \i \bold{Hybrid C++/script}: C++ application code connects a + signal to a script function. For example, the script function can be + a function that the user has typed in, or one that you have read from a + file. This approach is useful if you have a QObject but don't want + to expose the object itself to the scripting environment; you just + want a script to be able to define how a signal should be reacted + to, and leave it up to the C++ side of your application to establish + the connection. + + \i \bold{Hybrid script/C++}: A script can connect signals and slots + to establish connections between pre-defined objects that the + application exposes to the scripting environment. In this scenario, + the slots themselves are still written in C++, but the definition of + the connections is fully dynamic (script-defined). + + \i \bold{Purely script-defined}: A script can both define signal + handler functions (effectively "slots written in JavaScript"), + \e{and} set up the connections that utilize those handlers. For + example, a script can define a function that will handle the + QLineEdit::returnPressed() signal, and then connect that signal to the + script function. + \endlist + + Note that QtScript functions such as qScriptConnect are unavilable in the web environment. + + \section3 Signal to Function Connections + + \snippet webkitsnippets/qtwebkit_bridge_snippets.cpp 6 + + In this form of connection, the argument to \c{connect()} is the + function to connect to the signal. + + \snippet webkitsnippets/qtwebkit_bridge_snippets.cpp 7 + + The argument can be a JavaScript function, as in the above + example, or it can be a QObject slot, as in + the following example: + + \snippet webkitsnippets/qtwebkit_bridge_snippets.cpp 8 + + When the argument is a QObject slot, the argument types of the + signal and slot do not necessarily have to be compatible; + If necessary, the QtWebKit bridge will, perform conversion of the signal + arguments to match the argument types of the slot. + + To disconnect from a signal, you invoke the signal's + \c{disconnect()} function, passing the function to disconnect + as argument: + + \snippet webkitsnippets/qtwebkit_bridge_snippets.cpp 9 + + When a script function is invoked in response to a signal, the + \c this object will be the Global Object. + + \section3 Signal to Member Function Connections + + \snippet webkitsnippets/qtwebkit_bridge_snippets.cpp 10 + + In this form of the \c{connect()} function, the first argument + is the object that will be bound to the variable, \c this, when + the function specified using the second argument is invoked. + + If you have a push button in a form, you typically want to do + something involving the form in response to the button's + \c{clicked} signal; passing the form as the \c this object + makes sense in such a case. + + \snippet webkitsnippets/qtwebkit_bridge_snippets.cpp 11 + + To disconnect from the signal, pass the same arguments to \c{disconnect()}: + + \snippet webkitsnippets/qtwebkit_bridge_snippets.cpp 12 + + \section3 Signal to Named Member Function Connections + + \snippet webkitsnippets/qtwebkit_bridge_snippets.cpp 14 + + This form of the \c{connect()} function requires that the first argument is + the object that will be bound to the variable \c{this} when a function is + invoked in response to the signal. The second argument specifies the + name of a function that is connected to the signal, and this refers to a + member function of the object passed as the first argument (thisObject + in the above scheme). + + Note that the function is resolved when the connection is made, not + when the signal is emitted. + + \snippet webkitsnippets/qtwebkit_bridge_snippets.cpp 15 + + To disconnect from the signal, pass the same arguments to \c{disconnect()}: + + \snippet webkitsnippets/qtwebkit_bridge_snippets.cpp 17 + + \section3 Error Handling + + When \c{connect()} or \c{disconnect()} succeeds, the function will + return \c{undefined}; otherwise, it will throw a script exception. + You can obtain an error message from the resulting \c{Error} object. + Example: + + \snippet webkitsnippets/qtwebkit_bridge_snippets.cpp 18 + + \section3 Emitting Signals from Scripts + + To emit a signal from script code, you simply invoke the signal + function, passing the relevant arguments: + + \snippet webkitsnippets/qtwebkit_bridge_snippets.cpp 19 + + It is currently not possible to define a new signal in a script; + i.e., all signals must be defined by C++ classes. + + \section3 Overloaded Signals and Slots + + When a signal or slot is overloaded, the QtWebKit bridge will attempt to + pick the right overload based on the actual types of the QScriptValue arguments + involved in the function invocation. For example, if your class has slots + \c{myOverloadedSlot(int)} and \c{myOverloadedSlot(QString)}, the following + script code will behave reasonably: + + \snippet webkitsnippets/qtwebkit_bridge_snippets.cpp 20 + + You can specify a particular overload by using array-style property access + with the \l{QMetaObject::normalizedSignature()}{normalized signature} of + the C++ function as the property name: + + \snippet webkitsnippets/qtwebkit_bridge_snippets.cpp 21 + + If the overloads have different number of arguments, the QtWebKit bridge will + pick the overload with the argument count that best matches the + actual number of arguments passed to the slot. + + For overloaded signals, JavaScript will throw an error if you try to connect + to the signal by name; you have to refer to the signal with the full + normalized signature of the particular overload you want to connect to. + + \section3 Invokable Methods + + Both slots and signals are invokable from script by default. In addition, it's also + possible to define a method that's invokable from script without it being a signal or a slot. + This is especially useful for functions with return types, as slots normally do not return anything + (it would be meaningless to return values from a slot, as the connected signals don't handle the returned data). + To make a non-slot method invokable, simply add the Q_INVOKABLE macro before its definition: + + \snippet webkitsnippets/qtwebkit_bridge_snippets.cpp 22 + + \section2 Accessing Properties + + The properties of the QObject are available as properties + of the corresponding JavaScript object. When you manipulate + a property in script code, the C++ get/set method for that + property will automatically be invoked. For example, if your + C++ class has a property declared as follows: + + \snippet webkitsnippets/qtwebkit_bridge_snippets.cpp 23 + + then script code can do things like the following: + + \snippet webkitsnippets/qtwebkit_bridge_snippets.cpp 24 + + \section2 Accessing Child QObjects + + Every named child of the QObject (that is, for which + QObject::objectName() is not an empty string) is by default available as + a property of the JavaScript wrapper object. For example, + if you have a QDialog with a child widget whose \c{objectName} property is + \c{"okButton"}, you can access this object in script code through + the expression + + \snippet webkitsnippets/qtwebkit_bridge_snippets.cpp 25 + + Since \c{objectName} is itself a Q_PROPERTY, you can manipulate + the name in script code to, for example, rename an object: + + \snippet webkitsnippets/qtwebkit_bridge_snippets.cpp 26 + + \section2 Data types + + When calling slots, receiving signals or accessing properties, usually some payload is involved. + For example, a property "text" might return a \l{QString} parameter. + The QtWebKit bridge does the job of converting between a given JavaScript data-type, and the + expected or given Qt type. Each Qt type has a coresponding set of rules of how JavaScript treats it. + + The data type conversions are also applicable for the data returned from non-void invokable methods. + + \section3 Numbers + + All Qt numeric data types are converted to or from a JavaScript number. These include int, short, float, + double, and the porable Qt types (qreal, qint etc). A special case is \l{QChar}; + If a slot expects a QChar, the QtWebKit bridge would use the unicode value in case of a number, + or the first character in a string. + + Note that non-standard (typedefed) number types are not automatically converted to + or from a JavaScript number - it's advised to use standard number types for signal, slots + and properties. + + When a non-number is passed as an argument to a method or property that expects a number, + the appropriate JavaScript conversion function (parseInt / parseFloat) would be used. + + \section3 Strings + + When JavaScript accesses methods or properties that expect a \l{QString}, the QtWebKit bridge + will automatically convert the value to a string (if it is not already a string), using the + built-in JavaScript toString method. + + When a QString is passed to JavaScript from a signal or a property, The QtWebKit bridge will + convert it into a JavaScript string. + + \section3 Date & Time + + Both \l{QDate}, \l{QTime} and \l{QDateTime} are automatically translated to or from the JavaScript + Date object. If a number were passed as an argument to a method that expects one of the date/time + types, the QtWebKit bridge would treat it as a timestamp. If a sting is passed, QtWebKit would + try different Qt date parsing functions to find the right one. + + \section3 Regular Expressions + + The QtWebKit bridge would automatically convert JavaScript RegEx object to a \l{QRegExp}. + If a string is passed to a method expecting a \l{QRegExp}, the string would be converted + to that \l{QRegExp}. + + \section3 Lists + + The QtWebKit bridge treats several types of lists in a special way: \l{QVariantList}, \l{QStringList}, + \l{QObjectList} and \l{QList}. When a slot or property expects one of those list types, + the QtWebKit bridge would try to convert a JavaScript array into that type, converting each of + the array's elements to the single-element type of the list. + + The most useful type of list is perhaps \l{QVariantList}, which can be converted to from any + JavaScript array. + + \section3 Compound (JSON) objects + + JavaScript compound objects, also known as JSON objects, are variables that hold a list + of key-value pairs, where all the keys are strings and the values can have any type. + This translates very well to \l{QVariantMap}, which is nothing more than a \l{QMap} of \l{QString} + to \l{QVariant}. + + The seamless conversion between JSON objects and \l{QVariantMap} allows for a very convenient + way of passing arbitrary structured data between C++ and the JavaScript environment. The native \l{QObject} has + to make sure that compound values are converted to \l{QVariantMap}s and \l{QVariantList}s, and JavaScript is + guaranteed to receive them in a meaningful way. + + Note that types that are not supported by JSON, such as JavaScript functions and getters/setters, + are not converted. + + \section3 QVariants + + When a slot or property accepts a \l{QVariant}, the QtWebKit bridge would create a \l{QVariant} that best + matches the argument passed by JavaScript. A string, for example, would become a \l{QVariant} holding a \l{QString}, + a normal JSON object would become a \l{QVariantMap}, and a JavaScript array would become a \l{QVariantList}. + + Using \l{QVariant}s generously in C++ in that way makes C++ programming feel a bit more like JavaScript programming, + as it adds another level of indirection. Passing \l{QVariant}s around like this q is very flexible, as the program can figure out + the type of argument in runtime just like JavaScript would do, but it also takes away from the type-safety and robust + nature of C++. It's recommended to use \l{QVariant}s only for convenience high-level functions, and to keep most of your + \l{QObject}s somewhat type-safe. + + \section3 QObjects + + A pointer to a \l{QObject} or a \l{QWidget} can be passed as payload in signals, slots and properties. That object + can then be used like an object that's exposed directly; i.e. its slots can be invoked, its signals connected to etc. + However, this functionality is fairly limited - the type used has to be \l{QObject}* or \l{QWidget}*. If the type + specified is a pointer to a non-\l{QWidget} subclass of \l{QObject}, the QtWebKit bridge would not recognize it to be + a \l{QObject}. + + In general its advised to use care when passing \l{QObject}s as arguments, as those objects don't become owned by + the JavaScript engine; That means that the application developer has to be extra careful not to try to access + \l{QObject}s that have already been deleted by the native environment. + + \section3 Pixmaps and Images + + \since 4.7 + + The QtWebKit bridge handles \l{QPixmap}s and \l{QImage}s in a special way. Since QtWebKit stores \l{QPixmap}s to + represent HTML images, \l{QPixmap}s coming from the native environment can be used directly inside WebKit. + A \l{QImage} or a \l{QPixmap} coming from the Qt environment would convert to an intermediate JavaScript object, + that can be represented like this: + + \snippet webkitsnippets/qtwebkit_bridge_snippets.cpp 1 + + The JavaScript environment can then use the pixmap it gets from Qt and display it inside the HTML environment, + by assigning it to an existing element using assignToHTMLImageElement. It can also use the toDataURL() function, + which allows using the pixmap as the src attribute of an image or as a background-image url. Note that the toDataURL() + function is costly and should be used with caution. + + Example code: + + C++: + \snippet webkitsnippets/qtwebkit_bridge_snippets.cpp 2 + + HTML: + \snippet webkitsnippets/qtwebkit_bridge_snippets.cpp 3 + + When a Qt object expects a \l{QImage} or a \l{QPixmap} as input, and the argument passed is an HTML image element, + the QtWebKit bridge would convert the pixmap assigned to that image element into a \l{QPixmap} or a \l{QImage}. + + \since 4.7 + + \section3 QWebElement + + A signal, slot or property that expects or returns a \l{QWebElement} can work seamlessly with JavaScript references + to DOM elements. The JavaScript environment can select DOM elements, keep them in variables, then pass them to Qt as + a \l{QWebElement}, and receive them back. Example: + + C++: + \snippet webkitsnippets/qtwebkit_bridge_snippets.cpp 4 + + HTML: + \snippet webkitsnippets/qtwebkit_bridge_snippets.cpp 5 + + This is specifically useful to create custom renderers or extensions to the web environment. Instead of forcing Qt + to select the element, the web environment already selects the element and then send the selected element directly to Qt. + + Note that \l{QWebElement}s are not thread safe - an object handling them has to live in the UI thread. + + \section1 Architecture issues + + \section2 Limiting the Scope of the Hybrid Layer + + When using QtWebKit's hybrid features, it is a common pitfall to make the API exposed to JavaScript very rich and + use all its features. This, however, leads to complexity and can create bugs that are hard to trace. + Instead, it is advisable to keep the hybrid layer small and manageable: create a gate only when + there's an actual need for it, i.e. there's a new native enabler that requires a direct interface + to the application layer. Sometimes new functionality is better handled internally in the native layer + or in the web layer; simplicity is your friend. + + This usually becomes more apparent when the hybrid layer can create or destroy objects, or uses + signals slots or properties with a \l{QObject}* argument. It is advised to be very careful and to treat + an exposed \l{QObject} as a system - with careful attention to memory management and object ownership. + + \section2 Internet Security + + When exposing native object to an open web environment, it is importwhichant to understand the security + implications. Think whether the exposed object enables the web environment access to things that + shouldn't be open, and whether the web content loaded by that web page comes from a trusted. In general, when + exposing native QObjects that give the web environment access to private information or to functionality + that's potentially harmful to the client, such exposure should be balanced by limiting the web page's + access to trusted URLs only with HTTPS, and by utilizing other measures as part of a security strategy. + + + +*/ diff --git a/WebKit/qt/docs/qtwebkit.qdoc b/WebKit/qt/docs/qtwebkit.qdoc index c6dd550..d3f5502 100644 --- a/WebKit/qt/docs/qtwebkit.qdoc +++ b/WebKit/qt/docs/qtwebkit.qdoc @@ -20,8 +20,9 @@ scripted with JavaScript. A bridge between the JavaScript execution environment and the Qt object - model makes it possible for custom QObjects to be scripted. Integration - with the Qt networking module enables Web pages to be transparently loaded + model makes it possible for custom QObjects to be scripted. For detailed + documentation see \l{The QtWebkit Bridge}. + Integration with the Qt networking module enables Web pages to be transparently loaded from Web servers, the local file system or even the Qt resource system. In addition to providing pure rendering features, HTML documents can be diff --git a/WebKit/qt/docs/webkitsnippets/qtwebkit_bridge_snippets.cpp b/WebKit/qt/docs/webkitsnippets/qtwebkit_bridge_snippets.cpp new file mode 100644 index 0000000..62eeeca --- /dev/null +++ b/WebKit/qt/docs/webkitsnippets/qtwebkit_bridge_snippets.cpp @@ -0,0 +1,177 @@ + +void wrapInFunction() +{ + + //! [0] + // ... + QWebFrame *frame = myWebPage->mainFrame(); + frame->addToJavaScriptWindowObject("someNameForMyObject", myObject); + // ... + //! [0] +#if 0 + //! [1] + { + width: ..., + height: ..., + toDataURL: function() { ... }, + assignToHTMLImageElement: function(element) { ... } + } + //! [1] +#endif + //! [2] + class MyObject : QObject { + Q_OBJECT + Q_PROPERTY(QPixmap myPixmap READ getPixmap) + + public: + QPixmap getPixmap() const; + }; + + /* ... */ + + MyObject myObject; + myWebPage.mainFrame()->addToJavaScriptWindowObject("myObject", &myObject); + + //! [2] +#if 0 + //! [3] + + + + + + + + + //! [3] +#endif + //! [4] + class MyObject : QObject { + Q_OBJECT + + public slots: + void doSomethingWithWebElement(const QWebElement&); + }; + + /* ... */ + + MyObject myObject; + myWebPage.mainFrame()->addToJavaScriptWindowObject("myObject", &myObject); + + //! [4] +#if 0 + //! [5] + + + + + + Text + + + //! [5] + //! [6] + connect(function); + //! [6] + //! [7] + function myInterestingScriptFunction() { ... } + ... + myQObject.somethingChanged.connect(myInterestingScriptFunction); + //! [7] + //! [8] + myQObject.somethingChanged.connect(myOtherQObject.doSomething); + //! [8] + //! [9] + myQObject.somethingChanged.disconnect(myInterestingFunction); + myQObject.somethingChanged.disconnect(myOtherQObject.doSomething); + //! [9] + //! [10] + connect(thisObject, function) + //! [10] + //! [11] + var obj = { x: 123 }; + var fun = function() { print(this.x); }; + myQObject.somethingChanged.connect(obj, fun); + //! [11] + //! [12] + myQObject.somethingChanged.disconnect(obj, fun); + //! [12] + //! [13] + connect(function); + //! [13] + //! [14] + connect(thisObject, functionName) + //! [14] + //! [15] + var obj = { x: 123, fun: function() { print(this.x); } }; + myQObject.somethingChanged.connect(obj, "fun"); + //! [15] + //! [16] + connect(function); + //! [16] + //! [17] + myQObject.somethingChanged.disconnect(obj, "fun"); + //! [17] + //! [18] + try { + myQObject.somethingChanged.connect(myQObject, "slotThatDoesntExist"); + } catch (e) { + print(e); + } + //! [18] + //! [19] + myQObject.somethingChanged("hello"); + //! [19] + //! [20] + myQObject.myOverloadedSlot(10); // will call the int overload + myQObject.myOverloadedSlot("10"); // will call the QString overload + //! [20] + //! [21] + myQObject['myOverloadedSlot(int)']("10"); // call int overload; the argument is converted to an int + myQObject['myOverloadedSlot(QString)'](10); // call QString overload; the argument is converted to a string + //! [21] + //! [22] + class MyObject : public QObject + { + Q_OBJECT + + public: + Q_INVOKABLE void thisMethodIsInvokableInQtScript(); + void thisMethodIsNotInvokableInQtScript(); + + ... + }; + //! [22] + //! [23] + Q_PROPERTY(bool enabled READ enabled WRITE setEnabled) + //! [23] + //! [24] + myQObject.enabled = true; + + ... + + myQObject.enabled = !myQObject.enabled; + //! [24] + //! [25] + myQObject.enabled = true; + + ... + + myQObject.enabled = !myQObject.enabled; + //! [25] + //! [26] + myDialog.okButton + myDialog.okButton.objectName = "cancelButton"; + // from now on, myDialog.cancelButton references the button + //! [26] +#endif +} + diff --git a/WebKit/qt/examples/platformplugin/WebNotificationPresenter.cpp b/WebKit/qt/examples/platformplugin/WebNotificationPresenter.cpp new file mode 100644 index 0000000..c992236 --- /dev/null +++ b/WebKit/qt/examples/platformplugin/WebNotificationPresenter.cpp @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 "WebNotificationPresenter.h" + +WebNotificationWidget::WebNotificationWidget() + : QWidget() +{ +} + +WebNotificationWidget::~WebNotificationWidget() +{ +} + +void WebNotificationWidget::showNotification(const QWebNotificationData* data) +{ + QPixmap mask; + QPainter painter(&mask); + painter.fillRect(0, 0, 300, 100, Qt::lightGray); + QBitmap bitmap(mask); + setMask(bitmap); + QGridLayout* layout = new QGridLayout(this); + layout->addWidget(new QLabel(data->title()), 0, 0, 1, 5); + int messagePosition = 0; + QPixmap pixmap; + if (data->iconData().length() && pixmap.loadFromData(data->iconData())) { + QLabel* label = new QLabel; + label->setPixmap(pixmap); + layout->addWidget(label, 1, 0, 1, 1); + messagePosition++; + } + QLabel* messageLabel = new QLabel(data->message()); + messageLabel->setMask(bitmap); + messageLabel->setWordWrap(true); + layout->addWidget(messageLabel, 1, messagePosition, 1, 5 - messagePosition); + setLayout(layout); + setFixedSize(300, 100); + show(); +} + +bool WebNotificationWidget::event(QEvent* ev) +{ + if (ev->type() == QEvent::MouseButtonRelease || ev->type() == QEvent::Close) { + emit notificationClosed(); + return true; + } + return QWidget::event(ev); +} + diff --git a/WebKit/qt/examples/platformplugin/WebNotificationPresenter.h b/WebKit/qt/examples/platformplugin/WebNotificationPresenter.h new file mode 100644 index 0000000..a2563b2 --- /dev/null +++ b/WebKit/qt/examples/platformplugin/WebNotificationPresenter.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 WebNotificationPresenter_h +#define WebNotificationPresenter_h + +#include "qwebkitplatformplugin.h" +#include + +class WebNotificationWidget : public QWidget +{ + Q_OBJECT +public: + WebNotificationWidget(); + virtual ~WebNotificationWidget(); + + void showNotification(const QWebNotificationData*); + bool event(QEvent*); + +Q_SIGNALS: + void notificationClosed(); +}; + +class WebNotificationPresenter : public QWebNotificationPresenter +{ + Q_OBJECT +public: + WebNotificationPresenter() + : QWebNotificationPresenter() + { + m_widget = new WebNotificationWidget(); + connect(m_widget, SIGNAL(notificationClosed()), this, SIGNAL(notificationClosed())); + } + virtual ~WebNotificationPresenter() { m_widget->close(); delete m_widget; } + + void showNotification(const QWebNotificationData* data) { m_widget->showNotification(data); } + +private: + WebNotificationWidget* m_widget; +}; + +#endif // WebNotificationsUi_h diff --git a/WebKit/qt/examples/platformplugin/WebPlugin.cpp b/WebKit/qt/examples/platformplugin/WebPlugin.cpp index 79e583d..1f3877c 100644 --- a/WebKit/qt/examples/platformplugin/WebPlugin.cpp +++ b/WebKit/qt/examples/platformplugin/WebPlugin.cpp @@ -210,7 +210,15 @@ MultipleSelectionPopup::MultipleSelectionPopup(const QWebSelectData& data) bool WebPlugin::supportsExtension(Extension extension) const { - return extension == MultipleSelections; + if (extension == MultipleSelections) + return true; + if (extension == Notifications) +#if ENABLE_NOTIFICATIONS + return true; +#else + return false; +#endif + return false; } Q_EXPORT_PLUGIN2(qwebselectim, WebPlugin) diff --git a/WebKit/qt/examples/platformplugin/WebPlugin.h b/WebKit/qt/examples/platformplugin/WebPlugin.h index a46a07b..9a99d0b 100644 --- a/WebKit/qt/examples/platformplugin/WebPlugin.h +++ b/WebKit/qt/examples/platformplugin/WebPlugin.h @@ -21,6 +21,7 @@ #define WEBPLUGIN_H #include "qwebkitplatformplugin.h" +#include "WebNotificationPresenter.h" #include @@ -88,8 +89,9 @@ class WebPlugin : public QObject, public QWebKitPlatformPlugin public: virtual QWebSelectMethod* createSelectInputMethod() const { return new WebPopup(); } virtual bool supportsExtension(Extension extension) const; + virtual QWebNotificationPresenter* createNotificationPresenter() const { + return new WebNotificationPresenter(); + } }; - - #endif // WEBPLUGIN_H diff --git a/WebKit/qt/examples/platformplugin/platformplugin.pro b/WebKit/qt/examples/platformplugin/platformplugin.pro index c5c665b..9275665 100644 --- a/WebKit/qt/examples/platformplugin/platformplugin.pro +++ b/WebKit/qt/examples/platformplugin/platformplugin.pro @@ -6,8 +6,12 @@ CONFIG += plugin DESTDIR = $$[QT_INSTALL_PLUGINS]/webkit SOURCES += \ - WebPlugin.cpp + WebPlugin.cpp \ + WebNotificationPresenter.cpp HEADERS += \ WebPlugin.h \ - qwebkitplatformplugin.h + qwebkitplatformplugin.h \ + WebNotificationPresenter.h + +!contains(DEFINES, ENABLE_NOTIFICATIONS=.): DEFINES += ENABLE_NOTIFICATIONS=1 diff --git a/WebKit/qt/examples/platformplugin/qwebkitplatformplugin.h b/WebKit/qt/examples/platformplugin/qwebkitplatformplugin.h index 7d024ae..bac618c 100644 --- a/WebKit/qt/examples/platformplugin/qwebkitplatformplugin.h +++ b/WebKit/qt/examples/platformplugin/qwebkitplatformplugin.h @@ -58,20 +58,43 @@ Q_SIGNALS: void didHide(); }; +class QWebNotificationData +{ +public: + virtual const QString title() const = 0; + virtual const QString message() const = 0; + virtual const QByteArray iconData() const = 0; +}; + +class QWebNotificationPresenter : public QObject +{ + Q_OBJECT +public: + QWebNotificationPresenter() {} + virtual ~QWebNotificationPresenter() {} + + virtual void showNotification(const QWebNotificationData*) = 0; + +Q_SIGNALS: + void notificationClosed(); +}; + class QWebKitPlatformPlugin { public: - inline ~QWebKitPlatformPlugin() {} + virtual ~QWebKitPlatformPlugin() {} enum Extension { - MultipleSelections + MultipleSelections, + Notifications }; - virtual QWebSelectMethod* createSelectInputMethod() const = 0; virtual bool supportsExtension(Extension extension) const = 0; + virtual QWebSelectMethod* createSelectInputMethod() const = 0; + virtual QWebNotificationPresenter* createNotificationPresenter() const = 0; }; -Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.0"); +Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.2"); #endif // QWEBKITPLATFORMPLUGIN_H diff --git a/WebKit/qt/qt_webkit_version.pri b/WebKit/qt/qt_webkit_version.pri new file mode 100644 index 0000000..1656f2d --- /dev/null +++ b/WebKit/qt/qt_webkit_version.pri @@ -0,0 +1,4 @@ +QT_WEBKIT_VERSION = 4.8.0 +QT_WEBKIT_MAJOR_VERSION = 4 +QT_WEBKIT_MINOR_VERSION = 8 +QT_WEBKIT_PATCH_VERSION = 0 diff --git a/WebKit/qt/qtwebkit_version.pri b/WebKit/qt/qtwebkit_version.pri deleted file mode 100644 index 1656f2d..0000000 --- a/WebKit/qt/qtwebkit_version.pri +++ /dev/null @@ -1,4 +0,0 @@ -QT_WEBKIT_VERSION = 4.8.0 -QT_WEBKIT_MAJOR_VERSION = 4 -QT_WEBKIT_MINOR_VERSION = 8 -QT_WEBKIT_PATCH_VERSION = 0 diff --git a/WebKit/qt/symbian/eabi/QtWebKitu.def b/WebKit/qt/symbian/eabi/QtWebKitu.def index 203261a..93fd33c 100644 --- a/WebKit/qt/symbian/eabi/QtWebKitu.def +++ b/WebKit/qt/symbian/eabi/QtWebKitu.def @@ -770,3 +770,9 @@ EXPORTS _ZN23DumpRenderTreeSupportQt39setWillSendRequestReturnsNullOnRedirectEb @769 NONAME _ZN23DumpRenderTreeSupportQt40garbageCollectorCollectOnAlternateThreadEb @770 NONAME _ZN23DumpRenderTreeSupportQt40setDomainRelaxationForbiddenForURLSchemeEbRK7QString @771 NONAME + _ZN23DumpRenderTreeSupportQt18setEditingBehaviorEP8QWebPageRK7QString @ 772 NONAME + _ZN23DumpRenderTreeSupportQt24setNotificationsReceiverEP7QObject @ 773 NONAME + _ZN23DumpRenderTreeSupportQt26allowNotificationForOriginERK7QString @ 774 NONAME + _ZN23DumpRenderTreeSupportQt26setCheckPermissionFunctionEPFvP7QObjectRK4QUrlR22NotificationPermissionE @ 775 NONAME + _ZN23DumpRenderTreeSupportQt28setRequestPermissionFunctionEPFvP7QObjectRK7QStringE @ 776 NONAME + _ZN23DumpRenderTreeSupportQt31removeWhiteListAccessFromOriginERK7QStringS2_S2_b @ 777 NONAME diff --git a/WebKit/qt/tests/qgraphicswebview/resources/input_types.html b/WebKit/qt/tests/qgraphicswebview/resources/input_types.html new file mode 100644 index 0000000..18ab314 --- /dev/null +++ b/WebKit/qt/tests/qgraphicswebview/resources/input_types.html @@ -0,0 +1,8 @@ + +
+
+
+
+
+
" + \ No newline at end of file diff --git a/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp b/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp index ebe847d..e06524d 100644 --- a/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp +++ b/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp @@ -19,6 +19,7 @@ #include "../util.h" #include +#include #include #include #include @@ -32,6 +33,7 @@ private slots: void qgraphicswebview(); void crashOnViewlessWebPages(); void microFocusCoordinates(); + void focusInputTypes(); }; void tst_QGraphicsWebView::qgraphicswebview() @@ -75,6 +77,29 @@ private slots: } }; +class GraphicsWebView : public QGraphicsWebView +{ + Q_OBJECT + +public: + GraphicsWebView(QGraphicsItem* parent = 0): QGraphicsWebView(parent) + { + } + + void fireMouseClick(QPointF point) { + QGraphicsSceneMouseEvent presEv(QEvent::GraphicsSceneMousePress); + presEv.setPos(point); + presEv.setButton(Qt::LeftButton); + presEv.setButtons(Qt::LeftButton); + QGraphicsSceneMouseEvent relEv(QEvent::GraphicsSceneMouseRelease); + relEv.setPos(point); + relEv.setButton(Qt::LeftButton); + relEv.setButtons(Qt::LeftButton); + QGraphicsWebView::sceneEvent(&presEv); + QGraphicsWebView::sceneEvent(&relEv); + } +}; + void tst_QGraphicsWebView::crashOnViewlessWebPages() { QGraphicsScene scene; @@ -140,6 +165,57 @@ void tst_QGraphicsWebView::microFocusCoordinates() delete view; } +void tst_QGraphicsWebView::focusInputTypes() +{ + QWebPage* page = new QWebPage; + GraphicsWebView* webView = new GraphicsWebView; + webView->setPage( page ); + QGraphicsView* view = new QGraphicsView; + QGraphicsScene* scene = new QGraphicsScene(view); + view->setScene(scene); + scene->addItem(webView); + view->setGeometry(QRect(0,0,500,500)); + QCoreApplication::processEvents(); + QUrl url("qrc:///resources/input_types.html"); + page->mainFrame()->load(url); + page->mainFrame()->setFocus(); + + QVERIFY(waitForSignal(page, SIGNAL(loadFinished(bool)))); + + // 'text' type + webView->fireMouseClick(QPointF(20.0, 10.0)); +#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) || defined(Q_OS_SYMBIAN) + QVERIFY(webView->inputMethodHints() & Qt::ImhNoAutoUppercase); + QVERIFY(webView->inputMethodHints() & Qt::ImhNoPredictiveText); +#else + QVERIFY(webView->inputMethodHints() == Qt::ImhNone); +#endif + + // 'password' field + webView->fireMouseClick(QPointF(20.0, 60.0)); + QVERIFY(webView->inputMethodHints() & Qt::ImhHiddenText); + + // 'tel' field + webView->fireMouseClick(QPointF(20.0, 110.0)); + QVERIFY(webView->inputMethodHints() & Qt::ImhDialableCharactersOnly); + + // 'number' field + webView->fireMouseClick(QPointF(20.0, 160.0)); + QVERIFY(webView->inputMethodHints() & Qt::ImhDigitsOnly); + + // 'email' field + webView->fireMouseClick(QPointF(20.0, 210.0)); + QVERIFY(webView->inputMethodHints() & Qt::ImhEmailCharactersOnly); + + // 'url' field + webView->fireMouseClick(QPointF(20.0, 260.0)); + QVERIFY(webView->inputMethodHints() & Qt::ImhUrlCharactersOnly); + + delete webView; + delete view; +} + + QTEST_MAIN(tst_QGraphicsWebView) diff --git a/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc b/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc new file mode 100644 index 0000000..c91bb9c --- /dev/null +++ b/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc @@ -0,0 +1,6 @@ + + + resources/input_types.html + + + diff --git a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 630ccce..5e6f4e6 100644 --- a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -77,6 +77,7 @@ private slots: void acceptNavigationRequest(); void infiniteLoopJS(); + void geolocationRequestJS(); void loadFinished(); void acceptNavigationRequestWithNewWindow(); void userStyleSheet(); @@ -123,6 +124,7 @@ private slots: void testJSPrompt(); void showModalDialog(); void testStopScheduledPageRefresh(); + void findText(); private: QWebView* m_view; @@ -213,16 +215,52 @@ public: public slots: bool shouldInterruptJavaScript() { - return true; + return true; + } + bool allowGeolocationRequest(QWebFrame *frame) + { + return m_allowGeolocation; + } + +public: + void setGeolocationPermission(bool allow) + { + m_allowGeolocation = allow; } + +private: + bool m_allowGeolocation; }; void tst_QWebPage::infiniteLoopJS() { JSTestPage* newPage = new JSTestPage(m_view); m_view->setPage(newPage); - m_view->setHtml(QString(""), QUrl()); + m_view->setHtml(QString("test"), QUrl()); m_view->page()->mainFrame()->evaluateJavaScript("var run = true;var a = 1;while(run){a++;}"); + delete newPage; +} + +void tst_QWebPage::geolocationRequestJS() +{ + JSTestPage* newPage = new JSTestPage(m_view); + newPage->setGeolocationPermission(false); + m_view->setPage(newPage); + m_view->setHtml(QString("test"), QUrl()); + m_view->page()->mainFrame()->evaluateJavaScript("var errorCode = 0; function error(err) { errorCode = err.code; } function success(pos) { } navigator.geolocation.getCurrentPosition(success, error)"); + QTest::qWait(2000); + QVariant empty = m_view->page()->mainFrame()->evaluateJavaScript("errorCode"); + + QVERIFY(empty.type() == QVariant::Double && empty.toInt() != 0); + + newPage->setGeolocationPermission(true); + m_view->page()->mainFrame()->evaluateJavaScript("errorCode = 0; navigator.geolocation.getCurrentPosition(success, error);"); + empty = m_view->page()->mainFrame()->evaluateJavaScript("errorCode"); + + //http://dev.w3.org/geo/api/spec-source.html#position + //PositionError: const unsigned short PERMISSION_DENIED = 1; + QVERIFY(empty.type() == QVariant::Double && empty.toInt() != 1); + delete newPage; } void tst_QWebPage::loadFinished() @@ -2116,5 +2154,21 @@ void tst_QWebPage::testStopScheduledPageRefresh() QCOMPARE(page2.mainFrame()->url().toString(), QString("about:blank")); } +void tst_QWebPage::findText() +{ + m_view->setHtml(QString("
foo bar
")); + m_page->triggerAction(QWebPage::SelectAll); + QVERIFY(!m_page->selectedText().isEmpty()); + m_page->findText(""); + QVERIFY(m_page->selectedText().isEmpty()); + QStringList words = (QStringList() << "foo" << "bar"); + foreach (QString subString, words) { + m_page->findText(subString, QWebPage::FindWrapsAroundDocument); + QCOMPARE(m_page->selectedText(), subString); + m_page->findText(""); + QVERIFY(m_page->selectedText().isEmpty()); + } +} + QTEST_MAIN(tst_QWebPage) #include "tst_qwebpage.moc" diff --git a/WebKit/qt/tests/qwebview/resources/input_types.html b/WebKit/qt/tests/qwebview/resources/input_types.html new file mode 100644 index 0000000..18ab314 --- /dev/null +++ b/WebKit/qt/tests/qwebview/resources/input_types.html @@ -0,0 +1,8 @@ + +
+
+
+
+
+
" + \ No newline at end of file diff --git a/WebKit/qt/tests/qwebview/tst_qwebview.cpp b/WebKit/qt/tests/qwebview/tst_qwebview.cpp index 100399e..835ad82 100644 --- a/WebKit/qt/tests/qwebview/tst_qwebview.cpp +++ b/WebKit/qt/tests/qwebview/tst_qwebview.cpp @@ -30,8 +30,6 @@ #include #include -#include - class tst_QWebView : public QObject { Q_OBJECT @@ -49,10 +47,25 @@ private slots: void reusePage_data(); void reusePage(); void microFocusCoordinates(); + void focusInputTypes(); void crashTests(); }; +class WebView : public QWebView +{ + Q_OBJECT + +public: + void fireMouseClick(QPoint point) { + QMouseEvent presEv(QEvent::MouseButtonPress, point, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); + QMouseEvent relEv(QEvent::MouseButtonRelease, point, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); + QWebView::mousePressEvent(&presEv); + QWebView::mousePressEvent(&relEv); + } + +}; + // This will be called before the first test function is executed. // It is only called once. void tst_QWebView::initTestCase() @@ -230,6 +243,52 @@ void tst_QWebView::microFocusCoordinates() QCOMPARE(initialMicroFocus.toRect().translated(QPoint(0,-50)), currentMicroFocus.toRect()); } +void tst_QWebView::focusInputTypes() +{ + QWebPage* page = new QWebPage; + WebView* webView = new WebView; + webView->setPage( page ); + + QCoreApplication::processEvents(); + QUrl url("qrc:///resources/input_types.html"); + page->mainFrame()->load(url); + page->mainFrame()->setFocus(); + + QVERIFY(waitForSignal(page, SIGNAL(loadFinished(bool)))); + + // 'text' type + webView->fireMouseClick(QPoint(20, 10)); +#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) || defined(Q_OS_SYMBIAN) + QVERIFY(webView->inputMethodHints() & Qt::ImhNoAutoUppercase); + QVERIFY(webView->inputMethodHints() & Qt::ImhNoPredictiveText); +#else + QVERIFY(webView->inputMethodHints() == Qt::ImhNone); +#endif + + // 'password' field + webView->fireMouseClick(QPoint(20, 60)); + QVERIFY(webView->inputMethodHints() & Qt::ImhHiddenText); + + // 'tel' field + webView->fireMouseClick(QPoint(20, 110)); + QVERIFY(webView->inputMethodHints() & Qt::ImhDialableCharactersOnly); + + // 'number' field + webView->fireMouseClick(QPoint(20, 160)); + QVERIFY(webView->inputMethodHints() & Qt::ImhDigitsOnly); + + // 'email' field + webView->fireMouseClick(QPoint(20, 210)); + QVERIFY(webView->inputMethodHints() & Qt::ImhEmailCharactersOnly); + + // 'url' field + webView->fireMouseClick(QPoint(20, 260)); + QVERIFY(webView->inputMethodHints() & Qt::ImhUrlCharactersOnly); + + delete webView; + +} + QTEST_MAIN(tst_QWebView) #include "tst_qwebview.moc" diff --git a/WebKit/qt/tests/qwebview/tst_qwebview.qrc b/WebKit/qt/tests/qwebview/tst_qwebview.qrc index 5abc64c..8710a9a 100644 --- a/WebKit/qt/tests/qwebview/tst_qwebview.qrc +++ b/WebKit/qt/tests/qwebview/tst_qwebview.qrc @@ -2,6 +2,7 @@ resources/index.html resources/frame_a.html + resources/input_types.html diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog index 2979556..85f67b6 100644 --- a/WebKit/win/ChangeLog +++ b/WebKit/win/ChangeLog @@ -1,3 +1,99 @@ +2010-06-14 Ilya Tikhonovsky + + Reviewed by Pavel Feldman. + + WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc + data from inspected page to WebInspector as JSON string via http. The native + serialization to JSON string is supported by InspectorValue's classes. This patch + has the implementation of sendMessageToFrontend function. WebKit version of it still + uses ScriptFunctionCall and will be switched to another transport a little bit later. + https://bugs.webkit.org/show_bug.cgi?id=40134 + + * WebCoreSupport/WebInspectorClient.cpp: + (WebInspectorClient::WebInspectorClient): + (WebInspectorClient::~WebInspectorClient): + (WebInspectorClient::openInspectorFrontend): + * WebCoreSupport/WebInspectorClient.h: + +2010-06-10 Eric Seidel + + Reviewed by Adam Barth. + + Reduce FrameView.h includes to speed up build times + https://bugs.webkit.org/show_bug.cgi?id=40408 + + Another fix for Windows. + + * WebView.cpp: + +2010-06-09 Sheriff Bot + + Unreviewed, rolling out r60889. + http://trac.webkit.org/changeset/60889 + https://bugs.webkit.org/show_bug.cgi?id=40365 + + gtk bot has some kind of memory corruption (Requested by + loislo on #webkit). + + * WebCoreSupport/WebInspectorClient.cpp: + (WebInspectorClient::WebInspectorClient): + (WebInspectorClient::~WebInspectorClient): + (WebInspectorClient::openInspectorFrontend): + * WebCoreSupport/WebInspectorClient.h: + (WebInspectorClient::frontendClosing): + +2010-06-07 Ilya Tikhonovsky + + Reviewed by Pavel Feldman. + + WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc + data from inspected page to WebInspector as JSON string via http. The native + serialization to JSON string is supported by InspectorValue's classes. This patch + has the implementation of sendMessageToFrontend function. WebKit version of it still + uses ScriptFunctionCall and will be switched to another transport a little bit later. + https://bugs.webkit.org/show_bug.cgi?id=40134 + + * WebCoreSupport/WebInspectorClient.cpp: + (WebInspectorClient::WebInspectorClient): + (WebInspectorClient::~WebInspectorClient): + (WebInspectorClient::openInspectorFrontend): + * WebCoreSupport/WebInspectorClient.h: + +2010-06-08 Antonio Gomes + + Reviewed by Ojan Vafai and Darin Adler. + + Refactor platform dependent editing behavior code out of Settings + https://bugs.webkit.org/show_bug.cgi?id=39854 + + EditingBehavior enum was renamed to EditingBehaviorTypes and moved out from Settings.h to + EditingBehaviorTypes.h . Call sites in WebKit/ adjusted accordingly. + + * WebView.cpp: + (WebView::notifyPreferencesChanged): + +2010-06-04 Alice Liu + + Reviewed by Jon Honeycutt. + + WebFrame::paintDocumentRectToContextAtPoint doesn't paint scrollbars + https://bugs.webkit.org/show_bug.cgi?id=40034 + + + * WebFrame.cpp: + (WebFrame::paintScrollViewRectToContextAtPoint): Renamed from paintDocumentRectToContextAtPoint. + Call paint() instead of paintContents(). Also move the dirtyRect to counteract the moving that happens in paint(). + + Just renaming changes: + * Interfaces/IWebFramePrivate.idl: + * Interfaces/IWebViewPrivate.idl: + * WebFrame.h: + * WebView.cpp: + (WebView::paintScrollViewRectToContextAtPoint): + * WebView.h: + + * Interfaces/WebKit.idl: Touched for rebuild. + 2010-05-30 Daniel Bates Unreviewed, attempt to fix the build after http://trac.webkit.org/changeset/60418. diff --git a/WebKit/win/Interfaces/IWebFramePrivate.idl b/WebKit/win/Interfaces/IWebFramePrivate.idl index 80a3e24..1b7209d 100755 --- a/WebKit/win/Interfaces/IWebFramePrivate.idl +++ b/WebKit/win/Interfaces/IWebFramePrivate.idl @@ -111,5 +111,5 @@ interface IWebFramePrivate : IUnknown HRESULT layerTreeAsText([out, retval] BSTR* result); - HRESULT paintDocumentRectToContextAtPoint([in] RECT rect, [in] POINT pt, [in] OLE_HANDLE deviceContext); + HRESULT paintScrollViewRectToContextAtPoint([in] RECT rect, [in] POINT pt, [in] OLE_HANDLE deviceContext); } diff --git a/WebKit/win/Interfaces/IWebViewPrivate.idl b/WebKit/win/Interfaces/IWebViewPrivate.idl index 1bf21d5..352ae7e 100644 --- a/WebKit/win/Interfaces/IWebViewPrivate.idl +++ b/WebKit/win/Interfaces/IWebViewPrivate.idl @@ -234,7 +234,7 @@ interface IWebViewPrivate : IUnknown HRESULT nextDisplayIsSynchronous(); - HRESULT paintDocumentRectToContextAtPoint([in] RECT rect, [in] POINT pt, [in] OLE_HANDLE dc); + HRESULT paintScrollViewRectToContextAtPoint([in] RECT rect, [in] POINT pt, [in] OLE_HANDLE dc); [local] HRESULT reportException([in] JSContextRef context, [in] JSValueRef exception); } diff --git a/WebKit/win/Interfaces/WebKit.idl b/WebKit/win/Interfaces/WebKit.idl index 98f5da8..d25cdfe 100644 --- a/WebKit/win/Interfaces/WebKit.idl +++ b/WebKit/win/Interfaces/WebKit.idl @@ -300,4 +300,3 @@ library WebKit [default] interface IWebUserContentURLPattern; } } - diff --git a/WebKit/win/WebCoreSupport/WebInspectorClient.cpp b/WebKit/win/WebCoreSupport/WebInspectorClient.cpp index 3c263e5..34fb827 100644 --- a/WebKit/win/WebCoreSupport/WebInspectorClient.cpp +++ b/WebKit/win/WebCoreSupport/WebInspectorClient.cpp @@ -69,6 +69,7 @@ static CFBundleRef getWebKitBundle() WebInspectorClient::WebInspectorClient(WebView* webView) : m_inspectedWebView(webView) + , m_frontendPage(0) { ASSERT(m_inspectedWebView); m_inspectedWebView->viewWindow((OLE_HANDLE*)&m_inspectedWebViewHwnd); @@ -76,6 +77,7 @@ WebInspectorClient::WebInspectorClient(WebView* webView) WebInspectorClient::~WebInspectorClient() { + m_frontendPage = 0; } void WebInspectorClient::inspectorDestroyed() @@ -172,8 +174,9 @@ void WebInspectorClient::openInspectorFrontend(InspectorController* inspectorCon if (FAILED(frontendWebView->topLevelFrame()->loadRequest(request.get()))) return; - Page* page = core(frontendWebView.get()); - page->inspectorController()->setInspectorFrontendClient(new WebInspectorFrontendClient(m_inspectedWebView, m_inspectedWebViewHwnd, frontendHwnd, frontendWebView, frontendWebViewHwnd, this)); + m_frontendPage = core(frontendWebView.get()); + WebInspectorFrontendClient* frontendClient = new WebInspectorFrontendClient(m_inspectedWebView, m_inspectedWebViewHwnd, frontendHwnd, frontendWebView, frontendWebViewHwnd, this); + m_frontendPage->inspectorController()->setInspectorFrontendClient(frontendClient); m_frontendHwnd = frontendHwnd; } diff --git a/WebKit/win/WebCoreSupport/WebInspectorClient.h b/WebKit/win/WebCoreSupport/WebInspectorClient.h index 64773a5..17a8d99 100644 --- a/WebKit/win/WebCoreSupport/WebInspectorClient.h +++ b/WebKit/win/WebCoreSupport/WebInspectorClient.h @@ -37,6 +37,12 @@ #include #include +namespace WebCore { + +class Page; + +} + class WebNodeHighlight; class WebView; @@ -55,13 +61,21 @@ public: virtual void populateSetting(const WebCore::String& key, WebCore::String* value); virtual void storeSetting(const WebCore::String& key, const WebCore::String& value); + virtual bool sendMessageToFrontend(const WebCore::String&); + void updateHighlight(); - void frontendClosing() { m_frontendHwnd = 0; } + void frontendClosing() + { + m_frontendHwnd = 0; + releaseFrontendPage(); + } + void releaseFrontendPage(); private: ~WebInspectorClient(); WebView* m_inspectedWebView; + WebCore::Page* m_frontendPage; HWND m_inspectedWebViewHwnd; HWND m_frontendHwnd; diff --git a/WebKit/win/WebFrame.cpp b/WebKit/win/WebFrame.cpp index 22bd339..75a9c8d 100644 --- a/WebKit/win/WebFrame.cpp +++ b/WebKit/win/WebFrame.cpp @@ -359,7 +359,7 @@ HRESULT STDMETHODCALLTYPE WebFrame::paintDocumentRectToContext( return S_OK; } -HRESULT STDMETHODCALLTYPE WebFrame::paintDocumentRectToContextAtPoint( +HRESULT STDMETHODCALLTYPE WebFrame::paintScrollViewRectToContextAtPoint( /* [in] */ RECT rect, /* [in] */ POINT pt, /* [in] */ OLE_HANDLE deviceContext) @@ -380,9 +380,8 @@ HRESULT STDMETHODCALLTYPE WebFrame::paintDocumentRectToContextAtPoint( gc.setShouldIncludeChildWindows(true); gc.save(); IntRect dirtyRect(rect); - gc.translate(-pt.x, -pt.y); - gc.clip(dirtyRect); - view->paintContents(&gc, rect); + dirtyRect.move(-pt.x, -pt.y); + view->paint(&gc, dirtyRect); gc.restore(); return S_OK; diff --git a/WebKit/win/WebFrame.h b/WebKit/win/WebFrame.h index b556192..d839f17 100644 --- a/WebKit/win/WebFrame.h +++ b/WebKit/win/WebFrame.h @@ -245,7 +245,7 @@ public: /* [in] */ RECT rect, /* [in] */ OLE_HANDLE deviceContext); - virtual HRESULT STDMETHODCALLTYPE paintDocumentRectToContextAtPoint( + virtual HRESULT STDMETHODCALLTYPE paintScrollViewRectToContextAtPoint( /* [in] */ RECT rect, /* [in] */ POINT pt, /* [in] */ OLE_HANDLE deviceContext); diff --git a/WebKit/win/WebView.cpp b/WebKit/win/WebView.cpp index 525108f..a85cc92 100644 --- a/WebKit/win/WebView.cpp +++ b/WebKit/win/WebView.cpp @@ -110,6 +110,7 @@ #include #include #include +#include #include #include #include @@ -4654,7 +4655,7 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification) hr = preferences->editingBehavior(&editingBehavior); if (FAILED(hr)) return hr; - settings->setEditingBehavior((EditingBehavior)editingBehavior); + settings->setEditingBehaviorType((EditingBehaviorType)editingBehavior); hr = preferences->usesPageCache(&enabled); if (FAILED(hr)) @@ -5676,7 +5677,7 @@ HRESULT STDMETHODCALLTYPE WebView::paintDocumentRectToContext( return m_mainFrame->paintDocumentRectToContext(rect, deviceContext); } -HRESULT STDMETHODCALLTYPE WebView::paintDocumentRectToContextAtPoint( +HRESULT STDMETHODCALLTYPE WebView::paintScrollViewRectToContextAtPoint( /* [in] */ RECT rect, /* [in] */ POINT pt, /* [in] */ OLE_HANDLE deviceContext) @@ -5687,7 +5688,7 @@ HRESULT STDMETHODCALLTYPE WebView::paintDocumentRectToContextAtPoint( if (!m_mainFrame) return E_FAIL; - return m_mainFrame->paintDocumentRectToContextAtPoint(rect, pt, deviceContext); + return m_mainFrame->paintScrollViewRectToContextAtPoint(rect, pt, deviceContext); } HRESULT STDMETHODCALLTYPE WebView::reportException( diff --git a/WebKit/win/WebView.h b/WebKit/win/WebView.h index d44e6c6..514f376 100644 --- a/WebKit/win/WebView.h +++ b/WebKit/win/WebView.h @@ -697,7 +697,7 @@ public: /* [in] */ RECT rect, /* [in] */ OLE_HANDLE dc); - virtual HRESULT STDMETHODCALLTYPE paintDocumentRectToContextAtPoint( + virtual HRESULT STDMETHODCALLTYPE paintScrollViewRectToContextAtPoint( /* [in] */ RECT rect, /* [in] */ POINT pt, /* [in] */ OLE_HANDLE dc); diff --git a/WebKit/wx/ChangeLog b/WebKit/wx/ChangeLog index ab25102..aefe2a1 100644 --- a/WebKit/wx/ChangeLog +++ b/WebKit/wx/ChangeLog @@ -1,3 +1,45 @@ +2010-06-14 Ilya Tikhonovsky + + Reviewed by Pavel Feldman. + + WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc + data from inspected page to WebInspector as JSON string via http. The native + serialization to JSON string is supported by InspectorValue's classes. This patch + has the implementation of sendMessageToFrontend function. WebKit version of it still + uses ScriptFunctionCall and will be switched to another transport a little bit later. + https://bugs.webkit.org/show_bug.cgi?id=40134 + + * WebKitSupport/InspectorClientWx.cpp: + (WebCore::InspectorClientWx::sendMessageToFrontend): + * WebKitSupport/InspectorClientWx.h: + +2010-06-09 Sheriff Bot + + Unreviewed, rolling out r60889. + http://trac.webkit.org/changeset/60889 + https://bugs.webkit.org/show_bug.cgi?id=40365 + + gtk bot has some kind of memory corruption (Requested by + loislo on #webkit). + + * WebKitSupport/InspectorClientWx.cpp: + * WebKitSupport/InspectorClientWx.h: + +2010-06-07 Ilya Tikhonovsky + + Reviewed by Pavel Feldman. + + WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc + data from inspected page to WebInspector as JSON string via http. The native + serialization to JSON string is supported by InspectorValue's classes. This patch + has the implementation of sendMessageToFrontend function. WebKit version of it still + uses ScriptFunctionCall and will be switched to another transport a little bit later. + https://bugs.webkit.org/show_bug.cgi?id=40134 + + * WebKitSupport/InspectorClientWx.cpp: + (WebCore::InspectorClientWx::sendMessageToFrontend): + * WebKitSupport/InspectorClientWx.h: + 2010-05-27 Kevin Ollivier [wx] Build fixes for Windows after recent changes. diff --git a/WebKit/wx/WebKitSupport/InspectorClientWx.cpp b/WebKit/wx/WebKitSupport/InspectorClientWx.cpp index 5dc9ac7..c949d77 100644 --- a/WebKit/wx/WebKitSupport/InspectorClientWx.cpp +++ b/WebKit/wx/WebKitSupport/InspectorClientWx.cpp @@ -72,4 +72,10 @@ void InspectorClientWx::storeSetting(const String& key, const String& setting) notImplemented(); } +bool InspectorClientWx::sendMessageToFrontend(const String&) +{ + notImplemented(); + return false; +} + }; diff --git a/WebKit/wx/WebKitSupport/InspectorClientWx.h b/WebKit/wx/WebKitSupport/InspectorClientWx.h index 7675dc1..698a0f5 100644 --- a/WebKit/wx/WebKitSupport/InspectorClientWx.h +++ b/WebKit/wx/WebKitSupport/InspectorClientWx.h @@ -48,6 +48,8 @@ public: virtual void populateSetting(const String& key, String* value); virtual void storeSetting(const String& key, const String& value); + + virtual bool sendMessageToFrontend(const String&); }; } // namespace WebCore diff --git a/WebKitExamplePlugins/ChangeLog b/WebKitExamplePlugins/ChangeLog index 6133243..07c3d8e 100644 --- a/WebKitExamplePlugins/ChangeLog +++ b/WebKitExamplePlugins/ChangeLog @@ -1,3 +1,15 @@ +2010-06-10 Anders Carlsson + + Fix build. + + * NetscapeCocoaPlugin/NetscapeCocoaPlugin.xcodeproj/project.pbxproj: + * NetscapeCocoaPlugin/main.m: + (NPP_New): + (NPP_NewStream): + (NPP_WriteReady): + (NPP_Write): + (NPP_HandleEvent): + 2010-03-02 Anders Carlsson Reviewed by Kevin Decker. diff --git a/WebKitExamplePlugins/NetscapeCocoaPlugin/NetscapeCocoaPlugin.xcodeproj/project.pbxproj b/WebKitExamplePlugins/NetscapeCocoaPlugin/NetscapeCocoaPlugin.xcodeproj/project.pbxproj index 1c78769..cf36a4d 100644 --- a/WebKitExamplePlugins/NetscapeCocoaPlugin/NetscapeCocoaPlugin.xcodeproj/project.pbxproj +++ b/WebKitExamplePlugins/NetscapeCocoaPlugin/NetscapeCocoaPlugin.xcodeproj/project.pbxproj @@ -192,24 +192,24 @@ 149C298808902C53008A9EFC /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)"; + ARCHS = "$(ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1)"; ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "ppc i386 ppc64 x86_64"; + ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1 = x86_64; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; PREBINDING = NO; - SDKROOT = /Developer/SDKs/MacOSX10.5.sdk; }; name = Debug; }; 149C298908902C53008A9EFC /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)"; + ARCHS = "$(ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1)"; ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "ppc i386 ppc64 x86_64"; + ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1 = x86_64; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; PREBINDING = NO; - SDKROOT = /Developer/SDKs/MacOSX10.5.sdk; }; name = Release; }; diff --git a/WebKitExamplePlugins/NetscapeCocoaPlugin/main.m b/WebKitExamplePlugins/NetscapeCocoaPlugin/main.m index afe29c6..3f0396a 100644 --- a/WebKitExamplePlugins/NetscapeCocoaPlugin/main.m +++ b/WebKitExamplePlugins/NetscapeCocoaPlugin/main.m @@ -56,16 +56,16 @@ typedef struct PluginObject MenuHandler *menuHandler; } PluginObject; -NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved); +NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved); NPError NPP_Destroy(NPP instance, NPSavedData** save); NPError NPP_SetWindow(NPP instance, NPWindow* window); -NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype); +NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype); NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason); -int32 NPP_WriteReady(NPP instance, NPStream* stream); -int32 NPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer); +int32_t NPP_WriteReady(NPP instance, NPStream* stream); +int32_t NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer); void NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname); void NPP_Print(NPP instance, NPPrint* platformPrint); -int16 NPP_HandleEvent(NPP instance, void* event); +int16_t NPP_HandleEvent(NPP instance, void* event); void NPP_URLNotify(NPP instance, const char* URL, NPReason reason, void* notifyData); NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value); NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value); @@ -109,7 +109,7 @@ void NP_Shutdown(void) } -NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved) +NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved) { // Create per-instance storage PluginObject *obj = (PluginObject *)malloc(sizeof(PluginObject)); @@ -164,7 +164,7 @@ NPError NPP_SetWindow(NPP instance, NPWindow* window) } -NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype) +NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype) { *stype = NP_ASFILEONLY; return NPERR_NO_ERROR; @@ -175,12 +175,12 @@ NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason) return NPERR_NO_ERROR; } -int32 NPP_WriteReady(NPP instance, NPStream* stream) +int32_t NPP_WriteReady(NPP instance, NPStream* stream) { return 0; } -int32 NPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer) +int32_t NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer) { return 0; } @@ -313,7 +313,7 @@ static void handleKeyboardEvent(PluginObject *obj, NPCocoaEvent *event) invalidatePlugin(obj); } -int16 NPP_HandleEvent(NPP instance, void* event) +int16_t NPP_HandleEvent(NPP instance, void* event) { PluginObject *obj = instance->pdata; diff --git a/WebKitLibraries/ChangeLog b/WebKitLibraries/ChangeLog index 3783b39..273a141 100644 --- a/WebKitLibraries/ChangeLog +++ b/WebKitLibraries/ChangeLog @@ -1,3 +1,13 @@ +2010-06-02 Sterling Swigart + + Reviewed by David Levin. + + Image Resizer Patch 0: Added compilation argument to conditionally compile pending patches. + https://bugs.webkit.org/show_bug.cgi?id=39906 + + * win/tools/vsprops/FeatureDefines.vsprops: + * win/tools/vsprops/FeatureDefinesCairo.vsprops: + 2010-05-24 Jer Noble No review; build fix only. diff --git a/WebKitLibraries/WebKitSystemInterface.h b/WebKitLibraries/WebKitSystemInterface.h index 18b612c..48defe0 100644 --- a/WebKitLibraries/WebKitSystemInterface.h +++ b/WebKitLibraries/WebKitSystemInterface.h @@ -29,9 +29,9 @@ NSString *WKGetPreferredExtensionForMIMEType(NSString *type); NSArray *WKGetExtensionsForMIMEType(NSString *type); NSString *WKGetMIMETypeForExtension(NSString *extension); -NSDate *WKGetNSURLResponseLastModifiedDate(NSURLResponse *); -NSTimeInterval WKGetNSURLResponseFreshnessLifetime(NSURLResponse *); -NSString *WKCopyNSURLResponseStatusLine(NSURLResponse *); +NSDate *WKGetNSURLResponseLastModifiedDate(NSURLResponse *response); +NSTimeInterval WKGetNSURLResponseFreshnessLifetime(NSURLResponse *response); +NSString *WKCopyNSURLResponseStatusLine(NSURLResponse *response); CFStringEncoding WKGetWebDefaultCFStringEncoding(void); @@ -177,7 +177,7 @@ BOOL WKSupportsMultipartXMixedReplace(NSMutableURLRequest *request); BOOL WKCGContextIsBitmapContext(CGContextRef context); -void WKGetWheelEventDeltas(NSEvent *, float *deltaX, float *deltaY, float *wheelTicksX, float *wheelTicksY, BOOL *continuous); +void WKGetWheelEventDeltas(NSEvent *, float *deltaX, float *deltaY, BOOL *continuous); BOOL WKAppVersionCheckLessThan(NSString *, int, double); diff --git a/WebKitLibraries/libWebKitSystemInterfaceLeopard.a b/WebKitLibraries/libWebKitSystemInterfaceLeopard.a index 673465f..d99cf68 100644 Binary files a/WebKitLibraries/libWebKitSystemInterfaceLeopard.a and b/WebKitLibraries/libWebKitSystemInterfaceLeopard.a differ diff --git a/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a b/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a index 20d0bae..ef9d346 100644 Binary files a/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a and b/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a differ diff --git a/WebKitLibraries/libWebKitSystemInterfaceTiger.a b/WebKitLibraries/libWebKitSystemInterfaceTiger.a index bcb6ab3..65f874d 100644 Binary files a/WebKitLibraries/libWebKitSystemInterfaceTiger.a and b/WebKitLibraries/libWebKitSystemInterfaceTiger.a differ diff --git a/WebKitLibraries/win/tools/vsprops/FeatureDefines.vsprops b/WebKitLibraries/win/tools/vsprops/FeatureDefines.vsprops index 02ee348..83cf220 100644 --- a/WebKitLibraries/win/tools/vsprops/FeatureDefines.vsprops +++ b/WebKitLibraries/win/tools/vsprops/FeatureDefines.vsprops @@ -9,7 +9,7 @@ > + + + + Reviewed by Laszlo Gombos. + + [Qt] navigator.geolocation support for Qt port + https://bugs.webkit.org/show_bug.cgi?id=39724 + + Implementation for geolocation cases to DumpRenderTreeQt + + * DumpRenderTree/qt/DumpRenderTreeQt.cpp: + (WebCore::WebPage::allowGeolocationRequest): + * DumpRenderTree/qt/DumpRenderTreeQt.h: + * DumpRenderTree/qt/LayoutTestControllerQt.cpp: + (LayoutTestController::setGeolocationPermission): + (LayoutTestController::setMockGeolocationError): + (LayoutTestController::setMockGeolocationPosition): + * DumpRenderTree/qt/LayoutTestControllerQt.h: + (LayoutTestController::isGeolocationPermissionSet): + (LayoutTestController::geolocationPermission): + +2010-06-13 Nathan Lawrence + + Reviewed by Darin Adler. + + Outside of Xcode (make or WebKitTools/Scripts), there doesn't seem to + be a way of overwriting the Xcode system path. Making + $WEBKITOUTPUTDIR take precedence over the system default would make + this possible. + + * Scripts/webkitdirs.pm: + +2010-06-13 Chris Fleizach + + Reviewed by Darin Adler. + + AX: link won't return linked element if URL contains # + https://bugs.webkit.org/show_bug.cgi?id=40192 + + * DumpRenderTree/AccessibilityUIElement.cpp: + (linkedUIElementAtIndexCallback): + (AccessibilityUIElement::getJSClass): + * DumpRenderTree/AccessibilityUIElement.h: + * DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp: + (AccessibilityUIElement::linkedUIElementAtIndex): + * DumpRenderTree/mac/AccessibilityUIElementMac.mm: + (AccessibilityUIElement::linkedUIElementAtIndex): + * DumpRenderTree/win/AccessibilityUIElementWin.cpp: + (AccessibilityUIElement::linkedUIElementAtIndex): + +2010-06-13 Adam Barth + + Reviewed by Darin Adler. + + webkit-patch should add a bug URL to ChangeLogs if they don't have one yet + https://bugs.webkit.org/show_bug.cgi?id=39550 + + This can cause an extra request to bugs.webkit.org durig upload, but it + shouldn't be too bad. Also, this won't work if you remove the + boilerplate created by prepare-ChangeLog. + + * Scripts/webkitpy/common/checkout/changelog.py: + * Scripts/webkitpy/common/checkout/changelog_unittest.py: + * Scripts/webkitpy/common/net/bugzilla.py: + * Scripts/webkitpy/tool/steps/abstractstep.py: + * Scripts/webkitpy/tool/steps/preparechangelog.py: + * Scripts/webkitpy/tool/steps/preparechangelog_unittest.py: Added. + +2010-06-08 Robert Hogan + + Reviewed by Eric Seidel. + + [Qt] Add support for callShouldCloseOnWebView() to DRT + https://bugs.webkit.org/show_bug.cgi?id=40330 + + * DumpRenderTree/qt/LayoutTestControllerQt.cpp: + (LayoutTestController::callShouldCloseOnWebView): + * DumpRenderTree/qt/LayoutTestControllerQt.h: + (LayoutTestController::setCallCloseOnWebViews): + +2010-06-12 Eric Seidel + + Reviewed by Daniel Bates. + + do-webcore-rename should have a --verbose option + https://bugs.webkit.org/show_bug.cgi?id=40497 + + * Scripts/do-webcore-rename: + - Unified how we handle skipping files/directories + this will allow us to "black list" certain files and + directories when performing renames. + - Made do-webcore-rename log what it's skipping when passed --verbose. + +2010-06-12 Darin Adler + + * Scripts/run-bindings-tests: Fixed a typo in a message. + +2010-06-12 Kent Tamura + + Reviewed by Dimitri Glazkov. + + [Chromium] new-run-webkit-tests --use-drt should work with Chromium checkout + https://bugs.webkit.org/show_bug.cgi?id=40402 + + _build_path() of each Chromium port check existence of build path + of Chromium checkout first, then check existence of build path of + WebKit-only checkout. + + * Scripts/webkitpy/layout_tests/port/chromium_linux.py: + * Scripts/webkitpy/layout_tests/port/chromium_mac.py: + * Scripts/webkitpy/layout_tests/port/chromium_win.py: + +2010-06-12 Robert Hogan + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Back-forward list dumping is incorrect + + https://bugs.webkit.org/show_bug.cgi?id=36392 + + Support dumping child history items in DRT. + + Unskip: + + fast/loader/frame-src-change-added-to-history.html + fast/loader/frame-src-change-not-added-to-history.html + fast/loader/frame-location-change-not-added-to-history.html + + * DumpRenderTree/qt/DumpRenderTreeQt.cpp: + (WebCore::dumpHistoryItem): + +2010-06-10 Ojan Vafai + + Reviewed by Eric Seidel. + + upload all patches that lack in-rietveld to rietveld + https://bugs.webkit.org/show_bug.cgi?id=40444 + + If it's a patch, then we'll try to upload it as long as it + doesn't have in-rietveld set. No longer set in-rietveld? since + it's not needed. + + * Scripts/webkitpy/common/net/bugzilla.py: + +2010-06-10 Ojan Vafai + + Reviewed by Darin Fisher. + + Fix rietveld upload when message length > 100 characters + https://bugs.webkit.org/show_bug.cgi?id=40457 + + * Scripts/webkitpy/common/net/rietveld.py: + +2010-06-11 Yael Aharon + + Reviewed by Laszlo Gombos. + + [Qt] There should be a way to enable popups in QtTestBrowser + https://bugs.webkit.org/show_bug.cgi?id=40427 + + * QtTestBrowser/main.cpp: + (LauncherWindow::toggleJavascriptCanOpenWindows): + (LauncherWindow::createChrome): + +2010-06-10 Adam Barth + + Reviewed by Daniel Bates. + + Make SheriffBot more chatty + https://bugs.webkit.org/show_bug.cgi?id=40463 + + People seem to like to talk to SheriffBot, so let's make him chat back. + + * Scripts/webkitpy/thirdparty/__init__.py: + * Scripts/webkitpy/tool/bot/irc_command.py: + * Scripts/webkitpy/tool/bot/irc_command_unittest.py: Added. + * Scripts/webkitpy/tool/bot/sheriffircbot.py: + * Scripts/webkitpy/tool/bot/sheriffircbot_unittest.py: + +2010-06-10 Brian Weinstein + + Reviewed by Darin Adler. + + Fix the Windows buildbot when WebKitAuxiliaryLibs.zip cannot be found on our server. + + Robustify update-webkit-auxiliary-libs to be able to handle the case when WebKitAuxiliaryLibs.zip doesn't exist, + and allow the script to fall back to an existing file, only failing if there is no fallback file. Also switch to checking + WEXITSTATUS on $result instead of just comparing $result to 0. + + * Scripts/update-webkit-auxiliary-libs: + +2010-06-10 Ojan Vafai + + Reviewed by Alexey Proskuryakov. + + don't use Exception.message as it's deprecated in python 2.6+ + https://bugs.webkit.org/show_bug.cgi?id=40449 + + * Scripts/webkitpy/tool/commands/queues.py: + +2010-06-10 Ojan Vafai + + Reviewed by Adam Barth. + + fix handle_script_error in rietveld upload queue and add testing for handle_script_error + https://bugs.webkit.org/show_bug.cgi?id=40436 + + * Scripts/webkitpy/common/system/outputcapture.py: + * Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py: + * Scripts/webkitpy/tool/commands/queues.py: + * Scripts/webkitpy/tool/commands/queues_unittest.py: + * Scripts/webkitpy/tool/commands/queuestest.py: + * Scripts/webkitpy/tool/mocktool.py: + +2010-06-10 Jarkko Sakkinen + + Reviewed by Simon Hausmann. + + [Qt] *All* WebGL layout tests fail! + https://bugs.webkit.org/show_bug.cgi?id=40296 + + Added test for WebKitWebGLEnabled to + LayoutTestController::overridePreference(). + + * DumpRenderTree/qt/LayoutTestControllerQt.cpp: + (LayoutTestController::overridePreference): + +2010-06-10 Diego Gonzalez + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] DRT EventSender support to graphics mouse events activation + https://bugs.webkit.org/show_bug.cgi?id=40017 + + * DumpRenderTree/qt/EventSenderQt.cpp: + (EventSender::mouseDown): + (EventSender::mouseUp): + (EventSender::mouseMoveTo): + (EventSender::keyDown): + (EventSender::contextClick): + (EventSender::sendTouchEvent): + (EventSender::sendOrQueueEvent): + (EventSender::eventFilter): + (EventSender::createGraphicsSceneMouseEvent): + (EventSender::sendEvent): + * DumpRenderTree/qt/EventSenderQt.h: + (EventSender::isGraphicsBased): + +2010-06-09 Adam Barth + + Reviewed by Ojan Vafai. + + webkit-patch upload fails for security bugs because there's no rietveld flag + https://bugs.webkit.org/show_bug.cgi?id=40309 + + There's probably a more elegant way of seeing whether the form control + exists, but this seems to work. + + * Scripts/webkitpy/common/net/bugzilla.py: + +2010-06-09 Ojan Vafai + + Reviewed by Adam Barth. + + make rietveld upload faster and avoid posting to bug on errors + https://bugs.webkit.org/show_bug.cgi?id=40389 + + Only grab the first item of the upload queue instead of trying + to compute the whole list upfront (which is O(n) bugzilla lookups!). + + Also, don't post comments to the bug when uploading fails. + + * Scripts/webkitpy/common/net/bugzilla.py: + * Scripts/webkitpy/tool/commands/queues.py: + * Scripts/webkitpy/tool/commands/queues_unittest.py: + * Scripts/webkitpy/tool/commands/stepsequence.py: + * Scripts/webkitpy/tool/mocktool.py: + +2010-06-09 Ojan Vafai + + Reviewed by Adam Barth. + + Rietveld upload queue fails when setting in-rietveld flag + https://bugs.webkit.org/show_bug.cgi?id=40371 + + Make the comment arguments to set_flag_on_attachment optional + and add it to the MockBugzilla. + + * Scripts/webkitpy/common/net/bugzilla.py: + * Scripts/webkitpy/tool/bot/queueengine.py: + * Scripts/webkitpy/tool/commands/download_unittest.py: + * Scripts/webkitpy/tool/commands/queues.py: + * Scripts/webkitpy/tool/commands/queues_unittest.py: + * Scripts/webkitpy/tool/mocktool.py: + +2010-06-09 Kenneth Russell + + Reviewed by Dimitri Glazkov. + + Rename FloatArray to Float32Array + https://bugs.webkit.org/show_bug.cgi?id=40323 + + Used do-webcore-rename to perform renaming. Manually undid + incorrect changes to WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp, + WebCore/manual-tests/resources/ArrayParameterTestApplet.java and + ArrayParameterTestApplet.class. Updated LayoutTests. Built and ran + all layout tests on Safari; built Chromium and ran selected WebGL + tests. + + * Scripts/do-webcore-rename: + +2010-06-08 Tony Chang + + Reviewed by David Levin. + + [chromium] compile linux chromium in WebKit/out instead of WebKit/WebKit/chromium/out + https://bugs.webkit.org/show_bug.cgi?id=40285 + + * Scripts/webkitdirs.pm: + * Scripts/webkitpy/layout_tests/port/chromium_linux.py: + +2010-06-03 Roland Steiner + + Reviewed by Tamura Kent. + + Bug 40052 - [DRT/Chromium] Upstream test_shell_webthemeengine as WebThemeEngineDRT + https://bugs.webkit.org/show_bug.cgi?id=40052 + + Add WebThemeEngineDRT and WebThemeControlDRT ported from Chromium rev. 48907 + + * DumpRenderTree/DumpRenderTree.gypi: + * DumpRenderTree/chromium/TestShellWin.cpp: + (platformInit): + * DumpRenderTree/chromium/WebThemeControlDRT.cpp: Added. + (WebKit::): + (WebKit::WebThemeControlDRT::WebThemeControlDRT): + (WebKit::WebThemeControlDRT::~WebThemeControlDRT): + (WebKit::WebThemeControlDRT::box): + (WebKit::WebThemeControlDRT::line): + (WebKit::WebThemeControlDRT::triangle): + (WebKit::WebThemeControlDRT::roundRect): + (WebKit::WebThemeControlDRT::oval): + (WebKit::WebThemeControlDRT::circle): + (WebKit::WebThemeControlDRT::nestedBoxes): + (WebKit::WebThemeControlDRT::markState): + (WebKit::WebThemeControlDRT::draw): + (WebKit::WebThemeControlDRT::drawTextField): + (WebKit::WebThemeControlDRT::drawProgressBar): + * DumpRenderTree/chromium/WebThemeControlDRT.h: Added. + (WebKit::WebThemeControlDRT::): + * DumpRenderTree/chromium/WebThemeEngineDRT.cpp: Added. + (WebKit::): + (WebKit::WebThemeEngineDRT::paintButton): + (WebKit::WebThemeEngineDRT::paintMenuList): + (WebKit::WebThemeEngineDRT::paintScrollbarArrow): + (WebKit::WebThemeEngineDRT::paintScrollbarThumb): + (WebKit::WebThemeEngineDRT::paintScrollbarTrack): + (WebKit::WebThemeEngineDRT::paintTextField): + (WebKit::WebThemeEngineDRT::paintTrackbar): + (WebKit::WebThemeEngineDRT::paintProgressBar): + * DumpRenderTree/chromium/WebThemeEngineDRT.h: Added. + (WebKit::WebThemeEngineDRT::WebThemeEngineDRT): + +2010-06-08 Sheriff Bot + + Unreviewed, rolling out r60878. + http://trac.webkit.org/changeset/60878 + https://bugs.webkit.org/show_bug.cgi?id=40349 + + broke linux build (Requested by tony^work on #webkit). + + * Scripts/webkitdirs.pm: + * Scripts/webkitpy/layout_tests/port/chromium_linux.py: + +2010-06-08 Tony Chang + + Reviewed by David Levin. + + [chromium] compile linux chromium in WebKit/out instead of WebKit/WebKit/chromium/out + https://bugs.webkit.org/show_bug.cgi?id=40285 + + * Scripts/webkitdirs.pm: + * Scripts/webkitpy/layout_tests/port/chromium_linux.py: + +2010-06-08 Kenneth Russell + + Unreviewed, build fix. + + Fix build breakage from 38145 + https://bugs.webkit.org/show_bug.cgi?id=40346 + + The fix for bug 38145 broke the Chromium Win build because + Microsoft's cmath doesn't define log2. Suggested fix by zmo is to + change log2(x) to log(x) / log(2). Built and ran WebGL layout + tests in Safari on Mac OS X. Changed download mirrors for + python-irclib to working ones. + + * Scripts/webkitpy/thirdparty/__init__.py: + +2010-06-08 Fumitoshi Ukai + + Reviewed by Eric Seidel. + + old-run-webkit-tests should use ensure-valid-python to check if it can run the websockets tests + https://bugs.webkit.org/show_bug.cgi?id=39058 + + * Scripts/old-run-webkit-tests: + use sourceDir() to find ensure-valid-python in checkPythonVersion() + +2010-06-08 Andras Becsi + + Unreviewed buildfix after r60479. + + [GTK] Move the declaration of getRootCoords higher up to fix the build on GTK + versions other than 2.17.3. + + * DumpRenderTree/gtk/EventSender.cpp: + (getRootCoords): + +2010-06-07 Martin Robinson + + Reviewed by Oliver Hunt. + + [GTK] Mouse movement should not trigger a replay of saved events in the event sender + https://bugs.webkit.org/show_bug.cgi?id=40267 + + When a mouse button is down, automatically queue mouse motion events and + do not play them back until the mouse button is released. This matches the + behavior of other ports' EventSenders. + + * DumpRenderTree/gtk/EventSender.cpp: + (mouseMoveToCallback): Don't automatically replaySavedEvents for mouse motion. + (sendOrQueueEvent): Add a shouldReplaySavedEvents argument defaulting to true. + +2010-06-07 Nikolas Zimmermann + + Reviewed by Sam Weinig. + + Add CPP bindings generator + https://bugs.webkit.org/show_bug.cgi?id=38279 + + Integrate CPP bindings in run-bindings-tests. + + * Scripts/run-bindings-tests: + +2010-06-04 Tony Gentilcore + + Reviewed by Ojan Vafai. + + Rename 'svn_merge_base' -> 'remote_merge_base'. This was left out of r60633. + https://bugs.webkit.org/show_bug.cgi?id=40183 + + * Scripts/webkitpy/tool/steps/preparechangelog.py: + +2010-06-04 Martin Robinson + + Unreviewed. + + Add my new email and IRC nick to committers.py. + + * Scripts/webkitpy/common/config/committers.py: + +2010-06-04 Kinuko Yasuda + + Unreviewed. + + Revert changes in json_results_generator.py's _get_svn_revision. + + * Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py: + +2010-06-04 Martin Robinson + + Reviewed by Xan Lopez. + + [GTK] GtkLauncher should support relative file paths + https://bugs.webkit.org/show_bug.cgi?id=39944 + + Allow GtkLauncher to handle relative file paths passed via command-line arguments. + + * GtkLauncher/main.c: + (filename_to_url): Added. + (main): Try to resolve arguments as relative file URLs first. + +2010-06-04 Martin Robinson + + Reviewed by Xan Lopez. + + [GTK] EventSender should call gtk_main_do_event instead of invoking signal handlers directly + https://bugs.webkit.org/show_bug.cgi?id=40182 + + Instead of invoking signal handlers directly via g_signal_emit_by_name, call + gtk_main_do_event. This will allow us to call gtk_get_current_event() in WebKit + without breaking DRT. + + * DumpRenderTree/gtk/EventSender.cpp: + (dispatchEvent): Use gtk_main_do_event instead of invoking signal handlers directly. + (keyDownCallback): Use dispatchEvent here which now uses gtk_main_do_event. + +2010-06-04 Anders Carlsson + + Reviewed by David Hyatt. + + Make the editing/spelling/context-menu-suggestions.html test more robust + https://bugs.webkit.org/show_bug.cgi?id=40178 + + Change the contextClick method to return an array of strings describing the context menu items. + + * DumpRenderTree/mac/EventSendingController.mm: + (+[EventSendingController isSelectorExcludedFromWebScript:]): + (+[EventSendingController webScriptNameForSelector:]): + (-[EventSendingController contextClick]): + +2010-06-03 Kinuko Yasuda + + Reviewed by Shinichiro Hamaji. + + Clean up chromium-specific code from json_results_generator.py. + https://bugs.webkit.org/show_bug.cgi?id=39665 + + * 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/port/base.py: + * Scripts/webkitpy/layout_tests/port/chromium.py: + +2010-06-04 Tony Gentilcore + + Reviewed by Adam Barth. + + Utilize new takeFirst() method where appropriate. + https://bugs.webkit.org/show_bug.cgi?id=40089 + + * DumpRenderTree/chromium/EventSender.cpp: + (EventSender::replaySavedEvents): + * DumpRenderTree/chromium/LayoutTestController.cpp: + (LayoutTestController::WorkQueue::processWork): + (LayoutTestController::WorkQueue::reset): + +2010-06-04 Yael Aharon + + Reviewed by Simon Hausmann. + + [Qt] QtTestLauncher should allow notifications by default. + https://bugs.webkit.org/show_bug.cgi?id=40078 + + * QtTestBrowser/main.cpp: + (NotificationsPermissionController::NotificationsPermissionController): + (NotificationsPermissionController::checkPermission): + (NotificationsPermissionController::requestPermission): + (LauncherWindow::LauncherWindow): + +2010-06-04 Tony Gentilcore + + Reviewed by Adam Barth. + + Detect whether the user's environment can open a browser. + https://bugs.webkit.org/show_bug.cgi?id=40136 + + Some environments like cygwin silently fail webbrowser.open() causing + webkit-patch upload not to display any diff. This detects environments + where webbrowser.open() would fail by testing if webbrowser.get() + raises an exception. + + * Scripts/webkitpy/common/system/user.py: + * Scripts/webkitpy/tool/mocktool.py: + * Scripts/webkitpy/tool/steps/confirmdiff.py: + +2010-06-03 Tony Gentilcore + + Reviewed by David Levin. + + Add dependencies required to link with VS Express 2005. + https://bugs.webkit.org/show_bug.cgi?id=40038 + + Visual Studio implicitly links against these libs. + VC++ Express does not. + + * WebKitAPITest/WebKitAPITestCommon.vsprops: + * WinLauncher/WinLauncher.vcproj: + +2010-06-03 Fumitoshi Ukai + + Reviewed by David Levin. + + bad codecs.open in webkitpy/layout_tests/ports/websocket_server.py + https://bugs.webkit.org/show_bug.cgi?id=40105 + + * Scripts/webkitpy/layout_tests/port/websocket_server.py: + - kill pywebsocket process when url is not alive and the process is not + terminated, not to leave pywebsocket server running. + - fix codecs.open parameters. + +2010-06-03 Fumitoshi Ukai + + Reviewed by Alexey Proskuryakov. + + old-run-webkit-tests should use ensure-valid-python to check if it can run the websockets tests + https://bugs.webkit.org/show_bug.cgi?id=39058 + + * Scripts/ensure-valid-python: + - Perl 5.8 doesn't have File::Temp->newdir(). Use File::Temp->tempdir() instead. + - Add --check-only and --help option. + - --check-only option only checks python version and don't try to install Python 2.5. + - Set executable bit. + * Scripts/old-run-webkit-tests: + - Check if it can run the websocket tests by calling ensure-valid-python --check-only. + +2010-05-14 Ojan Vafai + + Reviewed by Adam Barth. + + add a RietveldUploadQueue to upload in-rietveld? patches to rietveld + https://bugs.webkit.org/show_bug.cgi?id=38918 + + Patches with in-rietveld? get uploaded to rietveld and get marked + in-rietveld+. If the upload fails, they are marked in-rietveld- + and an error is logged to the bug, like the commit-queue. + + Also, get rid of --fancy-review and the ability to upload to rietveld + using webkit-patch upload/post. + + * Scripts/webkitpy/common/net/bugzilla.py: + * Scripts/webkitpy/common/net/bugzilla_unittest.py: + * Scripts/webkitpy/tool/commands/download.py: + * Scripts/webkitpy/tool/commands/download_unittest.py: + * Scripts/webkitpy/tool/commands/queues.py: + * Scripts/webkitpy/tool/commands/queues_unittest.py: + * Scripts/webkitpy/tool/commands/upload.py: + * Scripts/webkitpy/tool/commands/upload_unittest.py: + * Scripts/webkitpy/tool/mocktool.py: + * Scripts/webkitpy/tool/steps/options.py: + * Scripts/webkitpy/tool/steps/postcodereview.py: + +2010-05-24 Ojan Vafai + + Reviewed by Chris Jerdonek. + + many webkit-patch commands fail in a non-svn tracking git checkout + https://bugs.webkit.org/show_bug.cgi?id=38156 + + If the svn-tracking-branch (trunk) doesn't exist, fallback to the git remote-tracking-branch (master). + If neither exists, then error out. This makes webkit-patch work + for anyone that follows the intructions at http://trac.webkit.org/wiki/UsingGitWithWebKit + to checkout webkit. The fallback to master is for people who don't + do the steps on that page for tracking svn. + + * Scripts/webkitpy/common/checkout/scm.py: + * Scripts/webkitpy/common/checkout/scm_unittest.py: + +2010-06-03 Mike Fenton + + Unreviewed. + + Reverse e-mail for myself in committers.py to correspond with bugzilla account. + + * Scripts/webkitpy/common/config/committers.py: + +2010-06-03 Pavel Feldman + + Reviewed by Yury Semikhatsky. + + Web Inspector: a number of fixes that make InspectorController + happy with null redirects. + + https://bugs.webkit.org/show_bug.cgi?id=40109 + + * DumpRenderTree/gtk/DumpRenderTree.cpp: + (runTest): + * DumpRenderTree/mac/DumpRenderTree.mm: + (runTest): + * DumpRenderTree/win/DumpRenderTree.cpp: + (runTest): + +2010-06-02 Tasuku Suzuki + + Reviewed by Shinichiro Hamaji. + + [Qt] Fix compilation with QT_NO_PROPERTIES + https://bugs.webkit.org/show_bug.cgi?id=38324 + + * QtTestBrowser/main.cpp: + (LauncherWindow::init): + +2010-06-02 Diego Gonzalez + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Make possible run DRT with QGraphicsWebView + https://bugs.webkit.org/show_bug.cgi?id=40016 + + Make possible to use a environment variable for switching backend. + Usage: QT_DRT_WEBVIEW_MODE=graphics WebKitTools/Scripts/run-webkit-tests --qt + + * DumpRenderTree/qt/DumpRenderTreeQt.cpp: + (WebCore::WebViewGraphicsBased::WebViewGraphicsBased): + (WebCore::DumpRenderTree::DumpRenderTree): + * DumpRenderTree/qt/DumpRenderTreeQt.h: + (WebCore::DumpRenderTree::setGraphicsBased): + (WebCore::DumpRenderTree::isGraphicsBased): + (WebCore::WebViewGraphicsBased::graphicsView): + (WebCore::WebViewGraphicsBased::setPage): + * Scripts/old-run-webkit-tests: + +2010-06-02 Csaba Osztrogonác + + Reviewed by Eric Seidel. + + Slave lost shouldn't be recognized as build failed. + https://bugs.webkit.org/show_bug.cgi?id=39282 + + * Scripts/webkitpy/common/net/buildbot.py: Treat slave lost as green. + * Scripts/webkitpy/common/net/buildbot_unittest.py: Add unit test for slave lost. + +2010-06-01 Yael Aharon + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Fix the lifecycle of notification objects + https://bugs.webkit.org/show_bug.cgi?id=40003 + + Remove the dependency of notifications on QWebPage. + + * DumpRenderTree/qt/DumpRenderTreeQt.cpp: + (WebCore::requestPermissionCallback): + (WebCore::WebPage::WebPage): + (WebCore::DumpRenderTree::requestPermission): + * DumpRenderTree/qt/DumpRenderTreeQt.h: + +2010-06-02 Sheriff Bot + + Unreviewed, rolling out r60559. + http://trac.webkit.org/changeset/60559 + https://bugs.webkit.org/show_bug.cgi?id=40055 + + It broke python unit test (Requested by Ossy on #webkit). + + * Scripts/webkitpy/common/net/buildbot.py: + +2010-06-02 Csaba Osztrogonác + + Reviewed by Eric Seidel. + + Slave lost shouldn't be recognized as build failed. + https://bugs.webkit.org/show_bug.cgi?id=39282 + + * Scripts/webkitpy/common/net/buildbot.py: + +2010-06-02 Tony Gentilcore + + Reviewed by Eric Seidel. + + Fix crash caused when assigned_to is disabled + https://bugs.webkit.org/show_bug.cgi?id=40039 + + * Scripts/webkitpy/common/net/bugzilla.py: + +2010-06-02 Sterling Swigart + + Reviewed by David Levin. + + Image Resizer Patch 0: Added compilation argument to conditionally compile pending patches. + https://bugs.webkit.org/show_bug.cgi?id=39906 + + * Scripts/build-webkit: + +2010-06-01 Raine Makelainen + + Reviewed by Simon Hausmann. + + Fixed tests to use QWebSettings::JavascriptCanAccessClipboard instead of QWebSettings::JavaScriptCanAccessClipboard. + + * DumpRenderTree/qt/DumpRenderTreeQt.cpp: + (WebCore::WebPage::WebPage): + (WebCore::WebPage::resetSettings): + * DumpRenderTree/qt/LayoutTestControllerQt.cpp: + (LayoutTestController::setJavaScriptCanAccessClipboard): + +2010-06-01 Alexey Proskuryakov + + Reviewed by Mark Rowe. + + A nicer Tiger build fix. + + * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj: + * DumpRenderTree/mac/Configurations/Base.xcconfig: + Enable GCC_OBJC_CALL_CXX_CDTORS via .xcconfig. + +2010-06-01 Alexey Proskuryakov + + A real Tiger build fix. + + * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj: Enable GCC_OBJC_CALL_CXX_CDTORS + for all configurations, not just debug. + +2010-06-01 Alexey Proskuryakov + + Tiger build fix. + + * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj: Enable GCC_OBJC_CALL_CXX_CDTORS. + +2010-06-01 Martin Robinson + + Reviewed by Xan Lopez. + + [GTK] Get more mouse tests passing + https://bugs.webkit.org/show_bug.cgi?id=39040 + + Reproduce the logic from the Windows EventSender for mapping + button numbers to GDK button numbers. Move this logic to the + prepareMouseButtonEvent helper. + + * DumpRenderTree/gtk/EventSender.cpp: + (prepareMouseButtonEvent): Reproduce Windows logic. + (contextClickCallback): Move mapping logic to prepareMouseButtonEvent. + (mouseDownCallback): Ditto. + (mouseUpCallback): Ditto. + +2010-06-01 Alexey Proskuryakov + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=39434 + REGRESSION (r59811): Geolocation callbacks cannot be created + + * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj: Added MockGeolocationProvider. + + * DumpRenderTree/mac/DumpRenderTree.mm: + (createWebViewAndOffscreenWindow): Tell the view to use MockGeolocationProvider. + (resetWebViewToConsistentStateBeforeTesting): Make sure that mock notifications don't leak + into subsequent tests. + + * DumpRenderTree/mac/LayoutTestControllerMac.mm: + (LayoutTestController::setMockGeolocationPosition): Changed to use MockGeolocationProvider. + (LayoutTestController::setMockGeolocationError): Ditto. + + * DumpRenderTree/mac/MockGeolocationProvider.h: Added. + * DumpRenderTree/mac/MockGeolocationProvider.mm: Added. + (+[MockGeolocationProvider shared]): + (-[MockGeolocationProvider dealloc]): + (-[MockGeolocationProvider setPosition:]): + (-[MockGeolocationProvider setError:]): + (-[MockGeolocationProvider registerWebView:]): + (-[MockGeolocationProvider unregisterWebView:]): + (-[MockGeolocationProvider lastPosition]): + (-[MockGeolocationProvider stopTimer]): + (-[MockGeolocationProvider timerFired]): + + * DumpRenderTree/mac/UIDelegate.mm: + (-[UIDelegate webView:decidePolicyForGeolocationRequestFromOrigin:frame:listener:]): + This delegate method must send a response. I'm not sure what the two-stage check is supposed + to achieve, it seems unnecessary. + +2010-05-12 Martin Robinson + + Reviewed by Xan Lopez. + + [GTK] Double clicks cause three button press events + https://bugs.webkit.org/show_bug.cgi?id=38853 + + WebKit now filters the extra GDK_BUTTON_PRESS before GDK_2BUTTON_PRESS + and GDK_3BUTTON_PRESS via gdk_event_peek(). Since EventSender bypasses + the GDK event queue entirely, we simply do not send the extra event. + + * DumpRenderTree/gtk/EventSender.cpp: + (mouseDownCallback): Do not send extra event. Send GDK_3BUTTON_PRESS appropriately. + (dispatchEvent): Properly handle GDK_3BUTTON_PRESS. + +2010-06-01 Martin Robinson + + Not reviewed. Build fix. + + Fix GTK+ build caused by a bad merge. + + * DumpRenderTree/gtk/EventSender.cpp: + (prepareMouseButtonEvent): Use the GdkEvent union as a pointer here. + +2010-06-01 Martin Robinson + + Reviewed by Xan Lopez. + + [GTK] Double clicks cause three button press events + https://bugs.webkit.org/show_bug.cgi?id=38853 + + Small EventSender cleanups. Consolidate some common code. Style fixes. + + * DumpRenderTree/gtk/EventSender.cpp: + (prepareMouseButtonEvent): Added. + (contextClickCallback): Use prepareMouseButtonEvent. + (mouseDownCallback): Use prepareMouseButtonEvent. + (mouseUpCallback): Use prepareMouseButtonEvent. + (mouseMoveToCallback): Small style fix. + +2010-06-01 Martin Robinson + + Reviewed by Xan Lopez. + + [GTK] Double clicks cause three button press events + https://bugs.webkit.org/show_bug.cgi?id=38853 + + Add rudimentary leapForward support to the GTK+ DRT. leapForward allows a test + to pause for a specified amount of time. It is used in the processing of drag- + -and-drop data as well as to separate distinct mouse double-clicks in some tests. + This patch enables tests that rely on the latter behavior to pass. + + * DumpRenderTree/gtk/DumpRenderTree.cpp: + (webViewWindowObjectCleared): Only initialize the EventSender when loading the top frame. + * DumpRenderTree/gtk/EventSender.cpp: + (leapForwardCallback): Add support for adjusting the time offset on leapForward(). + (contextClickCallback): Use sendOrQueueEvent. + (updateClickCount): Take the time offset into account when counting clicks. + (mouseDownCallback): Use sendOrQueueEvent. + (getStateFlags): Change down/currentEventButton into buttonCurrentlyDown/lastClickButton. + (mouseUpCallback): Use sendOrQueueEvent. + (mouseMoveToCallback): Ditto. + (mouseWheelToCallback): Ditto. + (sendOrQueueEvent): Added. + (dispatchEvent): Added. + (replaySavedEvents): Pause when an event has a delay and defer to dispatchEvent. + (makeEventSender): Only initialize the EventSender when loading the top frame. + * DumpRenderTree/gtk/EventSender.h: Ditto. + +2010-06-01 Martin Robinson + + Reviewed by Xan Lopez. + + [GTK] css1/color_and_background/background_attachment.html fails on the 32-bit debug bot + https://bugs.webkit.org/show_bug.cgi?id=39101 + + Work around timing issues for render tree dumps by pumping the + main loop before doing the dump. Resize events are asynchronous + in GTK+, so sometimes resize requests are still pending when DRT + dumps the tree. + + * DumpRenderTree/gtk/DumpRenderTree.cpp: + (dump): Pump the main loop before dumping the render tree. + 2010-05-31 Kent Tamura Reviewed by Dimitri Glazkov. diff --git a/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp b/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp index 9cf34de..c4d5e6f 100644 --- a/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp +++ b/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp @@ -171,6 +171,15 @@ static JSValueRef childAtIndexCallback(JSContextRef context, JSObjectRef functio return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->getChildAtIndex(indexNumber)); } +static JSValueRef linkedUIElementAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + int indexNumber = -1; + if (argumentCount == 1) + indexNumber = JSValueToNumber(context, arguments[0], exception); + + return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->linkedUIElementAtIndex(indexNumber)); +} + static JSValueRef disclosedRowAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { int indexNumber = 0; @@ -703,6 +712,7 @@ JSClassRef AccessibilityUIElement::getJSClass() { "boundsForRange", boundsForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "stringForRange", stringForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "childAtIndex", childAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "linkedUIElementAtIndex", linkedUIElementAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "indexOfChild", indexOfChildCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "elementAtPoint", elementAtPointCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "attributesOfColumnHeaders", attributesOfColumnHeadersCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, diff --git a/WebKitTools/DumpRenderTree/AccessibilityUIElement.h b/WebKitTools/DumpRenderTree/AccessibilityUIElement.h index f62ec1a..2a06962 100644 --- a/WebKitTools/DumpRenderTree/AccessibilityUIElement.h +++ b/WebKitTools/DumpRenderTree/AccessibilityUIElement.h @@ -91,6 +91,8 @@ public: // Methods - platform-independent implementations JSStringRef allAttributes(); JSStringRef attributesOfLinkedUIElements(); + AccessibilityUIElement linkedUIElementAtIndex(unsigned); + JSStringRef attributesOfDocumentLinks(); JSStringRef attributesOfChildren(); JSStringRef parameterizedAttributeNames(); diff --git a/WebKitTools/DumpRenderTree/DumpRenderTree.gypi b/WebKitTools/DumpRenderTree/DumpRenderTree.gypi index 280c8dd..5fc8dab 100644 --- a/WebKitTools/DumpRenderTree/DumpRenderTree.gypi +++ b/WebKitTools/DumpRenderTree/DumpRenderTree.gypi @@ -34,5 +34,15 @@ 'chromium/WebViewHost.cpp', 'chromium/WebViewHost.h', ], + 'conditions': [ + ['OS=="win"', { + 'drt_files': [ + 'chromium/WebThemeControlDRT.cpp', + 'chromium/WebThemeControlDRT.h', + 'chromium/WebThemeEngineDRT.cpp', + 'chromium/WebThemeEngineDRT.h', + ], + }], + ], } } diff --git a/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj b/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj index 3adfaf2..6a49b44 100644 --- a/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj +++ b/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj @@ -117,6 +117,8 @@ BCD08B3A0E1057EF00A7D0C1 /* AccessibilityController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD08B390E1057EF00A7D0C1 /* AccessibilityController.cpp */; }; BCD08B710E1059D200A7D0C1 /* AccessibilityControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCD08B700E1059D200A7D0C1 /* AccessibilityControllerMac.mm */; }; BCF6C6500C98E9C000AC063E /* GCController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCF6C64F0C98E9C000AC063E /* GCController.cpp */; }; + E1B7816511AF31B7007E1BC2 /* MockGeolocationProvider.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1B7808711AF1669007E1BC2 /* MockGeolocationProvider.mm */; }; + E1B7816711AF31C3007E1BC2 /* MockGeolocationProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = E1B7808511AF1643007E1BC2 /* MockGeolocationProvider.h */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -275,6 +277,8 @@ BCD08B390E1057EF00A7D0C1 /* AccessibilityController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityController.cpp; sourceTree = ""; }; BCD08B700E1059D200A7D0C1 /* AccessibilityControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AccessibilityControllerMac.mm; path = mac/AccessibilityControllerMac.mm; sourceTree = ""; }; BCF6C64F0C98E9C000AC063E /* GCController.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = GCController.cpp; sourceTree = ""; }; + E1B7808511AF1643007E1BC2 /* MockGeolocationProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MockGeolocationProvider.h; path = mac/MockGeolocationProvider.h; sourceTree = ""; }; + E1B7808711AF1669007E1BC2 /* MockGeolocationProvider.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MockGeolocationProvider.mm; path = mac/MockGeolocationProvider.mm; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -378,6 +382,8 @@ BC0131D80C9772010087317D /* LayoutTestController.cpp */, BC0131D90C9772010087317D /* LayoutTestController.h */, BCA18B220C9B014B00114369 /* LayoutTestControllerMac.mm */, + E1B7808511AF1643007E1BC2 /* MockGeolocationProvider.h */, + E1B7808711AF1669007E1BC2 /* MockGeolocationProvider.mm */, BCA18B6D0C9B08DB00114369 /* NavigationController.h */, BCA18B6E0C9B08DB00114369 /* NavigationController.m */, BCA18B2F0C9B01B400114369 /* ObjCController.h */, @@ -546,6 +552,7 @@ BC9D90250C97472E0099A4A3 /* WorkQueue.h in Headers */, BC9D90260C97472E0099A4A3 /* WorkQueueItem.h in Headers */, 5185F6B310714E12007AA393 /* HistoryDelegate.h in Headers */, + E1B7816711AF31C3007E1BC2 /* MockGeolocationProvider.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -712,6 +719,7 @@ BC9D90240C97472E0099A4A3 /* WorkQueue.cpp in Sources */, BCA18B260C9B015C00114369 /* WorkQueueItemMac.mm in Sources */, 5185F6B210714E07007AA393 /* HistoryDelegate.mm in Sources */, + E1B7816511AF31B7007E1BC2 /* MockGeolocationProvider.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/WebKitTools/DumpRenderTree/chromium/EventSender.cpp b/WebKitTools/DumpRenderTree/chromium/EventSender.cpp index 381112e..7695095 100644 --- a/WebKitTools/DumpRenderTree/chromium/EventSender.cpp +++ b/WebKitTools/DumpRenderTree/chromium/EventSender.cpp @@ -716,8 +716,7 @@ void EventSender::replaySavedEvents() { replayingSavedEvents = true; while (!mouseEventQueue.isEmpty()) { - SavedEvent e = mouseEventQueue.first(); - mouseEventQueue.removeFirst(); + SavedEvent e = mouseEventQueue.takeFirst(); switch (e.type) { case SavedEvent::MouseMove: { diff --git a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp index b4e3764..89e16e0 100644 --- a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp +++ b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp @@ -201,8 +201,7 @@ void LayoutTestController::WorkQueue::processWork() // Quit doing work once a load is in progress. while (!m_queue.isEmpty()) { bool startedLoad = m_queue.first()->run(shell); - delete m_queue.first(); - m_queue.removeFirst(); + delete m_queue.takeFirst(); if (startedLoad) return; } @@ -215,8 +214,7 @@ void LayoutTestController::WorkQueue::reset() { m_frozen = false; while (!m_queue.isEmpty()) { - delete m_queue.first(); - m_queue.removeFirst(); + delete m_queue.takeFirst(); } } diff --git a/WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp b/WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp index 3884e94..a9ca6a9 100644 --- a/WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp +++ b/WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "TestShell.h" +#include "WebThemeEngineDRT.h" #include "webkit/support/webkit_support.h" #include #include @@ -38,6 +39,9 @@ #include #include +// Theme engine +static WebThemeEngineDRT themeEngine; + // Thread main to run for the thread which just tests for timeout. unsigned int __stdcall watchDogThread(void* arg) { @@ -105,6 +109,9 @@ void platformInit() _setmode(_fileno(stdout), _O_BINARY); _setmode(_fileno(stderr), _O_BINARY); + // Set theme engine. + webkit_support::SetThemeEngine(&themeEngine); + // Load Ahem font. // AHEM____.TTF is copied to the directory of DumpRenderTree.exe by WebKit.gyp. WCHAR path[_MAX_PATH]; diff --git a/WebKitTools/DumpRenderTree/chromium/WebThemeControlDRT.cpp b/WebKitTools/DumpRenderTree/chromium/WebThemeControlDRT.cpp new file mode 100755 index 0000000..df12476 --- /dev/null +++ b/WebKitTools/DumpRenderTree/chromium/WebThemeControlDRT.cpp @@ -0,0 +1,518 @@ +/* + * 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 file implements a simple generic version of the WebThemeEngine, +// which is used to draw all the native controls on a web page. We use this +// file when running in layout test mode in order to remove any +// platform-specific rendering differences due to themes, colors, etc. +// + +#include "config.h" +#include "WebThemeControlDRT.h" + +#include "skia/ext/platform_canvas.h" +#include "skia/ext/skia_utils_win.h" +#include "third_party/skia/include/core/SkPaint.h" +#include "third_party/skia/include/core/SkPath.h" +#include "third_party/skia/include/core/SkRect.h" + +#include + +using namespace std; +using namespace skia; + +static const SkColor edgeColor = SK_ColorBLACK; +static const SkColor readOnlyColor = SkColorSetRGB(0xe9, 0xc2, 0xa6); +static const SkColor fgColor = SK_ColorBLACK; +static const SkColor bgColors[] = { + SK_ColorBLACK, // Unknown + SkColorSetRGB(0xc9, 0xc9, 0xc9), // Disabled + SkColorSetRGB(0xf3, 0xe0, 0xd0), // Readonly + SkColorSetRGB(0x89, 0xc4, 0xff), // Normal + SkColorSetRGB(0x43, 0xf9, 0xff), // Hot + SkColorSetRGB(0x20, 0xf6, 0xcc), // Focused + SkColorSetRGB(0x00, 0xf3, 0xac), // Hover + SkColorSetRGB(0xa9, 0xff, 0x12), // Pressed + SkColorSetRGB(0xcc, 0xcc, 0xcc) // Indeterminate +}; + +static SkIRect validate(const SkIRect& rect, WebThemeControlDRT::Type ctype) +{ + switch (ctype) { + case WebThemeControlDRT::UncheckedBoxType: + case WebThemeControlDRT::CheckedBoxType: + case WebThemeControlDRT::UncheckedRadioType: + case WebThemeControlDRT::CheckedRadioType: { + SkIRect retval = rect; + + // The maximum width and height is 13. + // Center the square in the passed rectangle. + const int maxControlSize = 13; + int controlSize = min(rect.width(), rect.height()); + controlSize = min(controlSize, maxControlSize); + + retval.fLeft = rect.fLeft + (rect.width() / 2) - (controlSize / 2); + retval.fRight = retval.fLeft + controlSize - 1; + retval.fTop = rect.fTop + (rect.height() / 2) - (controlSize / 2); + retval.fBottom = retval.fTop + controlSize - 1; + + return retval; + } + + default: + return rect; + } +} + +// WebThemeControlDRT + +WebThemeControlDRT::WebThemeControlDRT(PlatformCanvas* canvas, + const SkIRect& irect, + Type ctype, + State cstate) + : m_canvas(canvas) + , m_irect(validate(irect, ctype)) + , m_type(ctype) + , m_state(cstate) + , m_left(m_irect.fLeft) + , m_right(m_irect.fRight) + , m_top(m_irect.fTop) + , m_bottom(m_irect.fBottom) + , m_height(m_irect.height()) + , m_width(m_irect.width()) + , m_edgeColor(edgeColor) + , m_bgColor(bgColors[cstate]) + , m_fgColor(fgColor) +{ +} + +WebThemeControlDRT::~WebThemeControlDRT() +{ +} + +void WebThemeControlDRT::box(const SkIRect& rect, SkColor fillColor) +{ + SkPaint paint; + + paint.setStyle(SkPaint::kFill_Style); + paint.setColor(fillColor); + m_canvas->drawIRect(rect, paint); + + paint.setColor(m_edgeColor); + paint.setStyle(SkPaint::kStroke_Style); + m_canvas->drawIRect(rect, paint); +} + +void WebThemeControlDRT::line(int x0, int y0, int x1, int y1, SkColor color) +{ + SkPaint paint; + paint.setColor(color); + m_canvas->drawLine(SkIntToScalar(x0), SkIntToScalar(y0), + SkIntToScalar(x1), SkIntToScalar(y1), + paint); +} + +void WebThemeControlDRT::triangle(int x0, int y0, + int x1, int y1, + int x2, int y2, + SkColor color) +{ + SkPath path; + SkPaint paint; + + paint.setColor(color); + paint.setStyle(SkPaint::kFill_Style); + path.incReserve(4); + path.moveTo(SkIntToScalar(x0), SkIntToScalar(y0)); + path.lineTo(SkIntToScalar(x1), SkIntToScalar(y1)); + path.lineTo(SkIntToScalar(x2), SkIntToScalar(y2)); + path.close(); + m_canvas->drawPath(path, paint); + + paint.setColor(m_edgeColor); + paint.setStyle(SkPaint::kStroke_Style); + m_canvas->drawPath(path, paint); +} + +void WebThemeControlDRT::roundRect(SkColor color) +{ + SkRect rect; + SkScalar radius = SkIntToScalar(5); + SkPaint paint; + + rect.set(m_irect); + paint.setColor(color); + paint.setStyle(SkPaint::kFill_Style); + m_canvas->drawRoundRect(rect, radius, radius, paint); + + paint.setColor(m_edgeColor); + paint.setStyle(SkPaint::kStroke_Style); + m_canvas->drawRoundRect(rect, radius, radius, paint); +} + +void WebThemeControlDRT::oval(SkColor color) +{ + SkRect rect; + SkPaint paint; + + rect.set(m_irect); + paint.setColor(color); + paint.setStyle(SkPaint::kFill_Style); + m_canvas->drawOval(rect, paint); + + paint.setColor(m_edgeColor); + paint.setStyle(SkPaint::kStroke_Style); + m_canvas->drawOval(rect, paint); +} + +void WebThemeControlDRT::circle(SkScalar radius, SkColor color) +{ + SkScalar cy = SkIntToScalar(m_top + m_height / 2); + SkScalar cx = SkIntToScalar(m_left + m_width / 2); + SkPaint paint; + + paint.setColor(color); + paint.setStyle(SkPaint::kFill_Style); + m_canvas->drawCircle(cx, cy, radius, paint); + + paint.setColor(m_edgeColor); + paint.setStyle(SkPaint::kStroke_Style); + m_canvas->drawCircle(cx, cy, radius, paint); +} + +void WebThemeControlDRT::nestedBoxes(int indentLeft, + int indentTop, + int indentRight, + int indentBottom, + SkColor outerColor, + SkColor innerColor) +{ + SkIRect lirect; + box(m_irect, outerColor); + lirect.set(m_irect.fLeft + indentLeft, + m_irect.fTop + indentTop, + m_irect.fRight - indentRight, + m_irect.fBottom - indentBottom); + box(lirect, innerColor); +} + +void WebThemeControlDRT::markState() +{ + // The horizontal lines in a read only control are spaced by this amount. + const int readOnlyLineOffset = 5; + + // The length of a triangle side for the corner marks. + const int triangleSize = 5; + + switch (m_state) { + case UnknownState: + case DisabledState: + case NormalState: + // Don't visually mark these states (color is enough). + break; + case ReadOnlyState: + // Drawing lines across the control. + for (int i = m_top + readOnlyLineOffset; i < m_bottom; i += readOnlyLineOffset) + line(m_left + 1, i, m_right - 1, i, readOnlyColor); + break; + + case HotState: + // Draw a triangle in the upper left corner of the control. + triangle(m_left, m_top, + m_left + triangleSize, m_top, + m_left, m_top + triangleSize, m_edgeColor); + break; + + case HoverState: + // Draw a triangle in the upper right corner of the control. + triangle(m_right, m_top, + m_right, m_top + triangleSize, + m_right - triangleSize, m_top, m_edgeColor); + break; + + case FocusedState: + // Draw a triangle in the bottom right corner of the control. + triangle(m_right, m_bottom, + m_right - triangleSize, m_bottom, + m_right, m_bottom - triangleSize, m_edgeColor); + break; + + case PressedState: + // Draw a triangle in the bottom left corner of the control. + triangle(m_left, m_bottom, + m_left, m_bottom - triangleSize, + m_left + triangleSize, m_bottom, m_edgeColor); + break; + + default: + ASSERT_NOT_REACHED(); + CRASH(); + break; + } +} + +void WebThemeControlDRT::draw() +{ + int halfWidth = m_width / 2; + int halfHeight = m_height / 2; + int quarterWidth = m_width / 4; + int quarterHeight = m_height / 4; + + // Indent amounts for the check in a checkbox or radio button. + const int checkIndent = 3; + + // Indent amounts for short and long sides of the scrollbar notches. + const int notchLongOffset = 1; + const int notchShortOffset = 4; + const int noOffset = 0; + + // Indent amounts for the short and long sides of a scroll thumb box. + const int thumbLongIndent = 0; + const int thumbShortIndent = 2; + + // Indents for the crosshatch on a scroll grip. + const int gripLongIndent = 3; + const int gripShortIndent = 5; + + // Indents for the the slider track. + const int sliderIndent = 2; + + m_canvas->beginPlatformPaint(); + + switch (m_type) { + case UnknownType: + ASSERT_NOT_REACHED(); + CRASH(); + break; + + case TextFieldType: + // We render this by hand outside of this function. + ASSERT_NOT_REACHED(); + CRASH(); + break; + + case PushButtonType: + // push buttons render as a rounded rectangle + roundRect(m_bgColor); + break; + + case UncheckedBoxType: + // Unchecked boxes are simply plain boxes. + box(m_irect, m_bgColor); + break; + + case CheckedBoxType: + nestedBoxes(checkIndent, checkIndent, checkIndent, checkIndent, m_bgColor, m_fgColor); + break; + + case UncheckedRadioType: + circle(SkIntToScalar(halfHeight), m_bgColor); + break; + + case CheckedRadioType: + circle(SkIntToScalar(halfHeight), m_bgColor); + circle(SkIntToScalar(halfHeight - checkIndent), m_fgColor); + break; + + case HorizontalScrollTrackBackType: { + // Draw a box with a notch at the left. + int longOffset = halfHeight - notchLongOffset; + int shortOffset = m_width - notchShortOffset; + nestedBoxes(noOffset, longOffset, shortOffset, longOffset, m_bgColor, m_edgeColor); + break; + } + + case HorizontalScrollTrackForwardType: { + // Draw a box with a notch at the right. + int longOffset = halfHeight - notchLongOffset; + int shortOffset = m_width - notchShortOffset; + nestedBoxes(shortOffset, longOffset, noOffset, longOffset, m_bgColor, m_fgColor); + break; + } + + case VerticalScrollTrackBackType: { + // Draw a box with a notch at the top. + int longOffset = halfWidth - notchLongOffset; + int shortOffset = m_height - notchShortOffset; + nestedBoxes(longOffset, noOffset, longOffset, shortOffset, m_bgColor, m_fgColor); + break; + } + + case VerticalScrollTrackForwardType: { + // Draw a box with a notch at the bottom. + int longOffset = halfWidth - notchLongOffset; + int shortOffset = m_height - notchShortOffset; + nestedBoxes(longOffset, shortOffset, longOffset, noOffset, m_bgColor, m_fgColor); + break; + } + + case HorizontalScrollThumbType: + // Draw a narrower box on top of the outside box. + nestedBoxes(thumbLongIndent, thumbShortIndent, thumbLongIndent, thumbShortIndent, m_bgColor, m_bgColor); + break; + + case VerticalScrollThumbType: + // Draw a shorter box on top of the outside box. + nestedBoxes(thumbShortIndent, thumbLongIndent, thumbShortIndent, thumbLongIndent, m_bgColor, m_bgColor); + break; + + case HorizontalSliderThumbType: + // Slider thumbs are ovals. + oval(m_bgColor); + break; + + case HorizontalScrollGripType: { + // Draw a horizontal crosshatch for the grip. + int longOffset = halfWidth - gripLongIndent; + line(m_left + gripLongIndent, m_top + halfHeight, + m_right - gripLongIndent, m_top + halfHeight, m_fgColor); + line(m_left + longOffset, m_top + gripShortIndent, + m_left + longOffset, m_bottom - gripShortIndent, m_fgColor); + line(m_right - longOffset, m_top + gripShortIndent, + m_right - longOffset, m_bottom - gripShortIndent, m_fgColor); + break; + } + + case VerticalScrollGripType: { + // Draw a vertical crosshatch for the grip. + int longOffset = halfHeight - gripLongIndent; + line(m_left + halfWidth, m_top + gripLongIndent, + m_left + halfWidth, m_bottom - gripLongIndent, m_fgColor); + line(m_left + gripShortIndent, m_top + longOffset, + m_right - gripShortIndent, m_top + longOffset, m_fgColor); + line(m_left + gripShortIndent, m_bottom - longOffset, + m_right - gripShortIndent, m_bottom - longOffset, m_fgColor); + break; + } + + case LeftArrowType: + // Draw a left arrow inside a box. + box(m_irect, m_bgColor); + triangle(m_right - quarterWidth, m_top + quarterHeight, + m_right - quarterWidth, m_bottom - quarterHeight, + m_left + quarterWidth, m_top + halfHeight, m_fgColor); + break; + + case RightArrowType: + // Draw a left arrow inside a box. + box(m_irect, m_bgColor); + triangle(m_left + quarterWidth, m_top + quarterHeight, + m_right - quarterWidth, m_top + halfHeight, + m_left + quarterWidth, m_bottom - quarterHeight, m_fgColor); + break; + + case UpArrowType: + // Draw an up arrow inside a box. + box(m_irect, m_bgColor); + triangle(m_left + quarterWidth, m_bottom - quarterHeight, + m_left + halfWidth, m_top + quarterHeight, + m_right - quarterWidth, m_bottom - quarterHeight, m_fgColor); + break; + + case DownArrowType: + // Draw a down arrow inside a box. + box(m_irect, m_bgColor); + triangle(m_left + quarterWidth, m_top + quarterHeight, + m_right - quarterWidth, m_top + quarterHeight, + m_left + halfWidth, m_bottom - quarterHeight, m_fgColor); + break; + + case HorizontalSliderTrackType: { + // Draw a narrow rect for the track plus box hatches on the ends. + SkIRect lirect; + lirect = m_irect; + lirect.inset(noOffset, halfHeight - sliderIndent); + box(lirect, m_bgColor); + line(m_left, m_top, m_left, m_bottom, m_edgeColor); + line(m_right, m_top, m_right, m_bottom, m_edgeColor); + break; + } + + case DropDownButtonType: + // Draw a box with a big down arrow on top. + box(m_irect, m_bgColor); + triangle(m_left + quarterWidth, m_top, + m_right - quarterWidth, m_top, + m_left + halfWidth, m_bottom, m_fgColor); + break; + + default: + ASSERT_NOT_REACHED(); + CRASH(); + break; + } + + markState(); + m_canvas->endPlatformPaint(); +} + +// Because rendering a text field is dependent on input +// parameters the other controls don't have, we render it directly +// rather than trying to overcomplicate draw() further. +void WebThemeControlDRT::drawTextField(bool drawEdges, bool fillContentArea, SkColor color) +{ + SkPaint paint; + + m_canvas->beginPlatformPaint(); + if (fillContentArea) { + paint.setColor(color); + paint.setStyle(SkPaint::kFill_Style); + m_canvas->drawIRect(m_irect, paint); + } + if (drawEdges) { + paint.setColor(m_edgeColor); + paint.setStyle(SkPaint::kStroke_Style); + m_canvas->drawIRect(m_irect, paint); + } + + markState(); + m_canvas->endPlatformPaint(); +} + +void WebThemeControlDRT::drawProgressBar(const SkIRect& fillRect) +{ + SkPaint paint; + + m_canvas->beginPlatformPaint(); + paint.setColor(m_bgColor); + paint.setStyle(SkPaint::kFill_Style); + m_canvas->drawIRect(m_irect, paint); + + // Emulate clipping + SkIRect tofill; + tofill.intersect(m_irect, fillRect); + paint.setColor(m_fgColor); + paint.setStyle(SkPaint::kFill_Style); + m_canvas->drawIRect(tofill, paint); + + markState(); + m_canvas->endPlatformPaint(); +} + diff --git a/WebKitTools/DumpRenderTree/chromium/WebThemeControlDRT.h b/WebKitTools/DumpRenderTree/chromium/WebThemeControlDRT.h new file mode 100755 index 0000000..1f73610 --- /dev/null +++ b/WebKitTools/DumpRenderTree/chromium/WebThemeControlDRT.h @@ -0,0 +1,202 @@ +/* + * 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. + */ + +// WebThemeControlDRT implements the generic rendering of controls +// needed by WebThemeEngineDRT. See the comments in that class +// header file for why this class is needed and used. +// +// This class implements a generic set of widgets using Skia. The widgets +// are optimized for testability, not a pleasing appearance. +// + +#ifndef WebThemeControlDRT_h +#define WebThemeControlDRT_h + +#include "skia/ext/platform_canvas.h" +#include "third_party/skia/include/core/SkColor.h" +#include + +// Skia forward declarations +struct SkIRect; + +class WebThemeControlDRT : public Noncopyable { +public: + // This list of states mostly mirrors the list in WebCore/platform/ThemeTypes.h + // but is maintained separately since that isn't public and also to minimize + // dependencies. + // Note that the WebKit ThemeTypes seem to imply that a control can be + // in multiple states simultaneously but WebThemeEngine only allows for + // a single state at a time. + // + // Some definitions for the various states: + // Disabled - indicates that a control can't be modified or selected + // (corresponds to HTML 'disabled' attribute) + // ReadOnly - indicates that a control can't be modified but can be + // selected + // Normal - the normal state of control on the page when it isn't + // focused or otherwise active + // Hot - when the mouse is hovering over a part of the control, + // all the other parts are considered "hot" + // Hover - when the mouse is directly over a control (the CSS + // :hover pseudo-class) + // Focused - when the control has the keyboard focus + // Pressed - when the control is being triggered (by a mousedown or + // a key event). + // Indeterminate - when set to indeterminate (only for progress bar) + enum State { + UnknownState = 0, + DisabledState, + ReadOnlyState, + NormalState, + HotState, + HoverState, + FocusedState, + PressedState, + IndeterminateState + }; + + // This list of types mostly mirrors the list in + // WebCore/platform/ThemeTypes.h but is maintained + // separately since that isn't public and also to minimize dependencies. + // + // Note that what the user might think of as a single control can be + // made up of multiple parts. For example, a single scroll bar contains + // six clickable parts - two arrows, the "thumb" indicating the current + // position on the bar, the other two parts of the bar (before and after + // the thumb) and the "gripper" on the thumb itself. + // + enum Type { + UnknownType = 0, + TextFieldType, + PushButtonType, + UncheckedBoxType, + CheckedBoxType, + UncheckedRadioType, + CheckedRadioType, + HorizontalScrollTrackBackType, + HorizontalScrollTrackForwardType, + HorizontalScrollThumbType, + HorizontalScrollGripType, + VerticalScrollTrackBackType, + VerticalScrollTrackForwardType, + VerticalScrollThumbType, + VerticalScrollGripType, + LeftArrowType, + RightArrowType, + UpArrowType, + DownArrowType, + HorizontalSliderTrackType, + HorizontalSliderThumbType, + DropDownButtonType, + ProgressBarType + }; + + // canvas is the canvas to draw onto, and rect gives the size of the + // control. ctype and cstate specify the type and state of the control. + WebThemeControlDRT(skia::PlatformCanvas* canvas, + const SkIRect& rect, + Type ctype, + State cstate); + ~WebThemeControlDRT(); + + // Draws the control. + void draw(); + + // Use this for TextField controls instead, because the logic + // for drawing them is dependent on what WebKit tells us to do. + // If drawEdges is true, draw an edge around the control. If + // fillContentArea is true, fill the content area with the given color. + void drawTextField(bool drawEdges, bool fillContentArea, SkColor color); + + // Use this for drawing ProgressBar controls instead, since we + // need to know the rect to fill inside the bar. + void drawProgressBar(const SkIRect& fillRect); + +private: + // Draws a box of size specified by irect, filled with the given color. + // The box will have a border drawn in the default edge color. + void box(const SkIRect& irect, SkColor color); + + + // Draws a triangle of size specified by the three pairs of coordinates, + // filled with the given color. The box will have an edge drawn in the + // default edge color. + void triangle(int x0, int y0, int x1, int y1, int x2, int y2, SkColor color); + + // Draws a rectangle the size of the control with rounded corners, filled + // with the specified color (and with a border in the default edge color). + void roundRect(SkColor color); + + // Draws an oval the size of the control, filled with the specified color + // and with a border in the default edge color. + void oval(SkColor color); + + // Draws a circle centered in the control with the specified radius, + // filled with the specified color, and with a border draw in the + // default edge color. + void circle(SkScalar radius, SkColor color); + + // Draws a box the size of the control, filled with the outerColor and + // with a border in the default edge color, and then draws another box + // indented on all four sides by the specified amounts, filled with the + // inner color and with a border in the default edge color. + void nestedBoxes(int indentLeft, + int indentTop, + int indentRight, + int indentBottom, + SkColor outerColor, + SkColor innerColor); + + // Draws a line between the two points in the given color. + void line(int x0, int y0, int x1, int y1, SkColor color); + + // Draws a distinctive mark on the control for each state, so that the + // state of the control can be determined without needing to know which + // color is which. + void markState(); + + skia::PlatformCanvas* m_canvas; + const SkIRect m_irect; + const Type m_type; + const State m_state; + const SkColor m_edgeColor; + const SkColor m_bgColor; + const SkColor m_fgColor; + + // The following are convenience accessors for m_irect. + const int m_left; + const int m_right; + const int m_top; + const int m_bottom; + const int m_width; + const int m_height; +}; + +#endif // WebThemeControlDRT_h diff --git a/WebKitTools/DumpRenderTree/chromium/WebThemeEngineDRT.cpp b/WebKitTools/DumpRenderTree/chromium/WebThemeEngineDRT.cpp new file mode 100755 index 0000000..b3092cc --- /dev/null +++ b/WebKitTools/DumpRenderTree/chromium/WebThemeEngineDRT.cpp @@ -0,0 +1,674 @@ +/* + * 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 "WebThemeEngineDRT.h" + +#include "WebThemeControlDRT.h" +#include "public/WebRect.h" +#include "third_party/skia/include/core/SkRect.h" + +// Although all this code is generic, we include these headers +// to pull in the Windows #defines for the parts and states of +// the controls. +#include +#include + +#include + +using namespace WebKit; + +// We define this for clarity, although there really should be a DFCS_NORMAL in winuser.h. +static const int dfcsNormal = 0x0000; + +static SkIRect webRectToSkIRect(const WebRect& webRect) +{ + SkIRect irect; + irect.set(webRect.x, webRect.y, webRect.x + webRect.width, webRect.y + webRect.height); + return irect; +} + +static void drawControl(WebCanvas* canvas, + const WebRect& rect, + WebThemeControlDRT::Type ctype, + WebThemeControlDRT::State cstate) +{ + WebThemeControlDRT control(canvas, webRectToSkIRect(rect), ctype, cstate); + control.draw(); +} + +static void drawTextField(WebCanvas* canvas, + const WebRect& rect, + WebThemeControlDRT::Type ctype, + WebThemeControlDRT::State cstate, + bool drawEdges, + bool fillContentArea, + WebColor color) +{ + WebThemeControlDRT control(canvas, webRectToSkIRect(rect), ctype, cstate); + control.drawTextField(drawEdges, fillContentArea, color); +} + +static void drawProgressBar(WebCanvas* canvas, + WebThemeControlDRT::Type ctype, + WebThemeControlDRT::State cstate, + const WebRect& barRect, + const WebRect& fillRect) +{ + WebThemeControlDRT control(canvas, webRectToSkIRect(barRect), ctype, cstate); + control.drawProgressBar(webRectToSkIRect(fillRect)); +} + +// WebThemeEngineDRT + +void WebThemeEngineDRT::paintButton(WebCanvas* canvas, + int part, + int state, + int classicState, + const WebRect& rect) +{ + WebThemeControlDRT::Type ctype = WebThemeControlDRT::UnknownType; + WebThemeControlDRT::State cstate = WebThemeControlDRT::UnknownState; + + if (part == BP_CHECKBOX) { + switch (state) { + case CBS_UNCHECKEDNORMAL: + ASSERT(classicState == dfcsNormal); + ctype = WebThemeControlDRT::UncheckedBoxType; + cstate = WebThemeControlDRT::NormalState; + break; + + case CBS_UNCHECKEDHOT: + ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_HOT)); + ctype = WebThemeControlDRT::UncheckedBoxType; + cstate = WebThemeControlDRT::HotState; + break; + + case CBS_UNCHECKEDPRESSED: + ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_PUSHED)); + ctype = WebThemeControlDRT::UncheckedBoxType; + cstate = WebThemeControlDRT::PressedState; + break; + + case CBS_UNCHECKEDDISABLED: + ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_INACTIVE)); + ctype = WebThemeControlDRT::UncheckedBoxType; + cstate = WebThemeControlDRT::DisabledState; + break; + + case CBS_CHECKEDNORMAL: + ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_CHECKED)); + ctype = WebThemeControlDRT::CheckedBoxType; + cstate = WebThemeControlDRT::NormalState; + break; + + case CBS_CHECKEDHOT: + ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS_HOT)); + ctype = WebThemeControlDRT::CheckedBoxType; + cstate = WebThemeControlDRT::HotState; + break; + + case CBS_CHECKEDPRESSED: + ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS_PUSHED)); + ctype = WebThemeControlDRT::CheckedBoxType; + cstate = WebThemeControlDRT::PressedState; + break; + + case CBS_CHECKEDDISABLED: + ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS_INACTIVE)); + ctype = WebThemeControlDRT::CheckedBoxType; + cstate = WebThemeControlDRT::DisabledState; + break; + + default: + ASSERT_NOT_REACHED(); + break; + } + } else if (BP_RADIOBUTTON == part) { + switch (state) { + case RBS_UNCHECKEDNORMAL: + ASSERT(classicState == DFCS_BUTTONRADIO); + ctype = WebThemeControlDRT::UncheckedRadioType; + cstate = WebThemeControlDRT::NormalState; + break; + + case RBS_UNCHECKEDHOT: + ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_HOT)); + ctype = WebThemeControlDRT::UncheckedRadioType; + cstate = WebThemeControlDRT::HotState; + break; + + case RBS_UNCHECKEDPRESSED: + ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_PUSHED)); + ctype = WebThemeControlDRT::UncheckedRadioType; + cstate = WebThemeControlDRT::PressedState; + break; + + case RBS_UNCHECKEDDISABLED: + ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_INACTIVE)); + ctype = WebThemeControlDRT::UncheckedRadioType; + cstate = WebThemeControlDRT::DisabledState; + break; + + case RBS_CHECKEDNORMAL: + ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_CHECKED)); + ctype = WebThemeControlDRT::CheckedRadioType; + cstate = WebThemeControlDRT::NormalState; + break; + + case RBS_CHECKEDHOT: + ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_CHECKED | DFCS_HOT)); + ctype = WebThemeControlDRT::CheckedRadioType; + cstate = WebThemeControlDRT::HotState; + break; + + case RBS_CHECKEDPRESSED: + ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_CHECKED | DFCS_PUSHED)); + ctype = WebThemeControlDRT::CheckedRadioType; + cstate = WebThemeControlDRT::PressedState; + break; + + case RBS_CHECKEDDISABLED: + ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_CHECKED | DFCS_INACTIVE)); + ctype = WebThemeControlDRT::CheckedRadioType; + cstate = WebThemeControlDRT::DisabledState; + break; + + default: + ASSERT_NOT_REACHED(); + break; + } + } else if (BP_PUSHBUTTON == part) { + switch (state) { + case PBS_NORMAL: + ASSERT(classicState == DFCS_BUTTONPUSH); + ctype = WebThemeControlDRT::PushButtonType; + cstate = WebThemeControlDRT::NormalState; + break; + + case PBS_HOT: + ASSERT(classicState == (DFCS_BUTTONPUSH | DFCS_HOT)); + ctype = WebThemeControlDRT::PushButtonType; + cstate = WebThemeControlDRT::HotState; + break; + + case PBS_PRESSED: + ASSERT(classicState == (DFCS_BUTTONPUSH | DFCS_PUSHED)); + ctype = WebThemeControlDRT::PushButtonType; + cstate = WebThemeControlDRT::PressedState; + break; + + case PBS_DISABLED: + ASSERT(classicState == (DFCS_BUTTONPUSH | DFCS_INACTIVE)); + ctype = WebThemeControlDRT::PushButtonType; + cstate = WebThemeControlDRT::DisabledState; + break; + + case PBS_DEFAULTED: + ASSERT(classicState == DFCS_BUTTONPUSH); + ctype = WebThemeControlDRT::PushButtonType; + cstate = WebThemeControlDRT::FocusedState; + break; + + default: + ASSERT_NOT_REACHED(); + break; + } + } else { + ASSERT_NOT_REACHED(); + } + + drawControl(canvas, rect, ctype, cstate); +} + + +void WebThemeEngineDRT::paintMenuList(WebCanvas* canvas, + int part, + int state, + int classicState, + const WebRect& rect) +{ + WebThemeControlDRT::Type ctype = WebThemeControlDRT::UnknownType; + WebThemeControlDRT::State cstate = WebThemeControlDRT::UnknownState; + + if (CP_DROPDOWNBUTTON == part) { + ctype = WebThemeControlDRT::DropDownButtonType; + switch (state) { + case CBXS_NORMAL: + ASSERT(classicState == DFCS_MENUARROW); + cstate = WebThemeControlDRT::NormalState; + break; + + case CBXS_HOT: + ASSERT(classicState == (DFCS_MENUARROW | DFCS_HOT)); + cstate = WebThemeControlDRT::HoverState; + break; + + case CBXS_PRESSED: + ASSERT(classicState == (DFCS_MENUARROW | DFCS_PUSHED)); + cstate = WebThemeControlDRT::PressedState; + break; + + case CBXS_DISABLED: + ASSERT(classicState == (DFCS_MENUARROW | DFCS_INACTIVE)); + cstate = WebThemeControlDRT::DisabledState; + break; + + default: + CRASH(); + break; + } + } else { + CRASH(); + } + + drawControl(canvas, rect, ctype, cstate); +} + +void WebThemeEngineDRT::paintScrollbarArrow(WebCanvas* canvas, + int state, + int classicState, + const WebRect& rect) +{ + WebThemeControlDRT::Type ctype = WebThemeControlDRT::UnknownType; + WebThemeControlDRT::State cstate = WebThemeControlDRT::UnknownState; + + switch (state) { + case ABS_UPNORMAL: + ASSERT(classicState == DFCS_SCROLLUP); + ctype = WebThemeControlDRT::UpArrowType; + cstate = WebThemeControlDRT::NormalState; + break; + + case ABS_DOWNNORMAL: + ASSERT(classicState == DFCS_SCROLLDOWN); + ctype = WebThemeControlDRT::DownArrowType; + cstate = WebThemeControlDRT::NormalState; + break; + + case ABS_LEFTNORMAL: + ASSERT(classicState == DFCS_SCROLLLEFT); + ctype = WebThemeControlDRT::LeftArrowType; + cstate = WebThemeControlDRT::NormalState; + break; + + case ABS_RIGHTNORMAL: + ASSERT(classicState == DFCS_SCROLLRIGHT); + ctype = WebThemeControlDRT::RightArrowType; + cstate = WebThemeControlDRT::NormalState; + break; + + case ABS_UPHOT: + ASSERT(classicState == (DFCS_SCROLLUP | DFCS_HOT)); + ctype = WebThemeControlDRT::UpArrowType; + cstate = WebThemeControlDRT::HotState; + break; + + case ABS_DOWNHOT: + ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_HOT)); + ctype = WebThemeControlDRT::DownArrowType; + cstate = WebThemeControlDRT::HotState; + break; + + case ABS_LEFTHOT: + ASSERT(classicState == (DFCS_SCROLLLEFT | DFCS_HOT)); + ctype = WebThemeControlDRT::LeftArrowType; + cstate = WebThemeControlDRT::HotState; + break; + + case ABS_RIGHTHOT: + ASSERT(classicState == (DFCS_SCROLLRIGHT | DFCS_HOT)); + ctype = WebThemeControlDRT::RightArrowType; + cstate = WebThemeControlDRT::HotState; + break; + + case ABS_UPHOVER: + ASSERT(classicState == DFCS_SCROLLUP); + ctype = WebThemeControlDRT::UpArrowType; + cstate = WebThemeControlDRT::HoverState; + break; + + case ABS_DOWNHOVER: + ASSERT(classicState == DFCS_SCROLLDOWN); + ctype = WebThemeControlDRT::DownArrowType; + cstate = WebThemeControlDRT::HoverState; + break; + + case ABS_LEFTHOVER: + ASSERT(classicState == DFCS_SCROLLLEFT); + ctype = WebThemeControlDRT::LeftArrowType; + cstate = WebThemeControlDRT::HoverState; + break; + + case ABS_RIGHTHOVER: + ASSERT(classicState == DFCS_SCROLLRIGHT); + ctype = WebThemeControlDRT::RightArrowType; + cstate = WebThemeControlDRT::HoverState; + break; + + case ABS_UPPRESSED: + ASSERT(classicState == (DFCS_SCROLLUP | DFCS_PUSHED | DFCS_FLAT)); + ctype = WebThemeControlDRT::UpArrowType; + cstate = WebThemeControlDRT::PressedState; + break; + + case ABS_DOWNPRESSED: + ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_PUSHED | DFCS_FLAT)); + ctype = WebThemeControlDRT::DownArrowType; + cstate = WebThemeControlDRT::PressedState; + break; + + case ABS_LEFTPRESSED: + ASSERT(classicState == (DFCS_SCROLLLEFT | DFCS_PUSHED | DFCS_FLAT)); + ctype = WebThemeControlDRT::LeftArrowType; + cstate = WebThemeControlDRT::PressedState; + break; + + case ABS_RIGHTPRESSED: + ASSERT(classicState == (DFCS_SCROLLRIGHT | DFCS_PUSHED | DFCS_FLAT)); + ctype = WebThemeControlDRT::RightArrowType; + cstate = WebThemeControlDRT::PressedState; + break; + + case ABS_UPDISABLED: + ASSERT(classicState == (DFCS_SCROLLUP | DFCS_INACTIVE)); + ctype = WebThemeControlDRT::UpArrowType; + cstate = WebThemeControlDRT::DisabledState; + break; + + case ABS_DOWNDISABLED: + ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_INACTIVE)); + ctype = WebThemeControlDRT::DownArrowType; + cstate = WebThemeControlDRT::DisabledState; + break; + + case ABS_LEFTDISABLED: + ASSERT(classicState == (DFCS_SCROLLLEFT | DFCS_INACTIVE)); + ctype = WebThemeControlDRT::LeftArrowType; + cstate = WebThemeControlDRT::DisabledState; + break; + + case ABS_RIGHTDISABLED: + ASSERT(classicState == (DFCS_SCROLLRIGHT | DFCS_INACTIVE)); + ctype = WebThemeControlDRT::RightArrowType; + cstate = WebThemeControlDRT::DisabledState; + break; + + default: + ASSERT_NOT_REACHED(); + break; + } + + drawControl(canvas, rect, ctype, cstate); +} + +void WebThemeEngineDRT::paintScrollbarThumb(WebCanvas* canvas, + int part, + int state, + int classicState, + const WebRect& rect) +{ + WebThemeControlDRT::Type ctype = WebThemeControlDRT::UnknownType; + WebThemeControlDRT::State cstate = WebThemeControlDRT::UnknownState; + + switch (part) { + case SBP_THUMBBTNHORZ: + ctype = WebThemeControlDRT::HorizontalScrollThumbType; + break; + + case SBP_THUMBBTNVERT: + ctype = WebThemeControlDRT::VerticalScrollThumbType; + break; + + case SBP_GRIPPERHORZ: + ctype = WebThemeControlDRT::HorizontalScrollGripType; + break; + + case SBP_GRIPPERVERT: + ctype = WebThemeControlDRT::VerticalScrollGripType; + break; + + default: + ASSERT_NOT_REACHED(); + break; + } + + switch (state) { + case SCRBS_NORMAL: + ASSERT(classicState == dfcsNormal); + cstate = WebThemeControlDRT::NormalState; + break; + + case SCRBS_HOT: + ASSERT(classicState == DFCS_HOT); + cstate = WebThemeControlDRT::HotState; + break; + + case SCRBS_HOVER: + ASSERT(classicState == dfcsNormal); + cstate = WebThemeControlDRT::HoverState; + break; + + case SCRBS_PRESSED: + ASSERT(classicState == dfcsNormal); + cstate = WebThemeControlDRT::PressedState; + break; + + case SCRBS_DISABLED: + ASSERT_NOT_REACHED(); // This should never happen in practice. + break; + + default: + ASSERT_NOT_REACHED(); + break; + } + + drawControl(canvas, rect, ctype, cstate); +} + +void WebThemeEngineDRT::paintScrollbarTrack(WebCanvas* canvas, + int part, + int state, + int classicState, + const WebRect& rect, + const WebRect& alignRect) +{ + WebThemeControlDRT::Type ctype = WebThemeControlDRT::UnknownType; + WebThemeControlDRT::State cstate = WebThemeControlDRT::UnknownState; + + switch (part) { + case SBP_UPPERTRACKHORZ: + ctype = WebThemeControlDRT::HorizontalScrollTrackBackType; + break; + + case SBP_LOWERTRACKHORZ: + ctype = WebThemeControlDRT::HorizontalScrollTrackForwardType; + break; + + case SBP_UPPERTRACKVERT: + ctype = WebThemeControlDRT::VerticalScrollTrackBackType; + break; + + case SBP_LOWERTRACKVERT: + ctype = WebThemeControlDRT::VerticalScrollTrackForwardType; + break; + + default: + ASSERT_NOT_REACHED(); + break; + } + + switch (state) { + case SCRBS_NORMAL: + ASSERT(classicState == dfcsNormal); + cstate = WebThemeControlDRT::NormalState; + break; + + case SCRBS_HOT: + ASSERT_NOT_REACHED(); // This should never happen in practice. + break; + + case SCRBS_HOVER: + ASSERT(classicState == dfcsNormal); + cstate = WebThemeControlDRT::HoverState; + break; + + case SCRBS_PRESSED: + ASSERT_NOT_REACHED(); // This should never happen in practice. + break; + + case SCRBS_DISABLED: + ASSERT(classicState == DFCS_INACTIVE); + cstate = WebThemeControlDRT::DisabledState; + break; + + default: + CRASH(); + break; + } + + drawControl(canvas, rect, ctype, cstate); +} + +void WebThemeEngineDRT::paintTextField(WebCanvas* canvas, + int part, + int state, + int classicState, + const WebRect& rect, + WebColor color, + bool fillContentArea, + bool drawEdges) +{ + WebThemeControlDRT::Type ctype = WebThemeControlDRT::UnknownType; + WebThemeControlDRT::State cstate = WebThemeControlDRT::UnknownState; + + ASSERT(EP_EDITTEXT == part); + ctype = WebThemeControlDRT::TextFieldType; + + switch (state) { + case ETS_NORMAL: + ASSERT(classicState == dfcsNormal); + cstate = WebThemeControlDRT::NormalState; + break; + + case ETS_HOT: + ASSERT(classicState == DFCS_HOT); + cstate = WebThemeControlDRT::HotState; + break; + + case ETS_DISABLED: + ASSERT(classicState == DFCS_INACTIVE); + cstate = WebThemeControlDRT::DisabledState; + break; + + case ETS_SELECTED: + ASSERT(classicState == DFCS_PUSHED); + cstate = WebThemeControlDRT::PressedState; + break; + + case ETS_FOCUSED: + ASSERT(classicState == dfcsNormal); + cstate = WebThemeControlDRT::FocusedState; + break; + + case ETS_READONLY: + ASSERT(classicState == dfcsNormal); + cstate = WebThemeControlDRT::ReadOnlyState; + break; + + default: + ASSERT_NOT_REACHED(); + break; + } + + drawTextField(canvas, rect, ctype, cstate, drawEdges, fillContentArea, color); +} + +void WebThemeEngineDRT::paintTrackbar(WebCanvas* canvas, + int part, + int state, + int classicState, + const WebRect& rect) +{ + WebThemeControlDRT::Type ctype = WebThemeControlDRT::UnknownType; + WebThemeControlDRT::State cstate = WebThemeControlDRT::UnknownState; + + if (TKP_THUMBBOTTOM == part) { + ctype = WebThemeControlDRT::HorizontalSliderThumbType; + switch (state) { + case TUS_NORMAL: + ASSERT(classicState == dfcsNormal); + cstate = WebThemeControlDRT::NormalState; + break; + + case TUS_HOT: + ASSERT(classicState == DFCS_HOT); + cstate = WebThemeControlDRT::HotState; + break; + + case TUS_DISABLED: + ASSERT(classicState == DFCS_INACTIVE); + cstate = WebThemeControlDRT::DisabledState; + break; + + case TUS_PRESSED: + ASSERT(classicState == DFCS_PUSHED); + cstate = WebThemeControlDRT::PressedState; + break; + + default: + ASSERT_NOT_REACHED(); + break; + } + } else if (TKP_TRACK == part) { + ctype = WebThemeControlDRT::HorizontalSliderTrackType; + ASSERT(part == TUS_NORMAL); + ASSERT(classicState == dfcsNormal); + cstate = WebThemeControlDRT::NormalState; + } else { + ASSERT_NOT_REACHED(); + } + + drawControl(canvas, rect, ctype, cstate); +} + + +void WebThemeEngineDRT::paintProgressBar(WebKit::WebCanvas* canvas, + const WebKit::WebRect& barRect, + const WebKit::WebRect& valueRect, + bool determinate, + double) +{ + WebThemeControlDRT::Type ctype = WebThemeControlDRT::ProgressBarType; + WebThemeControlDRT::State cstate = determinate ? WebThemeControlDRT::NormalState + : WebThemeControlDRT::IndeterminateState; + drawProgressBar(canvas, ctype, cstate, barRect, valueRect); +} + diff --git a/WebKitTools/DumpRenderTree/chromium/WebThemeEngineDRT.h b/WebKitTools/DumpRenderTree/chromium/WebThemeEngineDRT.h new file mode 100755 index 0000000..89805b1 --- /dev/null +++ b/WebKitTools/DumpRenderTree/chromium/WebThemeEngineDRT.h @@ -0,0 +1,93 @@ +/* + * 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 implements the WebThemeEngine API used by the Windows version of +// Chromium to render native form controls like checkboxes, radio buttons, +// and scroll bars. +// The normal implementation (native_theme) renders the controls using either +// the UXTheme theming engine present in XP, Vista, and Win 7, or the "classic" +// theme used if that theme is selected in the Desktop settings. +// Unfortunately, both of these themes render controls differently on the +// different versions of Windows. +// +// In order to ensure maximum consistency of baselines across the different +// Windows versions, we provide a simple implementation for DRT here +// instead. These controls are actually platform-independent (they're rendered +// using Skia) and could be used on Linux and the Mac as well, should we +// choose to do so at some point. +// + +#ifndef WebThemeEngineDRT_h +#define WebThemeEngineDRT_h + +#include "public/WebThemeEngine.h" +#include + +class WebThemeEngineDRT : public WebKit::WebThemeEngine, public Noncopyable { +public: + WebThemeEngineDRT() {} + + // WebThemeEngine methods: + virtual void paintButton( + WebKit::WebCanvas*, int part, int state, int classicState, + const WebKit::WebRect&); + + virtual void paintMenuList( + WebKit::WebCanvas*, int part, int state, int classicState, + const WebKit::WebRect&); + + virtual void paintScrollbarArrow( + WebKit::WebCanvas*, int state, int classicState, + const WebKit::WebRect&); + + virtual void paintScrollbarThumb( + WebKit::WebCanvas*, int part, int state, int classicState, + const WebKit::WebRect&); + + virtual void paintScrollbarTrack( + WebKit::WebCanvas*, int part, int state, int classicState, + const WebKit::WebRect&, const WebKit::WebRect& alignRect); + + virtual void paintTextField( + WebKit::WebCanvas*, int part, int state, int classicState, + const WebKit::WebRect&, WebKit::WebColor, bool fillContentArea, + bool drawEdges); + + virtual void paintTrackbar( + WebKit::WebCanvas*, int part, int state, int classicState, + const WebKit::WebRect&); + + virtual void paintProgressBar( + WebKit::WebCanvas*, const WebKit::WebRect& barRect, + const WebKit::WebRect& valueRect, + bool determinate, double time); +}; + +#endif // WebThemeEngineDRT_h diff --git a/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp b/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp index 3735d0a..d186ffa 100644 --- a/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp +++ b/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp @@ -112,6 +112,12 @@ AccessibilityUIElement AccessibilityUIElement::elementAtPoint(int x, int y) return 0; } +AccessibilityUIElement AccessibilityUIElement::linkedUIElementAtIndex(unsigned index) +{ + // FIXME: implement + return 0; +} + AccessibilityUIElement AccessibilityUIElement::getChildAtIndex(unsigned index) { Vector children; diff --git a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp index 02c0abb..14577f1 100644 --- a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp +++ b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp @@ -388,8 +388,18 @@ void dump() if (gLayoutTestController->dumpAsText()) result = dumpFramesAsText(mainFrame); - else + else { + // Widget resizing is done asynchronously in GTK+. We pump the main + // loop here, to flush any pending resize requests. This prevents + // timing issues which affect the size of elements in the output. + // We only enable this workaround for tests that print the render tree + // because this seems to break some dumpAsText tests: see bug 39988 + // After fixing that test, we should apply this approach to all dumps. + while (gtk_events_pending()) + gtk_main_iteration(); + result = webkit_web_frame_dump_render_tree(mainFrame); + } if (!result) { const char* errorMessage; @@ -525,8 +535,10 @@ static void runTest(const string& testPathOrURL) gtk_main(); // If developer extras enabled Web Inspector may have been open by the test. - if (shouldEnableDeveloperExtras(pathOrURL.c_str())) + if (shouldEnableDeveloperExtras(pathOrURL.c_str())) { gLayoutTestController->closeWebInspector(); + gLayoutTestController->setDeveloperExtrasEnabled(false); + } // Also check if we still have opened webViews and free them. if (gLayoutTestController->closeRemainingWindowsWhenComplete() || webViewList) { @@ -663,7 +675,7 @@ static void webViewWindowObjectCleared(WebKitWebView* view, WebKitWebFrame* fram ASSERT(!exception); JSStringRef eventSenderStr = JSStringCreateWithUTF8CString("eventSender"); - JSValueRef eventSender = makeEventSender(context); + JSValueRef eventSender = makeEventSender(context, !webkit_web_frame_get_parent(frame)); JSObjectSetProperty(context, windowObject, eventSenderStr, eventSender, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, 0); JSStringRelease(eventSenderStr); } diff --git a/WebKitTools/DumpRenderTree/gtk/EventSender.cpp b/WebKitTools/DumpRenderTree/gtk/EventSender.cpp index 9c27d8c..0ef4a42 100644 --- a/WebKitTools/DumpRenderTree/gtk/EventSender.cpp +++ b/WebKitTools/DumpRenderTree/gtk/EventSender.cpp @@ -45,28 +45,27 @@ #include #include -// TODO: Currently drag and drop related code is left out and -// should be merged once we have drag and drop support in WebCore. +// FIXME: Implement support for synthesizing drop events. extern "C" { extern void webkit_web_frame_layout(WebKitWebFrame* frame); } -static bool down = false; -static bool currentEventButton = 1; -static bool dragMode = true; -static bool replayingSavedEvents = false; +static bool dragMode; +static int timeOffset = 0; + static int lastMousePositionX; static int lastMousePositionY; - static int lastClickPositionX; static int lastClickPositionY; -static int clickCount = 0; +static int lastClickTimeOffset; +static int lastClickButton; +static int buttonCurrentlyDown; +static int clickCount; struct DelayedMessage { GdkEvent event; gulong delay; - gboolean isDragEvent; }; static DelayedMessage msgQueue[1024]; @@ -84,6 +83,10 @@ enum KeyLocationCode { DOM_KEY_LOCATION_NUMPAD = 0x03 }; +static void sendOrQueueEvent(GdkEvent, bool = true); +static void dispatchEvent(GdkEvent event); +static guint getStateFlags(); + static JSValueRef getDragModeCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { return JSValueMakeBoolean(context, dragMode); @@ -97,46 +100,15 @@ static bool setDragModeCallback(JSContextRef context, JSObjectRef object, JSStri static JSValueRef leapForwardCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - // FIXME: Add proper support for forward leaps - return JSValueMakeUndefined(context); -} - -static JSValueRef contextClickCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - webkit_web_frame_layout(mainFrame); - - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - if (!view) - return JSValueMakeUndefined(context); - - GdkEvent event; - memset(&event, 0, sizeof(event)); - event.button.button = 3; - event.button.x = lastMousePositionX; - event.button.y = lastMousePositionY; - event.button.window = GTK_WIDGET(view)->window; - - gboolean return_val; - down = true; - event.type = GDK_BUTTON_PRESS; - g_signal_emit_by_name(view, "button_press_event", &event, &return_val); - - down = false; - event.type = GDK_BUTTON_RELEASE; - g_signal_emit_by_name(view, "button_release_event", &event, &return_val); + if (argumentCount > 0) { + msgQueue[endOfQueue].delay = JSValueToNumber(context, arguments[0], exception); + timeOffset += msgQueue[endOfQueue].delay; + ASSERT(!exception || !*exception); + } return JSValueMakeUndefined(context); } -static void updateClickCount(int button) -{ - // FIXME: take the last clicked button number and the time of last click into account. - if (lastClickPositionX != lastMousePositionX || lastClickPositionY != lastMousePositionY || currentEventButton != button) - clickCount = 1; - else - clickCount++; -} - #if !GTK_CHECK_VERSION(2,17,3) static void getRootCoords(GtkWidget* view, int* rootX, int* rootY) { @@ -152,131 +124,139 @@ static void getRootCoords(GtkWidget* view, int* rootX, int* rootY) } #endif -static JSValueRef mouseDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +bool prepareMouseButtonEvent(GdkEvent* event, int eventSenderButtonNumber) { WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); if (!view) - return JSValueMakeUndefined(context); + return false; + + // The logic for mapping EventSender button numbers to GDK button + // numbers originates from the Windows EventSender. + int gdkButtonNumber = 3; + if (eventSenderButtonNumber >= 0 && eventSenderButtonNumber <= 2) + gdkButtonNumber = eventSenderButtonNumber + 1; + + // fast/events/mouse-click-events expects the 4th button + // to be event.button = 1, so send a middle-button event. + else if (eventSenderButtonNumber == 3) + gdkButtonNumber = 2; + + memset(event, 0, sizeof(event)); + event->button.button = gdkButtonNumber; + event->button.x = lastMousePositionX; + event->button.y = lastMousePositionY; + event->button.window = GTK_WIDGET(view)->window; + event->button.device = gdk_device_get_core_pointer(); + event->button.state = getStateFlags(); + + // Mouse up & down events dispatched via g_signal_emit_by_name must offset + // their time value, so that WebKit can detect where sequences of mouse + // clicks begin and end. This should not interfere with GDK or GTK+ event + // processing, because the event is only seen by the widget. + event->button.time = GDK_CURRENT_TIME + timeOffset; + + int xRoot, yRoot; +#if GTK_CHECK_VERSION(2, 17, 3) + gdk_window_get_root_coords(GTK_WIDGET(view)->window, lastMousePositionX, lastMousePositionY, &xRoot, &yRoot); +#else + getRootCoords(GTK_WIDGET(view), &xRoot, &yRoot); +#endif + event->button.x_root = xRoot; + event->button.y_root = yRoot; - down = true; + return true; +} +static JSValueRef contextClickCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ GdkEvent event; - memset(&event, 0, sizeof(event)); + if (!prepareMouseButtonEvent(&event, 2)) + return JSValueMakeUndefined(context); + event.type = GDK_BUTTON_PRESS; - event.button.button = 1; + sendOrQueueEvent(event); + event.type = GDK_BUTTON_RELEASE; + sendOrQueueEvent(event); + + return JSValueMakeUndefined(context); +} + +static void updateClickCount(int button) +{ + if (lastClickPositionX != lastMousePositionX + || lastClickPositionY != lastMousePositionY + || lastClickButton != button + || timeOffset - lastClickTimeOffset >= 1) + clickCount = 1; + else + clickCount++; +} +static JSValueRef mouseDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + int button = 0; if (argumentCount == 1) { - event.button.button = (int)JSValueToNumber(context, arguments[0], exception) + 1; + button = static_cast(JSValueToNumber(context, arguments[0], exception)); g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context)); } - currentEventButton = event.button.button; - - event.button.x = lastMousePositionX; - event.button.y = lastMousePositionY; - event.button.window = GTK_WIDGET(view)->window; - event.button.time = GDK_CURRENT_TIME; - event.button.device = gdk_device_get_core_pointer(); - - int x_root, y_root; -#if GTK_CHECK_VERSION(2,17,3) - gdk_window_get_root_coords(GTK_WIDGET(view)->window, lastMousePositionX, lastMousePositionY, &x_root, &y_root); -#else - getRootCoords(GTK_WIDGET(view), &x_root, &y_root); -#endif + GdkEvent event; + if (!prepareMouseButtonEvent(&event, button)) + return JSValueMakeUndefined(context); - event.button.x_root = x_root; - event.button.y_root = y_root; + buttonCurrentlyDown = event.button.button; + // Normally GDK will send both GDK_BUTTON_PRESS and GDK_2BUTTON_PRESS for + // the second button press during double-clicks. WebKit GTK+ selectively + // ignores the first GDK_BUTTON_PRESS of that pair using gdk_event_peek. + // Since our events aren't ever going onto the GDK event queue, WebKit won't + // be able to filter out the first GDK_BUTTON_PRESS, so we just don't send + // it here. Eventually this code should probably figure out a way to get all + // appropriate events onto the event queue and this work-around should be + // removed. updateClickCount(event.button.button); + if (clickCount == 2) + event.type = GDK_2BUTTON_PRESS; + else if (clickCount == 3) + event.type = GDK_3BUTTON_PRESS; + else + event.type = GDK_BUTTON_PRESS; - if (!msgQueue[endOfQueue].delay) { - webkit_web_frame_layout(mainFrame); - - gboolean return_val; - g_signal_emit_by_name(view, "button_press_event", &event, &return_val); - if (clickCount == 2) { - event.type = GDK_2BUTTON_PRESS; - g_signal_emit_by_name(view, "button_press_event", &event, &return_val); - } - } else { - // replaySavedEvents should have the required logic to make leapForward delays work - msgQueue[endOfQueue++].event = event; - replaySavedEvents(); - } - + sendOrQueueEvent(event); return JSValueMakeUndefined(context); } static guint getStateFlags() { - guint state = 0; - - if (down) { - if (currentEventButton == 1) - state = GDK_BUTTON1_MASK; - else if (currentEventButton == 2) - state = GDK_BUTTON2_MASK; - else if (currentEventButton == 3) - state = GDK_BUTTON3_MASK; - } else - state = 0; - - return state; + if (buttonCurrentlyDown == 1) + return GDK_BUTTON1_MASK; + if (buttonCurrentlyDown == 2) + return GDK_BUTTON2_MASK; + if (buttonCurrentlyDown == 3) + return GDK_BUTTON3_MASK; + return 0; } static JSValueRef mouseUpCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - if (!view) - return JSValueMakeUndefined(context); - - GdkEvent event; - memset(&event, 0, sizeof(event)); - event.type = GDK_BUTTON_RELEASE; - event.button.button = 1; - + int button = 0; if (argumentCount == 1) { - event.button.button = (int)JSValueToNumber(context, arguments[0], exception) + 1; + button = static_cast(JSValueToNumber(context, arguments[0], exception)); g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context)); } - currentEventButton = event.button.button; - - event.button.x = lastMousePositionX; - event.button.y = lastMousePositionY; - event.button.window = GTK_WIDGET(view)->window; - event.button.time = GDK_CURRENT_TIME; - event.button.device = gdk_device_get_core_pointer(); - event.button.state = getStateFlags(); - - down = false; - - int x_root, y_root; -#if GTK_CHECK_VERSION(2,17,3) - gdk_window_get_root_coords(GTK_WIDGET(view)->window, lastMousePositionX, lastMousePositionY, &x_root, &y_root); -#else - getRootCoords(GTK_WIDGET(view), &x_root, &y_root); -#endif - - event.button.x_root = x_root; - event.button.y_root = y_root; - - if ((dragMode && !replayingSavedEvents) || msgQueue[endOfQueue].delay) { - msgQueue[endOfQueue].event = event; - msgQueue[endOfQueue++].isDragEvent = true; - replaySavedEvents(); - } else { - webkit_web_frame_layout(mainFrame); - - gboolean return_val; - g_signal_emit_by_name(view, "button_release_event", &event, &return_val); - } + GdkEvent event; + if (!prepareMouseButtonEvent(&event, button)) + return JSValueMakeUndefined(context); lastClickPositionX = lastMousePositionX; lastClickPositionY = lastMousePositionY; + lastClickButton = buttonCurrentlyDown; + lastClickTimeOffset = timeOffset; + buttonCurrentlyDown = 0; + event.type = GDK_BUTTON_RELEASE; + sendOrQueueEvent(event); return JSValueMakeUndefined(context); } @@ -299,32 +279,22 @@ static JSValueRef mouseMoveToCallback(JSContextRef context, JSObjectRef function event.type = GDK_MOTION_NOTIFY; event.motion.x = lastMousePositionX; event.motion.y = lastMousePositionY; + event.motion.time = GDK_CURRENT_TIME; event.motion.window = GTK_WIDGET(view)->window; event.motion.device = gdk_device_get_core_pointer(); + event.motion.state = getStateFlags(); - int x_root, y_root; + int xRoot, yRoot; #if GTK_CHECK_VERSION(2,17,3) - gdk_window_get_root_coords(GTK_WIDGET(view)->window, lastMousePositionX, lastMousePositionY, &x_root, &y_root); + gdk_window_get_root_coords(GTK_WIDGET(view)->window, lastMousePositionX, lastMousePositionY, &xRoot, &yRoot); #else - getRootCoords(GTK_WIDGET(view), &x_root, &y_root); + getRootCoords(GTK_WIDGET(view), &xRoot, &yRoot); #endif + event.motion.x_root = xRoot; + event.motion.y_root = yRoot; - event.motion.x_root = x_root; - event.motion.y_root = y_root; - - event.motion.state = getStateFlags(); - - if (dragMode && down && !replayingSavedEvents) { - msgQueue[endOfQueue].event = event; - msgQueue[endOfQueue++].isDragEvent = true; - } else { - webkit_web_frame_layout(mainFrame); - - gboolean return_val; - g_signal_emit_by_name(view, "motion_notify_event", &event, &return_val); - } - + sendOrQueueEvent(event, false); return JSValueMakeUndefined(context); } @@ -363,14 +333,7 @@ static JSValueRef mouseWheelToCallback(JSContextRef context, JSObjectRef functio else g_assert_not_reached(); - if (dragMode && down && !replayingSavedEvents) { - msgQueue[endOfQueue].event = event; - msgQueue[endOfQueue++].isDragEvent = true; - } else { - webkit_web_frame_layout(mainFrame); - gtk_main_do_event(&event); - } - + sendOrQueueEvent(event); return JSValueMakeUndefined(context); } @@ -383,49 +346,49 @@ static JSValueRef beginDragWithFilesCallback(JSContextRef context, JSObjectRef f return JSValueMakeUndefined(context); } -void replaySavedEvents() +static void sendOrQueueEvent(GdkEvent event, bool shouldReplaySavedEvents) { - // FIXME: This doesn't deal with forward leaps, but it should. + // Mouse move events are queued if the previous event was queued or if a + // delay was set up by leapForward(). + if (buttonCurrentlyDown || endOfQueue != startOfQueue || msgQueue[endOfQueue].delay) { + msgQueue[endOfQueue++].event = event; + + if (shouldReplaySavedEvents) + replaySavedEvents(); + + return; + } + + dispatchEvent(event); +} +static void dispatchEvent(GdkEvent event) +{ + webkit_web_frame_layout(mainFrame); WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); if (!view) return; - replayingSavedEvents = true; - - for (unsigned queuePos = 0; queuePos < endOfQueue; queuePos++) { - GdkEvent event = msgQueue[queuePos].event; - gboolean return_val; - - switch (event.type) { - case GDK_BUTTON_RELEASE: - g_signal_emit_by_name(view, "button_release_event", &event, &return_val); - break; - case GDK_BUTTON_PRESS: - g_signal_emit_by_name(view, "button_press_event", &event, &return_val); - break; - case GDK_MOTION_NOTIFY: - g_signal_emit_by_name(view, "motion_notify_event", &event, &return_val); - break; - default: - continue; - } + gtk_main_do_event(&event); +} - startOfQueue++; - } +void replaySavedEvents() +{ + // FIXME: Eventually we may need to have more sophisticated logic to + // track drag-and-drop operations. + + // First send all the events that are ready to be sent + while (startOfQueue < endOfQueue) { + if (msgQueue[startOfQueue].delay) { + g_usleep(msgQueue[startOfQueue].delay * 1000); + msgQueue[startOfQueue].delay = 0; + } - int numQueuedMessages = endOfQueue - startOfQueue; - if (!numQueuedMessages) { - startOfQueue = 0; - endOfQueue = 0; - replayingSavedEvents = false; - return; + dispatchEvent(msgQueue[startOfQueue++].event); } startOfQueue = 0; endOfQueue = 0; - - replayingSavedEvents = false; } static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) @@ -566,13 +529,11 @@ static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS g_free(keys); } - gboolean return_val; event.key.type = GDK_KEY_PRESS; - - g_signal_emit_by_name(view, "key-press-event", &event.key, &return_val); + dispatchEvent(event); event.key.type = GDK_KEY_RELEASE; - g_signal_emit_by_name(view, "key-release-event", &event.key, &return_val); + dispatchEvent(event); return JSValueMakeUndefined(context); } @@ -661,17 +622,24 @@ static JSClassRef getClass(JSContextRef context) return eventSenderClass; } -JSObjectRef makeEventSender(JSContextRef context) +JSObjectRef makeEventSender(JSContextRef context, bool isTopFrame) { - down = false; - dragMode = true; - lastMousePositionX = lastMousePositionY = 0; - lastClickPositionX = lastClickPositionY = 0; - - if (!replayingSavedEvents) { - // This function can be called in the middle of a test, even - // while replaying saved events. Resetting these while doing that - // can break things. + if (isTopFrame) { + dragMode = true; + + // Fly forward in time one second when the main frame loads. This will + // ensure that when a test begins clicking in the same location as + // a previous test, those clicks won't be interpreted as continuations + // of the previous test's click sequences. + timeOffset += 1000; + + lastMousePositionX = lastMousePositionY = 0; + lastClickPositionX = lastClickPositionY = 0; + lastClickTimeOffset = 0; + lastClickButton = 0; + buttonCurrentlyDown = 0; + clickCount = 0; + endOfQueue = 0; startOfQueue = 0; } diff --git a/WebKitTools/DumpRenderTree/gtk/EventSender.h b/WebKitTools/DumpRenderTree/gtk/EventSender.h index 272e8a9..ce33ccc 100644 --- a/WebKitTools/DumpRenderTree/gtk/EventSender.h +++ b/WebKitTools/DumpRenderTree/gtk/EventSender.h @@ -33,7 +33,7 @@ typedef const struct OpaqueJSContext* JSContextRef; typedef struct OpaqueJSValue* JSObjectRef; -JSObjectRef makeEventSender(JSContextRef context); +JSObjectRef makeEventSender(JSContextRef context, bool isTopFrame); void replaySavedEvents(); #endif diff --git a/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm b/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm index 3fa9c40..939398d 100644 --- a/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm +++ b/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm @@ -337,6 +337,17 @@ AccessibilityUIElement AccessibilityUIElement::getChildAtIndex(unsigned index) return 0; } +AccessibilityUIElement AccessibilityUIElement::linkedUIElementAtIndex(unsigned index) +{ + BEGIN_AX_OBJC_EXCEPTIONS + NSArray* objects = [m_element accessibilityAttributeValue:NSAccessibilityLinkedUIElementsAttribute]; + if (index < [objects count]) + return [objects objectAtIndex:index]; + END_AX_OBJC_EXCEPTIONS + + return 0; +} + AccessibilityUIElement AccessibilityUIElement::ariaOwnsElementAtIndex(unsigned index) { BEGIN_AX_OBJC_EXCEPTIONS diff --git a/WebKitTools/DumpRenderTree/mac/Configurations/Base.xcconfig b/WebKitTools/DumpRenderTree/mac/Configurations/Base.xcconfig index 5f989e0..28a0518 100644 --- a/WebKitTools/DumpRenderTree/mac/Configurations/Base.xcconfig +++ b/WebKitTools/DumpRenderTree/mac/Configurations/Base.xcconfig @@ -27,6 +27,7 @@ GCC_PREPROCESSOR_DEFINITIONS = ENABLE_DASHBOARD_SUPPORT WEBKIT_VERSION_MIN_REQUI DEBUG_INFORMATION_FORMAT = dwarf PREBINDING = NO GCC_C_LANGUAGE_STANDARD = gnu99 +GCC_OBJC_CALL_CXX_CDTORS = YES GCC_PRECOMPILE_PREFIX_HEADER = YES GCC_TREAT_WARNINGS_AS_ERRORS = YES GCC_WARN_UNUSED_FUNCTION = YES diff --git a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm index 8fd5298..9e4b203 100644 --- a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm +++ b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm @@ -41,6 +41,7 @@ #import "HistoryDelegate.h" #import "JavaScriptThreading.h" #import "LayoutTestController.h" +#import "MockGeolocationProvider.h" #import "NavigationController.h" #import "ObjCPlugin.h" #import "ObjCPluginFunction.h" @@ -291,6 +292,7 @@ WebView *createWebViewAndOffscreenWindow() [webView setFrameLoadDelegate:frameLoadDelegate]; [webView setEditingDelegate:editingDelegate]; [webView setResourceLoadDelegate:resourceLoadDelegate]; + [webView _setGeolocationProvider:[MockGeolocationProvider shared]]; // Register the same schemes that Safari does [WebView registerURLSchemeAsLocal:@"feed"]; @@ -1181,6 +1183,8 @@ static void resetWebViewToConsistentStateBeforeTesting() [WebView _setUsesTestModeFocusRingColor:YES]; [WebView _resetOriginAccessWhitelists]; + + [[MockGeolocationProvider shared] stopTimer]; } static void runTest(const string& testPathOrURL) @@ -1291,8 +1295,10 @@ static void runTest(const string& testPathOrURL) } // If developer extras enabled Web Inspector may have been open by the test. - if (shouldEnableDeveloperExtras(pathOrURL.c_str())) + if (shouldEnableDeveloperExtras(pathOrURL.c_str())) { gLayoutTestController->closeWebInspector(); + gLayoutTestController->setDeveloperExtrasEnabled(false); + } resetWebViewToConsistentStateBeforeTesting(); diff --git a/WebKitTools/DumpRenderTree/mac/EventSendingController.mm b/WebKitTools/DumpRenderTree/mac/EventSendingController.mm index b5b6f82..73831ff 100644 --- a/WebKitTools/DumpRenderTree/mac/EventSendingController.mm +++ b/WebKitTools/DumpRenderTree/mac/EventSendingController.mm @@ -122,7 +122,7 @@ BOOL replayingSavedEvents; { if (aSelector == @selector(beginDragWithFiles:) || aSelector == @selector(clearKillRing) - || aSelector == @selector(contextClick:) + || aSelector == @selector(contextClick) || aSelector == @selector(enableDOMUIEventLogging:) || aSelector == @selector(fireKeyboardEventsToElement:) || aSelector == @selector(keyDown:withModifiers:withLocation:) @@ -152,7 +152,7 @@ BOOL replayingSavedEvents; { if (aSelector == @selector(beginDragWithFiles:)) return @"beginDragWithFiles"; - if (aSelector == @selector(contextClick:)) + if (aSelector == @selector(contextClick)) return @"contextClick"; if (aSelector == @selector(enableDOMUIEventLogging:)) return @"enableDOMUIEventLogging"; @@ -494,7 +494,7 @@ static int buildModifierFlags(const WebScriptObject* modifiers) [self mouseScrollByX:x andY:y continuously:NO]; } -- (void)contextClick:(BOOL)shouldPrintMenuItems +- (NSArray *)contextClick { [[[mainFrame frameView] documentView] layout]; [self updateClickCountForButton:RightMouseButton]; @@ -510,21 +510,24 @@ static int buildModifierFlags(const WebScriptObject* modifiers) pressure:0.0]; NSView *subView = [[mainFrame webView] hitTest:[event locationInWindow]]; + NSMutableArray *menuItemStrings = [NSMutableArray array]; + if (subView) { NSMenu* menu = [subView menuForEvent:event]; - if (shouldPrintMenuItems) { - printf("ContextMenuItems: "); - for (int i = 0; i < [menu numberOfItems]; ++i) { - NSMenuItem* menuItem = [menu itemAtIndex:i]; - if (!strcmp("Inspect Element", [[menuItem title] UTF8String])) - continue; - if (i > 0) - printf(", "); - fputs([menuItem isSeparatorItem] ? "" : [[menuItem title] UTF8String], stdout); - } - printf("\n"); + + for (int i = 0; i < [menu numberOfItems]; ++i) { + NSMenuItem* menuItem = [menu itemAtIndex:i]; + if (!strcmp("Inspect Element", [[menuItem title] UTF8String])) + continue; + + if ([menuItem isSeparatorItem]) + [menuItemStrings addObject:@""]; + else + [menuItemStrings addObject:[menuItem title]]; } } + + return menuItemStrings; } - (void)scheduleAsynchronousClick diff --git a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm index 898235b..eb01090 100644 --- a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm +++ b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm @@ -31,6 +31,7 @@ #import "LayoutTestController.h" #import "EditingDelegate.h" +#import "MockGeolocationProvider.h" #import "PolicyDelegate.h" #import "WorkQueue.h" #import "WorkQueueItem.h" @@ -47,7 +48,7 @@ #import #import #import -#import +#import #import #import #import @@ -55,6 +56,7 @@ #import #import #import +#import #import #import #import @@ -298,14 +300,17 @@ void LayoutTestController::setDomainRelaxationForbiddenForURLScheme(bool forbidd void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy) { - [WebGeolocationMock setPosition:latitude:longitude:accuracy]; + WebGeolocationPosition *position = [[WebGeolocationPosition alloc] initWithTimestamp:0 latitude:latitude longitude:longitude accuracy:accuracy]; + [[MockGeolocationProvider shared] setPosition:position]; + [position release]; } void LayoutTestController::setMockGeolocationError(int code, JSStringRef message) { RetainPtr messageCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, message)); NSString *messageNS = (NSString *)messageCF.get(); - [WebGeolocationMock setError:code:messageNS]; + NSError *error = [NSError errorWithDomain:WebKitErrorDomain code:code userInfo:[NSDictionary dictionaryWithObject:messageNS forKey:NSLocalizedDescriptionKey]]; + [[MockGeolocationProvider shared] setError:error]; } void LayoutTestController::setIconDatabaseEnabled(bool iconDatabaseEnabled) diff --git a/WebKitTools/DumpRenderTree/mac/MockGeolocationProvider.h b/WebKitTools/DumpRenderTree/mac/MockGeolocationProvider.h new file mode 100644 index 0000000..311d1e9 --- /dev/null +++ b/WebKitTools/DumpRenderTree/mac/MockGeolocationProvider.h @@ -0,0 +1,47 @@ +/* + * 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 + * 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 MockGeolocationProvider_h +#define MockGeolocationProvider_h + +#import +#import + +@interface MockGeolocationProvider : NSObject { + WebGeolocationPosition *_lastPosition; + NSError *_error; + NSTimer *_timer; + HashSet _registeredViews; +} + ++ (MockGeolocationProvider *)shared; + +- (void)setPosition:(WebGeolocationPosition *)position; +- (void)setError:(NSError *)error; + +- (void)stopTimer; + +@end +#endif diff --git a/WebKitTools/DumpRenderTree/mac/MockGeolocationProvider.mm b/WebKitTools/DumpRenderTree/mac/MockGeolocationProvider.mm new file mode 100644 index 0000000..55d7257 --- /dev/null +++ b/WebKitTools/DumpRenderTree/mac/MockGeolocationProvider.mm @@ -0,0 +1,109 @@ +/* + * 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 + * 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. + */ + +#import "MockGeolocationProvider.h" + + +@implementation MockGeolocationProvider + ++ (MockGeolocationProvider *)shared +{ + static MockGeolocationProvider *provider = [[MockGeolocationProvider alloc] init]; + return provider; +} + +- (void)dealloc +{ + ASSERT(_registeredViews.isEmpty()); + + [_lastPosition release]; + [_error release]; + [super dealloc]; +} + +- (void)setPosition:(WebGeolocationPosition *)position +{ + if (_lastPosition != position) { + [_lastPosition release]; + _lastPosition = [position retain]; + } + + [_error release]; + _error = 0; + + if (!_timer) + _timer = [NSTimer scheduledTimerWithTimeInterval:0 target:self selector:@selector(timerFired) userInfo:0 repeats:NO]; +} + +- (void)setError:(NSError *)error +{ + if (_error != error) { + [_error release]; + _error = [error retain]; + } + + [_lastPosition release]; + _lastPosition = 0; + + if (!_timer) + _timer = [NSTimer scheduledTimerWithTimeInterval:0 target:self selector:@selector(timerFired) userInfo:0 repeats:NO]; +} + +- (void)registerWebView:(WebView *)webView +{ + _registeredViews.add(webView); +} + +- (void)unregisterWebView:(WebView *)webView +{ + _registeredViews.remove(webView); +} + +- (WebGeolocationPosition *)lastPosition +{ + return _lastPosition; +} + +- (void)stopTimer +{ + [_timer invalidate]; + _timer = 0; +} + +- (void)timerFired +{ + _timer = 0; + + // Expect that views won't be (un)registered while iterating. + HashSet views = _registeredViews; + for (HashSet::iterator iter = views.begin(); iter != views.end(); ++iter) { + if (_error) + [*iter _geolocationDidFailWithError:_error]; + else + [*iter _geolocationDidChangePosition:_lastPosition]; + } +} + +@end diff --git a/WebKitTools/DumpRenderTree/mac/UIDelegate.mm b/WebKitTools/DumpRenderTree/mac/UIDelegate.mm index 19ceb95..e6754c1 100644 --- a/WebKitTools/DumpRenderTree/mac/UIDelegate.mm +++ b/WebKitTools/DumpRenderTree/mac/UIDelegate.mm @@ -157,12 +157,11 @@ DumpRenderTreeDraggingInfo *draggingInfo = nil; - (void)webView:(WebView *)webView decidePolicyForGeolocationRequestFromOrigin:(WebSecurityOrigin *)origin frame:(WebFrame *)frame listener:(id)listener { - if (gLayoutTestController->isGeolocationPermissionSet()) { - if (gLayoutTestController->geolocationPermission()) - [listener allow]; - else - [listener deny]; - } + // FIXME: If mock permission isn't set yet, we should send the response asynchronously. + if (gLayoutTestController->isGeolocationPermissionSet() && gLayoutTestController->geolocationPermission()) + [listener allow]; + else + [listener deny]; } - (BOOL)webView:(WebView *)sender shouldHaltPlugin:(DOMNode *)pluginNode diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp index ba9780b..f5fbb5c 100644 --- a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp +++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp @@ -135,9 +135,9 @@ void checkPermissionCallback(QObject* receiver, const QUrl& url, NotificationPer qobject_cast(receiver)->checkPermission(url, permission); } -void requestPermissionCallback(QObject* receiver, QWebPage* page, const QString& origin) +void requestPermissionCallback(QObject* receiver, const QString& origin) { - qobject_cast(receiver)->requestPermission(page, origin); + qobject_cast(receiver)->requestPermission(origin); } WebPage::WebPage(QObject* parent, DumpRenderTree* drt) @@ -153,14 +153,13 @@ WebPage::WebPage(QObject* parent, DumpRenderTree* drt) globalSettings->setFontSize(QWebSettings::DefaultFixedFontSize, 13); globalSettings->setAttribute(QWebSettings::JavascriptCanOpenWindows, true); - globalSettings->setAttribute(QWebSettings::DOMPasteAllowed, true); + globalSettings->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true); globalSettings->setAttribute(QWebSettings::LinksIncludedInFocusChain, false); globalSettings->setAttribute(QWebSettings::PluginsEnabled, true); globalSettings->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, true); globalSettings->setAttribute(QWebSettings::JavascriptEnabled, true); globalSettings->setAttribute(QWebSettings::PrivateBrowsingEnabled, false); globalSettings->setAttribute(QWebSettings::SpatialNavigationEnabled, false); - globalSettings->setAttribute(QWebSettings::JavaScriptCanAccessClipboard, true); connect(this, SIGNAL(geometryChangeRequested(const QRect &)), this, SLOT(setViewGeometry(const QRect & ))); @@ -168,7 +167,7 @@ WebPage::WebPage(QObject* parent, DumpRenderTree* drt) setNetworkAccessManager(m_drt->networkAccessManager()); setPluginFactory(new TestPlugin(this)); - DumpRenderTreeSupportQt::setNotificationsReceiver(this, m_drt); + DumpRenderTreeSupportQt::setNotificationsReceiver(m_drt); DumpRenderTreeSupportQt::setCheckPermissionFunction(checkPermissionCallback); DumpRenderTreeSupportQt::setRequestPermissionFunction(requestPermissionCallback); @@ -201,7 +200,7 @@ void WebPage::resetSettings() settings()->resetAttribute(QWebSettings::OfflineWebApplicationCacheEnabled); settings()->resetAttribute(QWebSettings::LocalContentCanAccessRemoteUrls); settings()->resetAttribute(QWebSettings::PluginsEnabled); - settings()->resetAttribute(QWebSettings::JavaScriptCanAccessClipboard); + settings()->resetAttribute(QWebSettings::JavascriptCanAccessClipboard); settings()->resetAttribute(QWebSettings::AutoLoadImages); m_drt->layoutTestController()->setCaretBrowsingEnabled(false); @@ -349,24 +348,51 @@ QObject* WebPage::createPlugin(const QString& classId, const QUrl& url, const QS #endif } +bool WebPage::allowGeolocationRequest(QWebFrame *) +{ + return m_drt->layoutTestController()->geolocationPermission(); +} + +WebViewGraphicsBased::WebViewGraphicsBased(QWidget* parent) + : m_item(new QGraphicsWebView) +{ + setScene(new QGraphicsScene(this)); + scene()->addItem(m_item); +} + DumpRenderTree::DumpRenderTree() : m_dumpPixels(false) , m_stdin(0) , m_enableTextOutput(false) , m_singleFileMode(false) + , m_graphicsBased(false) , m_persistentStoragePath(QString(getenv("DUMPRENDERTREE_TEMP"))) { + + QByteArray viewMode = getenv("QT_DRT_WEBVIEW_MODE"); + if (viewMode == "graphics") + setGraphicsBased(true); + DumpRenderTreeSupportQt::overwritePluginDirectories(); QWebSettings::enablePersistentStorage(m_persistentStoragePath); m_networkAccessManager = new NetworkAccessManager(this); // create our primary testing page/view. - m_mainView = new QWebView(0); - m_mainView->resize(QSize(LayoutTestController::maxViewWidth, LayoutTestController::maxViewHeight)); - m_page = new WebPage(m_mainView, this); - m_mainView->setPage(m_page); + if (isGraphicsBased()) { + WebViewGraphicsBased* view = new WebViewGraphicsBased(0); + m_page = new WebPage(view, this); + view->setPage(m_page); + m_mainView = view; + } else { + QWebView* view = new QWebView(0); + m_page = new WebPage(view, this); + view->setPage(m_page); + m_mainView = view; + } + m_mainView->setContextMenuPolicy(Qt::NoContextMenu); + m_mainView->resize(QSize(LayoutTestController::maxViewWidth, LayoutTestController::maxViewHeight)); // clean up cache by resetting quota. qint64 quota = webPage()->settings()->offlineWebApplicationCacheQuota(); @@ -687,10 +713,18 @@ static QString dumpHistoryItem(const QWebHistoryItem& item, int indent, bool cur result.append(url); } - // FIXME: Wrong, need (private?) API for determining this. - result.append(QLatin1String(" **nav target**")); + QString target = DumpRenderTreeSupportQt::historyItemTarget(item); + if (!target.isEmpty()) + result.append(QString(QLatin1String(" (in frame \"%1\")")).arg(target)); + + if (DumpRenderTreeSupportQt::isTargetItem(item)) + result.append(QLatin1String(" **nav target**")); result.append(QLatin1String("\n")); + QList children = DumpRenderTreeSupportQt::getChildHistoryItems(item); + for (int i = 0; i < children.size(); ++i) + result += dumpHistoryItem(children.at(i), 12, false); + return result; } @@ -920,9 +954,9 @@ void DumpRenderTree::checkPermission(const QUrl& url, NotificationPermission& pe permission = m_controller->checkDesktopNotificationPermission(url.scheme() + "://" + url.host()) ? NotificationAllowed : NotificationDenied; } -void DumpRenderTree::requestPermission(QWebPage* page, const QString& origin) +void DumpRenderTree::requestPermission(const QString& origin) { - DumpRenderTreeSupportQt::allowNotificationForOrigin(page, origin); + DumpRenderTreeSupportQt::allowNotificationForOrigin(origin); } #if defined(Q_WS_X11) diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h index 3fa4485..2ec972a 100644 --- a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h +++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h @@ -41,6 +41,8 @@ #endif #include "../../../WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h" +#include +#include #include #include #include @@ -80,6 +82,9 @@ public: void setSingleFileMode(bool flag) { m_singleFileMode = flag; } bool isSingleFileMode() { return m_singleFileMode; } + void setGraphicsBased(bool flag) { m_graphicsBased = flag; } + bool isGraphicsBased() { return m_graphicsBased; } + void setDumpPixels(bool); void closeRemainingWindows(); @@ -115,7 +120,7 @@ public Q_SLOTS: void statusBarMessage(const QString& message); void windowCloseRequested(); void checkPermission(const QUrl&, NotificationPermission&); - void requestPermission(QWebPage* page, const QString&); + void requestPermission(const QString&); Q_SIGNALS: void quit(); @@ -135,7 +140,7 @@ private: QString m_expectedHash; WebPage *m_page; - QWebView* m_mainView; + QWidget* m_mainView; EventSender *m_eventSender; TextInputController *m_textInputController; @@ -147,6 +152,7 @@ private: QList windows; bool m_enableTextOutput; bool m_singleFileMode; + bool m_graphicsBased; QString m_persistentStoragePath; }; @@ -185,6 +191,7 @@ public: public slots: bool shouldInterruptJavaScript() { return false; } + bool allowGeolocationRequest(QWebFrame *frame); protected: bool acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest& request, NavigationType type); @@ -202,6 +209,18 @@ private: DumpRenderTree *m_drt; }; +class WebViewGraphicsBased : public QGraphicsView { + Q_OBJECT + +public: + WebViewGraphicsBased(QWidget* parent); + QGraphicsWebView* graphicsView() const { return m_item; } + void setPage(QWebPage* page) { m_item->setPage(page); } + +private: + QGraphicsWebView* m_item; +}; + } #endif diff --git a/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp b/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp index a548a63..7ec505f 100644 --- a/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp +++ b/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp @@ -29,8 +29,7 @@ #include "config.h" #include "EventSenderQt.h" -//#include - +#include #include #define KEYCODE_DEL 127 @@ -111,10 +110,16 @@ void EventSender::mouseDown(int button) m_mouseButtons |= mouseButton; // qDebug() << "EventSender::mouseDown" << frame; - QMouseEvent* event; - event = new QMouseEvent((m_clickCount == 2) ? QEvent::MouseButtonDblClick : + QEvent* event; + if (isGraphicsBased()) { + event = createGraphicsSceneMouseEvent((m_clickCount == 2) ? + QEvent::GraphicsSceneMouseDoubleClick : QEvent::GraphicsSceneMousePress, + m_mousePos, m_mousePos, mouseButton, m_mouseButtons, Qt::NoModifier); + } else { + event = new QMouseEvent((m_clickCount == 2) ? QEvent::MouseButtonDblClick : QEvent::MouseButtonPress, m_mousePos, m_mousePos, mouseButton, m_mouseButtons, Qt::NoModifier); + } sendOrQueueEvent(event); @@ -146,7 +151,15 @@ void EventSender::mouseUp(int button) m_mouseButtons &= ~mouseButton; // qDebug() << "EventSender::mouseUp" << frame; - QMouseEvent* event = new QMouseEvent(QEvent::MouseButtonRelease, m_mousePos, m_mousePos, mouseButton, m_mouseButtons, Qt::NoModifier); + QEvent* event; + if (isGraphicsBased()) { + event = createGraphicsSceneMouseEvent(QEvent::GraphicsSceneMouseRelease, + m_mousePos, m_mousePos, mouseButton, m_mouseButtons, Qt::NoModifier); + } else { + event = new QMouseEvent(QEvent::MouseButtonRelease, + m_mousePos, m_mousePos, mouseButton, m_mouseButtons, Qt::NoModifier); + } + sendOrQueueEvent(event); } @@ -154,7 +167,16 @@ void EventSender::mouseMoveTo(int x, int y) { // qDebug() << "EventSender::mouseMoveTo" << x << y; m_mousePos = QPoint(x, y); - QMouseEvent* event = new QMouseEvent(QEvent::MouseMove, m_mousePos, m_mousePos, Qt::NoButton, m_mouseButtons, Qt::NoModifier); + + QEvent* event; + if (isGraphicsBased()) { + event = createGraphicsSceneMouseEvent(QEvent::GraphicsSceneMouseMove, + m_mousePos, m_mousePos, Qt::NoButton, m_mouseButtons, Qt::NoModifier); + } else { + event = new QMouseEvent(QEvent::MouseMove, + m_mousePos, m_mousePos, Qt::NoButton, m_mouseButtons, Qt::NoModifier); + } + sendOrQueueEvent(event); } @@ -306,19 +328,19 @@ void EventSender::keyDown(const QString& string, const QStringList& modifiers, u } } QKeyEvent event(QEvent::KeyPress, code, modifs, s); - QApplication::sendEvent(m_page, &event); + sendEvent(m_page, &event); QKeyEvent event2(QEvent::KeyRelease, code, modifs, s); - QApplication::sendEvent(m_page, &event2); + sendEvent(m_page, &event2); } void EventSender::contextClick() { QMouseEvent event(QEvent::MouseButtonPress, m_mousePos, Qt::RightButton, Qt::RightButton, Qt::NoModifier); - QApplication::sendEvent(m_page, &event); + sendEvent(m_page, &event); QMouseEvent event2(QEvent::MouseButtonRelease, m_mousePos, Qt::RightButton, Qt::RightButton, Qt::NoModifier); - QApplication::sendEvent(m_page, &event2); + sendEvent(m_page, &event2); QContextMenuEvent event3(QContextMenuEvent::Mouse, m_mousePos); - QApplication::sendEvent(m_page->view(), &event3); + sendEvent(m_page->view(), &event3); } void EventSender::scheduleAsynchronousClick() @@ -431,7 +453,7 @@ void EventSender::sendTouchEvent(QEvent::Type type) #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) QTouchEvent event(type, QTouchEvent::TouchScreen, m_touchModifiers); event.setTouchPoints(m_touchPoints); - QApplication::sendEvent(m_page, &event); + sendEvent(m_page, &event); QList::Iterator it = m_touchPoints.begin(); while (it != m_touchPoints.end()) { if (it->state() == Qt::TouchPointReleased) @@ -493,7 +515,7 @@ void EventSender::sendOrQueueEvent(QEvent* event) // 3. A call to mouseMoveTo while the mouse button is pressed could initiate a drag operation, and that does not return until mouseUp is processed. // To be safe and avoid a deadlock, this event is queued. if (endOfQueue == startOfQueue && !eventQueue[endOfQueue].m_delay && (!(m_mouseButtonPressed && (m_eventLoop && event->type() == QEvent::MouseButtonRelease)))) { - QApplication::sendEvent(m_page->view(), event); + sendEvent(m_page->view(), event); delete event; return; } @@ -541,13 +563,16 @@ bool EventSender::eventFilter(QObject* watched, QEvent* event) case QEvent::Leave: return true; case QEvent::MouseButtonPress: + case QEvent::GraphicsSceneMousePress: m_mouseButtonPressed = true; break; case QEvent::MouseMove: + case QEvent::GraphicsSceneMouseMove: if (m_mouseButtonPressed) m_drag = true; break; case QEvent::MouseButtonRelease: + case QEvent::GraphicsSceneMouseRelease: m_mouseButtonPressed = false; m_drag = false; break; @@ -562,3 +587,24 @@ void EventSender::timerEvent(QTimerEvent* ev) { m_clickTimer.stop(); } + +QGraphicsSceneMouseEvent* EventSender::createGraphicsSceneMouseEvent(QEvent::Type type, const QPoint& pos, const QPoint& screenPos, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) +{ + QGraphicsSceneMouseEvent* event; + event = new QGraphicsSceneMouseEvent(type); + event->setPos(pos); + event->setScreenPos(screenPos); + event->setButton(button); + event->setButtons(buttons); + event->setModifiers(modifiers); + + return event; +} + +void EventSender::sendEvent(QObject* receiver, QEvent* event) +{ + if (WebCore::WebViewGraphicsBased* view = qobject_cast(receiver)) + view->scene()->sendEvent(view->graphicsView(), event); + else + QApplication::sendEvent(receiver, event); +} diff --git a/WebKitTools/DumpRenderTree/qt/EventSenderQt.h b/WebKitTools/DumpRenderTree/qt/EventSenderQt.h index d5b45ac..51c8325 100644 --- a/WebKitTools/DumpRenderTree/qt/EventSenderQt.h +++ b/WebKitTools/DumpRenderTree/qt/EventSenderQt.h @@ -29,6 +29,9 @@ #ifndef EventSenderQt_h #define EventSenderQt_h + +#include "DumpRenderTreeQt.h" + #include #include #include @@ -83,6 +86,11 @@ protected: void timerEvent(QTimerEvent*); private: + bool isGraphicsBased() const { return qobject_cast(m_page->view()); } + QGraphicsSceneMouseEvent* createGraphicsSceneMouseEvent(QEvent::Type, const QPoint& pos, const QPoint& screenPos, Qt::MouseButton, Qt::MouseButtons, Qt::KeyboardModifiers); + void sendEvent(QObject* receiver, QEvent* event); + +private: void sendTouchEvent(QEvent::Type); void sendOrQueueEvent(QEvent*); void replaySavedEvents(bool flush); diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp index 9079be2..8450376 100644 --- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp +++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp @@ -410,7 +410,7 @@ void LayoutTestController::setMainFrameIsFirstResponder(bool isFirst) void LayoutTestController::setJavaScriptCanAccessClipboard(bool enable) { - m_drt->webPage()->settings()->setAttribute(QWebSettings::JavaScriptCanAccessClipboard, enable); + m_drt->webPage()->settings()->setAttribute(QWebSettings::JavascriptCanAccessClipboard, enable); } void LayoutTestController::setXSSAuditorEnabled(bool enable) @@ -513,6 +513,8 @@ void LayoutTestController::overridePreference(const QString& name, const QVarian setCaretBrowsingEnabled(value.toBool()); else if (name == "WebKitPluginsEnabled") settings->setAttribute(QWebSettings::PluginsEnabled, value.toBool()); + else if (name == "WebKitWebGLEnabled") + settings->setAttribute(QWebSettings::WebGLEnabled, value.toBool()); else printf("ERROR: LayoutTestController::overridePreference() does not support the '%s' preference\n", name.toLatin1().data()); @@ -564,8 +566,7 @@ int LayoutTestController::numberOfPages(float width, float height) bool LayoutTestController::callShouldCloseOnWebView() { - // FIXME: Implement for testing fix for https://bugs.webkit.org/show_bug.cgi?id=27481 - return false; + return DumpRenderTreeSupportQt::shouldClose(m_drt->webPage()->mainFrame()); } void LayoutTestController::setScrollbarPolicy(const QString& orientation, const QString& policy) @@ -645,5 +646,21 @@ void LayoutTestController::setEditingBehavior(const QString& editingBehavior) DumpRenderTreeSupportQt::setEditingBehavior(m_drt->webPage(), editingBehavior); } +void LayoutTestController::setGeolocationPermission(bool allow) +{ + m_isGeolocationPermissionSet = true; + m_geolocationPermission = allow; +} + +void LayoutTestController::setMockGeolocationError(int code, const QString& message) +{ + DumpRenderTreeSupportQt::setMockGeolocationError(code, message); +} + +void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy) +{ + DumpRenderTreeSupportQt::setMockGeolocationPosition(latitude, longitude, accuracy); +} + const unsigned LayoutTestController::maxViewWidth = 800; const unsigned LayoutTestController::maxViewHeight = 600; diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h index d7bb839..a041ad0 100644 --- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h +++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h @@ -180,6 +180,15 @@ public slots: int pageNumberForElementById(const QString& id, float width = 0, float height = 0); int numberOfPages(float width = maxViewWidth, float height = maxViewHeight); bool callShouldCloseOnWebView(); + // For now, this is a no-op. This may change depending on outcome of + // https://bugs.webkit.org/show_bug.cgi?id=33333 + void setCallCloseOnWebViews() {} + + void setMockGeolocationError(int code, const QString& message); + void setMockGeolocationPosition(double latitude, double longitude, double accuracy); + void setGeolocationPermission(bool allow); + bool isGeolocationPermissionSet() const { return m_isGeolocationPermissionSet; } + bool geolocationPermission() const { return m_geolocationPermission; } /* Policy values: 'on', 'auto' or 'off'. @@ -212,6 +221,8 @@ private: bool m_handleErrorPages; bool m_loadFinished; bool m_globalFlag; + bool m_isGeolocationPermissionSet; + bool m_geolocationPermission; QUrl m_userStyleSheetLocation; QBasicTimer m_timeoutTimer; diff --git a/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp b/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp index 9f00ae4..6aef32e 100644 --- a/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp +++ b/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp @@ -100,6 +100,12 @@ AccessibilityUIElement AccessibilityUIElement::elementAtPoint(int x, int y) return 0; } +AccessibilityUIElement AccessibilityUIElement::linkedUIElementAtIndex(unsigned index) +{ + // FIXME: implement + return 0; +} + AccessibilityUIElement AccessibilityUIElement::getChildAtIndex(unsigned index) { COMPtr child; diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp index b22f342..1ed54d5 100644 --- a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp +++ b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp @@ -969,8 +969,10 @@ static void runTest(const string& testPathOrURL) DispatchMessage(&msg); } - if (shouldEnableDeveloperExtras(pathOrURL.c_str())) + if (shouldEnableDeveloperExtras(pathOrURL.c_str())) { gLayoutTestController->closeWebInspector(); + gLayoutTestController->setDeveloperExtrasEnabled(false); + } resetWebViewToConsistentStateBeforeTesting(); diff --git a/WebKitTools/GtkLauncher/main.c b/WebKitTools/GtkLauncher/main.c index 2f9350d..e6d69a9 100644 --- a/WebKitTools/GtkLauncher/main.c +++ b/WebKitTools/GtkLauncher/main.c @@ -25,6 +25,7 @@ */ #include +#include #include static GtkWidget* main_window; @@ -186,6 +187,21 @@ create_window () return window; } +static gchar* filenameToURL(const char* filename) +{ + if (!g_file_test(filename, G_FILE_TEST_EXISTS)) + return 0; + + gchar *fullPath = realpath(filename, 0); + if (!fullPath) + return 0; + + gchar *fileURL = g_filename_to_uri(fullPath, 0, 0); + free(fullPath); + + return fileURL; +} + int main (int argc, char* argv[]) { @@ -201,8 +217,11 @@ main (int argc, char* argv[]) main_window = create_window (); gtk_container_add (GTK_CONTAINER (main_window), vbox); - gchar* uri = (gchar*) (argc > 1 ? argv[1] : "http://www.google.com/"); - webkit_web_view_load_uri (web_view, uri); + gchar *uri = (gchar*) (argc > 1 ? argv[1] : "http://www.google.com/"); + gchar *fileURL = filenameToURL(uri); + + webkit_web_view_load_uri(web_view, fileURL ? fileURL : uri); + g_free(fileURL); gtk_widget_grab_focus (GTK_WIDGET (web_view)); gtk_widget_show_all (main_window); diff --git a/WebKitTools/QtTestBrowser/main.cpp b/WebKitTools/QtTestBrowser/main.cpp index ca3bf7a..bd3be9e 100644 --- a/WebKitTools/QtTestBrowser/main.cpp +++ b/WebKitTools/QtTestBrowser/main.cpp @@ -92,6 +92,28 @@ static bool gUseFrameFlattening = false; static bool gUseQGLWidgetViewport = false; #endif +class NotificationsPermissionController : public QObject { + Q_OBJECT +public: + NotificationsPermissionController(QObject* parent) : QObject(parent) + { + DumpRenderTreeSupportQt::setNotificationsReceiver(this); + DumpRenderTreeSupportQt::setCheckPermissionFunction(checkPermission); + DumpRenderTreeSupportQt::setRequestPermissionFunction(requestPermission); + } + + static void checkPermission(QObject*, const QUrl&, NotificationPermission& permission) + { + permission = NotificationAllowed; + } + + static void requestPermission(QObject*, const QString& origin) + { + DumpRenderTreeSupportQt::allowNotificationForOrigin(origin); + } +}; + +NotificationsPermissionController* notificationsPermissionController = 0; class LauncherWindow : public MainWindow { Q_OBJECT @@ -144,6 +166,7 @@ protected slots: void changeViewportUpdateMode(int mode); void toggleFrameFlattening(bool toggle); void toggleInterruptingJavaScriptEnabled(bool enable); + void toggleJavascriptCanOpenWindows(bool enable); #if defined(QT_CONFIGURED_WITH_OPENGL) void toggleQGLWidgetViewport(bool enable); @@ -210,6 +233,8 @@ LauncherWindow::LauncherWindow(LauncherWindow* other, bool shareScene) } createChrome(); + if (!notificationsPermissionController) + notificationsPermissionController = new NotificationsPermissionController(QCoreApplication::instance()); } LauncherWindow::~LauncherWindow() @@ -238,8 +263,10 @@ void LauncherWindow::init(bool useGraphicsView) connect(this, SIGNAL(enteredFullScreenMode(bool)), this, SLOT(toggleFullScreenMode(bool))); m_inspector = new WebInspector(splitter); +#ifndef QT_NO_PROPERTIES if (!gInspectorUrl.isEmpty()) m_inspector->setProperty("_q_inspectorUrl", gInspectorUrl); +#endif m_inspector->setPage(page()); m_inspector->hide(); connect(this, SIGNAL(destroyed()), m_inspector, SLOT(deleteLater())); @@ -705,6 +732,11 @@ void LauncherWindow::toggleInterruptingJavaScriptEnabled(bool enable) page()->setInterruptingJavaScriptEnabled(enable); } +void LauncherWindow::toggleJavascriptCanOpenWindows(bool enable) +{ + page()->settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, enable); +} + #if defined(QT_CONFIGURED_WITH_OPENGL) void LauncherWindow::toggleQGLWidgetViewport(bool enable) { @@ -904,6 +936,10 @@ void LauncherWindow::createChrome() toggleInterruptingJavaScripteEnabled->setCheckable(true); toggleInterruptingJavaScripteEnabled->setChecked(false); + QAction* toggleJavascriptCanOpenWindows = toolsMenu->addAction("Enable js popup windows", this, SLOT(toggleJavascriptCanOpenWindows(bool))); + toggleJavascriptCanOpenWindows->setCheckable(true); + toggleJavascriptCanOpenWindows->setChecked(false); + #if defined(QT_CONFIGURED_WITH_OPENGL) QAction* toggleQGLWidgetViewport = graphicsViewMenu->addAction("Toggle use of QGLWidget Viewport", this, SLOT(toggleQGLWidgetViewport(bool))); toggleQGLWidgetViewport->setCheckable(true); diff --git a/WebKitTools/Scripts/build-webkit b/WebKitTools/Scripts/build-webkit index e70117f..a29a6fd 100755 --- a/WebKitTools/Scripts/build-webkit +++ b/WebKitTools/Scripts/build-webkit @@ -56,7 +56,7 @@ my $makeArgs; my $startTime = time(); my ($threeDCanvasSupport, $threeDRenderingSupport, $channelMessagingSupport, $clientBasedGeolocationSupport, $databaseSupport, $datagridSupport, $datalistSupport, - $domStorageSupport, $eventsourceSupport, $filtersSupport, $geolocationSupport, $iconDatabaseSupport, $indexedDatabaseSupport, + $domStorageSupport, $eventsourceSupport, $filtersSupport, $geolocationSupport, $iconDatabaseSupport, $imageResizerSupport, $indexedDatabaseSupport, $javaScriptDebuggerSupport, $mathmlSupport, $offlineWebApplicationSupport, $rubySupport, $systemMallocSupport, $sandboxSupport, $sharedWorkersSupport, $svgSupport, $svgAnimationSupport, $svgAsImageSupport, $svgDOMObjCBindingsSupport, $svgFontsSupport, $svgForeignObjectSupport, $svgUseSupport, $videoSupport, $webSocketsSupport, $wmlSupport, $wcssSupport, $xhtmlmpSupport, $workersSupport, @@ -105,6 +105,9 @@ my @features = ( { option => "icon-database", desc => "Toggle Icon database support", define => "ENABLE_ICONDATABASE", default => 1, value => \$iconDatabaseSupport }, + + { option => "image-resizer", desc => "Toggle Image Resizer API support", + define => "ENABLE_IMAGE_RESIZER", default => 0, value => \$imageResizerSupport }, { option => "indexed-database", desc => "Toggle Indexed Database API support", define => "ENABLE_INDEXED_DATABASE", default => 0, value => \$indexedDatabaseSupport }, diff --git a/WebKitTools/Scripts/do-webcore-rename b/WebKitTools/Scripts/do-webcore-rename index 32dd05e..e2ce019 100755 --- a/WebKitTools/Scripts/do-webcore-rename +++ b/WebKitTools/Scripts/do-webcore-rename @@ -29,16 +29,42 @@ # Script to do a rename in JavaScriptCore, WebCore, and WebKit. use strict; + +use File::Find; use FindBin; +use Getopt::Long qw(:config pass_through); + use lib $FindBin::Bin; use webkitdirs; -use File::Find; use VCSUtils; setConfiguration(); chdirWebKit(); -my %words; +my $showHelp; +my $verbose; + +my $programName = basename($0); +my $usage = < \$showHelp, + 'verbose|v' => \$verbose, +); + +if (!$getOptionsResult || $showHelp) { + print STDERR $usage; + exit 1; +} + +my @directoriesToIgnoreList = ( + "icu", +); +my %directoriesToIgnore = map { $_ => 1 } @directoriesToIgnoreList; # find all files we want to process @@ -52,17 +78,13 @@ sub wanted { my $file = $_; - if ($file eq "icu") { - $File::Find::prune = 1; - return; - } - - if ($file =~ /^\../) { + # Ignore excluded and hidden files/directories. + if ($directoriesToIgnore{$file} or $file =~ /^\../ or $file =~ /^ChangeLog/) { + print "Ignoring $File::Find::name\n" if $verbose; $File::Find::prune = 1; return; } - return if $file =~ /^ChangeLog/; return if -d $file; push @paths, $File::Find::name; @@ -70,28 +92,10 @@ sub wanted # Setting isDOMTypeRename to 1 rather than 0 expands the regexps used # below to handle custom JavaScript bindings. -my $isDOMTypeRename = 1; +my $isDOMTypeRename = 0; my %renames = ( - "WebGLArray" => "ArrayBufferView", - "WebGLArrayBuffer" => "ArrayBuffer", - "WebGLByteArray" => "Int8Array", - "WebGLFloatArray" => "FloatArray", - "WebGLIntArray" => "Int32Array", - "WebGLIntegralTypedArrayBase" => "IntegralTypedArrayBase", - "WebGLShortArray" => "Int16Array", - "WebGLUnsignedByteArray" => "Uint8Array", - "WebGLUnsignedIntArray" => "Uint32Array", - "WebGLUnsignedShortArray" => "Uint16Array", - "WebGLTypedArrayBase" => "TypedArrayBase", - # JSDOMWindow constructors. - "webGLArrayBuffer" => "arrayBuffer", - "webGLByteArray" => "int8Array", - "webGLFloatArray" => "floatArray", - "webGLIntArray" => "int32Array", - "webGLShortArray" => "int16Array", - "webGLUnsignedByteArray" => "uint8Array", - "webGLUnsignedIntArray" => "uint32Array", - "webGLUnsignedShortArray" => "uint16Array", + # Renames go here in the form of: + # "Tokenizer" => "DocumentParser", ); my %renamesContemplatedForTheFuture = ( @@ -224,7 +228,7 @@ for my $file (sort @paths) { my $contents; { local $/; - open FILE, $file or die; + open FILE, $file or die "Failed to open $file"; $contents = ; close FILE; } @@ -242,7 +246,7 @@ for my $file (sort @paths) { } if ($newContents ne $contents) { - open FILE, ">", $file or die; + open FILE, ">", $file or die "Failed to open $file"; print FILE $newContents; close FILE; } diff --git a/WebKitTools/Scripts/ensure-valid-python b/WebKitTools/Scripts/ensure-valid-python old mode 100644 new mode 100755 index c21ad4e..4640a01 --- a/WebKitTools/Scripts/ensure-valid-python +++ b/WebKitTools/Scripts/ensure-valid-python @@ -31,6 +31,7 @@ use File::Basename; use File::Spec; use File::Temp qw(tempdir); use FindBin; +use Getopt::Long; use lib $FindBin::Bin; use webkitdirs; @@ -41,7 +42,7 @@ my $macPythonMD5 = "84489bba813fdbb6041b69d4310a86da"; my $macPythonInstallerName = "Python.mpkg"; # We could use a consistent download location, like the source or build directory. -my $tempDirectory = File::Temp->newdir(); +my $tempDirectory = File::Temp->tempdir("WebKitPythonXXXX"); my $downloadDirectory = $tempDirectory; my $mountPoint = File::Spec->join($tempDirectory, "mount"); @@ -117,11 +118,27 @@ sub installMacPython() sub main() { + my $checkOnly = 0; + my $showHelp = 0; + my $getOptionsResult = GetOptions( + 'check-only!' => \$checkOnly, + 'help|h' => \$showHelp, + ); + if (!$getOptionsResult || $showHelp) { + print STDERR <catfile($tmpDir, "layout-test-results"); @@ -224,6 +226,11 @@ if (!defined($platform)) { $platform = "undefined"; } +if (!checkPythonVersion()) { + print "WARNING: Your platform does not have Python 2.5+, which is required to run websocket server, so disabling websocket/tests.\n"; + $testWebSocket = 0; +} + my $programName = basename($0); my $launchSafariDefault = $launchSafari ? "launch" : "do not launch"; my $httpDefault = $testHTTP ? "run" : "do not run"; @@ -457,6 +464,9 @@ if (!$testHTTP) { $ignoredDirectories{'http'} = 1; $ignoredDirectories{'websocket'} = 1; } +if (!$testWebSocket) { + $ignoredDirectories{'websocket'} = 1; +} if (!$testMedia) { $ignoredDirectories{'media'} = 1; @@ -1358,6 +1368,7 @@ sub openDumpTool() # Port spesifics if (isQt()) { $CLEAN_ENV{QTWEBKIT_PLUGIN_PATH} = productDir() . "/lib/plugins"; + $CLEAN_ENV{QT_DRT_WEBVIEW_MODE} = $ENV{"QT_DRT_WEBVIEW_MODE"}; } my @args = ($dumpTool, @toolArgs); @@ -1425,6 +1436,13 @@ sub configureAndOpenHTTPDIfNeeded() $isHttpdOpen = openHTTPD(@args); } +sub checkPythonVersion() +{ + # we have not chdir to sourceDir yet. + system sourceDir() . "/WebKitTools/Scripts/ensure-valid-python", "--check-only"; + return exitStatus($?) == 0; +} + sub openWebSocketServerIfNeeded() { return 1 if $isWebSocketServerOpen; diff --git a/WebKitTools/Scripts/run-bindings-tests b/WebKitTools/Scripts/run-bindings-tests index 56b2aff..4a093d1 100755 --- a/WebKitTools/Scripts/run-bindings-tests +++ b/WebKitTools/Scripts/run-bindings-tests @@ -116,6 +116,7 @@ def main(argv): 'V8', 'ObjC', 'GObject', + 'CPP' ] for generator in generators: @@ -128,7 +129,7 @@ def main(argv): print 'All tests passed!' return 0 else: - print '(To update the reference files, execute "run-bindings-test --reset-results")' + print '(To update the reference files, execute "run-bindings-tests --reset-results")' return -1 diff --git a/WebKitTools/Scripts/update-webkit-auxiliary-libs b/WebKitTools/Scripts/update-webkit-auxiliary-libs index 9c52449..19e4ad3 100755 --- a/WebKitTools/Scripts/update-webkit-auxiliary-libs +++ b/WebKitTools/Scripts/update-webkit-auxiliary-libs @@ -31,11 +31,12 @@ use strict; use warnings; -use HTTP::Date qw(str2time); use File::Find; -use File::Temp (); use File::Spec; +use File::Temp (); use FindBin; +use HTTP::Date qw(str2time); +use POSIX; use lib $FindBin::Bin; use webkitdirs; @@ -58,9 +59,21 @@ my $tmpDir = File::Spec->rel2abs(File::Temp::tempdir("webkitlibsXXXXXXX", TMPDIR print "Checking Last-Modified date of $zipFile...\n"; my $result = system "curl -s -I $auxiliaryLibsURL | grep Last-Modified > \"$tmpDir/$file.headers\""; -print STDERR "Couldn't check Last-Modified date of new $zipFile.\n" if $result; -if (!$result && open NEW, "$tmpDir/$file.headers") { +if (WEXITSTATUS($result)) { + print STDERR "Couldn't check Last-Modified date of new $zipFile.\n"; + print STDERR "Please ensure that $auxiliaryLibsURL is reachable.\n"; + + if (! -f "$webkitLibrariesDir/$file.headers") { + print STDERR "Unable to check Last-Modified date and no version of $file to fall back to.\n"; + exit 1; + } + + print STDERR "Falling back to existing version of $file.\n"; + exit 0; +} + +if (open NEW, "$tmpDir/$file.headers") { my $new = lastModifiedToUnixTime(); close NEW; diff --git a/WebKitTools/Scripts/webkitdirs.pm b/WebKitTools/Scripts/webkitdirs.pm index ca17757..33ae7da 100644 --- a/WebKitTools/Scripts/webkitdirs.pm +++ b/WebKitTools/Scripts/webkitdirs.pm @@ -115,7 +115,9 @@ sub determineBaseProductDir return if defined $baseProductDir; determineSourceDir(); - if (isAppleMacWebKit()) { + $baseProductDir = $ENV{"WEBKITOUTPUTDIR"}; + + if (!defined($baseProductDir) and isAppleMacWebKit()) { # Silently remove ~/Library/Preferences/xcodebuild.plist which can # cause build failure. The presence of # ~/Library/Preferences/xcodebuild.plist can prevent xcodebuild from @@ -148,7 +150,7 @@ sub determineBaseProductDir } if (!defined($baseProductDir)) { # Port-spesific checks failed, use default - $baseProductDir = $ENV{"WEBKITOUTPUTDIR"} || "$sourceDir/WebKitBuild"; + $baseProductDir = "$sourceDir/WebKitBuild"; } if (isGit() && isGitBranchBuild()) { @@ -1434,16 +1436,15 @@ sub buildGtkProject($$@) return buildAutotoolsProject($clean, @buildArgs); } -sub buildChromiumMakefile($$$) +sub buildChromiumMakefile($$) { - my ($dir, $target, $clean) = @_; - chdir $dir; + my ($target, $clean) = @_; if ($clean) { return system qw(rm -rf out); } my $config = configuration(); my $numCpus = (grep /processor/, `cat /proc/cpuinfo`) || 1; - my @command = ("make", "-j$numCpus", "BUILDTYPE=$config", $target); + my @command = ("make", "-fMakefile.chromium", "-j$numCpus", "BUILDTYPE=$config", $target); print join(" ", @command) . "\n"; return system @command; } @@ -1501,7 +1502,7 @@ sub buildChromium($@) $result = buildChromiumVisualStudioProject("WebKit/chromium/WebKit.sln", $clean); } elsif (isLinux()) { # Linux build - build using make. - $ result = buildChromiumMakefile("WebKit/chromium/", "all", $clean); + $ result = buildChromiumMakefile("all", $clean); } else { print STDERR "This platform is not supported by chromium.\n"; } diff --git a/WebKitTools/Scripts/webkitpy/common/checkout/changelog.py b/WebKitTools/Scripts/webkitpy/common/checkout/changelog.py index 6220fbd..40657eb 100644 --- a/WebKitTools/Scripts/webkitpy/common/checkout/changelog.py +++ b/WebKitTools/Scripts/webkitpy/common/checkout/changelog.py @@ -36,6 +36,8 @@ import textwrap from webkitpy.common.system.deprecated_logging import log from webkitpy.common.config.committers import CommitterList +from webkitpy.common.net.bugzilla import parse_bug_id + def view_source_url(revision_number): # FIMXE: This doesn't really belong in this file, but we don't have a @@ -88,6 +90,9 @@ class ChangeLogEntry(object): def contents(self): return self._contents + def bug_id(self): + return parse_bug_id(self._contents) + # FIXME: Various methods on ChangeLog should move into ChangeLogEntry instead. class ChangeLog(object): @@ -183,3 +188,8 @@ class ChangeLog(object): for line in fileinput.FileInput(self.path, inplace=1): # Trailing comma suppresses printing newline print line.replace("NOBODY (OOPS!)", reviewer.encode("utf-8")), + + def set_short_description_and_bug_url(self, short_description, bug_url): + message = "%s\n %s" % (short_description, bug_url) + for line in fileinput.FileInput(self.path, inplace=1): + print line.replace("Need a short description and bug URL (OOPS!)", message.encode("utf-8")), diff --git a/WebKitTools/Scripts/webkitpy/common/checkout/changelog_unittest.py b/WebKitTools/Scripts/webkitpy/common/checkout/changelog_unittest.py index 864428a..6aeb1f8 100644 --- a/WebKitTools/Scripts/webkitpy/common/checkout/changelog_unittest.py +++ b/WebKitTools/Scripts/webkitpy/common/checkout/changelog_unittest.py @@ -38,7 +38,7 @@ from StringIO import StringIO from webkitpy.common.checkout.changelog import * -class ChangeLogsTest(unittest.TestCase): +class ChangeLogTest(unittest.TestCase): _example_entry = u'''2009-08-17 Peter Kasting @@ -131,6 +131,18 @@ class ChangeLogsTest(unittest.TestCase): os.remove(changelog_path) self.assertEquals(actual_contents, expected_contents) + def test_set_short_description_and_bug_url(self): + changelog_contents = u"%s\n%s" % (self._new_entry_boilerplate, self._example_changelog) + changelog_path = self._write_tmp_file_with_contents(changelog_contents.encode("utf-8")) + short_description = "A short description" + bug_url = "http://example.com/b/2344" + ChangeLog(changelog_path).set_short_description_and_bug_url(short_description, bug_url) + actual_contents = self._read_file_contents(changelog_path, "utf-8") + expected_message = "%s\n %s" % (short_description, bug_url) + expected_contents = changelog_contents.replace("Need a short description and bug URL (OOPS!)", expected_message) + os.remove(changelog_path) + self.assertEquals(actual_contents, expected_contents) + _revert_message = """ Unreviewed, rolling out r12345. http://trac.webkit.org/changeset/12345 http://example.com/123 diff --git a/WebKitTools/Scripts/webkitpy/common/checkout/scm.py b/WebKitTools/Scripts/webkitpy/common/checkout/scm.py index eea76be..fc4c6fd 100644 --- a/WebKitTools/Scripts/webkitpy/common/checkout/scm.py +++ b/WebKitTools/Scripts/webkitpy/common/checkout/scm.py @@ -240,7 +240,7 @@ class SCM: def supports_local_commits(): raise NotImplementedError, "subclasses must implement" - def svn_merge_base(): + def remote_merge_base(): raise NotImplementedError, "subclasses must implement" def commit_locally_with_message(self, message): @@ -465,11 +465,11 @@ class Git(SCM): def discard_local_commits(self): # FIXME: This should probably use cwd=self.checkout_root - self.run(['git', 'reset', '--hard', self.svn_branch_name()]) + self.run(['git', 'reset', '--hard', self.remote_branch_ref()]) def local_commits(self): # FIXME: This should probably use cwd=self.checkout_root - return self.run(['git', 'log', '--pretty=oneline', 'HEAD...' + self.svn_branch_name()]).splitlines() + return self.run(['git', 'log', '--pretty=oneline', 'HEAD...' + self.remote_branch_ref()]).splitlines() def rebase_in_progress(self): return os.path.exists(os.path.join(self.checkout_root, '.git/rebase-apply')) @@ -507,7 +507,7 @@ class Git(SCM): return git_commit if self.should_squash(squash): - return self.svn_merge_base() + return self.remote_merge_base() # FIXME: Non-squash behavior should match commit_with_message. It raises an error # if there are working copy changes and --squash or --no-squash wasn't passed in. @@ -602,14 +602,14 @@ class Git(SCM): if num_local_commits > 1 or (num_local_commits > 0 and not self.working_directory_is_clean()): raise ScriptError(message=self._get_squash_error_message(num_local_commits)) - if squash and self._svn_branch_has_extra_commits(): + if squash and self._remote_branch_has_extra_commits(): raise ScriptError(message="Cannot use --squash when HEAD is not fully merged/rebased to %s. " - "This branch needs to be synced first." % self.svn_branch_name()) + "This branch needs to be synced first." % self.remote_branch_ref()) return squash - def _svn_branch_has_extra_commits(self): - return len(run_command(['git', 'rev-list', '--max-count=1', self.svn_branch_name(), '^HEAD'])) + def _remote_branch_has_extra_commits(self): + return len(run_command(['git', 'rev-list', '--max-count=1', self.remote_branch_ref(), '^HEAD'])) def commit_with_message(self, message, username=None, git_commit=None, squash=None): # Username is ignored during Git commits. @@ -624,7 +624,7 @@ class Git(SCM): squash = self.should_squash(squash) if squash: - self.run(['git', 'reset', '--soft', self.svn_branch_name()]) + self.run(['git', 'reset', '--soft', self.remote_branch_ref()]) self.commit_locally_with_message(message) elif not self.working_directory_is_clean(): if not len(self.local_commits()): @@ -650,8 +650,8 @@ class Git(SCM): # We want to squash all this branch's commits into one commit with the proper description. # We do this by doing a "merge --squash" into a new commit branch, then dcommitting that. - MERGE_BRANCH = 'webkit-patch-land' - self.delete_branch(MERGE_BRANCH) + MERGE_BRANCH_NAME = 'webkit-patch-land' + self.delete_branch(MERGE_BRANCH_NAME) # We might be in a directory that's present in this branch but not in the # trunk. Move up to the top of the tree so that git commands that expect a @@ -662,7 +662,7 @@ class Git(SCM): # We wrap in a try...finally block so if anything goes wrong, we clean up the branches. commit_succeeded = True try: - self.run(['git', 'checkout', '-q', '-b', MERGE_BRANCH, self.svn_branch_name()]) + self.run(['git', 'checkout', '-q', '-b', MERGE_BRANCH_NAME, self.remote_branch_ref()]) for commit in commit_ids: # We're on a different branch now, so convert "head" to the branch name. @@ -681,7 +681,7 @@ class Git(SCM): # And then swap back to the original branch and clean up. self.clean_working_directory() self.run(['git', 'checkout', '-q', branch_name]) - self.delete_branch(MERGE_BRANCH) + self.delete_branch(MERGE_BRANCH_NAME) return output @@ -693,18 +693,31 @@ class Git(SCM): return self.run(['git', 'svn', 'log', '--limit=1']) # Git-specific methods: + def _branch_ref_exists(self, branch_ref): + return self.run(['git', 'show-ref', '--quiet', '--verify', branch_ref], return_exit_code=True) == 0 - def delete_branch(self, branch): - if self.run(['git', 'show-ref', '--quiet', '--verify', 'refs/heads/' + branch], return_exit_code=True) == 0: - self.run(['git', 'branch', '-D', branch]) + def delete_branch(self, branch_name): + if self._branch_ref_exists('refs/heads/' + branch_name): + self.run(['git', 'branch', '-D', branch_name]) - def svn_merge_base(self): - return self.run(['git', 'merge-base', self.svn_branch_name(), 'HEAD']).strip() + def remote_merge_base(self): + return self.run(['git', 'merge-base', self.remote_branch_ref(), 'HEAD']).strip() + + def remote_branch_ref(self): + # Use references so that we can avoid collisions, e.g. we don't want to operate on refs/heads/trunk if it exists. - def svn_branch_name(self): # FIXME: This should so something like: Git.read_git_config('svn-remote.svn.fetch').split(':')[1] # but that doesn't work if the git repo is tracking multiple svn branches. - return 'trunk' + remote_branch_refs = [ + 'refs/remotes/trunk', # A git-svn checkout as per http://trac.webkit.org/wiki/UsingGitWithWebKit. + 'refs/remotes/origin/master', # A git clone of git://git.webkit.org/WebKit.git that is not tracking svn. + ] + + for ref in remote_branch_refs: + if self._branch_ref_exists(ref): + return ref + + raise ScriptError(message="Can't find a branch to diff against. %s branches do not exist." % " and ".join(remote_branch_refs)) def commit_locally_with_message(self, message): self.run(['git', 'commit', '--all', '-F', '-'], input=message) @@ -726,7 +739,7 @@ class Git(SCM): # A B : [A, B] (different from git diff, which would use "rev-list A..B") def commit_ids_from_commitish_arguments(self, args): if not len(args): - args.append('%s..HEAD' % self.svn_branch_name()) + args.append('%s..HEAD' % self.remote_branch_ref()) commit_ids = [] for commitish in args: diff --git a/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py b/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py index 8eea4d8..36a1d1c 100644 --- a/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py +++ b/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py @@ -635,25 +635,63 @@ Q1dTBx0AAAB42itg4GlgYJjGwMDDyODMxMDw34GBgQEAJPQDJA== class GitTest(SCMTest): - def _setup_git_clone_of_svn_repository(self): + def setUp(self): + """Sets up fresh git repository with one commit. Then setups a second git + repo that tracks the first one.""" + self.original_dir = os.getcwd() + + self.untracking_checkout_path = tempfile.mkdtemp(suffix="git_test_checkout2") + run_command(['git', 'init', self.untracking_checkout_path]) + + os.chdir(self.untracking_checkout_path) + write_into_file_at_path('foo_file', 'foo') + run_command(['git', 'add', 'foo_file']) + run_command(['git', 'commit', '-am', 'dummy commit']) + self.untracking_scm = detect_scm_system(self.untracking_checkout_path) + + self.tracking_git_checkout_path = tempfile.mkdtemp(suffix="git_test_checkout") + run_command(['git', 'clone', '--quiet', self.untracking_checkout_path, self.tracking_git_checkout_path]) + os.chdir(self.tracking_git_checkout_path) + self.tracking_scm = detect_scm_system(self.tracking_git_checkout_path) + + def tearDown(self): + # Change back to a valid directory so that later calls to os.getcwd() do not fail. + os.chdir(self.original_dir) + run_command(['rm', '-rf', self.tracking_git_checkout_path]) + run_command(['rm', '-rf', self.untracking_checkout_path]) + + def test_remote_branch_ref(self): + self.assertEqual(self.tracking_scm.remote_branch_ref(), 'refs/remotes/origin/master') + + os.chdir(self.untracking_checkout_path) + self.assertRaises(ScriptError, self.untracking_scm.remote_branch_ref) + + +class GitSVNTest(SCMTest): + + def _setup_git_checkout(self): self.git_checkout_path = tempfile.mkdtemp(suffix="git_test_checkout") # --quiet doesn't make git svn silent, so we use run_silent to redirect output run_silent(['git', 'svn', 'clone', '-T', 'trunk', self.svn_repo_url, self.git_checkout_path]) + os.chdir(self.git_checkout_path) - def _tear_down_git_clone_of_svn_repository(self): + def _tear_down_git_checkout(self): + # Change back to a valid directory so that later calls to os.getcwd() do not fail. + os.chdir(self.original_dir) run_command(['rm', '-rf', self.git_checkout_path]) def setUp(self): + self.original_dir = os.getcwd() + SVNTestRepository.setup(self) - self._setup_git_clone_of_svn_repository() - os.chdir(self.git_checkout_path) + self._setup_git_checkout() self.scm = detect_scm_system(self.git_checkout_path) # For historical reasons, we test some checkout code here too. self.checkout = Checkout(self.scm) def tearDown(self): SVNTestRepository.tear_down(self) - self._tear_down_git_clone_of_svn_repository() + self._tear_down_git_checkout() def test_detection(self): scm = detect_scm_system(self.git_checkout_path) @@ -683,25 +721,24 @@ class GitTest(SCMTest): self.assertEqual(len(self.scm.local_commits()), 0) def test_delete_branch(self): - old_branch = run_command(['git', 'symbolic-ref', 'HEAD']).strip() new_branch = 'foo' run_command(['git', 'checkout', '-b', new_branch]) self.assertEqual(run_command(['git', 'symbolic-ref', 'HEAD']).strip(), 'refs/heads/' + new_branch) - run_command(['git', 'checkout', old_branch]) + run_command(['git', 'checkout', '-b', 'bar']) self.scm.delete_branch(new_branch) self.assertFalse(re.search(r'foo', run_command(['git', 'branch']))) - def test_svn_merge_base(self): + def test_remote_merge_base(self): # Diff to merge-base should include working-copy changes, # which the diff to svn_branch.. doesn't. test_file = os.path.join(self.git_checkout_path, 'test_file') write_into_file_at_path(test_file, 'foo') - diff_to_common_base = _git_diff(self.scm.svn_branch_name() + '..') - diff_to_merge_base = _git_diff(self.scm.svn_merge_base()) + diff_to_common_base = _git_diff(self.scm.remote_branch_ref() + '..') + diff_to_merge_base = _git_diff(self.scm.remote_merge_base()) self.assertFalse(re.search(r'foo', diff_to_common_base)) self.assertTrue(re.search(r'foo', diff_to_merge_base)) @@ -888,6 +925,9 @@ class GitTest(SCMTest): scm = detect_scm_system(self.git_checkout_path) self.assertRaises(ScriptError, scm.commit_with_message, "another test commit", squash=True) + def test_remote_branch_ref(self): + self.assertEqual(self.scm.remote_branch_ref(), 'refs/remotes/trunk') + def test_reverse_diff(self): self._shared_test_reverse_diff() diff --git a/WebKitTools/Scripts/webkitpy/common/config/committers.py b/WebKitTools/Scripts/webkitpy/common/config/committers.py index d9c541f..37bd4eb 100644 --- a/WebKitTools/Scripts/webkitpy/common/config/committers.py +++ b/WebKitTools/Scripts/webkitpy/common/config/committers.py @@ -70,6 +70,7 @@ committers_unable_to_review = [ Committer("Alexander Kellett", ["lypanov@mac.com", "a-lists001@lypanov.net", "lypanov@kde.org"], "lypanov"), Committer("Alexander Pavlov", "apavlov@chromium.org"), Committer("Andre Boule", "aboule@apple.com"), + Committer("Andrei Popescu", "andreip@google.com", "andreip"), Committer("Andrew Wellington", ["andrew@webkit.org", "proton@wiretapped.net"], "proton"), Committer("Andras Becsi", "abecsi@webkit.org", "bbandix"), Committer("Andy Estes", "aestes@apple.com", "estes"), @@ -133,14 +134,15 @@ committers_unable_to_review = [ Committer("Krzysztof Kowalczyk", "kkowalczyk@gmail.com"), Committer("Levi Weintraub", "lweintraub@apple.com"), Committer("Mads Ager", "ager@chromium.org"), + Committer("Marcus Voltis Bulach", "bulach@chromium.org"), Committer("Matt Lilek", ["webkit@mattlilek.com", "pewtermoose@webkit.org"]), Committer("Matt Perry", "mpcomplete@chromium.org"), Committer("Maxime Britto", ["maxime.britto@gmail.com", "britto@apple.com"]), Committer("Maxime Simon", ["simon.maxime@gmail.com", "maxime.simon@webkit.org"], "maxime.simon"), - Committer("Martin Robinson", ["mrobinson@webkit.org", "martin.james.robinson@gmail.com"]), + Committer("Martin Robinson", ["mrobinson@igalia.com", "mrobinson@webkit.org", "martin.james.robinson@gmail.com"], "mrobinson"), Committer("Michelangelo De Simone", "michelangelo@webkit.org", "michelangelo"), Committer("Mike Belshe", ["mbelshe@chromium.org", "mike@belshe.com"]), - Committer("Mike Fenton", ["mike.fenton@torchmobile.com", "mifenton@rim.com"], "mfenton"), + Committer("Mike Fenton", ["mifenton@rim.com", "mike.fenton@torchmobile.com"], "mfenton"), Committer("Mike Thole", ["mthole@mikethole.com", "mthole@apple.com"]), Committer("Mikhail Naganov", "mnaganov@chromium.org"), Committer("MORITA Hajime", "morrita@google.com", "morrita"), @@ -166,6 +168,7 @@ committers_unable_to_review = [ Committer("Yong Li", ["yong.li.webkit@gmail.com", "yong.li@torchmobile.com"], "yong"), Committer("Yongjun Zhang", "yongjun.zhang@nokia.com"), Committer("Yuzo Fujishima", "yuzo@google.com", "yuzo"), + Committer("Zhenyao Mo", "zmo@google.com"), Committer("Zoltan Herczeg", "zherczeg@webkit.org", "zherczeg"), Committer("Zoltan Horvath", "zoltan@webkit.org", "zoltan"), ] diff --git a/WebKitTools/Scripts/webkitpy/common/net/bugzilla.py b/WebKitTools/Scripts/webkitpy/common/net/bugzilla.py index 26d3652..40db32c 100644 --- a/WebKitTools/Scripts/webkitpy/common/net/bugzilla.py +++ b/WebKitTools/Scripts/webkitpy/common/net/bugzilla.py @@ -113,6 +113,9 @@ class Attachment(object): def commit_queue(self): return self._attachment_dictionary.get("commit-queue") + def in_rietveld(self): + return self._attachment_dictionary.get("in-rietveld") + def url(self): # FIXME: This should just return # self._bugzilla().attachment_url_for_id(self.id()). scm_unittest.py @@ -158,6 +161,9 @@ class Bug(object): def id(self): return self.bug_dictionary["id"] + def title(self): + return self.bug_dictionary["title"] + def assigned_to_email(self): return self.bug_dictionary["assigned_to_email"] @@ -201,6 +207,9 @@ class Bug(object): # a valid committer. return filter(lambda patch: patch.committer(), patches) + def in_rietveld_queue_patches(self): + return [patch for patch in self.patches() if patch.in_rietveld() == None] + # A container for all of the logic for making and parsing buzilla queries. class BugzillaQueries(object): @@ -264,6 +273,16 @@ class BugzillaQueries(object): return sum([self._fetch_bug(bug_id).commit_queued_patches() for bug_id in self.fetch_bug_ids_from_commit_queue()], []) + def fetch_first_patch_from_rietveld_queue(self): + # rietveld-queue processes all patches that don't have in-rietveld set. + query_url = "buglist.cgi?query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&field0-0-0=flagtypes.name&type0-0-0=notsubstring&value0-0-0=in-rietveld&field0-1-0=attachments.ispatch&type0-1-0=equals&value0-1-0=1&order=Last+Changed&field0-2-0=attachments.isobsolete&type0-2-0=equals&value0-2-0=0" + bugs = self._fetch_bug_ids_advanced_query(query_url) + if not len(bugs): + return None + + patches = self._fetch_bug(bugs[0]).in_rietveld_queue_patches() + return patches[0] if len(patches) else None + def _fetch_bug_ids_from_review_queue(self): review_queue_url = "buglist.cgi?query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&field0-0-0=flagtypes.name&type0-0-0=equals&value0-0-0=review?" return self._fetch_bug_ids_advanced_query(review_queue_url) @@ -474,6 +493,8 @@ class Bugzilla(object): self._parse_attachment_flag( element, 'review', attachment, 'reviewer_email') self._parse_attachment_flag( + element, 'in-rietveld', attachment, 'rietveld_uploader_email') + self._parse_attachment_flag( element, 'commit-queue', attachment, 'committer_email') return attachment @@ -592,7 +613,8 @@ class Bugzilla(object): comment_text=None, mark_for_review=False, mark_for_commit_queue=False, - mark_for_landing=False, bug_id=None): + mark_for_landing=False, + bug_id=None): self.browser['description'] = description self.browser['ispatch'] = ("1",) self.browser['flag_type-1'] = ('?',) if mark_for_review else ('X',) @@ -703,7 +725,7 @@ class Bugzilla(object): self.browser["blocked"] = unicode(blocked) if assignee == None: assignee = self.username - if assignee: + if assignee and not self.browser.find_control("assigned_to").disabled: self.browser["assigned_to"] = assignee self.browser["short_desc"] = bug_title self.browser["comment"] = bug_description @@ -730,8 +752,10 @@ class Bugzilla(object): # FIXME: This will break if we ever re-order attachment flags if flag_name == "review": return self.browser.find_control(type='select', nr=0) - if flag_name == "commit-queue": + elif flag_name == "commit-queue": return self.browser.find_control(type='select', nr=1) + elif flag_name == "in-rietveld": + return self.browser.find_control(type='select', nr=2) raise Exception("Don't know how to find flag named \"%s\"" % flag_name) def clear_attachment_flags(self, @@ -758,8 +782,8 @@ class Bugzilla(object): attachment_id, flag_name, flag_value, - comment_text, - additional_comment_text): + comment_text=None, + additional_comment_text=None): # FIXME: We need a way to test this function on a live bugzilla # instance. @@ -774,7 +798,10 @@ class Bugzilla(object): self.browser.open(self.attachment_url_for_id(attachment_id, 'edit')) self.browser.select_form(nr=1) - self.browser.set_value(comment_text, name='comment', nr=0) + + if comment_text: + self.browser.set_value(comment_text, name='comment', nr=0) + self._find_select_element_for_flag(flag_name).value = (flag_value,) self.browser.submit() diff --git a/WebKitTools/Scripts/webkitpy/common/net/bugzilla_unittest.py b/WebKitTools/Scripts/webkitpy/common/net/bugzilla_unittest.py index ce992e7..3556121 100644 --- a/WebKitTools/Scripts/webkitpy/common/net/bugzilla_unittest.py +++ b/WebKitTools/Scripts/webkitpy/common/net/bugzilla_unittest.py @@ -96,6 +96,11 @@ class BugzillaTest(unittest.TestCase): status="+" setter="two@test.com" /> + ''' _expected_example_attachment_parsing = { @@ -111,6 +116,8 @@ class BugzillaTest(unittest.TestCase): 'reviewer_email' : 'one@test.com', 'commit-queue' : '+', 'committer_email' : 'two@test.com', + 'in-rietveld': '+', + 'rietveld_uploader_email': 'three@test.com', 'attacher_email' : 'christian.plesner.hansen@gmail.com', } @@ -191,12 +198,12 @@ removed-because-it-was-really-long ZEZpbmlzaExvYWRXaXRoUmVhc29uOnJlYXNvbl07Cit9CisKIEBlbmQKIAogI2VuZGlmCg== - - + + """ diff --git a/WebKitTools/Scripts/webkitpy/common/net/buildbot.py b/WebKitTools/Scripts/webkitpy/common/net/buildbot.py index 6c6ed43..c849ef1 100644 --- a/WebKitTools/Scripts/webkitpy/common/net/buildbot.py +++ b/WebKitTools/Scripts/webkitpy/common/net/buildbot.py @@ -333,7 +333,12 @@ class BuildBot(object): builder['built_revision'] = int(revision_string) \ if not re.match('\D', revision_string) \ else None - builder['is_green'] = not re.search('fail', cell.renderContents()) + + # FIXME: We treat slave lost as green even though it is not to + # work around the Qts bot being on a broken internet connection. + # The real fix is https://bugs.webkit.org/show_bug.cgi?id=37099 + builder['is_green'] = not re.search('fail', cell.renderContents()) or \ + not not re.search('lost', cell.renderContents()) status_link_regexp = r"builders/(?P.*)/builds/(?P\d+)" link_match = re.match(status_link_regexp, status_link['href']) diff --git a/WebKitTools/Scripts/webkitpy/common/net/buildbot_unittest.py b/WebKitTools/Scripts/webkitpy/common/net/buildbot_unittest.py index 5e04745..5384321 100644 --- a/WebKitTools/Scripts/webkitpy/common/net/buildbot_unittest.py +++ b/WebKitTools/Scripts/webkitpy/common/net/buildbot_unittest.py @@ -169,6 +169,10 @@ class BuildBotTest(unittest.TestCase):
Qt Linux Release 47383
failed
compile-webkit idle
3 pending + + Qt Windows 32-bit Debug + 60563
failed
failed
slave
lost + building
ETA in
~ 5 mins
at 08:25 ''' _expected_example_one_box_parsings = [ @@ -196,6 +200,14 @@ class BuildBotTest(unittest.TestCase): 'activity': 'idle', 'pending_builds': 3, }, + { + 'is_green': True, + 'build_number' : 2090, + 'name': u'Qt Windows 32-bit Debug', + 'built_revision': 60563, + 'activity': 'building', + 'pending_builds': 0, + }, ] def test_status_parsing(self): diff --git a/WebKitTools/Scripts/webkitpy/common/net/rietveld.py b/WebKitTools/Scripts/webkitpy/common/net/rietveld.py index 572d1fd..eccda3a 100644 --- a/WebKitTools/Scripts/webkitpy/common/net/rietveld.py +++ b/WebKitTools/Scripts/webkitpy/common/net/rietveld.py @@ -51,6 +51,10 @@ class Rietveld(object): if not message: raise ScriptError("Rietveld requires a message.") + # Rietveld has a 100 character limit on message length. + if len(message) > 100: + message = message[:100] + args = [ # First argument is empty string to mimic sys.argv. "", @@ -70,5 +74,5 @@ class Rietveld(object): # Use RealMain instead of calling upload from the commandline so that # we can pass in the diff ourselves. Otherwise, upload will just use # git diff for git checkouts, which doesn't respect --squash and --git-commit. - issue, patchset = upload.RealMain(args[1:], data=diff) + issue, patchset = upload.RealMain(args, data=diff) return issue diff --git a/WebKitTools/Scripts/webkitpy/common/system/outputcapture.py b/WebKitTools/Scripts/webkitpy/common/system/outputcapture.py index 592a669..68a3919 100644 --- a/WebKitTools/Scripts/webkitpy/common/system/outputcapture.py +++ b/WebKitTools/Scripts/webkitpy/common/system/outputcapture.py @@ -52,9 +52,12 @@ class OutputCapture(object): def restore_output(self): return (self._restore_output_with_name("stdout"), self._restore_output_with_name("stderr")) - def assert_outputs(self, testcase, function, args=[], kwargs={}, expected_stdout="", expected_stderr=""): + def assert_outputs(self, testcase, function, args=[], kwargs={}, expected_stdout="", expected_stderr="", expected_exception=None): self.capture_output() - return_value = function(*args, **kwargs) + if expected_exception: + return_value = testcase.assertRaises(expected_exception, function, *args, **kwargs) + else: + return_value = function(*args, **kwargs) (stdout_string, stderr_string) = self.restore_output() testcase.assertEqual(stdout_string, expected_stdout) testcase.assertEqual(stderr_string, expected_stderr) diff --git a/WebKitTools/Scripts/webkitpy/common/system/user.py b/WebKitTools/Scripts/webkitpy/common/system/user.py index 82fa0d3..b4df3cb 100644 --- a/WebKitTools/Scripts/webkitpy/common/system/user.py +++ b/WebKitTools/Scripts/webkitpy/common/system/user.py @@ -104,5 +104,14 @@ class User(object): response = raw_input("%s [Y/n]: " % message) return not response or response.lower() == "y" + def can_open_url(self): + try: + webbrowser.get() + return True + except webbrowser.Error, e: + return False + def open_url(self, url): + if not self.can_open_url(): + _log.warn("Failed to open %s" % url) webbrowser.open(url) 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 cee44ad..bb214f7 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 @@ -77,6 +77,7 @@ class JSONLayoutResultsGenerator(json_results_generator.JSONResultsGenerator): self._test_timings = dict( (path_to_name(test_tuple.filename), test_tuple.test_run_time) for test_tuple in test_timings) + self._svn_repositories = port.test_repository_paths() self._generate_json_output() 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 0993cbd..1cf1b95 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 @@ -38,6 +38,8 @@ import time import urllib2 import xml.dom.minidom +from webkitpy.common.checkout import scm +from webkitpy.common.system.executive import ScriptError from webkitpy.layout_tests.layout_package import test_expectations import webkitpy.thirdparty.simplejson as simplejson @@ -46,6 +48,7 @@ _log = logging.getLogger("webkitpy.layout_tests.layout_package." class JSONResultsGenerator(object): + """A JSON results generator for generic tests.""" MAX_NUMBER_OF_BUILD_RESULTS_TO_LOG = 750 # Min time (seconds) that will be added to the JSON. @@ -60,8 +63,6 @@ class JSONResultsGenerator(object): RESULTS = "results" TIMES = "times" BUILD_NUMBERS = "buildNumbers" - WEBKIT_SVN = "webkitRevision" - CHROME_SVN = "chromeRevision" TIME = "secondsSinceEpoch" TESTS = "tests" @@ -102,7 +103,6 @@ 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 @@ -114,6 +114,7 @@ class JSONResultsGenerator(object): self._passed_tests = passed_tests self._skipped_tests = skipped_tests self._all_tests = all_tests + self._svn_repositories = port.test_repository_paths() self._generate_json_output() @@ -132,6 +133,7 @@ class JSONResultsGenerator(object): Args: in_directory: The directory where svn is to be run. """ + if os.path.exists(os.path.join(in_directory, '.svn')): # Note: Not thread safe: http://bugs.python.org/issue2320 output = subprocess.Popen(["svn", "info", "--xml"], @@ -312,23 +314,11 @@ class JSONResultsGenerator(object): self._insert_item_into_raw_list(results_for_builder, self._build_number, self.BUILD_NUMBERS) - # 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('WebCore') + # Include SVN revisions for the given repositories. + for (name, path) in self._svn_repositories: 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'): - try: - 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) - except AssertionError: - # We're not in a Chromium checkout, that's ok. - pass + self._get_svn_revision(path), + name + 'Revision') self._insert_item_into_raw_list(results_for_builder, int(time.time()), diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py index 782c87c..e73579f 100644 --- a/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py +++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py @@ -537,6 +537,14 @@ class Port(object): expectations, determining search paths, and logging information.""" raise NotImplementedError('Port.version') + def test_repository_paths(self): + """Returns a list of (repository_name, repository_path) tuples + of its depending code base. By default it returns a list that only + contains a ('webkit', ) tuple. + """ + return [('webkit', self.layout_tests_dir())] + + _WDIFF_DEL = '##WDIFF_DEL##' _WDIFF_ADD = '##WDIFF_ADD##' _WDIFF_END = '##WDIFF_END##' diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py index db23eb8..e7f9ac8 100644 --- a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py +++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py @@ -232,6 +232,13 @@ class ChromiumPort(base.Port): raise ValueError('Unsupported test_platform_name: %s' % test_platform_name) + def test_repository_paths(self): + # Note: for JSON file's backward-compatibility we use 'chrome' rather + # than 'chromium' here. + repos = super(ChromiumPort, self).test_repository_paths() + repos.append(('chrome', self.path_from_chromium_base())) + return repos + # # PROTECTED METHODS # diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_linux.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_linux.py index 0818d51..4df43e0 100644 --- a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_linux.py +++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_linux.py @@ -81,15 +81,15 @@ class ChromiumLinuxPort(chromium.ChromiumPort): # def _build_path(self, *comps): - if self._options.use_drt: - base = os.path.join(self.path_from_webkit_base(), 'WebKit', - 'chromium') - else: - base = self.path_from_chromium_base() + base = self.path_from_chromium_base() if os.path.exists(os.path.join(base, 'sconsbuild')): return os.path.join(base, 'sconsbuild', *comps) - else: + if os.path.exists(os.path.join(base, 'out', *comps)) or not self._options.use_drt: return os.path.join(base, 'out', *comps) + base = self.path_from_webkit_base() + if os.path.exists(os.path.join(base, 'sconsbuild')): + return os.path.join(base, 'sconsbuild', *comps) + return os.path.join(base, 'out', *comps) def _check_apache_install(self): result = chromium.check_file_exists(self._path_to_apache(), diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_mac.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_mac.py index aa3ac8d..abd84ae 100644 --- a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_mac.py +++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_mac.py @@ -102,10 +102,11 @@ class ChromiumMacPort(chromium.ChromiumPort): # def _build_path(self, *comps): - if self._options.use_drt: - return self.path_from_webkit_base('WebKit', 'chromium', - 'xcodebuild', *comps) - return self.path_from_chromium_base('xcodebuild', *comps) + path = self.path_from_chromium_base('xcodebuild', *comps) + if os.path.exists(path) or not self._options.use_drt: + return path + return self.path_from_webkit_base('WebKit', 'chromium', 'xcodebuild', + *comps) def _check_wdiff_install(self): try: diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py index ec1c33c..8072bc0 100644 --- a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py +++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py @@ -117,13 +117,14 @@ class ChromiumWinPort(chromium.ChromiumPort): # def _build_path(self, *comps): - if self._options.use_drt: - return os.path.join(self.path_from_webkit_base(), 'WebKit', - 'chromium', *comps) p = self.path_from_chromium_base('webkit', *comps) if os.path.exists(p): return p - return self.path_from_chromium_base('chrome', *comps) + p = self.path_from_chromium_base('chrome', *comps) + if os.path.exists(p) or not self._options.use_drt: + return p + return os.path.join(self.path_from_webkit_base(), 'WebKit', 'chromium', + *comps) def _lighttpd_path(self, *comps): return self.path_from_chromium_base('third_party', 'lighttpd', 'win', diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/websocket_server.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/websocket_server.py index 22ae780..81bf39e 100644 --- a/WebKitTools/Scripts/webkitpy/layout_tests/port/websocket_server.py +++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/websocket_server.py @@ -207,12 +207,13 @@ class PyWebSocket(http_server.Lighttpd): url = 'http' url = url + '://127.0.0.1:%d/' % self._port if not url_is_alive(url): - fp = codecs.open(output_log, "utf-8") - try: + if self._process.returncode == None: + # FIXME: We should use a non-static Executive for easier + # testing. + Executive().kill_process(self._process.pid) + with codecs.open(output_log, "r", "utf-8") as fp: for line in fp: _log.error(line) - finally: - fp.close() raise PyWebSocketNotStarted( 'Failed to start %s server on port %s.' % (self._server_name, self._port)) diff --git a/WebKitTools/Scripts/webkitpy/thirdparty/__init__.py b/WebKitTools/Scripts/webkitpy/thirdparty/__init__.py index 3642286..e1fa673 100644 --- a/WebKitTools/Scripts/webkitpy/thirdparty/__init__.py +++ b/WebKitTools/Scripts/webkitpy/thirdparty/__init__.py @@ -71,7 +71,8 @@ installer.install(url="http://pypi.python.org/packages/source/m/mechanize/mechan url_subpath="mechanize") installer.install(url="http://pypi.python.org/packages/source/p/pep8/pep8-0.5.0.tar.gz#md5=512a818af9979290cd619cce8e9c2e2b", url_subpath="pep8-0.5.0/pep8.py") - +installer.install(url="http://www.adambarth.com/webkit/eliza", + target_name="eliza.py") rietveld_dir = os.path.join(autoinstalled_dir, "rietveld") installer = AutoInstaller(target_dir=rietveld_dir) @@ -84,9 +85,9 @@ installer.install(url="http://webkit-rietveld.googlecode.com/svn/trunk/static/up # organization purposes. irc_dir = os.path.join(autoinstalled_dir, "irc") installer = AutoInstaller(target_dir=irc_dir) -installer.install(url="http://iweb.dl.sourceforge.net/project/python-irclib/python-irclib/0.4.8/python-irclib-0.4.8.zip", +installer.install(url="http://hivelocity.dl.sourceforge.net/project/python-irclib/python-irclib/0.4.8/python-irclib-0.4.8.zip", url_subpath="irclib.py") -installer.install(url="http://iweb.dl.sourceforge.net/project/python-irclib/python-irclib/0.4.8/python-irclib-0.4.8.zip", +installer.install(url="http://hivelocity.dl.sourceforge.net/project/python-irclib/python-irclib/0.4.8/python-irclib-0.4.8.zip", url_subpath="ircbot.py") pywebsocket_dir = os.path.join(autoinstalled_dir, "pywebsocket") diff --git a/WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/.mechanize.url b/WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/.mechanize.url deleted file mode 100644 index 4186aee..0000000 --- a/WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/.mechanize.url +++ /dev/null @@ -1 +0,0 @@ -http://pypi.python.org/packages/source/m/mechanize/mechanize-0.1.11.zip \ No newline at end of file diff --git a/WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/.pep8.py.url b/WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/.pep8.py.url deleted file mode 100644 index 0fb1ef6..0000000 --- a/WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/.pep8.py.url +++ /dev/null @@ -1 +0,0 @@ -http://pypi.python.org/packages/source/p/pep8/pep8-0.5.0.tar.gz#md5=512a818af9979290cd619cce8e9c2e2b \ No newline at end of file diff --git a/WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/README b/WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/README deleted file mode 100644 index 1d68cf3..0000000 --- a/WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/README +++ /dev/null @@ -1,2 +0,0 @@ -This directory is auto-generated by WebKit and is safe to delete. -It contains needed third-party Python packages automatically downloaded from the web. \ No newline at end of file diff --git a/WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/__init__.py b/WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/__init__.py deleted file mode 100644 index c1e4c6d..0000000 --- a/WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# This file is required for Python to search this directory for modules. diff --git a/WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/clientform/.ClientForm.py.url b/WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/clientform/.ClientForm.py.url deleted file mode 100644 index c723abf..0000000 --- a/WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/clientform/.ClientForm.py.url +++ /dev/null @@ -1 +0,0 @@ -http://pypi.python.org/packages/source/C/ClientForm/ClientForm-0.2.10.zip \ No newline at end of file diff --git a/WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/clientform/ClientForm.py b/WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/clientform/ClientForm.py deleted file mode 100644 index a622de7..0000000 --- a/WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled/clientform/ClientForm.py +++ /dev/null @@ -1,3401 +0,0 @@ -"""HTML form handling for web clients. - -ClientForm is a Python module for handling HTML forms on the client -side, useful for parsing HTML forms, filling them in and returning the -completed forms to the server. It has developed from a port of Gisle -Aas' Perl module HTML::Form, from the libwww-perl library, but the -interface is not the same. - -The most useful docstring is the one for HTMLForm. - -RFC 1866: HTML 2.0 -RFC 1867: Form-based File Upload in HTML -RFC 2388: Returning Values from Forms: multipart/form-data -HTML 3.2 Specification, W3C Recommendation 14 January 1997 (for ISINDEX) -HTML 4.01 Specification, W3C Recommendation 24 December 1999 - - -Copyright 2002-2007 John J. Lee -Copyright 2005 Gary Poster -Copyright 2005 Zope Corporation -Copyright 1998-2000 Gisle Aas. - -This code is free software; you can redistribute it and/or modify it -under the terms of the BSD or ZPL 2.1 licenses (see the file -COPYING.txt included with the distribution). - -""" - -# XXX -# Remove parser testing hack -# safeUrl()-ize action -# Switch to unicode throughout (would be 0.3.x) -# See Wichert Akkerman's 2004-01-22 message to c.l.py. -# Add charset parameter to Content-type headers? How to find value?? -# Add some more functional tests -# Especially single and multiple file upload on the internet. -# Does file upload work when name is missing? Sourceforge tracker form -# doesn't like it. Check standards, and test with Apache. Test -# binary upload with Apache. -# mailto submission & enctype text/plain -# I'm not going to fix this unless somebody tells me what real servers -# that want this encoding actually expect: If enctype is -# application/x-www-form-urlencoded and there's a FILE control present. -# Strictly, it should be 'name=data' (see HTML 4.01 spec., section -# 17.13.2), but I send "name=" ATM. What about multiple file upload?? - -# Would be nice, but I'm not going to do it myself: -# ------------------------------------------------- -# Maybe a 0.4.x? -# Replace by_label etc. with moniker / selector concept. Allows, eg., -# a choice between selection by value / id / label / element -# contents. Or choice between matching labels exactly or by -# substring. Etc. -# Remove deprecated methods. -# ...what else? -# Work on DOMForm. -# XForms? Don't know if there's a need here. - -__all__ = ['AmbiguityError', 'CheckboxControl', 'Control', - 'ControlNotFoundError', 'FileControl', 'FormParser', 'HTMLForm', - 'HiddenControl', 'IgnoreControl', 'ImageControl', 'IsindexControl', - 'Item', 'ItemCountError', 'ItemNotFoundError', 'Label', - 'ListControl', 'LocateError', 'Missing', 'ParseError', 'ParseFile', - 'ParseFileEx', 'ParseResponse', 'ParseResponseEx','PasswordControl', - 'RadioControl', 'ScalarControl', 'SelectControl', - 'SubmitButtonControl', 'SubmitControl', 'TextControl', - 'TextareaControl', 'XHTMLCompatibleFormParser'] - -try: True -except NameError: - True = 1 - False = 0 - -try: bool -except NameError: - def bool(expr): - if expr: return True - else: return False - -try: - import logging - import inspect -except ImportError: - def debug(msg, *args, **kwds): - pass -else: - _logger = logging.getLogger("ClientForm") - OPTIMIZATION_HACK = True - - def debug(msg, *args, **kwds): - if OPTIMIZATION_HACK: - return - - caller_name = inspect.stack()[1][3] - extended_msg = '%%s %s' % msg - extended_args = (caller_name,)+args - debug = _logger.debug(extended_msg, *extended_args, **kwds) - - def _show_debug_messages(): - global OPTIMIZATION_HACK - OPTIMIZATION_HACK = False - _logger.setLevel(logging.DEBUG) - handler = logging.StreamHandler(sys.stdout) - handler.setLevel(logging.DEBUG) - _logger.addHandler(handler) - -import sys, urllib, urllib2, types, mimetools, copy, urlparse, \ - htmlentitydefs, re, random -from cStringIO import StringIO - -import sgmllib -# monkeypatch to fix http://www.python.org/sf/803422 :-( -sgmllib.charref = re.compile("&#(x?[0-9a-fA-F]+)[^0-9a-fA-F]") - -# HTMLParser.HTMLParser is recent, so live without it if it's not available -# (also, sgmllib.SGMLParser is much more tolerant of bad HTML) -try: - import HTMLParser -except ImportError: - HAVE_MODULE_HTMLPARSER = False -else: - HAVE_MODULE_HTMLPARSER = True - -try: - import warnings -except ImportError: - def deprecation(message, stack_offset=0): - pass -else: - def deprecation(message, stack_offset=0): - warnings.warn(message, DeprecationWarning, stacklevel=3+stack_offset) - -VERSION = "0.2.10" - -CHUNK = 1024 # size of chunks fed to parser, in bytes - -DEFAULT_ENCODING = "latin-1" - -class Missing: pass - -_compress_re = re.compile(r"\s+") -def compress_text(text): return _compress_re.sub(" ", text.strip()) - -def normalize_line_endings(text): - return re.sub(r"(?:(? - w = MimeWriter(f) - ...call w.addheader(key, value) 0 or more times... - - followed by either: - - f = w.startbody(content_type) - ...call f.write(data) for body data... - - or: - - w.startmultipartbody(subtype) - for each part: - subwriter = w.nextpart() - ...use the subwriter's methods to create the subpart... - w.lastpart() - - The subwriter is another MimeWriter instance, and should be - treated in the same way as the toplevel MimeWriter. This way, - writing recursive body parts is easy. - - Warning: don't forget to call lastpart()! - - XXX There should be more state so calls made in the wrong order - are detected. - - Some special cases: - - - startbody() just returns the file passed to the constructor; - but don't use this knowledge, as it may be changed. - - - startmultipartbody() actually returns a file as well; - this can be used to write the initial 'if you can read this your - mailer is not MIME-aware' message. - - - If you call flushheaders(), the headers accumulated so far are - written out (and forgotten); this is useful if you don't need a - body part at all, e.g. for a subpart of type message/rfc822 - that's (mis)used to store some header-like information. - - - Passing a keyword argument 'prefix=' to addheader(), - start*body() affects where the header is inserted; 0 means - append at the end, 1 means insert at the start; default is - append for addheader(), but insert for start*body(), which use - it to determine where the Content-type header goes. - - """ - - def __init__(self, fp, http_hdrs=None): - self._http_hdrs = http_hdrs - self._fp = fp - self._headers = [] - self._boundary = [] - self._first_part = True - - def addheader(self, key, value, prefix=0, - add_to_http_hdrs=0): - """ - prefix is ignored if add_to_http_hdrs is true. - """ - lines = value.split("\r\n") - while lines and not lines[-1]: del lines[-1] - while lines and not lines[0]: del lines[0] - if add_to_http_hdrs: - value = "".join(lines) - # 2.2 urllib2 doesn't normalize header case - self._http_hdrs.append((key.capitalize(), value)) - else: - for i in range(1, len(lines)): - lines[i] = " " + lines[i].strip() - value = "\r\n".join(lines) + "\r\n" - line = key.title() + ": " + value - if prefix: - self._headers.insert(0, line) - else: - self._headers.append(line) - - def flushheaders(self): - self._fp.writelines(self._headers) - self._headers = [] - - def startbody(self, ctype=None, plist=[], prefix=1, - add_to_http_hdrs=0, content_type=1): - """ - prefix is ignored if add_to_http_hdrs is true. - """ - if content_type and ctype: - for name, value in plist: - ctype = ctype + ';\r\n %s=%s' % (name, value) - self.addheader("Content-Type", ctype, prefix=prefix, - add_to_http_hdrs=add_to_http_hdrs) - self.flushheaders() - if not add_to_http_hdrs: self._fp.write("\r\n") - self._first_part = True - return self._fp - - def startmultipartbody(self, subtype, boundary=None, plist=[], prefix=1, - add_to_http_hdrs=0, content_type=1): - boundary = boundary or choose_boundary() - self._boundary.append(boundary) - return self.startbody("multipart/" + subtype, - [("boundary", boundary)] + plist, - prefix=prefix, - add_to_http_hdrs=add_to_http_hdrs, - content_type=content_type) - - def nextpart(self): - boundary = self._boundary[-1] - if self._first_part: - self._first_part = False - else: - self._fp.write("\r\n") - self._fp.write("--" + boundary + "\r\n") - return self.__class__(self._fp) - - def lastpart(self): - if self._first_part: - self.nextpart() - boundary = self._boundary.pop() - self._fp.write("\r\n--" + boundary + "--\r\n") - - -class LocateError(ValueError): pass -class AmbiguityError(LocateError): pass -class ControlNotFoundError(LocateError): pass -class ItemNotFoundError(LocateError): pass - -class ItemCountError(ValueError): pass - -# for backwards compatibility, ParseError derives from exceptions that were -# raised by versions of ClientForm <= 0.2.5 -if HAVE_MODULE_HTMLPARSER: - SGMLLIB_PARSEERROR = sgmllib.SGMLParseError - class ParseError(sgmllib.SGMLParseError, - HTMLParser.HTMLParseError, - ): - pass -else: - if hasattr(sgmllib, "SGMLParseError"): - SGMLLIB_PARSEERROR = sgmllib.SGMLParseError - class ParseError(sgmllib.SGMLParseError): - pass - else: - SGMLLIB_PARSEERROR = RuntimeError - class ParseError(RuntimeError): - pass - - -class _AbstractFormParser: - """forms attribute contains HTMLForm instances on completion.""" - # thanks to Moshe Zadka for an example of sgmllib/htmllib usage - def __init__(self, entitydefs=None, encoding=DEFAULT_ENCODING): - if entitydefs is None: - entitydefs = get_entitydefs() - self._entitydefs = entitydefs - self._encoding = encoding - - self.base = None - self.forms = [] - self.labels = [] - self._current_label = None - self._current_form = None - self._select = None - self._optgroup = None - self._option = None - self._textarea = None - - # forms[0] will contain all controls that are outside of any form - # self._global_form is an alias for self.forms[0] - self._global_form = None - self.start_form([]) - self.end_form() - self._current_form = self._global_form = self.forms[0] - - def do_base(self, attrs): - debug("%s", attrs) - for key, value in attrs: - if key == "href": - self.base = self.unescape_attr_if_required(value) - - def end_body(self): - debug("") - if self._current_label is not None: - self.end_label() - if self._current_form is not self._global_form: - self.end_form() - - def start_form(self, attrs): - debug("%s", attrs) - if self._current_form is not self._global_form: - raise ParseError("nested FORMs") - name = None - action = None - enctype = "application/x-www-form-urlencoded" - method = "GET" - d = {} - for key, value in attrs: - if key == "name": - name = self.unescape_attr_if_required(value) - elif key == "action": - action = self.unescape_attr_if_required(value) - elif key == "method": - method = self.unescape_attr_if_required(value.upper()) - elif key == "enctype": - enctype = self.unescape_attr_if_required(value.lower()) - d[key] = self.unescape_attr_if_required(value) - controls = [] - self._current_form = (name, action, method, enctype), d, controls - - def end_form(self): - debug("") - if self._current_label is not None: - self.end_label() - if self._current_form is self._global_form: - raise ParseError("end of FORM before start") - self.forms.append(self._current_form) - self._current_form = self._global_form - - def start_select(self, attrs): - debug("%s", attrs) - if self._select is not None: - raise ParseError("nested SELECTs") - if self._textarea is not None: - raise ParseError("SELECT inside TEXTAREA") - d = {} - for key, val in attrs: - d[key] = self.unescape_attr_if_required(val) - - self._select = d - self._add_label(d) - - self._append_select_control({"__select": d}) - - def end_select(self): - debug("") - if self._select is None: - raise ParseError("end of SELECT before start") - - if self._option is not None: - self._end_option() - - self._select = None - - def start_optgroup(self, attrs): - debug("%s", attrs) - if self._select is None: - raise ParseError("OPTGROUP outside of SELECT") - d = {} - for key, val in attrs: - d[key] = self.unescape_attr_if_required(val) - - self._optgroup = d - - def end_optgroup(self): - debug("") - if self._optgroup is None: - raise ParseError("end of OPTGROUP before start") - self._optgroup = None - - def _start_option(self, attrs): - debug("%s", attrs) - if self._select is None: - raise ParseError("OPTION outside of SELECT") - if self._option is not None: - self._end_option() - - d = {} - for key, val in attrs: - d[key] = self.unescape_attr_if_required(val) - - self._option = {} - self._option.update(d) - if (self._optgroup and self._optgroup.has_key("disabled") and - not self._option.has_key("disabled")): - self._option["disabled"] = None - - def _end_option(self): - debug("") - if self._option is None: - raise ParseError("end of OPTION before start") - - contents = self._option.get("contents", "").strip() - self._option["contents"] = contents - if not self._option.has_key("value"): - self._option["value"] = contents - if not self._option.has_key("label"): - self._option["label"] = contents - # stuff dict of SELECT HTML attrs into a special private key - # (gets deleted again later) - self._option["__select"] = self._select - self._append_select_control(self._option) - self._option = None - - def _append_select_control(self, attrs): - debug("%s", attrs) - controls = self._current_form[2] - name = self._select.get("name") - controls.append(("select", name, attrs)) - - def start_textarea(self, attrs): - debug("%s", attrs) - if self._textarea is not None: - raise ParseError("nested TEXTAREAs") - if self._select is not None: - raise ParseError("TEXTAREA inside SELECT") - d = {} - for key, val in attrs: - d[key] = self.unescape_attr_if_required(val) - self._add_label(d) - - self._textarea = d - - def end_textarea(self): - debug("") - if self._textarea is None: - raise ParseError("end of TEXTAREA before start") - controls = self._current_form[2] - name = self._textarea.get("name") - controls.append(("textarea", name, self._textarea)) - self._textarea = None - - def start_label(self, attrs): - debug("%s", attrs) - if self._current_label: - self.end_label() - d = {} - for key, val in attrs: - d[key] = self.unescape_attr_if_required(val) - taken = bool(d.get("for")) # empty id is invalid - d["__text"] = "" - d["__taken"] = taken - if taken: - self.labels.append(d) - self._current_label = d - - def end_label(self): - debug("") - label = self._current_label - if label is None: - # something is ugly in the HTML, but we're ignoring it - return - self._current_label = None - # if it is staying around, it is True in all cases - del label["__taken"] - - def _add_label(self, d): - #debug("%s", d) - if self._current_label is not None: - if not self._current_label["__taken"]: - self._current_label["__taken"] = True - d["__label"] = self._current_label - - def handle_data(self, data): - debug("%s", data) - - if self._option is not None: - # self._option is a dictionary of the OPTION element's HTML - # attributes, but it has two special keys, one of which is the - # special "contents" key contains text between OPTION tags (the - # other is the "__select" key: see the end_option method) - map = self._option - key = "contents" - elif self._textarea is not None: - map = self._textarea - key = "value" - data = normalize_line_endings(data) - # not if within option or textarea - elif self._current_label is not None: - map = self._current_label - key = "__text" - else: - return - - if data and not map.has_key(key): - # according to - # http://www.w3.org/TR/html4/appendix/notes.html#h-B.3.1 line break - # immediately after start tags or immediately before end tags must - # be ignored, but real browsers only ignore a line break after a - # start tag, so we'll do that. - if data[0:2] == "\r\n": - data = data[2:] - elif data[0:1] in ["\n", "\r"]: - data = data[1:] - map[key] = data - else: - map[key] = map[key] + data - - def do_button(self, attrs): - debug("%s", attrs) - d = {} - d["type"] = "submit" # default - for key, val in attrs: - d[key] = self.unescape_attr_if_required(val) - controls = self._current_form[2] - - type = d["type"] - name = d.get("name") - # we don't want to lose information, so use a type string that - # doesn't clash with INPUT TYPE={SUBMIT,RESET,BUTTON} - # e.g. type for BUTTON/RESET is "resetbutton" - # (type for INPUT/RESET is "reset") - type = type+"button" - self._add_label(d) - controls.append((type, name, d)) - - def do_input(self, attrs): - debug("%s", attrs) - d = {} - d["type"] = "text" # default - for key, val in attrs: - d[key] = self.unescape_attr_if_required(val) - controls = self._current_form[2] - - type = d["type"] - name = d.get("name") - self._add_label(d) - controls.append((type, name, d)) - - def do_isindex(self, attrs): - debug("%s", attrs) - d = {} - for key, val in attrs: - d[key] = self.unescape_attr_if_required(val) - controls = self._current_form[2] - - self._add_label(d) - # isindex doesn't have type or name HTML attributes - controls.append(("isindex", None, d)) - - def handle_entityref(self, name): - #debug("%s", name) - self.handle_data(unescape( - '&%s;' % name, self._entitydefs, self._encoding)) - - def handle_charref(self, name): - #debug("%s", name) - self.handle_data(unescape_charref(name, self._encoding)) - - def unescape_attr(self, name): - #debug("%s", name) - return unescape(name, self._entitydefs, self._encoding) - - def unescape_attrs(self, attrs): - #debug("%s", attrs) - escaped_attrs = {} - for key, val in attrs.items(): - try: - val.items - except AttributeError: - escaped_attrs[key] = self.unescape_attr(val) - else: - # e.g. "__select" -- yuck! - escaped_attrs[key] = self.unescape_attrs(val) - return escaped_attrs - - def unknown_entityref(self, ref): self.handle_data("&%s;" % ref) - def unknown_charref(self, ref): self.handle_data("&#%s;" % ref) - - -if not HAVE_MODULE_HTMLPARSER: - class XHTMLCompatibleFormParser: - def __init__(self, entitydefs=None, encoding=DEFAULT_ENCODING): - raise ValueError("HTMLParser could not be imported") -else: - class XHTMLCompatibleFormParser(_AbstractFormParser, HTMLParser.HTMLParser): - """Good for XHTML, bad for tolerance of incorrect HTML.""" - # thanks to Michael Howitz for this! - def __init__(self, entitydefs=None, encoding=DEFAULT_ENCODING): - HTMLParser.HTMLParser.__init__(self) - _AbstractFormParser.__init__(self, entitydefs, encoding) - - def feed(self, data): - try: - HTMLParser.HTMLParser.feed(self, data) - except HTMLParser.HTMLParseError, exc: - raise ParseError(exc) - - def start_option(self, attrs): - _AbstractFormParser._start_option(self, attrs) - - def end_option(self): - _AbstractFormParser._end_option(self) - - def handle_starttag(self, tag, attrs): - try: - method = getattr(self, "start_" + tag) - except AttributeError: - try: - method = getattr(self, "do_" + tag) - except AttributeError: - pass # unknown tag - else: - method(attrs) - else: - method(attrs) - - def handle_endtag(self, tag): - try: - method = getattr(self, "end_" + tag) - except AttributeError: - pass # unknown tag - else: - method() - - def unescape(self, name): - # Use the entitydefs passed into constructor, not - # HTMLParser.HTMLParser's entitydefs. - return self.unescape_attr(name) - - def unescape_attr_if_required(self, name): - return name # HTMLParser.HTMLParser already did it - def unescape_attrs_if_required(self, attrs): - return attrs # ditto - - def close(self): - HTMLParser.HTMLParser.close(self) - self.end_body() - - -class _AbstractSgmllibParser(_AbstractFormParser): - - def do_option(self, attrs): - _AbstractFormParser._start_option(self, attrs) - - if sys.version_info[:2] >= (2,5): - # we override this attr to decode hex charrefs - entity_or_charref = re.compile( - '&(?:([a-zA-Z][-.a-zA-Z0-9]*)|#(x?[0-9a-fA-F]+))(;?)') - def convert_entityref(self, name): - return unescape("&%s;" % name, self._entitydefs, self._encoding) - def convert_charref(self, name): - return unescape_charref("%s" % name, self._encoding) - def unescape_attr_if_required(self, name): - return name # sgmllib already did it - def unescape_attrs_if_required(self, attrs): - return attrs # ditto - else: - def unescape_attr_if_required(self, name): - return self.unescape_attr(name) - def unescape_attrs_if_required(self, attrs): - return self.unescape_attrs(attrs) - - -class FormParser(_AbstractSgmllibParser, sgmllib.SGMLParser): - """Good for tolerance of incorrect HTML, bad for XHTML.""" - def __init__(self, entitydefs=None, encoding=DEFAULT_ENCODING): - sgmllib.SGMLParser.__init__(self) - _AbstractFormParser.__init__(self, entitydefs, encoding) - - def feed(self, data): - try: - sgmllib.SGMLParser.feed(self, data) - except SGMLLIB_PARSEERROR, exc: - raise ParseError(exc) - - def close(self): - sgmllib.SGMLParser.close(self) - self.end_body() - - -# sigh, must support mechanize by allowing dynamic creation of classes based on -# its bundled copy of BeautifulSoup (which was necessary because of dependency -# problems) - -def _create_bs_classes(bs, - icbinbs, - ): - class _AbstractBSFormParser(_AbstractSgmllibParser): - bs_base_class = None - def __init__(self, entitydefs=None, encoding=DEFAULT_ENCODING): - _AbstractFormParser.__init__(self, entitydefs, encoding) - self.bs_base_class.__init__(self) - def handle_data(self, data): - _AbstractFormParser.handle_data(self, data) - self.bs_base_class.handle_data(self, data) - def feed(self, data): - try: - self.bs_base_class.feed(self, data) - except SGMLLIB_PARSEERROR, exc: - raise ParseError(exc) - def close(self): - self.bs_base_class.close(self) - self.end_body() - - class RobustFormParser(_AbstractBSFormParser, bs): - """Tries to be highly tolerant of incorrect HTML.""" - pass - RobustFormParser.bs_base_class = bs - class NestingRobustFormParser(_AbstractBSFormParser, icbinbs): - """Tries to be highly tolerant of incorrect HTML. - - Different from RobustFormParser in that it more often guesses nesting - above missing end tags (see BeautifulSoup docs). - - """ - pass - NestingRobustFormParser.bs_base_class = icbinbs - - return RobustFormParser, NestingRobustFormParser - -try: - if sys.version_info[:2] < (2, 2): - raise ImportError # BeautifulSoup uses generators - import BeautifulSoup -except ImportError: - pass -else: - RobustFormParser, NestingRobustFormParser = _create_bs_classes( - BeautifulSoup.BeautifulSoup, BeautifulSoup.ICantBelieveItsBeautifulSoup - ) - __all__ += ['RobustFormParser', 'NestingRobustFormParser'] - - -#FormParser = XHTMLCompatibleFormParser # testing hack -#FormParser = RobustFormParser # testing hack - - -def ParseResponseEx(response, - select_default=False, - form_parser_class=FormParser, - request_class=urllib2.Request, - entitydefs=None, - encoding=DEFAULT_ENCODING, - - # private - _urljoin=urlparse.urljoin, - _urlparse=urlparse.urlparse, - _urlunparse=urlparse.urlunparse, - ): - """Identical to ParseResponse, except that: - - 1. The returned list contains an extra item. The first form in the list - contains all controls not contained in any FORM element. - - 2. The arguments ignore_errors and backwards_compat have been removed. - - 3. Backwards-compatibility mode (backwards_compat=True) is not available. - """ - return _ParseFileEx(response, response.geturl(), - select_default, - False, - form_parser_class, - request_class, - entitydefs, - False, - encoding, - _urljoin=_urljoin, - _urlparse=_urlparse, - _urlunparse=_urlunparse, - ) - -def ParseFileEx(file, base_uri, - select_default=False, - form_parser_class=FormParser, - request_class=urllib2.Request, - entitydefs=None, - encoding=DEFAULT_ENCODING, - - # private - _urljoin=urlparse.urljoin, - _urlparse=urlparse.urlparse, - _urlunparse=urlparse.urlunparse, - ): - """Identical to ParseFile, except that: - - 1. The returned list contains an extra item. The first form in the list - contains all controls not contained in any FORM element. - - 2. The arguments ignore_errors and backwards_compat have been removed. - - 3. Backwards-compatibility mode (backwards_compat=True) is not available. - """ - return _ParseFileEx(file, base_uri, - select_default, - False, - form_parser_class, - request_class, - entitydefs, - False, - encoding, - _urljoin=_urljoin, - _urlparse=_urlparse, - _urlunparse=_urlunparse, - ) - -def ParseResponse(response, *args, **kwds): - """Parse HTTP response and return a list of HTMLForm instances. - - The return value of urllib2.urlopen can be conveniently passed to this - function as the response parameter. - - ClientForm.ParseError is raised on parse errors. - - response: file-like object (supporting read() method) with a method - geturl(), returning the URI of the HTTP response - select_default: for multiple-selection SELECT controls and RADIO controls, - pick the first item as the default if none are selected in the HTML - form_parser_class: class to instantiate and use to pass - request_class: class to return from .click() method (default is - urllib2.Request) - entitydefs: mapping like {"&": "&", ...} containing HTML entity - definitions (a sensible default is used) - encoding: character encoding used for encoding numeric character references - when matching link text. ClientForm does not attempt to find the encoding - in a META HTTP-EQUIV attribute in the document itself (mechanize, for - example, does do that and will pass the correct value to ClientForm using - this parameter). - - backwards_compat: boolean that determines whether the returned HTMLForm - objects are backwards-compatible with old code. If backwards_compat is - true: - - - ClientForm 0.1 code will continue to work as before. - - - Label searches that do not specify a nr (number or count) will always - get the first match, even if other controls match. If - backwards_compat is False, label searches that have ambiguous results - will raise an AmbiguityError. - - - Item label matching is done by strict string comparison rather than - substring matching. - - - De-selecting individual list items is allowed even if the Item is - disabled. - - The backwards_compat argument will be deprecated in a future release. - - Pass a true value for select_default if you want the behaviour specified by - RFC 1866 (the HTML 2.0 standard), which is to select the first item in a - RADIO or multiple-selection SELECT control if none were selected in the - HTML. Most browsers (including Microsoft Internet Explorer (IE) and - Netscape Navigator) instead leave all items unselected in these cases. The - W3C HTML 4.0 standard leaves this behaviour undefined in the case of - multiple-selection SELECT controls, but insists that at least one RADIO - button should be checked at all times, in contradiction to browser - behaviour. - - There is a choice of parsers. ClientForm.XHTMLCompatibleFormParser (uses - HTMLParser.HTMLParser) works best for XHTML, ClientForm.FormParser (uses - sgmllib.SGMLParser) (the default) works better for ordinary grubby HTML. - Note that HTMLParser is only available in Python 2.2 and later. You can - pass your own class in here as a hack to work around bad HTML, but at your - own risk: there is no well-defined interface. - - """ - return _ParseFileEx(response, response.geturl(), *args, **kwds)[1:] - -def ParseFile(file, base_uri, *args, **kwds): - """Parse HTML and return a list of HTMLForm instances. - - ClientForm.ParseError is raised on parse errors. - - file: file-like object (supporting read() method) containing HTML with zero - or more forms to be parsed - base_uri: the URI of the document (note that the base URI used to submit - the form will be that given in the BASE element if present, not that of - the document) - - For the other arguments and further details, see ParseResponse.__doc__. - - """ - return _ParseFileEx(file, base_uri, *args, **kwds)[1:] - -def _ParseFileEx(file, base_uri, - select_default=False, - ignore_errors=False, - form_parser_class=FormParser, - request_class=urllib2.Request, - entitydefs=None, - backwards_compat=True, - encoding=DEFAULT_ENCODING, - _urljoin=urlparse.urljoin, - _urlparse=urlparse.urlparse, - _urlunparse=urlparse.urlunparse, - ): - if backwards_compat: - deprecation("operating in backwards-compatibility mode", 1) - fp = form_parser_class(entitydefs, encoding) - while 1: - data = file.read(CHUNK) - try: - fp.feed(data) - except ParseError, e: - e.base_uri = base_uri - raise - if len(data) != CHUNK: break - fp.close() - if fp.base is not None: - # HTML BASE element takes precedence over document URI - base_uri = fp.base - labels = [] # Label(label) for label in fp.labels] - id_to_labels = {} - for l in fp.labels: - label = Label(l) - labels.append(label) - for_id = l["for"] - coll = id_to_labels.get(for_id) - if coll is None: - id_to_labels[for_id] = [label] - else: - coll.append(label) - forms = [] - for (name, action, method, enctype), attrs, controls in fp.forms: - if action is None: - action = base_uri - else: - action = _urljoin(base_uri, action) - # would be nice to make HTMLForm class (form builder) pluggable - form = HTMLForm( - action, method, enctype, name, attrs, request_class, - forms, labels, id_to_labels, backwards_compat) - form._urlparse = _urlparse - form._urlunparse = _urlunparse - for ii in range(len(controls)): - type, name, attrs = controls[ii] - # index=ii*10 allows ImageControl to return multiple ordered pairs - form.new_control( - type, name, attrs, select_default=select_default, index=ii*10) - forms.append(form) - for form in forms: - form.fixup() - return forms - - -class Label: - def __init__(self, attrs): - self.id = attrs.get("for") - self._text = attrs.get("__text").strip() - self._ctext = compress_text(self._text) - self.attrs = attrs - self._backwards_compat = False # maintained by HTMLForm - - def __getattr__(self, name): - if name == "text": - if self._backwards_compat: - return self._text - else: - return self._ctext - return getattr(Label, name) - - def __setattr__(self, name, value): - if name == "text": - # don't see any need for this, so make it read-only - raise AttributeError("text attribute is read-only") - self.__dict__[name] = value - - def __str__(self): - return "" % (self.id, self.text) - - -def _get_label(attrs): - text = attrs.get("__label") - if text is not None: - return Label(text) - else: - return None - -class Control: - """An HTML form control. - - An HTMLForm contains a sequence of Controls. The Controls in an HTMLForm - are accessed using the HTMLForm.find_control method or the - HTMLForm.controls attribute. - - Control instances are usually constructed using the ParseFile / - ParseResponse functions. If you use those functions, you can ignore the - rest of this paragraph. A Control is only properly initialised after the - fixup method has been called. In fact, this is only strictly necessary for - ListControl instances. This is necessary because ListControls are built up - from ListControls each containing only a single item, and their initial - value(s) can only be known after the sequence is complete. - - The types and values that are acceptable for assignment to the value - attribute are defined by subclasses. - - If the disabled attribute is true, this represents the state typically - represented by browsers by 'greying out' a control. If the disabled - attribute is true, the Control will raise AttributeError if an attempt is - made to change its value. In addition, the control will not be considered - 'successful' as defined by the W3C HTML 4 standard -- ie. it will - contribute no data to the return value of the HTMLForm.click* methods. To - enable a control, set the disabled attribute to a false value. - - If the readonly attribute is true, the Control will raise AttributeError if - an attempt is made to change its value. To make a control writable, set - the readonly attribute to a false value. - - All controls have the disabled and readonly attributes, not only those that - may have the HTML attributes of the same names. - - On assignment to the value attribute, the following exceptions are raised: - TypeError, AttributeError (if the value attribute should not be assigned - to, because the control is disabled, for example) and ValueError. - - If the name or value attributes are None, or the value is an empty list, or - if the control is disabled, the control is not successful. - - Public attributes: - - type: string describing type of control (see the keys of the - HTMLForm.type2class dictionary for the allowable values) (readonly) - name: name of control (readonly) - value: current value of control (subclasses may allow a single value, a - sequence of values, or either) - disabled: disabled state - readonly: readonly state - id: value of id HTML attribute - - """ - def __init__(self, type, name, attrs, index=None): - """ - type: string describing type of control (see the keys of the - HTMLForm.type2class dictionary for the allowable values) - name: control name - attrs: HTML attributes of control's HTML element - - """ - raise NotImplementedError() - - def add_to_form(self, form): - self._form = form - form.controls.append(self) - - def fixup(self): - pass - - def is_of_kind(self, kind): - raise NotImplementedError() - - def clear(self): - raise NotImplementedError() - - def __getattr__(self, name): raise NotImplementedError() - def __setattr__(self, name, value): raise NotImplementedError() - - def pairs(self): - """Return list of (key, value) pairs suitable for passing to urlencode. - """ - return [(k, v) for (i, k, v) in self._totally_ordered_pairs()] - - def _totally_ordered_pairs(self): - """Return list of (key, value, index) tuples. - - Like pairs, but allows preserving correct ordering even where several - controls are involved. - - """ - raise NotImplementedError() - - def _write_mime_data(self, mw, name, value): - """Write data for a subitem of this control to a MimeWriter.""" - # called by HTMLForm - mw2 = mw.nextpart() - mw2.addheader("Content-Disposition", - 'form-data; name="%s"' % name, 1) - f = mw2.startbody(prefix=0) - f.write(value) - - def __str__(self): - raise NotImplementedError() - - def get_labels(self): - """Return all labels (Label instances) for this control. - - If the control was surrounded by a